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