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 11099 - Indirect Ant compiler without build.xml prints stack trace
Summary: Indirect Ant compiler without build.xml prints stack trace
Status: CLOSED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 3.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on: 3934
Blocks:
  Show dependency tree
 
Reported: 2001-04-05 14:47 UTC by _ pkuzel
Modified: 2003-06-30 14:46 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The real exception thrown from ant CompilerType (661 bytes, text/plain)
2001-07-20 20:30 UTC, Svata Dedic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ pkuzel 2001-04-05 14:48:00 UTC
[5/Apr/2001] I set Indirect Ant as default compiler. Opening filesystem
that does not contain build.xml somewhere in path shows:

Thu Apr 05 15:40:50 GMT+02:00 2001: org.openide.util.RequestProcessor$Holder:
Posted StackTrace
Annotation: No build.xml Ant script was found above object DomEcho04.
org.openide.util.RequestProcessor$Holder: Posted StackTrace(task
org.netbeans.modules.java.JavaNode$1@558b7 [-14612, 1, -1])
        at
org.openide.util.RequestProcessor$Task.createHolder(RequestProcessor.java:322)
        at org.openide.util.RequestProcessor.post(RequestProcessor.java:100)
        at org.openide.util.RequestProcessor.post(RequestProcessor.java:84)
        at
org.openide.util.RequestProcessor.postRequest(RequestProcessor.java:171)
        at
org.netbeans.modules.java.JavaNode.requestResolveIcons(JavaNode.java:251)
        at org.netbeans.modules.java.JavaNode.sourceParsed(JavaNode.java:212)
        at
org.netbeans.modules.java.JavaNode$PropL.stateChanged(JavaNode.java:169)
        at
org.openide.util.WeakListener$Change.stateChanged(WeakListener.java:583)
        at
org.netbeans.modules.java.parser.ParsingSupport.fireStateChange(ParsingSupport.java:276)
        at
org.netbeans.modules.java.parser.ParsingSupport.changeStatus(ParsingSupport.java:259)
        at
org.netbeans.modules.java.parser.ParsingSupport$Processor.complete(ParsingSupport.java:618)
        at
org.netbeans.modules.java.parser.ParsingSupport$Processor.run(ParsingSupport.java:557)
        at org.openide.util.Task.run(Task.java:124)
[catch] at
org.openide.util.RequestProcessor$ProcessorThread.run(RequestProcessor.java:622)
Comment 1 Svata Dedic 2001-04-05 16:48:13 UTC
Sorry, the stack trace is not complete - the portion that shows the actual 
error source is missing (only trace of code that posted the request is there). 
Could you attach the second trace part as well ?
Comment 2 _ pkuzel 2001-04-06 10:24:41 UTC
Unfortunatelly it was not provided. However it is easily reproducible.
Comment 3 Svata Dedic 2001-04-06 10:59:16 UTC
Reproduced, missing portion attached.
It seems that Ant compiler throws IllegalArgumentException.
Jesse, could you correct it in ant's CompilerType ?
org.openide.compilers.CompilerType does not document throwing IllegalArg from
prepareJob().
Comment 4 Svata Dedic 2001-04-06 12:45:38 UTC
Created attachment 1024 [details]
The real exception thrown from ant CompilerType
Comment 5 Svata Dedic 2001-04-06 20:06:47 UTC
Jesse, I don't think that the CompilerType should throw IllegalArgument. Maybe 
printing a warning to output window when the compilation starts would be 
better.
Anyway, if you think throwing the exception si correct, reassign this back to 
me. Thanks.
Comment 6 Jesse Glick 2001-04-09 11:16:18 UTC
It's true, it does not declare IAE can be thrown. But if the job cannot be
prepared at all, it is strange to print something--after all messages can only
be printed from a compiler group, and there is none applicable here. It would be
necessary to construct an entirely separate "fake" compiler and compiler group
just to print this one message. So I think the API is deficient. Compare
Executor.execute which can throw an IOException if the executor is misconfigured
somehow--there appears to be no equivalent way for compiler types to report a
problem.

BTW I have already filed a bug that RP does not print the "real" stack trace
from an exception, I think it is not using ErrorManager correctly.

Also AFAIK if you actually run the compilation using F9, ErrorManager is used
and the user is given a nice dialog with the message about what is wrong--there
is no stack trace. So it might be a good idea for JavaNode to do the same, in
the interests of robustness--catch runtime exceptions (or at least IAE) from
resolveCompileBadge and report using ErrorManager.
Comment 7 Jesse Glick 2001-04-09 16:46:30 UTC
I would point out that JavaCompilerType throws ClassCastException when run on a
non-Java source, which is not exactly declared either... (I think there is some
openide enhancement request that service types be able to declare what
DataObject's they are applicable to?)
Comment 8 Jesse Glick 2001-04-11 16:51:06 UTC
Yarda suggests: compiler produce dummy group which will fire compiler error
event when run. No better way to do it, apparently.
Comment 9 Jesse Glick 2001-04-12 12:10:37 UTC
Fixed in the trunk: AntCompilerType.java 1.5, IndirectAntCompilerType.java 1.4.
Comment 10 Jesse Glick 2001-04-13 17:41:28 UTC
Fixed in release32.
Comment 11 Jan Chalupa 2001-05-05 19:30:30 UTC
Target milestone -> 3.2
Comment 12 Milan Kubec 2001-06-27 09:20:07 UTC
Verified in build 20010627.
Comment 13 _ briansmith 2002-09-14 06:43:21 UTC
I have been seeing this issue again lately (last week or two) while
using NetBeans from the CVS trunk. It is very annoying since I'm
developing a NetBeans module and thus the stacktraces are getting in
the way of any errors that _my_ module might be generating. Here is a
stack trace:

[org.apache.tools.ant.module] INFORMATIONAL *********** Exception
occurred *****
******* at Sat Sep 14 00:29:37 CDT 2002
Annotation: No build.xml Ant script was found above object JApplet.
java.lang.IllegalArgumentException: No build.xml found for:
Templates/GUIForms/J
Applet.java
        at
org.apache.tools.ant.module.run.IndirectAntCompilerType.prepareJob0(I
ndirectAntCompilerType.java:105)
[catch] at
org.apache.tools.ant.module.run.AntCompilerType.prepareJob(AntCompile
rType.java:76)
        at
org.openide.loaders.CompilerSupport.addToJob(CompilerSupport.java:89)

        at
org.netbeans.modules.java.JavaDataObject.checkUpToDate(JavaDataObject
.java:1226)
        at
org.netbeans.modules.java.JavaDataObject.access$400(JavaDataObject.ja
va:63)
        at
org.netbeans.modules.java.JavaDataObject$PrimaryListener.propertyChan
ge(JavaDataObject.java:964)
        at
org.openide.loaders.DataObject.firePropertyChange(DataObject.java:793
)
        at
org.openide.loaders.MultiDataObject$1.run(MultiDataObject.java:663)
        at org.openide.util.Task.run(Task.java:136)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java
:599)
[org.apache.tools.ant.module] INFORMATIONAL *********** Exception
occurred *****
******* at Sat Sep 14 00:29:37 CDT 2002
Annotation: No build.xml Ant script was found above object JDialog.
java.lang.IllegalArgumentException: No build.xml found for:
Templates/GUIForms/J
Dialog.java
        at
org.apache.tools.ant.module.run.IndirectAntCompilerType.prepareJob0(I
ndirectAntCompilerType.java:105)
[catch] at
org.apache.tools.ant.module.run.AntCompilerType.prepareJob(AntCompile
rType.java:76)
        at
org.openide.loaders.CompilerSupport.addToJob(CompilerSupport.java:89)

        at
org.netbeans.modules.java.JavaDataObject.checkUpToDate(JavaDataObject
.java:1226)
        at
org.netbeans.modules.java.JavaDataObject.access$400(JavaDataObject.ja
va:63)
        at
org.netbeans.modules.java.JavaDataObject$PrimaryListener.propertyChan
ge(JavaDataObject.java:964)
        at
org.openide.loaders.DataObject.firePropertyChange(DataObject.java:793
)
        at
org.openide.loaders.MultiDataObject$1.run(MultiDataObject.java:663)
        at org.openide.util.Task.run(Task.java:136)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java
:599)
[org.apache.tools.ant.module] INFORMATIONAL *********** Exception
occurred *****
******* at Sat Sep 14 00:29:37 CDT 2002
Annotation: No build.xml Ant script was found above object JFrame.
java.lang.IllegalArgumentException: No build.xml found for:
Templates/GUIForms/J
Frame.java
        at
org.apache.tools.ant.module.run.IndirectAntCompilerType.prepareJob0(I
ndirectAntCompilerType.java:105)
[catch] at
org.apache.tools.ant.module.run.AntCompilerType.prepareJob(AntCompile
rType.java:76)
        at
org.openide.loaders.CompilerSupport.addToJob(CompilerSupport.java:89)

        at
org.netbeans.modules.java.JavaDataObject.checkUpToDate(JavaDataObject
.java:1226)
        at
org.netbeans.modules.java.JavaDataObject.access$400(JavaDataObject.ja
va:63)
        at
org.netbeans.modules.java.JavaDataObject$PrimaryListener.propertyChan
ge(JavaDataObject.java:964)
        at
org.openide.loaders.DataObject.firePropertyChange(DataObject.java:793
)
        at
org.openide.loaders.MultiDataObject$1.run(MultiDataObject.java:663)
        at org.openide.util.Task.run(Task.java:136)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java
:599)
[org.apache.tools.ant.module] INFORMATIONAL *********** Exception
occurred *****
******* at Sat Sep 14 00:29:37 CDT 2002
Annotation: No build.xml Ant script was found above object JInternalFrame.
java.lang.IllegalArgumentException: No build.xml found for:
Templates/GUIForms/J
InternalFrame.java
        at
org.apache.tools.ant.module.run.IndirectAntCompilerType.prepareJob0(I
ndirectAntCompilerType.java:105)
[catch] at
org.apache.tools.ant.module.run.AntCompilerType.prepareJob(AntCompile
rType.java:76)
        at
org.openide.loaders.CompilerSupport.addToJob(CompilerSupport.java:89)

        at
org.netbeans.modules.java.JavaDataObject.checkUpToDate(JavaDataObject
.java:1226)
        at
org.netbeans.modules.java.JavaDataObject.access$400(JavaDataObject.ja
va:63)
        at
org.netbeans.modules.java.JavaDataObject$PrimaryListener.propertyChan
ge(JavaDataObject.java:964)
        at
org.openide.loaders.DataObject.firePropertyChange(DataObject.java:793
)
        at
org.openide.loaders.MultiDataObject$1.run(MultiDataObject.java:663)
        at org.openide.util.Task.run(Task.java:136)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java
:599)
[org.apache.tools.ant.module] INFORMATIONAL *********** Exception
occurred *****
******* at Sat Sep 14 00:29:37 CDT 2002
Annotation: No build.xml Ant script was found above object JPanel.
java.lang.IllegalArgumentException: No build.xml found for:
Templates/GUIForms/J
Panel.java
        at
org.apache.tools.ant.module.run.IndirectAntCompilerType.prepareJob0(I
ndirectAntCompilerType.java:105)
[catch] at
org.apache.tools.ant.module.run.AntCompilerType.prepareJob(AntCompile
rType.java:76)
        at
org.openide.loaders.CompilerSupport.addToJob(CompilerSupport.java:89)

        at
org.netbeans.modules.java.JavaDataObject.checkUpToDate(JavaDataObject
.java:1226)
        at
org.netbeans.modules.java.JavaDataObject.access$400(JavaDataObject.ja
va:63)
        at
org.netbeans.modules.java.JavaDataObject$PrimaryListener.propertyChan
ge(JavaDataObject.java:964)
        at
org.openide.loaders.DataObject.firePropertyChange(DataObject.java:793
)
        at
org.openide.loaders.MultiDataObject$1.run(MultiDataObject.java:663)
        at org.openide.util.Task.run(Task.java:136)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java
:599)
[org.apache.tools.ant.module] INFORMATIONAL *********** Exception
occurred *****
******* at Sat Sep 14 00:29:38 CDT 2002
Annotation: No build.xml Ant script was found above object Bean Form.
java.lang.IllegalArgumentException: No build.xml found for:
Templates/GUIForms/B
eanForm.java
        at
org.apache.tools.ant.module.run.IndirectAntCompilerType.prepareJob0(I
ndirectAntCompilerType.java:105)
[catch] at
org.apache.tools.ant.module.run.AntCompilerType.prepareJob(AntCompile
rType.java:76)
        at
org.openide.loaders.CompilerSupport.addToJob(CompilerSupport.java:89)

        at
org.netbeans.modules.java.JavaDataObject.checkUpToDate(JavaDataObject
.java:1226)
        at
org.netbeans.modules.java.JavaDataObject.access$400(JavaDataObject.ja
va:63)
        at
org.netbeans.modules.java.JavaDataObject$PrimaryListener.propertyChan
ge(JavaDataObject.java:964)
        at
org.openide.loaders.DataObject.firePropertyChange(DataObject.java:793
)
        at
org.openide.loaders.MultiDataObject$1.run(MultiDataObject.java:663)
        at org.openide.util.Task.run(Task.java:136)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java
:599)
[org.apache.tools.ant.module] INFORMATIONAL *********** Exception
occurred *****
******* at Sat Sep 14 00:29:38 CDT 2002
Annotation: No build.xml Ant script was found above object Customizer.
java.lang.IllegalArgumentException: No build.xml found for:
Templates/Beans/Cust
omizer.java
        at
org.apache.tools.ant.module.run.IndirectAntCompilerType.prepareJob0(I
ndirectAntCompilerType.java:105)
[catch] at
org.apache.tools.ant.module.run.AntCompilerType.prepareJob(AntCompile
rType.java:76)
        at
org.openide.loaders.CompilerSupport.addToJob(CompilerSupport.java:89)

        at
org.netbeans.modules.java.JavaDataObject.checkUpToDate(JavaDataObject
.java:1226)
        at
org.netbeans.modules.java.JavaDataObject.access$400(JavaDataObject.ja
va:63)
        at
org.netbeans.modules.java.JavaDataObject$PrimaryListener.propertyChan
ge(JavaDataObject.java:964)
        at
org.openide.loaders.DataObject.firePropertyChange(DataObject.java:793
)
        at
org.openide.loaders.MultiDataObject$1.run(MultiDataObject.java:663)
        at org.openide.util.Task.run(Task.java:136)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java
:599)
Comment 14 Jesse Glick 2002-09-14 21:18:52 UTC
Brian - the symptoms you are describing are the *fix* of the bug, not
a regression. It now only logs an informational-level message to the
log file. Since you set the default compiler type for all .java to be
IAE, and did not supply a build.xml, in fact random .java files are
*not* compilable; and the Java module tries to check compilation
status of files in order to update the icon badge, which it cannot do.

I guess the stack trace in the log file could simply be suppressed.
However this could result in suppressing potentially useful debugging
info in the case of real errors, since there are several kinds of
reasons why preparing a compilation job with an IAE might fail. My
best suggestion at this point is to remove call to notify() from
AntCompilerType.prepareJob, and add it to BogusCompilerGroup.start, to
hopefully prevent the stack traces from being printed in case the Java
module is only probing for badges.

Issue #3934 has a summary of the discussion for making service types
such as compilers apply only to certain files, which is the underlying
problem. 4.0's projects support will very likely introduce major
changes in how things like compilation options are associated to
files, which will probably obsolete issues like this anyway.
Comment 15 _ briansmith 2002-09-14 22:31:22 UTC
I see that this is the expected behavior. But, IMO the real problem is
that the Java module doesn't need to check compilation status of
Templates/GUIForms/JInternalFrame.java et al. I think that the actions
in the templates for Java source code are causing the Java module to
unnecessarily chec the compilation status of the java source code
templates, which seems to me to be completely unnecessary since they
are always uncompiled. In other words, doing <Context Menu>->New->Java
Class shouldn't trigger this message. That means that the message
would only occur with mounted filesystems, and I can control that by
setting those filesystems to be uncompilable, I think.

Besides the above, maybe Indirect Ant Compiler should delegate to the
internal compiler when it can't find a build.xml?

Comment 16 Jesse Glick 2002-09-15 15:25:57 UTC
"That means that the message would only occur with mounted
filesystems, and I can control that by setting those filesystems to be
uncompilable, I think." - actually templates are on the system
filesystem which is currently always set to be used in compilation.
I'm not sure it needs to be, however; probably it doesn't. The only
cases where you would be compiling or running a class in the SFS is
(1) the Startup folder, (2) VCS Generic commands. These could be
easily special-cased, I think.

"Besides the above, maybe Indirect Ant Compiler should delegate to the
internal compiler when it can't find a build.xml?" - sounds too clever
to me, and besides is Java-specific whereas the Ant module generally
shouldn't be.
Comment 17 David Konecny 2003-01-13 12:33:22 UTC
Fixed as Jesse suggected. The exception is thrown only after the
compilation job is started and not during the preparing of compilation
job. That should solve Brian's problem.

Fixed in file:
Checking in src/org/apache/tools/ant/module/run/AntCompilerType.java
new revision: 1.8; previous revision: 1.7
Comment 18 Quality Engineering 2003-06-30 14:43:47 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.

Comment 19 Quality Engineering 2003-06-30 14:46:13 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.