--- old/test/tools/jlink/plugins/GetAvailableLocales.java 2016-06-09 16:26:53.806835545 +0900 +++ new/test/tools/jlink/plugins/GetAvailableLocales.java 2016-06-09 16:26:53.630831691 +0900 @@ -23,20 +23,36 @@ import java.util.Arrays; import java.util.Locale; +import java.util.Set; +import java.util.TreeSet; import java.util.stream.Collectors; class GetAvailableLocales { public static void main(String[] args) { - String availableLocales = Arrays.stream(Locale.getAvailableLocales()) - .map(l -> l.toString()) - .sorted() - .collect(Collectors.joining(" ")); + Set expected = Set.of(args); + Set actual = + Arrays.stream(Locale.getAvailableLocales()) + // "(root)" for Locale.ROOT rather than "" + .map(loc -> loc.equals(Locale.ROOT) ? "(root)" : loc.toString()) + .collect(Collectors.toSet()); - if (!availableLocales.equals(args[0])) { - throw new RuntimeException("Available locales are not equal to the expected ones.\n" + - "Expected: " + args[0] + "\n" + - "Actual: " + availableLocales); + if (!expected.equals(actual)) { + diff(expected, actual); + System.exit(1); + } + } + + private static void diff(Set expected, Set actual) { + Set s1 = new TreeSet<>(expected); + s1.removeAll(actual); + if (!s1.isEmpty()) { + System.out.println("\tMissing locale(s): " + s1); + } + Set s2 = new TreeSet<>(actual); + s2.removeAll(expected); + if (!s2.isEmpty()) { + System.out.println("\tExtra locale(s): " + s2); } } }