Fixed small bug in the meta type service: when reading meta type resources the content of an attribute tag was incorrectly split on comma's when it was provided in one or more value child tags instead of in the content argument of the attribute tag itself.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@663149 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/metatype/src/main/java/org/apache/felix/metatype/Attribute.java b/metatype/src/main/java/org/apache/felix/metatype/Attribute.java
index 81a5bc1..2aa3a63 100644
--- a/metatype/src/main/java/org/apache/felix/metatype/Attribute.java
+++ b/metatype/src/main/java/org/apache/felix/metatype/Attribute.java
@@ -23,7 +23,7 @@
* The <code>Attribute</code> TODO
*
* @author fmeschbe
- * @version $Rev:$, $Date:$
+ * @version $Rev$, $Date$
*/
public class Attribute
{
@@ -63,16 +63,25 @@
String[] newContent = new String[content.length + added.length];
System.arraycopy( content, 0, newContent, 0, content.length );
System.arraycopy( added, 0, newContent, content.length, added.length );
+ content = newContent;
}
}
}
- public void addContent( String content )
+ public void addContent( String content, boolean split )
{
if ( content != null )
{
- addContent( AD.splitList( content ) );
+ if ( split )
+ {
+ addContent( AD.splitList( content ) );
+ }
+ else
+ {
+ addContent( new String[] { content } );
+ }
}
}
+
}
diff --git a/metatype/src/main/java/org/apache/felix/metatype/MetaDataReader.java b/metatype/src/main/java/org/apache/felix/metatype/MetaDataReader.java
index eb1dfb5..10be489 100644
--- a/metatype/src/main/java/org/apache/felix/metatype/MetaDataReader.java
+++ b/metatype/src/main/java/org/apache/felix/metatype/MetaDataReader.java
@@ -365,7 +365,7 @@
{
Attribute ah = this.createAttribute();
ah.setAdRef( this.getRequiredAttribute( "adref" ) );
- ah.addContent( this.getOptionalAttribute( "content" ) );
+ ah.addContent( this.getOptionalAttribute( "content" ), true );
int eventType = this.parser.next();
while ( eventType != XmlPullParser.END_DOCUMENT )
@@ -374,7 +374,7 @@
{
if ( "Value".equals( this.parser.getName() ) )
{
- ah.addContent( this.parser.nextText() );
+ ah.addContent( this.parser.nextText(), false );
eventType = this.parser.getEventType();
continue;
}