This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 397814 - NPE in FilterRule - TargetRuntime when project has no runtime
Summary: NPE in FilterRule - TargetRuntime when project has no runtime
Status: RESOLVED FIXED
Alias: None
Product: WTP Common Tools
Classification: WebTools
Component: wst.common (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Rosendo Martinez CLA
QA Contact: Carl Anderson CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-09 18:31 EST by Shane Clarke CLA
Modified: 2013-02-20 11:49 EST (History)
2 users (show)

See Also:


Attachments
Moview: Reproducing the bug (522.63 KB, video/x-ms-wmv)
2013-01-10 09:29 EST, Danail Branekov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shane Clarke CLA 2013-01-09 18:31:44 EST
31 tests from the org.eclipse.jst.ws.jaxws.dom.runtime.tests.dom.validation package have failed in two consecutive WTP 3.5.0 builds.

http://build.eclipse.org/webtools/committers/wtp4x-R3.5.0-I/20130108063043/I-3.5.0-20130108063043/

http://build.eclipse.org/webtools/committers/wtp4x-R3.5.0-I/20130108224252/I-3.5.0-20130108224252/

All tests fail with similar errors to the following with only the project name changing:
org.eclipse.core.internal.resources.ResourceException: Errors occurred during the build.
at org.eclipse.core.internal.resources.Project$1.run(Project.java:620)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:114)
at org.eclipse.jst.ws.jaxws.testutils.project.TestProject$9.run(TestProject.java:451)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327)
at org.eclipse.jst.ws.jaxws.testutils.project.TestProjectsUtils.executeWorkspaceRunnable(TestProjectsUtils.java:320)
at org.eclipse.jst.ws.jaxws.testutils.project.TestProjectsUtils.access$0(TestProjectsUtils.java:315)
at org.eclipse.jst.ws.jaxws.testutils.project.TestProjectsUtils$3.run(TestProjectsUtils.java:336)
at org.eclipse.jst.ws.jaxws.testutils.threading.TestContextThread.run(TestContextThread.java:72)
Contains: Errors running builder 'Validation' on project 'ValidationTest1357638849871'.
java.lang.NullPointerException
at org.eclipse.wst.validation.internal.model.FilterRule$TargetRuntime.matchesProject(FilterRule.java:574)
at org.eclipse.wst.validation.internal.model.FilterGroup.shouldValidate(FilterGroup.java:187)
at org.eclipse.wst.validation.Validator$V2.shouldValidateProject(Validator.java:1323)
at org.eclipse.wst.validation.Validator.shouldValidateProject(Validator.java:358)
at org.eclipse.wst.validation.Validator.shouldValidateProject(Validator.java:338)
at org.eclipse.wst.validation.internal.ValManager$ValidatorProjectManager$ValProjectMap.load(ValManager.java:1207)
at org.eclipse.wst.validation.internal.ValManager$ValidatorProjectManager$ValProjectMap.<init>(ValManager.java:1165)
at org.eclipse.wst.validation.internal.ValManager$ValidatorProjectManager.<init>(ValManager.java:1074)
at org.eclipse.wst.validation.internal.ValManager$ValidatorProjectManager.get(ValManager.java:1092)
at org.eclipse.wst.validation.internal.ValManager.accept(ValManager.java:747)
at org.eclipse.wst.validation.internal.ValManager.clean(ValManager.java:989)
at org.eclipse.wst.validation.internal.operations.ValidationBuilder.newClean(ValidationBuilder.java:300)
at org.eclipse.wst.validation.internal.operations.ValidationBuilder.clean(ValidationBuilder.java:117)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:394)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:114)
at org.eclipse.jst.ws.jaxws.testutils.project.TestProject$9.run(TestProject.java:451)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327)
at org.eclipse.jst.ws.jaxws.testutils.project.TestProjectsUtils.executeWorkspaceRunnable(TestProjectsUtils.java:320)
at org.eclipse.jst.ws.jaxws.testutils.project.TestProjectsUtils.access$0(TestProjectsUtils.java:315)
at org.eclipse.jst.ws.jaxws.testutils.project.TestProjectsUtils$3.run(TestProjectsUtils.java:336)
at org.eclipse.jst.ws.jaxws.testutils.threading.TestContextThread.run(TestContextThread.java:72)

From the above error an NPE is thrown at FilterRule line 574. That matchesProject method was added to FilterRule and committed 2 days ago as part of Bug 380173.

I've ran all the tests locally on OSX and I've been unable to reproduce any of the test failures and a breakpoint set at FilterRule line 574 is never hit.
Comment 1 Shane Clarke CLA 2013-01-09 18:40:33 EST
Danail could you have a look at these tests and see if you can reproduce or spot any issues with them due to that change in FilterRule.
Comment 2 Danail Branekov CLA 2013-01-10 09:28:47 EST
Hi Shane,

I managed to reproduce the bug manually. Steps:
1. Create a new Server -> Runtime Environment (e.g. Apache Tomcat 6)
2. Create a new dynamic web project and make sure that you do not specify target runtime
3. Open Preferences -> Validation
  3.1 Choose a configurable validator (e.g. XML Schema Validator), press the "..." button 
  3.2 Add an exclude group
  3.3 Add a rule for the exclude group via pressing Add Rule...
  3.4 Let the rule be applicable for the runtime created on step 1
4. Confirm all the preferences dialog
5. Upon project rebuild the exception occurs

As a solution I could propose that  org.eclipse.wst.validation.internal.model.FilterRule.TargetRuntime.matchesProject(IProject) should return false in case the project has no runtime

I am assigning the bug to WTP common tools

Regards, Danail
Comment 3 Danail Branekov CLA 2013-01-10 09:29:58 EST
Created attachment 225438 [details]
Moview: Reproducing the bug

This short movie demonstrates how to reproduce the NullPointerException
Comment 4 Shane Clarke CLA 2013-01-10 09:55:27 EST
Thanks Danail.

Updating bug title.
Comment 5 Rosendo Martinez CLA 2013-01-17 11:51:59 EST
Fix was committed to master for WTP 3.5.0.
Comment 6 Rosendo Martinez CLA 2013-02-20 11:49:57 EST
Resolving...