[MAGNOLIA-5734] Restoring previous page versions not working Created: 01/Apr/14  Updated: 06/May/14  Resolved: 16/Apr/14

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 5.2.2
Fix Version/s: 5.2.4

Type: Bug Priority: Blocker
Reporter: Ben Price Assignee: Milan Divilek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File restoring.png    
Issue Links:
Cloners
causality
caused by MAGNOLIA-5588 Remove unwanted @author and @version ... Closed
is causing MAGNOLIA-5759 Activation fails on uuid conflicts of... Closed
relation
is related to MAGNOLIA-5748 Restoring version created in M4.5.x d... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

In versions 5.2.2 and newer is not possible to restore older versions of content due to change of serial version uid in Rule.

See attached screenshot error regarding restoring page versions.



 Comments   
Comment by Milan Divilek [ 02/Apr/14 ]

Restore/Preview version which was created in version 4.5.x doesn't work. It's caused by changes in metadata.

Action for restoring to any version was reintroduced in M5.2.2 MGNLUI-2604, before there was only info.magnolia.pages.app.action.RestorePreviousVersionAction which allows to restore only last created version.

Comment by Jan Haderka [ 02/Apr/14 ]

In which case I guess we do not cause any more harm if we just settle on using new serialVersionUID that was generated after removal of it, but put it back in the class to make sure we don't have such incompatibilities in the future again.
Would be great to also under separate task review all remaining places where it was removed and check where it causes problems as well (e.g. MgnlUser which is serialised upon session serialisation for storage on server restart or session transfer in clustered environments and others).

Comment by Magnolia International [ 02/Apr/14 ]

Is a "manual" import/export also not working ? Could we perhaps consider adding an import filter ? (we've done it in the past albeit for simple type changes)

Comment by Milan Divilek [ 02/Apr/14 ]

Manual export/import works. It's handled with info.magnolia.importexport.postprocessors.MetaDataImportPostProcessor which is used after import info.magnolia.importexport.DataTransporter#postProcessAfterImport. We can probably used this also during restore/preview/compare versions.

btw. see http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html

"However, it is strongly recommended that all serializable classes explicitly declare serialVersionUID values, since the default serialVersionUID computation is highly sensitive to class details that may vary depending on compiler implementations, and can thus result in unexpected InvalidClassExceptions during deserialization. Therefore, to guarantee a consistent serialVersionUID value across different java compiler implementations, a serializable class must declare an explicit serialVersionUID value."

Why we go against of recommendation of oracle? http://wiki.magnolia-cms.com/display/DEV/Code+Style#CodeStyle-serialVersionUIDs

Comment by Magnolia International [ 03/Apr/14 ]

Would be cool if we could use that filter on restore of versions, then.

CodeStyle-serialVersionUID - we had it in many places were it was unnecessary (thanks, default code template of Eclipse), but it should never have been removed from Rule indeed.

Having our own readObject() - or implement java.io.Externalizable which I tend to think is more elegant but have never used before, would let restore content from all version (pre-removal of serialVersionUID, post-removal, and post-readdition). As a longer term solution I'd tend to think we should not binary-serialize the object instance anyway, but that's a much broader topic.

Comment by Christoph Meier [ 17/Apr/14 ]

I replaced deprecated Assert.$someMethod() by static imports on info.magnolia.cms.util.RuleTest

Generated at Mon Feb 12 04:07:53 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.