cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r772402 - in /cxf/trunk: 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/java/org/apache/cx...
Date Wed, 06 May 2009 18:55:26 GMT
Author: dkulp
Date: Wed May  6 18:55:25 2009
New Revision: 772402

URL: http://svn.apache.org/viewvc?rev=772402&view=rev
Log:
[CXF-2205] Fix issues with Aegis trimming strings
Also fix potential problems with DOMUtils.getContent(..) not returning all the content

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

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/StringBeanDefinitionParser.java
Wed May  6 18:55:25 2009
@@ -29,7 +29,7 @@
     @SuppressWarnings("deprecation")
     @Override
     protected void doParse(Element element, BeanDefinitionBuilder builder) {
-        builder.addConstructorArg(DOMUtils.getContent(element));
+        builder.addConstructorArg(DOMUtils.getRawContent(element));
     }
 
     @Override

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java Wed May  6
18:55:25 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/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
Wed May  6 18:55:25 2009
@@ -188,7 +188,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;
@@ -229,8 +229,7 @@
         if (at == null) {
             return null;
         }
-
-        return DOMUtils.getContent(at);
+        return at.getNodeValue();
     }
 
     public int getAttributeCount() {

Modified: cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
Wed May  6 18:55:25 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/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java Wed May  6 18:55:25
2009
@@ -141,7 +141,7 @@
                                            + writeNodeToString(node));
         }
 
-        String value2 = DOMUtils.getContent(result).trim();
+        String value2 = DOMUtils.getContent(result);
 
         Assert.assertEquals(value, value2);
     }

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigDecimalType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigIntegerType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigIntegerType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigIntegerType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BigIntegerType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ByteType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ByteType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ByteType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ByteType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/CalendarType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/CalendarType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/CalendarType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/CalendarType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateTimeType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateTimeType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateTimeType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateTimeType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/DateType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
Wed May  6 18:55:25 2009
@@ -101,6 +101,7 @@
             throw new DatabindingException("Missing 'xsi:type' attribute value");
         }
 
+        typeName = typeName.trim();
         Type type = null;
         QName typeQName = null;
         if (typeName != null) {
@@ -154,7 +155,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);
@@ -162,7 +164,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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ShortType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ShortType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ShortType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ShortType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimeType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimeType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimeType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimeType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimestampType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimestampType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimestampType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimestampType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimezoneLessDateType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimezoneLessDateType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimezoneLessDateType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/TimezoneLessDateType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/URIType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/URIType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/URIType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/URIType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/DurationType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/DurationType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/DurationType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/DurationType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/EnumType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/EnumType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/EnumType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/EnumType.java
Wed May  6 18:55:25 2009
@@ -36,7 +36,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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/XMLGregorianCalendarType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/XMLGregorianCalendarType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/XMLGregorianCalendarType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/XMLGregorianCalendarType.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/mtom/AbstractXOPType.java
Wed May  6 18:55:25 2009
@@ -90,7 +90,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();
@@ -123,7 +123,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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
Wed May  6 18:55:25 2009
@@ -141,8 +141,6 @@
             
             if (value == null) {
                 value = "";
-            } else {
-                value = value.trim();
             }
         }
         return value;

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType1.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType1.xml?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType1.xml
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType1.xml
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType2.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType2.xml?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType2.xml
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayAnyType2.xml
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType1.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType1.xml?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType1.xml
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType1.xml
Wed May  6 18:55:25 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/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType2.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType2.xml?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType2.xml
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/arrayUrType2.xml
Wed May  6 18:55:25 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/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsImpl.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsImpl.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsImpl.java Wed
May  6 18:55:25 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/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsTest.java?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsTest.java Wed
May  6 18:55:25 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());
     }
+    
 }

Added: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/ServerPasswordCallback.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/ServerPasswordCallback.java?rev=772402&view=auto
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/ServerPasswordCallback.java
(added)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/ServerPasswordCallback.java
Wed May  6 18:55:25 2009
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.aegis;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+/**
+ * 
+ */
+public class ServerPasswordCallback implements CallbackHandler {
+
+    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
{
+        for (int i = 0; i < callbacks.length; i++) {
+            WSPasswordCallback pc = (WSPasswordCallback)callbacks[i];
+            pc.setPassword("pass");
+        }
+
+    }
+
+}

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/ServerPasswordCallback.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/aegis/ServerPasswordCallback.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/systests/src/test/resources/aegisJaxWsBeans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/aegisJaxWsBeans.xml?rev=772402&r1=772401&r2=772402&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/resources/aegisJaxWsBeans.xml (original)
+++ cxf/trunk/systests/src/test/resources/aegisJaxWsBeans.xml Wed May  6 18:55:25 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