remove "Error type"

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@320962 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-10-14 01:26:23 +00:00
parent e6101f2d11
commit 03f249b9e4
2 changed files with 41 additions and 43 deletions

View File

@ -1,21 +1,20 @@
package org.apache.maven.usability.diagnostics; package org.apache.maven.usability.diagnostics;
/* /*
* Copyright 2001-2005 The Apache Software Foundation. * Copyright 2001-2005 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
public final class DiagnosisUtils public final class DiagnosisUtils
{ {
@ -27,9 +26,9 @@ public final class DiagnosisUtils
{ {
Throwable cause = error; Throwable cause = error;
while( cause != null ) while ( cause != null )
{ {
if( test.isInstance( cause ) ) if ( test.isInstance( cause ) )
{ {
return true; return true;
} }
@ -44,11 +43,11 @@ public final class DiagnosisUtils
{ {
Throwable cause = error; Throwable cause = error;
while( true ) while ( true )
{ {
Throwable nextCause = cause.getCause(); Throwable nextCause = cause.getCause();
if( nextCause == null ) if ( nextCause == null )
{ {
break; break;
} }
@ -65,9 +64,9 @@ public final class DiagnosisUtils
{ {
Throwable cause = error; Throwable cause = error;
while( cause != null ) while ( cause != null )
{ {
if( targetClass.isInstance( cause ) ) if ( targetClass.isInstance( cause ) )
{ {
return cause; return cause;
} }
@ -78,17 +77,18 @@ public final class DiagnosisUtils
return null; 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 ); Throwable root = getRootCause( error );
if ( root != null && root != error ) if ( root != null && !root.equals( error ) )
{ {
String rootMsg = root.getMessage(); 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 ) if ( includeTypeInfo )
{ {

View File

@ -129,9 +129,7 @@ public class ErrorDiagnostics
message.append( error.getMessage() ); message.append( error.getMessage() );
message.append( "\nError type: " ).append( error.getClass().getName() ); DiagnosisUtils.appendRootCauseIfPresentAndUnique( error, message, false );
DiagnosisUtils.appendRootCauseIfPresentAndUnique( error, message, true );
return message.toString(); return message.toString();
} }