Blame SOURCES/rh1862929-scanner_performance.patch

ac89e8
diff --git openjdk.orig/jdk/src/share/classes/java/util/Scanner.java openjdk/jdk/src/share/classes/java/util/Scanner.java
ac89e8
--- openjdk.orig/jdk/src/share/classes/java/util/Scanner.java
ac89e8
+++ openjdk/jdk/src/share/classes/java/util/Scanner.java
ac89e8
@@ -1186,10 +1186,10 @@
ac89e8
             (DecimalFormat)NumberFormat.getNumberInstance(locale);
ac89e8
         DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(locale);
ac89e8
 
ac89e8
-        // These must be literalized to avoid collision with regex
ac89e8
-        // metacharacters such as dot or parenthesis
ac89e8
-        groupSeparator =   "\\x{" + Integer.toHexString(dfs.getGroupingSeparator()) + "}";
ac89e8
-        decimalSeparator = "\\x{" + Integer.toHexString(dfs.getDecimalSeparator()) + "}";
ac89e8
+        // Escape separators to avoid them being interpreted as a regex
ac89e8
+        // metacharacter (e.g. '.')
ac89e8
+        groupSeparator = escapeSeparator(dfs.getGroupingSeparator());
ac89e8
+        decimalSeparator = escapeSeparator(dfs.getDecimalSeparator());
ac89e8
 
ac89e8
         // Quoting the nonzero length locale-specific things
ac89e8
         // to avoid potential conflict with metacharacters
ac89e8
@@ -1217,6 +1217,26 @@
ac89e8
     }
ac89e8
 
ac89e8
     /**
ac89e8
+     * Utility method to escape separators so they
ac89e8
+     * are not misinterpreted as regex metacharacters.
ac89e8
+     * We optimise the most common cases by using an
ac89e8
+     * escaped literal rather than the \x construct.
ac89e8
+     *
ac89e8
+     * @param ch the separator character to escape.
ac89e8
+     * @return a {@code String} contained the escaped character.
ac89e8
+     */
ac89e8
+    private static String escapeSeparator(char ch) {
ac89e8
+        switch (ch) {
ac89e8
+            case '\u002c': // ','
ac89e8
+            case '\u002e': // '.'
ac89e8
+            case '\u00a0':
ac89e8
+                return "\\" + ch;
ac89e8
+            default:
ac89e8
+                return "\\x{" + Integer.toHexString(ch) + "}";
ac89e8
+        }
ac89e8
+    }
ac89e8
+
ac89e8
+    /**
ac89e8
      * Returns this scanner's default radix.
ac89e8
      *
ac89e8
      * 

A scanner's radix affects elements of its default