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

Bug 543200

Summary: [Tests]Ant Editor gets NPE while getShell
Product: [Eclipse Project] Platform Reporter: Sarika Sinha <sarika.sinha>
Component: AntAssignee: Andrey Loskutov <loskutov>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: loskutov
Version: 4.11   
Target Milestone: 4.11 M1   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/134724
https://git.eclipse.org/c/platform/eclipse.platform.git/commit/?id=90ea9219418dbf1befe7e56df63dec46c72ebf51
Whiteboard:

Description Sarika Sinha CLA 2019-01-06 23:46:27 EST
java.lang.NullPointerException
	at org.eclipse.ui.internal.PartSite.getShell(PartSite.java:477)
	at org.eclipse.ant.internal.ui.editor.AntEditor.lambda$0(AntEditor.java:1147)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4095)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3762)
	at org.eclipse.ant.tests.ui.editor.performance.EditorTestHelper.runEventQueue(EditorTestHelper.java:81)
Comment 1 Sarika Sinha CLA 2019-01-06 23:50:46 EST
2 tests failed on Mac.
https://download.eclipse.org/eclipse/downloads/drops4/I20190106-0150/testResults.php

testVerboseStackTrace	Failure	Incorrect message expected:<BUILD FAILED> but was:<null> 

junit.framework.ComparisonFailure: Incorrect message expected:<BUILD FAILED> but was:<null>
at junit.framework.Assert.assertEquals(Assert.java:100)
at junit.framework.TestCase.assertEquals(TestCase.java:261)
at org.eclipse.ant.tests.ui.BuildTests.testVerboseStackTrace(BuildTests.java:55)

testColor	Error	Offset > length: 15 > 0 

org.eclipse.jface.text.BadLocationException: Offset > length: 15 > 0
at org.eclipse.jface.text.ListLineTracker.getLineInformationOfOffset(ListLineTracker.java:160)
Comment 2 Eclipse Genie CLA 2019-01-07 09:20:11 EST
New Gerrit change created: https://git.eclipse.org/r/134724
Comment 3 Andrey Loskutov CLA 2019-01-07 09:31:47 EST
(In reply to Eclipse Genie from comment #2)
> New Gerrit change created: https://git.eclipse.org/r/134724

This is the patch for comment 0.

Both fails from comment 1 are probably not related, looking on the code I would assume that the ant expects console to be opened & have some output, but this seem to be not the case (see ConsoleLineTracker code). The reason could be failure to start ant or just timing issue with the console output not being yet printed to console.
Comment 5 Sarika Sinha CLA 2019-01-08 06:00:01 EST
Thanks Andrey!!

Do not see the error in new build.
Comment 6 Sarika Sinha CLA 2019-01-17 00:53:47 EST
testVerboseStackTrace failed again.

https://download.eclipse.org/eclipse/downloads/drops4/I20190116-1800/testresults/html/org.eclipse.ant.tests.ui_ep411I-unit-mac64_macosx.cocoa.x86_64_8.0.html

testVerboseStackTrace	Failure	Incorrect message expected:<BUILD FAILED> but was:<null> 

junit.framework.ComparisonFailure: Incorrect message expected:<BUILD FAILED> but was:<null>
at junit.framework.Assert.assertEquals(Assert.java:100)
at junit.framework.TestCase.assertEquals(TestCase.java:261)
at org.eclipse.ant.tests.ui.BuildTests.testVerboseStackTrace(BuildTests.java:55)

testColor	Error	Offset > length: 15 > 0 

org.eclipse.jface.text.BadLocationException: Offset > length: 15 > 0
at org.eclipse.jface.text.ListLineTracker.getLineInformationOfOffset(ListLineTracker.java:160)
Comment 7 Sarika Sinha CLA 2019-01-17 00:55:00 EST
Don't see any NPE in getShell(), This might be a different issue.
Comment 8 Andrey Loskutov CLA 2019-01-17 00:58:51 EST
(In reply to Sarika Sinha from comment #6)
> testVerboseStackTrace failed again.
> 
> https://download.eclipse.org/eclipse/downloads/drops4/I20190116-1800/
> testresults/html/org.eclipse.ant.tests.ui_ep411I-unit-mac64_macosx.cocoa.
> x86_64_8.0.html
> 
> testVerboseStackTrace	Failure	Incorrect message expected:<BUILD FAILED> but
> was:<null> 
> 
> junit.framework.ComparisonFailure: Incorrect message expected:<BUILD FAILED>
> but was:<null>
> at junit.framework.Assert.assertEquals(Assert.java:100)
> at junit.framework.TestCase.assertEquals(TestCase.java:261)
> at
> org.eclipse.ant.tests.ui.BuildTests.testVerboseStackTrace(BuildTests.java:55)
> 
> testColor	Error	Offset > length: 15 > 0 
> 
> org.eclipse.jface.text.BadLocationException: Offset > length: 15 > 0
> at
> org.eclipse.jface.text.ListLineTracker.
> getLineInformationOfOffset(ListLineTracker.java:160)

This is a different issue. This is a problem with the console. I see it time to time in UI, I believe there is a big opened for this.