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

Commita02d8e3

Browse files
author
zhourenjian
committed
Fixed bug that AClass.loadClass can not accept null Runnable instance.
1 parent8769474 commita02d8e3

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

‎sources/net.sf.j2s.ajax/ajaxcore/net/sf/j2s/ajax/AClass.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,35 +45,35 @@ protected AClass() {
4545
*
4646
* @j2sNativeSrc
4747
* ClazzLoader.loadClass (clazzName, function () {
48-
* if (Clazz.instanceOf (afterLoaded, net.sf.j2s.ajax.ARunnable)) {
48+
* if (afterLoaded != null &&Clazz.instanceOf (afterLoaded, net.sf.j2s.ajax.ARunnable)) {
4949
* var clz = Clazz.evalType (clazzName);
5050
* afterLoaded.setClazz (clz);
5151
* }
52-
* afterLoaded.run ();
52+
*if (afterLoaded != null)afterLoaded.run ();
5353
* }, false, true);
5454
* @j2sNative
5555
* ClazzLoader.loadClass (a, function () {
56-
* if (Clazz.instanceOf (b, net.sf.j2s.ajax.ARunnable)) {
56+
* if (b != null &&Clazz.instanceOf (b, net.sf.j2s.ajax.ARunnable)) {
5757
* var clz = Clazz.evalType (a);
5858
* b.setClazz (clz);
5959
* }
60-
* b.run ();
60+
*if (b != null)b.run ();
6161
* }, false, true);
6262
*/
6363
publicstaticvoidload(finalStringclazzName,finalRunnableafterLoaded) {
6464
newThread(newRunnable() {
6565
publicvoidrun() {
6666
try {
6767
Classclz =Class.forName(clazzName);
68-
if (afterLoadedinstanceofARunnable) {
68+
if (afterLoaded!=null &&afterLoadedinstanceofARunnable) {
6969
ARunnablerunnable = (ARunnable)afterLoaded;
7070
runnable.setClazz(clz);
7171
}
7272
}catch (ClassNotFoundExceptione) {
7373
e.printStackTrace();
7474
return ;
7575
}
76-
afterLoaded.run();
76+
if (afterLoaded !=null)afterLoaded.run();
7777
}
7878
}).start();
7979
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
230230
resp.setHeader("Pragma","no-cache");
231231
resp.setHeader("Cache-Control","no-cache");
232232
resp.setDateHeader("Expires",0);
233-
resp.setContentType("text/plain;charset=utf-8");
233+
resp.setContentType("text/plain;charset=utf-8");
234234
//resp.setCharacterEncoding("utf-8");
235235
PrintWriterwriter =resp.getWriter();
236236
runnable.deserialize(request);

‎sources/net.sf.j2s.ajax/ajaxswt/net/sf/j2s/ajax/ASWTClass.java‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,27 @@ public static void swtLoad(String clazzName, Runnable afterLoaded) {
8383
*
8484
* @j2sNativeSrc
8585
* ClazzLoader.loadClass (clazzName, function () {
86-
* if (Clazz.instanceOf (afterLoaded, net.sf.j2s.ajax.ARunnable)) {
86+
* if (afterLoaded != null &&Clazz.instanceOf (afterLoaded, net.sf.j2s.ajax.ARunnable)) {
8787
* var clz = Clazz.evalType (clazzName);
8888
* afterLoaded.setClazz (clz);
8989
* }
90-
* afterLoaded.run ();
90+
*if (afterLoaded != null)afterLoaded.run ();
9191
* }, false, true);
9292
* @j2sNative
9393
* ClazzLoader.loadClass (b, function () {
94-
* if (Clazz.instanceOf (c, net.sf.j2s.ajax.ARunnable)) {
94+
* if (c != null &&Clazz.instanceOf (c, net.sf.j2s.ajax.ARunnable)) {
9595
* var clz = Clazz.evalType (b);
9696
* c.setClazz (clz);
9797
* }
98-
* c.run ();
98+
*if (c != null)c.run ();
9999
* }, false, true);
100100
*/
101101
staticvoidobjectLoad(Objectdisplay,finalStringclazzName,finalRunnableafterLoaded) {
102102
((Display)display).asyncExec(newRunnable() {
103103
publicvoidrun() {
104104
try {
105-
Classclz =Class.forName(clazzName);
106-
if (afterLoadedinstanceofARunnable) {
105+
Classclz =Class.forName(clazzName);// May freeze UI!
106+
if (afterLoaded!=null &&afterLoadedinstanceofARunnable) {
107107
ARunnablerunnable = (ARunnable)afterLoaded;
108108
runnable.setClazz(clz);
109109
}
@@ -112,7 +112,7 @@ public void run() {
112112
return ;
113113
}
114114

115-
afterLoaded.run();
115+
if (afterLoaded !=null)afterLoaded.run();
116116
}
117117
});
118118
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp