Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 311788

Summary: NPE editing join column for invalid relationship mapping
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: GeneralAssignee: Karen Butzke <karenfbutzke>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: neil.hauge, raghunathan.srinivasan
Version: 2.3Flags: neil.hauge: pmc_approved? (david_williams)
raghunathan.srinivasan: pmc_approved+
neil.hauge: pmc_approved? (naci.dai)
neil.hauge: pmc_approved? (deboer)
neil.hauge: pmc_approved? (neil.hauge)
neil.hauge: pmc_approved? (kaloyan)
neil.hauge: review+
Target Milestone: 2.3 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard: PMC_approved
Attachments:
Description Flags
proposed patch against head none

Description Karen Butzke CLA 2010-05-05 16:04:09 EDT
Given the following entity in a Generic 2.0 JPA project, open the JPA details view and look at he Join Strategy Join columns section.  Clck on the Join column in the list and press the Edit... button. NPE occurs and the edit dialog does not appear

@Entity
public class Person {
    private int id;
	
    @OneToMany
    @JoinColumn
    private String foo;
}
Caused by: java.lang.NullPointerException
at org.eclipse.jpt.ui.internal.details.JoinColumnInJoiningStrategyStateObject.getDbSchema(JoinColumnInJoiningStrategyStateObject.java:60)
at org.eclipse.jpt.ui.internal.details.JoinColumnInJoiningStrategyStateObject.tables(JoinColumnInJoiningStrategyStateObject.java:55)
at org.eclipse.jpt.ui.internal.details.BaseJoinColumnDialogPane$13.listIterator_(BaseJoinColumnDialogPane.java:342)
Comment 1 Karen Butzke CLA 2010-05-05 16:08:14 EDT
Created attachment 167219 [details]
proposed patch against head

The attached patch adds the appropriate null checks to prevent this NPE.
Comment 2 Neil Hauge CLA 2010-05-05 16:39:35 EDT
* 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. 

NPE encountered in UI in error case.  Not a stop-ship defect, but very low risk fix for ugly looking bug.

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

Avoid the invalid relationship mapping.

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

Developer tested.

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

Simple addition of two null checks.  I have reviewed the fix.

* What is the risk associated with this fix? 

Very low risk.
Comment 3 Karen Butzke CLA 2010-05-05 16:51:38 EDT
checked in for 2.3RC1
Comment 4 Karen Butzke CLA 2010-05-10 15:33:02 EDT
verified fixed in build WTP-I-3.2.0-20100507065327