You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2015/10/22 11:19:45 UTC

svn commit: r1709966 - /webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ThreadLocalSecurityProvider.java

Author: coheigea
Date: Thu Oct 22 09:19:44 2015
New Revision: 1709966

URL: http://svn.apache.org/viewvc?rev=1709966&view=rev
Log:
Fixing build

Modified:
    webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ThreadLocalSecurityProvider.java

Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ThreadLocalSecurityProvider.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ThreadLocalSecurityProvider.java?rev=1709966&r1=1709965&r2=1709966&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ThreadLocalSecurityProvider.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ThreadLocalSecurityProvider.java Thu Oct 22 09:19:44 2015
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.Map;
+import java.util.NoSuchElementException;
 import java.util.Set;
 
 public final class ThreadLocalSecurityProvider extends Provider {
@@ -34,6 +35,7 @@ public final class ThreadLocalSecurityPr
     private static final String NAME = "TLSP";
     private static final ThreadLocal<Provider> provider = new ThreadLocal<Provider>();
     private static boolean installed = false;
+    private static final EmptyEnumeration<Object> emptyEnumeration = new EmptyEnumeration<Object>();
 
     public static synchronized void install() {
         Security.insertProviderAt(new ThreadLocalSecurityProvider(),
@@ -146,7 +148,7 @@ public final class ThreadLocalSecurityPr
         if (p != null) {
             return p.keys();
         } else {
-            return Collections.emptyEnumeration();
+            return emptyEnumeration;
         }
     }
 
@@ -155,7 +157,7 @@ public final class ThreadLocalSecurityPr
         if (p != null) {
             return p.elements();
         } else {
-            return Collections.emptyEnumeration();
+            return emptyEnumeration;
         }
     }
 
@@ -185,5 +187,18 @@ public final class ThreadLocalSecurityPr
             return null;
         }
     }
-    
+
+    private static class EmptyEnumeration<T> implements Enumeration<T> {
+
+        @Override
+        public boolean hasMoreElements() {
+            return false;
+        }
+
+        @Override
+        public T nextElement() {
+            throw new NoSuchElementException();
+        }
+
+    }
 }
\ No newline at end of file