This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 59033 - NPE from ClassFileInfoUtil.getJavadocFile
Summary: NPE from ClassFileInfoUtil.getJavadocFile
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: Pavel Flaska
URL:
Keywords:
: 59075 59643 60444 60952 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-05-18 17:27 UTC by markswanson
Modified: 2007-09-26 09:14 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
project.xml - requested by jlahoda (493 bytes, text/xml)
2005-05-18 18:01 UTC, markswanson
Details
Example project. (12.47 KB, application/octet-stream)
2005-05-19 09:14 UTC, Jan Lahoda
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markswanson 2005-05-18 17:27:07 UTC
I just downloaded Netbeans 4.1 today and the first Java file I clicked on caused
NetBeans to throw the Exception below. Other java files work fine.

The 'problem' java file compiles fine and has been used in production for years.

Annotation: Exception occurred in Request Processor
java.lang.NullPointerException
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.getJavadocFile(ClassFileInfoUtil.java:705)
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.getHtmlReader(ClassFileInfoUtil.java:633)
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.createParamsInfo(ClassFileInfoUtil.java:582)
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.createMethodInfo(ClassFileInfoUtil.java:213)
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.createClassInfo(ClassFileInfoUtil.java:153)
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.createClassInfo(ClassFileInfoUtil.java:66)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.getResInfoFromClassFile(ResourceImpl.java:413)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.directClassFileUpdate(ResourceImpl.java:670)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.checkUpToDate(ResourceImpl.java:644)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.checkUpToDate(ResourceImpl.java:582)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.checkUpToDate(SemiPersistentElement.java:263)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.checkUpToDate(SemiPersistentElement.java:267)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.JavaClassImpl.getSuperClass(JavaClassImpl.java:321)
	at org.netbeans.jmi.javamodel.JavaClass$Impl.getSuperClass(Unknown Source)
	at
org.netbeans.modules.javacore.parser.MDRParser.getSuperClass(MDRParser.java:1453)
	at
org.netbeans.modules.javacore.parser.Scope.constructMemberTypeScope(Scope.java:130)
	at org.netbeans.modules.javacore.parser.Scope.createMemberTypeScope(Scope.java:118)
	at
org.netbeans.modules.javacore.parser.Scope.constructMemberTypeScope(Scope.java:140)
	at org.netbeans.modules.javacore.parser.Scope.createMemberTypeScope(Scope.java:118)
	at org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:474)
	at org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:364)
	at org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:326)
	at org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:304)
	at org.netbeans.modules.javacore.parser.MDRParser.enterMembers(MDRParser.java:234)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.directUpdate(ResourceImpl.java:732)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.checkUpToDate(ResourceImpl.java:640)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.checkUpToDate(ResourceImpl.java:582)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.initResource(ResourceImpl.java:422)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.initCheck(MetadataElement.java:133)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.getElementInfo(SemiPersistentElement.java:185)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.initChildren(ResourceImpl.java:323)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.initChildren(ResourceImpl.java:317)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.MetadataElement.initCheck(MetadataElement.java:139)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.checkUpToDate(SemiPersistentElement.java:269)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.JavaClassImpl.getContents(JavaClassImpl.java:407)
	at org.netbeans.jmi.javamodel.JavaClass$Impl.getContents(Unknown Source)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.FeaturesList.toArray(FeaturesList.java:101)
	at java.util.LinkedList.addAll(LinkedList.java:265)
	at java.util.LinkedList.addAll(LinkedList.java:242)
	at java.util.LinkedList.<init>(LinkedList.java:98)
	at
org.netbeans.modules.javanavigation.JUtils.addInnerClassMembers(JUtils.java:1382)
	at org.netbeans.modules.javanavigation.JUtils.getClassMembers(JUtils.java:1339)
	at
org.netbeans.modules.javanavigation.ClassMemberModel.loadContents(ClassMemberModel.java:247)
	at
org.netbeans.modules.navigator.spi.ListModelSupport$Loader.run(ListModelSupport.java:945)
	at org.openide.util.Task.run(Task.java:189)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:721)
Comment 1 markswanson 2005-05-18 17:38:08 UTC
Btw, this is running NetBeans-4.1 with the new mustang b36.
Comment 2 markswanson 2005-05-18 17:41:06 UTC
Also note: the error also happens with java 1.5.0_02 (i586, Linux). I just
re-installed netbeans-4.1 from scratch with the new jdk to confirm. here is the
1.5.2_02/nb 4.1 stack trace:

(btw, there is a bug in the error dialog. It ends with:
"The messages.log file is located in your". In my where? The dialog doesn't say)

java.lang.NullPointerException
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.getJavadocFile(ClassFileInfoUtil.java:705)
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.getHtmlReader(ClassFileInfoUtil.java:633)
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.createParamsInfo(ClassFileInfoUtil.java:582)
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.createMethodInfo(ClassFileInfoUtil.java:213)
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.createClassInfo(ClassFileInfoUtil.java:153)
	at
org.netbeans.modules.javacore.parser.ClassFileInfoUtil.createClassInfo(ClassFileInfoUtil.java:66)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.getResInfoFromClassFile(ResourceImpl.java:413)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.directClassFileUpdate(ResourceImpl.java:670)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.checkUpToDate(ResourceImpl.java:644)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.checkUpToDate(ResourceImpl.java:582)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.checkUpToDate(SemiPersistentElement.java:263)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.checkUpToDate(SemiPersistentElement.java:267)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.JavaClassImpl.getSuperClass(JavaClassImpl.java:321)
	at org.netbeans.jmi.javamodel.JavaClass$Impl.getSuperClass(Unknown Source)
	at
org.netbeans.modules.javacore.parser.MDRParser.getSuperClass(MDRParser.java:1453)
	at
org.netbeans.modules.javacore.parser.Scope.constructMemberTypeScope(Scope.java:130)
	at org.netbeans.modules.javacore.parser.Scope.createMemberTypeScope(Scope.java:118)
	at
org.netbeans.modules.javacore.parser.Scope.constructMemberTypeScope(Scope.java:140)
	at org.netbeans.modules.javacore.parser.Scope.createMemberTypeScope(Scope.java:118)
	at org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:474)
	at org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:364)
	at org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:326)
	at org.netbeans.modules.javacore.parser.MDRParser.processAST(MDRParser.java:304)
	at org.netbeans.modules.javacore.parser.MDRParser.enterMembers(MDRParser.java:234)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.directUpdate(ResourceImpl.java:732)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.checkUpToDate(ResourceImpl.java:640)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.checkUpToDate(ResourceImpl.java:582)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement.checkUpToDate(SemiPersistentElement.java:263)
	at
org.netbeans.modules.javacore.jmiimpl.javamodel.ResourceImpl.getImports(ResourceImpl.java:270)
	at org.netbeans.jmi.javamodel.Resource$Impl.getImports(Unknown Source)
	at
org.netbeans.modules.editor.java.NbJavaFoldManager.collectFoldUpdates(NbJavaFoldManager.java:306)
	at
org.netbeans.modules.editor.java.NbJavaFoldManager.updateFolds(NbJavaFoldManager.java:210)
	at
org.netbeans.modules.editor.java.NbJavaFoldManager.run(NbJavaFoldManager.java:193)
	at org.openide.util.Task.run(Task.java:189)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:721)
Comment 3 Jan Lahoda 2005-05-18 17:42:44 UTC
Hello,
    is your project a freeform project? If yes, could you please attach your
nbproject/project.xml to this bug? Also the fully-qualified name (package+name)
of the problematic class and its location in the project (path from the project
folder) would be helpfull.
Thank you.
Comment 4 markswanson 2005-05-18 18:01:44 UTC
Created attachment 22188 [details]
project.xml - requested by jlahoda
Comment 5 markswanson 2005-05-18 18:04:04 UTC
As requested:
freeform: yes
1. class: com.wss.calendar.client.jws.JWSHelper.java
2. location: src/com/wss/calendar/client/jws

Cheers
Comment 6 Jan Lahoda 2005-05-19 09:13:15 UTC
Hello, thanks for the info.

I was able to reproduce the problem, I am attaching a testing J2SE project.
Unpack it, open javaapplication5.Main in the editor, and switch the "show
inherited members" in the navigator - the exception is thrown.

It seems to be caused by a classfile under the source roots. If the EXECUTE
classpath is taken for this classfile, it does not contain the classfile (which
is OK in my opinion), and so the NullPointerException is thrown.

(Note: more conditions need to be fullfilled: the classfile has to be without
the variable debug info, the Main class has to extend the class defined in the
classfile.)
Comment 7 Jan Lahoda 2005-05-19 09:14:12 UTC
Created attachment 22190 [details]
Example project.
Comment 8 Jan Lahoda 2005-05-19 19:22:14 UTC
Possible workarounds (hopefully some of them will help):
1. do not have ".class" files in the source directories.
2. make the ".class" files in the source directories contain full debug info (in
particular variable debug info).
3. other?
Comment 9 Jan Lahoda 2005-05-19 19:28:05 UTC
*** Issue 59075 has been marked as a duplicate of this issue. ***
Comment 10 markswanson 2005-05-19 19:34:51 UTC
Note: The JWSHelper.class has _all_ debug info - so the workaround to enable
debug info wouldn't help.
Comment 11 Martin Matula 2005-05-19 21:52:15 UTC
Pavel, please look at it.
Comment 12 Pavel Flaska 2005-05-20 08:07:01 UTC
Mark is right. Debug information is not enough. The code throwing NPE is used,
when reading classfile parameters and there is missing parameter's name. When
you have class file compiled with -g, names are present, but name doesn't
present for parameters in abstract classes and interfaces, so if you have such
classes, workaround 2) does not help.

I have prepared simple fix.
Comment 13 Pavel Flaska 2005-05-20 09:12:44 UTC
Checking in src/org/netbeans/modules/javacore/parser/ClassFileInfoUtil.java;
/cvs/java/javacore/src/org/netbeans/modules/javacore/parser/ClassFileInfoUtil.java,v
 <--  ClassFileInfoUtil.java
new revision: 1.26; previous revision: 1.25
done
Comment 14 Tomas Hurka 2005-06-16 10:32:55 UTC
*** Issue 59643 has been marked as a duplicate of this issue. ***
Comment 15 Jan Lahoda 2005-06-24 12:21:17 UTC
*** Issue 60444 has been marked as a duplicate of this issue. ***
Comment 16 Jiri Prox 2005-07-14 11:00:02 UTC
Verified in 4.2 (200507110943)
Comment 17 Pavel Flaska 2005-09-14 12:57:57 UTC
*** Issue 60952 has been marked as a duplicate of this issue. ***
Comment 18 Quality Engineering 2007-09-20 09:48:26 UTC
Reorganization of java component