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

Bug 321948

Summary: open task from svn history throws npe
Product: z_Archived Reporter: Andreas Höhmann <andreas.hoehmann>
Component: MylynAssignee: Frank Becker <eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse, robert.elves, steffen.pingel
Version: 3.4   
Target Milestone: 3.4.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch V1
none
mylyn/context/zip
none
patch V2
none
mylyn/context/zip
none
patch V3
none
mylyn/context/zip
none
backported patch none

Description Andreas Höhmann CLA 2010-08-06 03:20:54 EDT
I use function "open corresponding task"

Our svn commit template is this:

----
[fix] ${connector.task.prefix} ${task.id} "${task.description}"
 - Link : ${task.url}
----

for example:
----
[fix] bug 1176 "[cr-3][2.9c] Migrate SoftwareVariantIndex to HotfixIndex / Codereview"
 - Link : https://bugzilla.foobar.de/show_bug.cgi?id=1176
 - add test for SoftwareVariantDao.findByComplexData(String, String, SoftwareProduct)
----

stacktrace:
java.lang.NullPointerException
at org.eclipse.mylyn.internal.bugzilla.core.SaxMultiBugReportContentHandler.endElement(SaxMultiBugReportContentHandler.java:490)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLNSDTDValidator.endNamespaceScope(XMLNSDTDValidator.java:263)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2028)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:901)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
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:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at org.eclipse.mylyn.internal.bugzilla.core.AbstractReportFactory.collectResults(AbstractReportFactory.java:123)
at org.eclipse.mylyn.internal.bugzilla.core.MultiBugReportFactory.populateReport(MultiBugReportFactory.java:48)
at org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient.getTaskData(BugzillaClient.java:1867)
at org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler.getMultiTaskData(BugzillaTaskDataHandler.java:329)
at org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler.getTaskData(BugzillaTaskDataHandler.java:259)
at org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector.getTaskData(BugzillaRepositoryConnector.java:524)
at org.eclipse.mylyn.internal.tasks.ui.OpenRepositoryTaskJob.run(OpenRepositoryTaskJob.java:110)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 1 Steffen Pingel CLA 2010-08-06 03:27:50 EDT
Thanks Andreas. From a quick glance I can't tell why this would be happening. We'll need to investigate further. Frank, Rob, could you take a look?
Comment 2 Frank Becker CLA 2010-08-07 11:06:23 EDT
Created attachment 176087 [details]
patch V1

Fix for the wrong URL returned from getUrlFromComment()
Comment 3 Frank Becker CLA 2010-08-07 11:06:25 EDT
Created attachment 176088 [details]
mylyn/context/zip
Comment 4 Frank Becker CLA 2010-08-07 11:08:12 EDT
Patch is now in HEAD.

Should we do a backport for 3.4.2?
Comment 5 Steffen Pingel CLA 2010-08-16 15:50:44 EDT
> Should we do a backport for 3.4.2?

Makes sense. Can you add a test case that triggers the bug?
Comment 6 Frank Becker CLA 2010-08-16 16:19:49 EDT
Created attachment 176725 [details]
patch V2

commited junit test
Comment 7 Frank Becker CLA 2010-08-16 16:19:51 EDT
Created attachment 176726 [details]
mylyn/context/zip
Comment 8 Steffen Pingel CLA 2010-08-17 00:30:22 EDT
Frank, the most recent commit caused a compile error: 

BugzillaStatus_suspiciousAction cannot be resolved or is not a field	BugzillaStatus.java	/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core	line 85	Java Problem

Can you take a look?
Comment 9 Steffen Pingel CLA 2010-08-17 01:29:39 EDT
The fix looks okay to me but I still don't quite understand why the NPE was happening in the Bugzilla connector. I assume the sax parser did not detect that the Bugzilla response was not actually the XML output for a task but was parsing something else? Doesn't this case need to be handled in SaxMultiBugReportContentHandler in addition to the committed fix?
Comment 10 Frank Becker CLA 2010-08-17 15:51:47 EDT
Created attachment 176839 [details]
patch V3

correction BugzillaStatus was commited by mistake (wrong changeset)
Comment 11 Frank Becker CLA 2010-08-17 15:51:49 EDT
Created attachment 176840 [details]
mylyn/context/zip
Comment 12 Frank Becker CLA 2010-08-17 15:56:21 EDT
(In reply to comment #9)
> The fix looks okay to me but I still don't quite understand why the NPE was
> happening in the Bugzilla connector. I assume the sax parser did not detect that
> the Bugzilla response was not actually the XML output for a task but was parsing
> something else? Doesn't this case need to be handled in
> SaxMultiBugReportContentHandler in addition to the committed fix?

No we get the URL from the comment and only test for space so if an comment was in the form 

<url>\n- we get the extra char after the url.
Comment 13 Steffen Pingel CLA 2010-08-17 23:23:37 EDT
Created attachment 176860 [details]
backported patch
Comment 14 Steffen Pingel CLA 2010-08-17 23:26:08 EDT
(In reply to comment #12)
> (In reply to comment #9)
> > The fix looks okay to me but I still don't quite understand why the NPE was
> > happening in the Bugzilla connector. I assume the sax parser did not detect
> that
> > the Bugzilla response was not actually the XML output for a task but was
> parsing
> > something else? Doesn't this case need to be handled in
> > SaxMultiBugReportContentHandler in addition to the committed fix?
> 
> No we get the URL from the comment and only test for space so if an comment was
> in the form
> 
> <url>\n- we get the extra char after the url.

I am still concerned that we are only fixing part of the problem here and SaxMultiBugReportContentHandler should never get into a state where it throws an NPE but I'll leave it up to you and Rob to judge if further action needs to be taken. Please feel free to close if we are done here. I have applied the patches to the e_3_4_m_3_x branch.
Comment 15 Steffen Pingel CLA 2010-09-01 20:31:39 EDT
Let's mark this resolved.