}
}
// Error - MediaItem ID not found
if (!found) {
throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "MediaItem ID " + mediaItemId + " does not exist within Album " + albumId);
}
}
// Return found MediaItems
return ImmediateFuture.newInstance(new RestfulCollection<MediaItem>(result));
}
// Table doesn't exist for user
throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "MediaItem table not found for user " + user);
} catch (JSONException je) {
throw new ProtocolException(
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
je.getMessage(), je);
}
}