Jettison
  1. Jettison
  2. JETTISON-70

EmptyStackException when writing attribute

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.0
    • Fix Version/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The error occurs when returning Java object (containing other objects and sets of objects) from REST interface built with JBoss RESTEasy which use Jettison to produce JSON responses. The same data printed to XML produce following content:

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <place timestamp="2009-05-13T15:52:07.840+02:00" id="1">
      <categories>
      <category timestamp="2009-05-13T15:52:07.840+02:00">
      <categorySystemName>xxxx</categorySystemName>
      <displayName>yyyy</displayName>
      <name>yyy</name>
      </category>
      </categories>
      <contact timestamp="2009-05-13T15:52:07.840+02:00">
      <phone>435435435</phone>
      </contact>
      <location timestamp="2009-05-13T15:52:07.840+02:00">
      <address timestamp="2009-05-13T15:52:07.840+02:00">
      <city>San Francisco</city>
      <countryCode>USA</countryCode>
      <zipCode>94128</zipCode>
      </address>
      <geoCoordinates timestamp="2009-05-13T15:52:07.840+02:00">
      <latitude>37.61476</latitude>
      <longitude>-122.39188</longitude>
      </geoCoordinates>
      </location>
      <hasPpoiInformation>false</hasPpoiInformation>
      <isAdPlace>false</isAdPlace>
      <names timestamp="2009-05-13T15:52:07.840+02:00">
      <alternativeNames>
      <name timestamp="2009-05-13T15:52:07.840+02:00">
      <language>eng</language>
      <name>Sfo Int'L Airport</name>
      </name>
      <name timestamp="2009-05-13T15:52:07.840+02:00">
      <language>eng</language>
      <name>Sfo</name>
      </name>
      <name timestamp="2009-05-13T15:52:07.840+02:00">
      <language>eng</language>
      <name>Sf Int'L Airport</name>
      </name>
      </alternativeNames>
      <defaultName timestamp="2009-05-13T15:52:07.840+02:00">
      <language>eng</language>
      <name>San Francisco Int'L Airport</name>
      </defaultName>
      </names>
      </place>

      Stack trace:
      java.util.EmptyStackException
      org.codehaus.jettison.util.FastStack.peek(FastStack.java:39)
      org.codehaus.jettison.mapped.MappedXMLStreamWriter.setNewValue(MappedXMLStreamWriter.java:121)
      org.codehaus.jettison.mapped.MappedXMLStreamWriter.makeCurrentJSONObject(MappedXMLStreamWriter.java:113)
      org.codehaus.jettison.mapped.MappedXMLStreamWriter.writeAttribute(MappedXMLStreamWriter.java:97)
      org.codehaus.jettison.mapped.MappedXMLStreamWriter.writeAttribute(MappedXMLStreamWriter.java:138)
      org.codehaus.jettison.mapped.MappedXMLStreamWriter.writeAttribute(MappedXMLStreamWriter.java:142)
      com.sun.xml.bind.v2.runtime.output.XMLStreamWriterOutput.attribute(XMLStreamWriterOutput.java:131)
      com.sun.xml.bind.v2.runtime.output.XmlOutputAbstractImpl.attribute(XmlOutputAbstractImpl.java:106)
      com.sun.xml.bind.v2.runtime.XMLSerializer.attribute(XMLSerializer.java:442)
      com.sun.xml.bind.v2.runtime.property.AttributeProperty.serializeAttributes(AttributeProperty.java:99)
      com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeAttributes(ClassBeanInfoImpl.java:331)
      com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:679)
      com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:65)
      com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:168)
      com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:152)
      com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
      com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
      com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:150)
      com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
      com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:589)
      com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:312)
      com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:490)
      com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:325)
      com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:172)
      com.nokia.places.utilities.resteasy.plugins.providers.jaxb.json.JettisonMappedMarshaller.marshal(JettisonMappedMarshaller.java:87)
      com.nokia.places.utilities.resteasy.plugins.providers.jaxb.json.JettisonMappedMarshaller.marshal(JettisonMappedMarshaller.java:66)
      org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider.writeTo(AbstractJAXBProvider.java:89)
      org.jboss.resteasy.core.ResponseInvoker.writeTo(ResponseInvoker.java:101)
      org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:404)
      org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:365)
      org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
      org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
      org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      com.nokia.places.api.rest.ContentTypeFilter.doFilter(ContentTypeFilter.java:63)
      com.nokia.ovi.rest.debug.DebuggingFilter.doFilter(DebuggingFilter.java:59)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      The error occurs on processing 'timestamp' attribute in last 'name' element in 'alternativeNames'.

        Activity

        Hide
        Daniel Küstner added a comment -

        Happens also with Jettison 1.1

        Show
        Daniel Küstner added a comment - Happens also with Jettison 1.1
        Hide
        Sergey Beryozkin added a comment -

        This may have been fixed - can you try with Jettison 1.3.2 ? Alternatively - please provide the sample JAXB beans, which are used to produce the output

        Show
        Sergey Beryozkin added a comment - This may have been fixed - can you try with Jettison 1.3.2 ? Alternatively - please provide the sample JAXB beans, which are used to produce the output
        Hide
        Sergey Beryozkin added a comment -

        Please provide a test bean if the issue still exists with Jettison 1.3.5

        Show
        Sergey Beryozkin added a comment - Please provide a test bean if the issue still exists with Jettison 1.3.5

          People

          • Assignee:
            Sergey Beryozkin
            Reporter:
            Adam Lider
          • Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: