ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: java.security.PrivilegedActionException in Jython scriptdef
Date Tue, 28 Oct 2008 11:06:50 GMT
Morgan Kinne wrote:
> Hi,
> I'm a newbie here and a newbie to Jython and scripting in Ant. In that 
> vein:
> 
> I've created a scriptdef task which I wrote in Jython. I'm using BSF as 
> the manager. My intent was to delete files within this task. Everything 
> works right up to the point where a file is to be deleted, when I get this 
> exception:
> 
> eraseZipFiles:
> [delete-in-each-child-dir] Processing ap
> Oct 27, 2008 4:15:59 PM org.apache.bsf.BSFManager exec
> SEVERE: Exception :
> java.security.PrivilegedActionException: org.apache.bsf.BSFException: 
> exception
> from Jython:
> 
> Traceback (innermost last):
>   File "<string>", line 25, in ?
>         at org.apache.tools.ant.taskdefs.Delete.handle(Delete.java:624)
> 
>         at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:570)
> 
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
> 
> That's when I smacked my forehead and said to myself, "Self, you're 
> working in a sandbox you idiot."
> Of course I can solve this issue any number of ways, but I was wondering 
> if there was some way to "disable" the security manager? Would I have the 
> same issue if I used javax. as the manager? I hope so because I've found 
> scripting with Jython to be very effective.
> Morgan

Ant has a very minimal sandbox that is designed to stop you calling 
system.exit() and nothing else. So I'm pretty surprised by this. Maybe 
its BSF Manager at play

1. Looking at the stack trace, you've just tried to create a directory 
that isnt there
             } else if (!fsDir.isDirectory()) {
                 handle("Directory does not exist:" + fsDir);   //here

2. Is there a version of Jython for the Java6 scripting engine? Ant can 
work with that instead.

-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message