Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369684 - Create JAXB Project, Create JAXB Classes from schema, Close project Receive NPE Error
Summary: Create JAXB Project, Create JAXB Classes from schema, Close project Receive N...
Status: VERIFIED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JAXB (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC1   Edit
Assignee: Paul Fullbright CLA
QA Contact:
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-25 10:49 EST by Jolene Moffitt CLA
Modified: 2012-05-15 12:38 EDT (History)
3 users (show)

See Also:
neil.hauge: pmc_approved? (david_williams)
neil.hauge: pmc_approved? (raghunathan.srinivasan)
neil.hauge: pmc_approved? (naci.dai)
neil.hauge: pmc_approved? (deboer)
neil.hauge: pmc_approved? (neil.hauge)
neil.hauge: pmc_approved? (kaloyan)
cbridgha: pmc_approved+
neil.hauge: review+


Attachments
patch (4.14 KB, patch)
2012-05-03 11:58 EDT, Paul Fullbright CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jolene Moffitt CLA 2012-01-25 10:49:24 EST
Using build I-3.4.0-20120119095402 
Create JAXB Project 2.1 project using Generic platform
Create JAXB Classes from a schema 
R-click on the project and select Close Project
Receive the following NPE error in error log 
java.lang.NullPointerException
	at org.eclipse.jst.common.project.facet.core.libprov.internal.LibraryProviderFrameworkImpl.getCurrentProvider(LibraryProviderFrameworkImpl.java:144)
	at org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderFramework.getCurrentProvider(LibraryProviderFramework.java:81)
	at org.eclipse.jst.common.project.facet.core.libprov.user.UserLibraryProviderInstallOperationConfig.reset(UserLibraryProviderInstallOperationConfig.java:280)
	at org.eclipse.jst.common.project.facet.core.libprov.user.UserLibraryProviderInstallOperationConfig.init(UserLibraryProviderInstallOperationConfig.java:153)
	at org.eclipse.jst.j2ee.internal.common.classpath.WtpUserLibraryProviderInstallOperationConfig.init(WtpUserLibraryProviderInstallOperationConfig.java:69)
	at org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderInstallOperationConfig.init(LibraryProviderInstallOperationConfig.java:46)
	at org.eclipse.jst.common.project.facet.core.libprov.internal.LibraryProvider.createInstallOperationConfig(LibraryProvider.java:396)
	at org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate.refresh(LibraryInstallDelegate.java:409)
	at org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate$2.handleEvent(LibraryInstallDelegate.java:132)
	at org.eclipse.wst.common.project.facet.core.events.internal.ProjectListenerRegistry.notifyListeners(ProjectListenerRegistry.java:76)
	at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.notifyListeners(FacetedProject.java:1326)
	at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.refresh(FacetedProject.java:1825)
	at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.refresh(FacetedProject.java:1678)
	at org.eclipse.wst.common.project.facet.core.internal.FacetedProjectFrameworkImpl$ResourceChangeListener.resourceChanged(FacetedProjectFrameworkImpl.java:2364)
	at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:291)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285)
	at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149)
	at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:395)
	at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1530)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:45)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

If I just create a JAXB project and do not Import a schema and close the project I do not get the error.
Comment 1 Paul Fullbright CLA 2012-04-13 11:48:05 EDT
I get this even after reopening the workspace (i.e. there was no actual install operation in the current session.)  I'm also able to get it without generating anything, just by having a single class.  And it doesn't even have to have any annotations from the library.  As far as I can tell, we aren't invoking any library provider API at all.

Konstantin - any ideas what might be causing this?
Comment 2 Paul Fullbright CLA 2012-05-03 11:57:57 EDT
OK, what's happening is that, during validation, an library install delegate is constructed but not disposed.  (It wasn't clear from docs that was required.)  So I've added a dispose of that library install delegate.  I also found a few other instances where a delegate was being constructed and not disposed (and found the same stack trace when closing the project) and I've addressed those as well.
Comment 3 Paul Fullbright CLA 2012-05-03 11:58:53 EDT
Created attachment 215014 [details]
patch
Comment 4 Neil Hauge CLA 2012-05-07 17:25:16 EDT
Patch looks good.

    Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 

This bug is caused by a leak of a library install delegate.

    Is there a work-around? If so, why do you believe the work-around is insufficient? 

No workaround to avoid the leak.

    How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 

Unit tests have been run.  

    Give a brief technical overview. Who has reviewed this fix? 

This is boilerplate code that already exists in many other locations.  See comment 2 for details.  I have reviewed the fix.

    What is the risk associated with this fix? 

Very low risk.
Comment 5 Chuck Bridgham CLA 2012-05-08 11:07:03 EDT
looks good thanks
Comment 6 Paul Fullbright CLA 2012-05-10 11:47:01 EDT
committed for rc1
Comment 7 Jolene Moffitt CLA 2012-05-15 12:38:02 EDT
Verified in Build I-3.4.0-20120511050219 

Verified a JAXB project can be opened and closed without error and with or without classes.  See the link to view test steps for verification.
http://wiki.eclipse.org/Dali_3.2_RC1