spring-projects / spring-webflow

Spring Web Flow
https://spring.io/projects/spring-webflow
Apache License 2.0
325 stars 231 forks source link

FlowExecutionImpl does not have the serialVersionUID defined [SWF-1737] #912

Open spring-operator opened 5 years ago

spring-operator commented 5 years ago

Nate Margono opened SWF-1737 and commented

I'm running into an issue that's awfully similar to SPR-4826. This is a blocker for my application's new release as well.

My issue is upgrading from spring-webflow 2.0.9.RELEASE to 2.3.4.RELEASE, and my previously existing snapshots can no longer be loaded/deserialized/unmarshalled:

java.io.InvalidClassException: org.springframework.webflow.engine.impl.FlowExecutionImpl; local class incompatible: stream classdesc serialVersionUID = 507164007291131518, local class serialVersionUID = -4659689664429207075

So I tried to approach it by hardcoding private static final long serialVersionUID = -4659689664429207075L; just like the fix for SPR-4826, but it's still throwing the same error, so maybe I missed a class/step?

It's noteworthy that the snapshots that were serialized in 2.0.9 were done by JDK 1.6, whereas the upgraded 2.3.4 is with JDK 1.8, which explains the differently generated serialVersionUID, as FlowExecutionImpl.java doesn't have a serialVersionUID harcoded - ergo, the JDK has to auto generate one.

But, for backward compatibility in the spring-webflow upgrade, shouldn't the snapshots still be able to be loaded/deserialized in the later version?

What's my best option to approach this?


Affects: 2.3.4

Reference URL: https://github.com/spring-projects/spring-framework/issues/9502

spring-operator commented 5 years ago

Nate Margono commented

I was able to get past the serialVersionUID by hardcoding the value 507164007291131518 in the FlowExecutionImpl class (adapted from SPR-4826).

But I'm not faced with a serialization issue for FlowExecutionStatus, and I traced it back to #1774, where it's been changed from a StaticLabeledEnum to a Java enum. So, I'm getting a deserialization issue: "Caused by: java.io.InvalidClassException: cannot bind non-enum descriptor to an enum class", as expected.

But, that still leaves me with a lot of snapshots that were serialized as StaticLabeledEnum, and now not deserializable because of it. What is the best way to upgrade/restore these snapshots?

spring-operator commented 5 years ago

Nate Margono commented

Can I get some help on this? It's a blocker for us and it requires us to modify the webflow JAR to get it to work, but we can't deliver it officially because of the modification.