0 Replies Latest reply on Apr 15, 2015 3:50 AM by jan.kaae.andersen

    Stacktrace when unmarshalling UTF-8 characters (MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence)

    jan.kaae.andersen

      Im running a JBOSS wildfly : WildFly 8.1.0.Final "Kenny" starting on a Windows 7

      Im trying to retrieve some xml which apparantly contains some special characters

       

      My code looks like this :

       

      private Oxip sendOxipPoolRequest(String queryString) {
        Oxip oxip = null;
        try {
          WebTarget oxipTarget = ClientBuilder.newClient().target(queryString);
          oxip = oxipTarget.request(MediaType.APPLICATION_XML_TYPE).get(Oxip.class);
        } catch (Exception e) {
          mLogger.info("StackTrace : " + ExceptionUtils.getStackTrace(e));
        }
        return oxip;
      }
      
      
      
      

       

      Oxip is a class hieracy created from an xml sample -> xsd -> java

      The queryString has a language parameter and when im setting this to en (english) im getting fx. Bayern Munich

      and all runs smooth as expected. But setting language to da (danish) im getting Bayern München (u with umlaut)

      which results in a stacktrace

       

       

      2015-04-14 16:34:43,126 INFO  (default task-3) StackTrace : javax.ws.rs.client.ResponseProcessingException: javax.ws.rs.ProcessingException: org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException: javax.xml.bind.UnmarshalException

      - with linked exception:

      [com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.]

          at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.extractResult(ClientInvocation.java:140)

          at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:444)

          at org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder.get(ClientInvocationBuilder.java:165)

          at dk.xxxxx.business.api.Pools.sendOxipPoolRequest(Pools.java:762)

       

      So how can i overcome this problem ??