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

Bug 257342

Summary: Ant editor throws a NPE while trying to open a build file
Product: [Eclipse Project] Platform Reporter: Antoine Toulmé <antoine>
Component: AntAssignee: Platform-Ant-Inbox <platform-ant-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: darin.eclipse, devel, Michael_Rennie
Version: 3.4.1   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Antoine Toulmé CLA 2008-12-03 05:48:42 EST
 
Comment 1 Antoine Toulmé CLA 2008-12-03 08:10:54 EST
java.lang.NullPointerException
	at java.util.Hashtable.put(Hashtable.java:396)
	at java.util.Properties.setProperty(Properties.java:128)
	at java.lang.System.setProperty(System.java:701)
	at org.eclipse.ant.internal.ui.model.AntModel.processAntHome(AntModel.java:478)
	at org.eclipse.ant.internal.ui.model.AntModel.initializeProject(AntModel.java:369)
	at org.eclipse.ant.internal.ui.model.AntModel.prepareForFullParse(AntModel.java:344)
	at org.eclipse.ant.internal.ui.model.AntModel.parseDocument(AntModel.java:307)
	at org.eclipse.ant.internal.ui.model.AntModel.reconcile(AntModel.java:265)
	at org.eclipse.ant.internal.ui.model.AntModel.getProjectNode(AntModel.java:1386)
	at org.eclipse.ant.internal.ui.model.AntModel.getProjectNode(AntModel.java:1396)
	at org.eclipse.ant.internal.ui.editor.text.AntFoldingStructureProvider.updateFoldingRegions(AntFoldingStructureProvider.java:88)
	at org.eclipse.ant.internal.ui.editor.AntEditor.projectionEnabled(AntEditor.java:1243)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.fireProjectionEnabled(ProjectionViewer.java:480)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.enableProjection(ProjectionViewer.java:528)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1413)
	at org.eclipse.ant.internal.ui.editor.AntEditor$StatusLineSourceViewer.doOperation(AntEditor.java:215)
	at org.eclipse.ant.internal.ui.editor.AntEditor.createPartControl(AntEditor.java:971)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:661)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:428)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:594)
	at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:266)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2820)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2729)
	at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2721)
	at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2673)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2668)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2652)
	at org.eclipse.ui.actions.OpenWithMenu.openEditor(OpenWithMenu.java:337)
	at org.eclipse.ui.actions.OpenWithMenu.access$0(OpenWithMenu.java:325)
	at org.eclipse.ui.actions.OpenWithMenu$2.handleEvent(OpenWithMenu.java:187)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1561)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1585)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1570)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1360)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3482)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3068)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	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:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)

To reproduce the error:
check out org.eclipse.swt and org.eclipse.swt.cocoa.macosx.x86_64, and then try to open build.xml in org.eclipse.swt.cocoa.macosx.x86_64.

My current environment is Eclipse Classic SDK 3.4.1 on a Mac Leopard.
Comment 2 Daniel Hirscher CLA 2009-04-03 03:24:29 EDT
I got the same problem on Windows.
I don't know how this happened. Maybe it was due to the installation of some plug-ins or due to the upgrade of an existing workspace.

However in the Preferences > Ant > Runtime, Ant Home pointed to the workspace instead of the plug-in.

Solution: Set Ant Home to the plug-in or Restore to defaults.

See also: http://dev.eclipse.org/newslists/news.eclipse.webtools/msg15549.html

Comment 3 Michael Rennie CLA 2009-05-19 10:26:24 EDT
Same root cause for bug 275839. If Ant home cannot be derived the Ant editor loading code tries to set a null entry as a system property. If you use the teneo.hibernate bundle mentioned in bug 275839 this is easily reproducible.

*** This bug has been marked as a duplicate of bug 275839 ***