Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7902420

JavaHelpFactory.createHelpSetObject incorrectly calculates the prefix for HelpSet

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3
    • None
    • jt5.0
    • tools
    • None
    • generic
    • generic

    Description

      com.sun.interview.JavaHelpFactory.createHelpSetObject(String name, Class c) incorrectly calculates the prefix for HelpSet (JavaHelpFactory.java:62)

      62: pref = hsn.substring(0, hsn.indexOf(name));

      If name contains subdirectory, e.g. "help/jctck", it is not taken into account and the HelpSet is created based on interview parameter class name with suffix "/" only.

      HelpSet gets the incomplete prefix and throws NPE when mapref tag is read from .hs file and (HelpSet.java:118)
      118 localMap = parseMap(loader, u, prefix);
      is called.

      Here is stack trace from JC TCK interview. Interview.setHelpSet is called with "help/jctck":

      setHelpSet("help/jctck")

      mapref tag in help/jctck.hs file contains "default/jtjck.jhm" location:

           <mapref location="default/jtjck.jhm"/>

      parseMap is trying to parse file "default/jtjck.jhm" instead of "help/default/jtjck.jhm" and NPE is thrown:
      __________

      Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
              at com.sun.javatest.tool.jthelp.HelpSet.getXMLReader(HelpSet.java:167)
              at com.sun.javatest.tool.jthelp.HelpSet.readHelpMap(HelpSet.java:133)
              at com.sun.javatest.tool.jthelp.HelpSet.parseMap(HelpSet.java:118)
              at com.sun.javatest.tool.jthelp.HelpSet.<init>(HelpSet.java:78)
              at com.sun.interview.JavaHelpFactory.createHelpSetObject(JavaHelpFactory.java:68)
              at com.sun.interview.Interview.setHelpSet(Interview.java:371)
              at com.sun.tck.jc.interview.JCTCKEnvParameters.<init>(JCTCKEnvParameters.java:44)
      ...
      __________

      To workaround the issue in JC TCK, help set's "help" directory should be renamed to "moreInfo" because the prefix is recalculated correctly for this name. See HelpSet.java:74

      74 prefix = prefix + "moreInfo/";

      It allow to find help set correctly in JCK interview.

      JT 4.6 does not contain this issue.

      Attachments

        Activity

          People

            dbessono Dmitry Bessonov
            dsilaev Dmitri Silaev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: