Bug #2735

Auto-save preference is broken

Added by Sebastien Jacquot 5 months ago. Updated 5 months ago.

Status:Feedback Start date:01/22/2020
Priority:High Due date:
Assignee:- % Done:

80%

Category:Persistence / Lazy Spent time: -
Target version:TXM 0.8.1

Description

Auto-save preference is broken since the parameter user_persistable and internal_persistable have been fused.

Note

In TXMResult constructor, it seems:

        // set result as persistent if AUTO_PERSISTENCE_ENABLED preference is activated
        if (TBXPreferences.getInstance().getBoolean(TBXPreferences.AUTO_PERSISTENCE_ENABLED)) {
            this.userPersistable = true; 
        }

userPersistable value is overridden later by the call of:

this.autoLoadParametersFromAnnotations(); // auto fill from Parameter annotations

When creating a new result, TXMPreferences.PERSITABLE preference is not set so userPersistable member field is set to default Java boolean value (false).

Solution 1

  • add test on TXMPreferences.PERSITABLE + TBXPreferences.getInstance().getBoolean(TBXPreferences.AUTO_PERSISTENCE_ENABLED) directly in autoLoadParametersFromAnnotations()

Solution 2

  • set the preference node value instead of than the variable member
// set result as persistent if AUTO_PERSISTENCE_ENABLED preference is activated
        if (TBXPreferences.getInstance().getBoolean(TBXPreferences.AUTO_PERSISTENCE_ENABLED)) {
            this.saveParameter(TXMPreferences.PERSITABLE, true);
        }

History

#1 Updated by Sebastien Jacquot 5 months ago

  • Description updated (diff)
  • Status changed from New to Feedback
  • % Done changed from 0 to 80

Fixed with solution #2.

#2 Updated by Sebastien Jacquot 5 months ago

  • Description updated (diff)

Also available in: Atom PDF