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

Bug 269042

Summary: NPE in copySignatures method
Product: [WebTools] Java Server Faces Reporter: Xiaonan Jiang <xiaonan_jiang>
Component: JSF ToolsAssignee: Carlin Rogers <carlin.rogers>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david_williams, neil.hauge, raghunathan.srinivasan, robert_gallagher
Version: 3.0.3Keywords: plan
Target Milestone: 3.2 RC1Flags: raghunathan.srinivasan: pmc_approved? (david_williams)
raghunathan.srinivasan: pmc_approved? (naci.dai)
raghunathan.srinivasan: pmc_approved? (deboer)
neil.hauge: pmc_approved+
raghunathan.srinivasan: pmc_approved? (kaloyan)
raghunathan.srinivasan: review+
Hardware: PC   
OS: Windows XP   
Whiteboard: PMC_approved Robustness
Attachments:
Description Flags
patch to check for null argument none

Description Xiaonan Jiang CLA 2009-03-17 14:15:20 EDT
Build ID: prior 3.0.3

Steps To Reproduce:
!ENTRY org.eclipse.jst.jsf.core 4 0
!MESSAGE Error validating attribute: valueChangeListener on element h:selectOneMenu
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaTypeDescriptor2Impl.copySignatures(Unknown Source)
	at org.eclipse.jst.jsf.context.symbol.internal.impl.IJavaTypeDescriptor2Impl.getSuperTypeSignatures(Unknown Source)
	at org.eclipse.jst.jsf.context.symbol.internal.impl.ITypeDescriptorImpl.instanceOf(Unknown Source)
	at org.eclipse.jst.jsf.context.symbol.internal.impl.IInstanceSymbolImpl.supportsCoercion(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.el.operators.MemberAccessorOperator.validateNamedPropertyAccessorBase(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.el.operators.DotOperator.validateObjectSymbolValue(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.el.operators.MemberAccessorOperator.validate(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.el.ASTSemanticValidator.visit(Unknown Source)
	at org.eclipse.jst.jsp.core.internal.java.jspel.ASTValueSuffix.jjtAccept(Unknown Source)
	at org.eclipse.jst.jsp.core.internal.java.jspel.SimpleNode.childrenAccept(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.el.ASTSemanticValidator.visit(Unknown Source)
	at org.eclipse.jst.jsp.core.internal.java.jspel.ASTValue.jjtAccept(Unknown Source)
	at org.eclipse.jst.jsp.core.internal.java.jspel.SimpleNode.childrenAccept(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.el.ASTSemanticValidator.visit(Unknown Source)
	at org.eclipse.jst.jsp.core.internal.java.jspel.ASTUnaryExpression.jjtAccept(Unknown Source)
	at org.eclipse.jst.jsp.core.internal.java.jspel.SimpleNode.childrenAccept(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.el.ASTSemanticValidator.visit(Unknown Source)
	at org.eclipse.jst.jsp.core.internal.java.jspel.ASTExpression.jjtAccept(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.el.ASTSemanticValidator.validate(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.el.ELExpressionValidator.validateSemantics(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.el.ELExpressionValidator.validateXMLNode(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.strategy.AttributeValidatingStrategy.validateELExpression(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.strategy.AttributeValidatingStrategy.checkIfELAndValidate(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.strategy.AttributeValidatingStrategy.access$0(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.strategy.AttributeValidatingStrategy$1.run(Unknown Source)
	at org.eclipse.core.runtime.SafeRunner.run(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.strategy.AttributeValidatingStrategy.validateAttributeValue(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.strategy.AttributeValidatingStrategy.validate(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.XMLViewDefnValidator.validateTag(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.XMLViewDefnValidator.validateRegions(Unknown Source)
	at org.eclipse.jst.jsf.validation.internal.XMLViewDefnValidator.validateView(Unknown Source)
	at org.eclipse.jst.jsf.ui.internal.validation.JSFValidator.validateFile(Unknown Source)
	at org.eclipse.jst.jsp.core.internal.validation.JSPValidator.validate(Unknown Source)
	at org.eclipse.wst.validation.Validator$V2.validate(Unknown Source)
	at org.eclipse.wst.validation.internal.ValManager.validate(Unknown Source)
	at org.eclipse.wst.validation.internal.ValManager$1.visit(Unknown Source)
	at org.eclipse.wst.validation.internal.ValManager.accept(Unknown Source)
	at org.eclipse.wst.validation.internal.ValManager.validate(Unknown Source)
	at org.eclipse.wst.validation.internal.ValBuilderJob.visit(Unknown Source)
	at org.eclipse.core.internal.resources.Resource$2.visit(Unknown Source)
	at org.eclipse.core.internal.resources.Resource$1.visitElement(Unknown Source)
	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(Unknown Source)
	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(Unknown Source)
	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(Unknown Source)
	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(Unknown Source)
	at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(Unknown Source)
	at org.eclipse.core.internal.resources.Resource.accept(Unknown Source)
	at org.eclipse.core.internal.resources.Resource.accept(Unknown Source)
	at org.eclipse.core.internal.resources.Resource.accept(Unknown Source)
	at org.eclipse.wst.validation.internal.ValBuilderJob.fullBuild(Unknown Source)
	at org.eclipse.wst.validation.internal.ValBuilderJob.run(Unknown Source)
	at org.eclipse.wst.validation.internal.ValBuilderJob.runInWorkspace(Unknown Source)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(Unknown Source)
	at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)

More information:
Maybe it's the side effect of https://bugs.eclipse.org/bugs/show_bug.cgi?id=269008. 
The variable "list" could be null in IJavaTypeDescriptor2Impl.copySignature() method.
Comment 1 Raghunathan Srinivasan CLA 2009-04-27 19:07:24 EDT
See More info at the end of the description:
More information:
Maybe it's the side effect of
https://bugs.eclipse.org/bugs/show_bug.cgi?id=269008. 
The variable "list" could be null in IJavaTypeDescriptor2Impl.copySignature()
method.
Comment 2 Carlin Rogers CLA 2010-05-10 13:48:06 EDT
Created attachment 167767 [details]
patch to check for null argument

Attaching a patch that will check that the argument for the expected array of IType to copy in copySignatures() is not null.

This does appear to be a downstream NPE due to the failure logged in Bug 269008. The failure in the call to TypeInfoCache.cacheSupertypesFor() gets logged in the underlying TypeInfoCache method, getOrCreateTypeInfo(), null is returned, and then passed into the copySignatures() of IJavaTypeDescriptor2Impl.

This patch will protect against the additional NPE.

This is a trivial fix and should be safe for 3.2RC1. Requesting consideration for PMC approval.
Comment 3 Raghunathan Srinivasan CLA 2010-05-12 16:40:37 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. 
This is a fix for NPE that adopters have seen in the log file. 
* Is there a work-around? If so, why do you believe the work-around is
insufficient? 
No workaround
* How has the fix been tested? Is there a test case attached to the bugzilla
record? Has a JUnit Test been added? 
Code review. There are no reproducible steps.
* Give a brief technical overview. Who has reviewed this fix? 
See comment 2
* What is the risk associated with this fix?
none-low
Comment 4 Carlin Rogers CLA 2010-05-12 18:35:09 EDT
Checked patch into HEAD for 3.2RC1