diff --git a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/connection/ConnectionRESTService.java b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/connection/ConnectionRESTService.java index acfca2b1a..05228b178 100644 --- a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/connection/ConnectionRESTService.java +++ b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/connection/ConnectionRESTService.java @@ -97,7 +97,7 @@ public class ConnectionRESTService { } if(parentConnectionGroup == null) - throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID."); + throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided parentID."); Directory connectionDirectory = parentConnectionGroup.getConnectionDirectory(); @@ -112,9 +112,9 @@ public class ConnectionRESTService { return connectionService.convertConnectionList(connections); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while listing connections.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -145,13 +145,13 @@ public class ConnectionRESTService { Connection connection = connectionDirectory.get(connectionID); if(connection == null) - throw new GuacamoleClientException("No Connection found with the provided ID."); + throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided parentID."); return new APIConnection(connection); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while getting connection.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -178,14 +178,14 @@ public class ConnectionRESTService { // Make sure the connection is there before trying to delete if(connectionDirectory.get(connectionID) == null) - throw new GuacamoleClientException("No Connection found with the provided ID."); + throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided ID."); // Delete the connection connectionDirectory.remove(connectionID); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while deleting connection.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -225,7 +225,7 @@ public class ConnectionRESTService { } if(parentConnectionGroup == null) - throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID."); + throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided parentID."); Directory connectionDirectory = parentConnectionGroup.getConnectionDirectory(); @@ -236,9 +236,9 @@ public class ConnectionRESTService { // Return the new connection identifier return connection.getIdentifier(); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while creating connection.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -270,14 +270,14 @@ public class ConnectionRESTService { // Make sure the connection is there before trying to update if(connectionDirectory.get(connectionID) == null) - throw new GuacamoleClientException("No Connection with the provided ID."); + throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided ID."); // Update the connection connectionDirectory.update(new APIConnectionWrapper(connection)); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught updating connection.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -310,14 +310,14 @@ public class ConnectionRESTService { ConnectionGroup parentConnectionGroup = connectionGroupDirectory.get(parentID); if(parentConnectionGroup == null) - throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID."); + throw new HTTPException(Status.NOT_FOUND, "No Connection found with the provided parentID."); // Move the connection connectionDirectory.move(connectionID, parentConnectionGroup.getConnectionDirectory()); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught moving connection.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); diff --git a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/connectiongroup/ConnectionGroupRESTService.java b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/connectiongroup/ConnectionGroupRESTService.java index 825fdd290..8b71b58fa 100644 --- a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/connectiongroup/ConnectionGroupRESTService.java +++ b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/connectiongroup/ConnectionGroupRESTService.java @@ -96,7 +96,7 @@ public class ConnectionGroupRESTService { } if(parentConnectionGroup == null) - throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID."); + throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided parentID."); Directory connectionGroupDirectory = parentConnectionGroup.getConnectionGroupDirectory(); @@ -111,9 +111,9 @@ public class ConnectionGroupRESTService { return connectionGroupService.convertConnectionGroupList(connectionGroups); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while listing connection groups.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -144,13 +144,13 @@ public class ConnectionGroupRESTService { ConnectionGroup connectionGroup = connectionGroupDirectory.get(connectionGroupID); if(connectionGroup == null) - throw new GuacamoleClientException("No ConnectionGroup found with the provided ID."); + throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided ID."); return new APIConnectionGroup(connectionGroup); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while getting connection group.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -177,14 +177,14 @@ public class ConnectionGroupRESTService { // Make sure the connection is there before trying to delete if(connectionGroupDirectory.get(connectionGroupID) == null) - throw new GuacamoleClientException("No Connection found with the provided ID."); + throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided ID."); // Delete the connection group connectionGroupDirectory.remove(connectionGroupID); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while deleting connection group.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -224,7 +224,7 @@ public class ConnectionGroupRESTService { } if(parentConnectionGroup == null) - throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID."); + throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided parentID."); Directory connectionGroupDirectory = parentConnectionGroup.getConnectionGroupDirectory(); @@ -235,9 +235,9 @@ public class ConnectionGroupRESTService { // Return the new connection group identifier return connectionGroup.getIdentifier(); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while creating connection.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -269,14 +269,14 @@ public class ConnectionGroupRESTService { // Make sure the connection group is there before trying to update if(connectionGroupDirectory.get(connectionGroupID) == null) - throw new GuacamoleClientException("No ConnectionGroup with the provided ID."); + throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided ID."); // Update the connection group connectionGroupDirectory.update(new APIConnectionGroupWrapper(connectionGroup)); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught updating connection.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -308,15 +308,15 @@ public class ConnectionGroupRESTService { Directory newConnectionGroupDirectory = rootGroup.getConnectionGroupDirectory(); ConnectionGroup parentConnectionGroup = newConnectionGroupDirectory.get(parentID); - if(newConnectionGroupDirectory == null) - throw new GuacamoleClientException("No ConnectionGroup found with the provided parentID."); + if(parentConnectionGroup == null) + throw new HTTPException(Status.NOT_FOUND, "No ConnectionGroup found with the provided parentID."); // Move the connection connectionGroupDirectory.move(connectionGroupID, parentConnectionGroup.getConnectionGroupDirectory()); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught moving connection.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); diff --git a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/permission/PermissionRESTService.java b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/permission/PermissionRESTService.java index 1c9043c4b..10fccb85d 100644 --- a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/permission/PermissionRESTService.java +++ b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/permission/PermissionRESTService.java @@ -89,9 +89,9 @@ public class PermissionRESTService { return permissionService.convertPermissionList(user.getPermissions()); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while listing permissions.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -122,9 +122,9 @@ public class PermissionRESTService { // Add the new permission user.addPermission(permission.toPermission()); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught adding permission.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -155,9 +155,9 @@ public class PermissionRESTService { // Remove the permission user.removePermission(permission.toPermission()); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught adding permission.", e); throw new HTTPException(Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); diff --git a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/user/UserRESTService.java b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/user/UserRESTService.java index d5b9397f6..be3704ac3 100644 --- a/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/user/UserRESTService.java +++ b/guacamole/src/main/java/org/glyptodon/guacamole/net/basic/rest/user/UserRESTService.java @@ -86,9 +86,9 @@ public class UserRESTService { // Convert and return the user directory listing return userService.convertUserList(userDirectory); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while listing permissions.", e); throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -119,9 +119,9 @@ public class UserRESTService { // Return the user return new APIUser(user); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while listing permissions.", e); throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -147,9 +147,9 @@ public class UserRESTService { return user.getUsername(); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while listing permissions.", e); throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -187,9 +187,9 @@ public class UserRESTService { */ userDirectory.update(new APIUserWrapper(user, existingUser.getPermissions())); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while listing permissions.", e); throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error."); @@ -220,9 +220,9 @@ public class UserRESTService { // Delete the user userDirectory.remove(userID); } catch(GuacamoleSecurityException e) { - throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); + throw new HTTPException(Response.Status.UNAUTHORIZED, e.getMessage() != null ? e.getMessage() : "Permission denied."); } catch(GuacamoleClientException e) { - throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); + throw new HTTPException(Response.Status.BAD_REQUEST, e.getMessage() != null ? e.getMessage() : "Invalid Request."); } catch(GuacamoleException e) { logger.error("Unexpected GuacamoleException caught while listing permissions.", e); throw new HTTPException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage() != null ? e.getMessage() : "Unexpected server error.");