1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

Better error reporting for expressions that are too long

This commit is contained in:
Reinhard Pointner 2016-08-09 02:00:17 +08:00
parent 574a90c623
commit 65d5453797

View File

@ -36,6 +36,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.prefs.Preferences;
import javax.script.ScriptException;
import javax.swing.AbstractAction;
@ -696,6 +697,9 @@ public class FormatDialog extends JDialog {
if (format.getExpression().isEmpty()) {
throw new ScriptException("Expression is empty");
}
if (format.getExpression().length() > Preferences.MAX_VALUE_LENGTH) {
throw new ScriptException("Expression is limited to " + Preferences.MAX_VALUE_LENGTH + " characters");
}
// create new recent history and ignore duplicates
Set<String> recent = new LinkedHashSet<String>();
@ -718,6 +722,8 @@ public class FormatDialog extends JDialog {
finish(true);
} catch (ScriptException e) {
log.log(Level.WARNING, ExceptionUtilities.getRootCauseMessage(e));
} catch (Exception e) {
log.log(Level.WARNING, e.getMessage(), e);
}
}
};