Issue #676: include characterid and previous text of the text tag in text import error log message

This commit is contained in:
2014-11-30 14:07:04 +01:00
parent e27eaed6ed
commit eec3db60c9
11 changed files with 9598 additions and 8667 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -58,7 +58,7 @@ public class TextImporter {
String[] records = textArr[1].split(recordSeparator);
result.put(id, records);
} else {
if (errorHandler.handle()) {
if (errorHandler.handle(null)) {
return null;
}
}
@@ -175,9 +175,9 @@ public class TextImporter {
return true;
}
return !errorHandler.handle();
return !errorHandler.handle(textTag);
} catch (TextParseException ex) {
return !errorHandler.handle(ex.text, ex.line);
return !errorHandler.handle(textTag, ex.text, ex.line);
}
}
}
@@ -22,7 +22,7 @@ package com.jpexs.decompiler.flash.tags.base;
*/
public abstract class TextImportErrorHandler {
public abstract boolean handle();
public abstract boolean handle(TextTag textTag);
public abstract boolean handle(String message, long line);
public abstract boolean handle(TextTag textTag, String message, long line);
}
File diff suppressed because it is too large Load Diff
@@ -1390,17 +1390,26 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
private final ConfigurationItem<Boolean> doNotShowImportError = new ConfigurationItem<>("doNotShowImportError", true, true);
private final ConfigurationItem<Boolean> doNotShowInvalidText = new ConfigurationItem<>("doNotShowInvalidText", true, true);
private String getTextTagInfo(TextTag textTag) {
String ret = "";
if (textTag != null) {
ret += " TextId: " + textTag.getCharacterId() + " (" + textTag.getText(", ") + ")";
}
return ret;
}
@Override
public boolean handle() {
public boolean handle(TextTag textTag) {
String msg = translate("error.text.import");
logger.log(Level.SEVERE, msg);
logger.log(Level.SEVERE, msg + getTextTagInfo(textTag));
return View.showConfirmDialog(diz, msg, translate("error"), JOptionPane.OK_CANCEL_OPTION, doNotShowImportError, JOptionPane.OK_OPTION) == JOptionPane.CANCEL_OPTION;
}
@Override
public boolean handle(String message, long line) {
public boolean handle(TextTag textTag, String message, long line) {
String msg = translate("error.text.invalid.continue").replace("%text%", message).replace("%line%", Long.toString(line));
logger.log(Level.SEVERE, msg);
logger.log(Level.SEVERE, msg + getTextTagInfo(textTag));
return View.showConfirmDialog(diz, msg, translate("error"), JOptionPane.OK_CANCEL_OPTION, doNotShowInvalidText, JOptionPane.OK_OPTION) == JOptionPane.CANCEL_OPTION;
}
});
@@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.gui.player;
import com.jpexs.decompiler.flash.gui.FlashUnsupportedException;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.javactivex.ActiveX;
import com.jpexs.javactivex.ActiveXControl;
import com.jpexs.javactivex.ActiveXEvent;
import com.jpexs.javactivex.ActiveXEventListener;
import com.jpexs.javactivex.ActiveXException;