logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1599089 - in /logging/log4j/log4j2/trunk/log4j-core/src: main/java/org/apache/logging/log4j/core/config/plugins/util/TypeConverters.java test/java/org/apache/logging/log4j/core/config/plugins/util/TypeConvertersTest.java
Date Mon, 02 Jun 2014 05:24:08 GMT
Author: ggregory
Date: Mon Jun  2 05:24:08 2014
New Revision: 1599089

URL: http://svn.apache.org/r1599089
Log:
Add type converter for the Java Security Provider class, which I plan to use for file encryption.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/TypeConverters.java
    logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/TypeConvertersTest.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/TypeConverters.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/TypeConverters.java?rev=1599089&r1=1599088&r2=1599089&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/TypeConverters.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/TypeConverters.java
Mon Jun  2 05:24:08 2014
@@ -25,6 +25,8 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.charset.Charset;
+import java.security.Provider;
+import java.security.Security;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.regex.Pattern;
@@ -234,6 +236,16 @@ public final class TypeConverters {
     }
 
     /**
+     * Converts a {@link String} into a {@link Pattern}.
+     */
+    private static class SecurityProviderConverter implements TypeConverter<Provider>
{
+        @Override
+        public Provider convert(final String s) {
+            return Security.getProvider(s);
+        }
+    }
+
+    /**
      * Converts a {@link String} into a {@link Short}.
      */
     private static class ShortConverter implements TypeConverter<Short> {
@@ -385,6 +397,7 @@ public final class TypeConverters {
         registry.put(URI.class, new UriConverter());
         registry.put(Class.class, new ClassConverter());
         registry.put(Pattern.class, new PatternConverter());
+        registry.put(Provider.class, new SecurityProviderConverter());
         // Log4J 
         registry.put(Level.class, new LevelConverter());
         registry.put(Filter.Result.class, new EnumConverter<Filter.Result>(Filter.Result.class));

Modified: logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/TypeConvertersTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/TypeConvertersTest.java?rev=1599089&r1=1599088&r2=1599089&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/TypeConvertersTest.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/config/plugins/util/TypeConvertersTest.java
Mon Jun  2 05:24:08 2014
@@ -26,6 +26,8 @@ import java.math.BigInteger;
 import java.net.URI;
 import java.net.URL;
 import java.nio.charset.Charset;
+import java.security.Provider;
+import java.security.Security;
 import java.util.Arrays;
 import java.util.Collection;
 
@@ -153,6 +155,9 @@ public class TypeConvertersTest {
                 // JRE BigInteger
                 { "9223372036854775817000.99999", new BigDecimal("9223372036854775817000.99999"),
null, BigDecimal.class },
                 { "\n", null, null, BigDecimal.class },
+                // JRE Security Provider
+                { Security.getProviders()[0].getName(), Security.getProviders()[0], null,
Provider.class },
+                { "\n", null, null, Provider.class },
             }
         );
     }



Mime
View raw message