felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1781782 - in /felix/trunk/osgi-r7/configurator/src: main/java/org/apache/felix/configurator/impl/ main/java/org/apache/felix/configurator/impl/json/ test/java/org/apache/felix/configurator/impl/
Date Sun, 05 Feb 2017 16:45:25 GMT
Author: cziegeler
Date: Sun Feb  5 16:45:25 2017
New Revision: 1781782

URL: http://svn.apache.org/viewvc?rev=1781782&view=rev
Log:
Create a directory per pid and url encode pid for creating the file

Modified:
    felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java
    felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/Util.java
    felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/json/JSONUtil.java
    felix/trunk/osgi-r7/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java

Modified: felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java?rev=1781782&r1=1781781&r2=1781782&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java
(original)
+++ felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/TypeConverter.java
Sun Feb  5 16:45:25 2017
@@ -55,7 +55,9 @@ public class TypeConverter {
      * @return The converted value or {@code null} if the conversion failed.
      * @throws IOException If an error happens
      */
-    public Object convert(final Object value,
+    public Object convert(
+            final String pid,
+            final Object value,
             final String typeInfo) throws IOException {
         if ( typeInfo == null ) {
             if ( value instanceof String || value instanceof Boolean ) {
@@ -100,7 +102,7 @@ public class TypeConverter {
             if ( path == null ) {
                 throw new IOException("Invalid path for binary property: " + value);
             }
-            final File filePath = Util.extractFile(bundle, path);
+            final File filePath = Util.extractFile(bundle, pid, path);
             if ( filePath == null ) {
                 throw new IOException("Invalid path for binary property: " + value);
             }
@@ -119,7 +121,7 @@ public class TypeConverter {
             final String[] filePaths = new String[paths.length];
             int i = 0;
             while ( i < paths.length ) {
-                final File filePath = Util.extractFile(bundle, paths[i]);
+                final File filePath = Util.extractFile(bundle, pid, paths[i]);
                 if ( filePath == null ) {
                     throw new IOException("Invalid path for binary property: " + value);
                 }

Modified: felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/Util.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/Util.java?rev=1781782&r1=1781781&r2=1781782&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/Util.java
(original)
+++ felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/Util.java
Sun Feb  5 16:45:25 2017
@@ -28,6 +28,7 @@ import java.io.UnsupportedEncodingExcept
 import java.lang.reflect.Field;
 import java.net.URL;
 import java.net.URLConnection;
+import java.net.URLEncoder;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.Collections;
@@ -204,17 +205,19 @@ public class Util {
         return null;
     }
 
-    public static File extractFile(final Bundle bundle, final String path) {
+    public static File extractFile(final Bundle bundle, final String pid, final String path)
{
         final URL url = bundle.getEntry(path);
         if ( url == null ) {
             SystemLogger.error("Entry " + path + " not found in bundle " + bundle);
             return null;
         }
-        final File newFile = new File(binDirectory, UUID.randomUUID().toString());
         URLConnection connection = null;
         try {
             connection = url.openConnection();
 
+            final File dir = new File(binDirectory, URLEncoder.encode(pid, "UTF-8"));
+            dir.mkdir();
+            final File newFile = new File(dir, UUID.randomUUID().toString());
 
             try(final BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
                 final FileOutputStream fos = new FileOutputStream(newFile)) {
@@ -229,7 +232,10 @@ public class Util {
 
             return newFile;
         } catch ( final IOException ioe ) {
-            SystemLogger.error("Unable to read " + path + " in bundle " + bundle, ioe);
+            SystemLogger.error("Unable to read " + path +
+                    " in bundle " + bundle +
+                    " for pid " + pid +
+                    " and write to " + binDirectory, ioe);
         }
 
         return null;

Modified: felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/json/JSONUtil.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/json/JSONUtil.java?rev=1781782&r1=1781781&r2=1781782&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/json/JSONUtil.java
(original)
+++ felix/trunk/osgi-r7/configurator/src/main/java/org/apache/felix/configurator/impl/json/JSONUtil.java
Sun Feb  5 16:45:25 2017
@@ -197,7 +197,7 @@ public class JSONUtil {
                                 }
                             } else {
                                 try {
-                                    Object convertedVal = converter.convert(value, typeInfo);
+                                    Object convertedVal = converter.convert(pid.toString(),
value, typeInfo);
                                     if ( convertedVal == null ) {
                                         convertedVal = value.toString();
                                     }
@@ -247,7 +247,7 @@ public class JSONUtil {
         	return serializer.deserialize(Map.class).from(reader);
         } catch ( final IOException ioe) {
             SystemLogger.error("Invalid JSON from " + name);
-            return null;        	
+            return null;
         }
     }
 

Modified: felix/trunk/osgi-r7/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java?rev=1781782&r1=1781781&r2=1781782&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java
(original)
+++ felix/trunk/osgi-r7/configurator/src/test/java/org/apache/felix/configurator/impl/TypeConverterTest.java
Sun Feb  5 16:45:25 2017
@@ -37,7 +37,7 @@ public class TypeConverterTest {
     @Test public void testStringConversionNoTypeInfo() throws IOException {
         final String v_String = "world";
         final TypeConverter converter = new TypeConverter(null);
-        final Object result = converter.convert(v_String, null);
+        final Object result = converter.convert(null, v_String, null);
         assertTrue(result instanceof String);
         assertEquals(v_String, result);
     }
@@ -45,7 +45,7 @@ public class TypeConverterTest {
     @Test public void testLongConversionNoTypeInfo() throws IOException {
         final long v_long = 3;
         final TypeConverter converter = new TypeConverter(null);
-        final Object result = converter.convert(v_long, null);
+        final Object result = converter.convert(null, v_long, null);
         assertTrue(result instanceof Long);
         assertEquals(v_long, result);
     }
@@ -53,7 +53,7 @@ public class TypeConverterTest {
     @Test public void testIntegerConversionNoTypeInfo() throws IOException {
         final int v_int = 3;
         final TypeConverter converter = new TypeConverter(null);
-        final Object result = converter.convert(v_int, null);
+        final Object result = converter.convert(null, v_int, null);
         assertTrue(result instanceof Long);
         assertEquals(3L, result);
     }
@@ -61,7 +61,7 @@ public class TypeConverterTest {
     @Test public void testShortConversionNoTypeInfo() throws IOException {
         final short v_short = 3;
         final TypeConverter converter = new TypeConverter(null);
-        final Object result = converter.convert(v_short, null);
+        final Object result = converter.convert(null, v_short, null);
         assertTrue(result instanceof Long);
         assertEquals(3L, result);
     }
@@ -69,7 +69,7 @@ public class TypeConverterTest {
     @Test public void testByteConversionNoTypeInfo() throws IOException {
         final byte v_byte = 3;
         final TypeConverter converter = new TypeConverter(null);
-        final Object result = converter.convert(v_byte, null);
+        final Object result = converter.convert(null, v_byte, null);
         assertTrue(result instanceof Long);
         assertEquals(3L, result);
     }
@@ -77,26 +77,26 @@ public class TypeConverterTest {
     @Test public void testCharConversionNoTypeInfo() throws IOException {
         final char v_char = 'a';
         final TypeConverter converter = new TypeConverter(null);
-        assertNull(converter.convert(v_char, null));
+        assertNull(converter.convert(null, v_char, null));
     }
 
     @Test public void testCharacterConversionNoTypeInfo() throws IOException {
         final Character v_Character = new Character('a');
         final TypeConverter converter = new TypeConverter(null);
-        assertNull(converter.convert(v_Character, null));
+        assertNull(converter.convert(null, v_Character, null));
     }
 
     @Test public void testFloatConversionNoTypeInfo() throws IOException {
         final float v_float = 3.1f;
         final TypeConverter converter = new TypeConverter(null);
-        final Object result = converter.convert(v_float, null);
+        final Object result = converter.convert(null, v_float, null);
         assertTrue(result instanceof Double);
     }
 
     @Test public void testDoubleConversionNoTypeInfo() throws IOException {
         final double v_double = 3.0;
         final TypeConverter converter = new TypeConverter(null);
-        final Object result = converter.convert(v_double, null);
+        final Object result = converter.convert(null, v_double, null);
         assertTrue(result instanceof Double);
         assertEquals(v_double, result);
     }
@@ -107,27 +107,27 @@ public class TypeConverterTest {
         final Map config = JSONUtil.parseJSON("a", JSONUtilTest.readJSON("json/simple-types.json"));
         final Map properties = (Map)config.get("config");
 
-        assertTrue(converter.convert(properties.get("string"), null) instanceof String);
-        assertTrue(converter.convert(properties.get("boolean"), null) instanceof Boolean);
-        assertTrue(converter.convert(properties.get("number"), null) instanceof Long);
-        assertTrue(converter.convert(properties.get("float"), null) instanceof Double);
+        assertTrue(converter.convert(null, properties.get("string"), null) instanceof String);
+        assertTrue(converter.convert(null, properties.get("boolean"), null) instanceof Boolean);
+        assertTrue(converter.convert(null, properties.get("number"), null) instanceof Long);
+        assertTrue(converter.convert(null, properties.get("float"), null) instanceof Double);
 
         // arrays
-        assertTrue(converter.convert(properties.get("string.array"), null).getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("string.array"), null), 0)
instanceof String);
-        assertTrue(Array.get(converter.convert(properties.get("string.array"), null), 1)
instanceof String);
-
-        assertTrue(converter.convert(properties.get("boolean.array"), null).getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("boolean.array"), null), 0)
instanceof Boolean);
-        assertTrue(Array.get(converter.convert(properties.get("boolean.array"), null), 1)
instanceof Boolean);
-
-        assertTrue(converter.convert(properties.get("number.array"), null).getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("number.array"), null), 0)
instanceof Long);
-        assertTrue(Array.get(converter.convert(properties.get("number.array"), null), 1)
instanceof Long);
-
-        assertTrue(converter.convert(properties.get("float.array"), null).getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("float.array"), null), 0) instanceof
Double);
-        assertTrue(Array.get(converter.convert(properties.get("float.array"), null), 1) instanceof
Double);
+        assertTrue(converter.convert(null, properties.get("string.array"), null).getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("string.array"), null),
0) instanceof String);
+        assertTrue(Array.get(converter.convert(null, properties.get("string.array"), null),
1) instanceof String);
+
+        assertTrue(converter.convert(null, properties.get("boolean.array"), null).getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("boolean.array"), null),
0) instanceof Boolean);
+        assertTrue(Array.get(converter.convert(null, properties.get("boolean.array"), null),
1) instanceof Boolean);
+
+        assertTrue(converter.convert(null, properties.get("number.array"), null).getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("number.array"), null),
0) instanceof Long);
+        assertTrue(Array.get(converter.convert(null, properties.get("number.array"), null),
1) instanceof Long);
+
+        assertTrue(converter.convert(null, properties.get("float.array"), null).getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("float.array"), null),
0) instanceof Double);
+        assertTrue(Array.get(converter.convert(null, properties.get("float.array"), null),
1) instanceof Double);
     }
 
     @Test public void testSimpleTypeConversionsWithTypeHint() throws Exception {
@@ -136,78 +136,78 @@ public class TypeConverterTest {
         final Map config = JSONUtil.parseJSON("a", JSONUtilTest.readJSON("json/simple-types.json"));
         final Map properties = (Map)config.get("config");
 
-        assertTrue(converter.convert(properties.get("string"), "String") instanceof String);
-        assertTrue(converter.convert(properties.get("boolean"), "Boolean") instanceof Boolean);
-        assertTrue(converter.convert(properties.get("boolean"), "boolean") instanceof Boolean);
-        assertTrue(converter.convert(properties.get("number"), "Integer") instanceof Integer);
-        assertTrue(converter.convert(properties.get("number"), "int") instanceof Integer);
-        assertTrue(converter.convert(properties.get("number"), "Long") instanceof Long);
-        assertTrue(converter.convert(properties.get("number"), "long") instanceof Long);
-        assertTrue(converter.convert(properties.get("float"), "Double") instanceof Double);
-        assertTrue(converter.convert(properties.get("float"), "double") instanceof Double);
-        assertTrue(converter.convert(properties.get("float"), "Float") instanceof Float);
-        assertTrue(converter.convert(properties.get("float"), "float") instanceof Float);
-        assertTrue(converter.convert(properties.get("number"), "Byte") instanceof Byte);
-        assertTrue(converter.convert(properties.get("number"), "byte") instanceof Byte);
-        assertTrue(converter.convert(properties.get("number"), "Short") instanceof Short);
-        assertTrue(converter.convert(properties.get("number"), "short") instanceof Short);
-        assertTrue(converter.convert(properties.get("string"), "Character") instanceof Character);
-        assertTrue(converter.convert(properties.get("string"), "char") instanceof Character);
+        assertTrue(converter.convert(null, properties.get("string"), "String") instanceof
String);
+        assertTrue(converter.convert(null, properties.get("boolean"), "Boolean") instanceof
Boolean);
+        assertTrue(converter.convert(null, properties.get("boolean"), "boolean") instanceof
Boolean);
+        assertTrue(converter.convert(null, properties.get("number"), "Integer") instanceof
Integer);
+        assertTrue(converter.convert(null, properties.get("number"), "int") instanceof Integer);
+        assertTrue(converter.convert(null, properties.get("number"), "Long") instanceof Long);
+        assertTrue(converter.convert(null, properties.get("number"), "long") instanceof Long);
+        assertTrue(converter.convert(null, properties.get("float"), "Double") instanceof
Double);
+        assertTrue(converter.convert(null, properties.get("float"), "double") instanceof
Double);
+        assertTrue(converter.convert(null, properties.get("float"), "Float") instanceof Float);
+        assertTrue(converter.convert(null, properties.get("float"), "float") instanceof Float);
+        assertTrue(converter.convert(null, properties.get("number"), "Byte") instanceof Byte);
+        assertTrue(converter.convert(null, properties.get("number"), "byte") instanceof Byte);
+        assertTrue(converter.convert(null, properties.get("number"), "Short") instanceof
Short);
+        assertTrue(converter.convert(null, properties.get("number"), "short") instanceof
Short);
+        assertTrue(converter.convert(null, properties.get("string"), "Character") instanceof
Character);
+        assertTrue(converter.convert(null, properties.get("string"), "char") instanceof Character);
 
         // arrays
-        assertTrue(converter.convert(properties.get("string.array"), "String[]").getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("string.array"), "String[]"),
0) instanceof String);
-        assertTrue(Array.get(converter.convert(properties.get("string.array"), "String[]"),
1) instanceof String);
-
-        assertTrue(converter.convert(properties.get("boolean.array"), "Boolean[]").getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("boolean.array"), "Boolean[]"),
0) instanceof Boolean);
-        assertTrue(Array.get(converter.convert(properties.get("boolean.array"), "Boolean[]"),
1) instanceof Boolean);
+        assertTrue(converter.convert(null, properties.get("string.array"), "String[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("string.array"), "String[]"),
0) instanceof String);
+        assertTrue(Array.get(converter.convert(null, properties.get("string.array"), "String[]"),
1) instanceof String);
+
+        assertTrue(converter.convert(null, properties.get("boolean.array"), "Boolean[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("boolean.array"), "Boolean[]"),
0) instanceof Boolean);
+        assertTrue(Array.get(converter.convert(null, properties.get("boolean.array"), "Boolean[]"),
1) instanceof Boolean);
 
         // the following would throw class cast exceptions
-        boolean[] a0 = (boolean[])converter.convert(properties.get("boolean.array"), "boolean[]");
+        boolean[] a0 = (boolean[])converter.convert(null, properties.get("boolean.array"),
"boolean[]");
         assertNotNull(a0);
-        int[] a1 = (int[])converter.convert(properties.get("number.array"), "int[]");
+        int[] a1 = (int[])converter.convert(null, properties.get("number.array"), "int[]");
         assertNotNull(a1);
-        long[] a2 = (long[])converter.convert(properties.get("number.array"), "long[]");
+        long[] a2 = (long[])converter.convert(null, properties.get("number.array"), "long[]");
         assertNotNull(a2);
-        double[] a3 = (double[])converter.convert(properties.get("float.array"), "double[]");
+        double[] a3 = (double[])converter.convert(null, properties.get("float.array"), "double[]");
         assertNotNull(a3);
-        float[] a4 = (float[])converter.convert(properties.get("float.array"), "float[]");
+        float[] a4 = (float[])converter.convert(null, properties.get("float.array"), "float[]");
         assertNotNull(a4);
-        byte[] a5 = (byte[])converter.convert(properties.get("number.array"), "byte[]");
+        byte[] a5 = (byte[])converter.convert(null, properties.get("number.array"), "byte[]");
         assertNotNull(a5);
-        short[] a6 = (short[])converter.convert(properties.get("number.array"), "short[]");
+        short[] a6 = (short[])converter.convert(null, properties.get("number.array"), "short[]");
         assertNotNull(a6);
-        char[] a7 = (char[])converter.convert(properties.get("string.array"), "char[]");
+        char[] a7 = (char[])converter.convert(null, properties.get("string.array"), "char[]");
         assertNotNull(a7);
 
-        assertTrue(converter.convert(properties.get("number.array"), "Integer[]").getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("number.array"), "Integer[]"),
0) instanceof Integer);
-        assertTrue(Array.get(converter.convert(properties.get("number.array"), "Integer[]"),
1) instanceof Integer);
-
-        assertTrue(converter.convert(properties.get("number.array"), "Long[]").getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("number.array"), "Long[]"),
0) instanceof Long);
-        assertTrue(Array.get(converter.convert(properties.get("number.array"), "Long[]"),
1) instanceof Long);
-
-        assertTrue(converter.convert(properties.get("number.array"), "Byte[]").getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("number.array"), "Byte[]"),
0) instanceof Byte);
-        assertTrue(Array.get(converter.convert(properties.get("number.array"), "Byte[]"),
1) instanceof Byte);
-
-        assertTrue(converter.convert(properties.get("number.array"), "Short[]").getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("number.array"), "Short[]"),
0) instanceof Short);
-        assertTrue(Array.get(converter.convert(properties.get("number.array"), "Short[]"),
1) instanceof Short);
-
-        assertTrue(converter.convert(properties.get("float.array"), "Float[]").getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("float.array"), "Float[]"),
0) instanceof Float);
-        assertTrue(Array.get(converter.convert(properties.get("float.array"), "Float[]"),
1) instanceof Float);
-
-        assertTrue(converter.convert(properties.get("float.array"), "Double[]").getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("float.array"), "Double[]"),
0) instanceof Double);
-        assertTrue(Array.get(converter.convert(properties.get("float.array"), "Double[]"),
1) instanceof Double);
-
-        assertTrue(converter.convert(properties.get("string.array"), "Character[]").getClass().isArray());
-        assertTrue(Array.get(converter.convert(properties.get("string.array"), "Character[]"),
0) instanceof Character);
-        assertTrue(Array.get(converter.convert(properties.get("string.array"), "Character[]"),
1) instanceof Character);
+        assertTrue(converter.convert(null, properties.get("number.array"), "Integer[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("number.array"), "Integer[]"),
0) instanceof Integer);
+        assertTrue(Array.get(converter.convert(null, properties.get("number.array"), "Integer[]"),
1) instanceof Integer);
+
+        assertTrue(converter.convert(null, properties.get("number.array"), "Long[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("number.array"), "Long[]"),
0) instanceof Long);
+        assertTrue(Array.get(converter.convert(null, properties.get("number.array"), "Long[]"),
1) instanceof Long);
+
+        assertTrue(converter.convert(null, properties.get("number.array"), "Byte[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("number.array"), "Byte[]"),
0) instanceof Byte);
+        assertTrue(Array.get(converter.convert(null, properties.get("number.array"), "Byte[]"),
1) instanceof Byte);
+
+        assertTrue(converter.convert(null, properties.get("number.array"), "Short[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("number.array"), "Short[]"),
0) instanceof Short);
+        assertTrue(Array.get(converter.convert(null, properties.get("number.array"), "Short[]"),
1) instanceof Short);
+
+        assertTrue(converter.convert(null, properties.get("float.array"), "Float[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("float.array"), "Float[]"),
0) instanceof Float);
+        assertTrue(Array.get(converter.convert(null, properties.get("float.array"), "Float[]"),
1) instanceof Float);
+
+        assertTrue(converter.convert(null, properties.get("float.array"), "Double[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("float.array"), "Double[]"),
0) instanceof Double);
+        assertTrue(Array.get(converter.convert(null, properties.get("float.array"), "Double[]"),
1) instanceof Double);
+
+        assertTrue(converter.convert(null, properties.get("string.array"), "Character[]").getClass().isArray());
+        assertTrue(Array.get(converter.convert(null, properties.get("string.array"), "Character[]"),
0) instanceof Character);
+        assertTrue(Array.get(converter.convert(null, properties.get("string.array"), "Character[]"),
1) instanceof Character);
     }
 
     @SuppressWarnings("unchecked")
@@ -216,31 +216,31 @@ public class TypeConverterTest {
         final Map config = JSONUtil.parseJSON("a", JSONUtilTest.readJSON("json/simple-types.json"));
         final Map properties = (Map)config.get("config");
 
-        assertTrue(converter.convert(properties.get("string.array"), "Collection<String>")
instanceof Collection<?>);
-        assertTrue(((Collection<String>)converter.convert(properties.get("string.array"),
"Collection<String>")).iterator().next() instanceof String);
+        assertTrue(converter.convert(null, properties.get("string.array"), "Collection<String>")
instanceof Collection<?>);
+        assertTrue(((Collection<String>)converter.convert(null, properties.get("string.array"),
"Collection<String>")).iterator().next() instanceof String);
 
-        assertTrue(converter.convert(properties.get("number.array"), "Collection<Integer>")
instanceof Collection<?>);
-        assertTrue(((Collection<Integer>)converter.convert(properties.get("number.array"),
"Collection<Integer>")).iterator().next() instanceof Integer);
+        assertTrue(converter.convert(null, properties.get("number.array"), "Collection<Integer>")
instanceof Collection<?>);
+        assertTrue(((Collection<Integer>)converter.convert(null, properties.get("number.array"),
"Collection<Integer>")).iterator().next() instanceof Integer);
 
-        assertTrue(converter.convert(properties.get("number.array"), "Collection<Long>")
instanceof Collection<?>);
-        assertTrue(((Collection<Long>)converter.convert(properties.get("number.array"),
"Collection<Long>")).iterator().next() instanceof Long);
+        assertTrue(converter.convert(null, properties.get("number.array"), "Collection<Long>")
instanceof Collection<?>);
+        assertTrue(((Collection<Long>)converter.convert(null, properties.get("number.array"),
"Collection<Long>")).iterator().next() instanceof Long);
 
-        assertTrue(converter.convert(properties.get("float.array"), "Collection<Float>")
instanceof Collection<?>);
-        assertTrue(((Collection<Float>)converter.convert(properties.get("float.array"),
"Collection<Float>")).iterator().next() instanceof Float);
+        assertTrue(converter.convert(null, properties.get("float.array"), "Collection<Float>")
instanceof Collection<?>);
+        assertTrue(((Collection<Float>)converter.convert(null, properties.get("float.array"),
"Collection<Float>")).iterator().next() instanceof Float);
 
-        assertTrue(converter.convert(properties.get("float.array"), "Collection<Double>")
instanceof Collection<?>);
-        assertTrue(((Collection<Double>)converter.convert(properties.get("float.array"),
"Collection<Double>")).iterator().next() instanceof Double);
+        assertTrue(converter.convert(null, properties.get("float.array"), "Collection<Double>")
instanceof Collection<?>);
+        assertTrue(((Collection<Double>)converter.convert(null, properties.get("float.array"),
"Collection<Double>")).iterator().next() instanceof Double);
 
-        assertTrue(converter.convert(properties.get("number.array"), "Collection<Short>")
instanceof Collection<?>);
-        assertTrue(((Collection<Short>)converter.convert(properties.get("number.array"),
"Collection<Short>")).iterator().next() instanceof Short);
+        assertTrue(converter.convert(null, properties.get("number.array"), "Collection<Short>")
instanceof Collection<?>);
+        assertTrue(((Collection<Short>)converter.convert(null, properties.get("number.array"),
"Collection<Short>")).iterator().next() instanceof Short);
 
-        assertTrue(converter.convert(properties.get("number.array"), "Collection<Byte>")
instanceof Collection<?>);
-        assertTrue(((Collection<Byte>)converter.convert(properties.get("number.array"),
"Collection<Byte>")).iterator().next() instanceof Byte);
+        assertTrue(converter.convert(null, properties.get("number.array"), "Collection<Byte>")
instanceof Collection<?>);
+        assertTrue(((Collection<Byte>)converter.convert(null, properties.get("number.array"),
"Collection<Byte>")).iterator().next() instanceof Byte);
 
-        assertTrue(converter.convert(properties.get("string.array"), "Collection<Character>")
instanceof Collection<?>);
-        assertTrue(((Collection<Character>)converter.convert(properties.get("string.array"),
"Collection<Character>")).iterator().next() instanceof Character);
+        assertTrue(converter.convert(null, properties.get("string.array"), "Collection<Character>")
instanceof Collection<?>);
+        assertTrue(((Collection<Character>)converter.convert(null, properties.get("string.array"),
"Collection<Character>")).iterator().next() instanceof Character);
 
-        assertTrue(converter.convert(properties.get("boolean.array"), "Collection<Boolean>")
instanceof Collection<?>);
-        assertTrue(((Collection<Boolean>)converter.convert(properties.get("boolean.array"),
"Collection<Boolean>")).iterator().next() instanceof Boolean);
+        assertTrue(converter.convert(null, properties.get("boolean.array"), "Collection<Boolean>")
instanceof Collection<?>);
+        assertTrue(((Collection<Boolean>)converter.convert(null, properties.get("boolean.array"),
"Collection<Boolean>")).iterator().next() instanceof Boolean);
     }
 }



Mime
View raw message