river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter_firmst...@apache.org
Subject svn commit: r929366 - /incubator/river/jtsk/trunk/src/org/apache/river/security/policy/util/PolicyEntry.java
Date Wed, 31 Mar 2010 02:53:46 GMT
Author: peter_firmstone
Date: Wed Mar 31 02:53:46 2010
New Revision: 929366

URL: http://svn.apache.org/viewvc?rev=929366&view=rev
Log:
PolicyEntry refactor java 1.5 dependant

Modified:
    incubator/river/jtsk/trunk/src/org/apache/river/security/policy/util/PolicyEntry.java

Modified: incubator/river/jtsk/trunk/src/org/apache/river/security/policy/util/PolicyEntry.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/trunk/src/org/apache/river/security/policy/util/PolicyEntry.java?rev=929366&r1=929365&r2=929366&view=diff
==============================================================================
--- incubator/river/jtsk/trunk/src/org/apache/river/security/policy/util/PolicyEntry.java
(original)
+++ incubator/river/jtsk/trunk/src/org/apache/river/security/policy/util/PolicyEntry.java
Wed Mar 31 02:53:46 2010
@@ -53,13 +53,9 @@ public final class PolicyEntry {
 
     // Array of principals 
     private final List<Principal> principals;
-    private static final List<Principal> noPrincipals = 
-            Collections.unmodifiableList(new ArrayList<Principal>(0));
 
     // Permissions collection
     private final Collection<Permission> permissions;
-    private static final Collection<Permission> noPermissions = 
-            Collections.unmodifiableCollection(new HashSet<Permission>(0));
     
     private transient final int hashcode;
 
@@ -67,17 +63,18 @@ public final class PolicyEntry {
      * Constructor with initialization parameters. Passed collections are not
      * referenced directly, but copied.
      */
+    @SuppressWarnings("unchecked")
     public PolicyEntry(CodeSource cs, Collection<? extends Principal> prs,
             Collection<? extends Permission> permissions) {
         this.cs = (cs != null) ? normalizeCodeSource(cs) : null;
         if ( prs == null || prs.isEmpty()) {
-            this.principals = noPrincipals;
+            this.principals = Collections.emptyList(); // Java 1.5
         }else{
             this.principals = new ArrayList<Principal>(prs.size());
             this.principals.addAll(prs);
         }
         if (permissions == null || permissions.isEmpty()) {
-            this.permissions = noPermissions;
+            this.permissions = Collections.emptySet(); // Java 1.5
         }else{
             Set<Permission> perm = new HashSet<Permission>(permissions.size());
             perm.addAll(permissions);



Mime
View raw message