Class AppendTextBadgeSummaryActionConverter
- All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter,com.thoughtworks.xstream.converters.ConverterMatcher
AppendTextBadgeSummaryAction persist as a plain BadgeSummaryAction in
build.xml, without touching Java's own serialization contract.
A writeReplace() method would do the same substitution, but it is honored by
any Java serialization, not just Run.XSTREAM2: Pipeline's CPS interpreter
persists a running program's local variables (including whatever a script assigned
manager.createSummary(...) to) with plain ObjectOutputStream/
ObjectInputStream across every durability checkpoint. A writeReplace()-based
shim would come back from that round trip as a plain BadgeSummaryAction too, so a script
that called appendText(...) again after the controller resumed would fail with
MissingMethodException - breaking in Pipeline the exact thing being fixed in freestyle.
Registering this as an XStream Converter instead
keeps the substitution confined to Run.XSTREAM2: only marshal(java.lang.Object, com.thoughtworks.xstream.io.HierarchicalStreamWriter, com.thoughtworks.xstream.converters.MarshallingContext) is overridden, to
write a plain BadgeSummaryAction's fields (with the same resolves-to attribute
writeReplace() would have produced) in place of this class's own; RobustReflectionConverter.unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader, com.thoughtworks.xstream.converters.UnmarshallingContext) is
inherited unchanged from RobustReflectionConverter, so reading is unaffected either way.
ObjectOutputStream never consults registered XStream converters, so CPS state keeps the
real shim, with appendText intact, across every checkpoint.
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.util.RobustReflectionConverter
RobustReflectionConverter.DuplicateFieldException -
Field Summary
Fields inherited from class hudson.util.RobustReflectionConverter
mapper, reflectionProvider, serializationMethodInvoker -
Constructor Summary
ConstructorsConstructorDescriptionAppendTextBadgeSummaryActionConverter(com.thoughtworks.xstream.mapper.Mapper mapper, com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanConvert(Class type) voidmarshal(Object original, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context) Methods inherited from class hudson.util.RobustReflectionConverter
addErrorInContext, doMarshal, doUnmarshal, instantiateNewInstance, marshallField, unmarshal, unmarshalField
-
Constructor Details
-
AppendTextBadgeSummaryActionConverter
public AppendTextBadgeSummaryActionConverter(com.thoughtworks.xstream.mapper.Mapper mapper, com.thoughtworks.xstream.converters.reflection.ReflectionProvider reflectionProvider)
-
-
Method Details
-
canConvert
- Specified by:
canConvertin interfacecom.thoughtworks.xstream.converters.ConverterMatcher- Overrides:
canConvertin classRobustReflectionConverter
-
marshal
public void marshal(Object original, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context) - Specified by:
marshalin interfacecom.thoughtworks.xstream.converters.Converter- Overrides:
marshalin classRobustReflectionConverter
-