FAQ
Repository: ant
Updated Branches:
   refs/heads/master 5c13bb841 -> 5669303f2


<setpermissions>: failonerror=false doesnt work in conjunction with nonPosixMode.


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/5669303f
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/5669303f
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/5669303f

Branch: refs/heads/master
Commit: 5669303f290a5381a93841267cdab1858c0dd76a
Parents: 5c13bb8
Author: Jan Matèrne <jhm@apache.org>
Authored: Fri May 27 10:08:53 2016 +0200
Committer: Jan Matèrne <jhm@apache.org>
Committed: Fri May 27 10:08:53 2016 +0200

----------------------------------------------------------------------
  .../tools/ant/taskdefs/SetPermissions.java | 25 ++++++++++++++------
  1 file changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/5669303f/src/main/org/apache/tools/ant/taskdefs/SetPermissions.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/SetPermissions.java b/src/main/org/apache/tools/ant/taskdefs/SetPermissions.java
index 8716bee..7518077 100644
--- a/src/main/org/apache/tools/ant/taskdefs/SetPermissions.java
+++ b/src/main/org/apache/tools/ant/taskdefs/SetPermissions.java
@@ -151,17 +151,28 @@ public class SetPermissions extends Task {
                      maybeThrowException(ioe, "Failed to set permissions on '%s' due to %s", r, ioe.getMessage());
                  }
              }
- } catch (ClassCastException uoe) {
- maybeThrowException(null, "some specified permissions are not of type PosixFilePermission: %s", StringUtils.join(permissions, ", "));
- } catch (SecurityException uoe) {
- maybeThrowException(null, "the SecurityManager denies role accessUserInformation or write access for SecurityManager.checkWrite for resource '%s'", currentResource);
+ } catch (ClassCastException cce) {
+ maybeThrowException(null,
+ "some specified permissions are not of type PosixFilePermission: %s",
+ StringUtils.join(permissions, ", "));
+ } catch (SecurityException se) {
+ maybeThrowException(null,
+ "the SecurityManager denies role accessUserInformation or write access for SecurityManager.checkWrite for resource '%s'",
+ currentResource);
+ } catch (BuildException be) {
+ // maybe thrown by callback method this::posixPermissionsNotSupported.
+ maybeThrowException(be, be.getMessage());
          }
      }

- private void maybeThrowException(Exception ioe, String msgFormat, Object... msgArgs) {
+ private void maybeThrowException(Exception exc, String msgFormat, Object... msgArgs) {
          String msg = String.format(msgFormat, msgArgs);
          if (failonerror) {
- throw new BuildException(msg, ioe);
+ if (exc instanceof BuildException) {
+ throw (BuildException)exc;
+ } else {
+ throw new BuildException(msg, exc);
+ }
          } else {
              log("Warning: " + msg, Project.MSG_ERR);
          }
@@ -196,7 +207,7 @@ public class SetPermissions extends Task {
                  maybeThrowException(ioe, "Failed to set permissions on '%s' due to %s",
                                      p, ioe.getMessage());
              } catch (SecurityException uoe) {
- maybeThrowException(null, "the SecurityManager denies role "
+ maybeThrowException(null, "the SecurityManager denies role "
                                      + "accessUserInformation or write access for "
                                      + "SecurityManager.checkWrite for resource '%s'",
                                      p);

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupnotifications @
categoriesant
postedMay 27, '16 at 8:09a
activeMay 27, '16 at 8:09a
posts1
users1
websiteant.apache.org

1 user in discussion

Jhm: 1 post

People

Translate

site design / logo © 2018 Grokbase