Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
I am invoking a method from within an AOP (Spring) (Around advice). Once the method returns i do some checking on the object and if i am not happy with the results i throw an exception (my own). However, when the aspect returns, instead of my exception i get an "UndeclaredThrowableException" Any idea how to handle this?
I have an export to excel functionality in my application. I am to write a test case for teh same. Any Inputs??Sample Code?? Heres my action code. When the User clicks on "Download to excel" on the page, below export action is called. I am to test this functionality. def export={ def playerId=session["playerId"] //Calls calculateId, runs an sql query and returns a List tuneIns...
  /*
   * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Sun designates this
   * particular file as subject to the "Classpath" exception as provided
   * by Sun in the LICENSE file that accompanied this code.
  *
  * This code 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 General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
  *
  * You should have received a copy of the GNU General Public License version
  * 2 along with this work; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  * CA 95054 USA or visit www.sun.com if you need additional information or
  * have any questions.
  */
 
 package java.lang.reflect;

Thrown by a method invocation on a proxy instance if its invocation handler's invoke method throws a checked exception (a Throwable that is not assignable to RuntimeException or Error) that is not assignable to any of the exception types declared in the throws clause of the method that was invoked on the proxy instance and dispatched to the invocation handler.

An UndeclaredThrowableException instance contains the undeclared checked exception that was thrown by the invocation handler, and it can be retrieved with the getUndeclaredThrowable() method. UndeclaredThrowableException extends RuntimeException, so it is an unchecked exception that wraps a checked exception.

As of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The "undeclared checked exception that was thrown by the invocation handler" that may be provided at construction time and accessed via the getUndeclaredThrowable() method is now known as the cause, and may be accessed via the java.lang.Throwable.getCause() method, as well as the aforementioned "legacy method."

Author(s):
Peter Jones
Since:
1.3
See also:
InvocationHandler
 
 public class UndeclaredThrowableException extends RuntimeException {
     static final long serialVersionUID = 330127114055056639L;

    
the undeclared checked exception that was thrown

Serial:
 
     private Throwable undeclaredThrowable;

    
Constructs an UndeclaredThrowableException with the specified Throwable.

Parameters:
undeclaredThrowable the undeclared checked exception that was thrown
 
     public UndeclaredThrowableException(Throwable undeclaredThrowable) {
         super((Throwablenull);  // Disallow initCause
         this. = undeclaredThrowable;
     }

    
Constructs an UndeclaredThrowableException with the specified Throwable and a detail message.

Parameters:
undeclaredThrowable the undeclared checked exception that was thrown
s the detail message
 
     public UndeclaredThrowableException(Throwable undeclaredThrowable,
                                         String s)
     {
         super(snull);  // Disallow initCause
         this. = undeclaredThrowable;
     }

    
Returns the Throwable instance wrapped in this UndeclaredThrowableException, which may be null.

This method predates the general-purpose exception chaining facility. The java.lang.Throwable.getCause() method is now the preferred means of obtaining this information.

Returns:
the undeclared checked exception that was thrown
    public Throwable getUndeclaredThrowable() {
        return ;
    }

    
Returns the cause of this exception (the Throwable instance wrapped in this UndeclaredThrowableException, which may be null).

Returns:
the cause of this exception.
Since:
1.4
    public Throwable getCause() {
        return ;
    }
New to GrepCode? Check out our FAQ X