/** * Gets the file / directory creation umask. * * @return the umask {@link Mode} */ private static Mode getUMask(String confUmask) { int umask = Constants.DEFAULT_FILE_SYSTEM_UMASK; if (confUmask != null) { if ((confUmask.length() > 4) || !isValid(confUmask)) { throw new IllegalArgumentException(ExceptionMessage.INVALID_CONFIGURATION_VALUE .getMessage(confUmask, PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_UMASK)); } int newUmask = 0; int lastIndex = confUmask.length() - 1; for (int i = 0; i <= lastIndex; i++) { newUmask += (confUmask.charAt(i) - '0') << 3 * (lastIndex - i); } umask = newUmask; } return new Mode((short) umask); }