Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336936 - NPE in ProjectHelper$LexHandler.comment when reconciling Ant file
Summary: NPE in ProjectHelper$LexHandler.comment when reconciling Ant file
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 336994 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-02-11 08:50 EST by Markus Keller CLA
Modified: 2011-02-11 16:42 EST (History)
2 users (show)

See Also:


Attachments
fix (10.60 KB, patch)
2011-02-11 13:32 EST, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2011-02-11 08:50:34 EST
I20110208-0800

- new workspace, new project, new File "build.xml"
- Ctrl+Space, choose first proposal "Buildfile template"
- Save
- put caret on the comment line containing the creation date / time
- Ctrl+D
=> NPE in log. The same NPE is also thrown whenever I save the file after doing minor edits.

!ENTRY org.eclipse.ant.ui 4 120 2011-02-11 14:47:58.673
!MESSAGE Error logged from Ant UI:
!STACK 0
java.lang.NullPointerException
        at org.eclipse.ant.internal.ui.editor.utils.ProjectHelper$LexHandler.comment(ProjectHelper.java:477)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.comment(AbstractSAXParser.java:667)
        at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.comment(XMLDTDValidator.java:978)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:479)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at org.eclipse.ant.internal.ui.editor.utils.ProjectHelper.parse(ProjectHelper.java:588)
        at org.eclipse.ant.internal.ui.editor.utils.ProjectHelper.parse(ProjectHelper.java:653)
        at org.eclipse.ant.internal.ui.model.AntModel.parseDocument(AntModel.java:344)
        at org.eclipse.ant.internal.ui.model.AntModel.reconcile(AntModel.java:291)
        at org.eclipse.ant.internal.ui.editor.text.XMLReconcilingStrategy.internalReconcile(XMLReconcilingStrategy.java:43)
        at org.eclipse.ant.internal.ui.editor.text.XMLReconcilingStrategy.reconcile(XMLReconcilingStrategy.java:56)
        at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)
        at org.eclipse.ant.internal.ui.editor.text.NotifyingReconciler.process(NotifyingReconciler.java:39)
        at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206)
Comment 1 Markus Keller CLA 2011-02-11 09:04:42 EST
Note that the Error Log view is not reliable in this build, see bug 336938.
Comment 2 Michael Rennie CLA 2011-02-11 12:14:28 EST
Simplified steps:

1. open / create any Ant buildfile with a comment
2. Ctrl+D one of the lines of the comment

The problem is coming from our custom implementation of Project#getReferences(). With the update to Ant 1.8.2 I broke a subtlety where the map of references returned from Project#getReferences() must be the live map for the project, so that removals from the map actually affect the project.
Comment 3 Michael Rennie CLA 2011-02-11 13:32:43 EST
Created attachment 188803 [details]
fix

The patch corrects the getReferences() behavior and adds regression tests for AntModelProject
Comment 4 Michael Rennie CLA 2011-02-11 15:29:34 EST
*** Bug 336994 has been marked as a duplicate of this bug. ***
Comment 5 Michael Rennie CLA 2011-02-11 16:42:46 EST
applied patch to HEAD