You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Christopher Marshall (JIRA)" <ji...@apache.org> on 2011/08/08 21:04:27 UTC

[jira] [Created] (CXF-3719) NullPointerException When using TransformOutInterceptor

NullPointerException When using TransformOutInterceptor
-------------------------------------------------------

                 Key: CXF-3719
                 URL: https://issues.apache.org/jira/browse/CXF-3719
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.4.1
         Environment: Linux 2.6.29, java 1.6.0_16
            Reporter: Christopher Marshall


I have attempted to remove the namespace prefixes outbound JSON messages by using the TransformOutInterceptor.  At line 87 it explicitly does
    message.removeContent(OutputStream.class);
and this eventually causes a NullPointerException in the constructor of java.io.Writer.  The MessageImpl class has an array called defaultContents that would have otherwise had an entry containing HTTPConduit$WrappedOutputStream that would have been passed through multiple layer to the constructor of java.io.writer.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CXF-3719) NullPointerException When using TransformOutInterceptor

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3719?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-3719.
-----------------------------------

    Resolution: Later
      Assignee: Sergey Beryozkin

Fixing it as Later - in case we can figure out how to chain two initialized writers.
Dan, if you have some ideas then please reopen
thanks

> NullPointerException When using TransformOutInterceptor
> -------------------------------------------------------
>
>                 Key: CXF-3719
>                 URL: https://issues.apache.org/jira/browse/CXF-3719
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.4.1
>         Environment: Linux 2.6.29, java 1.6.0_16
>            Reporter: Christopher Marshall
>            Assignee: Sergey Beryozkin
>
> I have attempted to remove the namespace prefixes outbound JSON messages by using the TransformOutInterceptor.  At line 87 it explicitly does
>     message.removeContent(OutputStream.class);
> and this eventually causes a NullPointerException in the constructor of java.io.Writer.  The MessageImpl class has an array called defaultContents that would have otherwise had an entry containing HTTPConduit$WrappedOutputStream that would have been passed through multiple layer to the constructor of java.io.writer.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CXF-3719) NullPointerException When using TransformOutInterceptor

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3719?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13081147#comment-13081147 ] 

Sergey Beryozkin commented on CXF-3719:
---------------------------------------

thanks for the above analysis, for the moment, please configure JSONProvider explicitly and use ignoreNamespaces property. I'll work on this issue asap

> NullPointerException When using TransformOutInterceptor
> -------------------------------------------------------
>
>                 Key: CXF-3719
>                 URL: https://issues.apache.org/jira/browse/CXF-3719
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.4.1
>         Environment: Linux 2.6.29, java 1.6.0_16
>            Reporter: Christopher Marshall
>
> I have attempted to remove the namespace prefixes outbound JSON messages by using the TransformOutInterceptor.  At line 87 it explicitly does
>     message.removeContent(OutputStream.class);
> and this eventually causes a NullPointerException in the constructor of java.io.Writer.  The MessageImpl class has an array called defaultContents that would have otherwise had an entry containing HTTPConduit$WrappedOutputStream that would have been passed through multiple layer to the constructor of java.io.writer.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CXF-3719) NullPointerException When using TransformOutInterceptor

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3719?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13082344#comment-13082344 ] 

Sergey Beryozkin commented on CXF-3719:
---------------------------------------

http://svn.apache.org/viewvc?rev=1156183&view=rev

> NullPointerException When using TransformOutInterceptor
> -------------------------------------------------------
>
>                 Key: CXF-3719
>                 URL: https://issues.apache.org/jira/browse/CXF-3719
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.4.1
>         Environment: Linux 2.6.29, java 1.6.0_16
>            Reporter: Christopher Marshall
>            Assignee: Sergey Beryozkin
>
> I have attempted to remove the namespace prefixes outbound JSON messages by using the TransformOutInterceptor.  At line 87 it explicitly does
>     message.removeContent(OutputStream.class);
> and this eventually causes a NullPointerException in the constructor of java.io.Writer.  The MessageImpl class has an array called defaultContents that would have otherwise had an entry containing HTTPConduit$WrappedOutputStream that would have been passed through multiple layer to the constructor of java.io.writer.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CXF-3719) NullPointerException When using TransformOutInterceptor

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3719?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13082317#comment-13082317 ] 

Sergey Beryozkin commented on CXF-3719:
---------------------------------------

I reproduced the issue yesterday. 
At this stage I think TranformOutInterceptor can not work with Jettison-based JSON provider and the only 'fix' I can apply is to prevent NPE and throw a better exception. This is not to say JSON output can not be transformed, the problem is that Jettison needs OutputStream when creating its Mapped writer and using TransformFeature for out transformations creates TransformOutWriter too early - it should be created after Jettison writer has been created so that it can delegate to it.
Thus, for all sort of out transformations please configure JSONProvider directly:
http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-CustomizingJAXBXMLandJSONinputandoutput

This will result in TransformOutInterceptor created after Jettison writer has been created. Or use ignoreNamespaces property if you only need to drop prefixes.
This restriction only applies to the output JSON transforms - input ones should work ok with TransformInInterceptor. I'll update the docs shortly 

> NullPointerException When using TransformOutInterceptor
> -------------------------------------------------------
>
>                 Key: CXF-3719
>                 URL: https://issues.apache.org/jira/browse/CXF-3719
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.4.1
>         Environment: Linux 2.6.29, java 1.6.0_16
>            Reporter: Christopher Marshall
>
> I have attempted to remove the namespace prefixes outbound JSON messages by using the TransformOutInterceptor.  At line 87 it explicitly does
>     message.removeContent(OutputStream.class);
> and this eventually causes a NullPointerException in the constructor of java.io.Writer.  The MessageImpl class has an array called defaultContents that would have otherwise had an entry containing HTTPConduit$WrappedOutputStream that would have been passed through multiple layer to the constructor of java.io.writer.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira