[ 
https://jira.codehaus.org/browse/XSTR-30?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=290574#comment-290574
 ] 

galmeida edited comment on XSTR-30 at 2/2/12 4:12 AM:
------------------------------------------------------

workaround:
(http://initbinder.com/articles/how-to-tell-xstream-to-not-unmarshall-xml-fields.html)

{code:java}
XStream xstream = new XStream() {
  @Override
  protected MapperWrapper wrapMapper(MapperWrapper next) {
      return new MapperWrapper(next) {
 
      @Override
      public boolean shouldSerializeMember(Class definedIn, String fieldName) {
          if (definedIn == Object.class) { return false; }
             return super.shouldSerializeMember(definedIn, fieldName);
          }
       };
    }
};
{code}



                
      was (Author: fgalmeida):
    I found a workaround:
(http://initbinder.com/articles/how-to-tell-xstream-to-not-unmarshall-xml-fields.html)

{code:java}
XStream xstream = new XStream() {
  @Override
  protected MapperWrapper wrapMapper(MapperWrapper next) {
      return new MapperWrapper(next) {
 
      @Override
      public boolean shouldSerializeMember(Class definedIn, String fieldName) {
          if (definedIn == Object.class) { return false; }
             return super.shouldSerializeMember(definedIn, fieldName);
          }
       };
    }
};
{code}



                  
> User defined error handling
> ---------------------------
>
>                 Key: XSTR-30
>                 URL: https://jira.codehaus.org/browse/XSTR-30
>             Project: XStream
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.2
>            Reporter: Joe Walnes
>             Fix For: Upcoming
>
>
> When something goes wrong in serialization, I'd like the ability to choose 
> how the error is processed.
> Rather than throwing an exception, I'd like a callback (ErrorHandler) to 
> occur so I can choose to barf, ignore, recover, log, etc.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
    <a 
href="http://xircles.codehaus.org/manage_email";>http://xircles.codehaus.org/manage_email</a>
</p>

Reply via email to