Merge
authoramurillo
Thu, 04 Aug 2016 17:49:12 +0000
changeset 40122 4f81380d441a
parent 40110 26d8247a0407 (current diff)
parent 40121 4204d69de3a9 (diff)
child 40123 673d89604418
Merge
--- a/jdk/src/java.base/share/classes/java/net/Inet4Address.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/net/Inet4Address.java	Thu Aug 04 17:49:12 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -164,7 +164,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
      * @since 1.4
--- a/jdk/src/java.base/share/classes/java/net/Inet6Address.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/net/Inet6Address.java	Thu Aug 04 17:49:12 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -691,7 +691,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      *
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
--- a/jdk/src/java.base/share/classes/java/net/InetAddress.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java	Thu Aug 04 17:49:12 2016 +0000
@@ -361,7 +361,7 @@
     }
 
     /**
-     * Utility routine to check if the InetAddress in a wildcard address.
+     * Utility routine to check if the InetAddress is a wildcard address.
      * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
      * @since 1.4
--- a/jdk/src/java.base/share/classes/java/net/Socket.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/net/Socket.java	Thu Aug 04 17:49:12 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -907,7 +907,6 @@
             throw new SocketException("Socket is not connected");
         if (isInputShutdown())
             throw new SocketException("Socket input is shutdown");
-        final Socket s = this;
         InputStream is = null;
         try {
             is = AccessController.doPrivileged(
@@ -947,7 +946,6 @@
             throw new SocketException("Socket is not connected");
         if (isOutputShutdown())
             throw new SocketException("Socket output is shutdown");
-        final Socket s = this;
         OutputStream os = null;
         try {
             os = AccessController.doPrivileged(
--- a/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/nio/file/FileTreeWalker.java	Thu Aug 04 17:49:12 2016 +0000
@@ -168,7 +168,7 @@
      * @throws  IllegalArgumentException
      *          if {@code maxDepth} is negative
      * @throws  ClassCastException
-     *          if (@code options} contains an element that is not a
+     *          if {@code options} contains an element that is not a
      *          {@code FileVisitOption}
      * @throws  NullPointerException
      *          if {@code options} is {@ocde null} or the options
--- a/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Thu Aug 04 17:49:12 2016 +0000
@@ -810,7 +810,7 @@
      * The localized decimal style is not used.
      * <p>
      * The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
-     * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+     * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
      * may be outside the maximum range of {@code LocalDateTime}.
      * <p>
      * The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
@@ -848,7 +848,7 @@
      * digits from zero to nine are accepted.
      * <p>
      * The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
-     * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+     * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
      * may be outside the maximum range of {@code LocalDateTime}.
      * <p>
      * The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java	Thu Aug 04 17:49:12 2016 +0000
@@ -30,7 +30,7 @@
 import java.lang.reflect.*;
 import java.io.Serializable;
 import java.util.*;
-import java.util.stream.Collectors;
+import java.util.stream.*;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
@@ -163,47 +163,167 @@
      */
     private static String memberValueToString(Object value) {
         Class<?> type = value.getClass();
-        if (!type.isArray()) {   // primitive, string, class, enum const,
-                                 // or annotation
+        if (!type.isArray()) {
+            // primitive value, string, class, enum const, or annotation
             if (type == Class.class)
-                return classValueToString((Class<?>) value);
+                return toSourceString((Class<?>) value);
+            else if (type == String.class)
+                return  toSourceString((String) value);
+            if (type == Character.class)
+                return toSourceString((char) value);
+            else if (type == Double.class)
+                return  toSourceString((double) value);
+            else if (type == Float.class)
+                return  toSourceString((float) value);
+            else if (type == Long.class)
+                return  toSourceString((long) value);
             else
                 return value.toString();
-        }
+        } else {
+            Stream<String> stringStream;
+            if (type == byte[].class)
+                stringStream = convert((byte[]) value);
+            else if (type == char[].class)
+                stringStream = convert((char[]) value);
+            else if (type == double[].class)
+                stringStream = DoubleStream.of((double[]) value)
+                    .mapToObj(AnnotationInvocationHandler::toSourceString);
+            else if (type == float[].class)
+                stringStream = convert((float[]) value);
+            else if (type == int[].class)
+                stringStream = IntStream.of((int[]) value).mapToObj(String::valueOf);
+            else if (type == long[].class) {
+                stringStream = LongStream.of((long[]) value)
+                    .mapToObj(AnnotationInvocationHandler::toSourceString);
+            } else if (type == short[].class)
+                stringStream = convert((short[]) value);
+            else if (type == boolean[].class)
+                stringStream = convert((boolean[]) value);
+            else if (type == Class[].class)
+                stringStream =
+                    Arrays.stream((Class<?>[]) value).
+                    map(AnnotationInvocationHandler::toSourceString);
+            else if (type == String[].class)
+                stringStream =
+                    Arrays.stream((String[])value).
+                    map(AnnotationInvocationHandler::toSourceString);
+            else
+                stringStream = Arrays.stream((Object[])value).map(Objects::toString);
 
-        if (type == byte[].class)
-            return Arrays.toString((byte[]) value);
-        if (type == char[].class)
-            return Arrays.toString((char[]) value);
-        if (type == double[].class)
-            return Arrays.toString((double[]) value);
-        if (type == float[].class)
-            return Arrays.toString((float[]) value);
-        if (type == int[].class)
-            return Arrays.toString((int[]) value);
-        if (type == long[].class)
-            return Arrays.toString((long[]) value);
-        if (type == short[].class)
-            return Arrays.toString((short[]) value);
-        if (type == boolean[].class)
-            return Arrays.toString((boolean[]) value);
-        if (type == Class[].class)
-            return classArrayValueToString((Class<?>[])value);
-        return Arrays.toString((Object[]) value);
+            return stringStreamToString(stringStream);
+        }
     }
 
     /**
      * Translates a Class value to a form suitable for use in the
      * string representation of an annotation.
      */
-    private static String classValueToString(Class<?> clazz) {
-        return clazz.getName() + ".class" ;
+    private static String toSourceString(Class<?> clazz) {
+        Class<?> finalComponent = clazz;
+        StringBuilder arrayBackets = new StringBuilder();
+
+        while(finalComponent.isArray()) {
+            finalComponent = finalComponent.getComponentType();
+            arrayBackets.append("[]");
+        }
+
+        return finalComponent.getName() + arrayBackets.toString() + ".class" ;
+    }
+
+    private static String toSourceString(float f) {
+        if (Float.isFinite(f))
+            return Float.toString(f) + "f" ;
+        else {
+            if (Float.isInfinite(f)) {
+                return (f < 0.0f) ? "-1.0f/0.0f": "1.0f/0.0f";
+            } else
+                return "0.0f/0.0f";
+        }
+    }
+
+    private static String toSourceString(double d) {
+        if (Double.isFinite(d))
+            return Double.toString(d);
+        else {
+            if (Double.isInfinite(d)) {
+                return (d < 0.0f) ? "-1.0/0.0": "1.0/0.0";
+            } else
+                return "0.0/0.0";
+        }
+    }
+
+    private static String toSourceString(char c) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("'");
+        if (c == '\'')
+            sb.append("\\'");
+        else
+            sb.append(c);
+        sb.append("'");
+        return sb.toString();
+    }
+
+    private static String toSourceString(long ell) {
+        return (Math.abs(ell) <= Integer.MAX_VALUE) ?
+            String.valueOf(ell) :
+            (String.valueOf(ell) + "L");
     }
 
-    private static String classArrayValueToString(Class<?>[] classes) {
-        return Arrays.stream(classes)
-            .map(AnnotationInvocationHandler::classValueToString)
-            .collect(Collectors.joining(", ", "{", "}"));
+    /**
+     * Return a string suitable for use in the string representation
+     * of an annotation.
+     */
+    private static String toSourceString(String s) {
+        StringBuilder sb = new StringBuilder();
+        sb.append('"');
+        // Escape embedded quote characters, if present, but don't do
+        // anything more heroic.
+        if (s.indexOf('"') != -1) {
+            s = s.replace("\"", "\\\"");
+        }
+        sb.append(s);
+        sb.append('"');
+        return sb.toString();
+    }
+
+    private static Stream<String> convert(byte[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (byte b : values)
+            list.add(Byte.toString(b));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(char[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (char c : values)
+            list.add(toSourceString(c));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(float[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (float f : values) {
+            list.add(toSourceString(f));
+        }
+        return list.stream();
+    }
+
+    private static Stream<String> convert(short[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (short s : values)
+            list.add(Short.toString(s));
+        return list.stream();
+    }
+
+    private static Stream<String> convert(boolean[] values) {
+        List<String> list = new ArrayList<>(values.length);
+        for (boolean b : values)
+            list.add(Boolean.toString(b));
+        return list.stream();
+    }
+
+    private static String stringStreamToString(Stream<String> stream) {
+        return stream.collect(Collectors.joining(", ", "{", "}"));
     }
 
     /**
--- a/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java	Thu Aug 04 17:49:12 2016 +0000
@@ -28,16 +28,12 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Locale.*;
 import static java.util.Locale.FilteringMode.*;
 import static java.util.Locale.LanguageRange.*;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * Implementation for BCP47 Locale matching
@@ -111,10 +107,22 @@
 
     private static List<String> filterBasic(List<LanguageRange> priorityList,
                                             Collection<String> tags) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
         List<String> list = new ArrayList<>();
-        for (LanguageRange lr : priorityList) {
+        for (LanguageRange lr : nonZeroRanges) {
             String range = lr.getRange();
             if (range.equals("*")) {
+                tags = removeTagsMatchingBasicZeroRange(zeroRanges, tags);
                 return new ArrayList<String>(tags);
             } else {
                 for (String tag : tags) {
@@ -122,7 +130,8 @@
                     if (tag.startsWith(range)) {
                         int len = range.length();
                         if ((tag.length() == len || tag.charAt(len) == '-')
-                            && !list.contains(tag)) {
+                            && !list.contains(tag)
+                            && !shouldIgnoreFilterBasicMatch(zeroRanges, tag)) {
                             list.add(tag);
                         }
                     }
@@ -133,12 +142,76 @@
         return list;
     }
 
+    /**
+     * Removes the tag(s) which are falling in the basic exclusion range(s) i.e
+     * range(s) with q=0 and returns the updated collection. If the basic
+     * language ranges contains '*' as one of its non zero range then instead of
+     * returning all the tags, remove those which are matching the range with
+     * quality weight q=0.
+     */
+    private static Collection<String> removeTagsMatchingBasicZeroRange(
+            List<LanguageRange> zeroRange, Collection<String> tags) {
+        if (zeroRange.isEmpty()) {
+            return tags;
+        }
+
+        List<String> matchingTags = new ArrayList<>();
+        for (String tag : tags) {
+            tag = tag.toLowerCase(Locale.ROOT);
+            if (!shouldIgnoreFilterBasicMatch(zeroRange, tag)) {
+                matchingTags.add(tag);
+            }
+        }
+
+        return matchingTags;
+    }
+
+    /**
+     * The tag which is falling in the basic exclusion range(s) should not
+     * be considered as the matching tag. Ignores the tag matching with the
+     * non-zero ranges, if the tag also matches with one of the basic exclusion
+     * ranges i.e. range(s) having quality weight q=0
+     */
+    private static boolean shouldIgnoreFilterBasicMatch(
+            List<LanguageRange> zeroRange, String tag) {
+        if (zeroRange.isEmpty()) {
+            return false;
+        }
+
+        for (LanguageRange lr : zeroRange) {
+            String range = lr.getRange();
+            if (range.equals("*")) {
+                return true;
+            }
+            if (tag.startsWith(range)) {
+                int len = range.length();
+                if ((tag.length() == len || tag.charAt(len) == '-')) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
     private static List<String> filterExtended(List<LanguageRange> priorityList,
                                                Collection<String> tags) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
         List<String> list = new ArrayList<>();
-        for (LanguageRange lr : priorityList) {
+        for (LanguageRange lr : nonZeroRanges) {
             String range = lr.getRange();
             if (range.equals("*")) {
+                tags = removeTagsMatchingExtendedZeroRange(zeroRanges, tags);
                 return new ArrayList<String>(tags);
             }
             String[] rangeSubtags = range.split("-");
@@ -150,33 +223,101 @@
                     continue;
                 }
 
-                int rangeIndex = 1;
-                int tagIndex = 1;
-
-                while (rangeIndex < rangeSubtags.length
-                       && tagIndex < tagSubtags.length) {
-                   if (rangeSubtags[rangeIndex].equals("*")) {
-                       rangeIndex++;
-                   } else if (rangeSubtags[rangeIndex].equals(tagSubtags[tagIndex])) {
-                       rangeIndex++;
-                       tagIndex++;
-                   } else if (tagSubtags[tagIndex].length() == 1
-                              && !tagSubtags[tagIndex].equals("*")) {
-                       break;
-                   } else {
-                       tagIndex++;
-                   }
-               }
-
-               if (rangeSubtags.length == rangeIndex && !list.contains(tag)) {
-                   list.add(tag);
-               }
+                int rangeIndex = matchFilterExtendedSubtags(rangeSubtags,
+                        tagSubtags);
+                if (rangeSubtags.length == rangeIndex && !list.contains(tag)
+                        && !shouldIgnoreFilterExtendedMatch(zeroRanges, tag)) {
+                    list.add(tag);
+                }
             }
         }
 
         return list;
     }
 
+    /**
+     * Removes the tag(s) which are falling in the extended exclusion range(s)
+     * i.e range(s) with q=0 and returns the updated collection. If the extended
+     * language ranges contains '*' as one of its non zero range then instead of
+     * returning all the tags, remove those which are matching the range with
+     * quality weight q=0.
+     */
+    private static Collection<String> removeTagsMatchingExtendedZeroRange(
+            List<LanguageRange> zeroRange, Collection<String> tags) {
+        if (zeroRange.isEmpty()) {
+            return tags;
+        }
+
+        List<String> matchingTags = new ArrayList<>();
+        for (String tag : tags) {
+            tag = tag.toLowerCase(Locale.ROOT);
+            if (!shouldIgnoreFilterExtendedMatch(zeroRange, tag)) {
+                matchingTags.add(tag);
+            }
+        }
+
+        return matchingTags;
+    }
+
+    /**
+     * The tag which is falling in the extended exclusion range(s) should
+     * not be considered as the matching tag. Ignores the tag matching with the
+     * non zero range(s), if the tag also matches with one of the extended
+     * exclusion range(s) i.e. range(s) having quality weight q=0
+     */
+    private static boolean shouldIgnoreFilterExtendedMatch(
+            List<LanguageRange> zeroRange, String tag) {
+        if (zeroRange.isEmpty()) {
+            return false;
+        }
+
+        String[] tagSubtags = tag.split("-");
+        for (LanguageRange lr : zeroRange) {
+            String range = lr.getRange();
+            if (range.equals("*")) {
+                return true;
+            }
+
+            String[] rangeSubtags = range.split("-");
+
+            if (!rangeSubtags[0].equals(tagSubtags[0])
+                    && !rangeSubtags[0].equals("*")) {
+                continue;
+            }
+
+            int rangeIndex = matchFilterExtendedSubtags(rangeSubtags,
+                    tagSubtags);
+            if (rangeSubtags.length == rangeIndex) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private static int matchFilterExtendedSubtags(String[] rangeSubtags,
+            String[] tagSubtags) {
+        int rangeIndex = 1;
+        int tagIndex = 1;
+
+        while (rangeIndex < rangeSubtags.length
+                && tagIndex < tagSubtags.length) {
+            if (rangeSubtags[rangeIndex].equals("*")) {
+                rangeIndex++;
+            } else if (rangeSubtags[rangeIndex]
+                    .equals(tagSubtags[tagIndex])) {
+                rangeIndex++;
+                tagIndex++;
+            } else if (tagSubtags[tagIndex].length() == 1
+                    && !tagSubtags[tagIndex].equals("*")) {
+                break;
+            } else {
+                tagIndex++;
+            }
+        }
+        return rangeIndex;
+    }
+
     public static Locale lookup(List<LanguageRange> priorityList,
                                 Collection<Locale> locales) {
         if (priorityList.isEmpty() || locales.isEmpty()) {
@@ -205,7 +346,18 @@
             return null;
         }
 
-        for (LanguageRange lr : priorityList) {
+        int splitIndex = splitRanges(priorityList);
+        List<LanguageRange> nonZeroRanges;
+        List<LanguageRange> zeroRanges;
+        if (splitIndex != -1) {
+            nonZeroRanges = priorityList.subList(0, splitIndex);
+            zeroRanges = priorityList.subList(splitIndex, priorityList.size());
+        } else {
+            nonZeroRanges = priorityList;
+            zeroRanges = List.of();
+        }
+
+        for (LanguageRange lr : nonZeroRanges) {
             String range = lr.getRange();
 
             // Special language range ("*") is ignored in lookup.
@@ -217,31 +369,83 @@
             while (rangeForRegex.length() > 0) {
                 for (String tag : tags) {
                     tag = tag.toLowerCase(Locale.ROOT);
-                    if (tag.matches(rangeForRegex)) {
+                    if (tag.matches(rangeForRegex)
+                            && !shouldIgnoreLookupMatch(zeroRanges, tag)) {
                         return tag;
                     }
                 }
 
                 // Truncate from the end....
-                int index = rangeForRegex.lastIndexOf('-');
-                if (index >= 0) {
-                    rangeForRegex = rangeForRegex.substring(0, index);
-
-                    // if range ends with an extension key, truncate it.
-                    index = rangeForRegex.lastIndexOf('-');
-                    if (index >= 0 && index == rangeForRegex.length()-2) {
-                        rangeForRegex =
-                            rangeForRegex.substring(0, rangeForRegex.length()-2);
-                    }
-                } else {
-                    rangeForRegex = "";
-                }
+                rangeForRegex = truncateRange(rangeForRegex);
             }
         }
 
         return null;
     }
 
+    /**
+     * The tag which is falling in the exclusion range(s) should not be
+     * considered as the matching tag. Ignores the tag matching with the
+     * non zero range(s), if the tag also matches with one of the exclusion
+     * range(s) i.e. range(s) having quality weight q=0.
+     */
+    private static boolean shouldIgnoreLookupMatch(List<LanguageRange> zeroRange,
+            String tag) {
+        for (LanguageRange lr : zeroRange) {
+            String range = lr.getRange();
+
+            // Special language range ("*") is ignored in lookup.
+            if (range.equals("*")) {
+                continue;
+            }
+
+            String rangeForRegex = range.replaceAll("\\x2A", "\\\\p{Alnum}*");
+            while (rangeForRegex.length() > 0) {
+                if (tag.matches(rangeForRegex)) {
+                    return true;
+                }
+                // Truncate from the end....
+                rangeForRegex = truncateRange(rangeForRegex);
+            }
+        }
+
+        return false;
+    }
+
+    /* Truncate the range from end during the lookup match */
+    private static String truncateRange(String rangeForRegex) {
+        int index = rangeForRegex.lastIndexOf('-');
+        if (index >= 0) {
+            rangeForRegex = rangeForRegex.substring(0, index);
+
+            // if range ends with an extension key, truncate it.
+            index = rangeForRegex.lastIndexOf('-');
+            if (index >= 0 && index == rangeForRegex.length() - 2) {
+                rangeForRegex
+                        = rangeForRegex.substring(0, rangeForRegex.length() - 2);
+            }
+        } else {
+            rangeForRegex = "";
+        }
+
+        return rangeForRegex;
+    }
+
+    /* Returns the split index of the priority list, if it contains
+     * language range(s) with quality weight as 0 i.e. q=0, else -1
+     */
+    private static int splitRanges(List<LanguageRange> priorityList) {
+        int size = priorityList.size();
+        for (int index = 0; index < size; index++) {
+            LanguageRange range = priorityList.get(index);
+            if (range.getWeight() == 0) {
+                return index;
+            }
+        }
+
+        return -1; // no q=0 range exists
+    }
+
     public static List<LanguageRange> parse(String ranges) {
         ranges = ranges.replaceAll(" ", "").toLowerCase(Locale.ROOT);
         if (ranges.startsWith("accept-language:")) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java	Thu Aug 04 17:49:12 2016 +0000
@@ -177,7 +177,7 @@
      * @param lastRow  the last row affected by this event
      * @param column the column index of cells changed; {@code ALL_COLUMNS}
      *        signifies all cells in the specified range of rows are changed.
-     * @param type the type of change signified by this even, @code INSERT},
+     * @param type the type of change signified by this even, {@code INSERT},
      *        {@code DELETE } or {@code UPDATE}
      */
     public TableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type) {
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java	Thu Aug 04 17:49:12 2016 +0000
@@ -297,7 +297,7 @@
      * If {@code lw1} and {@code lw2} are both greater than zero, then
      * the parallelogram figure is doubled by both expanding and contracting
      * each delta vector by its corresponding {@code lw} value.
-     * If either (@code lw1) or {@code lw2} are also greater than 1, then
+     * If either {@code lw1} or {@code lw2} are also greater than 1, then
      * the inner (contracted) parallelogram disappears and the figure is
      * simply a single expanded parallelogram.
      * The {@code clip} parameter specifies the current clip in effect
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Thu Aug 04 17:49:12 2016 +0000
@@ -395,7 +395,7 @@
     public void dispose() throws GSSException;
 
     /**
-     * Return the mechanism-specific attribute associated with (@code type}.
+     * Return the mechanism-specific attribute associated with {@code type}.
      *
      * @param type the type of the attribute requested
      * @return the attribute
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java	Thu Aug 04 17:49:12 2016 +0000
@@ -56,7 +56,6 @@
 import java.util.Properties;
 import java.util.Set;
 import jdk.tools.jlink.internal.BasicImageWriter;
-import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin.SymImageFile;
 import jdk.tools.jlink.internal.ExecutableImage;
 import jdk.tools.jlink.plugin.ResourcePool;
@@ -184,10 +183,6 @@
             files.moduleView().modules().forEach(m -> {
                 // Only add modules that contain packages
                 if (!m.packages().isEmpty()) {
-                    // Skip the fake module used by FileCopierPlugin when copying files.
-                    if (m.name().equals(FileCopierPlugin.FAKE_MODULE)) {
-                        return;
-                    }
                     modules.add(m.name());
                 }
             });
@@ -228,6 +223,7 @@
             desc.osName().ifPresent(s -> props.setProperty("OS_NAME", s));
             desc.osVersion().ifPresent(s -> props.setProperty("OS_VERSION", s));
             desc.osArch().ifPresent(s -> props.setProperty("OS_ARCH", s));
+            props.setProperty("JAVA_VERSION", System.getProperty("java.version"));
         });
 
         Optional<ResourcePoolEntry> release = pool.findEntry("/java.base/release");
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ResourcePoolManager.java	Thu Aug 04 17:49:12 2016 +0000
@@ -213,7 +213,6 @@
 
     private final Map<String, ResourcePoolEntry> resources = new LinkedHashMap<>();
     private final Map<String, ResourcePoolModule> modules = new LinkedHashMap<>();
-    private final ResourcePoolModuleImpl fileCopierModule = new ResourcePoolModuleImpl(FileCopierPlugin.FAKE_MODULE);
     private final ByteOrder order;
     private final StringTable table;
     private final ResourcePool poolImpl;
@@ -272,11 +271,6 @@
         }
         String modulename = data.moduleName();
         ResourcePoolModuleImpl m = (ResourcePoolModuleImpl)modules.get(modulename);
-        // ## TODO: FileCopierPlugin should not add content to a module
-        // FAKE_MODULE is not really a module to be added in the image
-        if (FileCopierPlugin.FAKE_MODULE.equals(modulename)) {
-            m = fileCopierModule;
-        }
         if (m == null) {
             m = new ResourcePoolModuleImpl(modulename);
             modules.put(modulename, m);
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java	Thu Aug 04 17:49:12 2016 +0000
@@ -58,8 +58,6 @@
         Path source;
         Path target;
     }
-    public static final String FAKE_MODULE = "$jlink-file-copier";
-
     private final List<CopiedFile> files = new ArrayList<>();
 
     /**
@@ -159,7 +157,7 @@
         Objects.requireNonNull(file);
         Objects.requireNonNull(path);
         ResourcePoolEntry impl = ResourcePoolEntry.create(
-                "/" + FAKE_MODULE + "/other/" + path,
+                "/java.base/other/" + path,
                 ResourcePoolEntry.Type.OTHER, file);
         try {
             pool.add(impl);
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Thu Aug 04 17:49:12 2016 +0000
@@ -31,6 +31,7 @@
 import java.util.Locale;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Optional;
 import static java.util.ResourceBundle.Control;
 import java.util.Set;
@@ -342,9 +343,8 @@
                     // locales from the pre-filtered list.
                     locales.stream()
                         .filter(l -> l.toString().equalsIgnoreCase(loc.toString()))
-                        .findAny()
-                        .orElse(Locale.ROOT))
-                .filter(loc -> !loc.equals(Locale.ROOT))
+                        .findAny())
+                .flatMap(Optional::stream)
                 .flatMap(IncludeLocalesPlugin::localeToTags)
                 .distinct()
                 .collect(Collectors.toList());
@@ -373,40 +373,42 @@
     }
 
     private static Stream<String> localeToTags(Locale loc) {
+        Objects.requireNonNull(loc);
+
         String tag = loc.toLanguageTag();
-        Stream<String> ret = null;
+        List<String> tags = null;
 
         switch (loc.getLanguage()) {
             // ISO3166 compatibility
             case "iw":
-                ret = List.of(tag, tag.replaceFirst("^he", "iw")).stream();
+                tags = List.of(tag, tag.replaceFirst("^he", "iw"));
                 break;
             case "in":
-                ret = List.of(tag, tag.replaceFirst("^id", "in")).stream();
+                tags = List.of(tag, tag.replaceFirst("^id", "in"));
                 break;
             case "ji":
-                ret = List.of(tag, tag.replaceFirst("^yi", "ji")).stream();
+                tags = List.of(tag, tag.replaceFirst("^yi", "ji"));
                 break;
 
             // Special COMPAT provider locales
             case "ja":
                 if (loc.getCountry() == "JP") {
-                    ret = List.of(tag, jaJPJPTag).stream();
+                    tags = List.of(tag, jaJPJPTag);
                 }
                 break;
             case "no":
             case "nn":
                 if (loc.getCountry() == "NO") {
-                    ret = List.of(tag, noNONYTag).stream();
+                    tags = List.of(tag, noNONYTag);
                 }
                 break;
             case "th":
                 if (loc.getCountry() == "TH") {
-                    ret = List.of(tag, thTHTHTag).stream();
+                    tags = List.of(tag, thTHTHTag);
                 }
                 break;
         }
 
-        return ret == null ? List.of(tag).stream() : ret;
+        return tags == null ? List.of(tag).stream() : tags.stream();
     }
 }
--- a/jdk/test/ProblemList.txt	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/test/ProblemList.txt	Thu Aug 04 17:49:12 2016 +0000
@@ -318,7 +318,7 @@
 
 ############################################################################
 
-# jdk_tools
+# core_tools
 
 tools/pack200/CommandLineTests.java                             7143279,8059906 generic-all
 
@@ -368,20 +368,14 @@
 
 sun/tools/jcmd/TestJcmdSanity.java                              8031482 windows-all
 
-sun/tools/jmap/heapconfig/JMapHeapConfigTest.java               8072131,8132452 generic-all
-
 sun/tools/jstatd/TestJstatdExternalRegistry.java                8046285 generic-all
 
 sun/tools/jps/TestJpsJar.java                                   8160923 generic-all
 
 sun/tools/jps/TestJpsJarRelative.java                           6456333 generic-all
 
-sun/tools/jinfo/JInfoRunningProcessFlagTest.java                6734748 generic-all
-
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java    8057732 generic-all
 
-sun/tools/jinfo/JInfoSanityTest.java                            8059035 generic-all
-
 demo/jvmti/compiledMethodLoad/CompiledMethodLoadTest.java       8151899 generic-all
 
 ############################################################################
@@ -391,9 +385,3 @@
 com/sun/jndi/ldap/DeadSSLLdapTimeoutTest.java                   8141370 linux-i586,macosx-all
 
 ############################################################################
-
-# core_tools
-
-tools/jlink/JLinkOptimTest.java                                 8159264 generic-all
-
-############################################################################
--- a/jdk/test/TEST.groups	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/test/TEST.groups	Thu Aug 04 17:49:12 2016 +0000
@@ -27,7 +27,6 @@
 
 tier1 = \
     :jdk_lang \
-    -java/lang/ProcessBuilder/Zombies.java \
     :jdk_util \
     -java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
     -java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
@@ -38,7 +37,6 @@
     tools/pack200
 
 tier2 = \
-    java/lang/ProcessBuilder/Zombies.java \
     java/util/concurrent/ThreadPoolExecutor/ConfigChanges.java \
     java/util/concurrent/forkjoin/FJExceptionTableLeak.java \
     :jdk_io \
--- a/jdk/test/java/lang/ProcessBuilder/Zombies.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/test/java/lang/ProcessBuilder/Zombies.java	Thu Aug 04 17:49:12 2016 +0000
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @bug 6474073
+ * @run main/othervm Zombies
+ * @bug 6474073 6180151
  * @key intermittent
  * @summary Make sure zombies don't get created on Unix
  * @author Martin Buchholz
@@ -65,22 +66,21 @@
 
         Process p = rt.exec(TrueCommand);
         ProcessHandle pp = p.toHandle().parent().orElse(null);
-        System.out.printf("pid: %d, parent: %s%n", p.getPid(), pp);
+        System.out.printf("%s pid: %d, parent: %s%n", TrueCommand, p.getPid(), pp);
         p.waitFor();
 
         // Count all the zombies that are children of this Java process
         final String[] zombieCounter = {
             "/usr/bin/perl", "-e",
-            "exit @{[`/bin/ps -eo ppid,s` =~ /^ *@{[getppid]} +Z$/mog]}"
+                "$a=`/bin/ps -eo ppid,pid,s,command`;" +
+                        "print @b=$a=~/^ *@{[getppid]} +[0-9]+ +Z.*$/mog;" +
+                        "exit @b"
         };
 
-        int zombies = rt.exec(zombieCounter).waitFor();
+        ProcessBuilder pb = new ProcessBuilder(zombieCounter);
+        pb.inheritIO();
+        int zombies = pb.start().waitFor();
         if (zombies != 0) {
-            // Log remaining processes
-            ProcessBuilder pb = new ProcessBuilder("/bin/ps", "-ef");
-            pb.inheritIO();
-            Process p2 = pb.start();
-            p2.waitFor();
             throw new Error(zombies + " zombies!");
         }
     }
--- a/jdk/test/java/lang/Runtime/exec/LotsOfOutput.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/test/java/lang/Runtime/exec/LotsOfOutput.java	Thu Aug 04 17:49:12 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
  * @test
  * @bug 4369826 8078582
  * @summary Process with lots of output should not crash VM
- * @key intermittent
  * @author kladko
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/annotation/AnnotationToStringTest.java	Thu Aug 04 17:49:12 2016 +0000
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8162817
+ * @summary Test of toString on normal annotations
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * The expected string values are stored in @ExpectedString
+ * annotations. The essence of the test is comparing the toString()
+ * result of annotations to the corresponding ExpectedString.value().
+ */
+
+public class AnnotationToStringTest {
+    public static void main(String... args) throws Exception {
+        int failures = 0;
+
+        failures += check(PrimHost.class.getAnnotation(ExpectedString.class).value(),
+                          PrimHost.class.getAnnotation(MostlyPrimitive.class).toString());
+        failures += classyTest();
+        failures += arrayAnnotationTest();
+
+        if (failures > 0)
+            throw new RuntimeException(failures + " failures");
+    }
+
+    private static int check(String expected, String actual) {
+        if (!expected.equals(actual)) {
+            System.err.printf("ERROR: Expected ''%s'';%ngot             ''%s''.\n",
+                              expected, actual);
+            return 1;
+        } else
+            return 0;
+    }
+
+    @ExpectedString(
+        "@MostlyPrimitive(c0='a', "+
+        "c1='\\'', " +
+        "i0=1, " +
+        "i1=2, " +
+        "f0=1.0f, " +
+        "f1=0.0f/0.0f, " +
+        "d0=0.0, " +
+        "d1=1.0/0.0, " +
+        "l0=5, " +
+        "l1=9223372036854775807L, " +
+        "s0=\"Hello world.\", " +
+        "s1=\"a\\\"b\", " +
+        "class0=Obj[].class)")
+    @MostlyPrimitive(
+        c0='a',
+        c1='\'',
+        i0=1,
+        i1=2,
+        f0=1.0f,
+        f1=Float.NaN,
+        d0=0.0,
+        d1=2.0/0.0,
+        l0=5,
+        l1=Long.MAX_VALUE,
+        s0="Hello world.",
+        s1="a\"b",
+        class0=Obj[].class
+    )
+    static class PrimHost{}
+
+    private static int classyTest() {
+        int failures = 0;
+        for (Field f : AnnotationHost.class.getFields()) {
+            Annotation a = f.getAnnotation(Classy.class);
+            System.out.println(a);
+            failures += check(f.getAnnotation(ExpectedString.class).value(),
+                              a.toString());
+        }
+        return failures;
+    }
+
+    static class AnnotationHost {
+        @ExpectedString(
+       "@Classy(value=Obj.class)")
+        @Classy(value=Obj.class)
+        public int f0;
+
+        @ExpectedString(
+       "@Classy(value=Obj[].class)")
+        @Classy(value=Obj[].class)
+        public int f1;
+
+        @ExpectedString(
+       "@Classy(value=Obj[][].class)")
+        @Classy(value=Obj[][].class)
+        public int f2;
+
+        @ExpectedString(
+       "@Classy(value=Obj[][][].class)")
+        @Classy(value=Obj[][][].class)
+        public int f3;
+
+        @ExpectedString(
+       "@Classy(value=int.class)")
+        @Classy(value=int.class)
+        public int f4;
+
+        @ExpectedString(
+       "@Classy(value=int[][][].class)")
+        @Classy(value=int[][][].class)
+        public int f5;
+    }
+
+    /**
+     * Each field should have two annotations, the first being
+     * @ExpectedString and the second the annotation under test.
+     */
+    private static int arrayAnnotationTest() {
+        int failures = 0;
+        for (Field f : ArrayAnnotationHost.class.getFields()) {
+            Annotation[] annotations = f.getAnnotations();
+            System.out.println(annotations[1]);
+            failures += check(((ExpectedString)annotations[0]).value(),
+                              annotations[1].toString());
+        }
+        return failures;
+    }
+
+    static class ArrayAnnotationHost {
+        @ExpectedString(
+       "@BooleanArray(value={true, false, true})")
+        @BooleanArray(value={true, false, true})
+        public boolean[]   f0;
+
+        @ExpectedString(
+       "@FloatArray(value={3.0f, 4.0f, 0.0f/0.0f, -1.0f/0.0f, 1.0f/0.0f})")
+        @FloatArray(value={3.0f, 4.0f, Float.NaN, Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY})
+        public float[]     f1;
+
+        @ExpectedString(
+       "@DoubleArray(value={1.0, 2.0, 0.0/0.0, 1.0/0.0, -1.0/0.0})")
+        @DoubleArray(value={1.0, 2.0, Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,})
+        public double[]    f2;
+
+        @ExpectedString(
+       "@ByteArray(value={10, 11, 12})")
+        @ByteArray(value={10, 11, 12})
+        public byte[]      f3;
+
+        @ExpectedString(
+       "@ShortArray(value={0, 4, 5})")
+        @ShortArray(value={0, 4, 5})
+        public short[]     f4;
+
+        @ExpectedString(
+       "@CharArray(value={'a', 'b', 'c', '\\''})")
+        @CharArray(value={'a', 'b', 'c', '\''})
+        public char[]      f5;
+
+        @ExpectedString(
+       "@IntArray(value={1})")
+        @IntArray(value={1})
+        public int[]       f6;
+
+        @ExpectedString(
+       "@LongArray(value={-2147483647, 2147483648L, 9223372036854775807L})")
+        @LongArray(value={-Integer.MAX_VALUE, Integer.MAX_VALUE+1L, Long.MAX_VALUE})
+        public long[]      f7;
+
+        @ExpectedString(
+       "@StringArray(value={\"A\", \"B\", \"C\", \"\\\"Quote\\\"\"})")
+        @StringArray(value={"A", "B", "C", "\"Quote\""})
+        public String[]    f8;
+
+        @ExpectedString(
+       "@ClassArray(value={int.class, Obj[].class})")
+        @ClassArray(value={int.class, Obj[].class})
+        public Class<?>[]  f9;
+
+        @ExpectedString(
+       "@EnumArray(value={SOURCE})")
+        @EnumArray(value={RetentionPolicy.SOURCE})
+        public RetentionPolicy[]  f10;
+    }
+}
+
+// ------------ Supporting types ------------
+
+class Obj {}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ExpectedString {
+    String value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Classy {
+    Class<?> value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface BooleanArray {
+    boolean[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface FloatArray {
+    float[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface DoubleArray {
+    double[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ByteArray {
+    byte[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ShortArray {
+    short[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface CharArray {
+    char[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface IntArray {
+    int[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface LongArray {
+    long[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface ClassArray {
+    Class<?>[] value() default {int.class, Obj[].class};
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface StringArray {
+    String[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface EnumArray {
+    RetentionPolicy[] value();
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface MostlyPrimitive {
+    char   c0();
+    char   c1();
+    int    i0();
+    int    i1();
+    float  f0();
+    float  f1();
+    double d0();
+    double d1();
+    long   l0();
+    long   l1();
+    String s0();
+    String s1();
+    Class<?> class0();
+}
--- a/jdk/test/java/lang/annotation/ParameterAnnotations.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/test/java/lang/annotation/ParameterAnnotations.java	Thu Aug 04 17:49:12 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6761678
+ * @bug 6761678 8162817
  * @summary Check properties of Annotations returned from
  * getParameterAnnotations, including freedom from security
  * exceptions.
@@ -89,8 +89,8 @@
                 equal(ann.length, 2);
                 Annotation foo = ann[0][0];
                 Annotation bar = ann[1][0];
-                equal(foo.toString(), "@Named(value=foo)");
-                equal(bar.toString(), "@Named(value=bar)");
+                equal(foo.toString(), "@Named(value=\"foo\")");
+                equal(bar.toString(), "@Named(value=\"bar\")");
                 check(foo.equals(foo));
                 check(! foo.equals(bar));
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Locale/Bug8035133.java	Thu Aug 04 17:49:12 2016 +0000
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8035133
+ * @summary Checks that the tags matching the range with quality weight q=0
+ *          e.g. en;q=0 must be elimited and must not be the part of output
+ */
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+
+public class Bug8035133 {
+
+    private static boolean err = false;
+
+    public static void main(String[] args) {
+
+        // checking Locale.lookup with de-ch;q=0
+        checkLookup("en;q=0.1, *-ch;q=0.5, de-ch;q=0",
+                "de-ch, en, fr-ch", "fr-CH");
+
+        /* checking Locale.lookup with *;q=0 '*' should be ignored
+         * in lookup
+         */
+        checkLookup("en;q=0.1, *-ch;q=0.5, *;q=0",
+                "de-ch, en, fr-ch", "de-CH");
+
+        // checking Locale.filter with fr-ch;q=0 in BASIC_FILTERING
+        checkFilter("en;q=0.1, fr-ch;q=0.0, de-ch;q=0.5",
+                "de-ch, en, fr-ch", "de-CH, en");
+
+        // checking Locale.filter with *;q=0 in BASIC_FILTERING
+        checkFilter("de-ch;q=0.6, *;q=0", "de-ch, fr-ch", "");
+
+        // checking Locale.filter with *;q=0 in BASIC_FILTERING
+        checkFilter("de-ch;q=0.6, de;q=0", "de-ch", "");
+
+        // checking Locale.filter with *;q=0.6, en;q=0 in BASIC_FILTERING
+        checkFilter("*;q=0.6, en;q=0", "de-ch, hi-in, en", "de-CH, hi-IN");
+
+        // checking Locale.filter with de-ch;q=0 in EXTENDED_FILTERING
+        checkFilter("en;q=0.1, *-ch;q=0.5, de-ch;q=0",
+                "de-ch, en, fr-ch", "fr-CH, en");
+
+        /* checking Locale.filter with *-ch;q=0 in EXTENDED_FILTERING which
+         * must make filter to return "" empty or no match
+         */
+        checkFilter("de-ch;q=0.5, *-ch;q=0", "de-ch, fr-ch", "");
+
+        /* checking Locale.filter with *;q=0 in EXTENDED_FILTERING which
+         * must make filter to return "" empty or no match
+         */
+        checkFilter("*-ch;q=0.5, *;q=0", "de-ch, fr-ch", "");
+
+        /* checking Locale.filter with *;q=0.6, *-Latn;q=0 in
+         * EXTENDED_FILTERING
+         */
+        checkFilter("*;q=0.6, *-Latn;q=0", "de-ch, hi-in, en-Latn",
+                "de-CH, hi-IN");
+
+        if (err) {
+            throw new RuntimeException("[LocaleMatcher method(s) failed]");
+        }
+
+    }
+
+    private static void checkLookup(String ranges, String tags,
+            String expectedLocale) {
+
+        List<Locale.LanguageRange> priorityList = Locale.LanguageRange
+                .parse(ranges);
+        List<Locale> localeList = generateLocales(tags);
+        Locale loc = Locale.lookup(priorityList, localeList);
+        String actualLocale
+                = loc.toLanguageTag();
+
+        if (!actualLocale.equals(expectedLocale)) {
+            System.err.println("Locale.lookup failed with ranges: " + ranges
+                    + " Expected: " + expectedLocale
+                    + " Actual: " + actualLocale);
+            err = true;
+        }
+
+    }
+
+    private static void checkFilter(String ranges, String tags,
+            String expectedLocales) {
+
+        List<Locale.LanguageRange> priorityList = Locale.LanguageRange
+                .parse(ranges);
+        List<Locale> localeList = generateLocales(tags);
+        String actualLocales = getLocalesAsString(
+                Locale.filter(priorityList, localeList));
+
+        if (!actualLocales.equals(expectedLocales)) {
+            System.err.println("Locale.filter failed with ranges: " + ranges
+                    + " Expected: " + expectedLocales
+                    + " Actual: " + actualLocales);
+            err = true;
+        }
+
+    }
+
+    private static List<Locale> generateLocales(String tags) {
+        if (tags == null) {
+            return null;
+        }
+
+        List<Locale> localeList = new ArrayList<>();
+        if (tags.equals("")) {
+            return localeList;
+        }
+        String[] t = tags.split(", ");
+        for (String tag : t) {
+            localeList.add(Locale.forLanguageTag(tag));
+        }
+        return localeList;
+    }
+
+    private static String getLocalesAsString(List<Locale> locales) {
+        StringBuilder sb = new StringBuilder();
+
+        Iterator<Locale> itr = locales.iterator();
+        if (itr.hasNext()) {
+            sb.append(itr.next().toLanguageTag());
+        }
+        while (itr.hasNext()) {
+            sb.append(", ");
+            sb.append(itr.next().toLanguageTag());
+        }
+
+        return sb.toString().trim();
+    }
+
+}
--- a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Thu Aug 04 17:49:12 2016 +0000
@@ -32,7 +32,7 @@
  * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
  * @run main/othervm -Djava.security.debug=sunpkcs11 TestKeyPairGenerator
  *                                                   sm TestKeyPairGenerator.policy
- * @key intermittent randomness
+ * @key randomness
  */
 
 import java.math.BigInteger;
--- a/jdk/test/tools/jlink/IntegrationTest.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/test/tools/jlink/IntegrationTest.java	Thu Aug 04 17:49:12 2016 +0000
@@ -22,6 +22,7 @@
  */
 
 import java.io.File;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.UncheckedIOException;
 import java.nio.file.Files;
@@ -33,6 +34,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.function.Function;
 import jdk.tools.jlink.Jlink;
@@ -203,6 +205,27 @@
             throw new AssertionError("release not generated");
         }
 
+        Properties props = new Properties();
+        try (FileReader reader = new FileReader(release)) {
+            props.load(reader);
+        }
+
+        if (props.getProperty("JAVA_VERSION") == null) {
+            throw new AssertionError("release file does not contain JAVA_VERSION");
+        }
+
+        if (props.getProperty("OS_NAME") == null) {
+            throw new AssertionError("release file does not contain OS_NAME");
+        }
+
+        if (props.getProperty("OS_ARCH") == null) {
+            throw new AssertionError("release file does not contain OS_ARCH");
+        }
+
+        if (props.getProperty("OS_VERSION") == null) {
+            throw new AssertionError("release file does not contain OS_VERSION");
+        }
+
         if (!Files.exists(output.resolve("toto.txt"))) {
             throw new AssertionError("Post processing not called");
         }
--- a/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java	Thu Aug 04 17:32:53 2016 +0000
+++ b/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java	Thu Aug 04 17:49:12 2016 +0000
@@ -41,6 +41,7 @@
 import jdk.tools.jlink.builder.DefaultImageBuilder;
 
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
+import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.ResourcePool;
 
@@ -103,7 +104,18 @@
         });
         Path root = new File(".").toPath();
         DefaultImageBuilder imgbuilder = new DefaultImageBuilder(root);
-        imgbuilder.storeFiles(pool);
+        try {
+            imgbuilder.storeFiles(pool);
+        } catch (PluginException e) {
+            // We didn't add any .class resource of the java.base module!
+            // This cannot happen in non-testing scenario as java.base module
+            // is minimum mandatory module in a .jimage. jlink depends on java.base
+            // to generate 'release' file. If the current exception came from that
+            // part of the code, then it is okay.
+            if (!e.getMessage().contains("No module-info for java.base module")) {
+                throw e;
+            }
+        }
 
         if (lic.exists()) {
             File license = new File(root.toFile(), "LICENSE");