Changeset 7497 in josm


Ignore:
Timestamp:
2014-09-05T01:50:02+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #10480 - False positive with lanes validation if source:lanes is present + fix headless exception seen in unit tests

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java

    r7308 r7497  
    11// License: GPL. See LICENSE file for details.
    22package org.openstreetmap.josm.data.validation.tests;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
     5
     6import java.util.ArrayList;
     7import java.util.Collection;
     8import java.util.HashSet;
     9import java.util.Set;
     10import java.util.regex.Pattern;
    311
    412import org.openstreetmap.josm.Main;
     
    917import org.openstreetmap.josm.tools.Predicates;
    1018import org.openstreetmap.josm.tools.Utils;
    11 
    12 import java.util.Collection;
    13 import java.util.HashSet;
    14 import java.util.Set;
    15 import java.util.regex.Pattern;
    16 
    17 import static org.openstreetmap.josm.tools.I18n.tr;
    1819
    1920/**
     
    3536
    3637    protected void checkNumberOfLanesByKey(final OsmPrimitive p, String lanesKey, String message) {
    37         final Collection<String> keysForPattern = Utils.filter(p.keySet(),
    38                 Predicates.stringContainsPattern(Pattern.compile(":" + lanesKey + "$")));
     38        final Collection<String> keysForPattern = new ArrayList<>(Utils.filter(p.keySet(),
     39                Predicates.stringContainsPattern(Pattern.compile(":" + lanesKey + "$"))));
     40        keysForPattern.remove("source:lanes");
    3941        if (keysForPattern.size() < 1) {
    4042            // nothing to check
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r7402 r7497  
    2828import static org.openstreetmap.josm.tools.I18n.tr;
    2929
     30import java.awt.GraphicsEnvironment;
    3031import java.io.File;
    3132import java.io.IOException;
     
    265266            return false;
    266267        }
    267         // JOSM certificate not found, warn user
    268         StringBuilder message = new StringBuilder("<html>");
    269         message.append(tr("Remote Control is configured to provide HTTPS support.<br>"+
    270                 "This requires to add a custom certificate generated by JOSM to the Windows Root CA store.<br><br>"+
    271                 "You are now going to be prompted by Windows to confirm this operation.<br>"+
    272                 "To enable proper HTTPS support, <b>please click Yes</b> in next dialog.<br><br>"+
    273                 "If unsure, you can also click No then disable HTTPS support in Remote Control preferences."));
    274         message.append("</html>");
    275         JOptionPane.showMessageDialog(Main.parent, message.toString(),
    276                 tr("HTTPS support in Remote Control"), JOptionPane.INFORMATION_MESSAGE);
     268        if (!GraphicsEnvironment.isHeadless()) {
     269            // JOSM certificate not found, warn user
     270            StringBuilder message = new StringBuilder("<html>");
     271            message.append(tr("Remote Control is configured to provide HTTPS support.<br>"+
     272                    "This requires to add a custom certificate generated by JOSM to the Windows Root CA store.<br><br>"+
     273                    "You are now going to be prompted by Windows to confirm this operation.<br>"+
     274                    "To enable proper HTTPS support, <b>please click Yes</b> in next dialog.<br><br>"+
     275                    "If unsure, you can also click No then disable HTTPS support in Remote Control preferences."));
     276            message.append("</html>");
     277            JOptionPane.showMessageDialog(Main.parent, message.toString(),
     278                    tr("HTTPS support in Remote Control"), JOptionPane.INFORMATION_MESSAGE);
     279        }
    277280        // install it to Windows-ROOT keystore, used by IE, Chrome and Safari, but not by Firefox
    278281        Main.info(tr("Adding JOSM localhost certificate to {0} keystore", WINDOWS_ROOT));
  • trunk/test/config/unit-josm.home

    • Property svn:ignore
      •  

        old new  
        44preferences.xml
        55validator
         6remotecontrol
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.groovy

    r7357 r7497  
    11package org.openstreetmap.josm.data.validation.tests
    22
     3import org.openstreetmap.josm.JOSMFixture
    34import org.openstreetmap.josm.data.osm.OsmUtils
    45
     
    910    @Override
    1011    void setUp() {
     12        JOSMFixture.createUnitTestFixture().init()
    1113        lanes.initialize()
    1214        lanes.startTest(null)
     
    6062        assert lanes.errors.isEmpty()
    6163    }
     64
     65    void test9() {
     66        lanes.check(OsmUtils.createPrimitive("way highway=secondary lanes=2 source:lanes=survey"))
     67        assert lanes.errors.isEmpty()
     68    }
    6269}
Note: See TracChangeset for help on using the changeset viewer.