KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > builder > ImageBuilderInternalException


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.core.builder;
12
13 import org.eclipse.core.runtime.*;
14
15 /**
16  * Exception thrown when there is an internal error in the image builder.
17  * May wrapper another exception.
18  */

19 public class ImageBuilderInternalException extends RuntimeException JavaDoc {
20
21 private static final long serialVersionUID = 28252254530437336L; // backward compatible
22
protected CoreException coreException;
23
24 public ImageBuilderInternalException(CoreException e) {
25     this.coreException = e;
26 }
27
28 public String JavaDoc getLocalizedMessage() {
29     IStatus status = this.coreException.getStatus();
30     if (status.isMultiStatus()) {
31         IStatus[] children = status.getChildren();
32         if (children != null && children.length > 0)
33             return children[0].getMessage();
34     }
35     return this.coreException.getLocalizedMessage();
36 }
37
38 public CoreException getThrowable() {
39     return coreException;
40 }
41
42 public void printStackTrace() {
43     if (coreException != null) {
44         System.err.println(this);
45         System.err.println("Stack trace of embedded core exception:"); //$NON-NLS-1$
46
coreException.printStackTrace();
47     } else {
48         super.printStackTrace();
49     }
50 }
51 }
52
Popular Tags