NullPointerException creating

I am using JavaDoc for the first time, however I get a null pointer exception midway..

please help.

C:\java\src\>javadoc *.java

Loading source file AbstractTool.java...

Loading source file DrawCanvas.java...

Loading source file DrawCanvasListener.java...

Loading source file EraserTool.java...

Loading source file JDrawFrame.java...

Loading source file LineTool.java...

Loading source file OvalTool.java...

Loading source file RectangleTool.java...

Loading source file ScribbleTool.java...

Loading source file Tool.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 AbstractTool.html...

Generating DrawCanvas.html...

javadoc: In doclet class com.sun.tools.doclets.standard.Standard, method start has thrown

an exception java.lang.reflect.InvocationTargetException

java.lang.NullPointerException

at java.util.zip.ZipFile.getInputStream(ZipFile.java:176)

at com.sun.tools.javadoc.PackageDocImpl.documentation(PackageDocImpl.java:76)

at com.sun.tools.javadoc.DocImpl.comment(DocImpl.java:77)

at com.sun.tools.javadoc.DocImpl.tags(DocImpl.java:107)

at com.sun.tools.doclets.standard.HtmlStandardWriter.serialDocInclude(HtmlStandard

Writer.java:1381)

at com.sun.tools.doclets.standard.HtmlStandardWriter.serialInclude(HtmlStandardWri

ter.java:1362)

at com.sun.tools.doclets.standard.tags.SeeTaglet.toString(SeeTaglet.java:105)

at com.sun.tools.doclets.standard.HtmlStandardWriter.generateTagInfo(HtmlStandardW

riter.java:1494)

at com.sun.tools.doclets.standard.ClassWriter.generateClassFile(ClassWriter.java:2

34)

at com.sun.tools.doclets.standard.ClassWriter.generate(ClassWriter.java:95)

at com.sun.tools.doclets.standard.Standard.generateClassCycle(Standard.java:245)

at com.sun.tools.doclets.standard.Standard.generateClassFiles(Standard.java:195)

at com.sun.tools.doclets.standard.Standard.startGeneration(Standard.java:166)

at com.sun.tools.doclets.standard.Standard.start(Standard.java:44)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja

va:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:196)

at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:95)

at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:288)

at com.sun.tools.javadoc.Start.begin(Start.java:114)

at com.sun.tools.javadoc.Main.execute(Main.java:44)

at com.sun.tools.javadoc.Main.main(Main.java:34)

1 error

[3339 byte] By [primelogixa] at [2007-9-27 8:22:44]
# 1

We are interested in fixing this bug, whatever it is, because

javadoc should never crash (as shown by the stack trace).

Do the source files compile without error -- and in particular, DrawCanvas.java (where it crashed).

Do any of the classes belong to packages -- that is, do they

contain package statements?

If the source files are in a package, they should be in a directory

named after the package.

Does the source directory contain package.html? (I'm curious,

because it seemed to crash on a call from

PackageDocImpl.documentation.)

BTW, it's cleaner to use the -d option, so all the .html

files will not be mixed in the same directory as the .java files.

Try "-d api" to put them in the api directory.

-Doug Kramer

Javadoc team

dkramera at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

Here are the answers to your questions:

1. Yes they compile

2. None of the classes belong to packages (flat java sources in the same dir)

3. n/a

4. There are no htmls in the directory before running javadoc, it does create package.html during html generation

5. I tried the -d option, however it still did not work.

Any clues?

-Rohit

> We are interested in fixing this bug, whatever it is,

> because

> javadoc should never crash (as shown by the stack

> trace).

>

> Do the source files compile without error -- and in

> particular, DrawCanvas.java (where it crashed).

>

> Do any of the classes belong to packages -- that is,

> do they

> contain package statements?

>

> If the source files are in a package, they should be

> in a directory

> named after the package.

>

> Does the source directory contain package.html? (I'm

> curious,

> because it seemed to crash on a call from

> PackageDocImpl.documentation.)

>

> BTW, it's cleaner to use the -d option, so all the

> .html

> files will not be mixed in the same directory as the

> .java files.

> Try "-d api" to put them in the api directory.

>

> -Doug Kramer

> Javadoc team

primelogixa at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3

Did you mean it creates "package-summary.html"?

I don't see how it could create "package.html".

In any case, I don't see what could be causing your problem.

If you remove DrawCanvas.java, does javadoc work?

It's unusual for Javadoc to throw a NullPointerException.

If we can isolate it to that source file, it would enable us

to fix the bug.

I've asked our doclet engineer to look at the stack trace

for other clues.

-Doug Kramer

Javadoc team

dkramera at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 4

It does create packages.html.

If you want the source code to play around with email me at primelogix@yahoo.com

> Did you mean it creates "package-summary.html"?

> I don't see how it could create "package.html".

>

> In any case, I don't see what could be causing your

> problem.

> If you remove DrawCanvas.java, does javadoc work?

>

> It's unusual for Javadoc to throw a

> NullPointerException.

> If we can isolate it to that source file, it would

> enable us

> to fix the bug.

>

> I've asked our doclet engineer to look at the stack

> trace

> for other clues.

>

> -Doug Kramer

> Javadoc team

primelogixa at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 5

Here is what happens when Draw Canvas is removed:

C:\temp\docs>javadoc -d api *.java

Loading source file AbstractTool.java...

Loading source file DrawCanvasListener.java...

Loading source file EraserTool.java...

Loading source file JDrawFrame.java...

Loading source file LineTool.java...

Loading source file OvalTool.java...

Loading source file RectangleTool.java...

Loading source file ScribbleTool.java...

Loading source file Tool.java...

Constructing Javadoc information...

AbstractTool.java:13: cannot resolve symbol

symbol : class DrawCanvas

location: class AbstractTool

protectedDrawCanvascanvas; //the canvas drawi

ng area

^

AbstractTool.java:23: cannot resolve symbol

symbol : class DrawCanvas

location: class AbstractTool

public AbstractTool (DrawCanvas canvas,JFrame frame){

^

DrawCanvasListener.java:19: cannot resolve symbol

symbol : class DrawCanvas

location: class DrawCanvasListener

public DrawCanvasListener(DrawCanvas canvas,JFrame frame){

^

EraserTool.java:10: cannot resolve symbol

symbol : class DrawCanvas

location: class EraserTool

public EraserTool(DrawCanvas canvas,JDrawFrame frame){

^

JDrawFrame.java:21: cannot resolve symbol

symbol : class DrawCanvas

location: class JDrawFrame

protected DrawCanvas canvas;//the canvas where stuff will be drawn

^

LineTool.java:11: cannot resolve symbol

symbol : class DrawCanvas

location: class LineTool

public LineTool(DrawCanvas canvas,JFrame frame){

^

OvalTool.java:10: cannot resolve symbol

symbol : class DrawCanvas

location: class OvalTool

public OvalTool(DrawCanvas canvas,JFrame frame){

^

RectangleTool.java:10: cannot resolve symbol

symbol : class DrawCanvas

location: class RectangleTool

public RectangleTool(DrawCanvas canvas,JFrame frame){

^

ScribbleTool.java:10: cannot resolve symbol

symbol : class DrawCanvas

location: class ScribbleTool

public ScribbleTool(DrawCanvas canvas,JFrame frame){

^

Standard Doclet version 1.4.0

Generating api\constant-values.html...

Building tree for all the packages and classes...

Building index for all the packages and classes...

Generating api\overview-tree.html...

Generating api\index-all.html...

Generating api\deprecated-list.html...

Building index for all classes...

Generating api\allclasses-frame.html...

Generating api\allclasses-noframe.html...

Generating api\index.html...

Generating api\packages.html...

Generating api\AbstractTool.html...

Generating api\DrawCanvasListener.html...

Generating api\EraserTool.html...

Generating api\JDrawFrame.html...

JDrawFrame.java:11: warning - @date is an unknown tag.

javadoc: In doclet class com.sun.tools.doclets.standard.Standard, method start has thrown

an exception java.lang.reflect.InvocationTargetException

java.lang.NullPointerException

at java.util.zip.ZipFile.getInputStream(ZipFile.java:176)

at com.sun.tools.javadoc.PackageDocImpl.documentation(PackageDocImpl.java:76)

at com.sun.tools.javadoc.DocImpl.comment(DocImpl.java:77)

at com.sun.tools.javadoc.DocImpl.tags(DocImpl.java:107)

at com.sun.tools.doclets.standard.HtmlStandardWriter.serialDocInclude(HtmlStandard

Writer.java:1381)

at com.sun.tools.doclets.standard.HtmlStandardWriter.serialInclude(HtmlStandardWri

ter.java:1362)

at com.sun.tools.doclets.standard.tags.SeeTaglet.toString(SeeTaglet.java:105)

at com.sun.tools.doclets.standard.HtmlStandardWriter.generateTagInfo(HtmlStandardW

riter.java:1494)

at com.sun.tools.doclets.standard.ClassWriter.generateClassFile(ClassWriter.java:2

34)

at com.sun.tools.doclets.standard.ClassWriter.generate(ClassWriter.java:95)

at com.sun.tools.doclets.standard.Standard.generateClassCycle(Standard.java:245)

at com.sun.tools.doclets.standard.Standard.generateClassFiles(Standard.java:195)

at com.sun.tools.doclets.standard.Standard.startGeneration(Standard.java:166)

at com.sun.tools.doclets.standard.Standard.start(Standard.java:44)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja

va:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:196)

at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:95)

at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:288)

at com.sun.tools.javadoc.Start.begin(Start.java:114)

at com.sun.tools.javadoc.Main.execute(Main.java:44)

at com.sun.tools.javadoc.Main.main(Main.java:34)

1 error

10 warnings

primelogixa at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 6
Jamie, our doclet engineer, says this is a serious bug that hewill look into this week. Thanks for bringing it to our attention.-Doug KramerJavadoc team
dkramera at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 7

This very same bug is occuring for me...

<javadoc output>

H:\work\Ism\ism>javadoc src\*.java -d docs\api\

Loading source file src\GuageDial.java...

Loading source file src\TemplateTest.java...

Constructing Javadoc information...

Standard Doclet version 1.4.0

Generating docs\api\constant-values.html...

Building tree for all the packages and classes...

Building index for all the packages and classes...

Generating docs\api\overview-tree.html...

Generating docs\api\index-all.html...

Generating docs\api\deprecated-list.html...

Building index for all classes...

Generating docs\api\allclasses-frame.html...

Generating docs\api\allclasses-noframe.html...

Generating docs\api\index.html...

Generating docs\api\packages.html...

Generating docs\api\GuageDial.html...

javadoc: In doclet class com.sun.tools.doclets.standard.Standard, method start

has thrown an exception java.lang.reflect.InvocationTargetException

java.lang.NullPointerException

at java.util.zip.ZipFile.getInputStream(ZipFile.java:176)

at com.sun.tools.javadoc.PackageDocImpl.documentation(PackageDocImpl.java:76)

at com.sun.tools.javadoc.DocImpl.comment(DocImpl.java:77)

at com.sun.tools.javadoc.DocImpl.tags(DocImpl.java:107)

at com.sun.tools.doclets.standard.HtmlStandardWriter.serialDocInclude(Ht

mlStandardWriter.java:1381)

at com.sun.tools.doclets.standard.HtmlStandardWriter.serialInclude(HtmlS

tandardWriter.java:1362)

at com.sun.tools.doclets.standard.tags.SeeTaglet.toString(SeeTaglet.java:105)

at com.sun.tools.doclets.standard.HtmlStandardWriter.generateTagInfo(Htm

lStandardWriter.java:1494)

at com.sun.tools.doclets.standard.ClassWriter.generateClassFile(ClassWriter.java:234)

at com.sun.tools.doclets.standard.ClassWriter.generate(ClassWriter.java:95)

at com.sun.tools.doclets.standard.Standard.generateClassCycle(Standard.java:245)

at com.sun.tools.doclets.standard.Standard.generateClassFiles(Standard.java:195)

at com.sun.tools.doclets.standard.Standard.startGeneration(Standard.java:166)

at com.sun.tools.doclets.standard.Standard.start(Standard.java:44)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:196)

at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:95)

at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:288)

at com.sun.tools.javadoc.Start.begin(Start.java:114)

at com.sun.tools.javadoc.Main.execute(Main.java:44)

at com.sun.tools.javadoc.Main.main(Main.java:34)

1 error

</javadoc output>

The problem only seems to occur when it goes to generate the html for a class that _extends_ another class. classes which dont exdent anything come through unscaved. Hope this helps.

Have you made any progress on this bug?

UniversalOnea at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 8

I'm having the exact same problem running javadoc on my code files. None of my files are in packages or include packages. When I run javadoc on everything in the directory, the first few files work, but then it throws the exception. I can't find any difference between the files that work and those that don't though. I've even tried cutting back the files to include no comments, but they still don't work. Has anyone figured out a solution or made any progress on figuring out what the problem is? Thanks!

starlite182a at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 9

This NullPointerException happens when there is a JAR file in the class path. The tool tries to load the package.html file from the JAR file but fails because it is using the wrong path. For more information, please see:

http://developer.java.sun.com/developer/bugParade/bugs/4697113.html

I have fixed this bug. You will see the bug fix show up in J2SE 1.4.2.

Thanks for reporting this bug!

-Jamie Ho

Javadoc Team

jamie_ho2000a at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 10

Sorry to keep belaboring this problem, but is there a way to get javadoc to work right now? I'd really like to be able to run it on my files, but aside from taking all the jar files out of my classpath (which includes some necessary packages for my code to work properly on javadoc), I don't know how to fix it. Any ideas? Thanks!

starlite182a at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 11

As this problem only occurs with jars, have you tried to temporarily extract your jars to a directory and include that directory into your classpath instead of the jars?

E.g.:

Instead of

javadoc ... -classpath ./lib/important1.jar:./lib/important2.jar ...

create a temporary directory holding the contents of your jars

cd lib

mkdir importantDir

cd importantDir

cp ../*.jar .

jar xf important1.jar

jar xf important2.jar

rm *.jar

cd ../..

javadoc ... -classpath ./lib/importantDir ...

cd lib

rm -rf importantDir

Good luck!

Thomas

thomas.behra at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 12
Thank you so much! It works perfectly that way! :)
starlite182a at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 13

According to our doclet programmer, another thing to try

is setting classpath so it doesn't include those important

jar files:

-classpath .

You might get a lot of unknown class errors, but javadoc should

work anyway, because those unknown classes are not being documented.

-Doug

dkramera at 2007-7-8 16:14:08 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...