src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java

changeset 1746
bd51ca92c013
parent 1745
937aa020c667
child 1747
df4f44800923
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:55 2013 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:55 2013 -0700
     1.3 @@ -991,53 +991,6 @@
     1.4       *
     1.5       * @param pkg the package to link to.
     1.6       * @param label the label for the link.
     1.7 -     * @param isStrong true if the label should be strong.
     1.8 -     * @return the link to the given package.
     1.9 -     */
    1.10 -    public String getPackageLinkString(PackageDoc pkg, String label,
    1.11 -                                 boolean isStrong) {
    1.12 -        return getPackageLinkString(pkg, label, isStrong, "");
    1.13 -    }
    1.14 -
    1.15 -    /**
    1.16 -     * Return the link to the given package.
    1.17 -     *
    1.18 -     * @param pkg the package to link to.
    1.19 -     * @param label the label for the link.
    1.20 -     * @param isStrong true if the label should be strong.
    1.21 -     * @param style  the font of the package link label.
    1.22 -     * @return the link to the given package.
    1.23 -     */
    1.24 -    public String getPackageLinkString(PackageDoc pkg, String label, boolean isStrong,
    1.25 -            String style) {
    1.26 -        boolean included = pkg != null && pkg.isIncluded();
    1.27 -        if (! included) {
    1.28 -            PackageDoc[] packages = configuration.packages;
    1.29 -            for (int i = 0; i < packages.length; i++) {
    1.30 -                if (packages[i].equals(pkg)) {
    1.31 -                    included = true;
    1.32 -                    break;
    1.33 -                }
    1.34 -            }
    1.35 -        }
    1.36 -        if (included || pkg == null) {
    1.37 -            return getHyperLinkString(pathString(pkg, DocPaths.PACKAGE_SUMMARY),
    1.38 -                                label, isStrong, style);
    1.39 -        } else {
    1.40 -            DocLink crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
    1.41 -            if (crossPkgLink != null) {
    1.42 -                return getHyperLinkString(crossPkgLink, label, isStrong, style);
    1.43 -            } else {
    1.44 -                return label;
    1.45 -            }
    1.46 -        }
    1.47 -    }
    1.48 -
    1.49 -    /**
    1.50 -     * Return the link to the given package.
    1.51 -     *
    1.52 -     * @param pkg the package to link to.
    1.53 -     * @param label the label for the link.
    1.54       * @return a content tree for the package link.
    1.55       */
    1.56      public Content getPackageLink(PackageDoc pkg, String label) {
    1.57 @@ -1302,6 +1255,10 @@
    1.58              String label, boolean strong) {
    1.59          return getDocLink(context, classDoc, doc, label, strong, false);
    1.60      }
    1.61 +    public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
    1.62 +            Content label, boolean strong) {
    1.63 +        return getDocLink(context, classDoc, doc, label, strong, false);
    1.64 +    }
    1.65  
    1.66     /**
    1.67       * Return the link for the given member.
    1.68 @@ -1318,7 +1275,12 @@
    1.69       */
    1.70      public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
    1.71              String label, boolean strong, boolean isProperty) {
    1.72 -        return getDocLink(context, classDoc, doc, new RawHtml(label), strong, isProperty);
    1.73 +        return getDocLink(context, classDoc, doc, new StringContent(check(label)), strong, isProperty);
    1.74 +    }
    1.75 +
    1.76 +    String check(String s) {
    1.77 +        if (s.matches(".*[&<>].*"))throw new IllegalArgumentException(s);
    1.78 +        return s;
    1.79      }
    1.80  
    1.81      public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
    1.82 @@ -1487,7 +1449,7 @@
    1.83              text = plainOrCode(plain, new StringContent(refMemName));
    1.84  
    1.85              return getDocLink(LinkInfoImpl.Kind.SEE_TAG, containing,
    1.86 -                refMem, (label.isEmpty() ? text: label).toString(), false);
    1.87 +                refMem, (label.isEmpty() ? text: label), false);
    1.88          }
    1.89      }
    1.90  

mercurial