Skip to content
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...
1 parent 7b96f99 commit a43c4f4ded7decbf4d82b968e505b329bbbba6fb @adreghiciu adreghiciu committed with peterlynch Feb 10, 2012
View
33 ...us-app/src/main/java/org/sonatype/nexus/error/reporting/DefaultErrorReportingManager.java
@@ -251,15 +251,18 @@ 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
// of other checks
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
{

0 comments on commit a43c4f4

Please sign in to comment.
Something went wrong with that request. Please try again.