Changeset 12620 in josm for trunk/src/org/openstreetmap/josm/data/validation
- Timestamp:
- 2017-08-22T22:26:32+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r12542 r12620 61 61 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 62 62 import org.openstreetmap.josm.gui.preferences.validator.ValidatorPreference; 63 import org.openstreetmap.josm.tools.Logging; 63 64 import org.openstreetmap.josm.tools.Utils; 64 65 … … 143 144 allTestsMap.put(testClass.getName(), testClass.getConstructor().newInstance()); 144 145 } catch (ReflectiveOperationException e) { 145 Main.error(e);146 Logging.error(e); 146 147 } 147 148 } … … 189 190 ignoredErrors.addAll(Files.readAllLines(path, StandardCharsets.UTF_8)); 190 191 } catch (final FileNotFoundException e) { 191 Main.debug(Main.getErrorMessage(e));192 Logging.debug(Logging.getErrorMessage(e)); 192 193 } catch (final IOException e) { 193 Main.error(e);194 Logging.error(e); 194 195 } 195 196 } … … 225 226 } 226 227 } catch (IOException e) { 227 Main.error(e);228 Logging.error(e); 228 229 } 229 230 } … … 355 356 public static synchronized void initializeTests() { 356 357 if (!testsInitialized) { 357 Main.debug("Initializing validator tests");358 Logging.debug("Initializing validator tests"); 358 359 final long startTime = System.currentTimeMillis(); 359 360 initializeTests(getTests()); 360 361 testsInitialized = true; 361 if ( Main.isDebugEnabled()) {362 if (Logging.isDebugEnabled()) { 362 363 final long elapsedTime = System.currentTimeMillis() - startTime; 363 Main.debug("Initializing validator tests completed in " +Utils.getDurationString(elapsedTime));364 Logging.debug("Initializing validator tests completed in {0}", Utils.getDurationString(elapsedTime)); 364 365 } 365 366 } … … 377 378 } 378 379 } catch (Exception e) { // NOPMD 379 Main.error(e);380 Logging.error(e); 380 381 if (!GraphicsEnvironment.isHeadless()) { 381 382 JOptionPane.showMessageDialog(Main.parent, -
trunk/src/org/openstreetmap/josm/data/validation/Severity.java
r12390 r12620 7 7 import java.awt.Color; 8 8 9 import org.openstreetmap.josm.Main;10 9 import org.openstreetmap.josm.data.preferences.ColorProperty; 10 import org.openstreetmap.josm.tools.Logging; 11 11 12 12 /** The error severity */ … … 48 48 public static void getColors() { 49 49 for (Severity c : values()) { 50 if (Main.isDebugEnabled()) { 51 Main.debug(c.toString()); 52 } 50 Logging.debug("{0}", c); 53 51 } 54 52 } -
trunk/src/org/openstreetmap/josm/data/validation/Test.java
r11608 r12620 27 27 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 28 28 import org.openstreetmap.josm.tools.GBC; 29 import org.openstreetmap.josm.tools.Logging; 29 30 import org.openstreetmap.josm.tools.Utils; 30 31 … … 153 154 String startMessage = tr("Running test {0}", name); 154 155 this.progressMonitor.beginTask(startMessage); 155 Main.debug(startMessage);156 Logging.debug(startMessage); 156 157 this.errors = new ArrayList<>(30); 157 158 this.startTime = System.currentTimeMillis(); … … 187 188 // fix #11567 where elapsedTime is < 0 188 189 long elapsedTime = Math.max(0, System.currentTimeMillis() - startTime); 189 Main.debug(tr("Test ''{0}'' completed in {1}", getName(), Utils.getDurationString(elapsedTime)));190 Logging.debug(tr("Test ''{0}'' completed in {1}", getName(), Utils.getDurationString(elapsedTime))); 190 191 } 191 192 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java
r12466 r12620 21 21 import java.util.Locale; 22 22 23 import org.openstreetmap.josm. Main;23 import org.openstreetmap.josm.tools.Logging; 24 24 25 25 /** … … 2052 2052 } 2053 2053 } catch (IllegalArgumentException e) { // input is not valid 2054 Main.trace(e);2054 Logging.trace(e); 2055 2055 return input; 2056 2056 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r11893 r12620 29 29 import java.util.regex.Pattern; 30 30 31 import org.openstreetmap.josm. Main;31 import org.openstreetmap.josm.tools.Logging; 32 32 33 33 /** … … 450 450 } 451 451 } catch (URISyntaxException e) { 452 Main.trace(e);452 Logging.trace(e); 453 453 return false; 454 454 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r12318 r12620 26 26 import org.openstreetmap.josm.data.validation.TestError; 27 27 import org.openstreetmap.josm.tools.Geometry; 28 import org.openstreetmap.josm.tools.Logging; 28 29 import org.openstreetmap.josm.tools.Pair; 29 30 import org.openstreetmap.josm.tools.SubclassFilteredCollection; … … 216 217 } 217 218 } else { 218 Main.warn("Addresses test skipped chunck "+chunk+" for street part "+streetPart+" because p1 or p2 is null");219 Logging.warn("Addresses test skipped chunck "+chunk+" for street part "+streetPart+" because p1 or p2 is null"); 219 220 } 220 221 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java
r12402 r12620 13 13 import java.util.regex.Pattern; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 16 import org.openstreetmap.josm.data.validation.Severity; … … 19 18 import org.openstreetmap.josm.data.validation.TestError; 20 19 import org.openstreetmap.josm.tools.LanguageInfo; 20 import org.openstreetmap.josm.tools.Logging; 21 21 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 22 22 … … 207 207 } 208 208 } catch (ConditionalParsingException ex) { 209 Main.debug(ex);209 Logging.debug(ex); 210 210 return ex.getMessage(); 211 211 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r11913 r12620 11 11 import java.util.Objects; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.data.coor.EastNorth; 15 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 23 22 import org.openstreetmap.josm.data.validation.util.ValUtil; 24 23 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 24 import org.openstreetmap.josm.tools.Logging; 25 25 26 26 /** … … 268 268 final EastNorth en2 = es1.getSecondNode().getEastNorth(); 269 269 if (en1 == null || en2 == null) { 270 Main.warn("Crossing ways test skipped "+es1);270 Logging.warn("Crossing ways test skipped "+es1); 271 271 continue; 272 272 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java
r12461 r12620 8 8 import java.util.stream.Collectors; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.data.osm.OsmPrimitive; 12 11 import org.openstreetmap.josm.data.validation.Severity; 13 12 import org.openstreetmap.josm.data.validation.Test; 14 13 import org.openstreetmap.josm.data.validation.TestError; 14 import org.openstreetmap.josm.tools.Logging; 15 15 import org.openstreetmap.josm.tools.Utils; 16 16 … … 64 64 } 65 65 } catch (NumberFormatException ignore) { 66 Main.debug(ignore.getMessage());66 Logging.debug(ignore.getMessage()); 67 67 } 68 68 } … … 82 82 } 83 83 } catch (NumberFormatException ignore) { 84 Main.debug(ignore.getMessage());84 Logging.debug(ignore.getMessage()); 85 85 } 86 86 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r12410 r12620 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.FixCommand.evaluateObject; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 … … 64 65 import org.openstreetmap.josm.io.UTFInputStreamReader; 65 66 import org.openstreetmap.josm.tools.CheckParameterUtil; 67 import org.openstreetmap.josm.tools.Logging; 66 68 import org.openstreetmap.josm.tools.MultiMap; 67 69 import org.openstreetmap.josm.tools.Utils; … … 319 321 check.errors.put(ai, Severity.valueOf(ai.key.substring("throw".length()).toUpperCase(Locale.ENGLISH))); 320 322 } catch (IllegalArgumentException e) { 321 Main.warn(e, "Unsupported "+ai.key+" instruction. Allowed instructions are "+POSSIBLE_THROWS+'.'); 323 Logging.log(Logging.LEVEL_WARN, 324 "Unsupported "+ai.key+" instruction. Allowed instructions are "+POSSIBLE_THROWS+'.', e); 322 325 } 323 326 } else if ("fixAdd".equals(ai.key)) { … … 388 391 new GroupedMapCSSRule(map.getValue(), map.getKey()))); 389 392 } catch (IllegalDataException e) { 390 Main.error("Cannot add MapCss rule: "+e.getMessage());393 Logging.error("Cannot add MapCss rule: "+e.getMessage()); 391 394 source.logError(e); 392 395 } … … 452 455 } 453 456 } catch (IndexOutOfBoundsException ignore) { 454 Main.debug(ignore);457 Logging.debug(ignore); 455 458 } 456 459 return null; … … 480 483 m.appendReplacement(sb, String.valueOf(argument).replace("^(", "").replace(")$", "")); 481 484 } catch (IndexOutOfBoundsException | IllegalArgumentException e) { 482 Main.error(e, tr("Unable to replace argument {0} in {1}: {2}", argument, sb, e.getMessage()));485 Logging.log(Logging.LEVEL_ERROR, tr("Unable to replace argument {0} in {1}: {2}", argument, sb, e.getMessage()), e); 483 486 } 484 487 } … … 735 738 if (Main.pref.getBoolean("validator.check_assert_local_rules", false) && Utils.isLocalUrl(url)) { 736 739 for (String msg : checkAsserts(result.parseChecks)) { 737 Main.warn(msg);740 Logging.warn(msg); 738 741 } 739 742 } … … 752 755 try { 753 756 if (!i.startsWith("resource:")) { 754 Main.info(tr("Adding {0} to tag checker", i));755 } else if ( Main.isDebugEnabled()) {756 Main.debug(tr("Adding {0} to tag checker", i));757 Logging.info(tr("Adding {0} to tag checker", i)); 758 } else if (Logging.isDebugEnabled()) { 759 Logging.debug(tr("Adding {0} to tag checker", i)); 757 760 } 758 761 addMapCSS(i); … … 761 764 } 762 765 } catch (IOException | IllegalStateException | IllegalArgumentException ex) { 763 Main.warn(tr("Failed to add {0} to tag checker", i));764 Main.warn(ex, false);766 Logging.warn(tr("Failed to add {0} to tag checker", i)); 767 Logging.log(Logging.LEVEL_WARN, ex); 765 768 } catch (ParseException ex) { 766 Main.warn(tr("Failed to add {0} to tag checker", i));767 Main.warn(ex);769 Logging.warn(tr("Failed to add {0} to tag checker", i)); 770 Logging.warn(ex); 768 771 } 769 772 } … … 780 783 final DataSet ds = new DataSet(); 781 784 for (final TagCheck check : schecks) { 782 if (Main.isDebugEnabled()) { 783 Main.debug("Check: "+check); 784 } 785 Logging.debug("Check: {0}", check); 785 786 for (final Map.Entry<String, Boolean> i : check.assertions.entrySet()) { 786 if (Main.isDebugEnabled()) { 787 Main.debug("- Assertion: "+i); 788 } 787 Logging.debug("- Assertion: {0}", i); 789 788 final OsmPrimitive p = OsmUtils.createPrimitive(i.getKey()); 790 789 // Build minimal ordered list of checks to run to test the assertion … … 798 797 ds.addPrimitive(p); 799 798 final Collection<TestError> pErrors = getErrorsForPrimitive(p, true, checksToRun); 800 if (Main.isDebugEnabled()) { 801 Main.debug("- Errors: "+pErrors); 802 } 799 Logging.debug("- Errors: {0}", pErrors); 803 800 @SuppressWarnings({"EqualsBetweenInconvertibleTypes", "EqualsIncompatibleType"}) 804 801 final boolean isError = pErrors.stream().anyMatch(e -> e.getTester().equals(check.rule)); -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r11893 r12620 18 18 import java.util.Set; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.command.ChangeCommand; 22 21 import org.openstreetmap.josm.command.Command; … … 41 40 import org.openstreetmap.josm.tools.Geometry; 42 41 import org.openstreetmap.josm.tools.Geometry.PolygonIntersection; 42 import org.openstreetmap.josm.tools.Logging; 43 43 44 44 /** … … 591 591 final EastNorth en2 = es1.getSecondNode().getEastNorth(); 592 592 if (en1 == null || en2 == null) { 593 Main.warn("Crossing ways test (MP) skipped " + es1);593 Logging.warn("Crossing ways test (MP) skipped " + es1); 594 594 continue; 595 595 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r11889 r12620 15 15 import javax.script.ScriptException; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.command.ChangePropertyCommand; 19 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 23 22 import org.openstreetmap.josm.io.CachedFile; 24 23 import org.openstreetmap.josm.tools.LanguageInfo; 24 import org.openstreetmap.josm.tools.Logging; 25 25 26 26 /** … … 72 72 } 73 73 } else { 74 Main.warn("Unable to initialize OpeningHourTest because no JavaScript engine has been found");74 Logging.warn("Unable to initialize OpeningHourTest because no JavaScript engine has been found"); 75 75 } 76 76 } … … 207 207 prettifiedValue = (String) ((Invocable) ENGINE).invokeMethod(r, "prettifyValue"); 208 208 } catch (ScriptException | NoSuchMethodException e) { 209 Main.warn(e);209 Logging.warn(e); 210 210 } 211 211 for (final Object i : getList(((Invocable) ENGINE).invokeMethod(r, "getErrors"))) { … … 219 219 } 220 220 } catch (ScriptException | NoSuchMethodException ex) { 221 Main.error(ex);221 Logging.error(ex); 222 222 } 223 223 return errors; -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r12390 r12620 51 51 import org.openstreetmap.josm.io.CachedFile; 52 52 import org.openstreetmap.josm.tools.GBC; 53 import org.openstreetmap.josm.tools.Logging; 53 54 import org.openstreetmap.josm.tools.MultiMap; 54 55 import org.openstreetmap.josm.tools.Utils; … … 205 206 tagcheckerfile = true; 206 207 if (!DEFAULT_SOURCES.contains(source)) { 207 Main.info(tr("Adding {0} to tag checker", source));208 Logging.info(tr("Adding {0} to tag checker", source)); 208 209 } 209 210 } else … … 211 212 ignorefile = true; 212 213 if (!DEFAULT_SOURCES.contains(source)) { 213 Main.info(tr("Adding {0} to ignore tags", source));214 Logging.info(tr("Adding {0} to ignore tags", source)); 214 215 } 215 216 } … … 238 239 default: 239 240 if (!key.startsWith(";")) { 240 Main.warn("Unsupported TagChecker key: " + key);241 Logging.warn("Unsupported TagChecker key: " + key); 241 242 } 242 243 } … … 249 250 checkerData.add(d); 250 251 } else { 251 Main.error(tr("Invalid tagchecker line - {0}: {1}", err, line));252 Logging.error(tr("Invalid tagchecker line - {0}: {1}", err, line)); 252 253 } 253 254 } … … 257 258 harmonizedKeys.put(harmonizeKey(line.substring(1)), okValue); 258 259 } else { 259 Main.error(tr("Invalid spellcheck line: {0}", line));260 Logging.error(tr("Invalid spellcheck line: {0}", line)); 260 261 } 261 262 if (isFirstLine) { 262 263 isFirstLine = false; 263 264 if (!(tagcheckerfile || ignorefile) && !DEFAULT_SOURCES.contains(source)) { 264 Main.info(tr("Adding {0} to spellchecker", source));265 Logging.info(tr("Adding {0} to spellchecker", source)); 265 266 } 266 267 } 267 268 } 268 269 } catch (IOException e) { 269 Main.error(e);270 Logging.error(e); 270 271 errorSources.append(source).append('\n'); 271 272 } … … 828 829 } 829 830 } catch (IllegalStateException e) { 830 Main.error(e);831 Logging.error(e); 831 832 description = null; 832 833 } … … 871 872 data.add(new CheckerElement(exp)); 872 873 } catch (IllegalStateException e) { 873 Main.trace(e);874 Logging.trace(e); 874 875 return tr("Illegal expression ''{0}''", exp); 875 876 } catch (PatternSyntaxException e) { 876 Main.trace(e);877 Logging.trace(e); 877 878 return tr("Illegal regular expression ''{0}''", exp); 878 879 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r11913 r12620 33 33 import org.openstreetmap.josm.gui.preferences.validator.ValidatorPreference; 34 34 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 35 import org.openstreetmap.josm.tools.Logging; 35 36 36 37 /** … … 318 319 public boolean nearby(Node n, double dist) { 319 320 if (w == null) { 320 Main.debug("way null");321 Logging.debug("way null"); 321 322 return false; 322 323 }
Note:
See TracChangeset
for help on using the changeset viewer.