1 11 package org.eclipse.core.internal.resources; 12 13 import java.io.PrintStream ; 14 import java.io.PrintWriter ; 15 import org.eclipse.core.resources.IResourceStatus; 16 import org.eclipse.core.runtime.*; 17 18 28 public class ResourceException extends CoreException { 29 32 private static final long serialVersionUID = 1L; 33 34 public ResourceException(int code, IPath path, String message, Throwable exception) { 35 super(new ResourceStatus(code, path, message, exception)); 36 } 37 38 44 public ResourceException(IStatus status) { 45 super(status); 46 } 47 48 53 public void printStackTrace() { 54 printStackTrace(System.err); 55 } 56 57 62 public void printStackTrace(PrintStream output) { 63 synchronized (output) { 64 IStatus status = getStatus(); 65 if (status.getException() != null) { 66 String path = "()"; if (status instanceof IResourceStatus) 68 path = "(" + ((IResourceStatus) status).getPath() + ")"; output.print(getClass().getName() + path + "[" + status.getCode() + "]: "); status.getException().printStackTrace(output); 71 } else 72 super.printStackTrace(output); 73 } 74 } 75 76 81 public void printStackTrace(PrintWriter output) { 82 synchronized (output) { 83 IStatus status = getStatus(); 84 if (status.getException() != null) { 85 String path = "()"; if (status instanceof IResourceStatus) 87 path = "(" + ((IResourceStatus) status).getPath() + ")"; output.print(getClass().getName() + path + "[" + status.getCode() + "]: "); status.getException().printStackTrace(output); 90 } else 91 super.printStackTrace(output); 92 } 93 } 94 95 } 96 | Popular Tags |