JDK-4827300 : InvocationTargetException & NPE when generating doc for unpackaged servlet
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2003-03-04
  • Updated: 2014-05-05
  • Resolved: 2003-03-21
Related Reports
Duplicate :  
Description

Name: nt126004			Date: 03/04/2003


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



FULL OS VERSION :
Linux opus 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown



EXTRA RELEVANT SYSTEM CONFIGURATION :
Using a build script with Jakarta Ant 1.5.1

A DESCRIPTION OF THE PROBLEM :
I have a project tree like

JavaDev
   package1
      src   -> contains com/mycorp/package1/*.java
   package2
      src   -> contains com/mycorp/package2/*.java
   buildhere
      src   -> contains unpackages serlvets (*.java) and overview.html
      war   -> HTML, WEB-INF directory, etc.
   packagen
      ...

I run an ant build.xml in JavaDev/buildhere.  Inside buildhere/src are several
servlets that belong to no package.  With 1.3.1, javadoc creates the HTML for these servlets.  But in 1.4.1, I get an exception whenever javadoc reaches one of these servlets:



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a tree similar to that in "Description".  Attempt to run javadoc for all packages and the Java files in buildhere/src.  The error appears whenever an unpackaged servlet in buildhere/src is reached.

The attached script runjavadoc.sh is:

javadoc -d doc/javadocs -classpath /usr/local/j2sdkee1.3.1/lib/j2ee.jar:../package1/package1.jar:../package2/package2.jar:../packagen/packagen.jar -overview ./src/overview.html -windowtitle "Testing javadoc 1.4.1_01" -sourcepath ./src:../package1/src:../package2/src:../packagen/src -doctitle "<h1>Testing javadoc 1.4.1_01</h1>" -bottom "<i>Copyright &#169; 2003 mindwrap, inc. All Rights Reserved.</i>" -package ./src/HelloWorld.java com.mycorp.package1 com.mycorp.package2 com.mycorp.packagen


EXPECTED VERSUS ACTUAL BEHAVIOR :
All docs should build.
java.lang.NullPointerException at java.util.zip.ZipFile.getInputStream(ZipFile.java:182) when no zip file is present.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
  From the Ant console:

$ ant javadocs
Buildfile: build.xml

init:

javadocs:
   [delete] Deleting directory /home/thad/optixdev/JavaDev/optix-web/doc/javadocs
    [mkdir] Created dir: /home/thad/optixdev/JavaDev/optix-web/doc/javadocs
  [javadoc] Generating Javadoc
  [javadoc] Javadoc execution
  [javadoc] Loading source file /home/thad/optixdev/JavaDev/optix-web/src/DeleteFolderItemServlet.java...
  [javadoc] Loading source file /home/thad/optixdev/JavaDev/optix-web/src/GetScreenDef.java...
  [javadoc] Loading source file /home/thad/optixdev/JavaDev/optix-web/src/OpenObjectServlet.java...
  [javadoc] Loading source files for package com.optix.database...
  [javadoc] Loading source files for package com.optix.database.util...
  [javadoc] Loading source files for package com.optix.scrdef...
  [javadoc] Loading source files for package com.optix.servlet...
  [javadoc] Loading source files for package com.optix.util...
  [javadoc] Loading source files for package com.optix.util.collection...
  [javadoc] Loading source files for package com.optix.xml...
  [javadoc] Constructing Javadoc information...
  [javadoc] Standard Doclet version 1.4.1

  [javadoc] Building tree for all the packages and classes...
  [javadoc] Building index for all the packages and classes...
  [javadoc] Building index for all classes...
  [javadoc] javadoc: In doclet class com.sun.tools.doclets.standard.Standard,  method start has thrown an exception java.lang.reflect.InvocationTargetException
  [javadoc] java.lang.NullPointerException
  [javadoc] 	at java.util.zip.ZipFile.getInputStream(ZipFile.java:182)
  [javadoc] 	at com.sun.tools.javadoc.PackageDocImpl.documentation(PackageDocImpl.java:71)
  [javadoc] 	at com.sun.tools.javadoc.DocImpl.comment(DocImpl.java:74)
  [javadoc] 	at com.sun.tools.javadoc.DocImpl.tags(DocImpl.java:104)
  [javadoc] 	at com.sun.tools.doclets.standard.HtmlStandardWriter.serialDocInclude(HtmlStandardWriter.java:1432)
  [javadoc] 	at com.sun.tools.doclets.standard.HtmlStandardWriter.serialInclude(HtmlStandardWriter.java:1413)
  [javadoc] 	at com.sun.tools.doclets.standard.tags.SeeTaglet.toString(SeeTaglet.java:105)
  [javadoc] 	at com.sun.tools.doclets.standard.HtmlStandardWriter.generateTagInfo(HtmlStandardWriter.java:1545)
  [javadoc] 	at com.sun.tools.doclets.standard.ClassWriter.generateClassFile(ClassWriter.java:236)
  [javadoc] 	at com.sun.tools.doclets.standard.ClassWriter.generate(ClassWriter.java:95)
  [javadoc] Generating /home/thad/optixdev/JavaDev/optix-web/doc/javadocs/DeleteFolderItemServlet.html...
  [javadoc] 1 error
  [javadoc] 	at com.sun.tools.doclets.standard.Standard.generateClassCycle(Standard.java:245)
  [javadoc] 	at com.sun.tools.doclets.standard.Standard.generateClassFiles(Standard.java:195)
  [javadoc] 	at com.sun.tools.doclets.standard.Standard.startGeneration(Standard.java:166)
  [javadoc] 	at com.sun.tools.doclets.standard.Standard.start(Standard.java:44)
  [javadoc] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  [javadoc] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  [javadoc] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  [javadoc] 	at java.lang.reflect.Method.invoke(Method.java:324)
  [javadoc] 	at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:193)
  [javadoc] 	at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:92)
  [javadoc] 	at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:301)
  [javadoc] 	at com.sun.tools.javadoc.Start.begin(Start.java:120)
  [javadoc] 	at com.sun.tools.javadoc.Main.execute(Main.java:41)
  [javadoc] 	at com.sun.tools.javadoc.Main.main(Main.java:31)


REPRODUCIBILITY :
This bug can be reproduced always.

----------- BEGIN SOURCE ---------------
<see comments>
------------ END SOURCE ----------------

CUSTOMER SUBMITTED WORKAROUND :
I'm building the javadoc with 1.3.1.  It's an inconvenience.
(Review ID: 181649) 
======================================================================

Comments
EVALUATION jdocbug.jar.Z is attached and should reproduce the problem without using Ant. ###@###.### 2003-03-04 I am able to reproduce the InvocationTargetException and NullPointerException. using 1.4.1_01. These errors occur only when -classpath points to j2ee.jar. If this is omitted, the javadocs build with only these warnings: ./src/HelloWorld.java:2: package javax.servlet does not exist import javax.servlet.*; ^ ./src/HelloWorld.java:3: package javax.servlet.http does not exist import javax.servlet.http.*; ^ ./src/HelloWorld.java:5: cannot resolve symbol symbol : class HttpServlet location: class HelloWorld public class HelloWorld extends HttpServlet { ^ ./src/HelloWorld.java:10: cannot resolve symbol symbol : class HttpServletRequest location: class HelloWorld public void doGet(HttpServletRequest request, HttpServletResponse response) ^ ./src/HelloWorld.java:10: cannot resolve symbol symbol : class HttpServletResponse location: class HelloWorld public void doGet(HttpServletRequest request, HttpServletResponse response) ^ ./src/HelloWorld.java:11: cannot resolve symbol symbol : class ServletException location: class HelloWorld throws IOException, ServletException ^ ###@###.### 2003-03-20 This bug is a duplicate of 4697040, which has been fixed in 1.4.2. ###@###.### 2003-03-20 I also confirm this is fixed in 1.4.2 -- no errors are produced. ###@###.### 2003-03-21
20-03-2003

PUBLIC COMMENTS This is a duplicate of 4697040 and has already been fixed in 1.4.2. Please upgrade your version of Javadoc when 1.4.2 is available. ###@###.### 2003-03-20
20-03-2003