Ignore:
Timestamp:
2018-01-16T00:28:24+01:00 (2 years ago)
Author:
Don-vip
Message:

see #14097, see #15783 - robustness to situations where JavaScript engine cannot be retrieved, for whatever reason

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/download/OverpassQueryWizardDialog.java

    r12977 r13331  
    144144    private Optional<String> tryParseSearchTerm(String searchTerm) {
    145145        try {
    146             String query = this.overpassQueryBuilder.constructQuery(searchTerm);
    147 
    148             return Optional.of(query);
    149         } catch (UncheckedParseException ex) {
     146            return Optional.of(overpassQueryBuilder.constructQuery(searchTerm));
     147        } catch (UncheckedParseException | IllegalStateException ex) {
    150148            Logging.error(ex);
    151149            JOptionPane.showMessageDialog(
     
    158156                    JOptionPane.ERROR_MESSAGE
    159157            );
    160 
    161158            return Optional.empty();
    162159        }
  • trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java

    r13268 r13331  
    2626
    2727import javax.script.ScriptEngine;
    28 import javax.script.ScriptEngineManager;
    2928import javax.script.ScriptException;
    3029import javax.swing.JOptionPane;
     
    421420                this.mainPrefs = mainPrefs;
    422421                PreferencesUtils.resetLog();
    423                 engine = new ScriptEngineManager(null).getEngineByName("JavaScript");
     422                engine = Utils.getJavaScriptEngine();
     423                if (engine == null) {
     424                    throw new ScriptException("Failed to retrieve JavaScript engine");
     425                }
    424426                engine.eval("API={}; API.pref={}; API.fragments={};");
    425427
Note: See TracChangeset for help on using the changeset viewer.