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

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Mon Nov 13 12:49:37 EST 2006


Author: steve.ebersole at jboss.com
Date: 2006-11-13 12:49:36 -0500 (Mon, 13 Nov 2006)
New Revision: 10792

Modified:
   trunk/Hibernate3/src/org/hibernate/proxy/pojo/cglib/CGLIBLazyInitializer.java
   trunk/Hibernate3/src/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java
Log:
code cleanup

Modified: trunk/Hibernate3/src/org/hibernate/proxy/pojo/cglib/CGLIBLazyInitializer.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/proxy/pojo/cglib/CGLIBLazyInitializer.java	2006-11-13 17:44:44 UTC (rev 10791)
+++ trunk/Hibernate3/src/org/hibernate/proxy/pojo/cglib/CGLIBLazyInitializer.java	2006-11-13 17:49:36 UTC (rev 10792)
@@ -141,22 +141,20 @@
 				final Object returnValue;
 				try {
 					if ( ReflectHelper.isPublic( persistentClass, method ) ) {
-						if(! ( method.getDeclaringClass().isInstance(target) ) )
-						{
-							throw new ClassCastException(
-									target.getClass()
-											.getName()
-							);
+						if ( !method.getDeclaringClass().isInstance( target ) ) {
+							throw new ClassCastException( target.getClass().getName() );
 						}
 						returnValue = method.invoke( target, args );
 					}
 					else {
-						if ( !method.isAccessible() ) method.setAccessible( true );
+						if ( !method.isAccessible() ) {
+							method.setAccessible( true );
+						}
 						returnValue = method.invoke( target, args );
 					}
 					return returnValue == target ? proxy : returnValue;
 				}
-				catch (InvocationTargetException ite) {
+				catch ( InvocationTargetException ite ) {
 					throw ite.getTargetException();
 				}
 			}
@@ -170,7 +168,7 @@
 				return this;
 			}
 			else {
-				throw new LazyInitializationException("unexpected case hit, method=" + method.getName());
+				throw new LazyInitializationException( "unexpected case hit, method=" + method.getName() );
 			}
 		}
 	}

Modified: trunk/Hibernate3/src/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java	2006-11-13 17:44:44 UTC (rev 10791)
+++ trunk/Hibernate3/src/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java	2006-11-13 17:49:36 UTC (rev 10792)
@@ -136,7 +136,6 @@
 			factory.setInterfaces( interfaces );
 			factory.setFilter( FINALIZE_FILTER );
 			return factory.createClass();
-			// TODO
 		}
 		catch ( Throwable t ) {
 			LogFactory.getLog( BasicLazyInitializer.class ).error(
@@ -167,23 +166,23 @@
 				Object target = getImplementation();
 				final Object returnValue;
 				try {
-                    if ( ReflectHelper.isPublic( persistentClass, thisMethod ) ) {
-						   if(! ( thisMethod.getDeclaringClass().isInstance(target) ) ) {
-                    		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;
-                }
+					if ( ReflectHelper.isPublic( persistentClass, thisMethod ) ) {
+						if ( !thisMethod.getDeclaringClass().isInstance( target ) ) {
+							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();
-                }
+					throw ite.getTargetException();
+				}
 			}
 			else {
 				return result;




More information about the hibernate-commits mailing list