cleaned up error log messages

pull/347/head
Justin Richer 2013-06-06 13:44:50 -04:00
parent 1b601abd6f
commit dc9d5c667e
7 changed files with 18 additions and 20 deletions

View File

@ -72,7 +72,7 @@ public class IntrospectionEndpoint {
try {
token = tokenServices.readAccessToken(tokenValue);
} catch (InvalidTokenException e) {
logger.error("Verify failed; AuthenticationException: " + e.getStackTrace().toString());
logger.error("Verify failed; AuthenticationException", e);
Map<String,Boolean> entity = ImmutableMap.of("valid", Boolean.FALSE);
model.addAttribute("entity", entity);
return "jsonEntityView";

View File

@ -85,13 +85,11 @@ public class OAuthConfirmationController {
try {
client = clientService.loadClientByClientId(clientAuth.getClientId());
} catch (OAuth2Exception e) {
logger.error("confirmAccess: OAuth2Exception was thrown when attempting to load client: "
+ e.getStackTrace().toString());
logger.error("confirmAccess: OAuth2Exception was thrown when attempting to load client", e);
model.put("code", HttpStatus.BAD_REQUEST);
return "httpCodeView";
} catch (IllegalArgumentException e) {
logger.error("confirmAccess: IllegalArgumentException was thrown when attempting to load client: "
+ e.getStackTrace().toString());
logger.error("confirmAccess: IllegalArgumentException was thrown when attempting to load client", e);
model.put("code", HttpStatus.BAD_REQUEST);
return "httpCodeView";
}

View File

@ -146,7 +146,7 @@ public class ScopeAPI {
logger.error("createScope failed; JSON was invalid: " + json);
m.put("code", HttpStatus.BAD_REQUEST);
m.put("errorMessage", "Could not save new scope " + scope.getValue() + ". The scope service failed to return a saved entity.");
m.put("errorMessage", "Could not save new scope " + scope + ". The scope service failed to return a saved entity.");
return "jsonErrorView";
}

View File

@ -96,12 +96,12 @@ public class BlacklistAPI {
}
catch (JsonSyntaxException e) {
logger.error("addNewBlacklistedSite failed due to JsonSyntaxException: " + e.getStackTrace().toString());
logger.error("addNewBlacklistedSite failed due to JsonSyntaxException: ", e);
m.put("code", HttpStatus.BAD_REQUEST);
m.put("errorMessage", "Could not save new blacklisted site. The server encountered a JSON syntax exception. Contact a system administrator for assistance.");
return "jsonErrorView";
} catch (IllegalStateException e) {
logger.error("addNewBlacklistedSite failed due to IllegalStateException: " + e.getStackTrace().toString());
logger.error("addNewBlacklistedSite failed due to IllegalStateException", e);
m.put("code", HttpStatus.BAD_REQUEST);
m.put("errorMessage", "Could not save new blacklisted site. The server encountered an IllegalStateException. Refresh and try again - if the problem persists, contact a system administrator for assistance.");
return "jsonErrorView";
@ -128,12 +128,12 @@ public class BlacklistAPI {
}
catch (JsonSyntaxException e) {
logger.error("updateBlacklistedSite failed due to JsonSyntaxException: " + e.getStackTrace().toString());
logger.error("updateBlacklistedSite failed due to JsonSyntaxException", e);
m.put("code", HttpStatus.BAD_REQUEST);
m.put("errorMessage", "Could not update blacklisted site. The server encountered a JSON syntax exception. Contact a system administrator for assistance.");
return "jsonErrorView";
} catch (IllegalStateException e) {
logger.error("updateBlacklistedSite failed due to IllegalStateException: " + e.getStackTrace().toString());
logger.error("updateBlacklistedSite failed due to IllegalStateException", e);
m.put("code", HttpStatus.BAD_REQUEST);
m.put("errorMessage", "Could not update blacklisted site. The server encountered an IllegalStateException. Refresh and try again - if the problem persists, contact a system administrator for assistance.");
return "jsonErrorView";

View File

@ -137,12 +137,12 @@ public class ClientAPI {
client = gson.fromJson(json, ClientDetailsEntity.class);
}
catch (JsonSyntaxException e) {
logger.error("apiAddClient failed due to JsonSyntaxException: " + e.getStackTrace().toString());
logger.error("apiAddClient failed due to JsonSyntaxException", e);
m.addAttribute("code", HttpStatus.BAD_REQUEST);
m.addAttribute("errorMessage", "Could not save new client. The server encountered a JSON syntax exception. Contact a system administrator for assistance.");
return "jsonErrorView";
} catch (IllegalStateException e) {
logger.error("apiAddClient failed due to IllegalStateException: " + e.getStackTrace().toString());
logger.error("apiAddClient failed due to IllegalStateException", e);
m.addAttribute("code", HttpStatus.BAD_REQUEST);
m.addAttribute("errorMessage", "Could not save new client. The server encountered an IllegalStateException. Refresh and try again - if the problem persists, contact a system administrator for assistance.");
return "jsonErrorView";
@ -194,12 +194,12 @@ public class ClientAPI {
client = gson.fromJson(json, ClientDetailsEntity.class);
}
catch (JsonSyntaxException e) {
logger.error("apiUpdateClient failed due to JsonSyntaxException: " + e.getStackTrace().toString());
logger.error("apiUpdateClient failed due to JsonSyntaxException", e);
m.addAttribute("code", HttpStatus.BAD_REQUEST);
m.addAttribute("errorMessage", "Could not update client. The server encountered a JSON syntax exception. Contact a system administrator for assistance.");
return "jsonErrorView";
} catch (IllegalStateException e) {
logger.error("apiUpdateClient failed due to IllegalStateException: " + e.getStackTrace().toString());
logger.error("apiUpdateClient failed due to IllegalStateException", e);
m.addAttribute("code", HttpStatus.BAD_REQUEST);
m.addAttribute("errorMessage", "Could not update client. The server encountered an IllegalStateException. Refresh and try again - if the problem persists, contact a system administrator for assistance.");
return "jsonErrorView";

View File

@ -65,12 +65,12 @@ public class RequestObjectAuthorizationEndpoint {
query = uri.getRawQuery();//uri.toString();
} catch (ParseException e) {
logger.error("ParseException while attempting to authorize request object: " + e.getStackTrace().toString());
logger.error("ParseException while attempting to authorize request object", e);
mav.addObject("code", HttpStatus.BAD_REQUEST);
return "httpCodeView";
} catch (URISyntaxException e) {
logger.error("URISyntaxError while attempting to authorize request object: " + e.getStackTrace().toString());
logger.error("URISyntaxError while attempting to authorize request object", e);
mav.addObject("code", HttpStatus.BAD_REQUEST);
return "httpCodeView";
}

View File

@ -92,12 +92,12 @@ public class WhitelistAPI {
whitelist = gson.fromJson(json, WhitelistedSite.class);
} catch (JsonParseException e) {
logger.error("addNewWhitelistedSite failed due to JsonParseException: " + e.getStackTrace().toString());
logger.error("addNewWhitelistedSite failed due to JsonParseException", e);
m.addAttribute("code", HttpStatus.BAD_REQUEST);
m.addAttribute("errorMessage", "Could not save new whitelisted site. The server encountered a JSON syntax exception. Contact a system administrator for assistance.");
return "jsonErrorView";
} catch (IllegalStateException e) {
logger.error("addNewWhitelistedSite failed due to IllegalStateException: " + e.getStackTrace().toString());
logger.error("addNewWhitelistedSite failed due to IllegalStateException", e);
m.addAttribute("code", HttpStatus.BAD_REQUEST);
m.addAttribute("errorMessage", "Could not save new whitelisted site. The server encountered an IllegalStateException. Refresh and try again - if the problem persists, contact a system administrator for assistance.");
return "jsonErrorView";
@ -129,12 +129,12 @@ public class WhitelistAPI {
whitelist = gson.fromJson(json, WhitelistedSite.class);
} catch (JsonParseException e) {
logger.error("updateWhitelistedSite failed due to JsonParseException: " + e.getStackTrace().toString());
logger.error("updateWhitelistedSite failed due to JsonParseException", e);
m.put("code", HttpStatus.BAD_REQUEST);
m.put("errorMessage", "Could not update whitelisted site. The server encountered a JSON syntax exception. Contact a system administrator for assistance.");
return "jsonErrorView";
} catch (IllegalStateException e) {
logger.error("updateWhitelistedSite failed due to IllegalStateException: " + e.getStackTrace().toString());
logger.error("updateWhitelistedSite failed due to IllegalStateException", e);
m.put("code", HttpStatus.BAD_REQUEST);
m.put("errorMessage", "Could not update whitelisted site. The server encountered an IllegalStateException. Refresh and try again - if the problem persists, contact a system administrator for assistance.");
return "jsonErrorView";