Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24cd307

Browse files
author
zhourenjian@gmail.com
committed
Fixed bug that reloading non-existed *.class will fail to use parent class loader to load class
1 parent6982cab commit24cd307

File tree

1 file changed

+31
-13
lines changed

1 file changed

+31
-13
lines changed

‎sources/net.sf.j2s.ajax/ajaxrpc/net/sf/j2s/ajax/SimpleClassLoader.java‎

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,39 @@ public Class<?> loadClass(String clazzName) throws ClassNotFoundException {
8888
}
8989
}
9090
if (contains) {
91+
Exceptionex =null;
9192
synchronized (mutex) {
9293
clazz =loadedClasses.get(clazzName);
93-
if (clazz ==null) {
94-
// The following two lines are IO sensitive
95-
byte[]bytes =null;
96-
// The following lines are IO sensitive
97-
try {
98-
bytes =loadClassData(clazzName);
99-
}catch (IOExceptione) {
100-
thrownewClassNotFoundException(e.getMessage(),e);
101-
}
102-
clazz =defineClass(clazzName,bytes,0,bytes.length);
103-
loadedClasses.put(clazzName,clazz);
104-
}
105-
returnclazz;
94+
if (clazz !=null) {
95+
returnclazz;
96+
}
97+
byte[]bytes =null;
98+
// The following lines are IO sensitive
99+
try {
100+
bytes =loadClassData(clazzName);
101+
}catch (IOExceptione) {
102+
ex =e;
103+
}
104+
if (bytes !=null) {
105+
clazz =defineClass(clazzName,bytes,0,bytes.length);
106+
loadedClasses.put(clazzName,clazz);
107+
returnclazz;
108+
}
109+
}
110+
// continue to load class by super class loader
111+
ClassLoaderparent =getParent();
112+
if (parent !=null) {
113+
clazz =parent.loadClass(clazzName);
114+
synchronized (mutex) {
115+
loadedClasses.put(clazzName,clazz);
116+
}
117+
returnclazz;
118+
}else {
119+
if (ex !=null) {
120+
thrownewClassNotFoundException(ex.getMessage(),ex);
121+
}else {
122+
thrownewClassNotFoundException();
123+
}
106124
}
107125
}
108126
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp