Author: fmeschbe Date: Mon Jan 19 02:57:03 2009 New Revision: 735656 URL: http://svn.apache.org/viewvc?rev=735656&view=rev Log: SLING-833 Accept Collection values and do not require Vector values
Modified: incubator/sling/trunk/commons/osgi/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java Modified: incubator/sling/trunk/commons/osgi/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java URL: http://svn.apache.org/viewvc/incubator/sling/trunk/commons/osgi/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java?rev=735656&r1=735655&r2=735656&view=diff ============================================================================== --- incubator/sling/trunk/commons/osgi/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java (original) +++ incubator/sling/trunk/commons/osgi/src/main/java/org/apache/sling/commons/osgi/OsgiUtil.java Mon Jan 19 02:57:03 2009 @@ -19,11 +19,11 @@ package org.apache.sling.commons.osgi; import java.util.ArrayList; +import java.util.Collection; import java.util.Dictionary; import java.util.Hashtable; import java.util.List; import java.util.Map; -import java.util.Vector; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceReference; @@ -140,9 +140,9 @@ } else if (propValue.getClass().isArray()) { Object[] prop = (Object[]) propValue; return prop.length > 0 ? prop[0] : null; - } else if (propValue instanceof Vector) { - Vector<?> prop = (Vector<?>) propValue; - return prop.isEmpty() ? null : prop.get(0); + } else if (propValue instanceof Collection) { + Collection<?> prop = (Collection<?>) propValue; + return prop.isEmpty() ? null : prop.iterator().next(); } else { return propValue; } @@ -195,9 +195,9 @@ } return values.toArray(new String[values.size()]); - } else if (propValue instanceof Vector) { + } else if (propValue instanceof Collection) { // vector - Vector<?> valueVector = (Vector<?>) propValue; + Collection<?> valueVector = (Collection<?>) propValue; List<String> values = new ArrayList<String>(valueVector.size()); for (Object value : valueVector) { if (value != null) {