You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/14 03:26:27 UTC
svn commit: r320962 - in
/maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics:
DiagnosisUtils.java ErrorDiagnostics.java
Author: brett
Date: Thu Oct 13 18:26:23 2005
New Revision: 320962
URL: http://svn.apache.org/viewcvs?rev=320962&view=rev
Log:
remove "Error type"
Modified:
maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/DiagnosisUtils.java
maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java
Modified: maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/DiagnosisUtils.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/DiagnosisUtils.java?rev=320962&r1=320961&r2=320962&view=diff
==============================================================================
--- maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/DiagnosisUtils.java (original)
+++ maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/DiagnosisUtils.java Thu Oct 13 18:26:23 2005
@@ -1,54 +1,53 @@
package org.apache.maven.usability.diagnostics;
-
/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2001-2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
public final class DiagnosisUtils
{
private DiagnosisUtils()
{
}
-
+
public static boolean containsInCausality( Throwable error, Class test )
{
Throwable cause = error;
-
- while( cause != null )
+
+ while ( cause != null )
{
- if( test.isInstance( cause ) )
+ if ( test.isInstance( cause ) )
{
return true;
}
-
+
cause = cause.getCause();
}
-
+
return false;
}
public static Throwable getRootCause( Throwable error )
{
Throwable cause = error;
-
- while( true )
+
+ while ( true )
{
Throwable nextCause = cause.getCause();
-
- if( nextCause == null )
+
+ if ( nextCause == null )
{
break;
}
@@ -57,39 +56,40 @@
cause = nextCause;
}
}
-
+
return cause;
}
public static Throwable getFromCausality( Throwable error, Class targetClass )
{
Throwable cause = error;
-
- while( cause != null )
+
+ while ( cause != null )
{
- if( targetClass.isInstance( cause ) )
+ if ( targetClass.isInstance( cause ) )
{
return cause;
}
-
+
cause = cause.getCause();
}
-
+
return null;
}
- public static void appendRootCauseIfPresentAndUnique( Throwable error, StringBuffer message, boolean includeTypeInfo )
+ public static void appendRootCauseIfPresentAndUnique( Throwable error, StringBuffer message,
+ boolean includeTypeInfo )
{
- Throwable root = DiagnosisUtils.getRootCause( error );
-
- if ( root != null && root != error )
+ Throwable root = getRootCause( error );
+
+ if ( root != null && !root.equals( error ) )
{
String rootMsg = root.getMessage();
-
- if ( rootMsg != null && error.getMessage().indexOf(rootMsg) < 0 )
+
+ if ( rootMsg != null && error.getMessage().indexOf( rootMsg ) < 0 )
{
- message.append( "\nRoot message: " ).append( rootMsg );
-
+ message.append( "\n" ).append( rootMsg );
+
if ( includeTypeInfo )
{
message.append( "\nRoot error type: " ).append( root.getClass().getName() );
Modified: maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java?rev=320962&r1=320961&r2=320962&view=diff
==============================================================================
--- maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java (original)
+++ maven/components/trunk/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java Thu Oct 13 18:26:23 2005
@@ -128,10 +128,8 @@
StringBuffer message = new StringBuffer();
message.append( error.getMessage() );
-
- message.append( "\nError type: " ).append( error.getClass().getName() );
-
- DiagnosisUtils.appendRootCauseIfPresentAndUnique( error, message, true );
+
+ DiagnosisUtils.appendRootCauseIfPresentAndUnique( error, message, false );
return message.toString();
}