Skip to content

Commit 9e7d27f

Browse files
committed
fix bug when using custom classloader
1 parent 68da1e6 commit 9e7d27f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/com/danga/MemCached/ContextObjectInputStream.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* MemCached Java client
3-
* Copyright (c) 2007 Greg Whalin
3+
* Copyright (c) 2008 Greg Whalin
44
* All rights reserved.
55
*
66
* This library is free software; you can redistribute it and/or
@@ -30,17 +30,17 @@
3030

3131
public class ContextObjectInputStream extends ObjectInputStream {
3232

33-
ClassLoader mLoader;
33+
ClassLoader mLoader;
3434

35-
public ContextObjectInputStream( InputStream in, ClassLoader loader ) throws IOException, SecurityException {
36-
super( in );
37-
mLoader = loader;
38-
}
39-
40-
protected Class resolveClass( ObjectStreamClass v ) throws IOException, ClassNotFoundException {
41-
if ( mLoader == null )
42-
return super.resolveClass( v );
35+
public ContextObjectInputStream( InputStream in, ClassLoader loader ) throws IOException, SecurityException {
36+
super( in );
37+
mLoader = loader;
38+
}
39+
40+
protected Class resolveClass( ObjectStreamClass v ) throws IOException, ClassNotFoundException {
41+
if ( mLoader == null )
42+
return super.resolveClass( v );
4343
else
44-
return mLoader.loadClass( v.getName() );
45-
}
44+
return Class.forName( v.getName(), true, mLoader );
45+
}
4646
}

0 commit comments

Comments
 (0)