Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351975 - NPE entering special characters to customizer class combo
Summary: NPE entering special characters to customizer class combo
Status: VERIFIED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.1 M1   Edit
Assignee: Nan Li CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-13 10:05 EDT by Nan Li CLA
Modified: 2011-11-01 18:25 EDT (History)
2 users (show)

See Also:
neil.hauge: review+


Attachments
stack trace (3.41 KB, text/plain)
2011-07-13 10:07 EDT, Nan Li CLA
no flags Details
Proposed Patch (2.77 KB, patch)
2011-07-15 12:35 EDT, Nan Li CLA
neil.hauge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nan Li CLA 2011-07-13 10:05:15 EDT
Build Identifier: I20110526-1708

* This problem only exists with Java EclipseLink customizer

1. Create a Java type mapping and go to Advanced section of JPA Details view
2. Enter special character(s) like comma(,), period(.), semicolon(;), etc. to the combo of Customizer class.

An error message is given saying an internal error occurred during update JPA project caused by 

java.lang.NullPointerException
	at org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools.resolveTypeBinding(ASTTools.java:124)
	at org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools.resolveFullyQualifiedName(ASTTools.java:101)

A full stack trace is uploaded.

Reproducible: Always
Comment 1 Nan Li CLA 2011-07-13 10:07:06 EDT
Created attachment 199585 [details]
stack trace
Comment 2 Nan Li CLA 2011-07-15 12:35:17 EDT
Created attachment 199759 [details]
Proposed Patch

The change for JavaEclipseLinkCustomizer is not related to this bug. It is for fixing NPE when the customizer class cannot be solved.
Comment 3 Neil Hauge CLA 2011-07-27 17:31:50 EDT
(In reply to comment #2)
> Created attachment 199759 [details]
> Proposed Patch
> 
> The change for JavaEclipseLinkCustomizer is not related to this bug. It is for
> fixing NPE when the customizer class cannot be solved.

The fix for the NPE in JavaEclipseLinkCustomizer appears to be in the wrong place.  Instead of avoiding this here, we should be avoiding the NPE in JDTTools.classHasPublicZeroArgConstructor().  If the resolved type is null (because the user has mistyped the class name) it should return false.  Actually, we shouldn't even be getting to this check, since we should first be validating to see whether the class exists.  Since the compiler is going to do this for us, I suppose the changes in JavaEclipseLinkCustomizer are still valid (to avoid going through unnecessary logic).  We should just add a null check to JDTTools.classHasPublicZeroArgConstructor() in addition to the current patch.  I will commit the patch and make the additional null check.
Comment 4 Neil Hauge CLA 2011-07-27 17:46:07 EDT
Patch committed with some minor additions to head.
Comment 5 Jolene Moffitt CLA 2011-08-31 10:36:33 EDT
Verified in Build I-3.4.0-20110826171354 

Verified that the NPE does not appear if you enter period(.), comma(,) or other special characters into the Customizer class field for the entity in the JPA Details pane.  See the link to view test steps for verification. 
http://wiki.eclipse.org/Dali_3.1_M1