You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2009/07/11 01:44:48 UTC

DO NOT REPLY [Bug 47509] New: Exception in scriptdef prints entire stack trace

https://issues.apache.org/bugzilla/show_bug.cgi?id=47509

           Summary: Exception in scriptdef prints entire stack trace
           Product: Ant
           Version: 1.7.1
          Platform: PC
        OS/Version: Windows 98
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Optional Tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: slugfiller@ifireball.dyndns.org


When I run a scriptdef like:
    <scriptdef name="quickfail" language="beanshell">
        <![CDATA[
            self.fail("I failed!");
        ]]>
    </scriptdef>

I expect to get an output like:

BUILD FAILED
C:\myproject\build.xml:10: [quickfail] I failed!

Or something of the sort... Instead I get:

BUILD FAILED
javax.script.ScriptException: Sourced file: inline evaluation of:
``self.fail("I failed!");                         ;'' : Method Invocation
self.fail : at Line: 3 : in file: inline evaluation of: ``
self.fail("I failed!");
'' : self .fail ( "I failed!" );

Target exception: I failed!
in inline evaluation of: ``                                        self.fail("I
failed!");
    at line number 3 '';
    at bsh.engine.BshScriptEngine.evalSource(BshScriptEngine.java:86)
    at bsh.engine.BshScriptEngine.eval(BshScriptEngine.java:46)
    at javax.script.AbstractScriptEngine.eval(Unknown Source)
.BshScriptEngine.evalSource(BshScriptEngine.java:86)
        at bsh.engine.BshScriptEngine.eval(BshScriptEngine.java:46)
        at javax.script.AbstractScriptEngine.eval(Unknown Source)
[...it keeps going for 3 more pages, making the original error very hard to
read...]

I'm willing to grudgingly accept such an output for an IOException, or even a
syntax error, but for a user-generated fail? What's the point of providing a
custom fail command if it looks like a full system crash?

I haven't checked if this is beanshell specific, or if it applies to javascript
and other languages as well, since I only have beanshell installed.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 47509] Exception in scriptdef prints entire stack trace

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47509


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




--- Comment #1 from Stefan Bodewig <bo...@apache.org>  2009-07-13 04:00:49 PST ---
I haven't tried beanshell but JavaScript in svn revision 793540 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=793540 )

When using Apache BSF things are just like one would want them to be - a one
line "I failed!" message.

But using javax.script things look ugly.  Unfortunately the scripting engine
throws a ScriptException without any nested cause in this case, completely
hiding the original BuildException.

The beanshell implementation may be doing better, in which case the changes
committed in above revision may help.

If it doesn't, then I'm afraid there isn't anything we can do from Ant's side.

Using WONTFIX as a placeholder for CANTFIX.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.