geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r769584 - in /geronimo/sandbox/blueprint/blueprint-core/src: main/java/org/apache/geronimo/blueprint/context/ main/java/org/apache/geronimo/blueprint/convert/ test/java/org/apache/geronimo/blueprint/convert/
Date Tue, 28 Apr 2009 23:13:07 GMT
Author: gawor
Date: Tue Apr 28 23:13:07 2009
New Revision: 769584

URL: http://svn.apache.org/viewvc?rev=769584&view=rev
Log:
handle \uXXXX syntax for conversion to characters

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/convert/ConversionServiceImplTest.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java?rev=769584&r1=769583&r2=769584&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
Tue Apr 28 23:13:07 2009
@@ -355,7 +355,6 @@
             }
         }
         Map instances = objectGraph.createAll(components);
-        System.out.println("Component instances: " + instances);
     }
 
     private void destroyComponents() {

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java?rev=769584&r1=769583&r2=769584&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/convert/ConversionServiceImpl.java
Tue Apr 28 23:13:07 2009
@@ -17,6 +17,7 @@
 package org.apache.geronimo.blueprint.convert;
 
 import java.io.ByteArrayInputStream;
+import java.io.StringReader;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Modifier;
@@ -161,7 +162,10 @@
         } else if (Double.class == toType || double.class == toType) {
             return Double.valueOf(value);
         } else if (Character.class == toType || char.class == toType) {
-            if (value.length() == 1) {
+            if (value.length() == 6 && value.startsWith("\\u")) {
+                int code = Integer.parseInt(value.substring(2), 16);
+                return (char)code;
+            } else if (value.length() == 1) {
                 return Character.valueOf(value.charAt(0));
             } else {
                 throw new Exception("Invalid value for character type: " + value);

Modified: geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/convert/ConversionServiceImplTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/convert/ConversionServiceImplTest.java?rev=769584&r1=769583&r2=769584&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/convert/ConversionServiceImplTest.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/convert/ConversionServiceImplTest.java
Tue Apr 28 23:13:07 2009
@@ -53,9 +53,8 @@
     public void testConvertCharacter() throws Exception {
         assertEquals('c', service.convert("c", char.class));
         assertEquals('c', service.convert("c", Character.class));
-        // TODO: check the following tests
-//        assertEquals('\n', service.convert("\\n", char.class));
-//        assertEquals('\n', service.convert("\\n", Character.class));
+        assertEquals('\u00F6', service.convert("\\u00F6", char.class));
+        assertEquals('\u00F6', service.convert("\\u00F6", Character.class));
     }
 
     public void testConvertBoolean() throws Exception {



Mime
View raw message