Bug 26523 - NPE in getHyperLink
Summary: NPE in getHyperLink
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Darin Wright CLA
QA Contact:
URL:
Whiteboard:
Keywords: ui
Depends on:
Blocks:
 
Reported: 2002-11-15 17:09 EST by Darin Wright CLA
Modified: 2003-01-17 14:34 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2002-11-15 17:09:39 EST
It seems AntProcessBuildLogger.getHyperLink() throws a null pointer 
exception when the location is a relative path - which it can be in 
externally parsed entities
For example, say I have a build file which does something like:

<!DOCTYPE project PUBLIC "-//ANT//DTD project//EN" 
"file:../../Build/ant/ant.dtd" [
   <!ENTITY build-driver SYSTEM "file:../../Build/ant/build-driver.xml">
]>

<project name="foo" default="all">
        <!-- Pulls in common build settings -->
        &build-driver;
</project>

If a task in build-driver gets executed, the task passed to the 
BuildLogger will have it Location's path equal to "../../Build/ant/build-
driver.xml:LINE", and since relativity is being 
determined relative to the workbench's CWD (?) instead of the location of 
the build file, we get a null IFile, and thus the exception below. 
Solution, check if a relative path, and make relative to the buildfile's 
location.

java.lang.NullPointerException
        at 
org.eclipse.ui.externaltools.internal.ant.logger.AntProcessBuildLogger.getHyperL
ink(AntProcessBuildLogger.java:136)
        at 
org.eclipse.ui.externaltools.internal.ant.logger.AntProcessBuildLogger.logMessag
e(AntProcessBuildLogger.java:100)
        at 
org.eclipse.ui.externaltools.internal.ant.logger.AntProcessBuildLogger.messageLo
gged(AntProcessBuildLogger.java:179)
        at 
org.apache.tools.ant.Project.fireMessageLoggedEvent(Project.java:1967)
        at 
org.apache.tools.ant.Project.fireMessageLogged(Project.java:2012)
        at org.apache.tools.ant.Project.log(Project.java:394)
        at org.apache.tools.ant.Task.log(Task.java:302)
        at org.apache.tools.ant.taskdefs.Echo.execute(Echo.java:89)
        at org.apache.tools.ant.Task.perform(Task.java:319)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at 
com.i2.logistics.build.ant.taskdefs.CallTarget.execute(CallTarget.java:152)
        at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:166)
        at org.apache.tools.ant.Task.perform(Task.java:319)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at 
org.eclipse.ant.internal.core.ant.InternalAntRunner.run
(InternalAntRunner.java:528)
        at 
org.eclipse.ant.internal.core.ant.InternalAntRunner.run
(InternalAntRunner.java:331)
        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:324)
        at org.eclipse.ant.core.AntRunner.run(AntRunner.java:312)
        at org.eclipse.ant.core.AntRunner.run(AntRunner.java:380)
        at 
org.eclipse.ui.externaltools.internal.ant.launchConfigurations.AntLaunchDelegate
$1.run(AntLaunchDelegate.java:145)
        at java.lang.Thread.run(Thread.java:536)
Comment 1 Darin Swanson CLA 2002-11-25 16:16:23 EST
I have added a null check as a temp fix (you just don't get a hyperlink) as we 
have bug 27128 as well.
Comment 2 Darin Swanson CLA 2003-01-16 11:35:03 EST
Fixed in AntProcessBuildLogger#getFileForLocation().
Please verify (DarinW).
Comment 3 Darin Wright CLA 2003-01-17 14:34:45 EST
Verified