sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1768292 - in /sling/trunk/installer/factories/configuration: pom.xml src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigUtil.java
Date Sun, 06 Nov 2016 08:46:36 GMT
Author: cziegeler
Date: Sun Nov  6 08:46:35 2016
New Revision: 1768292

URL: http://svn.apache.org/viewvc?rev=1768292&view=rev
Log:
SLING-6247 : Potential class cast exception for primitive arrays

Modified:
    sling/trunk/installer/factories/configuration/pom.xml
    sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigUtil.java

Modified: sling/trunk/installer/factories/configuration/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/installer/factories/configuration/pom.xml?rev=1768292&r1=1768291&r2=1768292&view=diff
==============================================================================
--- sling/trunk/installer/factories/configuration/pom.xml (original)
+++ sling/trunk/installer/factories/configuration/pom.xml Sun Nov  6 08:46:35 2016
@@ -48,18 +48,9 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
-                        <Import-Package>
-                            !org.apache.commons.lang3.builder,
-                            !org.apache.commons.lang3.math,
-                            !org.apache.commons.lang3.mutable,
-                            *
-                        </Import-Package>
                         <Bundle-Activator>
                             org.apache.sling.installer.factories.configuration.impl.Activator
                         </Bundle-Activator>
-                        <Embed-Dependency>
-                            commons-lang3;inline="org/apache/commons/lang3/ArrayUtils.*"
-                        </Embed-Dependency>
                     </instructions>
                 </configuration>
             </plugin>
@@ -91,12 +82,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-            <version>3.5</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.installer.core</artifactId>
             <version>3.7.1-SNAPSHOT</version>

Modified: sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigUtil.java?rev=1768292&r1=1768291&r2=1768292&view=diff
==============================================================================
--- sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigUtil.java
(original)
+++ sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigUtil.java
Sun Nov  6 08:46:35 2016
@@ -19,13 +19,13 @@
 package org.apache.sling.installer.factories.configuration.impl;
 
 import java.io.IOException;
+import java.lang.reflect.Array;
 import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.Set;
 
-import org.apache.commons.lang3.ArrayUtils;
 import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.service.cm.Configuration;
@@ -80,25 +80,9 @@ abstract class ConfigUtil {
      * @return an object array
      */
     private static Object[] convertToObjectArray(final Object value) {
-        final Object[] values;
-        if (value instanceof long[]) {
-            values = ArrayUtils.toObject((long[])value);
-        } else if (value instanceof int[]) {
-            values = ArrayUtils.toObject((int[])value);
-        } else if (value instanceof double[]) {
-            values = ArrayUtils.toObject((double[])value);
-        } else if (value instanceof byte[]) {
-            values = ArrayUtils.toObject((byte[])value);
-        } else if (value instanceof float[]) {
-            values = ArrayUtils.toObject((float[])value);
-        } else if (value instanceof short[]) {
-            values = ArrayUtils.toObject((short[])value);
-        } else if (value instanceof boolean[]) {
-            values = ArrayUtils.toObject((boolean[])value);
-        } else if (value instanceof char[]) {
-            values = ArrayUtils.toObject((char[])value);
-        } else {
-            values = (Object[]) value;
+        final Object[] values = new Object[Array.getLength(value)];
+        for(int i=0;i<values.length;i++) {
+            values[i] = Array.get(value, i);
         }
         return values;
     }



Mime
View raw message