FELIX-2097 do not return an empty locale name from the DefaultMetaTypeProvider.getLocales() method
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@911325 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/metatype/src/main/java/org/apache/felix/metatype/DefaultMetaTypeProvider.java b/metatype/src/main/java/org/apache/felix/metatype/DefaultMetaTypeProvider.java
index fa4118c..3ce1e2d 100644
--- a/metatype/src/main/java/org/apache/felix/metatype/DefaultMetaTypeProvider.java
+++ b/metatype/src/main/java/org/apache/felix/metatype/DefaultMetaTypeProvider.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -32,7 +32,6 @@
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.service.metatype.MetaTypeProvider;
-import org.osgi.service.metatype.MetaTypeService;
import org.osgi.service.metatype.ObjectClassDefinition;
@@ -43,7 +42,7 @@
* <p>
* This class may be used by clients, e.g. <code>ManagedService</code> or
* <code>ManagedServiceFactory</code> implementations to easily also implement
- * the <code>MetaTypeProvider</code> interface.
+ * the <code>MetaTypeProvider</code> interface.
*
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
@@ -52,7 +51,7 @@
private final Bundle bundle;
private final String localePrefix;
-
+
private Map objectClassDefinitions;
private Map designates;
private Map locales;
@@ -137,7 +136,9 @@
{
name = name.substring( 1 );
}
- locales.put( name, url );
+ if (name.length() > 0) {
+ locales.put( name, url );
+ }
}
}
@@ -178,7 +179,7 @@
{
return ( Designate ) designates.get( pid );
}
-
+
protected Map getObjectClassDefinitions()
{
return objectClassDefinitions;