<s> package org . eclipse . jdt . core ; import java . io . PrintStream ; import java . io . PrintWriter ; import org . eclipse . core . runtime . CoreException ; import org . eclipse . core . runtime . IStatus ; import org . eclipse . jdt . internal . core . JavaModelStatus ; public class JavaModelException extends CoreException { private static final long serialVersionUID = - 760398656505871287L ; CoreException nestedCoreException ; public JavaModelException ( Throwable e , int code ) { this ( new JavaModelStatus ( code , e ) ) ; } public JavaModelException ( CoreException exception ) { super ( exception . getStatus ( ) ) ; this . nestedCoreException = exception ; } public JavaModelException ( IJavaModelStatus status ) { super ( status ) ; } public Throwable getException ( ) { if ( this . nestedCoreException == null ) { return getStatus ( ) . getException ( ) ; } else { return this . nestedCoreException ; } } public IJavaModelStatus getJavaModelStatus ( ) { IStatus status = getStatus ( ) ; if ( status instanceof IJavaModelStatus ) { return ( IJavaModelStatus ) status ; } else { return new JavaModelStatus ( this . nestedCoreException ) ; } } public boolean isDoesNotExist ( ) { IJavaModelStatus javaModelStatus = getJavaModelStatus ( ) ; return javaModelStatus != null && javaModelStatus . isDoesNotExist ( ) ; } public void printStackTrace ( PrintStream output ) { synchronized ( output ) { super . printStackTrace ( output ) ; Throwable throwable = getException ( ) ; if ( throwable != null ) { output . print ( "Caused by: " ) ; throwable . printStackTrace ( output ) ; } } } public void printStackTrace ( PrintWriter output ) { synchronized ( output ) { super . printStackTrace ( output ) ; Throwable throwable = getException ( ) ; if ( throwable != null ) { output . print ( "Caused by: " ) ; throwable . printStackTrace ( output ) ; } } } public String toString ( ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "" ) ; if ( getException ( ) != null ) { if ( getException ( ) instanceof CoreException ) { CoreException c = ( CoreException ) getException ( ) ; buffer . append ( "" ) ; buffer . append ( c . getStatus ( ) . getCode ( ) ) ; buffer . append ( "] " ) ; buffer . append ( c . getStatus ( ) . getMessage ( ) ) ; } else { buffer . append ( getException ( ) . toString ( ) ) ; } } else { buffer . append ( getStatus ( ) . toString ( ) ) ; } return buffer . toString ( ) ; } } </s>