- Timestamp:
- 2016-01-10T13:48:42+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OverpassDownloadAction.java
r9242 r9385 50 50 import org.openstreetmap.josm.tools.OverpassTurboQueryWizard; 51 51 import org.openstreetmap.josm.tools.Shortcut; 52 import org.openstreetmap.josm.tools.UncheckedParseException; 52 53 import org.openstreetmap.josm.tools.Utils; 53 54 … … 157 158 try { 158 159 overpassQuery.setText(OverpassTurboQueryWizard.getInstance().constructQuery(overpassWizardText)); 159 } catch ( OverpassTurboQueryWizard.ParseException ex) {160 } catch (UncheckedParseException ex) { 160 161 HelpAwareOptionPane.showOptionDialog( 161 162 Main.parent, -
trunk/src/org/openstreetmap/josm/tools/OverpassTurboQueryWizard.java
r8855 r9385 24 24 private static OverpassTurboQueryWizard instance; 25 25 private final ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript"); 26 27 /**28 * An exception to indicate a failed parse.29 */30 public static class ParseException extends RuntimeException {31 }32 26 33 27 /** … … 60 54 * @param search the {@link org.openstreetmap.josm.actions.search.SearchAction} like query 61 55 * @return an Overpass QL query 62 * @throws ParseException when the parsing fails56 * @throws UncheckedParseException when the parsing fails 63 57 */ 64 public String constructQuery(String search) throws ParseException {58 public String constructQuery(String search) throws UncheckedParseException { 65 59 try { 66 60 final Object result = ((Invocable) engine).invokeFunction("construct_query", search); 67 61 if (result == Boolean.FALSE) { 68 throw new ParseException();62 throw new UncheckedParseException(); 69 63 } 70 64 String query = (String) result; -
trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
r9383 r9385 18 18 import org.openstreetmap.josm.data.preferences.BooleanProperty; 19 19 import org.openstreetmap.josm.tools.CheckParameterUtil; 20 import org.openstreetmap.josm.tools.UncheckedParseException; 20 21 21 22 /** … … 66 67 * @param str The XML date as string 67 68 * @return The date 68 */ 69 public static synchronized Date fromString(String str) { 69 * @throws UncheckedParseException if the date does not match any of the supported date formats 70 */ 71 public static synchronized Date fromString(String str) throws UncheckedParseException { 70 72 return new Date(tsFromString(str)); 71 73 } … … 75 77 * @param str The XML date as string 76 78 * @return The date in milliseconds since epoch 77 */ 78 public static synchronized long tsFromString(String str) { 79 * @throws UncheckedParseException if the date does not match any of the supported date formats 80 */ 81 public static synchronized long tsFromString(String str) throws UncheckedParseException { 79 82 // "2007-07-25T09:26:24{Z|{+|-}01:00}" 80 83 if (checkLayout(str, "xxxx-xx-xxTxx:xx:xxZ") || … … 130 133 return XML_DATE.newXMLGregorianCalendar(str).toGregorianCalendar().getTimeInMillis(); 131 134 } catch (Exception ex) { 132 return System.currentTimeMillis();135 throw new UncheckedParseException("The date string (" + str + ") could not be parsed."); 133 136 } 134 137 }
Note:
See TracChangeset
for help on using the changeset viewer.