Improper XStream form for Result outside of a Run

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Run.<clinit> registers Result.conv so that build.xml can use a simple

      <result>SUCCESS</result>
      

      Yet this is only available for Run.XSTREAM, not, say, Items.XSTREAM. So a project using ReverseBuildTrigger will have the odd

      <threshold>
        <name>SUCCESS</name>
        <ordinal>0</ordinal>
        <color>BLUE</color>
        <completeBuild>true</completeBuild>
      </threshold>
      

      During deserialization, only the ordinal is considered by readResolve.

      We should rather have a

      public static final class ConverterImpl extends AbstractSingleValueConverter
      

      so that any field of type Result will be sanely handled; just need to ensure that an existing ReverseBuildTrigger is correctly restored.

      Of course it would have been better for this to be an enum but it seems too late to change that compatibly. There may be Java serialized forms of this floating around (for example, in Pipeline program.dat), and you cannot deserialize the old form without a customed input stream:

      java.io.InvalidClassException: cannot bind non-enum descriptor to an enum class
      	at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:604)
      	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1630)
      	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
      	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781)
      	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
      	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
      

            Assignee:
            Unassigned
            Reporter:
            Jesse Glick
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: