JDK-4821648 : Package name ending in ".java" causes failure
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 1.4.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2003-02-20
  • Updated: 2014-05-05
  • Resolved: 2003-02-20
Related Reports
Duplicate :  
Description

Name: jl125535			Date: 02/20/2003


FULL PRODUCT VERSION :
java version "1.4.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_02-b02)
Java HotSpot(TM) Client VM (build 1.4.0_02-b02, mixed mode)


FULL OS VERSION :
SunOS fid 5.8 Generic_108528-16 sun4u sparc SUNW,Ultra-60
Windows_NT IDAHO 4 00 586

A DESCRIPTION OF THE PROBLEM :
Packages which end in ".java" cause problems for javadoc.
Javadoc does not parse these as packages & instead parses them as files:

Note: 'Loading source file...' when it should be  'Loading source files for package...'

Example:
javadoc com.mycompany.modules.java com.mycompany.jsp

Error message:
Loading source file com.mycompany.modules.java...
error: cannot read: com.mycompany.modules.java
Loading source files for package com.mycompany.modules...
Loading source files for package com.mycompany.modules.jsp...
1 error

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
mkdir -p src/com/foo/java
cat > src/com/foo/java/One.java
package com.foo.java;
public class One {
public static void main(String[] arg)  {
System.out.println("ONE");
}}
^D        // Control-D
javadoc -sourcepath src com.foo.java




EXPECTED VERSUS ACTUAL BEHAVIOR :
If all went well, the output would have been:
Loading source files for package com.foo.java...
Constructing Javadoc information...
Standard Doclet version 1.4.0

Generating constant-values.html...
Building tree for all the packages and classes...
Building index for all the packages and classes...
Generating overview-tree.html...
Generating index-all.html...
Generating deprecated-list.html...
Building index for all classes...
Generating allclasses-frame.html...
Generating allclasses-noframe.html...
Generating index.html...
Generating packages.html...
Generating com/foo/java/package-frame.html...
Generating com/foo/java/package-summary.html...
Generating com/foo/java/package-tree.html...
Generating com/foo/java/One.html...
Generating package-list...
Generating help-doc.html...
Generating stylesheet.css...
Instead, your output will be:

Loading source file com.foo.java...
error: cannot read: com.foo.java
1 error

ERROR MESSAGES/STACK TRACES THAT OCCUR :
see above.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
see above.
Paste everything but the "control-D"
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
don't generate javadocs for packages ending in .java
(note, com.foo.java.bar works fine).
(Review ID: 181585) 
======================================================================

Comments
EVALUATION Please upgrade to 1.4.1 or later, where it is fixed. Closing as a dupe of: 4507380: Merlin javadoc cannot handle packages named *.java (regression) ###@###.### 2003-02-20
20-02-2003