Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

NXCM-4080 - backport [NXCM-3889] Log more details about cause of APR …

…at info level

This is being back ported to nexus-2.0.x to facilitate a clean merge of NXCM-2992 changes from master, which in turn will resolve in the simplest fashion NXCM-4080 - remove xmlrpc:xmlrpc-client an xmlrpc:xmlrpc-common 3.0 dependencies to fix osvdb-68314
  • Loading branch information...
commit a43c4f4ded7decbf4d82b968e505b329bbbba6fb 1 parent 7b96f99
@adreghiciu adreghiciu authored peterlynch committed
View
33 nexus/nexus-app/src/main/java/org/sonatype/nexus/error/reporting/DefaultErrorReportingManager.java
@@ -251,8 +251,6 @@ public ErrorReportResponse handleError( ErrorReportRequest request, String jiraU
boolean useGlobalHttpProxy )
throws IssueSubmissionException, IOException, GeneralSecurityException
{
- getLogger().error( "Detected Error in Nexus", request.getThrowable() );
-
ErrorReportResponse response = new ErrorReportResponse();
// if title is not null, this is a manual report, so we will generate regardless
@@ -260,6 +258,11 @@ public ErrorReportResponse handleError( ErrorReportRequest request, String jiraU
if ( request.getTitle() != null
|| ( isEnabled() && shouldHandleReport( request ) && !shouldIgnore( request.getThrowable() ) ) )
{
+ getLogger().info(
+ "Detected Error in Nexus: {}. Generating a problem report...",
+ getThrowableMessage( request.getThrowable() )
+ );
+
IssueSubmissionRequest subRequest = buildRequest( request, jiraUsername, useGlobalHttpProxy );
File unencryptedFile = subRequest.getProblemReportBundle();
@@ -315,11 +318,37 @@ public ErrorReportResponse handleError( ErrorReportRequest request, String jiraU
else
{
response.setSuccess( true );
+
+ if ( getLogger().isInfoEnabled() )
+ {
+ String reason = "Nexus ignores this type of error";
+ if ( !isEnabled() )
+ {
+ reason = "reporting is not enabled";
+ }
+ else if ( !shouldHandleReport( request ) )
+ {
+ reason = "it has already being reported or it does not have an error message";
+ }
+ getLogger().info(
+ "Detected Error in Nexus: {}. Skipping problem report generation because {}",
+ getThrowableMessage( request.getThrowable() ), reason
+ );
+ }
}
return response;
}
+ private String getThrowableMessage( final Throwable throwable )
+ {
+ if ( throwable != null && StringUtils.isNotEmpty( throwable.getMessage() ) )
+ {
+ return throwable.getMessage();
+ }
+ return "(no exception message available)";
+ }
+
public ErrorReportResponse handleError( ErrorReportRequest request )
throws IssueSubmissionException, IOException, GeneralSecurityException
{
Please sign in to comment.
Something went wrong with that request. Please try again.