AbstractMethodError.java: Re-merged with Classpath.
* java/lang/AbstractMethodError.java: Re-merged with Classpath. * java/lang/ArithmeticException.java: Likewise. * java/lang/ArrayIndexOutOfBoundsException.java: Likewise. * java/lang/ArrayStoreException.java: Likewise. * java/lang/Byte.java: Likewise. * java/lang/CharSequence.java: Likewise. * java/lang/ClassCastException.java: Likewise. * java/lang/ClassCircularityError.java: Likewise. * java/lang/ClassFormatError.java: Likewise. * java/lang/CloneNotSupportedException.java: Likewise. * java/lang/Cloneable.java: Likewise. * java/lang/Comparable.java: Likewise. * java/lang/Compiler.java: Likewise. * java/lang/Error.java: Likewise. * java/lang/ExceptionInInitializerError.java: Likewise. * java/lang/IllegalAccessError.java: Likewise. * java/lang/IllegalAccessException.java: Likewise. * java/lang/IllegalArgumentException.java: Likewise. * java/lang/IllegalMonitorStateException.java: Likewise. * java/lang/IllegalStateException.java: Likewise. * java/lang/IllegalThreadStateException.java: Likewise. * java/lang/IncompatibleClassChangeError.java: Likewise. * java/lang/IndexOutOfBoundsException.java: Likewise. * java/lang/InheritableThreadLocal.java: Likewise. * java/lang/InstantiationError.java: Likewise. * java/lang/InstantiationException.java: Likewise. * java/lang/InternalError.java: Likewise. * java/lang/InterruptedException.java: Likewise. * java/lang/LinkageError.java: Likewise. * java/lang/NegativeArraySizeException.java: Likewise. * java/lang/NoClassDefFoundError.java: Likewise. * java/lang/NoSuchFieldError.java: Likewise. * java/lang/NoSuchFieldException.java: Likewise. * java/lang/NoSuchMethodError.java: Likewise. * java/lang/NoSuchMethodException.java: Likewise. * java/lang/NullPointerException.java: Likewise. * java/lang/NumberFormatException.java: Likewise. * java/lang/OutOfMemoryError.java: Likewise. * java/lang/Process.java: Likewise. * java/lang/Runnable.java: Likewise. * java/lang/RuntimePermission.java: Likewise. * java/lang/SecurityException.java: Likewise. * java/lang/Short.java: Likewise. * java/lang/StackOverflowError.java: Likewise. * java/lang/StringIndexOutOfBoundsException.java: Likewise. * java/lang/ThreadDeath.java: Likewise. * java/lang/ThreadLocal.java: Likewise. * java/lang/UnknownError.java: Likewise. * java/lang/UnsatisfiedLinkError.java: Likewise. * java/lang/UnsupportedClassVersionError.java: Likewise. * java/lang/UnsupportedOperationException.java: Likewise. * java/lang/VerifyError.java: Likewise. * java/lang/VirtualMachineError.java: Likewise. * java/lang/reflect/InvocationTargetException.java: Likewise. * java/net/BindException.java: Likewise. * java/net/ConnectException.java: Likewise. * java/net/MalformedURLException.java: Likewise. * java/net/NoRouteToHostException.java: Likewise. * java/net/ProtocolException.java: Likewise. * java/net/SocketException.java: Likewise. * java/net/UnknownHostException.java: Likewise. * java/net/UnknownServiceException.java: Likewise. From-SVN: r54656
This commit is contained in:
parent
34442f32a2
commit
3e1b181a67
63 changed files with 2168 additions and 2216 deletions
|
@ -1,5 +1,5 @@
|
|||
/* InvocationTargetException.java - Wrapper exception for reflection
|
||||
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
/* InvocationTargetException.java -- Wrapper exception for reflection
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
|
|||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
|
@ -38,102 +38,86 @@ exception statement from your version. */
|
|||
|
||||
package java.lang.reflect;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
|
||||
* "The Java Language Specification", ISBN 0-201-63451-1
|
||||
* Status: Believed complete and correct.
|
||||
*/
|
||||
|
||||
/**
|
||||
* InvocationTargetException is sort of a way to "wrap" whatever exception
|
||||
* comes up when a method or constructor is called via Reflection.
|
||||
* InvocationTargetException is sort of a way to "wrap" whatever exception
|
||||
* comes up when a method or constructor is called via Reflection. As of
|
||||
* JDK 1.4, it was retrofitted to match the exception chaining of all other
|
||||
* exceptions, but <code>getTargetException()</code> still works.
|
||||
*
|
||||
* @author John Keiser
|
||||
* @version 1.1.0, 31 May 1998
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date December 12, 1998
|
||||
*
|
||||
* @author Eric Blake <ebb9@email.byu.edu>
|
||||
* @see Method#invoke(Object,Object[])
|
||||
* @see Constructor#newInstance(Object[])
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
|
||||
public class InvocationTargetException extends Exception
|
||||
public class InvocationTargetException extends Exception
|
||||
{
|
||||
static final long serialVersionUID = 4085088731926701167L;
|
||||
|
||||
private Throwable target = null;
|
||||
|
||||
protected InvocationTargetException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an <code>InvocationTargetException</code> using another
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = 4085088731926701167L;
|
||||
|
||||
/**
|
||||
* The chained exception. This field is only around for serial compatibility.
|
||||
*
|
||||
* @serial the chained exception
|
||||
*/
|
||||
private final Throwable target;
|
||||
|
||||
/**
|
||||
* Construct an exception with null as the cause. The cause is initialized
|
||||
* to null.
|
||||
*/
|
||||
protected InvocationTargetException()
|
||||
{
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an <code>InvocationTargetException</code> using another
|
||||
* exception.
|
||||
*
|
||||
* @param targetException the exception to wrap
|
||||
*/
|
||||
public InvocationTargetException(Throwable targetException)
|
||||
{
|
||||
super(targetException.toString());
|
||||
target = targetException;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an <code>InvocationTargetException</code> using another
|
||||
public InvocationTargetException(Throwable targetException)
|
||||
{
|
||||
this(targetException, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an <code>InvocationTargetException</code> using another
|
||||
* exception and an error message.
|
||||
*
|
||||
* @param targetException the exception to wrap
|
||||
* @param err an extra reason for the exception-throwing
|
||||
*/
|
||||
public InvocationTargetException(Throwable targetException, String err)
|
||||
{
|
||||
super(err);
|
||||
target = targetException;
|
||||
}
|
||||
|
||||
public InvocationTargetException(Throwable targetException, String err)
|
||||
{
|
||||
super(err, targetException);
|
||||
target = targetException;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped (targeted) exception.
|
||||
*
|
||||
* @return the targeted exception.
|
||||
*
|
||||
* @return the targeted exception
|
||||
* @see #getCause()
|
||||
*/
|
||||
public Throwable getTargetException()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
public Throwable getTargetException()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
|
||||
public void printStackTrace()
|
||||
{
|
||||
if (target == null)
|
||||
super.printStackTrace();
|
||||
else
|
||||
{
|
||||
System.err.print(this.getClass() + ": ");
|
||||
target.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void printStackTrace(PrintStream ps)
|
||||
{
|
||||
if (target == null)
|
||||
super.printStackTrace(ps);
|
||||
else
|
||||
{
|
||||
ps.print(this.getClass() + ": ");
|
||||
target.printStackTrace(ps);
|
||||
}
|
||||
}
|
||||
|
||||
public void printStackTrace(PrintWriter pw)
|
||||
{
|
||||
if (target == null)
|
||||
super.printStackTrace(pw);
|
||||
else
|
||||
{
|
||||
pw.print(this.getClass() + ": ");
|
||||
target.printStackTrace(pw);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the cause of this exception (which may be null).
|
||||
*
|
||||
* @return the cause
|
||||
* @since 1.4
|
||||
*/
|
||||
public Throwable getCause()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue