Community
Participate
Working Groups
Build I20070418-1012, circa v_750. Add the following method to org.eclipse.jdt.core.tests.model.JavaProjectTests and run: it raises the following NPE: java.lang.NullPointerException at org.eclipse.jdt.internal.core.JavaProject.setOptions(JavaProject.java:2705) at org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.setUpProjectCompliance(AbstractJavaModelTests.java:2197) at org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.setUpJavaProject(AbstractJavaModelTests.java:2152) at org.eclipse.jdt.core.tests.model.AbstractJavaModelTests.setUpJavaProject(AbstractJavaModelTests.java:2130) at org.eclipse.jdt.core.tests.model.JavaProjectTests.testInvalidProject(JavaProjectTests.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:164) at junit.framework.TestCase.runBare(TestCase.java:130) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:120) at junit.framework.TestSuite.runTest(TestSuite.java:230) at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.runTest(SuiteOfTestCases.java:99) at junit.framework.TestSuite.run(TestSuite.java:225) at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.superRun(SuiteOfTestCases.java:83) at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$1.protect(SuiteOfTestCases.java:71) at junit.framework.TestResult.runProtected(TestResult.java:124) at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.run(SuiteOfTestCases.java:80) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58) at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethod(EclipseAppContainer.java:533) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:155) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:359) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:174) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:475) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:415) at org.eclipse.equinox.launcher.Main.run(Main.java:1140) at org.eclipse.equinox.launcher.Main.main(Main.java:1115) While there may be a problem with the test harness itself, I believe that JavaProject#getEclipsePreferences should state it can return null, and JavaProject#setOptions should protect against it.
Sorry, forgot the test case code: public void testInvalidProject() throws CoreException, IOException { try { setUpJavaProject("JavaProjectTestsInvalidProject"); } finally { deleteProject("JavaProjectTestsInvalidProject"); } }
Created attachment 76429 [details] Proposed patch
Comment on attachment 76429 [details] Proposed patch Patch attached to bug 152562 also includes the fix for this bug.
Released for 3.4M2 in HEAD stream.
Verified for 3.4 M2 using build I20070917-0010.