You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2002/09/24 16:40:21 UTC

cvs commit: xml-axis/java/src/org/apache/axis/encoding/ser SimpleSerializer.java

gdaniels    2002/09/24 07:40:20

  Modified:    java/test/encoding TestAttributes.java
               java/src/org/apache/axis/encoding/ser SimpleSerializer.java
  Log:
  Always write safe strings with the SimpleSerializer.  Fixes bugs:
  
  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12452
  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12453
  
  Uncomment dims' test cases for this behavior.
  
  Revision  Changes    Path
  1.18      +6 -4      xml-axis/java/test/encoding/TestAttributes.java
  
  Index: TestAttributes.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestAttributes.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TestAttributes.java	24 Sep 2002 13:46:12 -0000	1.17
  +++ TestAttributes.java	24 Sep 2002 14:40:20 -0000	1.18
  @@ -87,6 +87,8 @@
           log.debug(msgString);
           log.debug("---");
   
  +        System.out.println(msgString);
  +
           Message message = new Message(msgString);
           message.setMessageContext(msgContext);
           SOAPEnvelope env = message.getSOAPEnvelope();
  @@ -109,13 +111,13 @@
       }
   
       public void testSimpleType2() throws Exception {
  -        //Testcase for 12453 - Axis does not correctly HTML-encode <'s and >'s
  -        //checkSimpleBeanRoundTrip("http://mysite.com?a=1&b=2", 85.0F);
  +        //Testcase for 12452 - Axis does not correctly XML-encode ampersands
  +        checkSimpleBeanRoundTrip("http://mysite.com?a=1&b=2", 85.0F);
       }
   
       public void testSimpleType3() throws Exception {
  -        //Testcase for 12453 - Axis does not correctly HTML-encode <'s and >'s
  -        //checkSimpleBeanRoundTrip("</name>", 85.0F);
  +        //Testcase for 12453 - Axis does not correctly XML-encode <'s and >'s
  +        checkSimpleBeanRoundTrip("</name>", 85.0F);
       }
       
       private void checkSimpleBeanRoundTrip(String text, float temp) throws Exception {
  
  
  
  1.29      +1 -4      xml-axis/java/src/org/apache/axis/encoding/ser/SimpleSerializer.java
  
  Index: SimpleSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/SimpleSerializer.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- SimpleSerializer.java	18 Sep 2002 16:10:35 -0000	1.28
  +++ SimpleSerializer.java	24 Sep 2002 14:40:20 -0000	1.29
  @@ -64,7 +64,6 @@
   import org.apache.axis.encoding.SimpleValueSerializer;
   import org.apache.axis.utils.BeanPropertyDescriptor;
   import org.apache.axis.utils.BeanUtils;
  -import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.Messages;
   import org.apache.axis.utils.XMLUtils;
   import org.apache.axis.wsdl.fromJava.Types;
  @@ -142,7 +141,7 @@
   
           context.startElement(name, attributes);
           if (value != null) {
  -            context.writeString(getValueAsString(value, context));
  +            context.writeSafeString(getValueAsString(value, context));
           }
           context.endElement();
       }
  @@ -166,8 +165,6 @@
               } else if (data == Double.NEGATIVE_INFINITY) {
                   return "-INF";
               }
  -        } else if (value instanceof String) {
  -            return XMLUtils.xmlEncodeString((String)value);
           }
   
           return value.toString();