Author: jleroux
Date: Fri Oct 18 11:44:29 2019
New Revision: 1868589

URL: http://svn.apache.org/viewvc?rev=1868589&view=rev
Log:
Improved: Remove unused methods related to properties in UtilProperties and 
EntityUtilProperties
(OFBIZ-11254)

While removing the POS I forgot to remove specific methods I added in 
UtilProperties: setPropertyValue(*,*,*) and setPropertyValueInMemory. 
I finally found that setPropertyValueInMemory is used in one test and so maybe
usefull. setPropertyValue(*,*,*) is unused and can be safemy removed. It's also 
called from EntityUtilProperties so should also be removed there.

This removes it, and also slightly formats 
EntityUtilProperties::setPropertyValueInMemory 

Modified:
    
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java
    
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java

Modified: 
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java?rev=1868589&r1=1868588&r2=1868589&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java
 Fri Oct 18 11:44:29 2019
@@ -19,8 +19,6 @@
 package org.apache.ofbiz.base.util;
 
 import java.io.BufferedInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Serializable;
@@ -486,85 +484,6 @@ public final class UtilProperties implem
         return value == null ? "" : value.trim();
     }
 
-    /** Sets the specified value of the specified property name to the 
specified resource/properties file
-     * @param resource The name of the resource - must be a file
-     * @param name The name of the property in the properties file
-     * @param value The value of the property in the properties file */
-     public static void setPropertyValue(String resource, String name, String 
value) {
-         if (UtilValidate.isEmpty(resource)) {
-            return;
-        }
-         if (UtilValidate.isEmpty(name)) {
-            return;
-        }
-
-         Properties properties = getProperties(resource);
-         if (properties == null) {
-             return;
-         }
-
-        try (
-                FileOutputStream propFile = new FileOutputStream(resource);) {
-             properties.setProperty(name, value);
-             if ("XuiLabels".equals(name)) {
-                 properties.store(propFile,
-                     
"##############################################################################\n"
-                     +"# Licensed to the Apache Software Foundation (ASF) 
under one                   \n"
-                     +"# or more contributor license agreements.  See the 
NOTICE file                 \n"
-                     +"# distributed with this work for additional information 
                       \n"
-                     +"# regarding copyright ownership.  The ASF licenses this 
file                   \n"
-                     +"# to you under the Apache License, Version 2.0 (the     
                       \n"
-                     +"# \"License\"); you may not use this file except in 
compliance                 \n"
-                     +"# with the License.  You may obtain a copy of the 
License at                   \n"
-                     +"#                                                       
                       \n"
-                     +"# http://www.apache.org/licenses/LICENSE-2.0            
                       \n"
-                     +"#                                                       
                       \n"
-                     +"# Unless required by applicable law or agreed to in 
writing,                   \n"
-                     +"# software distributed under the License is distributed 
on an                  \n"
-                     +"# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 
ANY                     \n"
-                     +"# KIND, either express or implied.  See the License for 
the                    \n"
-                     +"# specific language governing permissions and 
limitations                      \n"
-                     +"# under the License.                                    
                       \n"
-                     
+"###############################################################################\n"
-                     +"#                                                       
                       \n"
-                     +"# Dynamically modified by OFBiz Framework 
(org.apache.ofbiz.base.util : UtilProperties.setPropertyValue)\n"
-                     +"#                                                       
                       \n"
-                     +"# By default the screen is 1024x768 wide. If you want 
to use another screen size,\n"
-                     +"# you must create a new directory under 
plugins/pos/screens, like the 800x600.\n"
-                     +"# You must also set the 3 related parameters 
(StartClass, ClientWidth, ClientHeight) accordingly.\n"
-                     +"#");
-             } else {
-                 properties.store(propFile,
-                     
"##############################################################################\n"
-                     +"# Licensed to the Apache Software Foundation (ASF) 
under one                   \n"
-                     +"# or more contributor license agreements.  See the 
NOTICE file                 \n"
-                     +"# distributed with this work for additional information 
                       \n"
-                     +"# regarding copyright ownership.  The ASF licenses this 
file                   \n"
-                     +"# to you under the Apache License, Version 2.0 (the     
                       \n"
-                     +"# \"License\"); you may not use this file except in 
compliance                 \n"
-                     +"# with the License.  You may obtain a copy of the 
License at                   \n"
-                     +"#                                                       
                       \n"
-                     +"# http://www.apache.org/licenses/LICENSE-2.0            
                       \n"
-                     +"#                                                       
                       \n"
-                     +"# Unless required by applicable law or agreed to in 
writing,                   \n"
-                     +"# software distributed under the License is distributed 
on an                  \n"
-                     +"# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 
ANY                     \n"
-                     +"# KIND, either express or implied.  See the License for 
the                    \n"
-                     +"# specific language governing permissions and 
limitations                      \n"
-                     +"# under the License.                                    
                       \n"
-                     
+"###############################################################################\n"
-                     +"#                                                       
                       \n"
-                     +"# Dynamically modified by OFBiz Framework 
(org.apache.ofbiz.base.util : UtilProperties.setPropertyValue)\n"
-                     +"# The comments have been removed, you may still find 
them on the OFBiz repository... \n"
-                     +"#");
-             }
-         } catch (FileNotFoundException e) {
-             Debug.logInfo(e, "Unable to located the resource file.", module);
-         } catch (IOException e) {
-             Debug.logError(e, module);
-         }
-     }
-
      /** Sets the specified value of the specified property name to the 
specified resource/properties in memory, does not persist it
       * @param resource The name of the resource
       * @param name The name of the property in the resource

Modified: 
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java?rev=1868589&r1=1868588&r2=1868589&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java
 Fri Oct 18 11:44:29 2019
@@ -246,13 +246,9 @@ public final class EntityUtilProperties
         return UtilProperties.getSplitPropertyValue(url, name);
     }
 
-     public static void setPropertyValue(String resource, String name, String 
value) {
-         UtilProperties.setPropertyValue(resource, name, value);
-     }
-
-      public static void setPropertyValueInMemory(String resource, String 
name, String value) {
-          UtilProperties.setPropertyValueInMemory(resource, name, value);
-      }
+    public static void setPropertyValueInMemory(String resource, String name, 
String value) {
+        UtilProperties.setPropertyValueInMemory(resource, name, value);
+    }
 
     public static String setPropertyValue(Delegator delegator, String 
resourceName, String name, String value) {
         GenericValue gv = null;


Reply via email to