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 


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868589 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2019-10-18 11:44:29 +00:00
parent 1c1daf855a
commit 6db4ffdbcd
2 changed files with 3 additions and 88 deletions
@@ -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 implements Serializable {
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
@@ -246,13 +246,9 @@ public final class EntityUtilProperties implements Serializable {
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;