Test data fixed

Better exception handling in FFDec AS3 compiler
This commit is contained in:
Jindra Petřík
2016-08-20 20:09:58 +02:00
parent af5afb1d89
commit aba9e3d2b1
5 changed files with 29 additions and 3 deletions

View File

@@ -15,6 +15,20 @@ public class As3ScriptReplaceException extends Exception {
this.exceptionItems = exceptionItems;
}
@Override
public String getMessage() {
StringBuilder sb = new StringBuilder();
for (As3ScriptReplaceExceptionItem item : exceptionItems) {
sb.append(item.toString()).append("\r\n");
}
return sb.toString();
}
@Override
public String getLocalizedMessage() {
return getMessage();
}
public As3ScriptReplaceException(As3ScriptReplaceExceptionItem exceptionItem) {
this.exceptionItems = new ArrayList<>();
this.exceptionItems.add(exceptionItem);

View File

@@ -41,4 +41,9 @@ public class As3ScriptReplaceExceptionItem {
return col;
}
@Override
public String toString() {
return (file != null ? "" + file : "") + (line != LINE_UNKNOWN ? ("(" + line + ")") : "") + (col != COL_UNKNOWN ? (" col: " + col) : "");
}
}

View File

@@ -67,6 +67,7 @@ public class FFDecAs3ScriptReplacer implements As3ScriptReplacerInterface {
throw new As3ScriptReplaceException(new As3ScriptReplaceExceptionItem(null, ex.text, (int) ex.line));
} catch (CompilationException ex) {
abc.script_info.get(oldIndex).delete(abc, false);
throw new As3ScriptReplaceException(new As3ScriptReplaceExceptionItem(null, ex.text, (int) ex.line));
}
}