cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r772668 - in /cxf/branches/2.1.x-fixes: ./ common/common/src/main/java/org/apache/cxf/configuration/spring/ common/common/src/main/java/org/apache/cxf/helpers/ common/common/src/main/java/org/apache/cxf/staxutils/ rt/bindings/http/src/main/...
Date Thu, 07 May 2009 14:49:59 GMT
Author: dkulp
Date: Thu May  7 14:49:57 2009
New Revision: 772668

URL: http://svn.apache.org/viewvc?rev=772668&view=rev
Log:
Merged revisions 772402 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r772402 | dkulp | 2009-05-06 14:55:25 -0400 (Wed, 06 May 2009) | 3 lines
  
  [CXF-2205] Fix issues with Aegis trimming strings
  Also fix potential problems with DOMUtils.getContent(..) not returning all the content
........

Added:
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/ServerPasswordCallback.java
      - copied unchanged from r772402, cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/ServerPasswordCallback.java
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
    cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
    cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
    cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
    cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigIntegerType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ByteType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/CalendarType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateTimeType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ShortType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimeType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimestampType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimezoneLessDateType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/URIType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/DurationType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/EnumType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/XMLGregorianCalendarType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType1.xml
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType2.xml
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType1.xml
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType2.xml
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsImpl.java
    cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsTest.java
    cxf/branches/2.1.x-fixes/systests/src/test/resources/aegisJaxWsBeans.xml

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May  7 14:49:57 2009
@@ -1 +1 @@
-/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143
+/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
(original)
+++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
Thu May  7 14:49:57 2009
@@ -28,7 +28,7 @@
 
     @Override
     protected void doParse(Element element, BeanDefinitionBuilder builder) {
-        builder.addConstructorArg(DOMUtils.getContent(element));
+        builder.addConstructorArg(DOMUtils.getRawContent(element));
     }
 
     @Override

Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
(original)
+++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
Thu May  7 14:49:57 2009
@@ -46,6 +46,7 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
+import org.w3c.dom.Text;
 
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
@@ -93,17 +94,11 @@
      * Get the trimmed text content of a node or null if there is no text
      */
     public static String getContent(Node n) {
-        if (n == null) {
-            return null;
+        String s = getRawContent(n);
+        if (s != null) {
+            s = s.trim();
         }
-
-        Node n1 = DOMUtils.getChild(n, Node.TEXT_NODE);
-
-        if (n1 == null) {
-            return null;
-        }
-
-        return n1.getNodeValue().trim();
+        return s;
     }
 
     /**
@@ -113,14 +108,26 @@
         if (n == null) {
             return null;
         }
-
-        Node n1 = DOMUtils.getChild(n, Node.TEXT_NODE);
-
-        if (n1 == null) {
-            return null;
+        StringBuilder b = null;
+        String s = null;
+        Node n1 = n.getFirstChild();
+        while (n1 != null) {
+            if (n1.getNodeType() == Node.TEXT_NODE) {
+                if (b != null) {
+                    b.append(((Text)n1).getNodeValue());
+                } else if (s == null) {
+                    s = ((Text)n1).getNodeValue();
+                } else {
+                    b = new StringBuilder(s);
+                    s = null;
+                }
+            }
+            n1 = n1.getNextSibling();
         }
-
-        return n1.getNodeValue();
+        if (b != null) {
+            return b.toString();
+        }
+        return s;
     }
 
     /**
@@ -234,7 +241,7 @@
             // System.out.println("getNode: " + name + " " +
             // node.getNodeName());
             if (name.equals(node.getNodeName())) {
-                return getContent(node);
+                return getRawContent(node);
             }
         }
         return null;

Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
(original)
+++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
Thu May  7 14:49:57 2009
@@ -175,7 +175,7 @@
 
     @Override
     public String getElementText() throws XMLStreamException {
-        String result = DOMUtils.getContent(content);
+        String result = DOMUtils.getRawContent(content);
 
         ElementFrame<Node, Node> frame = getCurrentFrame();
         frame.ended = true;
@@ -216,8 +216,7 @@
         if (at == null) {
             return null;
         }
-
-        return DOMUtils.getContent(at);
+        return at.getNodeValue();
     }
 
     public int getAttributeCount() {

Modified: cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
Thu May  7 14:49:57 2009
@@ -92,7 +92,7 @@
                     Node node = root.getFirstChild();
                     while (node != null) {
                         if (node.getNodeType() == Node.ELEMENT_NODE && name.equals(node.getLocalName()))
{
-                            builder.append(DOMUtils.getContent(node));
+                            builder.append(DOMUtils.getRawContent(node));
                             break;
                         }   
                         node = node.getNextSibling();

Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java Thu
May  7 14:49:57 2009
@@ -141,7 +141,7 @@
                                            + writeNodeToString(node));
         }
 
-        String value2 = DOMUtils.getContent(result).trim();
+        String value2 = DOMUtils.getContent(result);
 
         Assert.assertEquals(value, value2);
     }

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java
Thu May  7 14:49:57 2009
@@ -39,7 +39,7 @@
     public Object readObject(final MessageReader reader, final Context context) {
         final String value = reader.getValue();
 
-        return null == value ? null : new BigDecimal(value);
+        return null == value ? null : new BigDecimal(value.trim());
     }
 
     @Override

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigIntegerType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigIntegerType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigIntegerType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigIntegerType.java
Thu May  7 14:49:57 2009
@@ -39,7 +39,7 @@
     public Object readObject(final MessageReader reader, final Context context) {
         final String value = reader.getValue();
 
-        return null == value ? null : new BigInteger(value);
+        return null == value ? null : new BigInteger(value.trim());
     }
 
     @Override

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ByteType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ByteType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ByteType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ByteType.java
Thu May  7 14:49:57 2009
@@ -31,7 +31,7 @@
 public class ByteType extends Type {
     @Override
     public Object readObject(MessageReader reader, Context context) {
-        return new Byte(reader.getValue());
+        return new Byte(reader.getValue().trim());
     }
 
     @Override

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/CalendarType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/CalendarType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/CalendarType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/CalendarType.java
Thu May  7 14:49:57 2009
@@ -44,7 +44,7 @@
         }
 
         try {
-            return format.parseObject(value);
+            return format.parseObject(value.trim());
         } catch (ParseException e) {
             throw new DatabindingException("Could not parse xs:dateTime: " + e.getMessage(),
e);
         }

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateTimeType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateTimeType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateTimeType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateTimeType.java
Thu May  7 14:49:57 2009
@@ -51,7 +51,7 @@
         }
 
         try {
-            return ((Calendar)format.parseObject(value)).getTime();
+            return ((Calendar)format.parseObject(value.trim())).getTime();
         } catch (ParseException e) {
             throw new DatabindingException("Could not parse xs:dateTime: " + e.getMessage(),
e);
         }

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateType.java
Thu May  7 14:49:57 2009
@@ -47,7 +47,7 @@
         }
 
         try {
-            return ((Calendar)format.parseObject(value)).getTime();
+            return ((Calendar)format.parseObject(value.trim())).getTime();
         } catch (ParseException e) {
             throw new DatabindingException("Could not parse xs:dat: " + e.getMessage(), e);
         }

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
Thu May  7 14:49:57 2009
@@ -99,6 +99,7 @@
             throw new DatabindingException("Missing 'xsi:type' attribute value");
         }
 
+        typeName = typeName.trim();
         Type type = null;
         QName typeQName = null;
         if (typeName != null) {
@@ -152,7 +153,8 @@
     private Object reconstituteJavaObject(MessageReader reader) throws DatabindingException
{
 
         try {
-            ByteArrayInputStream in = new ByteArrayInputStream(Base64Utility.decode(reader.getValue()));
+            ByteArrayInputStream in = new ByteArrayInputStream(Base64Utility
+                                                                   .decode(reader.getValue().trim()));
             return new ObjectInputStream(in).readObject();
         } catch (Exception e) {
             throw new DatabindingException("Unable to reconstitute serialized object", e);
@@ -160,7 +162,7 @@
     }
 
     private boolean isNil(MessageReader reader) {
-        return null != reader && "true".equals(reader.getValue());
+        return null != reader && "true".equals(reader.getValue() == null ? "" : reader.getValue());
     }
 
     @Override

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ShortType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ShortType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ShortType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ShortType.java
Thu May  7 14:49:57 2009
@@ -29,7 +29,7 @@
 public class ShortType extends Type {
     @Override
     public Object readObject(MessageReader reader, Context context) {
-        return new Short(reader.getValue());
+        return new Short(reader.getValue().trim());
     }
 
     @Override

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimeType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimeType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimeType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimeType.java
Thu May  7 14:49:57 2009
@@ -46,7 +46,7 @@
         }
 
         try {
-            Calendar c = (Calendar)format.parseObject(value);
+            Calendar c = (Calendar)format.parseObject(value.trim());
             return new Time(c.getTimeInMillis());
         } catch (ParseException e) {
             throw new DatabindingException("Could not parse xs:dateTime: " + e.getMessage(),
e);

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimestampType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimestampType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimestampType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimestampType.java
Thu May  7 14:49:57 2009
@@ -46,7 +46,7 @@
         }
 
         try {
-            Calendar c = (Calendar)format.parseObject(value);
+            Calendar c = (Calendar)format.parseObject(value.trim());
             return new Timestamp(c.getTimeInMillis());
         } catch (ParseException e) {
             throw new DatabindingException("Could not parse xs:dateTime: " + e.getMessage(),
e);

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimezoneLessDateType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimezoneLessDateType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimezoneLessDateType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimezoneLessDateType.java
Thu May  7 14:49:57 2009
@@ -47,7 +47,7 @@
         }
 
         try {
-            return ((Calendar)format.parseObject(value)).getTime();
+            return ((Calendar)format.parseObject(value.trim())).getTime();
         } catch (ParseException e) {
             throw new DatabindingException("Could not parse xs:date: " + e.getMessage(),
e);
         }

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/URIType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/URIType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/URIType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/URIType.java
Thu May  7 14:49:57 2009
@@ -35,7 +35,7 @@
     public Object readObject(final MessageReader reader, final Context context) {
         final String value = reader.getValue();
 
-        return null == value ? null : URI.create(value);
+        return null == value ? null : URI.create(value.trim());
     }
 
     @Override

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/DurationType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/DurationType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/DurationType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/DurationType.java
Thu May  7 14:49:57 2009
@@ -46,7 +46,7 @@
 
     @Override
     public Object readObject(MessageReader reader, Context context) {
-        return dtFactory.newDuration(reader.getValue());
+        return dtFactory.newDuration(reader.getValue().trim());
     }
 
     @Override

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/EnumType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/EnumType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/EnumType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/EnumType.java
Thu May  7 14:49:57 2009
@@ -34,7 +34,7 @@
     public Object readObject(MessageReader reader, Context context) {
         String value = reader.getValue();
 
-        return Enum.valueOf(getTypeClass(), value);
+        return Enum.valueOf(getTypeClass(), value.trim());
     }
 
     @Override

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/XMLGregorianCalendarType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/XMLGregorianCalendarType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/XMLGregorianCalendarType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/XMLGregorianCalendarType.java
Thu May  7 14:49:57 2009
@@ -46,7 +46,7 @@
 
     @Override
     public Object readObject(MessageReader reader, Context context) {
-        return dtFactory.newXMLGregorianCalendar(reader.getValue());
+        return dtFactory.newXMLGregorianCalendar(reader.getValue().trim());
     }
 
     @Override

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
Thu May  7 14:49:57 2009
@@ -104,7 +104,7 @@
             MessageReader child = reader.getNextElementReader();
             if (child.getName().equals(XOP_INCLUDE)) {
                 MessageReader mimeReader = child.getAttributeReader(XOP_HREF);
-                String type = mimeReader.getValue();
+                String type = mimeReader.getValue().trim();
                 o = readInclude(type, child, context);
             }
             child.readToEnd();
@@ -137,7 +137,7 @@
     
     private Object readInclude(String type, MessageReader reader,
                               Context context) throws DatabindingException {
-        String href = reader.getAttributeReader(XOP_HREF).getValue();
+        String href = reader.getAttributeReader(XOP_HREF).getValue().trim();
 
         Attachment att = AttachmentUtil.getAttachment(href, context.getAttachments());
 

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java
Thu May  7 14:49:57 2009
@@ -50,7 +50,7 @@
         boolean nil = false;
         if (nilReader != null) {
             String value = nilReader.getValue();
-            if (value != null && (value.equals("true") || value.equals("1"))) {
+            if (value != null && (value.trim().equals("true") || value.trim().equals("1")))
{
                 return true;
             }
         }
@@ -77,7 +77,7 @@
             return 0;
         }
 
-        return Integer.parseInt(getValue());
+        return Integer.parseInt(getValue().trim());
     }
 
     /**
@@ -88,7 +88,7 @@
             return 0L;
         }
 
-        return Long.parseLong(getValue());
+        return Long.parseLong(getValue().trim());
     }
 
     /**
@@ -99,7 +99,7 @@
             return 0d;
         }
 
-        return Double.parseDouble(getValue());
+        return Double.parseDouble(getValue().trim());
     }
 
     /**
@@ -110,7 +110,7 @@
             return 0f;
         }
 
-        return Float.parseFloat(getValue());
+        return Float.parseFloat(getValue().trim());
     }
 
     /**
@@ -121,7 +121,7 @@
         if (value == null) {
             return false;
         }
-
+        value = value.trim();
         if ("true".equalsIgnoreCase(value) || "1".equalsIgnoreCase(value)) {
             return true;
         }

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
Thu May  7 14:49:57 2009
@@ -141,8 +141,6 @@
             
             if (value == null) {
                 value = "";
-            } else {
-                value = value.trim();
             }
         }
         return value;

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType1.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType1.xml?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType1.xml
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType1.xml
Thu May  7 14:49:57 2009
@@ -25,7 +25,5 @@
 
   <thing xsi:type="xsd:int">42</thing>
   <thing xsi:type="xsd:float">42.42</thing>
-  <thing xsi:type="xsd:string">
-    Forty Two
-  </thing>
+  <thing xsi:type="xsd:string">Forty Two</thing>
 </b:numbers>

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType2.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType2.xml?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType2.xml
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType2.xml
Thu May  7 14:49:57 2009
@@ -25,7 +25,5 @@
 
   <soapenc:int>42</soapenc:int>
   <soapenc:decimal>42.42</soapenc:decimal>
-  <xsd:string>
-    Forty Two
-  </xsd:string>
+  <xsd:string>Forty Two</xsd:string>
 </b:numbers>

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType1.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType1.xml?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType1.xml
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType1.xml
Thu May  7 14:49:57 2009
@@ -25,7 +25,5 @@
 
   <thing xsi:type="xsd:int">42</thing>
   <thing xsi:type="xsd:float">42.42</thing>
-  <thing xsi:type="xsd:string">
-    Forty Two
-  </thing>
+  <thing xsi:type="xsd:string">Forty Two</thing>
 </b:numbers>

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType2.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType2.xml?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType2.xml
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType2.xml
Thu May  7 14:49:57 2009
@@ -25,7 +25,5 @@
 
   <soapenc:int>42</soapenc:int>
   <soapenc:decimal>42.42</soapenc:decimal>
-  <xsd:string>
-    Forty Two
-  </xsd:string>
+  <xsd:string>Forty Two</xsd:string>
 </b:numbers>

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsImpl.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsImpl.java
(original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsImpl.java
Thu May  7 14:49:57 2009
@@ -47,7 +47,7 @@
     public Item getItemByKey(String key1, String key2) {
         Item fake = new Item();
         fake.setKey(new Integer(33));
-        fake.setData("and a third");
+        fake.setData(key1 + ":" + key2);
         return fake;
     }
     

Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsTest.java?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsTest.java
(original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsTest.java
Thu May  7 14:49:57 2009
@@ -19,12 +19,15 @@
 
 package org.apache.cxf.systest.aegis;
 
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.cxf.aegis.databinding.AegisDatabinding;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.systest.aegis.bean.Item;
+import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
+
 import org.junit.Test;
 import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
 
@@ -43,26 +46,46 @@
         return new String[] {"classpath:aegisJaxWsBeans.xml"};
     }
     
-    private void setupForTest() throws Exception {
+    private void setupForTest(boolean sec) throws Exception {
         
         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
         factory.setServiceClass(AegisJaxWs.class);
-        factory.setAddress("http://localhost:9167/aegisJaxWs");
+        if (sec) {
+            factory.setAddress("http://localhost:9167/aegisJaxWsUN");
+            WSS4JOutInterceptor wss4jOut = new WSS4JOutInterceptor();
+            wss4jOut.setProperty("action", "UsernameToken");
+            wss4jOut.setProperty("user", "alice");
+            wss4jOut.setProperty("password", "pass");
+            
+            factory.setProperties(new HashMap<String, Object>());
+            factory.getProperties().put("password", "pass");
+            factory.getOutInterceptors().add(wss4jOut);
+        } else {
+            factory.setAddress("http://localhost:9167/aegisJaxWs");            
+        }
         factory.getServiceFactory().setDataBinding(new AegisDatabinding());
 
         client = (AegisJaxWs)factory.create();
     }
     
     @Test
-    public void testGetItem() throws Exception {
-        setupForTest();
-        Item item = client.getItemByKey("a", "b");
+    public void testGetItemSecure() throws Exception {
+        setupForTest(true);
+        Item item = client.getItemByKey("   jack&jill   ", "b");
         assertEquals(33, item.getKey().intValue());
+        assertEquals("   jack&jill   :b", item.getData());
     }
     
+    @Test
+    public void testGetItem() throws Exception {
+        setupForTest(false);
+        Item item = client.getItemByKey(" a ", "b");
+        assertEquals(33, item.getKey().intValue());
+        assertEquals(" a :b", item.getData());
+    }
     @Test 
     public void testMapSpecified() throws Exception {
-        setupForTest();
+        setupForTest(false);
         Item item = new Item();
         item.setKey(new Integer(42));
         item.setData("Godzilla");
@@ -78,4 +101,5 @@
         assertEquals(42, key2.intValue());
         assertEquals("Godzilla", item2.getData());
     }
+    
 }

Modified: cxf/branches/2.1.x-fixes/systests/src/test/resources/aegisJaxWsBeans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/resources/aegisJaxWsBeans.xml?rev=772668&r1=772667&r2=772668&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/systests/src/test/resources/aegisJaxWsBeans.xml (original)
+++ cxf/branches/2.1.x-fixes/systests/src/test/resources/aegisJaxWsBeans.xml Thu May  7 14:49:57
2009
@@ -60,4 +60,33 @@
 				class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
 		</jaxws:inInterceptors>
 	</jaxws:endpoint>
+	
+	
+	<bean id="myPasswordCallback"
+		class="org.apache.cxf.systest.aegis.ServerPasswordCallback"/>
+	
+	<jaxws:endpoint id="aegisRPCImplUN" implementor="#impl"
+		address="http://localhost:9167/aegisJaxWsUN">
+		<jaxws:serviceFactory>
+			<ref bean='jaxws-and-aegis-service-factory' />
+		</jaxws:serviceFactory>
+		
+		<jaxws:inInterceptors>
+  			<bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+	     		<constructor-arg>
+	        		<map>
+	           			<entry key="action" value="UsernameToken"/>
+	           			<entry key="passwordType" value="PasswordText"/>
+	           			<entry key="passwordCallbackRef">
+	             			 <ref bean="myPasswordCallback"/>
+	           			</entry>
+	       			</map>
+	     		</constructor-arg>
+ 			</bean>
+		</jaxws:inInterceptors>
+
+		<jaxws:properties>
+		  <entry key="mtom-enabled" value="true" />
+		</jaxws:properties>
+	</jaxws:endpoint>
 </beans>
\ No newline at end of file



Mime
View raw message