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.
If user executes build script with compilation errors (in sources), new tab in OW is created and stdout and stderr are printed there. When another build script with compilation errors (in sources) is executed, stdout is printed to correct tab for given script but compilation errors (stderr) are printed to the tab where compilation errors were printed for the first script execution with comp. errors. It aplies for any other execution of scripts with compilation errors.
Doesn't happen to me. What build are you using - is this a regression - or only in Orion and not dev builds? What compiler? Please attach a sample script and data for it. Windows only, or Unix too?
I can easily reproduce it on current dev build on linux too. I unziped last dev build (I didn't change anything in the IDE), mounted nb_all folder, where only modules nbbuild (bootstrap), core and openide are built, nothing else. Then I started execution of ant module - it failed, then I started execution of applet module - it failed too, but compilation errors were printed to tab where ant compilation errors were printed. Any other module compilation (only modules with compilation errors) ended the same way. There is no special script nor data needed to reproduce it.
Created attachment 4959 [details] redirected output tab for script building ant module
Sorry, I cannot reproduce any problem, at least not on Linux. I made a build with -Dmodules=ant from sources circa Mar 8. Started on a fresh userdir. Mounted /space/src/nb_all/ as a directory. Made sure (from a command prompt) that core/javahelp and debuggercore and debuggerjpda and applet and ant were all cleaned (no compiled classfiles). Did not change any settings. Selected ant/build.xml, F6 to run. Failed with some compilation errors (missing core/javahelp classes). Build messages and compiler errors both appeared in Running workspace, output window tab "ant". Went back to Editing, selected applet/build.xml, F6. New tab "applet" opened, build messages and compiler errors (missing debugger classes) appeared in that tab correctly. Please check if this is a Windows-specific problem, perhaps, or something else specific to your environment, and reopen if necessary.
Jesse I must reopen it again, because I just reproduced it on my linux box and on Win2000 as well. I used todays NetBeans dev build. I did same steps as you and really error messages were printed to tab where error messages were printed for the first time. The tab belonging to the script showed just text: ... Compile failed, messages should have been provided. ... Do you have any idea what settings in my env could cause this problem? I use JDK 1.4.
I will look at it... does this occur on JDK 1.3.1 for you too? I have not tried with 1.4.
Actually David could you take a look since I don't have much extra time for Ant? If you need hints: DemuxOutputStream (part of Ant 1.4.x) is used from TargetExecutor to ensure that all stray System.out/err prints get sent to Project.log. (Tasks are supposed to use Project.log directly, but occasionally they mess up and print to console, in which case the demuxer is a backup to ensure Ant still handles the output.) Maybe the switching of the system streams to and from the Ant demuxer does not work in some situations. Also check what *kind* of compiler produces the misdirected errors. Internal javac may use System.out/err, I am not sure whether the <javac> task succeeds in intercepting this directly. External compilers ought to trap the Process.get{Input,Error}Stream and redirect anything they get to Project.log, in which case the demuxer is irrelevant. Or perhaps a window system bug is involved. But since some parts of the output go to one tab and others to another tab, I suspect the demuxer as the most likely problem area.
ok. thanx for hints!
I verified that when running on JDK 1.3.1 everything works OK, so marking as JDK 1.4 specific issue.
Jesse, I tried to fix this bug, but without success. Maybe you will have some pointers which could help me. I patched Ant sources and debug Ant together with Ant module but I still don't have any idea where the problem might be. What I did and what I know: In TargetExecutor I changed the NetBeansLogger to write logs directly to some file on disk and not to OutputWriterOutputStream. For each execution the file on disk is different. If I execute the first script, the log1.txt is created and everything is OK. When I execute the second script, the log2.txt is created, BUT errors from javac task are put into log1.txt and everything else is correctly put into log2.txt. How is that possible? The execution of javac task behaves like it was executed from first script - the build listener of first project is notified. If I changed the compiler to jikes, everything is OK. If I change it back to javac, it fails. I put some logs into Ant's Javac13.java file and just before the javac is executed, the strerr is correctly set and also the project is correctly set. So where the problem might be??????????? :-) Thanx for any help or recommendations.
I found it! It is JDK1.4 problem. It took me some time to realize one mistake I did. From the description I wrote yesterday it is clear that bug must be somewhere in javac compiler - it must cache stderr on first execution and on second and following executions it uses this cached stderr. So I wrote simple program which just executes javac twice on some uncompilable java file and each time the stderr is redirected to different file. Damn! This worked OK. But it took me a day or two to realize that I executed the testing application on JDK1.3. Grrr!! So today I executed it on JDK1.4 and voila! the same error as in Ant appeared. The JDK I'm using is: 1.4.0; Java HotSpot(TM) Client VM 1.4.0-b92 maybe it works on newer JDKs? In attachment you will find zip file containing my test app. It contains two batch files in which you must modify paths to your JDKs and then execute them. The result for JDK1.4 is that error output of second compilation is sent to _first_ stderr (ie to first file). And what to do now? Milan, could I ask you to check BugTraq for this error and file bug if necessary? I've never done that before, so it would take me ages to do it ;-) I propose to close this bug as WONTFIX.
Created attachment 5370 [details] zip file with simple test app
It should not be closed WONTFIX until there is a bug in BugTraq. BTW if you don't want to use the BugTraq native interface on SWAN, you can also do it publically (which involves some filtering of your report by Sun employees confirming it, but this is not necessarily bad): http://developer.java.sun.com/developer/bugParade/index.jshtml I think it would be best to look for a workaround, since 1.4 is our preferred platform, and 'modern' is the default compiler for <javac>. This bug could be quite visible. Maybe Javac's internal cache can be cleared using reflection?
I tried to search for such bug in bugtraq but found nothing, but it doesn't necessarily mean that the bug is not there since bugtraq is difficult to search in :-(.
Milan, before we file bug I would like to double check it in JDK sources. It will take me some time to get them. I will let you know then.
*** Issue 22659 has been marked as a duplicate of this issue. ***
The problem is in JDK1.4.0. There is static final PrintWriter defaultWriter = new PrintWriter(System.err); in com.sun.tools.javac.v8.util.Log class which caches the stderr. However in 1.4.1 this should be fixed, so there is no need to file bug against JDK. I tried to workaround it for 1.4.0, but I did not find any simple way how to do that. The variable is "final" so I cannot modify it by reflection. Therefore I'm closing this as WONTFIX. If you have some suggestion about possible workaround, please, let me know.
OK. I cannot think of any other workaround on our side. I suggest it be documented that 1.4.0 users should use a non-internal compiler: external javac, Jikes, etc.
proposed readme text: Description: Compilation errors are printed to wrong tab in Output window when running an Ant script. This may occur if you are using the IDE's internal compiler and the IDE is running on JDK 1.4.0.<br><br> Workaround: Use a different JDK or use a different compiler (such as external javac).
Sentence "if you are using the IDE's internal compiler" is not right. Ant script does not use IDE's compilers. It should be "if you are compiling with modern or classic compiler" or something like that (see help for Ant javac task). The workaround is to use a diff JDK or use a diff compiler (eg. jikes or extJavac).
And please emphasize that 1.4.1 JDK is OK.
Revised release note: Description: Compilation errors are printed to wrong tab in Output window when running an Ant script. This may occur if you are using the "classic" or "modern" compiler. <br><br> Workaround: Use a different JDK (including JDK 1.4.1) or use a different compiler (such as external javac or Jikes).
The mention that this happens only when IDE is running on JDK 1.4.0 left out. Otherwise OK.
added " and you are running on JDK 1.4" to the end.
Resolved for 3.3.x or earlier, no new info since then -> closing.
removing RELNOTE keyword as this issue seems to be much more marginal (how many people don't run on 1.4.1 or above?).