changeset 1628:c271c79d6a8c

Merge jdk7u60-b02
author andrew
date Thu, 26 Dec 2013 19:50:46 +0000
parents cdd21781b1df 954e1616449a
children c1b7eb1ea511
files .hgtags
diffstat 7 files changed, 344 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Dec 26 17:45:53 2013 +0000
+++ b/.hgtags	Thu Dec 26 19:50:46 2013 +0000
@@ -309,6 +309,22 @@
 17ee569d0c0130824ba27bc1b090114e6075c5f2 jdk7u25-b09
 41c1b02cd6a8fa7746752cc911da3dd4d380098d jdk7u25-b10
 0da9ef0d9fc5b017f960d65ae0cd07860a259621 jdk7u25-b11
+cf80c545434cfe44034e667079673ce42cc9cdbf jdk7u14-b16
+aecd58f25d7f21827ae1b020ae8cfb44857c439f jdk7u14-b17
+577f9625ec558c18e9de6e3428fd0f9cca823033 jdk7u14-b18
+5168a2c7af619364ddb342674ff880874c3b7897 jdk7u14-b19
+5168a2c7af619364ddb342674ff880874c3b7897 jdk7u14-b19
+e8c876a77def120b5eeb26535d0777c9b9f842f8 jdk7u14-b19
+86ae75a68cc375cfc0559699b5270951aab09eb0 jdk7u14-b20
+c31648d7a6ac692371f1e9abe95bc2856a7dc51c jdk7u14-b21
+eb1c9eacea1f07c07e7e700db624649d3573dae4 jdk7u14-b22
+e84535d2c292032669ac75a6a0afc5f23c708064 jdk7u40-b23
+d2b78e3b352dfb9b0cbd808669f9332e898147ed jdk7u40-b24
+e5635f70fe67192142cb5166bee08cc915a18bc4 jdk7u40-b25
+5bd6f156bc01b6a4e901fc5607663dfc249e9105 jdk7u40-b26
+12506bba2b67cd4b229550da67ff85b984549a28 jdk7u40-b27
+9f2eea2fae59c5242d1bb4cbca967bb6fbb99865 jdk7u40-b28
+bfe3575143fddbf71c2e570b580afef007d171e4 jdk7u40-b29
 28358b2489b2ca29c1a6b79f643204da8924a3d7 jdk7u25-b12
 5ed8c453480063838b632c74f528924f529361a2 jdk7u25-b13
 c6342ec6a12f7283e2a73a80a44dcdd3683e2e8b jdk7u25-b14
@@ -350,3 +366,29 @@
 95cefc18bea41615c6c9b85ccbdf62af899174cb jdk7u40-b41
 765bea9bfcfc8c472df0a2daced5e576095f46ac jdk7u40-b42
 988ece7b686564084770e99ca26746c45ffb933f jdk7u40-b43
+a67dbf96bf86989d0392cc5b66e5d4139cbceec7 jdk7u40-b60
+849b17bc6e9a08fa41e0ef631e51366a09842e64 jdk7u60-b00
+b2e29b79e54e58349c1dbcf5449f67fc5d5a235a jdk7u40-b61
+94ea3d062a3c28c64a837fa8f999c6b6956ff7c4 jdk7u40-b62
+9bbfba4981e1db5016bbfbc23025763966021c26 jdk7u45-b01
+61d5b73ae0ac46268490e2f0dfa1f69a5acda73f jdk7u45-b02
+2fe27ae865e723473225756f1920d9d76d47b903 jdk7u45-b03
+bede296dc848533abae859e61584a517df2773ae jdk7u45-b04
+e989f2f2b5cb639a23a5e67da0d52766acf549a2 jdk7u45-b05
+6f492dc935adc6e2878bb6045aee001a829428a7 jdk7u45-b06
+4c51f98e1eb5b8d94dfca08f3b3160ff382b7c3a jdk7u45-b07
+6cf97c9859e731fba6bcff67c46f57dead8d7284 jdk7u45-b08
+a9c31d3f8188b344ed165ec0730ebc2fd11dfa5d jdk7u45-b09
+2c09352066ec34c8608ccff0f933f566a52033af jdk7u45-b10
+53d5c06766b05689cdccfc300b32075878e8aa1d jdk7u45-b11
+0b6aa6e95eb9da58a686edacf5b102116614d3ea jdk7u45-b12
+68862f365075a11dfa291033d05a062590db9337 jdk7u45-b13
+8c799b9f0cd8af3b1cfd151ba075a4f1630967df jdk7u45-b14
+36ae3f206b53f751a0ebf933e5dbf364097b48a5 jdk7u45-b15
+18d1864abca976ca68cb71612e9b20c908455d3d jdk7u45-b16
+b9aeec6b9d5aac0746f8d1764a7740f8b83334ab jdk7u45-b17
+ba3ff27d4082f2cf0d06e635b2b6e01f80e78589 jdk7u45-b18
+164cf7491ba2f371354ba343a604eee4c61c529d jdk7u45-b30
+7f5cfaedb25c2c2774d6839810d6ae543557ca01 jdk7u45-b31
+849b17bc6e9a08fa41e0ef631e51366a09842e64 jdk7u60-b00
+b19e375d9829daf207b1bdc7f908a3e1d548462c jdk7u60-b01
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Thu Dec 26 17:45:53 2013 +0000
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Thu Dec 26 19:50:46 2013 +0000
@@ -292,7 +292,7 @@
             script.addAttr(HtmlAttr.TYPE, "text/javascript");
             String scriptCode = "<!--" + DocletConstants.NL +
                     "    if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
-                    "        parent.document.title=\"" + winTitle + "\";" + DocletConstants.NL +
+                    "        parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL +
                     "    }" + DocletConstants.NL +
                     "//-->" + DocletConstants.NL;
             RawHtml scriptContent = new RawHtml(scriptCode);
@@ -302,6 +302,53 @@
     }
 
     /**
+     * Returns a String with escaped special JavaScript characters.
+     *
+     * @param s String that needs to be escaped
+     * @return a valid escaped JavaScript string
+     */
+    private static String escapeJavaScriptChars(String s) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < s.length(); i++) {
+            char ch = s.charAt(i);
+            switch (ch) {
+                case '\b':
+                    sb.append("\\b");
+                    break;
+                case '\t':
+                    sb.append("\\t");
+                    break;
+                case '\n':
+                    sb.append("\\n");
+                    break;
+                case '\f':
+                    sb.append("\\f");
+                    break;
+                case '\r':
+                    sb.append("\\r");
+                    break;
+                case '"':
+                    sb.append("\\\"");
+                    break;
+                case '\'':
+                    sb.append("\\\'");
+                    break;
+                case '\\':
+                    sb.append("\\\\");
+                    break;
+                default:
+                    if (ch < 32 || ch >= 127) {
+                        sb.append(String.format("\\u%04X", (int)ch));
+                    } else {
+                        sb.append(ch);
+                    }
+                    break;
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
      * Returns a content tree for the SCRIPT tag for the main page(index.html).
      *
      * @return a content for the SCRIPT tag
--- a/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Thu Dec 26 17:45:53 2013 +0000
+++ b/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Thu Dec 26 19:50:46 2013 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -501,11 +501,10 @@
     private void scanIdent() {
         boolean isJavaIdentifierPart;
         char high;
+        if (sp == sbuf.length) putChar(ch); else sbuf[sp++] = ch;
+        // optimization, was: putChar(ch);
+        scanChar();
         do {
-            if (sp == sbuf.length) putChar(ch); else sbuf[sp++] = ch;
-            // optimization, was: putChar(ch);
-
-            scanChar();
             switch (ch) {
             case 'A': case 'B': case 'C': case 'D': case 'E':
             case 'F': case 'G': case 'H': case 'I': case 'J':
@@ -522,6 +521,7 @@
             case '$': case '_':
             case '0': case '1': case '2': case '3': case '4':
             case '5': case '6': case '7': case '8': case '9':
+                break;
             case '\u0000': case '\u0001': case '\u0002': case '\u0003':
             case '\u0004': case '\u0005': case '\u0006': case '\u0007':
             case '\u0008': case '\u000E': case '\u000F': case '\u0010':
@@ -529,30 +529,37 @@
             case '\u0015': case '\u0016': case '\u0017':
             case '\u0018': case '\u0019': case '\u001B':
             case '\u007F':
-                break;
+                scanChar();
+                continue;
             case '\u001A': // EOI is also a legal identifier part
                 if (bp >= buflen) {
                     name = names.fromChars(sbuf, 0, sp);
                     token = keywords.key(name);
                     return;
                 }
-                break;
+                scanChar();
+                continue;
             default:
                 if (ch < '\u0080') {
                     // all ASCII range chars already handled, above
                     isJavaIdentifierPart = false;
                 } else {
-                    high = scanSurrogates();
-                    if (high != 0) {
-                        if (sp == sbuf.length) {
-                            putChar(high);
+                    if (Character.isIdentifierIgnorable(ch)) {
+                        scanChar();
+                        continue;
+                    } else {
+                        high = scanSurrogates();
+                        if (high != 0) {
+                            if (sp == sbuf.length) {
+                                putChar(high);
+                            } else {
+                                sbuf[sp++] = high;
+                            }
+                            isJavaIdentifierPart = Character.isJavaIdentifierPart(
+                                Character.toCodePoint(high, ch));
                         } else {
-                            sbuf[sp++] = high;
+                            isJavaIdentifierPart = Character.isJavaIdentifierPart(ch);
                         }
-                        isJavaIdentifierPart = Character.isJavaIdentifierPart(
-                            Character.toCodePoint(high, ch));
-                    } else {
-                        isJavaIdentifierPart = Character.isJavaIdentifierPart(ch);
                     }
                 }
                 if (!isJavaIdentifierPart) {
@@ -561,6 +568,9 @@
                     return;
                 }
             }
+            if (sp == sbuf.length) putChar(ch); else sbuf[sp++] = ch;
+            // optimization, was: putChar(ch);
+            scanChar();
         } while (true);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java	Thu Dec 26 19:50:46 2013 +0000
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, 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 8016675
+ * @summary Test for window title.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestWindowTitle
+ * @run main TestWindowTitle
+ */
+
+public class TestWindowTitle extends JavadocTester {
+
+    private static final String BUG_ID = "8016675";
+    private static final String WIN_TITLE =
+            "Testing \"Window 'Title'\" with a \\ backslash and a / " +
+            "forward slash and a \u00e8 unicode char also a    tab and also a " +
+            "\t special character another \u0002 unicode)";
+    private static final String[][] TEST = {
+        {BUG_ID + FS  + "overview-summary.html",
+            "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" " +
+            "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char " +
+            "also a    tab and also a \\t special character another \\u0002 unicode))\";"
+        },
+    };
+    private static final String[][] NEG_TEST = {
+        {BUG_ID + FS + "overview-summary.html",
+            "parent.document.title=\"Overview (Testing \"Window \'Title\'\" " +
+            "with a \\ backslash and a / forward slash and a \u00E8 unicode char " +
+            "also a    tab and also a \t special character another \u0002 unicode))\";"
+        },
+    };
+    private static final String[] ARGS = new String[]{
+        "-d", BUG_ID, "-windowtitle", WIN_TITLE, "-sourcepath", SRC_DIR, "p1", "p2"
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestWindowTitle tester = new TestWindowTitle();
+        run(tester, ARGS, TEST, NEG_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testWindowTitle/p1/C1.java	Thu Dec 26 19:50:46 2013 +0000
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+package p1;
+
+public class C1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testWindowTitle/p2/C2.java	Thu Dec 26 19:50:46 2013 +0000
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+package p2;
+
+public class C2 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7144981/IgnoreIgnorableCharactersInInput.java	Thu Dec 26 19:50:46 2013 +0000
@@ -0,0 +1,92 @@
+
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 7144981
+ * @summary javac should ignore ignorable characters in input
+ * @run main IgnoreIgnorableCharactersInInput
+ */
+
+import com.sun.source.util.JavacTask;
+import java.io.File;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.TreeSet;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class IgnoreIgnorableCharactersInInput {
+
+    public static void main(String... args) throws Exception {
+        new IgnoreIgnorableCharactersInInput().run();
+    }
+
+    void run() throws Exception {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        File classesDir = new File(System.getProperty("user.dir"), "classes");
+        classesDir.mkdirs();
+        JavaSource[] sources = new JavaSource[]{
+            new JavaSource("TestOneIgnorableChar", "AA\\u0000BB"),
+            new JavaSource("TestMultipleIgnorableChar", "AA\\u0000\\u0000\\u0000BB")};
+        JavacTask ct = (JavacTask)comp.getTask(null, null, null,
+                Arrays.asList("-d", classesDir.getPath()),
+                null, Arrays.asList(sources));
+        try {
+            if (!ct.call()) {
+                throw new AssertionError("Error thrown when compiling test cases");
+            }
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when compiling test cases");
+        }
+        check(classesDir,
+                "TestOneIgnorableChar.class",
+                "TestOneIgnorableChar$AABB.class",
+                "TestMultipleIgnorableChar.class",
+                "TestMultipleIgnorableChar$AABB.class");
+        if (errors > 0)
+            throw new AssertionError("There are some errors in the test check the error output");
+    }
+
+    /**
+     *  Check that a directory contains the expected files.
+     */
+    void check(File dir, String... paths) {
+        Set<String> found = new TreeSet<String>(Arrays.asList(dir.list()));
+        Set<String> expect = new TreeSet<String>(Arrays.asList(paths));
+        if (found.equals(expect))
+            return;
+        for (String f: found) {
+            if (!expect.contains(f))
+                error("Unexpected file found: " + f);
+        }
+        for (String e: expect) {
+            if (!found.contains(e))
+                error("Expected file not found: " + e);
+        }
+    }
+
+    int errors;
+
+    void error(String msg) {
+        System.err.println(msg);
+        errors++;
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String internalSource =
+            "public class #O {public class #I {} }";
+        public JavaSource(String outerClassName, String innerClassName) {
+            super(URI.create(outerClassName + ".java"), JavaFileObject.Kind.SOURCE);
+            internalSource =
+                    internalSource.replace("#O", outerClassName).replace("#I", innerClassName);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return internalSource;
+        }
+    }
+}