[FELIX-4512] Fix possible NPE
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1596856 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java
index ba6ec27..0a46a26 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java
@@ -163,18 +163,21 @@
}
xmlWriter.startElement( "attributes" );
- for ( Entry<String, String> attribute : attributes.entrySet() )
+ if (attributes != null)
{
- String attributeName = attribute.getKey();
- if ( ':' == attributeName.charAt( attributeName.length() - 1 ) )
+ for (Entry<String, String> attribute : attributes.entrySet())
{
- attributeName = attributeName.substring( 0, attributeName.length() - 1 );
- }
- String attributeValue = attribute.getValue();
+ String attributeName = attribute.getKey();
+ if (':' == attributeName.charAt(attributeName.length() - 1))
+ {
+ attributeName = attributeName.substring(0, attributeName.length() - 1);
+ }
+ String attributeValue = attribute.getValue();
- xmlWriter.startElement( attributeName );
- xmlWriter.writeText( attributeValue );
- xmlWriter.endElement();
+ xmlWriter.startElement(attributeName);
+ xmlWriter.writeText(attributeValue);
+ xmlWriter.endElement();
+ }
}
xmlWriter.endElement();
}