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 54148 - NPE from FixAllImports.changeImports
Summary: NPE from FixAllImports.changeImports
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: Daniel Prusa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-28 11:02 UTC by hchar
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
zipped NetBeans project folder with lib/*.jar removed to reduce filesize (79.61 KB, application/octet-stream)
2005-01-29 00:04 UTC, hchar
Details
messages.log of NetBeans when the NPE occurred (173.09 KB, text/plain)
2005-01-29 00:08 UTC, hchar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hchar 2005-01-28 11:02:47 UTC
Annotation: Exception occurred in Request Processor
java.lang.NullPointerException
	at
org.netbeans.modules.editor.java.JavaFixAllImports.changeImports(JavaFixAllImports.java:393)
	at
org.netbeans.modules.editor.java.JavaFixAllImports.addAllNeededImports(JavaFixAllImports.java:264)
	at
org.netbeans.modules.editor.java.JavaFixAllImports$1.run(JavaFixAllImports.java:67)
	at org.openide.util.Task.run(Task.java:136)
	at
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:686)
[org.netbeans.javacore] INFORMATIONAL ***********
Exception occurred ************ at 9:54 PM on Jan
28, 2005
[catch]java.lang.Exception: rollback!!!
	at
org.netbeans.modules.javacore.ExclusiveMutex.leave(ExclusiveMutex.java:345)
	at
org.netbeans.mdr.NBMDRepositoryImpl.endTrans(NBMDRepositoryImpl.java:248)
	at
org.netbeans.modules.editor.java.JMIUtils.endTrans(JMIUtils.java:167)
	at
org.netbeans.modules.editor.java.JavaFixAllImports.addAllNeededImports(JavaFixAllImports.java:271)
	at
org.netbeans.modules.editor.java.JavaFixAllImports$1.run(JavaFixAllImports.java:67)
	at org.openide.util.Task.run(Task.java:136)
	at
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
	at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:686)
*********** Exception occurred ************ at
9:54 PM on Jan 28, 2005
Annotation: Exception occurred in Request Processor
java.lang.NullPointerException
	at
org.netbeans.modules.editor.java.JavaFixAllImports.changeImports(JavaFixAllImports.java:393)
	at
org.netbeans.modules.editor.java.JavaFixAllImports.addAllNeededImports(JavaFixAllImports.java:264)
	at
org.netbeans.modules.editor.java.JavaFixAllImports$1.run(JavaFixAllImports.java:67)
	at org.openide.util.Task.run(Task.java:136)
	at
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:686)
Comment 1 Milos Kleint 2005-01-28 11:48:43 UTC
java issue
Comment 2 Martin Matula 2005-01-28 15:30:12 UTC
Could you please provide steps to reproduce this problem?
FixAllImports works OK for me in the current build. What build are you
using? Could you please attach the messages.log.
Comment 3 hchar 2005-01-28 23:59:45 UTC
1) I am using NetBeans IDE 4.0 (Build 200412081800), which should be
the latest build.
2) The Fix Imports work most of the time, but definitely don't work
for missing annotation classes.

I am going to upload the entire zipped NetBeans project as an
attachment shortly.  Just open up the NetBeans project folder "yajcache".

3) The one that caused NPE when invoking the Fix Imports is the class
org.apache.jcs.yajcache.soft.SoftRefFileCache.java, when the line for
importing the AtomicInteger is commented out.
Comment 4 hchar 2005-01-29 00:04:05 UTC
Created attachment 20054 [details]
zipped NetBeans project folder with lib/*.jar removed to reduce filesize
Comment 5 hchar 2005-01-29 00:05:56 UTC
The removed lib/*.jar files are:

commons-beanutils-1.6.1.jar
commons-collections-3.1.jar
commons-lang-2.0.jar
commons-logging-1.0.3.jar
junit-3.8.1.jar
log4j-1.2.8.jar

All can be easily found and downloaded somewhere else.  All let me
know if you want me to upload them as separate attachments.
Comment 6 hchar 2005-01-29 00:08:44 UTC
Created attachment 20055 [details]
messages.log of NetBeans when the NPE occurred
Comment 7 hchar 2005-01-29 00:15:06 UTC
Also, for any class that has the following line, 

import org.apache.jcs.yajcache.lang.annotation.*;

if you comment it out and do a Fix Imports, you will get a failure.

However, this seems to be a different (and general) failure than the
specific AtomicInteger fix import problem of class SoftRefFileCache.java 
Comment 8 Daniel Prusa 2005-02-15 13:23:25 UTC
Fixed in main trunk.

Checking in JavaFixAllImports.java;
/cvs/java/editor/src/org/netbeans/modules/editor/java/JavaFixAllImports.java
new revision: 1.4; previous revision: 1.3