Examples of JAXBUnmarshalException


Examples of org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException

   public Entry readFrom(Class<Entry> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException
   {
      JAXBContextFinder finder = getFinder(mediaType);
      if (finder == null)
      {
         throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType);
      }

      try
      {
         JAXBContext ctx = finder.findCachedContext(Entry.class, mediaType, annotations);
         Entry entry = (Entry) ctx.createUnmarshaller().unmarshal(entityStream);
         if (entry.getContent() != null) entry.getContent().setFinder(finder);
         return entry;
      }
      catch (JAXBException e)
      {
         throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e);
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException

   public Feed readFrom(Class<Feed> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException
   {
      JAXBContextFinder finder = getFinder(mediaType);
      if (finder == null)
      {
         throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType);
      }

      try
      {
         JAXBContext ctx = finder.findCachedContext(Feed.class, mediaType, annotations);
         Feed feed = (Feed) ctx.createUnmarshaller().unmarshal(entityStream);
         for (Entry entry : feed.getEntries())
         {
            if (entry.getContent() != null) entry.getContent().setFinder(finder);
         }
         return feed;
      }
      catch (JAXBException e)
      {
         throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e);
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException

   public Feed readFrom(Class<Feed> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException
   {
      JAXBContextFinder finder = getFinder(mediaType);
      if (finder == null)
      {
         throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType);
      }

      try
      {
         JAXBContext ctx = finder.findCachedContext(Feed.class, mediaType, annotations);
         Feed feed = (Feed) ctx.createUnmarshaller().unmarshal(entityStream);
         for (Entry entry : feed.getEntries())
         {
            if (entry.getContent() != null) entry.getContent().setFinder(finder);
         }
         return feed;
      }
      catch (JAXBException e)
      {
         throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e);
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException

   public Entry readFrom(Class<Entry> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException
   {
      JAXBContextFinder finder = getFinder(mediaType);
      if (finder == null)
      {
         throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType);
      }

      try
      {
         JAXBContext ctx = finder.findCachedContext(Entry.class, mediaType, annotations);
         Entry entry = (Entry) ctx.createUnmarshaller().unmarshal(entityStream);
         if (entry.getContent() != null) entry.getContent().setFinder(finder);
         entry.setFinder(finder);
         return entry;
      }
      catch (JAXBException e)
      {
         throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e);
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException

   public Entry readFrom(Class<Entry> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException
   {
      JAXBContextFinder finder = getFinder(mediaType);
      if (finder == null)
      {
         throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType);
      }

      try
      {
         JAXBContext ctx = finder.findCachedContext(Entry.class, mediaType, annotations);
         Entry entry = (Entry) ctx.createUnmarshaller().unmarshal(entityStream);
         if (entry.getContent() != null) entry.getContent().setFinder(finder);
         return entry;
      }
      catch (JAXBException e)
      {
         throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e);
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException

   public Feed readFrom(Class<Feed> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException
   {
      JAXBContextFinder finder = getFinder(mediaType);
      if (finder == null)
      {
         throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType);
      }

      try
      {
         JAXBContext ctx = finder.findCachedContext(Feed.class, mediaType, annotations);
         Feed feed = (Feed) ctx.createUnmarshaller().unmarshal(entityStream);
         for (Entry entry : feed.getEntries())
         {
            if (entry.getContent() != null) entry.getContent().setFinder(finder);
         }
         return feed;
      }
      catch (JAXBException e)
      {
         throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e);
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException

   public Entry readFrom(Class<Entry> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException
   {
      JAXBContextFinder finder = getFinder(mediaType);
      if (finder == null)
      {
         throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType);
      }

      try
      {
         JAXBContext ctx = finder.findCachedContext(Entry.class, mediaType, annotations);
         Entry entry = (Entry) ctx.createUnmarshaller().unmarshal(entityStream);
         if (entry.getContent() != null) entry.getContent().setFinder(finder);
         entry.setFinder(finder);
         return entry;
      }
      catch (JAXBException e)
      {
         throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e);
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException

   public Feed readFrom(Class<Feed> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException
   {
      JAXBContextFinder finder = getFinder(mediaType);
      if (finder == null)
      {
         throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType);
      }

      try
      {
         JAXBContext ctx = finder.findCachedContext(Feed.class, mediaType, annotations);
         Feed feed = (Feed) ctx.createUnmarshaller().unmarshal(entityStream);
         for (Entry entry : feed.getEntries())
         {
            if (entry.getContent() != null) entry.getContent().setFinder(finder);
         }
         return feed;
      }
      catch (JAXBException e)
      {
         throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e);
      }
   }
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException

         reader = new BufferedReader(new InputStreamReader(entityStream));
      }


      char c = JsonParsing.eatWhitspace(reader, false);
      if (c != '[') throw new JAXBUnmarshalException("Expecting a json array as input");
      c = JsonParsing.eatWhitspace(reader, true);
      ArrayList list = new ArrayList();
      if (c != ']')
      {
         MessageBodyReader messageReader = providers.getMessageBodyReader(baseType, null, annotations, mediaType);

         do
         {
            String str = JsonParsing.extractJsonMapString(reader);
            ByteArrayInputStream stream = new ByteArrayInputStream(str.getBytes());
            Object obj = messageReader.readFrom(baseType, null, annotations, mediaType, httpHeaders, stream);
            list.add(obj);

            c = JsonParsing.eatWhitspace(reader, false);

            if (c == ']') break;

            if (c != ',')
            {
               throw new JAXBUnmarshalException("Was expecting a ',' in json array");
            }
            c = JsonParsing.eatWhitspace(reader, true);
         } while (c != -1);
      }


      if (type.isArray())
      {
         Object array = Array.newInstance(baseType, list.size());
         for (int i = 0; i < list.size(); i++)
         {
            Array.set(array, i, list.get(i));
         }
         return array;
      }
      else
      {
         Collection outCol = null;
         if (type.isInterface())
         {
            if (List.class.isAssignableFrom(type)) return list;
            else if (Set.class.isAssignableFrom(type)) outCol = new HashSet();
            else outCol = new ArrayList();
         }
         else
         {
            try
            {
               outCol = (Collection) type.newInstance();
            }
            catch (Exception e)
            {
               throw new JAXBUnmarshalException(e);
            }
         }
         outCol.addAll(list);
         return outCol;
      }
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException

      boolean backslash = false;

      int i = reader.read();
      char c = (char) i;
      StringBuffer buffer = new StringBuffer();
      if (c != '{') throw new JAXBUnmarshalException("Expecting '{' in json map");

      buffer.append(c);
      do
      {
         i = reader.read();
         if (i == -1) throw new JAXBUnmarshalException("Unexpected end of stream");
         c = (char) i;
         buffer.append(c);
         if (backslash)
         {
            backslash = false;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.