You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jing Xue <ji...@digizenstudio.com> on 2007/02/11 20:07:31 UTC

java task and permissions in 1.7.0

Hi,

This task has been working fine until I recently upgraded to 1.7.0:

  <target name="usage" description="This usage help">
    <java classname="org.apache.tools.ant.launch.Launcher">
      <arg value="-projecthelp"/>
    </java>
  </target> 

In 1.7.0, I get the "exitVM disallowed" error. So I changed it to:

  <target name="usage" description="This usage help">
    <java classname="org.apache.tools.ant.launch.Launcher">
      <arg value="-projecthelp"/>
      <permissions>
        <grant class="java.lang.RuntimePermission" name="exitVM.*"/>
      </permissions>
    </java>
  </target> 
and got:
 java.lang.SecurityException: Permission
 (java.util.PropertyPermission ant.home read) was not granted.

So here goes my _first question_: I thought any explicitly
granted/revoked permissions were accumulative on top of the base set?

Then I tried granting AllPermission:

  <target name="usage" description="This usage help">
    <java classname="org.apache.tools.ant.launch.Launcher">
      <arg value="-projecthelp"/>
      <permissions>
        <grant class="java.security.AllPermission"/>
      </permissions>
    </java>
  </target> 
and got the same error:
 java.lang.SecurityException: Permission
 (java.util.PropertyPermission ant.home read) was not granted.

So my _second question_ is quite obvious: why doesn't AllPermission
grant, well, all the permissions?

In the end I had to work around by adding fork="true" clonevm="true",
but it just looks silly to fork a vm in order to print out project help.

Thanks for any hint as to what I'm missing here.
-- 
Jing Xue

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