Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Commit

Permalink
Bugfix - Improved error handling (PermissionException)
Browse files Browse the repository at this point in the history
  • Loading branch information
oucs0130 committed Jan 31, 2012
1 parent 2d98281 commit 4ea5767
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ public List<ResourceDetails> getResources(EntityView view, Map<String, Object> p

// This is all more complicated because entitybroker isn't very flexible and announcements can only be loaded once you've got the
// channel in which they reside first.

String userId = developerHelperService.getCurrentUserId();
if (userId == null) {
throw new SecurityException(
"This action is not accessible to anon and there is no current user.");
}

Map<String, Object> parameters = getQueryMap((String)params.get("queryString"));
Time timeStamp = getTime((String)parameters.get(PARAMETER_TIMESTAMP));
Expand Down Expand Up @@ -295,18 +301,15 @@ public List<ResourceDetails> getResources(EntityView view, Map<String, Object> p

try {
collection = contentHostingService.getCollection(groupUrl);
}
catch (IdUnusedException e) {
log.error("IdUnusedException in Resource Entity Provider");
log.error(e.getStackTrace());
}
catch (TypeException e) {
log.error("TypeException in Resource Entity Provider");
log.error(e.getStackTrace());
}
catch (PermissionException e) {
log.error("PermissionException in Resource Entity Provider");
log.error(e.getStackTrace());

} catch (IdUnusedException e) {
throw new IllegalArgumentException("IdUnusedException in Resource Entity Provider");

} catch (TypeException e) {
throw new IllegalArgumentException("TypeException in Resource Entity Provider");

} catch (PermissionException e) {
throw new SecurityException("PermissionException in Resource Entity Provider");
}

List<ResourceDetails> resourceDetails = new ArrayList<ResourceDetails>();
Expand Down

0 comments on commit 4ea5767

Please sign in to comment.