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

Bug 349220

Summary: NPE when trying to Run external Ant script (run as Ant or Ant...)
Product: [Eclipse Project] Platform Reporter: trish <trish.zdarko>
Component: AntAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public
Version: 4.0   
Target Milestone: 3.8 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
code snippet and full stack trace supporting bug 349220
none
fix none

Description trish CLA 2011-06-13 14:43:11 EDT
Build Identifier: 20110218-0911

NPE in AntUtil class, but problem is really inAntLaunchShortcut, getAdapter doesn't return a file for external files, and a null file condition isnt handled in the code.
short stacktrace here, full will be attached

java.lang.NullPointerException
at org.eclipse.ant.internal.ui.AntUtil.isKnownAntFile(AntUtil.java:593)
at org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchShortcut.launch(AntLaunchShortcut.java:465)
at org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension.launch(LaunchShortcutExtension.java:424)


Reproducible: Always

Steps to Reproduce:
1.file>open file, select an external ant script
2.Run>external tools>run as
3.chose either Ant or Ant...
nothing appears to be happening, check the error log and you can see the NPE
Comment 1 trish CLA 2011-06-13 14:47:43 EDT
Created attachment 197916 [details]
code snippet and full stack trace supporting bug 349220

code snippet and stack trace
Comment 2 Michael Rennie CLA 2011-07-07 15:12:51 EDT
Created attachment 199287 [details]
fix

when we are launching we also need to handle the case the there is no IFile handle and that there could be a file path (leading to a java.io.File handle). In this case we need to have a similar method to ask "is this a known buildfile name?".

The patch adds support for external files.
Comment 3 Michael Rennie CLA 2011-07-07 15:17:42 EDT
applied patch to HEAD