XStream
  1. XStream
  2. XSTR-189

Sun14ReflectionProvider no longer default on HP-UX

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.1
    • Component/s: None
    • Labels:
      None
    • JDK version and platform:
      1.4.2.04-040628-18:09)
      Java HotSpot(TM) Server VM (build 1.4.2 1.4.2.04-040628-20:03-PA_RISC2.0 PA2.0 (aCC_AP), mixed mode)

      Description

      java version "1.4.2.04"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2.04-040628-18:09)
      Java HotSpot(TM) Server VM (build 1.4.2 1.4.2.04-040628-20:03-PA_RISC2.0 PA2.0 (aCC_AP), mixed mode)

      The following code:

      import com.thoughtworks.xstream.*;
      public class Main {
      private final int theValue;
      public static void main(String args[])

      { XStream xstream = new XStream(); System.out.println(xstream.toXML(new Main(3))); }

      public Main(int theValue)

      { this.theValue = theValue; }

      }

      Produces this exception:

      Exception in thread "main" com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Invalid final field Main.theValue
      at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.validateFieldAccess(PureJavaReflectionProvider.java:150)
      at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:105)
      at com.thoughtworks.xstream.converters.reflection.ReflectionConverter.marshal(ReflectionConverter.java:49)
      at com.thoughtworks.xstream.core.ReferenceByXPathMarshaller.convertAnother(ReferenceByXPathMarshaller.java:36)
      at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:46)
      at com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.marshal(ReferenceByXPathMarshallingStrategy.java:17)
      at com.thoughtworks.xstream.XStream.marshal(XStream.java:226)
      at com.thoughtworks.xstream.XStream.marshal(XStream.java:216)
      at com.thoughtworks.xstream.XStream.toXML(XStream.java:201)
      at Main.main(Main.java:6)

      This is because JVM now checks the platform and will only default to Sun14ReflectionProvider on Apple and Sub platforms. This provider should also be the default on the HP-UX platform.

        People

        • Assignee:
          Mauro Talevi
          Reporter:
          Gerard Krupa
        • Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: