Changeset 16643 in josm for trunk/test


Ignore:
Timestamp:
2020-06-14T20:19:59+02:00 (4 years ago)
Author:
simon04
Message:

see #19334 - https://errorprone.info/bugpattern/StringSplitter

Location:
trunk/test
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/data/imagery/ImageryCompareTestIT.java

    r15135 r16643  
    4444        String comparison = HttpClient.create(new URL("https://josm.openstreetmap.de/wiki/ImageryCompare")).connect().fetchContent();
    4545        String rubricLine = null;
    46         for (String line : comparison.split("\n")) {
     46        for (String line : comparison.split("\n", -1)) {
    4747            boolean black = line.startsWith(BLACK_PREFIX);
    4848            if (black) {
  • trunk/test/unit/org/openstreetmap/josm/TestUtils.java

    r16162 r16643  
    598598    public static List<String> getIgnoredErrorMessages(Class<?> integrationTest) throws IOException {
    599599        return Arrays.stream(new WikiReader()
    600                 .read("https://josm.openstreetmap.de/wiki/IntegrationTestIgnores?format=txt")
    601                 .split("\\n"))
     600                .read("https://josm.openstreetmap.de/wiki/IntegrationTestIgnores?format=txt").split("\\n", -1))
    602601                .filter(s -> s.startsWith("|| " + integrationTest.getSimpleName() + " ||"))
    603602                .map(s -> s.substring(s.indexOf("{{{") + 3, s.indexOf("}}}")))
  • trunk/test/unit/org/openstreetmap/josm/data/osm/TagCollectionTest.java

    r14518 r16643  
    689689        TagCollection g = new TagCollection(Arrays.asList(new Tag("k", "b"), new Tag("k", "a"), new Tag("k", "b"),
    690690                new Tag("k", "c"), new Tag("k", "d")));
    691         assertEquals("a;b;c;d", Stream.of(g.getJoinedValues("k").split(";")).sorted().collect(Collectors.joining(";")));
     691        assertEquals("a;b;c;d", Stream.of(g.getJoinedValues("k").split(";", -1)).sorted().collect(Collectors.joining(";")));
    692692    }
    693693
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java

    r16006 r16643  
    9999            debug = "debug".equals(args[0]);
    100100            if (args[args.length - 1].startsWith("EPSG:")) {
    101                 forcedCodes = Arrays.asList(args[args.length - 1].split(","));
     101                forcedCodes = Arrays.asList(args[args.length - 1].split(",", -1));
    102102            }
    103103        }
     
    137137                    result.add(curEntry);
    138138                } else if (curEntry != null) {
    139                     String[] f = line.trim().split(",");
     139                    String[] f = line.trim().split(",", -1);
    140140                    double lon = Double.parseDouble(f[0]);
    141141                    double lat = Double.parseDouble(f[1]);
     
    277277        List<String> args = new ArrayList<>();
    278278        args.add(CS2CS_EXE);
    279         args.addAll(Arrays.asList("-f %.9f +proj=longlat +datum=WGS84 +to".split(" ")));
     279        args.addAll(Arrays.asList("-f %.9f +proj=longlat +datum=WGS84 +to".split(" ", -1)));
    280280        // proj.4 cannot read our ntf_r93_b.gsb file
    281281        // possibly because it is big endian. Use equivalent
     
    286286            def = def.replace("'", "\\'").replace("\"", "\\\"");
    287287        }
    288         args.addAll(Arrays.asList(def.split(" ")));
     288        args.addAll(Arrays.asList(def.split(" ", -1)));
    289289        ProcessBuilder pb = new ProcessBuilder(args);
    290290        pb.environment().put("PROJ_LIB", new File(PROJ_LIB_DIR).getAbsolutePath());
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java

    r16445 r16643  
    125125
    126126    private static Pair<Double, Double> readLine(String expectedName, String input) {
    127         String[] fields = input.trim().split("[ ]+");
     127        String[] fields = input.trim().split("[ ]+", -1);
    128128        if (fields.length != 3) throw new AssertionError();
    129129        if (!fields[0].equals(expectedName)) throw new AssertionError();
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ValidatorTestUtils.java

    r15071 r16643  
    5151                    Set<Integer> expectedCodes = new TreeSet<>();
    5252                    if (!"none".equals(codes)) {
    53                         for (String code : codes.split(",")) {
     53                        for (String code : codes.split(",", -1)) {
    5454                            expectedCodes.add(Integer.parseInt(code));
    5555                        }
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/RenderingCLIAreaTest.java

    r16618 r16643  
    154154
    155155    public RenderingCLIAreaTest(String args, Matcher<Double> scaleMatcher, Matcher<Bounds> boundsMatcher) {
    156         this.args = args.split("\\s+");
     156        this.args = args.split("\\s+", -1);
    157157        this.scaleMatcher = scaleMatcher;
    158158        this.boundsMatcher = boundsMatcher;
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java

    r16438 r16643  
    248248        // Check if we have received an error message
    249249        String error = helper.detectErrorMessage(new String(data, StandardCharsets.UTF_8));
    250         String errorMsg = url + zoomMarker(zoom) + (error != null ? error.split("\\n")[0] : defaultMessage);
     250        String errorMsg = url + zoomMarker(zoom) + (error != null ? error.split("\\n", -1)[0] : defaultMessage);
    251251        addError(info, errorMsg);
    252252        return errorMsg;
     
    344344
    345345    private static boolean isZoomError(String error) {
    346         String[] parts = error.split(ERROR_SEP);
     346        String[] parts = error.split(ERROR_SEP, -1);
    347347        String lastPart = parts.length > 0 ? parts[parts.length - 1].toLowerCase(Locale.ENGLISH) : "";
    348348        return lastPart.contains("bbox")
  • trunk/test/unit/org/openstreetmap/josm/tools/KeyboardUtilsTest.java

    r14308 r16643  
    108108    private static void testgetCharactersForKeyE00(String locale, Character... expected) {
    109109        if (locale.contains("_")) {
    110             String[] l = locale.split("_");
     110            String[] l = locale.split("_", -1);
    111111            testgetCharactersForKeyE00(new Locale(l[0], l[1]), expected);
    112112        } else {
Note: See TracChangeset for help on using the changeset viewer.