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 105478 - NPE in Reverse Engineer action
Summary: NPE in Reverse Engineer action
Status: VERIFIED WORKSFORME
Alias: None
Product: uml
Classification: Unclassified
Component: Reverse Engineering (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Yang Su
URL:
Keywords:
Depends on:
Blocks: 89008
  Show dependency tree
 
Reported: 2007-06-02 16:40 UTC by Milos Kleint
Modified: 2007-06-28 18:16 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Milos Kleint 2007-06-02 16:40:27 UTC
current trunk.

Right click on a Maven based project shows a "Reverse Engineer" action. When
invoked, a dialog is shown, after sumbitting, a NPE appears. (See below)

The UML support includes wrong assumptions about projects. Specifically it
assumes all projects are Ant based. Which isn't true.

Ideally URL support would be project agnostic, not relying on any underlying
project type codebase.
Alternatively UML support would declare some sorts of API contract that could be
implemented by maven projects as well.
At the bare minimum level, the action should not be enabled for maven projects
until supported.

java.lang.NullPointerException
	at
org.netbeans.modules.uml.project.UMLProjectHelper.initializeProject(UMLProjectHelper.java:249)
	at
org.netbeans.modules.uml.project.UMLProjectGenerator.createEmptyProject(UMLProjectGenerator.java:271)
	at
org.netbeans.modules.uml.project.UMLProjectGenerator.createRevEngProject(UMLProjectGenerator.java:197)
	at
org.netbeans.modules.uml.integration.netbeans.actions.ReverseEngineerAction.createNewUMLProject(ReverseEngineerAction.java:299)
	at
org.netbeans.modules.uml.integration.netbeans.actions.ReverseEngineerAction.access$000(ReverseEngineerAction.java:78)
[catch] at
org.netbeans.modules.uml.integration.netbeans.actions.ReverseEngineerAction$1.run(ReverseEngineerAction.java:266)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)


java.lang.NullPointerException
	at
org.netbeans.modules.uml.project.UMLProjectHelper.initializeProject(UMLProjectHelper.java:249)
	at
org.netbeans.modules.uml.project.UMLProjectHelper.getProject(UMLProjectHelper.java:181)
	at org.netbeans.modules.uml.project.UMLProject.setProjectMode(UMLProject.java:452)
	at
org.netbeans.modules.uml.project.UMLProjectMetadataListener.propertyChange(UMLProjectMetadataListener.java:55)
	at
org.netbeans.spi.project.support.ant.PropertyUtils$SequentialPropertyEvaluator.stateChanged(PropertyUtils.java:857)
	at org.openide.util.WeakListenerImpl$Change.stateChanged(WeakListenerImpl.java:297)
	at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:101)
	at org.openide.util.ChangeSupport.fireChange(ChangeSupport.java:87)
	at
org.netbeans.spi.project.support.ant.ProjectProperties$PP$2.run(ProjectProperties.java:310)
	at
org.netbeans.spi.project.support.ant.ProjectProperties$PP$2.run(ProjectProperties.java:309)
	at org.openide.util.Mutex.readAccess(Mutex.java:230)
	at
org.netbeans.spi.project.support.ant.ProjectProperties$PP.fireChange(ProjectProperties.java:316)
	at
org.netbeans.spi.project.support.ant.ProjectProperties$PP.put(ProjectProperties.java:188)
	at
org.netbeans.spi.project.support.ant.ProjectProperties.putProperties(ProjectProperties.java:101)
	at
org.netbeans.spi.project.support.ant.AntProjectHelper$8.run(AntProjectHelper.java:650)
	at
org.netbeans.spi.project.support.ant.AntProjectHelper$8.run(AntProjectHelper.java:649)
	at org.openide.util.Mutex.writeAccess(Mutex.java:321)
	at
org.netbeans.spi.project.support.ant.AntProjectHelper.putProperties(AntProjectHelper.java:648)
	at
org.netbeans.modules.uml.project.UMLProjectGenerator.createProject(UMLProjectGenerator.java:350)
	at
org.netbeans.modules.uml.project.UMLProjectGenerator.createEmptyProject(UMLProjectGenerator.java:258)
	at
org.netbeans.modules.uml.project.UMLProjectGenerator.createRevEngProject(UMLProjectGenerator.java:197)
	at
org.netbeans.modules.uml.integration.netbeans.actions.ReverseEngineerAction.createNewUMLProject(ReverseEngineerAction.java:299)
	at
org.netbeans.modules.uml.integration.netbeans.actions.ReverseEngineerAction.access$000(ReverseEngineerAction.java:78)
[catch] at
org.netbeans.modules.uml.integration.netbeans.actions.ReverseEngineerAction$1.run(ReverseEngineerAction.java:266)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Comment 1 Yang Su 2007-06-27 19:39:23 UTC
I'm not sure what made you believe that UML assumes all projects are ant based, I didn't find evidence to support that
statement.

It is project agnostic, the API contract that UML uses to enable "Reverse Engineer" and obtain a list of source files to
feed that action is that the project must declare source groups with JavaProjectConstants.SOURCES_TYPE_JAVA type. As an
example, this menu item is not shown on Ruby project. If action is invoked on qualified project node, we will list all
declared java source group folders ( source and test packages ) for selection, if action is invoked on package/folder
node or file node ( they have to be under declared source root folder to enable action ), all Java source files under
selected node will be processed.

I downloaded Mavin IDE dated on 6/20 and tried on full IDE (build 070621) with latest UML (070627), created new Maven
Quickstart, Webapp and Mojo projects with default settings, and reverse engineered all those Mavin projects containing
Java classes in both source and test packages without any exceptions. I don't have environment to try on Maven project
with existing POM.

Please test again on the latest trunk, if you still see the issue, attach your test case to help us diagnose.

Comment 2 Milos Kleint 2007-06-28 07:39:41 UTC
verified. It seems to be working now. No exception. My evaluation was probably wrong as I based it on the stacktrace
which shows Ant project classes. However these are obviously used within the UML project type itself.


Having said that, for some reason I don't get the Reverse Engineer action on the popup menu of Maven projects, just on
single packages. How is the action added to regular project types' popup menu?
Comment 3 Yang Su 2007-06-28 18:16:22 UTC
The action enabling logic used to look up DataObject.class and see if all corresponding file
objects are under project's Java source folders, the purpose is to filter out non-source folders 
like /build or /nbbuild etc. Unlike other projects (J2SE, J2EE, Web, NB Module project), Mavin 
project node is also a data node, so context.lookupAll(DataObject.class) returns something that falls 
outside project's java source root folder, hence the action was not shown on Maven project node.

Changes were made yesterday (6/27/07) to accommodate this situation. If project node is selected 
context.lookupAll(Project.class), and the project satisfies requirement, checking on DataObject is bypassed.

Please verify it with trunk build after 6/27/07. Thanks.