Skip to content

Commit

Permalink
cloud manager report fix WrongLogLevelInCatchBlock issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailNavitski committed Apr 2, 2024
1 parent e6b0676 commit e055273
Show file tree
Hide file tree
Showing 17 changed files with 24 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
- #3295 - Updated the annotations in QueryReportConfig fixing the query manager issue due to empty query language
- #3284 - Allow anonymous to read redirect caconfig options
- #2854 - Code optimization: convert class fields to local variables
- #3301 - CM report fix WrongLogLevelInCatchBlock issue

## 6.4.0 - 2024-02-22

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ private JsonObject process(@NotNull final String actionUrl,
URIBuilder builder = new URIBuilder(actionUrl);
queryParameters.forEach((k, v) -> builder.addParameter(k, v));
uri = builder.build();
} catch(URISyntaxException uriexception) {
LOGGER.error(uriexception.getMessage());

} catch(URISyntaxException uriException) {
LOGGER.error("Unable to process the actionURL: {} using uriBuilder", actionUrl, uriException);
return new JsonObject();
}

Expand All @@ -223,11 +223,9 @@ private JsonObject process(@NotNull final String actionUrl,
}
}
catch (IOException ioexception) {
LOGGER.error(ioexception.getMessage());
LOGGER.error("Unable to process the request", ioexception);
return new JsonObject();

}

}

private JsonObject processGet(@NotNull final URI uri, String[] headers) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private String fetchAccessToken() {
LOGGER.error("JSON does not contain an access_token");
}
} catch (Exception e) {
LOGGER.error(e.getMessage());
LOGGER.error("Unable to fetch the access token", e);
}

LOGGER.info("JWT Access Token : {}", token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static void setResourceResolverOn(ResourceResolver resolver, Query query)
try {
internalSetResourceResolverOn(resolver, query);
} catch (NoSuchFieldException | IllegalAccessException e) {
log.debug("Could not set ResourceResolver on provided Query: {} => {}",
log.error("Could not set ResourceResolver on provided Query: {} => {}",
e.getClass().getName(), e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1003,15 +1003,15 @@ public void includeUsingGET(final SlingHttpServletRequest request, final SlingHt
try {
dispatcher.include(new GetRequest(request), response);
} catch (Exception e) {
log.debug("Exception swallowed while including error page", e);
log.error("Exception swallowed while including error page", e);
}
}
} else {
final String responseData = cache.get(path, new GetRequest(request), response);
try {
response.getWriter().write(responseData);
} catch (Exception e) {
log.info("Exception swallowed while including error page", e);
log.error("Exception swallowed while including error page", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public Collection<String> getHeaderNames() {
try {
return super.getHeaderNames();
} catch (AbstractMethodError e) {
log.debug("Known issue when internal sling redirects are made - the call to getHeaders() will throw an exception.", e);
log.warn("Known issue when internal sling redirects are made - the call to getHeaders() will throw an exception.", e);
return Collections.EMPTY_LIST;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void invalidate(String path){
log.debug("invalidating {}", path);
httpCacheEngine.invalidateCache(path);
} catch (HttpCacheException e){
log.debug("Job with the payload path - {} has invalidated the cache", path);
log.error("Job with the payload path - {} has invalidated the cache", path);
}
}

Expand All @@ -131,7 +131,7 @@ void invalidateReferences(String path) {

}
} catch (Exception e){
log.debug("failed to invalidate references of {}", path);
log.error("failed to invalidate references of {}", path);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private void setResourceTypeFromClass() throws IllegalAccessException, Instantia
}
}
} catch (RuntimeException | ReflectiveOperationException ex) {
LOGGER.debug("Unable to determine sling resource type for model bean: {} ", originalClass);
LOGGER.error("Unable to determine sling resource type for model bean: {} ", originalClass);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected final Node getOrCreateNode(String absolutePath, String intermediateNod
try {
return session.getNode(absolutePath);
} catch (PathNotFoundException e) {
logger.info("Creating node (and missing parents): {}", absolutePath);
logger.warn("Creating node (and missing parents): {}", absolutePath);
return JcrUtil.createPath(absolutePath, intermediateNodeType, nodeType, session, false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.adobe.granite.security.user.util.AuthorizableUtil;
import com.day.cq.tagging.Tag;
import com.day.cq.tagging.TagManager;
import org.apache.commons.lang3.StringUtils;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.DefaultInjectionStrategy;
import org.apache.sling.models.annotations.Model;
Expand Down Expand Up @@ -269,7 +268,7 @@ static Pattern toRegex(String src, boolean nc) {
ptrn = null;
}
} catch (PatternSyntaxException e) {
log.info("invalid regex: {}", src);
log.error("invalid regex: {}", src);
ptrn = null;
}
return ptrn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private boolean executeConfig(Resource config, SlingHttpServletRequest request,
} catch (ReportException e) {
log.warn(e.getMessage(), e);
} catch (Exception e) {
log.warn("Unexpected exception executing report executor " + reportExecutor, e);
log.warn("Unexpected exception executing report executor {} ", reportExecutor, e);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public void doFilter(final ServletRequest request,
try {
md5FromCache = getCacheEntry(uriInfo.cacheKey);
} catch (Exception e) {
log.debug("Failed to get cache entry for '{}'", uriInfo.cacheKey);
log.warn("Failed to get cache entry for '{}'", uriInfo.cacheKey);
}

// this static value "Invalid cache key parameter." happens when the cache key can't be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected void activate(BundleContext bundleContext, Map<String, Object> propert
this.adapterFactoryServiceRegistration = bundleContext.registerService(AdapterFactory.class, adapterFactory, serviceProps);

} catch (NoClassDefFoundError e) {
log.info("Twitter4J Library not found. Not registering TwitterAdapterFactory.");
log.error("Twitter4J Library not found. Not registering TwitterAdapterFactory.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private void initialize() throws RepositoryException {
}
}
} catch (javax.jcr.UnsupportedRepositoryOperationException e) {
log.debug(String.format("node %s not versionable", this.resource.getPath()));
log.warn(String.format("node %s not versionable", this.resource.getPath()));
}
versionSelection.add(new VersionSelectionImpl("latest", Properties.lastModified(resource)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private void doFilterWithErrorHandling(final SlingHttpServletRequest slingReques
if (this.isComponentErrorHandlingSuppressed(slingRequest)) {
// Allows disabling from within an inclusion.
// This is checked before the suppression is reset to the "pre-inclusion" state
log.debug("Suppressed component error handling for: {}",
log.warn("Suppressed component error handling for: {}",
slingRequest.getResource().getPath());

throw new ServletException(ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public final void run() {
} catch (InterruptedException e) {
log.error("Interrupted Exception during Workflow Removal", e);
} catch (WorkflowRemovalForceQuitException e) {
log.info("Workflow Removal force quit", e);
log.error("Workflow Removal force quit", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ private void run(final ResourceResolver resourceResolver,
session.save();
}
} catch (RepositoryException e) {
log.error("Could not complete save at end of synthetic workflow execution process"
+ " [ {} ]", payloadPath, e);
throw new WorkflowException(e);
throw new WorkflowException(String.format(
"Could not complete save at end of synthetic workflow execution process [ %s ]", payloadPath),
e);
}
}

Expand Down

0 comments on commit e055273

Please sign in to comment.