details:   https://code.openbravo.com/erp/devel/pi/rev/ffe59c8ae31f
changeset: 30648:ffe59c8ae31f
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Tue Nov 15 09:50:43 2016 +0100
summary:   related to issue 34514: declare cachedPreference map as transient

By marking cachedPreference as transient we are preventing it to be transferred 
through the network as it will be lost intentionally when serialization 
converts the object state to serial bytes

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java
 |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (22 lines):

diff -r 5a622584168a -r ffe59c8ae31f 
modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java
       Tue Nov 15 09:41:55 2016 +0100
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java
       Tue Nov 15 09:50:43 2016 +0100
@@ -61,7 +61,7 @@
   private List<String> propertyList = new ArrayList<String>(Arrays.asList(
       ALLOW_UNPAGED_DS_MANUAL_REQUEST, ALLOW_UNSECURED_DS_REQUEST, 
ALLOW_WHERE_PARAMETER,
       RESTRICT_ERP_ACCESS_IN_STORE_SERVER));
-  private Map<String, String> cachedPreference = new HashMap<String, String>();
+  private transient Map<String, String> cachedPreference;
 
   /**
    * It returns a String with the value of the preference whose related 
property name is entered as
@@ -75,6 +75,9 @@
    */
   public String getPreferenceValue(String propertyName) {
     long t = System.nanoTime();
+    if (cachedPreference == null) {
+      cachedPreference = new HashMap<String, String>();
+    }
     if (!cachedPreference.containsKey(propertyName)) {
       try {
         OBContext.setAdminMode(false);

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to