[hibernate-commits] Hibernate SVN: r19301 - core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/util.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Tue Apr 27 03:37:53 EDT 2010
Author: stliu
Date: 2010-04-27 03:37:53 -0400 (Tue, 27 Apr 2010)
New Revision: 19301
Modified:
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/util/SerializationHelper.java
Log:
JBPAPP-4180 HHH-2412 Support for JDBC4
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/util/SerializationHelper.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/util/SerializationHelper.java 2010-04-27 07:17:09 UTC (rev 19300)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/util/SerializationHelper.java 2010-04-27 07:37:53 UTC (rev 19301)
@@ -223,8 +223,10 @@
}
}
- /**
- * Deserializes an Object from an array of bytes.
+ /**
+ * Deserializes an object from an array of bytes using the Thread Context
+ * ClassLoader (TCCL). If there is no TCCL set, the classloader of the calling
+ * class is used.
* <p/>
* Delegates to {@link #deserialize(byte[], ClassLoader)}
*
@@ -261,9 +263,12 @@
/**
- * Custom ObjectInputStream implementation to more appropriately handle classloading
- * within app servers (mainly jboss - hence this class inspired by jboss's class of
- * the same purpose).
+ * By default, to resolve the classes being deserialized JDK serialization uses the
+ * classes loader which loaded the class which initiated the deserialization call. Here
+ * that would be hibernate classes. However, there are cases where that is not the correct
+ * class loader to use; mainly here we are worried about deserializing user classes in
+ * environments (app servers, etc) where Hibernate is on a parent classes loader. To
+ * facilitate for that we allow passing in the class loader we should use.
*/
private static final class CustomObjectInputStream extends ObjectInputStream {
private final ClassLoader loader;
@@ -285,7 +290,8 @@
log.trace( "Unable to locate class using given classloader" );
}
}
-
+ // By default delegate to normal JDK deserialization which will use the class loader
+ // of the class which is calling this deserialization.
return super.resolveClass( v );
}
}
More information about the hibernate-commits
mailing list