src/share/classes/java/util/PropertyPermission.java
Print this page
@@ -322,24 +322,20 @@
* read, write.
*
* @return the canonical string representation of the actions.
*/
static String getActions(int mask) {
- StringBuilder sb = new StringBuilder();
- boolean comma = false;
-
- if ((mask & READ) == READ) {
- comma = true;
- sb.append("read");
- }
-
- if ((mask & WRITE) == WRITE) {
- if (comma) sb.append(',');
- else comma = true;
- sb.append("write");
+ switch (mask & (READ|WRITE)) {
+ case READ:
+ return SecurityConstants.PROPERTY_READ_ACTION;
+ case WRITE:
+ return SecurityConstants.PROPERTY_WRITE_ACTION;
+ case READ|WRITE:
+ return SecurityConstants.PROPERTY_RW_ACTION;
+ default:
+ return "";
}
- return sb.toString();
}
/**
* Returns the "canonical string representation" of the actions.
* That is, this method always returns present actions in the following order: