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 168153 - Outputproperty of java ant task is set
Summary: Outputproperty of java ant task is set
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 6.x
Hardware: All Linux
: P3 blocker with 1 vote (vote)
Assignee: Jesse Glick
URL:
Keywords:
: 172107 (view as bug list)
Depends on:
Blocks: 194151
  Show dependency tree
 
Reported: 2009-07-06 00:49 UTC by nclemeur
Modified: 2011-02-10 23:34 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
proposed fix (1.90 KB, text/plain)
2009-08-25 16:03 UTC, t_h
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nclemeur 2009-07-06 00:49:43 UTC
When running a ant task from netbeans (using right click on an ant file and selecting run target), it seems that you
can't use the outputproperty of the java ant task. The output of System.out.print... is displayed in the console and the
outputproperty is empty.

Running the same ant file from the command line work as expected.


==== Example ===
<project>
    <javac srcdir="." destdir="."/>
    <java outputproperty="out" errorproperty="err" classname="Program" classpath="."/>
    <echo>Output: '${out}'</echo>
    <echo>Error : '${err}'</echo>
</project>

public class Program {
    public static void main(String[] args) {
        System.out.println("Hello System.out");
        System.err.println("Hello System.err");
    }
}
Comment 1 Jesse Glick 2009-07-06 18:24:14 UTC
Yes, has to do with special Output Window console handling for <java> programs. Similar to issue #121512.

Should be fixed in core-main #019b073dabbc. If you can verify (FIXED -> VERIFIED) in a development build (you will see a
notation added to this issue when the fix appears in one), this could be a candidate for a 6.7 patch release.
Comment 2 Quality Engineering 2009-07-07 05:32:08 UTC
Integrated into 'main-golden', will be available in build *200907070200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/019b073dabbc
User: Jesse Glick <jglick@netbeans.org>
Log: #168153: disable I/O tricks if <java> task requests special handling of output/error streams.
Comment 3 t_h 2009-08-25 16:03:13 UTC
The fix replaces NbRedirector even if only e.g. errorproperty is used. Maybe the attached fix would be better.
Comment 4 t_h 2009-08-25 16:03:51 UTC
Created attachment 86637 [details]
proposed fix
Comment 5 Jesse Glick 2009-08-25 16:09:19 UTC
That would break scripts using the input or inputstring attrs, I think (regressing issue #121512).
Comment 6 Jesse Glick 2009-08-25 16:11:46 UTC
...and in general I am guessing that if you are setting up redirections you do not need special Output Window
integration. Most usages would be the equivalent to Bourne shell `backticks` with the program doing line-oriented I/O.
Comment 7 t_h 2009-08-26 10:58:39 UTC
For issue #121512 there could be similar 'delegateInputStream' flag which would disable delegation/switch to super call.
I still think it is better to adjust NbRedirector behavior than replace it completely (and potentially lose some
Redirector setting done before replacement).
Comment 8 Jesse Glick 2009-08-26 15:43:19 UTC
I would rather simply discard NbRedirector if there is any special I/O redirection being done, to behave as much as
possible like regular CLI Ant.

I don't know exactly what you mean by "some settings done before replacement"; the first time any of these methods is
called, NbRedirector is thrown out and the standard impl is used. Of course if you have a test case which behaves
incorrectly it should be filed as its own bug for inspection.
Comment 9 Jesse Glick 2009-09-15 03:35:21 UTC
*** Issue 172107 has been marked as a duplicate of this issue. ***