Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 124316 - NullPointerException at org.netbeans.modules.visualweb.insync.java.JavaClass$1.run(JavaClass.java:131) when doing refactor->rename on a .java file.
NullPointerException at org.netbeans.modules.visualweb.insync.java.JavaClass$...
Status: RESOLVED INCOMPLETE
Product: obsolete
Classification: Unclassified
Component: visualweb
6.x
PC Linux
: P3 with 1 vote (vote)
: 6.x
Assigned To: _ sandipchitale
issues@obsolete
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-12-20 11:10 UTC by tomsve
Modified: 2008-08-12 21:50 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tomsve 2007-12-20 11:10:51 UTC
When I right click on a .java file and then select the "Refactor->Rename" menu entry I get the below exception. No
dialog ever pops up.

I was not entirely sure what component to report this on. It could be a refactoring problem. I might be totally
missinterpreting the stack trace, but to me it seems like the refactoring thinks that it is about to refactor a Java
Faces model class, which is not the case. The class I'm trying to refactor is a standard POJO. It is however in the
visualweb part that the exception occurs, so I decided to report it on this component. 

I can also add that:
- This problem only occurs for certain java files (POJOs) in a maven project with packaging of type "war". Yes, I'm
using the maven2 plugins, and yes, this could be related to those plugins also, but I cannot determine that.
- All java classes (tested) in maven projects of type "jar" the refactoring works (the dialog asking for new name pops
up nicely).
- There is nothing unique to distinguish the classes that fail from the ones that work. It seems random even though it
is not random since for the classes that fails it always fails.
- This have worked fine in beta1, beta2, rc1, rc2, and release version of 6.0 up until today (2007-12-20)! No new plugin
have been installed. No plugin have been removed. The java installation used have not changed. Just for testing I
started the rc2 version with its own installation and ~/.netbeans/netbeans-6.0beta2 user directory. Same problem! 

I as a last test uninstalled all netbeans installations on my machine and then did a rm -rf ~/.netbeans, and then
reinstalled netbeans 6.0, and finally installed only the absolutely neccesarry plugins: maven + spring. The problem remains.

What really annoys me is that it worked fine yesterday, and the day before that and so on. The java version is 1.5.0_14
and that has not changed since yesterday. The only things that have changed is some system updates: openssl, openssh,
firefox, python. I cannot se how it can affect either java or netbeans.

Unfortunately the only workaround I can see to this, for the moment, is installing the eclipse monster. I only have a
2.4Ghz duo core processor with 3GB of memory so that will be difficult. 

java.lang.NullPointerException
	at org.netbeans.modules.visualweb.insync.java.JavaClass$1.run(JavaClass.java:131)
	at org.netbeans.modules.visualweb.insync.java.ReadTaskWrapper.run(ReadTaskWrapper.java:73)
	at org.netbeans.modules.visualweb.insync.java.ReadTaskWrapper.run(ReadTaskWrapper.java:56)
	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:616)
	at org.netbeans.modules.visualweb.insync.java.ReadTaskWrapper.execute(ReadTaskWrapper.java:80)
	at org.netbeans.modules.visualweb.insync.java.ReadTaskWrapper.execute(ReadTaskWrapper.java:88)
	at org.netbeans.modules.visualweb.insync.java.JavaClass.isSubTypeOf(JavaClass.java:128)
	at org.netbeans.modules.visualweb.insync.models.FacesModel.openJavaUnits(FacesModel.java:819)
	at org.netbeans.modules.visualweb.insync.models.FacesModel.syncImpl(FacesModel.java:1051)
	at org.netbeans.modules.visualweb.insync.Model.sync(Model.java:219)
	at
org.netbeans.modules.visualweb.insync.faces.refactoring.FacesRefactoringUtils.isJavaFileObjectOfInterest(FacesRefactoringUtils.java:231)
	at
org.netbeans.modules.visualweb.insync.faces.refactoring.FacesRefactoringsPluginFactory.createInstance(FacesRefactoringsPluginFactory.java:141)
	at org.netbeans.modules.refactoring.api.AbstractRefactoring.getPlugins(AbstractRefactoring.java:131)
	at org.netbeans.modules.refactoring.api.AbstractRefactoring.addProgressListener(AbstractRefactoring.java:257)
	at org.netbeans.modules.refactoring.spi.impl.ParametersPanel.showDialog(ParametersPanel.java:448)
	at org.netbeans.modules.refactoring.spi.impl.RefactoringPanel.refresh(RefactoringPanel.java:605)
	at org.netbeans.modules.refactoring.spi.impl.RefactoringPanel.<init>(RefactoringPanel.java:139)
	at org.netbeans.modules.refactoring.spi.impl.RefactoringPanel.<init>(RefactoringPanel.java:131)
	at org.netbeans.modules.refactoring.spi.ui.UI.openRefactoringUI(UI.java:72)
	at
org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider$NodeToFileObjectTask.run(RefactoringActionsProvider.java:684)
	at org.netbeans.modules.refactoring.java.RetoucheUtils.invokeAfterScanFinished(RetoucheUtils.java:900)
	at org.netbeans.modules.refactoring.java.ui.RefactoringActionsProvider.doRename(RefactoringActionsProvider.java:156)
	at org.netbeans.modules.refactoring.api.impl.ActionsImplementationFactory.doRename(ActionsImplementationFactory.java:69)
	at org.netbeans.modules.refactoring.spi.impl.RenameAction.performAction(RenameAction.java:62)
	at org.netbeans.modules.refactoring.spi.impl.RefactoringGlobalAction.performAction(RefactoringGlobalAction.java:131)
	at org.openide.util.actions.NodeAction.performAction(NodeAction.java:289)
	at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:118)
	at org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(ActionsBridge.java:77)
	at org.openide.util.actions.CallableSystemAction.actionPerformed(CallableSystemAction.java:114)
	at org.openide.util.actions.NodeAction.actionPerformed(NodeAction.java:277)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1092)
	at java.awt.Component.processMouseEvent(Component.java:5517)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
	at java.awt.Component.processEvent(Component.java:5282)
	at java.awt.Container.processEvent(Container.java:1966)
	at java.awt.Component.dispatchEventImpl(Component.java:3984)
	at java.awt.Container.dispatchEventImpl(Container.java:2024)
	at java.awt.Component.dispatchEvent(Component.java:3819)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
	at java.awt.Container.dispatchEventImpl(Container.java:2010)
	at java.awt.Window.dispatchEventImpl(Window.java:1791)
	at java.awt.Component.dispatchEvent(Component.java:3819)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Comment 1 _ sandipchitale 2008-01-16 18:38:10 UTC
Can you please attach a sample Maven2 project with packaging of type "war" and a .java file that reproduces the exception?
Or atleast instructions on how to set up such a project.
Comment 2 oakie3cr 2008-01-22 21:42:47 UTC
It is easy to reproduce.  All I did to duplicate the problem was:

1 - create a new maven project
2 - use the maven webapp archetype
3 - use the default com.mycompany
4 - right click on the empty package (com.mycompany) and create a new package with the default name.
5 - right click on the new class (NewClass.java), then click refactor -> rename.

Boom, null pointer exception.
Comment 3 Karthikeyan Rajeswaran 2008-08-12 21:50:02 UTC
See also: issue 31227


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo