JDK-4463408 : javadoc tool: -encoding option is ignored for reading package.html
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2001-05-25
  • Updated: 2014-05-05
  • Resolved: 2001-07-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
1.4.0 beta2Fixed

Name: bsC130419			Date: 05/25/2001

java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)

When -encoding option is specified to javadoc, Java source codes are converted
correctly, but package.html aren't.

For example, an open-source project manage java source codes and related
documents includes "package.html" in Shift-JIS and share them from various
environments (e.g. Japanese Solaris which character encoding is Japanese-EUC).
On solaris, package.html is converted to '???' sequences.

This is a simple javadoc's bug.

j2sdk1_3_0-src-sol/src/share/classes/com/sun/tools/javadoc/DocImpl.java has the
following method which reads "package.html":

    String readHTMLDocumentation(java.io.InputStream input, String filename)
throws java.io.IOException {
        int filesize = input.available();
        byte[] filecontents = new byte[filesize];
        input.read(filecontents, 0, filesize);
        String rawDoc = new String(filecontents);

In fact, "new String(filecontents)" is the same as "new String(filecontents,
..., ..., ByteToCharConverter.getDefault())". Therefore, package.html always is
converted from platform's native character encoding, not character encoding
specified by -encoding option.

  To fix this bug, add an encoding argument to it like "new String(filecontents,
encoding)"; it is saved in an Env object and acquired by getCharacterEncoding().
(Review ID: 124196) 

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta2 FIXED IN: merlin-beta2 INTEGRATED IN: merlin-beta2

WORK AROUND Name: bsC130419 Date: 05/25/2001 Before runing javadoc, package.html must be converted to your platform's native character encoding. ======================================================================

EVALUATION Will investigate and fix asap. jamie.ho@Eng 2001-05-25 This bug has been fixed. Location of fix: DocEnv.java DocImpl.java JavadocTool.java Start.java jamie.ho@Eng 2001-07-10

PUBLIC COMMENTS Will investigate and fix asap. jamie.ho@Eng 2001-05-25 This bug has been fixed. If specified, the encoding is now used to read package.html. jamie.ho@Eng 2001-07-10