Changeset 12620 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2017-08-22T22:26:32+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 57 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/AbstractReader.java
r12065 r12620 12 12 import java.util.Map.Entry; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.data.osm.Changeset; 16 15 import org.openstreetmap.josm.data.osm.DataSet; … … 25 24 import org.openstreetmap.josm.data.osm.Way; 26 25 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 26 import org.openstreetmap.josm.tools.Logging; 27 27 28 28 /** … … 105 105 } 106 106 if (n.isDeleted()) { 107 Main.info(tr("Deleted node {0} is part of way {1}", id, w.getId()));107 Logging.info(tr("Deleted node {0} is part of way {1}", id, w.getId())); 108 108 } else { 109 109 wayNodes.add(n); … … 112 112 w.setNodes(wayNodes); 113 113 if (w.hasIncompleteNodes()) { 114 Main.info(tr("Way {0} with {1} nodes has incomplete nodes because at least one node was missing in the loaded data.",114 Logging.info(tr("Way {0} with {1} nodes has incomplete nodes because at least one node was missing in the loaded data.", 115 115 externalWayId, w.getNodesCount())); 116 116 } … … 176 176 } 177 177 if (primitive.isDeleted()) { 178 Main.info(tr("Deleted member {0} is used by relation {1}", primitive.getId(), relation.getId()));178 Logging.info(tr("Deleted member {0} is used by relation {1}", primitive.getId(), relation.getId())); 179 179 } else { 180 180 relationMembers.add(new RelationMember(rm.getRole(), primitive)); -
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r11746 r12620 9 9 import java.util.List; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.data.Bounds; 13 12 import org.openstreetmap.josm.data.DataSource; … … 18 17 import org.openstreetmap.josm.tools.CheckParameterUtil; 19 18 import org.openstreetmap.josm.tools.JosmRuntimeException; 19 import org.openstreetmap.josm.tools.Logging; 20 20 import org.xml.sax.SAXException; 21 21 … … 75 75 final OsmTransferCanceledException canceledException = new OsmTransferCanceledException("Operation canceled"); 76 76 canceledException.initCause(ex); 77 Main.warn(canceledException);77 Logging.warn(canceledException); 78 78 } 79 79 } -
trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java
r11879 r12620 12 12 13 13 import org.openstreetmap.josm.Main; 14 import org.openstreetmap.josm.tools.Logging; 14 15 import org.openstreetmap.josm.tools.Utils; 15 16 … … 99 100 return false; 100 101 } catch (OfflineAccessException e) { 101 Main.trace(e);102 Logging.trace(e); 102 103 return true; 103 104 } … … 187 188 this.data = new byte[input.available()]; 188 189 if (input.read(this.data) < this.data.length) { 189 Main.error("Failed to read expected contents from "+path);190 Logging.error("Failed to read expected contents from "+path); 190 191 } 191 192 } catch (IOException e) { 192 Main.trace(e);193 Logging.trace(e); 193 194 if (!isOffline()) { 194 195 this.data = updateForce(); … … 205 206 output.flush(); 206 207 } catch (IOException e) { 207 Main.error(e);208 Logging.error(e); 208 209 } 209 210 } -
trunk/src/org/openstreetmap/josm/io/CachedFile.java
r11856 r12620 29 29 import org.openstreetmap.josm.Main; 30 30 import org.openstreetmap.josm.tools.HttpClient; 31 import org.openstreetmap.josm.tools.Logging; 31 32 import org.openstreetmap.josm.tools.Pair; 32 33 import org.openstreetmap.josm.tools.Utils; … … 327 328 file = getFile(); 328 329 } catch (IOException ex) { 329 Main.warn(ex, false);330 Logging.log(Logging.LEVEL_WARN, ex); 330 331 } 331 332 if (file == null) … … 351 352 } catch (IOException e) { 352 353 if (file.getName().endsWith(".zip")) { 353 Main.warn(e, tr("Failed to open file with extension ''{2}'' and namepart ''{3}'' in zip file ''{0}''. Exception was: {1}", 354 file.getName(), e.toString(), extension, namepart)); 354 Logging.log(Logging.LEVEL_WARN, 355 tr("Failed to open file with extension ''{2}'' and namepart ''{3}'' in zip file ''{0}''. Exception was: {1}", 356 file.getName(), e.toString(), extension, namepart), e); 355 357 } 356 358 } … … 389 391 } 390 392 } catch (MalformedURLException e) { 391 Main.warn(e);393 Logging.warn(e); 392 394 } 393 395 } … … 422 424 checkOfflineAccess(urlStr); 423 425 } catch (OfflineAccessException e) { 424 Main.trace(e);426 Logging.trace(e); 425 427 offline = true; 426 428 } … … 471 473 final HttpClient.Response con = activeConnection.connect(); 472 474 if (ifModifiedSince != null && con.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) { 473 if (Main.isDebugEnabled()) { 474 Main.debug("304 Not Modified ("+urlStr+')'); 475 } 475 Logging.debug("304 Not Modified ({0})", urlStr); 476 476 if (localFile == null) 477 477 throw new AssertionError(); … … 491 491 Arrays.asList(Long.toString(System.currentTimeMillis()), localFile.toString())); 492 492 } else { 493 Main.warn(tr("Failed to rename file {0} to {1}.",493 Logging.warn(tr("Failed to rename file {0} to {1}.", 494 494 destDirFile.getPath(), localFile.getPath())); 495 495 } 496 496 } catch (IOException e) { 497 497 if (age >= maxAgeMillis && age < maxAgeMillis*2) { 498 Main.warn(tr("Failed to load {0}, use cached file and retry next time: {1}", urlStr, e));498 Logging.warn(tr("Failed to load {0}, use cached file and retry next time: {1}", urlStr, e)); 499 499 return localFile; 500 500 } else { -
trunk/src/org/openstreetmap/josm/io/Capabilities.java
r12200 r12620 13 13 import javax.xml.parsers.ParserConfigurationException; 14 14 15 import org.openstreetmap.josm. Main;15 import org.openstreetmap.josm.tools.Logging; 16 16 import org.openstreetmap.josm.tools.Utils; 17 17 import org.xml.sax.Attributes; … … 161 161 162 162 private static void warnIllegalValue(String attr, String elem, Object val) { 163 Main.warn(tr("Illegal value of attribute ''{0}'' of element ''{1}'' in server capabilities. Got ''{2}''", attr, elem, val));163 Logging.warn(tr("Illegal value of attribute ''{0}'' of element ''{1}'' in server capabilities. Got ''{2}''", attr, elem, val)); 164 164 } 165 165 -
trunk/src/org/openstreetmap/josm/io/CertificateAmendment.java
r12241 r12620 29 29 30 30 import org.openstreetmap.josm.Main; 31 import org.openstreetmap.josm.tools.Logging; 31 32 import org.openstreetmap.josm.tools.Utils; 32 33 … … 144 145 } 145 146 } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException | IllegalStateException e) { 146 Main.error(e);147 Logging.error(e); 147 148 } 148 149 … … 166 167 } 167 168 if (certificateIsMissing(keyStore, cert)) { 168 if ( Main.isDebugEnabled()) {169 Main.debug(tr("Adding certificate for TLS connections: {0}", cert.getSubjectX500Principal().getName()));169 if (Logging.isDebugEnabled()) { 170 Logging.debug(tr("Adding certificate for TLS connections: {0}", cert.getSubjectX500Principal().getName())); 170 171 } 171 172 String alias = "josm:" + new File(certAmend.id).getName(); -
trunk/src/org/openstreetmap/josm/io/ChangesetClosedException.java
r11878 r12620 9 9 import java.util.regex.Pattern; 10 10 11 import org.openstreetmap.josm. Main;11 import org.openstreetmap.josm.tools.Logging; 12 12 import org.openstreetmap.josm.tools.date.DateUtils; 13 13 … … 78 78 closedOn = DateUtils.newOsmApiDateTimeFormat().parse(m.group(2)); 79 79 } catch (ParseException ex) { 80 Main.error(tr("Failed to parse date ''{0}'' replied by server.", m.group(2)));81 Main.error(ex);80 Logging.error(tr("Failed to parse date ''{0}'' replied by server.", m.group(2))); 81 Logging.error(ex); 82 82 } 83 83 } else { 84 Main.error(tr("Unexpected format of error header for conflict in changeset update. Got ''{0}''", errorHeader));84 Logging.error(tr("Unexpected format of error header for conflict in changeset update. Got ''{0}''", errorHeader)); 85 85 } 86 86 } -
trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
r12495 r12620 16 16 import java.util.stream.Stream; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.Bounds; 20 19 import org.openstreetmap.josm.data.coor.LatLon; 21 20 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 22 21 import org.openstreetmap.josm.tools.CheckParameterUtil; 22 import org.openstreetmap.josm.tools.Logging; 23 23 import org.openstreetmap.josm.tools.Utils; 24 24 import org.openstreetmap.josm.tools.date.DateUtils; … … 267 267 CheckParameterUtil.ensureParameterNotNull(changesetIds, "changesetIds"); 268 268 if (changesetIds.size() > MAX_CHANGESETS_NUMBER) { 269 Main.warn("Changeset query built with more than " + MAX_CHANGESETS_NUMBER + " changeset ids (" + changesetIds.size() + ')');269 Logging.warn("Changeset query built with more than " + MAX_CHANGESETS_NUMBER + " changeset ids (" + changesetIds.size() + ')'); 270 270 } 271 271 this.changesetIds = changesetIds; … … 471 471 break; 472 472 default: 473 Main.warn("Unable to parse time: " + entry.getValue());473 Logging.warn("Unable to parse time: " + entry.getValue()); 474 474 } 475 475 break; -
trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java
r12537 r12620 21 21 import org.openstreetmap.josm.gui.preferences.server.ProxyPreferencesPanel; 22 22 import org.openstreetmap.josm.gui.preferences.server.ProxyPreferencesPanel.ProxyPolicy; 23 import org.openstreetmap.josm.tools.Logging; 23 24 24 25 /** … … 93 94 port = Integer.parseInt(value); 94 95 } catch (NumberFormatException e) { 95 Main.error(tr("Unexpected format for port number in preference ''{0}''. Got ''{1}''.", property, value));96 Main.error(tr("The proxy will not be used."));96 Logging.error(tr("Unexpected format for port number in preference ''{0}''. Got ''{1}''.", property, value)); 97 Logging.error(tr("The proxy will not be used.")); 97 98 return 0; 98 99 } 99 100 if (port <= 0 || port > 65_535) { 100 Main.error(tr("Illegal port number in preference ''{0}''. Got {1}.", property, port));101 Main.error(tr("The proxy will not be used."));101 Logging.error(tr("Illegal port number in preference ''{0}''. Got {1}.", property, port)); 102 Logging.error(tr("The proxy will not be used.")); 102 103 return 0; 103 104 } … … 116 117 proxyPolicy = ProxyPolicy.fromName(value); 117 118 if (proxyPolicy == null) { 118 Main.warn(tr("Unexpected value for preference ''{0}'' found. Got ''{1}''. Will use no proxy.",119 Logging.warn(tr("Unexpected value for preference ''{0}'' found. Got ''{1}''. Will use no proxy.", 119 120 ProxyPreferencesPanel.PROXY_POLICY, value)); 120 121 proxyPolicy = ProxyPolicy.NO_PROXY; … … 128 129 httpProxySocketAddress = new InetSocketAddress(host, port); 129 130 } else { 130 Main.warn(tr("Unexpected parameters for HTTP proxy. Got host ''{0}'' and port ''{1}''.", host, port));131 Main.warn(tr("The proxy will not be used."));131 Logging.warn(tr("Unexpected parameters for HTTP proxy. Got host ''{0}'' and port ''{1}''.", host, port)); 132 Logging.warn(tr("The proxy will not be used.")); 132 133 } 133 134 } … … 140 141 socksProxySocketAddress = new InetSocketAddress(host, port); 141 142 } else { 142 Main.warn(tr("Unexpected parameters for SOCKS proxy. Got host ''{0}'' and port ''{1}''.", host, port));143 Main.warn(tr("The proxy will not be used."));143 Logging.warn(tr("Unexpected parameters for SOCKS proxy. Got host ''{0}'' and port ''{1}''.", host, port)); 144 Logging.warn(tr("The proxy will not be used.")); 144 145 } 145 146 } … … 153 154 public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { 154 155 // Just log something. The network stack will also throw an exception which will be caught somewhere else 155 Main.error(tr("Connection to proxy ''{0}'' for URI ''{1}'' failed. Exception was: {2}", sa.toString(), uri.toString(), ioe.toString())); 156 Logging.error(tr("Connection to proxy ''{0}'' for URI ''{1}'' failed. Exception was: {2}", 157 sa.toString(), uri.toString(), ioe.toString())); 156 158 // Remember errors to give a friendly user message asking to review proxy configuration 157 159 errorResources.add(uri.toString()); … … 203 205 case USE_SYSTEM_SETTINGS: 204 206 if (!jvmWillUseSystemProxies) { 205 Main.warn(tr("The JVM is not configured to lookup proxies from the system settings. "+207 Logging.warn(tr("The JVM is not configured to lookup proxies from the system settings. "+ 206 208 "The property ''java.net.useSystemProxies'' was missing at startup time. Will not use a proxy.")); 207 209 return NO_PROXY_LIST; -
trunk/src/org/openstreetmap/josm/io/FileImporter.java
r12112 r12620 16 16 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 17 17 import org.openstreetmap.josm.gui.util.GuiHelper; 18 import org.openstreetmap.josm.tools.Logging; 18 19 import org.openstreetmap.josm.tools.Utils; 19 20 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; … … 89 90 public boolean importDataHandleExceptions(File f, ProgressMonitor progressMonitor) { 90 91 try { 91 Main.info("Open file: " + f.getAbsolutePath() + " (" + f.length() + " bytes)");92 Logging.info("Open file: " + f.getAbsolutePath() + " (" + f.length() + " bytes)"); 92 93 importData(f, progressMonitor); 93 94 return true; … … 110 111 111 112 private static void displayError(File f, Exception e) { 112 Main.error(e);113 Logging.error(e); 113 114 HelpAwareOptionPane.showMessageDialogInEDT( 114 115 Main.parent, … … 137 138 public boolean importDataHandleExceptions(List<File> files, ProgressMonitor progressMonitor) { 138 139 try { 139 Main.info("Open "+files.size()+" files");140 Logging.info("Open "+files.size()+" files"); 140 141 importData(files, progressMonitor); 141 142 return true; 142 143 } catch (IOException | IllegalDataException e) { 143 Main.error(e);144 Logging.error(e); 144 145 HelpAwareOptionPane.showMessageDialogInEDT( 145 146 Main.parent, -
trunk/src/org/openstreetmap/josm/io/FileWatcher.java
r11620 r12620 23 23 import org.openstreetmap.josm.gui.preferences.SourceEntry; 24 24 import org.openstreetmap.josm.tools.CheckParameterUtil; 25 import org.openstreetmap.josm.tools.Logging; 25 26 26 27 /** … … 44 45 thread = new Thread((Runnable) this::processEvents, "File Watcher"); 45 46 } catch (IOException e) { 46 Main.error(e);47 Logging.error(e); 47 48 } 48 49 } … … 104 105 */ 105 106 private void processEvents() { 106 if (Main.isDebugEnabled()) { 107 Main.debug("File watcher thread started"); 108 } 107 Logging.debug("File watcher thread started"); 109 108 while (true) { 110 109 … … 140 139 SourceEntry rule = ruleMap.get(fullPath); 141 140 if (style != null) { 142 Main.info("Map style "+style.getDisplayString()+" has been modified. Reloading style...");141 Logging.info("Map style "+style.getDisplayString()+" has been modified. Reloading style..."); 143 142 Main.worker.submit(new MapPaintStyleLoader(Collections.singleton(style))); 144 143 } else if (rule != null) { 145 Main.info("Validator rule "+rule.getDisplayString()+" has been modified. Reloading rule...");144 Logging.info("Validator rule "+rule.getDisplayString()+" has been modified. Reloading rule..."); 146 145 MapCSSTagChecker tagChecker = OsmValidator.getTest(MapCSSTagChecker.class); 147 146 if (tagChecker != null) { … … 149 148 tagChecker.addMapCSS(rule.url); 150 149 } catch (IOException | ParseException e) { 151 Main.warn(e);150 Logging.warn(e); 152 151 } 153 152 } 154 } else if ( Main.isDebugEnabled()) {155 Main.debug("Received "+kind.name()+" event for unregistered file: "+fullPath);153 } else if (Logging.isDebugEnabled()) { 154 Logging.debug("Received {0} event for unregistered file: {1}", kind.name(), fullPath); 156 155 } 157 156 } -
trunk/src/org/openstreetmap/josm/io/GeoJSONWriter.java
r12537 r12620 18 18 import javax.json.stream.JsonGenerator; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.data.Bounds; 22 21 import org.openstreetmap.josm.data.coor.EastNorth; … … 34 33 import org.openstreetmap.josm.gui.mappaint.ElemStyles; 35 34 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 35 import org.openstreetmap.josm.tools.Logging; 36 36 import org.openstreetmap.josm.tools.Pair; 37 37 … … 135 135 geomObj.add("coordinates", multiPolygon); 136 136 } catch (MultipolygonBuilder.JoinedPolygonCreationException ex) { 137 Main.warn("GeoJSON: Failed to export multipolygon {0}", r.getUniqueId());138 Main.warn(ex);137 Logging.warn("GeoJSON: Failed to export multipolygon {0}", r.getUniqueId()); 138 Logging.warn(ex); 139 139 } 140 140 } -
trunk/src/org/openstreetmap/josm/io/GpxExporter.java
r12279 r12620 35 35 import org.openstreetmap.josm.tools.CheckParameterUtil; 36 36 import org.openstreetmap.josm.tools.GBC; 37 import org.openstreetmap.josm.tools.Logging; 37 38 38 39 /** … … 205 206 fo.flush(); 206 207 } catch (IOException ex) { 207 Main.error(ex);208 Logging.error(ex); 208 209 JOptionPane.showMessageDialog(Main.parent, tr("Error while exporting {0}:\n{1}", fn, ex.getMessage()), 209 210 tr("Error"), JOptionPane.ERROR_MESSAGE); -
trunk/src/org/openstreetmap/josm/io/GpxImporter.java
r12421 r12620 17 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 18 18 import org.openstreetmap.josm.gui.util.GuiHelper; 19 import org.openstreetmap.josm.tools.Logging; 19 20 import org.xml.sax.SAXException; 20 21 … … 105 106 addLayers(loadLayers(r.getGpxData(), parsedProperly, fileName, tr("Markers from {0}", fileName))); 106 107 } catch (SAXException e) { 107 Main.error(e);108 Logging.error(e); 108 109 throw new IOException(tr("Parsing data for layer ''{0}'' failed", fileName), e); 109 110 } … … 184 185 return loadLayers(r.getGpxData(), parsedProperly, gpxLayerName, markerLayerName); 185 186 } catch (SAXException e) { 186 Main.error(e);187 Logging.error(e); 187 188 throw new IOException(tr("Parsing data for layer ''{0}'' failed", gpxLayerName), e); 188 189 } -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r12156 r12620 17 17 import javax.xml.parsers.ParserConfigurationException; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.Bounds; 21 20 import org.openstreetmap.josm.data.coor.LatLon; … … 27 26 import org.openstreetmap.josm.data.gpx.ImmutableGpxTrack; 28 27 import org.openstreetmap.josm.data.gpx.WayPoint; 28 import org.openstreetmap.josm.tools.Logging; 29 29 import org.openstreetmap.josm.tools.Utils; 30 30 import org.xml.sax.Attributes; … … 581 581 message += ' ' + tr("(at line {0}, column {1})", spe.getLineNumber(), spe.getColumnNumber()); 582 582 } 583 Main.warn(message);583 Logging.warn(message); 584 584 return false; 585 585 } else 586 586 throw e; 587 587 } catch (ParserConfigurationException e) { 588 Main.error(e); // broken SAXException chaining588 Logging.error(e); // broken SAXException chaining 589 589 throw new SAXException(e); 590 590 } -
trunk/src/org/openstreetmap/josm/io/InvalidXmlCharacterFilter.java
r9078 r12620 5 5 import java.io.Reader; 6 6 7 import org.openstreetmap.josm. Main;7 import org.openstreetmap.josm.tools.Logging; 8 8 9 9 /** … … 64 64 if (in < 0x20 && INVALID_CHARS[in]) { 65 65 if (firstWarning) { 66 Main.warn("Invalid xml character encountered: '"+in+"'.");66 Logging.warn("Invalid xml character encountered: '"+in+"'."); 67 67 firstWarning = false; 68 68 } -
trunk/src/org/openstreetmap/josm/io/MessageNotifier.java
r11969 r12620 30 30 import org.openstreetmap.josm.io.auth.JosmPreferencesCredentialAgent; 31 31 import org.openstreetmap.josm.tools.GBC; 32 import org.openstreetmap.josm.tools.Logging; 32 33 import org.openstreetmap.josm.tools.Utils; 33 34 … … 86 87 } 87 88 } catch (OsmTransferException e) { 88 Main.warn(e);89 Logging.warn(e); 89 90 } 90 91 } … … 97 98 int interval = PROP_INTERVAL.get(); 98 99 if (Main.isOffline(OnlineResource.OSM_API)) { 99 Main.info(tr("{0} not available (offline mode)", tr("Message notifier")));100 Logging.info(tr("{0} not available (offline mode)", tr("Message notifier"))); 100 101 } else if (!isRunning() && interval > 0 && isUserEnoughIdentified()) { 101 102 task = EXECUTOR.scheduleAtFixedRate(WORKER, 0, TimeUnit.MINUTES.toSeconds(interval), TimeUnit.SECONDS); 102 Main.info("Message notifier active (checks every "+interval+" minute"+(interval > 1 ? "s" : "")+')');103 Logging.info("Message notifier active (checks every "+interval+" minute"+(interval > 1 ? "s" : "")+')'); 103 104 } 104 105 } … … 110 111 if (isRunning()) { 111 112 task.cancel(false); 112 Main.info("Message notifier inactive");113 Logging.info("Message notifier inactive"); 113 114 task = null; 114 115 } … … 153 154 } 154 155 } catch (CredentialsAgentException e) { 155 Main.warn(e, "Unable to get credentials:");156 Logging.log(Logging.LEVEL_WARN, "Unable to get credentials:", e); 156 157 } 157 158 } -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r11809 r12620 38 38 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 39 39 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 40 import org.openstreetmap.josm.tools.Logging; 40 41 import org.openstreetmap.josm.tools.Utils; 41 42 … … 51 52 * reader.parseOsm(); 52 53 * if (!reader.getMissingPrimitives().isEmpty()) { 53 * Main.info("There are missing primitives: " + reader.getMissingPrimitives());54 * Logging.info("There are missing primitives: " + reader.getMissingPrimitives()); 54 55 * } 55 56 * if (!reader.getSkippedWays().isEmpty()) { 56 * Main.info("There are skipped ways: " + reader.getMissingPrimitives());57 * Logging.info("There are skipped ways: " + reader.getMissingPrimitives()); 57 58 * } 58 59 * </pre> … … 343 344 } 344 345 } catch (InterruptedException | ExecutionException e) { 345 Main.error(e);346 Logging.error(e); 346 347 } 347 348 } … … 487 488 } catch (OsmApiException e) { 488 489 if (e.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) { 489 Main.info(tr("Server replied with response code 404, retrying with an individual request for each object."));490 Logging.info(tr("Server replied with response code 404, retrying with an individual request for each object.")); 490 491 return singleGetIdPackage(type, pkg, progressMonitor); 491 492 } else { … … 524 525 } 525 526 } catch (IOException ex) { 526 Main.warn(ex);527 Logging.warn(ex); 527 528 } 528 529 return result; … … 552 553 } 553 554 } catch (IOException ex) { 554 Main.warn(ex);555 Logging.warn(ex); 555 556 } 556 557 return result; … … 591 592 } catch (OsmApiException e) { 592 593 if (e.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) { 593 Main.info(tr("Server replied with response code 404 for id {0}. Skipping.", Long.toString(id)));594 Logging.info(tr("Server replied with response code 404 for id {0}. Skipping.", Long.toString(id))); 594 595 result.missingPrimitives.add(new SimplePrimitiveId(id, type)); 595 596 } else { -
trunk/src/org/openstreetmap/josm/io/NameFinder.java
r12558 r12620 13 13 import javax.xml.parsers.ParserConfigurationException; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.Bounds; 17 16 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 21 20 import org.openstreetmap.josm.tools.HttpClient; 22 21 import org.openstreetmap.josm.tools.HttpClient.Response; 22 import org.openstreetmap.josm.tools.Logging; 23 23 import org.openstreetmap.josm.tools.OsmUrlToBounds; 24 24 import org.openstreetmap.josm.tools.UncheckedParseException; … … 250 250 } 251 251 } catch (NumberFormatException ex) { 252 Main.error(ex); // SAXException does not chain correctly252 Logging.error(ex); // SAXException does not chain correctly 253 253 throw new SAXException(ex.getMessage(), ex); 254 254 } catch (NullPointerException ex) { // NOPMD 255 Main.error(ex); // SAXException does not chain correctly255 Logging.error(ex); // SAXException does not chain correctly 256 256 throw new SAXException(tr("Null pointer exception, possibly some missing tags."), ex); 257 257 } -
trunk/src/org/openstreetmap/josm/io/NoteExporter.java
r11456 r12620 9 9 import java.io.OutputStream; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.actions.ExtensionFileFilter; 13 12 import org.openstreetmap.josm.gui.layer.Layer; 14 13 import org.openstreetmap.josm.gui.layer.NoteLayer; 14 import org.openstreetmap.josm.tools.Logging; 15 15 16 16 /** … … 37 37 @Override 38 38 public void exportData(File file, Layer layer) throws IOException { 39 Main.info("exporting notes to file: " + file);39 Logging.info("exporting notes to file: " + file); 40 40 if (layer instanceof NoteLayer) { 41 41 try (OutputStream os = new FileOutputStream(file); -
trunk/src/org/openstreetmap/josm/io/NoteImporter.java
r10432 r12620 14 14 import org.openstreetmap.josm.gui.layer.NoteLayer; 15 15 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 16 import org.openstreetmap.josm.tools.Logging; 16 17 import org.xml.sax.SAXException; 17 18 … … 32 33 @Override 33 34 public void importData(final File file, ProgressMonitor progressMonitor) throws IOException { 34 if ( Main.isDebugEnabled()) {35 Main.debug("importing notes file " +file.getAbsolutePath());35 if (Logging.isDebugEnabled()) { 36 Logging.debug("importing notes file {0}", file.getAbsolutePath()); 36 37 } 37 38 try (InputStream is = Compression.getUncompressedFileInputStream(file)) { … … 41 42 } 42 43 } catch (SAXException e) { 43 Main.error("error opening up notes file");44 Main.error(e, true);44 Logging.error("error opening up notes file"); 45 Logging.error(e); 45 46 throw new IOException(e.getMessage(), e); 46 47 } -
trunk/src/org/openstreetmap/josm/io/NoteReader.java
r11553 r12620 14 14 import javax.xml.parsers.ParserConfigurationException; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.coor.LatLon; 18 17 import org.openstreetmap.josm.data.notes.Note; … … 20 19 import org.openstreetmap.josm.data.notes.NoteComment.Action; 21 20 import org.openstreetmap.josm.data.osm.User; 21 import org.openstreetmap.josm.tools.Logging; 22 22 import org.openstreetmap.josm.tools.Utils; 23 23 import org.openstreetmap.josm.tools.date.DateUtils; … … 218 218 Utils.parseSafeSAX(inputSource, parser); 219 219 } catch (ParserConfigurationException e) { 220 Main.error(e); // broken SAXException chaining220 Logging.error(e); // broken SAXException chaining 221 221 throw new SAXException(e); 222 222 } -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r11535 r12620 37 37 import org.openstreetmap.josm.tools.CheckParameterUtil; 38 38 import org.openstreetmap.josm.tools.HttpClient; 39 import org.openstreetmap.josm.tools.Logging; 39 40 import org.openstreetmap.josm.tools.Utils; 40 41 import org.openstreetmap.josm.tools.XmlParsingException; … … 155 156 host = (new URL(serverUrl)).getHost(); 156 157 } catch (MalformedURLException e) { 157 Main.warn(e);158 Logging.warn(e); 158 159 } 159 160 return host; … … 212 213 initializeCapabilities(cache.updateIfRequiredString()); 213 214 } catch (SAXParseException parseException) { 214 Main.trace(parseException);215 Logging.trace(parseException); 215 216 // XML parsing may fail if JOSM previously stored a corrupted capabilities document (see #8278) 216 217 // In that case, force update and try again … … 219 220 if (capabilities == null) { 220 221 if (Main.isOffline(OnlineResource.OSM_API)) { 221 Main.warn(tr("{0} not available (offline mode)", tr("OSM API")));222 Logging.warn(tr("{0} not available (offline mode)", tr("OSM API"))); 222 223 } else { 223 Main.error(tr("Unable to initialize OSM API."));224 Logging.error(tr("Unable to initialize OSM API.")); 224 225 } 225 226 return; 226 227 } else if (!capabilities.supportsVersion("0.6")) { 227 Main.error(tr("This version of JOSM is incompatible with the configured server."));228 Main.error(tr("It supports protocol version 0.6, while the server says it supports {0} to {1}.",228 Logging.error(tr("This version of JOSM is incompatible with the configured server.")); 229 Logging.error(tr("It supports protocol version 0.6, while the server says it supports {0} to {1}.", 229 230 capabilities.get("version", "minimum"), capabilities.get("version", "maximum"))); 230 231 return; … … 243 244 for (Layer l : Main.getLayerManager().getLayersOfType(ImageryLayer.class)) { 244 245 if (((ImageryLayer) l).getInfo().isBlacklisted()) { 245 Main.info(tr("Removed layer {0} because it is not allowed by the configured API.", l.getName()));246 Logging.info(tr("Removed layer {0} because it is not allowed by the configured API.", l.getName())); 246 247 Main.getLayerManager().removeLayer(l); 247 248 } … … 284 285 osmWriter.flush(); 285 286 } catch (IOException e) { 286 Main.warn(e);287 Logging.warn(e); 287 288 } 288 289 return swriter.toString(); … … 303 304 osmWriter.flush(); 304 305 } catch (IOException e) { 305 Main.warn(e);306 Logging.warn(e); 306 307 } 307 308 return swriter.toString(); … … 552 553 553 554 private void sleepAndListen(int retry, ProgressMonitor monitor) throws OsmTransferCanceledException { 554 Main.info(tr("Waiting 10 seconds ... "));555 Logging.info(tr("Waiting 10 seconds ... ")); 555 556 for (int i = 0; i < 10; i++) { 556 557 if (monitor != null) { … … 562 563 Thread.sleep(1000); 563 564 } catch (InterruptedException ex) { 564 Main.warn("InterruptedException in "+getClass().getSimpleName()+" during sleep");565 Logging.warn("InterruptedException in "+getClass().getSimpleName()+" during sleep"); 565 566 Thread.currentThread().interrupt(); 566 567 } 567 568 } 568 Main.info(tr("OK - trying again."));569 Logging.info(tr("OK - trying again.")); 569 570 } 570 571 … … 652 653 653 654 final HttpClient.Response response = client.connect(); 654 Main.info(response.getResponseMessage());655 Logging.info(response.getResponseMessage()); 655 656 int retCode = response.getResponseCode(); 656 657 657 658 if (retCode >= 500 && retries-- > 0) { 658 659 sleepAndListen(retries, monitor); 659 Main.info(tr("Starting retry {0} of {1}.", getMaxRetries() - retries, getMaxRetries()));660 Logging.info(tr("Starting retry {0} of {1}.", getMaxRetries() - retries, getMaxRetries())); 660 661 continue; 661 662 } … … 667 668 if (response.getHeaderField("Error") != null) { 668 669 errorHeader = response.getHeaderField("Error"); 669 Main.error("Error header: " + errorHeader);670 Logging.error("Error header: " + errorHeader); 670 671 } else if (retCode != HttpURLConnection.HTTP_OK && responseBody.length() > 0) { 671 Main.error("Error body: " + responseBody);672 Logging.error("Error body: " + responseBody); 672 673 } 673 674 activeConnection.disconnect(); … … 859 860 throw new OsmTransferException(tr("Note upload failed")); 860 861 } catch (SAXException | IOException e) { 861 Main.error(e, true);862 Logging.error(e); 862 863 throw new OsmTransferException(tr("Error parsing note response from server"), e); 863 864 } -
trunk/src/org/openstreetmap/josm/io/OsmApiException.java
r10626 r12620 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import org.openstreetmap.josm. Main;5 import org.openstreetmap.josm.tools.Logging; 6 6 7 7 /** … … 146 146 } catch (IllegalArgumentException e) { 147 147 // Ignored 148 Main.trace(e);148 Logging.trace(e); 149 149 } 150 150 try { … … 157 157 } catch (IllegalArgumentException e) { 158 158 // Ignored 159 Main.trace(e);159 Logging.trace(e); 160 160 } 161 161 return sb.toString(); -
trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java
r12470 r12620 17 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 18 18 import org.openstreetmap.josm.gui.util.GuiHelper; 19 import org.openstreetmap.josm.tools.Logging; 19 20 20 21 /** … … 43 44 importData(Compression.getUncompressedFileInputStream(file), file, progressMonitor); 44 45 } catch (FileNotFoundException e) { 45 Main.error(e);46 Logging.error(e); 46 47 throw new IOException(tr("File ''{0}'' does not exist.", file.getName()), e); 47 48 } -
trunk/src/org/openstreetmap/josm/io/OsmChangesetContentParser.java
r9078 r12620 12 12 import javax.xml.parsers.ParserConfigurationException; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.data.osm.ChangesetDataSet; 16 15 import org.openstreetmap.josm.data.osm.ChangesetDataSet.ChangesetModificationType; … … 18 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 19 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 19 import org.openstreetmap.josm.tools.Logging; 20 20 import org.openstreetmap.josm.tools.Utils; 21 21 import org.openstreetmap.josm.tools.XmlParsingException; … … 69 69 break; 70 70 default: 71 Main.warn(tr("Unsupported start element ''{0}'' in changeset content at position ({1},{2}). Skipping.",71 Logging.warn(tr("Unsupported start element ''{0}'' in changeset content at position ({1},{2}). Skipping.", 72 72 qName, locator.getLineNumber(), locator.getColumnNumber())); 73 73 } … … 99 99 break; 100 100 default: 101 Main.warn(tr("Unsupported end element ''{0}'' in changeset content at position ({1},{2}). Skipping.",101 Logging.warn(tr("Unsupported end element ''{0}'' in changeset content at position ({1},{2}). Skipping.", 102 102 qName, locator.getLineNumber(), locator.getColumnNumber())); 103 103 } -
trunk/src/org/openstreetmap/josm/io/OsmConnection.java
r12470 r12620 23 23 import org.openstreetmap.josm.io.auth.CredentialsManager; 24 24 import org.openstreetmap.josm.tools.HttpClient; 25 import org.openstreetmap.josm.tools.Logging; 25 26 import org.openstreetmap.josm.tools.Utils; 26 27 … … 148 149 } else { 149 150 String msg = tr("Unexpected value for preference ''{0}''. Got ''{1}''.", "osm-server.auth-method", authMethod); 150 Main.warn(msg);151 Logging.warn(msg); 151 152 throw new OsmTransferException(msg); 152 153 } -
trunk/src/org/openstreetmap/josm/io/OsmExporter.java
r11848 r12620 19 19 import org.openstreetmap.josm.gui.layer.Layer; 20 20 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 21 import org.openstreetmap.josm.tools.Logging; 21 22 import org.openstreetmap.josm.tools.Utils; 22 23 … … 91 92 layer.onPostSaveToFile(); 92 93 } catch (IOException e) { 93 Main.error(e);94 Logging.error(e); 94 95 JOptionPane.showMessageDialog( 95 96 Main.parent, … … 106 107 } 107 108 } catch (IOException e2) { 108 Main.error(e2);109 Logging.error(e2); 109 110 JOptionPane.showMessageDialog( 110 111 Main.parent, -
trunk/src/org/openstreetmap/josm/io/OsmHistoryReader.java
r10462 r12620 11 11 import javax.xml.parsers.ParserConfigurationException; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.data.osm.history.HistoryDataSet; 15 14 import org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive; … … 17 16 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 18 17 import org.openstreetmap.josm.tools.CheckParameterUtil; 18 import org.openstreetmap.josm.tools.Logging; 19 19 import org.openstreetmap.josm.tools.Utils; 20 20 import org.xml.sax.Attributes; … … 94 94 Utils.parseSafeSAX(inputSource, new Parser()); 95 95 } catch (ParserConfigurationException e) { 96 Main.error(e); // broken SAXException chaining96 Logging.error(e); // broken SAXException chaining 97 97 throw new SAXException(e); 98 98 } finally { -
trunk/src/org/openstreetmap/josm/io/OsmImporter.java
r12470 r12620 18 18 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 19 19 import org.openstreetmap.josm.gui.util.GuiHelper; 20 import org.openstreetmap.josm.tools.Logging; 20 21 21 22 /** … … 79 80 importData(in, file, progressMonitor); 80 81 } catch (FileNotFoundException e) { 81 Main.error(e);82 Logging.error(e); 82 83 throw new IOException(tr("File ''{0}'' does not exist.", file.getName()), e); 83 84 } -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r12588 r12620 21 21 import javax.xml.stream.XMLStreamReader; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.data.Bounds; 25 24 import org.openstreetmap.josm.data.DataSource; … … 43 42 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 44 43 import org.openstreetmap.josm.tools.CheckParameterUtil; 44 import org.openstreetmap.josm.tools.Logging; 45 45 import org.openstreetmap.josm.tools.UncheckedParseException; 46 46 import org.openstreetmap.josm.tools.Utils; … … 202 202 Bounds copy = new Bounds(bounds); 203 203 bounds.normalize(); 204 Main.info("Bbox " + copy + " is out of the world, normalized to " + bounds);204 Logging.info("Bbox " + copy + " is out of the world, normalized to " + bounds); 205 205 } 206 206 DataSource src = new DataSource(bounds, origin); … … 225 225 nd.setCoor(ll); 226 226 } catch (NumberFormatException e) { 227 Main.trace(e);227 Logging.trace(e); 228 228 } 229 229 } … … 277 277 } 278 278 if (w.isDeleted() && !nodeIds.isEmpty()) { 279 Main.info(tr("Deleted way {0} contains nodes", w.getUniqueId()));279 Logging.info(tr("Deleted way {0} contains nodes", w.getUniqueId())); 280 280 nodeIds = new ArrayList<>(); 281 281 } … … 327 327 } 328 328 if (r.isDeleted() && !members.isEmpty()) { 329 Main.info(tr("Deleted relation {0} contains members", r.getUniqueId()));329 Logging.info(tr("Deleted relation {0} contains members", r.getUniqueId())); 330 330 members = new ArrayList<>(); 331 331 } … … 410 410 if (printWarning && ("note".equals(element) || "meta".equals(element))) { 411 411 // we know that Overpass API returns those elements 412 Main.debug(tr("Undefined element ''{0}'' found in input stream. Skipping.", element));412 Logging.debug(tr("Undefined element ''{0}'' found in input stream. Skipping.", element)); 413 413 } else if (printWarning) { 414 Main.info(tr("Undefined element ''{0}'' found in input stream. Skipping.", element));414 Logging.info(tr("Undefined element ''{0}'' found in input stream. Skipping.", element)); 415 415 } 416 416 while (true) { … … 505 505 Long.toString(current.getUniqueId()), versionString)); 506 506 } else if (version < 0 && current.isNew()) { 507 Main.warn(tr("Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.",507 Logging.warn(tr("Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", 508 508 current.getUniqueId(), version, 0, "0.6")); 509 509 version = 0; … … 539 539 current.setChangesetId(Integer.parseInt(v)); 540 540 } catch (IllegalArgumentException e) { 541 Main.debug(e.getMessage());541 Logging.debug(e.getMessage()); 542 542 if (current.isNew()) { 543 543 // for a new primitive we just log a warning 544 Main.info(tr("Illegal value for attribute ''changeset'' on new object {1}. Got {0}. Resetting to 0.",544 Logging.info(tr("Illegal value for attribute ''changeset'' on new object {1}. Got {0}. Resetting to 0.", 545 545 v, current.getUniqueId())); 546 546 current.setChangesetId(0); … … 551 551 } catch (IllegalStateException e) { 552 552 // thrown for positive changeset id on new primitives 553 Main.debug(e);554 Main.info(e.getMessage());553 Logging.debug(e); 554 Logging.info(e.getMessage()); 555 555 current.setChangesetId(0); 556 556 } … … 558 558 if (current.isNew()) { 559 559 // for a new primitive we just log a warning 560 Main.info(tr("Illegal value for attribute ''changeset'' on new object {1}. Got {0}. Resetting to 0.",560 Logging.info(tr("Illegal value for attribute ''changeset'' on new object {1}. Got {0}. Resetting to 0.", 561 561 v, current.getUniqueId())); 562 562 current.setChangesetId(0); -
trunk/src/org/openstreetmap/josm/io/OsmServerChangesetReader.java
r11193 r12620 13 13 import java.util.List; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.osm.Changeset; 17 16 import org.openstreetmap.josm.data.osm.ChangesetDataSet; … … 20 19 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 21 20 import org.openstreetmap.josm.tools.CheckParameterUtil; 21 import org.openstreetmap.josm.tools.Logging; 22 22 import org.openstreetmap.josm.tools.XmlParsingException; 23 23 … … 69 69 result = OsmChangesetParser.parse(in, monitor.createSubTaskMonitor(1, true)); 70 70 } catch (IOException e) { 71 Main.warn(e);71 Logging.warn(e); 72 72 } 73 73 } catch (OsmTransferException e) { … … 110 110 result = changesets.get(0); 111 111 } catch (IOException e) { 112 Main.warn(e);112 Logging.warn(e); 113 113 } 114 114 } catch (OsmTransferException e) { … … 160 160 ret.addAll(changesets); 161 161 } catch (IOException e) { 162 Main.warn(e);162 Logging.warn(e); 163 163 } 164 164 monitor.worked(1); … … 201 201 result = parser.parse(monitor.createSubTaskMonitor(1, true)); 202 202 } catch (IOException e) { 203 Main.warn(e);203 Logging.warn(e); 204 204 } 205 205 } catch (XmlParsingException e) { -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r12596 r12620 21 21 import org.openstreetmap.josm.io.auth.CredentialsManager; 22 22 import org.openstreetmap.josm.tools.HttpClient; 23 import org.openstreetmap.josm.tools.Logging; 23 24 import org.openstreetmap.josm.tools.Utils; 24 25 import org.openstreetmap.josm.tools.XmlParsingException; … … 48 49 doAuthenticate = OsmApi.isUsingOAuth() && CredentialsManager.getInstance().lookupOAuthAccessToken() != null; 49 50 } catch (CredentialsAgentException e) { 50 Main.warn(e);51 Logging.warn(e); 51 52 } 52 53 } … … 186 187 response = client.connect(progressMonitor); 187 188 } catch (IOException e) { 188 Main.error(e);189 Logging.error(e); 189 190 OsmTransferException ote = new OsmTransferException( 190 191 tr("Could not connect to the OSM server. Please check your internet connection."), e); … … 221 222 return response.fetchContent(); 222 223 } catch (IOException e) { 223 Main.error(e);224 Logging.error(e); 224 225 return tr("Reading error text failed."); 225 226 } -
trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java
r12598 r12620 19 19 import javax.xml.stream.XMLStreamException; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.data.Bounds; 23 22 import org.openstreetmap.josm.data.DataSource; … … 27 26 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 28 27 import org.openstreetmap.josm.tools.HttpClient; 28 import org.openstreetmap.josm.tools.Logging; 29 29 import org.openstreetmap.josm.tools.UncheckedParseException; 30 30 import org.openstreetmap.josm.tools.Utils; … … 168 168 break; 169 169 default: 170 Main.warn("Unsupported syntax: " + matcher.group(1));170 Logging.warn("Unsupported syntax: " + matcher.group(1)); 171 171 } 172 172 } catch (UncheckedParseException ex) { 173 173 final String msg = tr("Failed to evaluate {0}", matcher.group()); 174 Main.warn(ex, msg);174 Logging.log(Logging.LEVEL_WARN, msg, ex); 175 175 matcher.appendReplacement(sb, "// " + msg + "\n"); 176 176 } … … 245 245 reader = readerClass.getDeclaredConstructor().newInstance(); 246 246 } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) { 247 Main.error(e);247 Logging.error(e); 248 248 } 249 249 } -
trunk/src/org/openstreetmap/josm/io/audio/AudioPlayer.java
r12565 r12620 7 7 import org.openstreetmap.josm.Main; 8 8 import org.openstreetmap.josm.tools.JosmRuntimeException; 9 import org.openstreetmap.josm.tools.Logging; 9 10 10 11 /** … … 210 211 return audioPlayer; 211 212 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException ex) { 212 Main.error(ex);213 Logging.error(ex); 213 214 return null; 214 215 } … … 223 224 pause(); 224 225 } catch (InterruptedException | IOException e) { 225 Main.warn(e);226 Logging.warn(e); 226 227 } 227 228 audioPlayer.playingUrl = null; … … 238 239 soundPlayer = new JavaFxMediaPlayer(); 239 240 } catch (NoClassDefFoundError | InterruptedException e) { 240 Main.debug(e);241 Main.warn("Java FX is unavailable. Falling back to Java Sound API");241 Logging.debug(e); 242 Logging.warn("Java FX is unavailable. Falling back to Java Sound API"); 242 243 soundPlayer = new JavaSoundPlayer(leadIn, calibration); 243 244 } … … 298 299 command.ok(stateChange); 299 300 } catch (AudioException | IOException | SecurityException | IllegalArgumentException startPlayingException) { 300 Main.error(startPlayingException);301 Logging.error(startPlayingException); 301 302 command.failed(startPlayingException); // sets state 302 303 } 303 304 } catch (AudioException | IOException e) { 304 305 state = State.NOTPLAYING; 305 Main.error(e);306 Logging.error(e); 306 307 } 307 308 } -
trunk/src/org/openstreetmap/josm/io/audio/AudioUtil.java
r12328 r12620 16 16 17 17 import org.openstreetmap.josm.Main; 18 import org.openstreetmap.josm.tools.Logging; 18 19 19 20 /** … … 46 47 return naturalLength / calibration; 47 48 } catch (UnsupportedAudioFileException | IOException e) { 48 Main.debug(e);49 Logging.debug(e); 49 50 return 0.0; 50 51 } … … 62 63 else 63 64 msg = tr(msg); 64 Main.error(msg);65 Logging.error(msg); 65 66 if (!GraphicsEnvironment.isHeadless()) { 66 67 JOptionPane.showMessageDialog(Main.parent, -
trunk/src/org/openstreetmap/josm/io/audio/JavaSoundPlayer.java
r12414 r12620 15 15 import javax.sound.sampled.UnsupportedAudioFileException; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.io.audio.AudioPlayer.Execute; 19 18 import org.openstreetmap.josm.io.audio.AudioPlayer.State; 20 19 import org.openstreetmap.josm.tools.ListenerList; 20 import org.openstreetmap.josm.tools.Logging; 21 21 import org.openstreetmap.josm.tools.Utils; 22 22 … … 90 90 if (skippedBytes == 0) { 91 91 // Avoid inifinite loop 92 Main.warn("Unable to skip bytes from audio input stream");92 Logging.warn("Unable to skip bytes from audio input stream"); 93 93 bytesToSkip = 0; 94 94 } -
trunk/src/org/openstreetmap/josm/io/auth/CredentialsManager.java
r10627 r12620 7 7 import java.util.Objects; 8 8 9 import org.openstreetmap.josm.Main;10 9 import org.openstreetmap.josm.data.oauth.OAuthToken; 11 10 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 12 11 import org.openstreetmap.josm.io.OsmApi; 13 12 import org.openstreetmap.josm.tools.CheckParameterUtil; 13 import org.openstreetmap.josm.tools.Logging; 14 14 15 15 /** … … 104 104 } 105 105 } catch (CredentialsAgentException ex) { 106 Main.debug(ex);106 Logging.debug(ex); 107 107 return null; 108 108 } -
trunk/src/org/openstreetmap/josm/io/auth/DefaultAuthenticator.java
r9396 r12620 8 8 import java.util.Objects; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.io.OsmApi; 11 import org.openstreetmap.josm.tools.Logging; 12 12 import org.openstreetmap.josm.tools.Pair; 13 13 … … 65 65 return new PasswordAuthentication(response.getUsername(), response.getPassword()); 66 66 } catch (CredentialsAgentException e) { 67 Main.error(e);67 Logging.error(e); 68 68 return null; 69 69 } -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r12279 r12620 15 15 import javax.xml.parsers.ParserConfigurationException; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.data.imagery.ImageryInfo; 19 18 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryBounds; … … 24 23 import org.openstreetmap.josm.tools.JosmRuntimeException; 25 24 import org.openstreetmap.josm.tools.LanguageInfo; 25 import org.openstreetmap.josm.tools.Logging; 26 26 import org.openstreetmap.josm.tools.MultiMap; 27 27 import org.openstreetmap.josm.tools.Utils; … … 97 97 throw e; 98 98 } catch (ParserConfigurationException e) { 99 Main.error(e); // broken SAXException chaining99 Logging.error(e); // broken SAXException chaining 100 100 throw new SAXException(e); 101 101 } … … 219 219 atts.getValue("max-lon"), ","); 220 220 } catch (IllegalArgumentException e) { 221 Main.trace(e);221 Logging.trace(e); 222 222 break; 223 223 } … … 252 252 shape.addPoint(atts.getValue("lat"), atts.getValue("lon")); 253 253 } catch (IllegalArgumentException e) { 254 Main.trace(e);254 Logging.trace(e); 255 255 break; 256 256 } -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r12557 r12620 25 25 import javax.xml.parsers.ParserConfigurationException; 26 26 27 import org.openstreetmap.josm.Main;28 27 import org.openstreetmap.josm.data.Bounds; 29 28 import org.openstreetmap.josm.data.imagery.ImageryInfo; … … 31 30 import org.openstreetmap.josm.tools.HttpClient; 32 31 import org.openstreetmap.josm.tools.HttpClient.Response; 32 import org.openstreetmap.josm.tools.Logging; 33 33 import org.openstreetmap.josm.tools.Utils; 34 34 import org.w3c.dom.Document; … … 223 223 serviceUrl = new URL(serviceUrlStr); 224 224 } catch (HeadlessException e) { 225 Main.warn(e);225 Logging.warn(e); 226 226 return; 227 227 } … … 229 229 final Response response = HttpClient.create(getCapabilitiesUrl).connect(); 230 230 final String incomingData = response.fetchContent(); 231 Main.debug("Server response to Capabilities request:");232 Main.debug(incomingData);231 Logging.debug("Server response to Capabilities request:"); 232 Logging.debug(incomingData); 233 233 234 234 if (response.getResponseCode() >= 400) { … … 239 239 DocumentBuilder builder = Utils.newSafeDOMBuilder(); 240 240 builder.setEntityResolver((publicId, systemId) -> { 241 Main.info("Ignoring DTD " + publicId + ", " + systemId);241 Logging.info("Ignoring DTD " + publicId + ", " + systemId); 242 242 return new InputSource(new StringReader("")); 243 243 }); … … 267 267 String baseURL = child.getAttribute("xlink:href"); 268 268 if (!baseURL.equals(serviceUrlStr)) { 269 Main.info("GetCapabilities specifies a different service URL: " + baseURL);269 Logging.info("GetCapabilities specifies a different service URL: " + baseURL); 270 270 serviceUrl = new URL(baseURL); 271 271 } … … 283 283 boolean isFormatSupported = isImageFormatSupported(format); 284 284 if (!isFormatSupported) { 285 Main.info("Skipping unsupported image format {0}", format);285 Logging.info("Skipping unsupported image format {0}", format); 286 286 } 287 287 return isFormatSupported; -
trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java
r12617 r12620 16 16 import java.util.Optional; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.coor.LatLon; 20 19 import org.openstreetmap.josm.data.gpx.GpxConstants; … … 23 22 import org.openstreetmap.josm.data.gpx.WayPoint; 24 23 import org.openstreetmap.josm.io.IllegalDataException; 24 import org.openstreetmap.josm.tools.Logging; 25 25 import org.openstreetmap.josm.tools.date.DateUtils; 26 26 … … 209 209 210 210 } catch (IllegalDataException e) { 211 Main.warn(e);211 Logging.warn(e); 212 212 } 213 213 } … … 480 480 } catch (IllegalArgumentException | IndexOutOfBoundsException | IllegalDataException ex) { 481 481 if (ps.malformed < 5) { 482 Main.warn(ex);482 Logging.warn(ex); 483 483 } else { 484 Main.debug(ex);484 Logging.debug(ex); 485 485 } 486 486 ps.malformed++; -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpServer.java
r11620 r12620 10 10 11 11 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.tools.Logging; 12 13 13 14 /** … … 37 38 instance4.start(); 38 39 } catch (IOException ex) { 39 Main.debug(ex);40 Main.warn(marktr("Cannot start IPv4 remotecontrol server on port {0}: {1}"),40 Logging.debug(ex); 41 Logging.warn(marktr("Cannot start IPv4 remotecontrol server on port {0}: {1}"), 41 42 Integer.toString(port), ex.getLocalizedMessage()); 42 43 } … … 47 48 /* only show error when we also have no IPv4 */ 48 49 if (instance4 == null) { 49 Main.debug(ex);50 Main.warn(marktr("Cannot start IPv6 remotecontrol server on port {0}: {1}"),50 Logging.debug(ex); 51 Logging.warn(marktr("Cannot start IPv6 remotecontrol server on port {0}: {1}"), 51 52 Integer.toString(port), ex.getLocalizedMessage()); 52 53 } … … 63 64 instance4.stopServer(); 64 65 } catch (IOException ioe) { 65 Main.error(ioe);66 Logging.error(ioe); 66 67 } 67 68 instance4 = null; … … 71 72 instance6.stopServer(); 72 73 } catch (IOException ioe) { 73 Main.error(ioe);74 Logging.error(ioe); 74 75 } 75 76 instance6 = null; … … 96 97 @Override 97 98 public void run() { 98 Main.info(marktr("RemoteControl::Accepting remote connections on {0}:{1}"),99 Logging.info(marktr("RemoteControl::Accepting remote connections on {0}:{1}"), 99 100 server.getInetAddress(), Integer.toString(server.getLocalPort())); 100 101 while (true) { … … 105 106 } catch (SocketException e) { 106 107 if (!server.isClosed()) { 107 Main.error(e);108 Logging.error(e); 108 109 } else { 109 110 // stop the thread automatically if server is stopped … … 111 112 } 112 113 } catch (IOException ioe) { 113 Main.error(ioe);114 Logging.error(ioe); 114 115 } 115 116 } … … 122 123 */ 123 124 public void stopServer() throws IOException { 124 Main.info(marktr("RemoteControl::Server {0}:{1} stopped."),125 Logging.info(marktr("RemoteControl::Server {0}:{1} stopped."), 125 126 server.getInetAddress(), Integer.toString(server.getLocalPort())); 126 127 server.close(); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java
r12458 r12620 41 41 import org.openstreetmap.josm.Main; 42 42 import org.openstreetmap.josm.data.preferences.StringProperty; 43 import org.openstreetmap.josm.tools.Logging; 43 44 44 45 import sun.security.util.ObjectIdentifier; … … 208 209 209 210 if (!path.toFile().exists()) { 210 Main.debug("No keystore found, creating a new one");211 Logging.debug("No keystore found, creating a new one"); 211 212 212 213 // Create new keystore like previous one generated with JDK keytool as follows: … … 252 253 ks.load(in, KEYSTORE_PASSWORD.get().toCharArray()); 253 254 254 if ( Main.isDebugEnabled()) {255 if (Logging.isDebugEnabled()) { 255 256 for (Enumeration<String> aliases = ks.aliases(); aliases.hasMoreElements();) { 256 Main.debug("Alias in JOSM keystore: "+aliases.nextElement());257 Logging.debug("Alias in JOSM keystore: {0}", aliases.nextElement()); 257 258 } 258 259 } … … 278 279 sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); 279 280 280 if ( Main.isTraceEnabled()) {281 Main.trace("SSL Context protocol: " +sslContext.getProtocol());282 Main.trace("SSL Context provider: " +sslContext.getProvider());281 if (Logging.isTraceEnabled()) { 282 Logging.trace("SSL Context protocol: {0}", sslContext.getProtocol()); 283 Logging.trace("SSL Context provider: {0}", sslContext.getProvider()); 283 284 } 284 285 … … 316 317 instance4.start(); 317 318 } catch (IOException | GeneralSecurityException ex) { 318 Main.debug(ex);319 Main.warn(marktr("Cannot start IPv4 remotecontrol https server on port {0}: {1}"),319 Logging.debug(ex); 320 Logging.warn(marktr("Cannot start IPv4 remotecontrol https server on port {0}: {1}"), 320 321 Integer.toString(port), ex.getLocalizedMessage()); 321 322 } … … 326 327 /* only show error when we also have no IPv4 */ 327 328 if (instance4 == null) { 328 Main.debug(ex);329 Main.warn(marktr("Cannot start IPv6 remotecontrol https server on port {0}: {1}"),329 Logging.debug(ex); 330 Logging.warn(marktr("Cannot start IPv6 remotecontrol https server on port {0}: {1}"), 330 331 Integer.toString(port), ex.getLocalizedMessage()); 331 332 } … … 342 343 instance4.stopServer(); 343 344 } catch (IOException ioe) { 344 Main.error(ioe);345 Logging.error(ioe); 345 346 } 346 347 instance4 = null; … … 350 351 instance6.stopServer(); 351 352 } catch (IOException ioe) { 352 Main.error(ioe);353 Logging.error(ioe); 353 354 } 354 355 instance6 = null; … … 372 373 // Create SSL Server factory 373 374 SSLServerSocketFactory factory = sslContext.getServerSocketFactory(); 374 if ( Main.isTraceEnabled()) {375 Main.trace("SSL factory - Supported Cipher suites: "+Arrays.toString(factory.getSupportedCipherSuites()));375 if (Logging.isTraceEnabled()) { 376 Logging.trace("SSL factory - Supported Cipher suites: {0}", Arrays.toString(factory.getSupportedCipherSuites())); 376 377 } 377 378 … … 379 380 RemoteControl.getInet6Address() : RemoteControl.getInet4Address()); 380 381 381 if ( Main.isTraceEnabled() && server instanceof SSLServerSocket) {382 if (Logging.isTraceEnabled() && server instanceof SSLServerSocket) { 382 383 SSLServerSocket sslServer = (SSLServerSocket) server; 383 Main.trace("SSL server - Enabled Cipher suites: "+Arrays.toString(sslServer.getEnabledCipherSuites()));384 Main.trace("SSL server - Enabled Protocols: "+Arrays.toString(sslServer.getEnabledProtocols()));385 Main.trace("SSL server - Enable Session Creation: "+sslServer.getEnableSessionCreation());386 Main.trace("SSL server - Need Client Auth: "+sslServer.getNeedClientAuth());387 Main.trace("SSL server - Want Client Auth: "+sslServer.getWantClientAuth());388 Main.trace("SSL server - Use Client Mode: "+sslServer.getUseClientMode());384 Logging.trace("SSL server - Enabled Cipher suites: {0}", Arrays.toString(sslServer.getEnabledCipherSuites())); 385 Logging.trace("SSL server - Enabled Protocols: {0}", Arrays.toString(sslServer.getEnabledProtocols())); 386 Logging.trace("SSL server - Enable Session Creation: {0}", sslServer.getEnableSessionCreation()); 387 Logging.trace("SSL server - Need Client Auth: {0}", sslServer.getNeedClientAuth()); 388 Logging.trace("SSL server - Want Client Auth: {0}", sslServer.getWantClientAuth()); 389 Logging.trace("SSL server - Use Client Mode: {0}", sslServer.getUseClientMode()); 389 390 } 390 391 } … … 395 396 @Override 396 397 public void run() { 397 Main.info(marktr("RemoteControl::Accepting secure remote connections on {0}:{1}"),398 Logging.info(marktr("RemoteControl::Accepting secure remote connections on {0}:{1}"), 398 399 server.getInetAddress(), Integer.toString(server.getLocalPort())); 399 400 while (true) { … … 401 402 @SuppressWarnings("resource") 402 403 Socket request = server.accept(); 403 if ( Main.isTraceEnabled() && request instanceof SSLSocket) {404 if (Logging.isTraceEnabled() && request instanceof SSLSocket) { 404 405 SSLSocket sslSocket = (SSLSocket) request; 405 Main.trace("SSL socket - Enabled Cipher suites: "+Arrays.toString(sslSocket.getEnabledCipherSuites()));406 Main.trace("SSL socket - Enabled Protocols: "+Arrays.toString(sslSocket.getEnabledProtocols()));407 Main.trace("SSL socket - Enable Session Creation: "+sslSocket.getEnableSessionCreation());408 Main.trace("SSL socket - Need Client Auth: "+sslSocket.getNeedClientAuth());409 Main.trace("SSL socket - Want Client Auth: "+sslSocket.getWantClientAuth());410 Main.trace("SSL socket - Use Client Mode: "+sslSocket.getUseClientMode());411 Main.trace("SSL socket - Session: "+sslSocket.getSession());406 Logging.trace("SSL socket - Enabled Cipher suites: {0}", Arrays.toString(sslSocket.getEnabledCipherSuites())); 407 Logging.trace("SSL socket - Enabled Protocols: {0}", Arrays.toString(sslSocket.getEnabledProtocols())); 408 Logging.trace("SSL socket - Enable Session Creation: {0}", sslSocket.getEnableSessionCreation()); 409 Logging.trace("SSL socket - Need Client Auth: {0}", sslSocket.getNeedClientAuth()); 410 Logging.trace("SSL socket - Want Client Auth: {0}", sslSocket.getWantClientAuth()); 411 Logging.trace("SSL socket - Use Client Mode: {0}", sslSocket.getUseClientMode()); 412 Logging.trace("SSL socket - Session: {0}", sslSocket.getSession()); 412 413 } 413 414 RequestProcessor.processRequest(request); 414 415 } catch (SocketException e) { 415 416 if (!server.isClosed()) { 416 Main.error(e);417 Logging.error(e); 417 418 } 418 419 } catch (IOException ioe) { 419 Main.error(ioe);420 Logging.error(ioe); 420 421 } 421 422 } … … 428 429 */ 429 430 public void stopServer() throws IOException { 430 Main.info(marktr("RemoteControl::Server {0}:{1} stopped."),431 Logging.info(marktr("RemoteControl::Server {0}:{1} stopped."), 431 432 server.getInetAddress(), Integer.toString(server.getLocalPort())); 432 433 server.close(); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
r11952 r12620 25 25 import java.util.regex.Pattern; 26 26 27 import org.openstreetmap.josm.Main;28 27 import org.openstreetmap.josm.gui.help.HelpUtil; 29 28 import org.openstreetmap.josm.io.remotecontrol.handler.AddNodeHandler; … … 41 40 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerForbiddenException; 42 41 import org.openstreetmap.josm.io.remotecontrol.handler.VersionHandler; 42 import org.openstreetmap.josm.tools.Logging; 43 43 import org.openstreetmap.josm.tools.Utils; 44 44 … … 119 119 String commandWithSlash = '/' + command; 120 120 if (handlers.get(commandWithSlash) != null) { 121 Main.info("RemoteControl: ignoring duplicate command " + command121 Logging.info("RemoteControl: ignoring duplicate command " + command 122 122 + " with handler " + handler.getName()); 123 123 } else { 124 124 if (!silent) { 125 Main.info("RemoteControl: adding command \"" +125 Logging.info("RemoteControl: adding command \"" + 126 126 command + "\" (handled by " + handler.getSimpleName() + ')'); 127 127 } … … 161 161 return; 162 162 } 163 Main.info("RemoteControl received: " + get);163 Logging.info("RemoteControl received: " + get); 164 164 165 165 StringTokenizer st = new StringTokenizer(get); … … 247 247 out.flush(); 248 248 } catch (RequestHandlerErrorException ex) { 249 Main.debug(ex);249 Logging.debug(ex); 250 250 sendError(out); 251 251 } catch (RequestHandlerBadRequestException ex) { 252 Main.debug(ex);252 Logging.debug(ex); 253 253 sendBadRequest(out, ex.getMessage()); 254 254 } catch (RequestHandlerForbiddenException ex) { 255 Main.debug(ex);255 Logging.debug(ex); 256 256 sendForbidden(out, ex.getMessage()); 257 257 } … … 259 259 260 260 } catch (IOException ioe) { 261 Main.debug(Main.getErrorMessage(ioe));261 Logging.debug(Logging.getErrorMessage(ioe)); 262 262 } catch (ReflectiveOperationException e) { 263 Main.error(e);263 Logging.error(e); 264 264 try { 265 265 sendError(out); 266 266 } catch (IOException e1) { 267 Main.warn(e1);267 Logging.warn(e1); 268 268 } 269 269 } finally { … … 271 271 request.close(); 272 272 } catch (IOException e) { 273 Main.debug(Main.getErrorMessage(e));273 Logging.debug(Logging.getErrorMessage(e)); 274 274 } 275 275 } … … 402 402 handler = handlers.get(cmd).getConstructor().newInstance(); 403 403 } catch (ReflectiveOperationException ex) { 404 Main.error(ex);404 Logging.error(ex); 405 405 return null; 406 406 } … … 410 410 return w.toString(); 411 411 } catch (IOException e) { 412 Main.error(e);412 Logging.error(e); 413 413 return null; 414 414 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java
r10716 r12620 17 17 import org.openstreetmap.josm.io.remotecontrol.AddTagsDialog; 18 18 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 19 import org.openstreetmap.josm.tools.Logging; 19 20 20 21 /** … … 77 78 78 79 // Parse the arguments 79 Main.info("Adding node at (" + lat + ", " + lon + ')');80 Logging.info("Adding node at (" + lat + ", " + lon + ')'); 80 81 81 82 // Create a new node -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/FeaturesHandler.java
r11567 r12620 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import org.openstreetmap.josm.Main;7 6 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 8 7 import org.openstreetmap.josm.io.remotecontrol.RequestProcessor; 8 import org.openstreetmap.josm.tools.Logging; 9 9 10 10 /** … … 37 37 buf.append(info); 38 38 } else { 39 Main.warn("Unknown handler {0} passed to /features request", s);39 Logging.warn("Unknown handler {0} passed to /features request", s); 40 40 } 41 41 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java
r10728 r12620 13 13 import org.openstreetmap.josm.gui.util.GuiHelper; 14 14 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 15 import org.openstreetmap.josm.tools.Logging; 15 16 import org.openstreetmap.josm.tools.Utils; 16 17 … … 77 78 imgInfo.setDefaultMinZoom(Integer.parseInt(minZoom)); 78 79 } catch (NumberFormatException e) { 79 Main.error(e);80 Logging.error(e); 80 81 } 81 82 } … … 85 86 imgInfo.setDefaultMaxZoom(Integer.parseInt(maxZoom)); 86 87 } catch (NumberFormatException e) { 87 Main.error(e);88 Logging.error(e); 88 89 } 89 90 } … … 97 98 for (ImageryLayer layer : Main.getLayerManager().getLayersOfType(ImageryLayer.class)) { 98 99 if (layer.getInfo().equals(imgInfo)) { 99 Main.info("Imagery layer already exists: "+imgInfo);100 Logging.info("Imagery layer already exists: "+imgInfo); 100 101 return; 101 102 } … … 106 107 Main.getLayerManager().addLayer(ImageryLayer.create(imgInfo)); 107 108 } catch (IllegalArgumentException e) { 108 Main.error(e, false);109 Logging.log(Logging.LEVEL_ERROR, e); 109 110 } 110 111 }); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
r11746 r12620 14 14 import org.openstreetmap.josm.actions.downloadtasks.DownloadTask; 15 15 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 16 import org.openstreetmap.josm.tools.Logging; 16 17 import org.openstreetmap.josm.tools.Utils; 17 18 … … 36 37 // For compatibility reasons with older instances of JOSM, arbitrary choice of DownloadOsmTask 37 38 // As of 2015-04, Overpass Turbo requires this branch of code ... 38 Main.debug("Remote control, /import: defaulting to DownloadOsmTask");39 Logging.debug("Remote control, /import: defaulting to DownloadOsmTask"); 39 40 new DownloadOsmTask().loadUrl(isLoadInNewLayer(), url.toExternalForm(), null); 40 41 } else if (Main.pref.getBoolean("remotecontrol.import.interactive", true)) { … … 48 49 } 49 50 } catch (RuntimeException ex) { // NOPMD 50 Main.warn("RemoteControl: Error parsing import remote control request:");51 Main.error(ex);51 Logging.warn("RemoteControl: Error parsing import remote control request:"); 52 Logging.error(ex); 52 53 throw new RequestHandlerErrorException(ex); 53 54 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r12472 r12620 29 29 import org.openstreetmap.josm.io.remotecontrol.AddTagsDialog; 30 30 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 31 import org.openstreetmap.josm.tools.Logging; 31 32 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 32 33 import org.openstreetmap.josm.tools.Utils; … … 114 115 if (command.equals(myCommand)) { 115 116 if (!PermissionPrefWithDefault.LOAD_DATA.isAllowed()) { 116 Main.info("RemoteControl: download forbidden by preferences");117 Logging.info("RemoteControl: download forbidden by preferences"); 117 118 } else { 118 119 Area toDownload = null; … … 138 139 } 139 140 if (toDownload != null && toDownload.isEmpty()) { 140 Main.info("RemoteControl: no download necessary");141 Logging.info("RemoteControl: no download necessary"); 141 142 } else { 142 143 Future<?> future = osmTask.download(newLayer, new Bounds(minlat, minlon, maxlat, maxlon), … … 147 148 } 148 149 } catch (RuntimeException ex) { // NOPMD 149 Main.warn("RemoteControl: Error parsing load_and_zoom remote control request:");150 Main.error(ex);150 Logging.warn("RemoteControl: Error parsing load_and_zoom remote control request:"); 151 Logging.error(ex); 151 152 throw new RequestHandlerErrorException(ex); 152 153 } … … 200 201 }); 201 202 } catch (SearchCompiler.ParseError ex) { 202 Main.error(ex);203 Logging.error(ex); 203 204 throw new RequestHandlerErrorException(ex); 204 205 } … … 284 285 toSelect.add(SimplePrimitiveId.fromString(item)); 285 286 } catch (IllegalArgumentException ex) { 286 Main.warn(ex, "RemoteControl: invalid selection '" + item + "' ignored");287 Logging.log(Logging.LEVEL_WARN, "RemoteControl: invalid selection '" + item + "' ignored", ex); 287 288 } 288 289 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandler.java
r12472 r12620 18 18 import org.openstreetmap.josm.io.remotecontrol.AddTagsDialog; 19 19 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 20 import org.openstreetmap.josm.tools.Logging; 20 21 21 22 /** … … 59 60 protected void handleRequest() throws RequestHandlerErrorException, RequestHandlerBadRequestException { 60 61 if (!PermissionPrefWithDefault.LOAD_DATA.isAllowed()) { 61 Main.info("RemoteControl: download forbidden by preferences");62 Logging.info("RemoteControl: download forbidden by preferences"); 62 63 } 63 64 if (!ps.isEmpty()) { … … 102 103 ps.add(SimplePrimitiveId.fromString(i)); 103 104 } catch (IllegalArgumentException e) { 104 Main.warn(e, "RemoteControl: invalid selection '"+i+"' ignored.");105 Logging.log(Logging.LEVEL_WARN, "RemoteControl: invalid selection '"+i+"' ignored.", e); 105 106 } 106 107 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r11567 r12620 20 20 import org.openstreetmap.josm.Main; 21 21 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 22 import org.openstreetmap.josm.tools.Logging; 22 23 import org.openstreetmap.josm.tools.Utils; 23 24 … … 148 149 if (permissionPref != null && permissionPref.pref != null && !Main.pref.getBoolean(permissionPref.pref, permissionPref.defaultVal)) { 149 150 String err = MessageFormat.format("RemoteControl: ''{0}'' forbidden by preferences", myCommand); 150 Main.info(err);151 Logging.info(err); 151 152 throw new RequestHandlerForbiddenException(err); 152 153 } … … 228 229 if (value == null || value.isEmpty()) { 229 230 error = true; 230 Main.warn('\'' + myCommand + "' remote control request must have '" + key + "' parameter");231 Logging.warn('\'' + myCommand + "' remote control request must have '" + key + "' parameter"); 231 232 missingKeys.add(key); 232 233 } … … 241 242 for (String par: args.keySet()) { 242 243 if (!knownParams.contains(par)) { 243 Main.warn("Unknown remote control parameter {0}, skipping it", par);244 Logging.warn("Unknown remote control parameter {0}, skipping it", par); 244 245 } 245 246 } -
trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionExporter.java
r9983 r12620 12 12 import javax.swing.SwingConstants; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.gui.layer.Layer; 16 15 import org.openstreetmap.josm.gui.layer.geoimage.GeoImageLayer; 17 16 import org.openstreetmap.josm.gui.layer.geoimage.ImageEntry; 18 17 import org.openstreetmap.josm.tools.GBC; 18 import org.openstreetmap.josm.tools.Logging; 19 19 import org.w3c.dom.Element; 20 20 … … 66 66 67 67 if (entry.getFile() == null) { 68 Main.warn("No file attribute for image - skipping entry");68 Logging.warn("No file attribute for image - skipping entry"); 69 69 break; 70 70 } -
trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionImporter.java
r11522 r12620 10 10 import java.util.List; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.data.coor.LatLon; 14 13 import org.openstreetmap.josm.gui.layer.GpxLayer; … … 18 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 19 18 import org.openstreetmap.josm.io.IllegalDataException; 19 import org.openstreetmap.josm.tools.Logging; 20 20 import org.w3c.dom.Element; 21 21 import org.w3c.dom.Node; … … 117 117 // TODO: handle thumbnail loading 118 118 } catch (NumberFormatException e) { 119 Main.trace(e);119 Logging.trace(e); 120 120 } 121 121 } -
trunk/src/org/openstreetmap/josm/io/session/ImagerySessionImporter.java
r12604 r12620 8 8 import java.util.Map; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.data.Preferences; 12 11 import org.openstreetmap.josm.data.imagery.ImageryInfo; … … 23 22 import org.openstreetmap.josm.io.IllegalDataException; 24 23 import org.openstreetmap.josm.io.session.SessionReader.ImportSupport; 24 import org.openstreetmap.josm.tools.Logging; 25 25 import org.openstreetmap.josm.tools.Utils; 26 26 import org.w3c.dom.Element; … … 50 50 String zoomStr = attributes.get("zoom-level"); 51 51 if (zoomStr != null) { 52 53 54 55 56 Main.warn(e);57 58 52 support.addPostLayersTask(() -> { 53 try { 54 tsLayer.setZoomLevel(Integer.parseInt(zoomStr)); 55 } catch (NumberFormatException e) { 56 Logging.warn(e); 57 } 58 }); 59 59 } 60 60 } -
trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
r12542 r12620 45 45 import org.openstreetmap.josm.tools.CheckParameterUtil; 46 46 import org.openstreetmap.josm.tools.JosmRuntimeException; 47 import org.openstreetmap.josm.tools.Logging; 47 48 import org.openstreetmap.josm.tools.MultiMap; 48 49 import org.openstreetmap.josm.tools.Utils; … … 447 448 active = !activeAtt.isEmpty() ? (Integer.parseInt(activeAtt)-1) : -1; 448 449 } catch (NumberFormatException e) { 449 Main.warn("Unsupported value for 'active' layer attribute. Ignoring it. Error was: "+e.getMessage());450 Logging.warn("Unsupported value for 'active' layer attribute. Ignoring it. Error was: "+e.getMessage()); 450 451 active = -1; 451 452 } … … 468 469 idx = Integer.valueOf(e.getAttribute("index")); 469 470 } catch (NumberFormatException ex) { 470 Main.warn(ex);471 Logging.warn(ex); 471 472 } 472 473 if (idx == null) { … … 485 486 d = Integer.valueOf(sd); 486 487 } catch (NumberFormatException ex) { 487 Main.warn(ex);488 Logging.warn(ex); 488 489 } 489 490 if (d != null) { … … 567 568 } 568 569 if (exception != null) { 569 Main.error(exception);570 Logging.error(exception); 570 571 if (!GraphicsEnvironment.isHeadless()) { 571 572 CancelOrContinueDialog dialog = new CancelOrContinueDialog(); … … 607 608 layer.setOpacity(opacity); 608 609 } catch (NumberFormatException ex) { 609 Main.warn(ex);610 Logging.warn(ex); 610 611 } 611 612 } … … 625 626 Double.parseDouble(centerEl.getAttribute("lon"))); 626 627 } catch (NumberFormatException ex) { 627 Main.warn(ex);628 Logging.warn(ex); 628 629 } 629 630 if (center == null) return null; … … 634 635 return new SessionViewportData(center, scale); 635 636 } catch (NumberFormatException ex) { 636 Main.warn(ex);637 Logging.warn(ex); 637 638 return null; 638 639 } -
trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java
r12489 r12620 43 43 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 44 44 import org.openstreetmap.josm.tools.JosmRuntimeException; 45 import org.openstreetmap.josm.tools.Logging; 45 46 import org.openstreetmap.josm.tools.MultiMap; 46 47 import org.openstreetmap.josm.tools.Utils; … … 241 242 int depIndex = layers.indexOf(depLayer); 242 243 if (depIndex == -1) { 243 Main.warn("Unable to find " + depLayer);244 Logging.warn("Unable to find " + depLayer); 244 245 } else { 245 246 depsInt.add(depIndex+1);
Note:
See TracChangeset
for help on using the changeset viewer.