Changeset 11087 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-10-07T10:20:53+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r11054 r11087 1853 1853 try { 1854 1854 for (final OsmPrimitive osm : input) { 1855 try { 1856 if (osm.isDrawable()) { 1857 osm.accept(this); 1858 } 1859 } catch (RuntimeException e) { 1860 throw BugReport.intercept(e).put("osm", osm); 1861 } 1855 acceptDrawable(osm); 1862 1856 } 1863 1857 return output; … … 1866 1860 } finally { 1867 1861 MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().unlock(); 1862 } 1863 } 1864 1865 private void acceptDrawable(final OsmPrimitive osm) { 1866 try { 1867 if (osm.isDrawable()) { 1868 osm.accept(this); 1869 } 1870 } catch (RuntimeException e) { 1871 throw BugReport.intercept(e).put("osm", osm); 1868 1872 } 1869 1873 } … … 1966 1970 1967 1971 for (StyleRecord record : allStyleElems) { 1968 try { 1969 record.paintPrimitive(paintSettings, this); 1970 } catch (RuntimeException e) { 1971 throw BugReport.intercept(e).put("record", record); 1972 } 1972 paintRecord(record); 1973 1973 } 1974 1974 … … 1987 1987 } 1988 1988 } 1989 1990 private void paintRecord(StyleRecord record) { 1991 try { 1992 record.paintPrimitive(paintSettings, this); 1993 } catch (RuntimeException e) { 1994 throw BugReport.intercept(e).put("record", record); 1995 } 1996 } 1989 1997 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r11083 r11087 311 311 if (ai.key.startsWith("throw")) { 312 312 try { 313 final Severity severity = Severity.valueOf(ai.key.substring("throw".length()).toUpperCase(Locale.ENGLISH)); 314 check.errors.put(ai, severity); 313 check.errors.put(ai, Severity.valueOf(ai.key.substring("throw".length()).toUpperCase(Locale.ENGLISH))); 315 314 } catch (IllegalArgumentException e) { 316 315 Main.warn(e, "Unsupported "+ai.key+" instruction. Allowed instructions are "+POSSIBLE_THROWS+'.'); … … 753 752 addMapCSS(i); 754 753 if (Main.pref.getBoolean("validator.auto_reload_local_rules", true) && source.isLocal()) { 755 try { 756 Main.fileWatcher.registerValidatorRule(source); 757 } catch (IOException e) { 758 Main.error(e); 759 } 754 Main.fileWatcher.registerValidatorRule(source); 760 755 } 761 756 } catch (IOException ex) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r10827 r11087 1163 1163 } 1164 1164 1165 Main.worker.execute(() -> { 1166 try { 1167 // find a page that actually exists in the wiki 1168 HttpClient.Response conn; 1169 for (URI u : uris) { 1170 conn = HttpClient.create(u.toURL(), "HEAD").connect(); 1171 1172 if (conn.getResponseCode() != 200) { 1173 conn.disconnect(); 1174 } else { 1175 long osize = conn.getContentLength(); 1176 if (osize > -1) { 1177 conn.disconnect(); 1178 1179 final URI newURI = new URI(u.toString() 1180 .replace("=", "%3D") /* do not URLencode whole string! */ 1181 .replaceFirst("/wiki/", "/w/index.php?redirect=no&title=") 1182 ); 1183 conn = HttpClient.create(newURI.toURL(), "HEAD").connect(); 1184 } 1185 1186 /* redirect pages have different content length, but retrieving a "nonredirect" 1187 * page using index.php and the direct-link method gives slightly different 1188 * content lengths, so we have to be fuzzy.. (this is UGLY, recode if u know better) 1189 */ 1190 if (conn.getContentLength() != -1 && osize > -1 && Math.abs(conn.getContentLength() - osize) > 200) { 1191 Main.info("{0} is a mediawiki redirect", u); 1192 conn.disconnect(); 1193 } else { 1194 conn.disconnect(); 1195 1196 OpenBrowser.displayUrl(u.toString()); 1197 break; 1198 } 1199 } 1165 Main.worker.execute(() -> displayHelp(uris)); 1166 } catch (URISyntaxException e1) { 1167 Main.error(e1); 1168 } 1169 } 1170 1171 private void displayHelp(final List<URI> uris) { 1172 try { 1173 // find a page that actually exists in the wiki 1174 HttpClient.Response conn; 1175 for (URI u : uris) { 1176 conn = HttpClient.create(u.toURL(), "HEAD").connect(); 1177 1178 if (conn.getResponseCode() != 200) { 1179 conn.disconnect(); 1180 } else { 1181 long osize = conn.getContentLength(); 1182 if (osize > -1) { 1183 conn.disconnect(); 1184 1185 final URI newURI = new URI(u.toString() 1186 .replace("=", "%3D") /* do not URLencode whole string! */ 1187 .replaceFirst("/wiki/", "/w/index.php?redirect=no&title=") 1188 ); 1189 conn = HttpClient.create(newURI.toURL(), "HEAD").connect(); 1200 1190 } 1201 } catch (URISyntaxException | IOException e1) { 1202 Main.error(e1); 1191 1192 /* redirect pages have different content length, but retrieving a "nonredirect" 1193 * page using index.php and the direct-link method gives slightly different 1194 * content lengths, so we have to be fuzzy.. (this is UGLY, recode if u know better) 1195 */ 1196 if (conn.getContentLength() != -1 && osize > -1 && Math.abs(conn.getContentLength() - osize) > 200) { 1197 Main.info("{0} is a mediawiki redirect", u); 1198 conn.disconnect(); 1199 } else { 1200 conn.disconnect(); 1201 1202 OpenBrowser.displayUrl(u.toString()); 1203 break; 1204 } 1203 1205 } 1204 } );1205 } catch (URISyntaxException e1) {1206 } 1207 } catch (URISyntaxException | IOException e1) { 1206 1208 Main.error(e1); 1207 1209 } -
trunk/src/org/openstreetmap/josm/gui/history/HistoryLoadTask.java
r10106 r11087 171 171 break; 172 172 } 173 String msg = getLoadingMessage(pid); 174 progressMonitor.indeterminateSubTask(tr(msg, Long.toString(pid.getUniqueId()))); 175 reader = null; 176 HistoryDataSet ds; 177 try { 178 reader = new OsmServerHistoryReader(pid.getType(), pid.getUniqueId()); 179 ds = loadHistory(reader, progressMonitor); 180 } catch (OsmTransferException e) { 181 if (canceled) 182 return; 183 throw e; 184 } 185 loadedData.mergeInto(ds); 173 loadHistory(pid); 186 174 } 187 175 } catch (OsmTransferException e) { … … 189 177 return; 190 178 } 179 } 180 181 private void loadHistory(PrimitiveId pid) throws OsmTransferException { 182 String msg = getLoadingMessage(pid); 183 progressMonitor.indeterminateSubTask(tr(msg, Long.toString(pid.getUniqueId()))); 184 reader = null; 185 HistoryDataSet ds; 186 try { 187 reader = new OsmServerHistoryReader(pid.getType(), pid.getUniqueId()); 188 ds = loadHistory(reader, progressMonitor); 189 } catch (OsmTransferException e) { 190 if (canceled) 191 return; 192 throw e; 193 } 194 loadedData.mergeInto(ds); 191 195 } 192 196 -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r10982 r11087 588 588 for (PreferenceSetting setting : settings) { 589 589 if (setting instanceof SubPreferenceSetting) { 590 SubPreferenceSetting sps = (SubPreferenceSetting) setting; 591 if (sps.getTabPreferenceSetting(this) == preferenceSettings) { 592 try { 593 sps.addGui(this); 594 } catch (SecurityException ex) { 595 Main.error(ex); 596 } catch (RuntimeException ex) { 597 BugReportExceptionHandler.handleException(ex); 598 } finally { 599 settingsInitialized.add(sps); 600 } 601 } 590 addSubPreferenceSetting(preferenceSettings, (SubPreferenceSetting) setting); 602 591 } 603 592 } … … 618 607 } 619 608 } 609 610 private void addSubPreferenceSetting(TabPreferenceSetting preferenceSettings, SubPreferenceSetting sps) { 611 if (sps.getTabPreferenceSetting(this) == preferenceSettings) { 612 try { 613 sps.addGui(this); 614 } catch (SecurityException ex) { 615 Main.error(ex); 616 } catch (RuntimeException ex) { 617 BugReportExceptionHandler.handleException(ex); 618 } finally { 619 settingsInitialized.add(sps); 620 } 621 } 622 } 620 623 }
Note:
See TracChangeset
for help on using the changeset viewer.