Skip to content

Commit aab2d7e

Browse files
author
zhourenjian
committed
Support #deal method in anonymous class
Remove unused codes
1 parent 3d5277f commit aab2d7e

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

sources/net.sf.j2s.ajax/ajaxpipe/net/sf/j2s/ajax/SimplePipeRunnable.java

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public abstract class SimplePipeRunnable extends SimpleRPCRunnable {
6767
int sequenceIndex; // Index of last SimplePipeSequence in pipeData
6868

6969
@J2SIgnore
70-
int bufferedIndex; // Index of last buffered object in pipeData
70+
int bufferedIndex; // Index of last buffered object in pipeData, data before this object is sent
7171

7272
@J2SIgnore
7373
List<SimpleSerializable> pipeData;
@@ -102,11 +102,6 @@ public long getSequence() {
102102
return pipeSequence;
103103
}
104104

105-
@J2SIgnore
106-
public long increaseSequence() {
107-
return ++pipeSequence;
108-
}
109-
110105
@J2SIgnore
111106
public void setSequence(long sequence) {
112107
pipeSequence = sequence;
@@ -423,21 +418,6 @@ public boolean deal(SimpleSerializable ss) {
423418
Method method = null;
424419

425420
Class<?> clzz = getClass();
426-
String clazzName = clzz.getName();
427-
int idx = -1;
428-
while ((idx = clazzName.lastIndexOf('$')) != -1) {
429-
if (clazzName.length() > idx + 1) {
430-
char ch = clazzName.charAt(idx + 1);
431-
if (ch < '0' || ch > '9') { // not a number
432-
break; // inner class
433-
}
434-
}
435-
clzz = clzz.getSuperclass();
436-
if (clzz == null) {
437-
break; // should never happen!
438-
}
439-
clazzName = clzz.getName();
440-
}
441421
if (clzz != null) {
442422
do {
443423
try {
@@ -447,12 +427,13 @@ public boolean deal(SimpleSerializable ss) {
447427
if (method != null) {
448428
Class<?> returnType = method.getReturnType();
449429
if (returnType == boolean.class) {
430+
method.setAccessible(true);
450431
Object result = method.invoke(this, ss);
451432
return ((Boolean) result).booleanValue();
452433
}
453434
}
454435
clazz = clazz.getSuperclass();
455-
} while (clazz != null);
436+
} while (clazz != null && clazz != SimpleSerializable.class);
456437
}
457438
} catch (Throwable e) {
458439
e.printStackTrace();

0 commit comments

Comments
 (0)