Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2
    • Fix Version/s: Upcoming
    • Component/s: Core
    • Labels:
      None

      Description

      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.

        Issue Links

          Activity

          Hide
          galmeida added a comment -

          something like 'ignoreUnmappedElements' is a must have feature when consuming third party REST API's

          Show
          galmeida added a comment - something like 'ignoreUnmappedElements' is a must have feature when consuming third party REST API's
          Hide
          galmeida added a comment - - edited

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

          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);
                    }
                 };
              }
          };
          
          Show
          galmeida added a comment - - edited workaround: ( http://initbinder.com/articles/how-to-tell-xstream-to-not-unmarshall-xml-fields.html ) 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); } }; } };
          Hide
          Jörg Schaible added a comment -

          @galmeida: If you have questions about XStream, please use the user's list, JIRA is no help forum. This code snippet has there been published more than once and the code is part of XStream's acceptance tests for years. And the mailing list's archives also contain the drawbacks of the solution.

          Show
          Jörg Schaible added a comment - @galmeida: If you have questions about XStream, please use the user's list, JIRA is no help forum. This code snippet has there been published more than once and the code is part of XStream's acceptance tests for years. And the mailing list's archives also contain the drawbacks of the solution.
          Hide
          Jimmy Selamy added a comment -

          Is there any ETA on this issues ?

          Show
          Jimmy Selamy added a comment - Is there any ETA on this issues ?
          Hide
          Jörg Schaible added a comment -

          Remember: This issue features a general error hander for any kind of serialization error. However, most comments have been about unknown elements, which has been solved with XSTR-691.

          Show
          Jörg Schaible added a comment - Remember: This issue features a general error hander for any kind of serialization error. However, most comments have been about unknown elements, which has been solved with XSTR-691 .

            People

            • Assignee:
              Unassigned
              Reporter:
              Joe Walnes
            • Votes:
              23 Vote for this issue
              Watchers:
              18 Start watching this issue

              Dates

              • Created:
                Updated: