You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by Andreas Veithen <an...@gmail.com> on 2009/10/11 12:52:58 UTC

Re: svn commit: r818346 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java

This change causes a regression in a dependent project; see
SYNAPSE-590. Comments?

Andreas

On Thu, Sep 24, 2009 at 04:22,  <na...@apache.org> wrote:
> Author: nagy
> Date: Thu Sep 24 02:22:02 2009
> New Revision: 818346
>
> URL: http://svn.apache.org/viewvc?rev=818346&view=rev
> Log:
> Fix potential NPE during serialization if an encoding has not been set for the OMOutputFormat.
>
> Modified:
>    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
>    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java?rev=818346&r1=818345&r2=818346&view=diff
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java Thu Sep 24 02:22:02 2009
> @@ -214,7 +214,7 @@
>      * @return Returns encoding string.
>      */
>     public String getCharSetEncoding() {
> -        return this.charSetEncoding;
> +        return (this.charSetEncoding != null)?this.charSetEncoding:DEFAULT_CHAR_SET_ENCODING;
>     }
>
>     public void setCharSetEncoding(String charSetEncoding) {
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java?rev=818346&r1=818345&r2=818346&view=diff
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java Thu Sep 24 02:22:02 2009
> @@ -139,7 +139,15 @@
>         String payload = new String(bytes, "utf-16");
>         assertTrue("The obtained bytes did not match the payload",
>                    payload1.equals(payload));
> -
> +
> +        // Test getting the raw bytes with the default encoding
> +        OMOutputFormat outputFormat = new OMOutputFormat();
> +        baos = new ByteArrayOutputStream();
> +        ds.serialize(baos, outputFormat);
> +        output = baos.toString(OMOutputFormat.DEFAULT_CHAR_SET_ENCODING);
> +        System.out.println(output);
> +        assertTrue("The obtained bytes did not match the payload",
> +                   payload1.equals(output));
>     }
>
>     /**
>
>
>

Re: svn commit: r818346 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java

Posted by Andreas Veithen <an...@gmail.com>.
I think that after more than two weeks without any reply, we should go
ahead and revert this change. I tested that this doesn't cause any
regression in Axiom or Axis2.

Andreas

On Tue, Oct 13, 2009 at 02:43, Ruwan Linton <ru...@gmail.com> wrote:
> Synapse HessianMessageForamtter test case is still failing, can we please
> get rid of the default char set encoding if there is no char set encoding,
> for a binary format like Hessian there is no char set encoding.
>
> Shall I go ahead and do this fix??
>
> Thanks,
> Ruwan
>
> On Mon, Oct 12, 2009 at 6:46 AM, Ruwan Linton <ru...@gmail.com>wrote:
>
>> I think the null value should be handled at the OMOutputFormat but the
>> getCharSetEncoding shouldn't worry about it. As Andreas pointed in this
>> thread [1] for a binary protocol the charsetEncoding has to be optional :-(
>>
>> Thanks,
>> Ruwan
>>
>> [1] -
>> http://mail-archives.apache.org/mod_mbox/synapse-dev/200910.mbox/%3Cb67458760910111234ve431fek4b9e7af21316e5ce@mail.gmail.com%3E
>>
>>
>> On Sun, Oct 11, 2009 at 4:22 PM, Andreas Veithen <
>> andreas.veithen@gmail.com> wrote:
>>
>>> This change causes a regression in a dependent project; see
>>> SYNAPSE-590. Comments?
>>>
>>> Andreas
>>>
>>> On Thu, Sep 24, 2009 at 04:22,  <na...@apache.org> wrote:
>>> > Author: nagy
>>> > Date: Thu Sep 24 02:22:02 2009
>>> > New Revision: 818346
>>> >
>>> > URL: http://svn.apache.org/viewvc?rev=818346&view=rev
>>> > Log:
>>> > Fix potential NPE during serialization if an encoding has not been set
>>> for the OMOutputFormat.
>>> >
>>> > Modified:
>>> >
>>>  webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
>>> >
>>>  webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
>>> >
>>> > Modified:
>>> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
>>> > URL:
>>> http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java?rev=818346&r1=818345&r2=818346&view=diff
>>> >
>>> ==============================================================================
>>> > ---
>>> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
>>> (original)
>>> > +++
>>> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
>>> Thu Sep 24 02:22:02 2009
>>> > @@ -214,7 +214,7 @@
>>> >      * @return Returns encoding string.
>>> >      */
>>> >     public String getCharSetEncoding() {
>>> > -        return this.charSetEncoding;
>>> > +        return (this.charSetEncoding !=
>>> null)?this.charSetEncoding:DEFAULT_CHAR_SET_ENCODING;
>>> >     }
>>> >
>>> >     public void setCharSetEncoding(String charSetEncoding) {
>>> >
>>> > Modified:
>>> webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
>>> > URL:
>>> http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java?rev=818346&r1=818345&r2=818346&view=diff
>>> >
>>> ==============================================================================
>>> > ---
>>> webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
>>> (original)
>>> > +++
>>> webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
>>> Thu Sep 24 02:22:02 2009
>>> > @@ -139,7 +139,15 @@
>>> >         String payload = new String(bytes, "utf-16");
>>> >         assertTrue("The obtained bytes did not match the payload",
>>> >                    payload1.equals(payload));
>>> > -
>>> > +
>>> > +        // Test getting the raw bytes with the default encoding
>>> > +        OMOutputFormat outputFormat = new OMOutputFormat();
>>> > +        baos = new ByteArrayOutputStream();
>>> > +        ds.serialize(baos, outputFormat);
>>> > +        output =
>>> baos.toString(OMOutputFormat.DEFAULT_CHAR_SET_ENCODING);
>>> > +        System.out.println(output);
>>> > +        assertTrue("The obtained bytes did not match the payload",
>>> > +                   payload1.equals(output));
>>> >     }
>>> >
>>> >     /**
>>> >
>>> >
>>> >
>>>
>>
>>
>>
>> --
>> Ruwan Linton
>> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
>> WSO2 Inc.; http://wso2.org
>> email: ruwan@wso2.com; cell: +94 77 341 3097
>> blog: http://ruwansblog.blogspot.com
>>
>
>
>
> --
> Ruwan Linton
> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> WSO2 Inc.; http://wso2.org
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://ruwansblog.blogspot.com
>

Re: svn commit: r818346 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java

Posted by Ruwan Linton <ru...@gmail.com>.
Synapse HessianMessageForamtter test case is still failing, can we please
get rid of the default char set encoding if there is no char set encoding,
for a binary format like Hessian there is no char set encoding.

Shall I go ahead and do this fix??

Thanks,
Ruwan

On Mon, Oct 12, 2009 at 6:46 AM, Ruwan Linton <ru...@gmail.com>wrote:

> I think the null value should be handled at the OMOutputFormat but the
> getCharSetEncoding shouldn't worry about it. As Andreas pointed in this
> thread [1] for a binary protocol the charsetEncoding has to be optional :-(
>
> Thanks,
> Ruwan
>
> [1] -
> http://mail-archives.apache.org/mod_mbox/synapse-dev/200910.mbox/%3Cb67458760910111234ve431fek4b9e7af21316e5ce@mail.gmail.com%3E
>
>
> On Sun, Oct 11, 2009 at 4:22 PM, Andreas Veithen <
> andreas.veithen@gmail.com> wrote:
>
>> This change causes a regression in a dependent project; see
>> SYNAPSE-590. Comments?
>>
>> Andreas
>>
>> On Thu, Sep 24, 2009 at 04:22,  <na...@apache.org> wrote:
>> > Author: nagy
>> > Date: Thu Sep 24 02:22:02 2009
>> > New Revision: 818346
>> >
>> > URL: http://svn.apache.org/viewvc?rev=818346&view=rev
>> > Log:
>> > Fix potential NPE during serialization if an encoding has not been set
>> for the OMOutputFormat.
>> >
>> > Modified:
>> >
>>  webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
>> >
>>  webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
>> >
>> > Modified:
>> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
>> > URL:
>> http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java?rev=818346&r1=818345&r2=818346&view=diff
>> >
>> ==============================================================================
>> > ---
>> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
>> (original)
>> > +++
>> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
>> Thu Sep 24 02:22:02 2009
>> > @@ -214,7 +214,7 @@
>> >      * @return Returns encoding string.
>> >      */
>> >     public String getCharSetEncoding() {
>> > -        return this.charSetEncoding;
>> > +        return (this.charSetEncoding !=
>> null)?this.charSetEncoding:DEFAULT_CHAR_SET_ENCODING;
>> >     }
>> >
>> >     public void setCharSetEncoding(String charSetEncoding) {
>> >
>> > Modified:
>> webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
>> > URL:
>> http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java?rev=818346&r1=818345&r2=818346&view=diff
>> >
>> ==============================================================================
>> > ---
>> webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
>> (original)
>> > +++
>> webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
>> Thu Sep 24 02:22:02 2009
>> > @@ -139,7 +139,15 @@
>> >         String payload = new String(bytes, "utf-16");
>> >         assertTrue("The obtained bytes did not match the payload",
>> >                    payload1.equals(payload));
>> > -
>> > +
>> > +        // Test getting the raw bytes with the default encoding
>> > +        OMOutputFormat outputFormat = new OMOutputFormat();
>> > +        baos = new ByteArrayOutputStream();
>> > +        ds.serialize(baos, outputFormat);
>> > +        output =
>> baos.toString(OMOutputFormat.DEFAULT_CHAR_SET_ENCODING);
>> > +        System.out.println(output);
>> > +        assertTrue("The obtained bytes did not match the payload",
>> > +                   payload1.equals(output));
>> >     }
>> >
>> >     /**
>> >
>> >
>> >
>>
>
>
>
> --
> Ruwan Linton
> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> WSO2 Inc.; http://wso2.org
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://ruwansblog.blogspot.com
>



-- 
Ruwan Linton
Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com

Re: svn commit: r818346 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java

Posted by Ruwan Linton <ru...@gmail.com>.
I think the null value should be handled at the OMOutputFormat but the
getCharSetEncoding shouldn't worry about it. As Andreas pointed in this
thread [1] for a binary protocol the charsetEncoding has to be optional :-(

Thanks,
Ruwan

[1] -
http://mail-archives.apache.org/mod_mbox/synapse-dev/200910.mbox/%3Cb67458760910111234ve431fek4b9e7af21316e5ce@mail.gmail.com%3E

On Sun, Oct 11, 2009 at 4:22 PM, Andreas Veithen
<an...@gmail.com>wrote:

> This change causes a regression in a dependent project; see
> SYNAPSE-590. Comments?
>
> Andreas
>
> On Thu, Sep 24, 2009 at 04:22,  <na...@apache.org> wrote:
> > Author: nagy
> > Date: Thu Sep 24 02:22:02 2009
> > New Revision: 818346
> >
> > URL: http://svn.apache.org/viewvc?rev=818346&view=rev
> > Log:
> > Fix potential NPE during serialization if an encoding has not been set
> for the OMOutputFormat.
> >
> > Modified:
> >
>  webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
> >
>  webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
> >
> > Modified:
> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
> > URL:
> http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java?rev=818346&r1=818345&r2=818346&view=diff
> >
> ==============================================================================
> > ---
> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
> (original)
> > +++
> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
> Thu Sep 24 02:22:02 2009
> > @@ -214,7 +214,7 @@
> >      * @return Returns encoding string.
> >      */
> >     public String getCharSetEncoding() {
> > -        return this.charSetEncoding;
> > +        return (this.charSetEncoding !=
> null)?this.charSetEncoding:DEFAULT_CHAR_SET_ENCODING;
> >     }
> >
> >     public void setCharSetEncoding(String charSetEncoding) {
> >
> > Modified:
> webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
> > URL:
> http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java?rev=818346&r1=818345&r2=818346&view=diff
> >
> ==============================================================================
> > ---
> webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
> (original)
> > +++
> webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/OMSourcedElementTest.java
> Thu Sep 24 02:22:02 2009
> > @@ -139,7 +139,15 @@
> >         String payload = new String(bytes, "utf-16");
> >         assertTrue("The obtained bytes did not match the payload",
> >                    payload1.equals(payload));
> > -
> > +
> > +        // Test getting the raw bytes with the default encoding
> > +        OMOutputFormat outputFormat = new OMOutputFormat();
> > +        baos = new ByteArrayOutputStream();
> > +        ds.serialize(baos, outputFormat);
> > +        output =
> baos.toString(OMOutputFormat.DEFAULT_CHAR_SET_ENCODING);
> > +        System.out.println(output);
> > +        assertTrue("The obtained bytes did not match the payload",
> > +                   payload1.equals(output));
> >     }
> >
> >     /**
> >
> >
> >
>



-- 
Ruwan Linton
Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com