[hibernate-commits] Hibernate SVN: r10471 - trunk/Hibernate3/src/org/hibernate/proxy/pojo/javassist

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Sep 8 09:55:14 EDT 2006


Author: steve.ebersole at jboss.com
Date: 2006-09-08 09:55:13 -0400 (Fri, 08 Sep 2006)
New Revision: 10471

Modified:
   trunk/Hibernate3/src/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java
Log:
HHH-1986 : InvocationTargetException on JavassistLazyInitializer

Modified: trunk/Hibernate3/src/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java	2006-09-08 12:53:06 UTC (rev 10470)
+++ trunk/Hibernate3/src/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java	2006-09-08 13:55:13 UTC (rev 10471)
@@ -182,8 +182,10 @@
 	}
 
 	public Object invoke(
-			final Object proxy, final Method thisMethod,
-	        final Method proceed, final Object[] args) throws Exception {
+			final Object proxy,
+			final Method thisMethod,
+			final Method proceed,
+			final Object[] args) throws Throwable {
 		if ( this.constructed ) {
 			Object result;
 			try {
@@ -195,30 +197,24 @@
 			if ( result == INVOKE_IMPLEMENTATION ) {
 				Object target = getImplementation();
 				final Object returnValue;
-				if ( ReflectHelper.isPublic( persistentClass, thisMethod ) ) {
-					if ( !isCastable(
-							target.getClass(), thisMethod
-							.getDeclaringClass()
-					) ) {
-						throw new ClassCastException(
-								target.getClass()
-										.getName()
-						);
-					}
-					returnValue = thisMethod.invoke( target, args );
-				}
-				else {
-					if ( !thisMethod.isAccessible() ) {
-						thisMethod.setAccessible( true );
-					}
-					try {
-						returnValue = thisMethod.invoke( target, args );
-					}
-					catch ( InvocationTargetException e ) {
-						throw new Exception( e.getTargetException().getCause() );
-					}
-				}
-				return returnValue == target ? proxy : returnValue;
+				try {
+                    if ( ReflectHelper.isPublic( persistentClass, thisMethod ) ) {
+                    	if ( !isCastable( target.getClass(), thisMethod.getDeclaringClass()) ) {
+                    		throw new ClassCastException( target.getClass().getName() );
+                    	}
+                    	returnValue = thisMethod.invoke( target, args );
+                    }
+                    else {
+                    	if ( !thisMethod.isAccessible() ) {
+                    		thisMethod.setAccessible( true );
+                    	}
+                    	returnValue = thisMethod.invoke( target, args );
+                    }
+                    return returnValue == target ? proxy : returnValue;
+                }
+				catch ( InvocationTargetException ite ) {
+                    throw ite.getTargetException();
+                }
 			}
 			else {
 				return result;




More information about the hibernate-commits mailing list