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 di...@apache.org on 2003/11/18 23:36:37 UTC

cvs commit: ws-axis/java/test/encoding TestDOM.java

dims        2003/11/18 14:36:37

  Modified:    java/src/org/apache/axis AxisEngine.java
               java/src/org/apache/axis/encoding
                        SerializationContextImpl.java
               java/test/encoding TestDOM.java
  Log:
  Fix for Bug 18903 - .NET: Remove .NET 1.0 workaround patch
  
  Revision  Changes    Path
  1.108     +1 -2      ws-axis/java/src/org/apache/axis/AxisEngine.java
  
  Index: AxisEngine.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/AxisEngine.java,v
  retrieving revision 1.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- AxisEngine.java	5 Sep 2003 17:58:53 -0000	1.107
  +++ AxisEngine.java	18 Nov 2003 22:36:37 -0000	1.108
  @@ -101,7 +101,6 @@
       public static final String PROP_SOAP_VERSION = "defaultSOAPVersion";
       public static final String PROP_SOAP_ALLOWED_VERSION = "singleSOAPVersion";
       public static final String PROP_TWOD_ARRAY_ENCODING = "enable2DArrayEncoding";
  -    public static final String PROP_SEND_MINIMIZED_ELEMENTS = "axis.sendMinimizedElements";
       public static final String PROP_XML_ENCODING = "axis.xmlEncoding";
   
       public static final String DEFAULT_ATTACHMENT_IMPL="org.apache.axis.attachments.AttachmentsImpl";
  @@ -358,7 +357,7 @@
        * web services.
        */
       private static final String [] BOOLEAN_OPTIONS = new String [] {
  -        PROP_DOMULTIREFS, PROP_SEND_XSI, PROP_XML_DECL, PROP_SEND_MINIMIZED_ELEMENTS
  +        PROP_DOMULTIREFS, PROP_SEND_XSI, PROP_XML_DECL
       };
   
       /**
  
  
  
  1.99      +3 -20     ws-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java
  
  Index: SerializationContextImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- SerializationContextImpl.java	5 Sep 2003 17:58:53 -0000	1.98
  +++ SerializationContextImpl.java	18 Nov 2003 22:36:37 -0000	1.99
  @@ -162,12 +162,6 @@
       private boolean sendXSIType = true;
   
       /**
  -     * Should I send minimized elements? As in <element/> instead of
  -     * <element></element>.
  -     */
  -    private boolean sendMinimizedElements = true;
  -
  -    /**
        * A place to hold objects we cache for multi-ref serialization, and
        * remember the IDs we assigned them.
        */
  @@ -276,12 +270,6 @@
               if (shouldSendMultiRefs != null)
                   doMultiRefs = shouldSendMultiRefs.booleanValue();
   
  -            Boolean shouldSendMinimized =
  -                (Boolean)optionSource.getOption(AxisEngine.PROP_SEND_MINIMIZED_ELEMENTS);
  -
  -            if (shouldSendMinimized != null)
  -                sendMinimizedElements = shouldSendMinimized.booleanValue();
  -
               // The SEND_TYPE_ATTR and PROP_SEND_XSI options indicate
               // whether the elements should have xsi:type attributes.
               // Only turn this off is the user tells us to
  @@ -1019,14 +1007,9 @@
           nsStack.pop();
   
           if (writingStartTag) {
  -            if (sendMinimizedElements) {
  -                writer.write("/>");
  -            }
  -            else {
  -                writer.write("></");
  -                writer.write(elementQName);
  -                writer.write('>');
  -            }
  +            writer.write("></");
  +            writer.write(elementQName);
  +            writer.write('>');
               if (pretty) writer.write('\n');
               writingStartTag = false;
               return;
  
  
  
  1.18      +2 -2      ws-axis/java/test/encoding/TestDOM.java
  
  Index: TestDOM.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/test/encoding/TestDOM.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TestDOM.java	18 Jul 2003 12:40:41 -0000	1.17
  +++ TestDOM.java	18 Nov 2003 22:36:37 -0000	1.18
  @@ -124,7 +124,7 @@
       public void testEmptyNode() throws Exception
       {
           SOAPBodyElement body = new SOAPBodyElement(XMLUtils.newDocument().createElement("tmp"));
  -        assertEquals("<tmp/>",body.toString());
  +        assertXMLEqual("<tmp/>",body.toString());
       }
   
       public void testNodeWithAttribute() throws Exception 
  @@ -132,7 +132,7 @@
           org.w3c.dom.Element element = XMLUtils.newDocument().createElement("tmp");
           element.setAttribute("attrib", "foo");
           SOAPBodyElement body = new SOAPBodyElement(element);
  -        assertEquals("<tmp attrib=\"foo\"/>",body.toString());
  +        assertXMLEqual("<tmp attrib=\"foo\"/>",body.toString());
       }
   
       public static void main(String [] args) throws Exception
  
  
  

RE: cvs commit: ws-axis/java/test/encoding TestDOM.java

Posted by Glen Daniels <gl...@thoughtcraft.com>.
Um, dims?

I think you did this backwards.  The .NET bug was with parsing the
more-efficient "minimized" form, i.e. <foo/>.  Now that it has been fixed,
we can (and should) send minimized elements where possible.  Your fix makes
us always send the full start + end tag version, which gets bad when you've
got
<very-long-element-name-with-no-content></very-long-element-name-with-no-con
tent>.

Could you please put back the writer.write("/>") version?  Thanks.

--Glen

> -----Original Message-----
> From: dims@apache.org [mailto:dims@apache.org] 
> Sent: Tuesday, November 18, 2003 5:37 PM
> To: ws-axis-cvs@apache.org
> Subject: cvs commit: ws-axis/java/test/encoding TestDOM.java
> 
> 
> dims        2003/11/18 14:36:37
> 
>   Modified:    java/src/org/apache/axis AxisEngine.java
>                java/src/org/apache/axis/encoding
>                         SerializationContextImpl.java
>                java/test/encoding TestDOM.java
>   Log:
>   Fix for Bug 18903 - .NET: Remove .NET 1.0 workaround patch
>   
>   Revision  Changes    Path
>   1.108     +1 -2      
> ws-axis/java/src/org/apache/axis/AxisEngine.java
>   
>   Index: AxisEngine.java
>   ===================================================================
>   RCS file: 
> /home/cvs/ws-axis/java/src/org/apache/axis/AxisEngine.java,v
>   retrieving revision 1.107
>   retrieving revision 1.108
>   diff -u -r1.107 -r1.108
>   --- AxisEngine.java	5 Sep 2003 17:58:53 -0000	1.107
>   +++ AxisEngine.java	18 Nov 2003 22:36:37 -0000	1.108
>   @@ -101,7 +101,6 @@
>        public static final String PROP_SOAP_VERSION = 
> "defaultSOAPVersion";
>        public static final String PROP_SOAP_ALLOWED_VERSION = 
> "singleSOAPVersion";
>        public static final String PROP_TWOD_ARRAY_ENCODING = 
> "enable2DArrayEncoding";
>   -    public static final String 
> PROP_SEND_MINIMIZED_ELEMENTS = "axis.sendMinimizedElements";
>        public static final String PROP_XML_ENCODING = 
> "axis.xmlEncoding";
>    
>        public static final String 
> DEFAULT_ATTACHMENT_IMPL="org.apache.axis.attachments.AttachmentsImpl";
>   @@ -358,7 +357,7 @@
>         * web services.
>         */
>        private static final String [] BOOLEAN_OPTIONS = new 
> String [] {
>   -        PROP_DOMULTIREFS, PROP_SEND_XSI, PROP_XML_DECL, 
> PROP_SEND_MINIMIZED_ELEMENTS
>   +        PROP_DOMULTIREFS, PROP_SEND_XSI, PROP_XML_DECL
>        };
>    
>        /**
>   
>   
>   
>   1.99      +3 -20     
> ws-axis/java/src/org/apache/axis/encoding/SerializationContext
> Impl.java
>   
>   Index: SerializationContextImpl.java
>   ===================================================================
>   RCS file: 
> /home/cvs/ws-axis/java/src/org/apache/axis/encoding/Serializat
> ionContextImpl.java,v
>   retrieving revision 1.98
>   retrieving revision 1.99
>   diff -u -r1.98 -r1.99
>   --- SerializationContextImpl.java	5 Sep 2003 17:58:53 
> -0000	1.98
>   +++ SerializationContextImpl.java	18 Nov 2003 22:36:37 
> -0000	1.99
>   @@ -162,12 +162,6 @@
>        private boolean sendXSIType = true;
>    
>        /**
>   -     * Should I send minimized elements? As in <element/> 
> instead of
>   -     * <element></element>.
>   -     */
>   -    private boolean sendMinimizedElements = true;
>   -
>   -    /**
>         * A place to hold objects we cache for multi-ref 
> serialization, and
>         * remember the IDs we assigned them.
>         */
>   @@ -276,12 +270,6 @@
>                if (shouldSendMultiRefs != null)
>                    doMultiRefs = shouldSendMultiRefs.booleanValue();
>    
>   -            Boolean shouldSendMinimized =
>   -                
> (Boolean)optionSource.getOption(AxisEngine.PROP_SEND_MINIMIZED
> _ELEMENTS);
>   -
>   -            if (shouldSendMinimized != null)
>   -                sendMinimizedElements = 
> shouldSendMinimized.booleanValue();
>   -
>                // The SEND_TYPE_ATTR and PROP_SEND_XSI 
> options indicate
>                // whether the elements should have xsi:type 
> attributes.
>                // Only turn this off is the user tells us to
>   @@ -1019,14 +1007,9 @@
>            nsStack.pop();
>    
>            if (writingStartTag) {
>   -            if (sendMinimizedElements) {
>   -                writer.write("/>");
>   -            }
>   -            else {
>   -                writer.write("></");
>   -                writer.write(elementQName);
>   -                writer.write('>');
>   -            }
>   +            writer.write("></");
>   +            writer.write(elementQName);
>   +            writer.write('>');
>                if (pretty) writer.write('\n');
>                writingStartTag = false;
>                return;
>   
>   
>   
>   1.18      +2 -2      ws-axis/java/test/encoding/TestDOM.java
>   
>   Index: TestDOM.java
>   ===================================================================
>   RCS file: /home/cvs/ws-axis/java/test/encoding/TestDOM.java,v
>   retrieving revision 1.17
>   retrieving revision 1.18
>   diff -u -r1.17 -r1.18
>   --- TestDOM.java	18 Jul 2003 12:40:41 -0000	1.17
>   +++ TestDOM.java	18 Nov 2003 22:36:37 -0000	1.18
>   @@ -124,7 +124,7 @@
>        public void testEmptyNode() throws Exception
>        {
>            SOAPBodyElement body = new 
> SOAPBodyElement(XMLUtils.newDocument().createElement("tmp"));
>   -        assertEquals("<tmp/>",body.toString());
>   +        assertXMLEqual("<tmp/>",body.toString());
>        }
>    
>        public void testNodeWithAttribute() throws Exception 
>   @@ -132,7 +132,7 @@
>            org.w3c.dom.Element element = 
> XMLUtils.newDocument().createElement("tmp");
>            element.setAttribute("attrib", "foo");
>            SOAPBodyElement body = new SOAPBodyElement(element);
>   -        assertEquals("<tmp attrib=\"foo\"/>",body.toString());
>   +        assertXMLEqual("<tmp attrib=\"foo\"/>",body.toString());
>        }
>    
>        public static void main(String [] args) throws Exception
>   
>   
>   
> 
>