summaryrefslogtreecommitdiffstats
path: root/luni
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-09-20 12:08:34 -0700
committerBrian Carlstrom <bdc@google.com>2013-06-05 14:05:25 -0700
commit552f220a1c5f481293bf47b21726635a0e5df601 (patch)
tree16c2be76d563904f48c7578df2beb967adf0e6f9 /luni
parent940f85738c2f1326317458f11f8d6b9880adfe42 (diff)
downloadlibcore-552f220a1c5f481293bf47b21726635a0e5df601.zip
libcore-552f220a1c5f481293bf47b21726635a0e5df601.tar.gz
libcore-552f220a1c5f481293bf47b21726635a0e5df601.tar.bz2
Change the VMStack interface used by serialization.
(cherry picked from commit 8b44bdb6063816eeb90da6b4f8aa3ed9f38fe140) Change-Id: I5da041caa3037a4093f05dec4e03aed4f466a21d
Diffstat (limited to 'luni')
-rw-r--r--luni/src/main/java/java/io/ObjectInputStream.java19
1 files changed, 1 insertions, 18 deletions
diff --git a/luni/src/main/java/java/io/ObjectInputStream.java b/luni/src/main/java/java/io/ObjectInputStream.java
index 0476901..0b15161 100644
--- a/luni/src/main/java/java/io/ObjectInputStream.java
+++ b/luni/src/main/java/java/io/ObjectInputStream.java
@@ -2000,7 +2000,7 @@ public class ObjectInputStream extends InputStream implements ObjectInput, Objec
// original/outside caller
if (++nestedLevels == 1) {
// Remember the caller's class loader
- callerClassLoader = getClosestUserClassLoader();
+ callerClassLoader = VMStack.getClosestUserClassLoader(bootstrapLoader, systemLoader);
}
result = readNonPrimitiveContent(unshared);
@@ -2041,23 +2041,6 @@ public class ObjectInputStream extends InputStream implements ObjectInput, Objec
private static final ClassLoader systemLoader = ClassLoader.getSystemClassLoader();
/**
- * Searches up the call stack to find the closest user-defined class loader.
- *
- * @return a user-defined class loader or null if one isn't found
- */
- private static ClassLoader getClosestUserClassLoader() {
- Class<?>[] stackClasses = VMStack.getClasses(-1);
- for (Class<?> stackClass : stackClasses) {
- ClassLoader loader = stackClass.getClassLoader();
- if (loader != null && loader != bootstrapLoader
- && loader != systemLoader) {
- return loader;
- }
- }
- return null;
- }
-
- /**
* Method to be overridden by subclasses to read the next object from the
* source stream.
*