This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 43043 - NullPointerException from TargetExecutor.java:254
Summary: NullPointerException from TargetExecutor.java:254
Status: CLOSED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2004-05-10 20:53 UTC by Jan Lahoda
Modified: 2006-03-24 09:44 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Lahoda 2004-05-10 20:53:24 UTC
[current sources]

Consider following code:
AntTargetExecutor.Env env = new
AntTargetExecutor.Env();
env.setLogger(out);
                        
AntTargetExecutor executor =
AntTargetExecutor.createTargetExecutor(env);
ExecutorTask et = executor.execute(ac, new
String[] {target});

In this case, the ant module does not try to
allocate the InputOutpu, and uses provided logger
instead.

But, in TargetExecutor.java:254 the variable "io"
(which is null in this case) is used to get an
input stream, and so a NullPointerException is
thrown. This makes the above code unusable.
Comment 1 Jan Lahoda 2004-05-10 20:55:47 UTC
Ant is the correct component.
Comment 2 Jesse Glick 2004-05-10 21:12:25 UTC
Right, will fix.

BTW you are probably the only user of ATE.E.setLogger. Can I ask what
you are using it for?
Comment 3 Jesse Glick 2004-05-10 21:13:09 UTC
Presumably broken by recent change to support console input.
Comment 4 Jan Lahoda 2004-05-10 21:22:04 UTC
Well, my use case is probably not the correct one: I am using it to
parse the errors from the output. I am planing to re-write the tasks
to provide the std. notation, but I did not have time to do it yet (it
does not seem trivial for me, but I did not try hard).
Comment 5 Jan Lahoda 2004-05-10 21:43:23 UTC
There is another possible use-case: (AFAIK) it is not possible to
modify the name of the output tab through the API, so if anybody wants
to use a special name of the tab, it is necessary to use this approach.
Comment 6 Jesse Glick 2004-05-11 00:59:14 UTC
Definitely using this API to work around hyperlink parsing is not an
intended use case; cf. #42525.

It is true there is no API to specify a special tab name. That could
easily be added if someone wants it (file it separately of course).
Using a custom output stream is a very poor way to accomplish that
though - you will lose all sorts of functionality.

Actually there are no intended use cases for ATE.E.sL! It was added
during the old Projects work to support the now-dead Compiler API #2.
Comment 7 Jan Lahoda 2004-05-11 12:59:04 UTC
I have created a new issue for the second use-case: issue #43072.

I would suggest to make the setLogger method deprecated, so everyone
will that it should not be used.
Comment 8 Jesse Glick 2004-05-11 23:30:20 UTC
committed     Up-To-Date  1.40       
ant/src/org/apache/tools/ant/module/run/TargetExecutor.java

Also deprecating ATE.E.sL:

committed     Up-To-Date  1.4        
ant/src/org/apache/tools/ant/module/api/AntTargetExecutor.java
Comment 9 Jan Lahoda 2004-05-18 21:37:32 UTC
Seems OK in current sources.