You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2016/01/07 17:36:00 UTC
[5/7] usergrid git commit: added 'isDebugEnabled' and 'isTraceEnbled'
around logging calls.
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/AbstractContextResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/AbstractContextResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/AbstractContextResource.java
index c10b20f..4cdc8e0 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/AbstractContextResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/AbstractContextResource.java
@@ -116,7 +116,9 @@ public abstract class AbstractContextResource {
public <T extends AbstractContextResource> T getSubResource(Class<T> t) {
- logger.debug("getSubResource: " + t.getCanonicalName());
+ if (logger.isDebugEnabled()) {
+ logger.debug("getSubResource: " + t.getCanonicalName());
+ }
T subResource = resourceContext.getResource(t);
subResource.setParent(this);
return subResource;
@@ -172,11 +174,15 @@ public abstract class AbstractContextResource {
String redirect_url = properties.getProperty(template_property);
if (StringUtils.isNotBlank(redirect_url)) {
- logger.debug("Redirecting to URL: ", redirect_url);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Redirecting to URL: ", redirect_url);
+ }
sendRedirect(redirect_url);
}
- logger.debug("Dispatching to viewable with template: {}",
- template, template_property);
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Dispatching to viewable with template: {}", template, template_property);
+ }
Viewable viewable = new Viewable(template, model);
return viewable;
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
index 4afccf9..4b30010 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
@@ -340,7 +340,10 @@ public class RootResource extends AbstractContextResource implements MetricProce
@Path("orgs/{organizationName}")
public OrganizationResource getOrganizationByName3( @PathParam("organizationName") String organizationName )
throws Exception {
- logger.debug("getOrganizationByName3");
+ if (logger.isDebugEnabled()) {
+ logger.debug("getOrganizationByName3");
+ }
+
return getOrganizationByName( organizationName );
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java
index a598c4f..eabebc8 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java
@@ -152,7 +152,9 @@ public class ApplicationResource extends ServiceResource {
@RequireApplicationAccess
@Path("assets")
public AssetsResource getAssetsResource( @Context UriInfo ui ) throws Exception {
- logger.debug( "in assets n applicationResource" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("in assets n applicationResource");
+ }
addParameter( getServiceParameters(), "assets" );
PathSegment ps = getFirstPathSegment( "assets" );
@@ -168,14 +170,18 @@ public class ApplicationResource extends ServiceResource {
@Path("asset")
public AssetsResource getAssetResource( @Context UriInfo ui ) throws Exception {
// TODO change to singular
- logger.debug( "in asset in applicationResource" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("in asset in applicationResource");
+ }
return getAssetsResource( ui );
}
@Path("users")
public UsersResource getUsers( @Context UriInfo ui ) throws Exception {
- logger.debug( "ApplicationResource.getUsers" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("ApplicationResource.getUsers");
+ }
addParameter( getServiceParameters(), "users" );
PathSegment ps = getFirstPathSegment( "users" );
@@ -203,7 +209,9 @@ public class ApplicationResource extends ServiceResource {
@QueryParam("ttl") long ttl, @QueryParam("redirect_uri") String redirect_uri,
@QueryParam("callback") @DefaultValue("") String callback ) throws Exception {
- logger.debug( "ApplicationResource.getAccessToken" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("ApplicationResource.getAccessToken");
+ }
User user = null;
@@ -262,7 +270,11 @@ public class ApplicationResource extends ServiceResource {
}
if ( user == null ) {
- logger.debug("Returning 400 bad request due to: " + errorDescription );
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Returning 400 bad request due to: " + errorDescription);
+ }
+
OAuthResponse response =
OAuthResponse.errorResponse( SC_BAD_REQUEST ).setError( OAuthError.TokenResponse.INVALID_GRANT )
.setErrorDescription( errorDescription ).buildJSONMessage();
@@ -300,7 +312,9 @@ public class ApplicationResource extends ServiceResource {
@FormParam("redirect_uri") String redirect_uri,
@QueryParam("callback") @DefaultValue("") String callback ) throws Exception {
- logger.debug( "ApplicationResource.getAccessTokenPost" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("ApplicationResource.getAccessTokenPost");
+ }
return getAccessToken( ui, authorization, grant_type, username, password, pin, client_id, client_secret, code,
ttl, redirect_uri, callback );
@@ -348,7 +362,9 @@ public class ApplicationResource extends ServiceResource {
@QueryParam("callback") @DefaultValue("callback") String callback )
throws Exception {
- logger.debug( "AuthResource.keys" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("AuthResource.keys");
+ }
if ( !isApplicationAdmin( Identifier.fromUUID( applicationId ) ) ) {
throw new UnauthorizedException();
@@ -370,7 +386,9 @@ public class ApplicationResource extends ServiceResource {
public ApiResponse generateKeys( @Context UriInfo ui,
@QueryParam("callback") @DefaultValue("callback") String callback ) throws Exception {
- logger.debug( "AuthResource.keys" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("AuthResource.keys");
+ }
if ( !isApplicationAdmin( Identifier.fromUUID( applicationId ) ) ) {
throw new UnauthorizedException();
@@ -432,7 +450,9 @@ public class ApplicationResource extends ServiceResource {
@FormParam("username") String username,
@FormParam("password") String password ) {
- logger.debug( "ApplicationResource /authorize: {}/{}", username, password );
+ if (logger.isDebugEnabled()) {
+ logger.debug("ApplicationResource /authorize: {}/{}", username, password);
+ }
try {
responseType = response_type;
@@ -476,7 +496,7 @@ public class ApplicationResource extends ServiceResource {
throw e;
}
catch ( Exception e ) {
- logger.debug("handleAuthorizeForm failed", e);
+ logger.error("handleAuthorizeForm failed", e);
return Response.ok( handleViewable( "error", this ) ).build() ;
}
}
@@ -543,7 +563,9 @@ public class ApplicationResource extends ServiceResource {
Class cls = Class.forName( "org.apache.usergrid.rest.applications.notifiers.NotifiersResource" );
- logger.debug( "NotifiersResource.getNotifiersResource" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("NotifiersResource.getNotifiersResource");
+ }
addParameter( getServiceParameters(), "notifiers" );
PathSegment ps = getFirstPathSegment( "notifiers" );
@@ -636,12 +658,13 @@ public class ApplicationResource extends ServiceResource {
}
final String apmConfig = new ObjectMapper().writeValueAsString(json);
+
if(logger.isDebugEnabled()){
logger.debug("Received request to set apigeeMobileConfig properties with: {}", apmConfig);
}
-
EntityManager em = emf.getEntityManager( applicationId );
+
em.setProperty(new SimpleEntityRef(Application.ENTITY_TYPE, applicationId),
APIGEE_MOBILE_APM_CONFIG_JSON_KEY,
apmConfig
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifierResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifierResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifierResource.java
index c01f6a9..284c067 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifierResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifierResource.java
@@ -63,7 +63,9 @@ public class NotifierResource extends ServiceResource {
@QueryParam("callback") @DefaultValue("callback") String callback,
FormDataMultiPart multiPart) throws Exception {
- logger.debug("NotifierResource.executePut");
+ if (logger.isDebugEnabled()) {
+ logger.debug("NotifierResource.executePut");
+ }
String name = getValueOrNull(multiPart, "name");
String provider = getValueOrNull(multiPart, "provider");
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
index 48493ce..c8ae99f 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/notifiers/NotifiersResource.java
@@ -111,7 +111,9 @@ public class NotifiersResource extends ServiceResource {
FormDataMultiPart multiPart)
throws Exception {
- logger.debug("ServiceResource.uploadData");
+ if (logger.isDebugEnabled()) {
+ logger.debug("ServiceResource.uploadData");
+ }
String name = getValueOrNull(multiPart, "name");
String provider = getValueOrNull(multiPart, "provider");
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UserResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UserResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UserResource.java
index 130658cd..77ba756 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UserResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UserResource.java
@@ -639,7 +639,9 @@ public class UserResource extends ServiceResource {
public Response getAccessToken( @Context UriInfo ui, @QueryParam("ttl") long ttl,
@QueryParam("callback") @DefaultValue("") String callback ) throws Exception {
- logger.debug( "UserResource.getAccessToken" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("UserResource.getAccessToken");
+ }
try {
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java
index 6b1aba4..81cf59a 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java
@@ -89,12 +89,12 @@ public class UsersResource extends ServiceResource {
@Path("{itemName}")
public AbstractContextResource addNameParameter( @Context UriInfo ui, @PathParam("itemName") PathSegment itemName )
throws Exception {
+
if(logger.isDebugEnabled()){
logger.debug( "ServiceResource.addNameParameter" );
logger.debug( "Current segment is " + itemName.getPath() );
}
-
if ( itemName.getPath().startsWith( "{" ) ) {
Query query = Query.fromJsonString( itemName.getPath() );
if ( query != null ) {
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/exceptions/AbstractExceptionMapper.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/exceptions/AbstractExceptionMapper.java b/stack/rest/src/main/java/org/apache/usergrid/rest/exceptions/AbstractExceptionMapper.java
index 9e0f359..26e2736 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/exceptions/AbstractExceptionMapper.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/exceptions/AbstractExceptionMapper.java
@@ -107,6 +107,7 @@ public abstract class AbstractExceptionMapper<E extends java.lang.Throwable> imp
} else if ( logger.isDebugEnabled() ) {
logger.debug( "Server Error (" + status + "):\n" + jsonResponse );
}
+
String callback = httpServletRequest.getParameter( "callback" );
if ( isJSONP() && isNotBlank( callback ) ) {
jsonResponse = wrapJSONPResponse( callback, jsonResponse );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/filters/ContentTypeFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/filters/ContentTypeFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/filters/ContentTypeFilter.java
index d79451c..b7aae50 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/filters/ContentTypeFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/filters/ContentTypeFilter.java
@@ -91,7 +91,7 @@ public class ContentTypeFilter implements Filter {
try {
chain.doFilter( newRequest, response );
} catch ( Exception e ) {
- logger.debug("Error in filter", e);
+ logger.error("Error in filter", e);
}
}
@@ -135,7 +135,9 @@ public class ContentTypeFilter implements Filter {
String path = origRequest.getRequestURI();
String method = origRequest.getMethod();
- logger.debug( "Content path is '{}'", path );
+ if (logger.isDebugEnabled()) {
+ logger.debug("Content path is '{}'", path);
+ }
// first ensure that an Accept header is set
@@ -153,8 +155,10 @@ public class ContentTypeFilter implements Filter {
// request has no body, set type to application/json
if ( ( HttpMethod.POST.equals( method ) || HttpMethod.PUT.equals( method ) )
&& !MediaType.APPLICATION_FORM_URLENCODED.equals( getContentType() ) ) {
- logger.debug("Setting content type to application/json " +
- "for POST or PUT with no content at path '{}'", path );
+ if (logger.isDebugEnabled()) {
+ logger.debug("Setting content type to application/json " +
+ "for POST or PUT with no content at path '{}'", path);
+ }
setHeader( HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON );
setHeader( HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON );
@@ -168,8 +172,10 @@ public class ContentTypeFilter implements Filter {
&& !MediaType.APPLICATION_JSON.equals( getContentType() )) {
// request appears to be JSON so set type to application/json
- logger.debug( "Setting content type to application/json " +
- "for POST or PUT with json content at path '{}'", path );
+ if (logger.isDebugEnabled()) {
+ logger.debug("Setting content type to application/json " +
+ "for POST or PUT with json content at path '{}'", path);
+ }
setHeader( HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON );
setHeader( HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON );
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
index 8fba027..11fd897 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/ManagementResource.java
@@ -453,7 +453,9 @@ public class ManagementResource extends AbstractContextResource {
@FormParam( "username" ) String username,
@FormParam( "password" ) String password ) {
- logger.debug( "ManagementResource /authorize: {}/{}", username, password );
+ if (logger.isDebugEnabled()) {
+ logger.debug("ManagementResource /authorize: {}/{}", username, password);
+ }
try {
responseType = response_type;
@@ -491,7 +493,7 @@ public class ManagementResource extends AbstractContextResource {
throw e;
}
catch ( Exception e ) {
- logger.debug("handleAuthorizeForm failed", e);
+ logger.error("handleAuthorizeForm failed", e);
return handleViewable( "error", e );
}
}
@@ -667,7 +669,7 @@ public class ManagementResource extends AbstractContextResource {
} catch (Exception e) {
timerContext.stop();
- logger.debug("Error validating external token", e);
+ logger.error("Error validating external token", e);
throw e;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
index 12fbc63..79c5030 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
@@ -76,13 +76,17 @@ public class OrganizationResource extends AbstractContextResource {
public OrganizationResource() {
- logger.debug("OrganizationResource created");
+ if (logger.isDebugEnabled()) {
+ logger.debug("OrganizationResource created");
+ }
}
public OrganizationResource init( OrganizationInfo organization ) {
this.organization = organization;
- logger.debug("OrganizationResource initialized for org {}", organization.getName());
+ if (logger.isDebugEnabled()) {
+ logger.debug("OrganizationResource initialized for org {}", organization.getName());
+ }
return this;
}
@@ -262,7 +266,9 @@ public class OrganizationResource extends AbstractContextResource {
@QueryParam("callback") @DefaultValue("callback") String callback )
throws Exception {
- logger.debug( "executePut" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("executePut");
+ }
ApiResponse response = createApiResponse();
response.setAction( "put" );
@@ -284,7 +290,9 @@ public class OrganizationResource extends AbstractContextResource {
@QueryParam("callback") @DefaultValue("") String callback )
throws OAuthSystemException {
- logger.debug( "executePostJson" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("executePostJson");
+ }
UsergridAwsCredentials uac = new UsergridAwsCredentials();
@@ -400,7 +408,9 @@ public class OrganizationResource extends AbstractContextResource {
@QueryParam("callback") @DefaultValue("callback") String callback )
throws Exception {
- logger.debug("Put configuration for organization: " + organization.getUuid());
+ if (logger.isDebugEnabled()) {
+ logger.debug("Put configuration for organization: " + organization.getUuid());
+ }
ApiResponse response = createApiResponse();
response.setAction("put organization configuration");
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java
index f48168e..ee35cb1 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java
@@ -135,7 +135,9 @@ public class OrganizationsResource extends AbstractContextResource {
@QueryParam( "callback" ) @DefaultValue( "" ) String callback )
throws Exception {
- logger.debug("newOrganization");
+ if (logger.isDebugEnabled()) {
+ logger.debug("newOrganization");
+ }
ApiResponse response = createApiResponse();
response.setAction( "new organization" );
@@ -172,7 +174,9 @@ public class OrganizationsResource extends AbstractContextResource {
@QueryParam( "callback" ) @DefaultValue( "" ) String callback )
throws Exception {
- logger.debug( "New organization: {}", organizationNameForm );
+ if (logger.isDebugEnabled()) {
+ logger.debug("New organization: {}", organizationNameForm);
+ }
String organizationName = organizationNameForm != null ? organizationNameForm : organizationNameQuery;
String username = usernameForm != null ? usernameForm : usernameQuery;
@@ -205,7 +209,9 @@ public class OrganizationsResource extends AbstractContextResource {
Preconditions.checkArgument(
StringUtils.isNotBlank( organizationName ), "The organization parameter was missing" );
- logger.debug( "New organization: {}", organizationName );
+ if (logger.isDebugEnabled()) {
+ logger.debug("New organization: {}", organizationName);
+ }
ApiResponse response = createApiResponse();
response.setAction( "new organization" );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
index cf575a5..109b194 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
@@ -502,14 +502,18 @@ public class ApplicationResource extends AbstractContextResource {
management.deleteApplication( applicationId );
- logger.debug( "ApplicationResource.delete() deleted appId = {}", applicationId);
+ if (logger.isDebugEnabled()) {
+ logger.debug("ApplicationResource.delete() deleted appId = {}", applicationId);
+ }
ApiResponse response = createApiResponse();
response.setAction( "delete" );
response.setApplication(emf.getEntityManager( applicationId ).getApplication());
response.setParams(ui.getQueryParameters());
- logger.debug( "ApplicationResource.delete() sending response ");
+ if (logger.isDebugEnabled()) {
+ logger.debug("ApplicationResource.delete() sending response ");
+ }
return response;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsResource.java
index fcd5404..c359e30 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsResource.java
@@ -111,7 +111,9 @@ public class ApplicationsResource extends AbstractContextResource {
@FormParam( "name" ) String applicationName )
throws Exception {
- logger.debug("newApplicationForOrganizationFromForm");
+ if (logger.isDebugEnabled()) {
+ logger.debug("newApplicationForOrganizationFromForm");
+ }
Preconditions.checkArgument( !isEmpty( applicationName ),
"The 'name' parameter is required and cannot be empty: " + applicationName );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
index 6f89f9e..c6f1463 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
@@ -168,8 +168,10 @@ public class ImportsResource extends AbstractContextResource {
final UUID importId = UUID.fromString( entityId.getPath() );
final Import importEntity = importService.getImport( application.getId(), importId );
- logger.debug("Loaded import entity {}:{} with state {}",
- new Object[] { importEntity.getType(), importEntity.getUuid(), importEntity.getState() } );
+ if (logger.isDebugEnabled()) {
+ logger.debug("Loaded import entity {}:{} with state {}",
+ new Object[]{importEntity.getType(), importEntity.getUuid(), importEntity.getState()});
+ }
if ( importEntity == null ) {
throw new EntityNotFoundException( "could not find import with uuid " + importId );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
index 037121b..5cfc508 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UserResource.java
@@ -243,7 +243,9 @@ public class UserResource extends AbstractContextResource {
@FormParam( "recaptcha_challenge_field" ) String challenge,
@FormParam( "recaptcha_response_field" ) String uresponse ) {
- logger.debug("handlePasswordResetForm");
+ if (logger.isDebugEnabled()) {
+ logger.debug("handlePasswordResetForm");
+ }
final boolean externalTokensEnabled =
!StringUtils.isEmpty( properties.getProperty( ManagementResource.USERGRID_CENTRAL_URL ) );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
index 6136139..41bead2 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
@@ -61,7 +61,9 @@ public class UsersResource extends AbstractContextResource {
public UsersResource() {
- logger.debug( "ManagementUsersResource initialized" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("ManagementUsersResource initialized");
+ }
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/organizations/OrganizationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/organizations/OrganizationResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/organizations/OrganizationResource.java
index 6ac7366..4d075e2 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/organizations/OrganizationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/organizations/OrganizationResource.java
@@ -129,7 +129,9 @@ public class OrganizationResource extends AbstractContextResource {
public ApplicationResource getApplicationByName( @PathParam("applicationName") String applicationName )
throws Exception {
- logger.debug("getApplicationByName: " + applicationName );
+ if (logger.isDebugEnabled()) {
+ logger.debug("getApplicationByName: " + applicationName);
+ }
if ( "options".equalsIgnoreCase( request.getMethod() ) ) {
throw new NoOpException();
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/security/SecuredResourceFilterFactory.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/security/SecuredResourceFilterFactory.java b/stack/rest/src/main/java/org/apache/usergrid/rest/security/SecuredResourceFilterFactory.java
index d57e84c..66e9ae5 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/security/SecuredResourceFilterFactory.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/security/SecuredResourceFilterFactory.java
@@ -114,8 +114,10 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
public void configure(ResourceInfo resourceInfo, FeatureContext featureContext) {
Method am = resourceInfo.getResourceMethod();
- logger.debug( "configure {} method {}",
- resourceInfo.getResourceClass().getSimpleName(), resourceInfo.getResourceMethod().getName() );
+ if (logger.isDebugEnabled()) {
+ logger.debug("configure {} method {}",
+ resourceInfo.getResourceClass().getSimpleName(), resourceInfo.getResourceMethod().getName());
+ }
if ( am.isAnnotationPresent( RequireApplicationAccess.class ) ) {
featureContext.register( ApplicationFilter.class );
@@ -147,14 +149,21 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
@Override
public void filter(ContainerRequestContext request) throws IOException {
- logger.debug( "Filtering {}", request.getUriInfo().getRequestUri().toString() );
+ if (logger.isDebugEnabled()) {
+ logger.debug("Filtering {}", request.getUriInfo().getRequestUri().toString());
+ }
if ( request.getMethod().equalsIgnoreCase( "OPTIONS" ) ) {
- logger.debug( "Skipping option request" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("Skipping option request");
+ }
}
MultivaluedMap<java.lang.String, java.lang.String> params = uriInfo.getPathParameters();
- logger.debug( "Params: {}", params.keySet() );
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Params: {}", params.keySet());
+ }
authorize( request );
}
@@ -229,14 +238,20 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
@Override
public void authorize( ContainerRequestContext request ) {
- logger.debug( "OrganizationFilter.authorize" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("OrganizationFilter.authorize");
+ }
if ( !isPermittedAccessToOrganization( getOrganizationIdentifier() ) ) {
- logger.debug("No organization access authorized");
+ if (logger.isDebugEnabled()) {
+ logger.debug("No organization access authorized");
+ }
throw mappableSecurityException( "unauthorized", "No organization access authorized" );
}
- logger.debug( "OrganizationFilter.authorize - leaving" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("OrganizationFilter.authorize - leaving");
+ }
}
}
@@ -269,7 +284,9 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
@Override
public void authorize( ContainerRequestContext request ) {
- logger.debug( "ApplicationFilter.authorize" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("ApplicationFilter.authorize");
+ }
if ( SubjectUtils.isAnonymous() ) {
ApplicationInfo application = null;
try {
@@ -283,7 +300,9 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
Map<String, String> roles = null;
try {
roles = em.getRoles();
- logger.debug( "found roles {}", roles );
+ if (logger.isDebugEnabled()) {
+ logger.debug("found roles {}", roles);
+ }
}
catch ( Exception e ) {
logger.error( "Unable retrieve roles", e );
@@ -313,15 +332,21 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
@Override
public void authorize(ContainerRequestContext request) {
- logger.debug( "SystemFilter.authorize" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("SystemFilter.authorize");
+ }
try {
if (!request.getSecurityContext().isUserInRole( ROLE_SERVICE_ADMIN )) {
- logger.debug( "You are not the system admin." );
+ if (logger.isDebugEnabled()) {
+ logger.debug("You are not the system admin.");
+ }
throw mappableSecurityException( "unauthorized", "No system access authorized",
SecurityException.REALM );
}
} catch (IllegalStateException e) {
- logger.debug( "This is an invalid state", e );
+ if (logger.isDebugEnabled()) {
+ logger.debug("This is an invalid state", e);
+ }
if ((request.getSecurityContext().getUserPrincipal() == null) ||
!ROLE_SERVICE_ADMIN.equals( request.getSecurityContext().getUserPrincipal().getName() )) {
throw mappableSecurityException( "unauthorized", "No system access authorized",
@@ -340,7 +365,9 @@ public class SecuredResourceFilterFactory implements DynamicFeature {
@Override
public void authorize(ContainerRequestContext request) {
- logger.debug( "AdminUserFilter.authorize" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("AdminUserFilter.authorize");
+ }
if (!isUser( getUserIdentifier() )) {
throw mappableSecurityException( "unauthorized", "No admin user access authorized" );
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/BasicAuthSecurityFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/BasicAuthSecurityFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/BasicAuthSecurityFilter.java
index 1643501..c0e278c 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/BasicAuthSecurityFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/BasicAuthSecurityFilter.java
@@ -65,7 +65,9 @@ public class BasicAuthSecurityFilter extends SecurityFilter {
if ( name.equals( sysadmin_login_name ) && password.equals( sysadmin_login_password )
&& sysadmin_login_allowed ) {
request.setSecurityContext( new SysAdminRoleAuthenticator() );
- logger.debug( "System administrator access allowed" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("System administrator access allowed");
+ }
}
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/ClientCredentialsSecurityFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/ClientCredentialsSecurityFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/ClientCredentialsSecurityFilter.java
index eb982b8..c15c823 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/ClientCredentialsSecurityFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/ClientCredentialsSecurityFilter.java
@@ -51,7 +51,9 @@ public class ClientCredentialsSecurityFilter extends SecurityFilter {
@Override
public void filter( ContainerRequestContext request ) {
- logger.debug("Filtering: " + request.getUriInfo().getBaseUri());
+ if (logger.isDebugEnabled()) {
+ logger.debug("Filtering: " + request.getUriInfo().getBaseUri());
+ }
String clientId = httpServletRequest.getParameter( "client_id" );
String clientSecret = httpServletRequest.getParameter( "client_secret" );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/OAuth2AccessTokenSecurityFilter.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/OAuth2AccessTokenSecurityFilter.java b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/OAuth2AccessTokenSecurityFilter.java
index 4bb0c83..7cb96f8 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/OAuth2AccessTokenSecurityFilter.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/security/shiro/filters/OAuth2AccessTokenSecurityFilter.java
@@ -70,7 +70,9 @@ public class OAuth2AccessTokenSecurityFilter extends SecurityFilter implements C
@Override
public void filter(ContainerRequestContext request) throws IOException {
- logger.debug("Filtering: " + request.getUriInfo().getBaseUri());
+ if (logger.isDebugEnabled()) {
+ logger.debug("Filtering: " + request.getUriInfo().getBaseUri());
+ }
try {
try {
@@ -105,6 +107,7 @@ public class OAuth2AccessTokenSecurityFilter extends SecurityFilter implements C
// token is just some rubbish string
throw mappableSecurityException( BAD_ACCESS_TOKEN_ERROR );
} catch (Exception e) {
+
if (logger.isDebugEnabled()) {
logger.debug( "Unable to verify OAuth token: " + accessToken, e );
} else {
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/main/java/org/apache/usergrid/rest/system/MigrateResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/system/MigrateResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/system/MigrateResource.java
index 7a6100b..ca9933c 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/system/MigrateResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/system/MigrateResource.java
@@ -167,7 +167,9 @@ public class MigrateResource extends AbstractContextResource {
@QueryParam( "callback" ) @DefaultValue( "" ) String callback )
throws Exception {
- logger.debug( "setMigrationVersion" );
+ if (logger.isDebugEnabled()) {
+ logger.debug("setMigrationVersion");
+ }
Preconditions.checkNotNull( json, "You must provide a json body" );
Preconditions.checkArgument( json.keySet().size() > 0, "You must specify at least one module and version" );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
index 55c95b7..42cdacb 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
@@ -87,7 +87,9 @@ public class GeoPagingTest extends AbstractRestIT {
//retrieve it again from the database
activity = this.app().collection("groups").entity(activity).get();
index[i] = (Long) activity.get("created");
- log.debug("Activity {} created at {}", i, index[i]);
+ if (log.isDebugEnabled()) {
+ log.debug("Activity {} created at {}", i, index[i]);
+ }
}
this.refreshIndex();
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
index 60b872d..c390393 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
@@ -665,7 +665,9 @@ public class ImportResourceIT extends AbstractRestIT {
break;
}
- logger.debug("Waiting for import...");
+ if (logger.isDebugEnabled()) {
+ logger.debug("Waiting for import...");
+ }
Thread.sleep(1000);
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ClientSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ClientSetup.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ClientSetup.java
index fb597e2..25aa7aa 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ClientSetup.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ClientSetup.java
@@ -36,7 +36,7 @@ import java.io.IOException;
*/
public class ClientSetup implements TestRule {
- private Logger logger = LoggerFactory.getLogger( ClientSetup.class );
+ private Logger logger = LoggerFactory.getLogger(ClientSetup.class);
RestClient restClient;
@@ -54,25 +54,24 @@ public class ClientSetup implements TestRule {
protected Entity application;
- public ClientSetup (String serverUrl) {
+ public ClientSetup(String serverUrl) {
- restClient = new RestClient( serverUrl );
+ restClient = new RestClient(serverUrl);
}
- public Statement apply( Statement base, Description description ) {
- return statement( base, description );
+ public Statement apply(Statement base, Description description) {
+ return statement(base, description);
}
- private Statement statement( final Statement base, final Description description ) {
+ private Statement statement(final Statement base, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
- before( description );
+ before(description);
try {
base.evaluate();
- }
- finally {
+ } finally {
cleanup();
}
}
@@ -85,7 +84,7 @@ public class ClientSetup implements TestRule {
}
- protected void before( Description description ) throws IOException {
+ protected void before(Description description) throws IOException {
String testClass = description.getTestClass().getName();
String methodName = description.getMethodName();
String name = testClass + "." + methodName;
@@ -93,48 +92,56 @@ public class ClientSetup implements TestRule {
try {
restClient.superuserSetup();
superuserToken = restClient.management().token().get(superuserName, superuserPassword);
- } catch ( BadRequestException e ) {
- if ( logger.isDebugEnabled() ) {
- logger.debug( "Error creating superuser, may already exist", e );
- } else {
- logger.warn( "Error creating superuser, may already exist");
- }
+ } catch (BadRequestException e) {
+ logger.warn("Error creating superuser, may already exist");
}
- username = "user_"+name + UUIDUtils.newTimeUUID();
+ username = "user_" + name + UUIDUtils.newTimeUUID();
password = username;
- orgName = "org_"+name+UUIDUtils.newTimeUUID();
- appName = "app_"+name+UUIDUtils.newTimeUUID();
+ orgName = "org_" + name + UUIDUtils.newTimeUUID();
+ appName = "app_" + name + UUIDUtils.newTimeUUID();
organization = restClient.management().orgs().post(
- new Organization( orgName, username, username + "@usergrid.com", username, password, null ) );
+ new Organization(orgName, username, username + "@usergrid.com", username, password, null));
- restClient.management().token().get(username,password);
+ restClient.management().token().get(username, password);
- clientCredentials = restClient.management().orgs().org( orgName ).credentials().get(Credentials.class);
+ clientCredentials = restClient.management().orgs().org(orgName).credentials().get(Credentials.class);
ApiResponse appResponse = restClient.management().orgs()
- .org( organization.getName() ).app().post(new Application(appName));
- appUuid = ( String ) appResponse.getEntities().get( 0 ).get( "uuid" );
- application = new Application( appResponse );
+ .org(organization.getName()).app().post(new Application(appName));
+ appUuid = (String) appResponse.getEntities().get(0).get("uuid");
+ application = new Application(appResponse);
refreshIndex();
ApiResponse response = restClient.management().token().post(new Token(username, password));
refreshIndex();
}
- public String getUsername(){return username;}
+ public String getUsername() {
+ return username;
+ }
- public String getEmail(){return username+"@usergrid.com";}
+ public String getEmail() {
+ return username + "@usergrid.com";
+ }
- public String getPassword(){return password;}
+ public String getPassword() {
+ return password;
+ }
- public Organization getOrganization(){return organization;}
+ public Organization getOrganization() {
+ return organization;
+ }
- public String getOrganizationName(){return orgName;}
+ public String getOrganizationName() {
+ return orgName;
+ }
- public String getAppName() {return appName;}
+ public String getAppName() {
+ return appName;
+ }
public String getAppUuid() {
return appUuid;
@@ -157,15 +164,15 @@ public class ClientSetup implements TestRule {
}
public void refreshIndex() {
- this.restClient.refreshIndex(getOrganizationName(),getAppName(),
+ this.restClient.refreshIndex(getOrganizationName(), getAppName(),
CpNamingUtils.getManagementApplicationId().getUuid().toString());
- if(!CpNamingUtils.getManagementApplicationId().getUuid().toString().equals(getAppUuid())) {
+ if (!CpNamingUtils.getManagementApplicationId().getUuid().toString().equals(getAppUuid())) {
this.restClient.refreshIndex(getOrganizationName(), getAppName(), getAppUuid());
}
}
- public RestClient getRestClient(){
+ public RestClient getRestClient() {
return restClient;
}
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
index 958079c..ad5d9a6 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
@@ -133,7 +133,9 @@ public class CollectionEndpoint extends NamedResource {
.accept( acceptHeader )
.get(String.class);
- logger.debug("Response from get: " + responseString);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Response from get: " + responseString);
+ }
ObjectMapper mapper = new ObjectMapper();
org.apache.usergrid.rest.test.resource.model.ApiResponse response;
@@ -246,7 +248,9 @@ public class CollectionEndpoint extends NamedResource {
.accept(acceptHeader)
.post( javax.ws.rs.client.Entity.json( payload ), String.class);
- logger.debug("Response from post: " + responseString);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Response from post: " + responseString);
+ }
ObjectMapper mapper = new ObjectMapper();
org.apache.usergrid.rest.test.resource.model.ApiResponse response;
@@ -274,7 +278,9 @@ public class CollectionEndpoint extends NamedResource {
.accept( acceptHeader )
.post( javax.ws.rs.client.Entity.json( null ), String.class);
- logger.debug("Response from post: " + responseString);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Response from post: " + responseString);
+ }
ObjectMapper mapper = new ObjectMapper();
org.apache.usergrid.rest.test.resource.model.ApiResponse response;
@@ -303,7 +309,9 @@ public class CollectionEndpoint extends NamedResource {
.accept( acceptHeader )
.post( javax.ws.rs.client.Entity.json( entityList ), String.class);
- logger.debug("Response from post: " + responseString);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Response from post: " + responseString);
+ }
ObjectMapper mapper = new ObjectMapper();
org.apache.usergrid.rest.test.resource.model.ApiResponse response;
@@ -352,7 +360,9 @@ public class CollectionEndpoint extends NamedResource {
.accept(acceptHeader)
.post( javax.ws.rs.client.Entity.json( entity ), String.class);
- logger.debug("Response from put: " + responseString);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Response from put: " + responseString);
+ }
ObjectMapper mapper = new ObjectMapper();
org.apache.usergrid.rest.test.resource.model.ApiResponse response;
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationResource.java
index 4b9d195..079bdd5 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationResource.java
@@ -75,7 +75,9 @@ public class ApplicationResource extends NamedResource {
.accept(MediaType.APPLICATION_JSON)
.post( javax.ws.rs.client.Entity.json(payload), String.class);
- logger.debug("Response from post: " + responseString);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Response from post: " + responseString);
+ }
org.apache.usergrid.rest.test.resource.model.ApiResponse response;
try {
@@ -97,7 +99,9 @@ public class ApplicationResource extends NamedResource {
.accept(MediaType.APPLICATION_JSON)
.get(String.class);
- logger.debug("Response from post: " + responseString);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Response from post: " + responseString);
+ }
org.apache.usergrid.rest.test.resource.model.ApiResponse response;
try {
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
index 4d7b2f9..a52ae81 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
@@ -86,7 +86,9 @@ public class OrgResource extends NamedResource {
.accept( MediaType.APPLICATION_JSON )
.post( Entity.json( null ), String.class );
- logger.debug("Response from post: " + responseString);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Response from post: " + responseString);
+ }
ObjectMapper mapper = new ObjectMapper();
ApiResponse response;
@@ -135,10 +137,13 @@ public class OrgResource extends NamedResource {
.accept( MediaType.APPLICATION_JSON )
.post( Entity.json( organization ), String.class );
- logger.debug("Response from put: " + responseString);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Response from put: " + responseString);
+ }
ObjectMapper mapper = new ObjectMapper();
ApiResponse response;
+
try {
response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
} catch (IOException e) {
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/services/src/main/java/org/apache/usergrid/management/AppInfoMigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/AppInfoMigrationPlugin.java b/stack/services/src/main/java/org/apache/usergrid/management/AppInfoMigrationPlugin.java
index 6e84601..32e8583 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/AppInfoMigrationPlugin.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/AppInfoMigrationPlugin.java
@@ -142,7 +142,11 @@ public class AppInfoMigrationPlugin implements MigrationPlugin {
final int version = migrationInfoSerialization.getVersion( getName() );
if ( version == getMaxVersion() ) {
- logger.debug( "Skipping Migration Plugin: " + getName() );
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("Skipping Migration Plugin: " + getName());
+ }
+
return;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/af9d81e0/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index af70966..3d1eae8 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -1243,11 +1243,14 @@ public class ManagementServiceImpl implements ManagementService {
for ( EntityRef orgRef : orgResults.getRefs() ) {
Map properties = em.getDictionaryAsMap( orgRef, ORGANIZATION_PROPERTIES_DICTIONARY );
+
if ( properties != null ) {
OrganizationInfo orgInfo = new OrganizationInfo( null, null, properties );
+
if(logger.isDebugEnabled()){
logger.debug( " orgInfo.getPasswordHistorySize() = " + orgInfo.getPasswordHistorySize() );
}
+
size = Math.max( orgInfo.getPasswordHistorySize(), size );
}
}