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

Commitef9bc32

Browse files
author
zhourenjian
committed
Fixed bug [ 1690362 ] Invalid name of exception object inside catch block
Now Generating JavaScript for try/catch block will assign default exceptionvariable "e" to a new exception variable, if needed.
1 parent4278beb commitef9bc32

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/ASTKeywordVisitor.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,20 @@ public boolean visit(TryStatement node) {
10621062
CatchClauseelement = (CatchClause)iter.next();
10631063
element.getException().getType().accept(this);
10641064
buffer.append(")) ");
1065+
SimpleNameexName =element.getException().getName();
1066+
StringeName =exName.getIdentifier();
1067+
booleannotEName =false;
1068+
if (!"e".equals(eName)) {
1069+
buffer.append("{\r\n");
1070+
buffer.append("var ");
1071+
buffer.append(eName);
1072+
buffer.append(" = e;\r\n");
1073+
notEName =true;
1074+
}
10651075
element.getBody().accept(this);
1076+
if (notEName) {
1077+
buffer.append("\r\n}");
1078+
}
10661079
if (iter.hasNext()) {
10671080
buffer.append(" else if (Clazz.instanceOf (e, ");
10681081
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp