FELIX-3793 :  Property of type Character must use unicode value 

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1415581 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/Validator.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/Validator.java
index 4dc8f48..5267b23 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/Validator.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/Validator.java
@@ -375,6 +375,21 @@
                             && property.getType() == PropertyType.Char) {
                 property.setType(PropertyType.Character);
             }
+            // check character property value
+            if ( property.getType() == PropertyType.Char || property.getType() == PropertyType.Character ) {
+                if ( property.getValue() != null ) {
+                    if ( property.getValue().length() != 1 ) {
+                        this.logError(property, "Value is not a character: " + property.getValue());
+                    }
+                }
+                if ( property.getMultiValue() != null ) {
+                    for(final String value : property.getMultiValue() ) {
+                        if ( value.length() != 1 ) {
+                            this.logError(property, "Value is not a character: " + value);
+                        }
+                    }
+                }
+            }
         }
         // TODO might want to check value
     }
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
index fe6ba6a..e520db1 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/xml/ComponentDescriptorIO.java
@@ -339,7 +339,13 @@
         if ( property.getType() != PropertyType.String ) {
             IOUtils.addAttribute(ai, PROPERTY_ATTR_TYPE, property.getType());
         }
-        IOUtils.addAttribute(ai, PROPERTY_ATTR_VALUE, property.getValue());
+        String value = property.getValue();
+        if ( value != null ) {
+            if ( property.getType() == PropertyType.Character || property.getType() == PropertyType.Char ) {
+                value = String.valueOf((int)value.charAt(0));
+            }
+            IOUtils.addAttribute(ai, PROPERTY_ATTR_VALUE, value);
+        }
 
         IOUtils.indent(contentHandler, 2);
         contentHandler.startElement(INNER_NAMESPACE_URI, ComponentDescriptorIO.PROPERTY, ComponentDescriptorIO.PROPERTY_QNAME, ai);
@@ -348,7 +354,11 @@
             IOUtils.text(contentHandler, "\n");
             for (int i = 0; i < property.getMultiValue().length; i++) {
                 IOUtils.indent(contentHandler, 3);
-                IOUtils.text(contentHandler, property.getMultiValue()[i]);
+                value = property.getMultiValue()[i];
+                if ( property.getType() == PropertyType.Character || property.getType() == PropertyType.Char ) {
+                    value = String.valueOf((int)value.charAt(0));
+                }
+                IOUtils.text(contentHandler, value);
                 IOUtils.newline(contentHandler);
             }
             IOUtils.indent(contentHandler, 2);