8015997: Additional improvement in Javadoc framing
authorbpatel
Fri, 07 Jun 2013 16:12:04 -0700
changeset 18404 a5aaa0341fec
parent 18403 c70f67529320
child 18406 17d20c121ac0
8015997: Additional improvement in Javadoc framing Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Fri May 31 10:28:30 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Fri Jun 07 16:12:04 2013 -0700
@@ -314,7 +314,8 @@
                 "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + DocletConstants.NL +
                 "        targetPage = \"undefined\";" + DocletConstants.NL +
                 "    function validURL(url) {" + DocletConstants.NL +
-                "        if (!(url.indexOf(\".html\") == url.length - 5))" + DocletConstants.NL +
+                "        var pos = url.indexOf(\".html\");" + DocletConstants.NL +
+                "        if (pos == -1 || pos != url.length - 5)" + DocletConstants.NL +
                 "            return false;" + DocletConstants.NL +
                 "        var allowNumber = false;" + DocletConstants.NL +
                 "        var allowSep = false;" + DocletConstants.NL +
--- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java	Fri May 31 10:28:30 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java	Fri Jun 07 16:12:04 2013 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4665566 4855876 7025314 8012375
+ * @bug      4665566 4855876 7025314 8012375 8015997
  * @summary  Verify that the output has the right javascript.
  * @author   jamieh
  * @library  ../lib/
@@ -56,7 +56,8 @@
             "    if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))" + NL +
             "        targetPage = \"undefined\";" + NL +
             "    function validURL(url) {" + NL +
-            "        if (!(url.indexOf(\".html\") == url.length - 5))" + NL +
+            "        var pos = url.indexOf(\".html\");" + NL +
+            "        if (pos == -1 || pos != url.length - 5)" + NL +
             "            return false;" + NL +
             "        var allowNumber = false;" + NL +
             "        var allowSep = false;" + NL +