Author: mthl
Date: Sat Jul 20 18:41:37 2019
New Revision: 1863505
URL: http://svn.apache.org/viewvc?rev=1863505&view=rev
Log:
Improved: Use ‘StandardCharsets.UTF_8’
(OFBIZ-11142)
Modified:
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java
ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/promo/PromoServices.java
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/KeyStoreUtil.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java
ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilIOTests.java
ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile.java
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile2EntityXml.java
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java
ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java
ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonHelper.java
Modified:
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
Sat Jul 20 18:41:37 2019
@@ -30,6 +30,7 @@ import java.io.Writer;
import java.net.URL;
import java.net.URLConnection;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.sql.Timestamp;
@@ -987,7 +988,7 @@ public class DataResourceWorker impleme
if (!file.isAbsolute()) {
throw new GeneralException("File (" + objectInfo + ") is not
absolute");
}
- try (InputStreamReader in = new InputStreamReader(new
FileInputStream(file), UtilIO.getUtf8())) {
+ try (InputStreamReader in = new InputStreamReader(new
FileInputStream(file), StandardCharsets.UTF_8)) {
UtilIO.copy(in, out);
}
} else if ("OFBIZ_FILE".equals(dataResourceTypeId) &&
UtilValidate.isNotEmpty(objectInfo)) {
@@ -997,7 +998,7 @@ public class DataResourceWorker impleme
sep = "/";
}
File file = FileUtil.getFile(prefix + sep + objectInfo);
- try (InputStreamReader in = new InputStreamReader(new
FileInputStream(file), UtilIO.getUtf8())) {
+ try (InputStreamReader in = new InputStreamReader(new
FileInputStream(file), StandardCharsets.UTF_8)) {
UtilIO.copy(in, out);
}
} else if ("CONTEXT_FILE".equals(dataResourceTypeId) &&
UtilValidate.isNotEmpty(objectInfo)) {
@@ -1007,7 +1008,7 @@ public class DataResourceWorker impleme
sep = "/";
}
File file = FileUtil.getFile(prefix + sep + objectInfo);
- try (InputStreamReader in = new InputStreamReader(new
FileInputStream(file), UtilIO.getUtf8())) {
+ try (InputStreamReader in = new InputStreamReader(new
FileInputStream(file), StandardCharsets.UTF_8)) {
if (Debug.infoOn()) {
String enc = in.getEncoding();
Debug.logInfo("in serveImage, encoding:" + enc, module);
@@ -1064,7 +1065,7 @@ public class DataResourceWorker impleme
throw new GeneralException("Unsupported TEXT type; cannot
stream");
}
- byte[] bytes = text.getBytes(UtilIO.getUtf8());
+ byte[] bytes = text.getBytes(StandardCharsets.UTF_8);
return UtilMisc.toMap("stream", new ByteArrayInputStream(bytes),
"length", (long) bytes.length);
// object (binary) data
Modified:
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java
Sat Jul 20 18:41:37 2019
@@ -27,6 +27,7 @@ import java.io.RandomAccessFile;
import java.io.StringWriter;
import java.io.Writer;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.HashMap;
@@ -244,7 +245,7 @@ public class DataServices {
// write the data to the file
if (UtilValidate.isNotEmpty(textData)) {
try (
- OutputStreamWriter out = new OutputStreamWriter(new
FileOutputStream(file), UtilIO.getUtf8());
+ OutputStreamWriter out = new OutputStreamWriter(new
FileOutputStream(file), StandardCharsets.UTF_8);
) {
out.write(textData);
} catch (IOException e) {
@@ -433,7 +434,7 @@ public class DataServices {
// write the data to the file
if (UtilValidate.isNotEmpty(textData)) {
try (
- OutputStreamWriter out = new OutputStreamWriter(new
FileOutputStream(file),UtilIO.getUtf8());
+ OutputStreamWriter out = new OutputStreamWriter(new
FileOutputStream(file),StandardCharsets.UTF_8);
) {
out.write(textData);
} catch (IOException e) {
Modified:
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java
Sat Jul 20 18:41:37 2019
@@ -25,6 +25,7 @@ import java.io.StringWriter;
import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@@ -225,7 +226,7 @@ public class SurveyWrapper {
Template template = null;
try (
InputStream templateStream = templateUrl.openStream();
- InputStreamReader templateReader = new
InputStreamReader(templateStream,UtilIO.getUtf8());
+ InputStreamReader templateReader = new
InputStreamReader(templateStream,StandardCharsets.UTF_8);
){
template = new Template(templateUrl.toExternalForm(),
templateReader, config);
} catch (IOException e) {
Modified:
ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechServices.java
Sat Jul 20 18:41:37 2019
@@ -19,6 +19,7 @@
package org.apache.ofbiz.party.contact;
+import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.sql.Timestamp;
import java.util.Date;
@@ -973,7 +974,7 @@ public class ContactMechServices {
synchronized(ContactMechServices.class) {
while (true) {
Long random = secureRandom.nextLong();
- verifyHash = HashCrypt.digestHash("MD5",
Long.toString(random).getBytes(UtilIO.getUtf8()));
+ verifyHash = HashCrypt.digestHash("MD5",
Long.toString(random).getBytes(StandardCharsets.UTF_8));
List<GenericValue> emailAddVerifications = null;
try {
emailAddVerifications =
EntityQuery.use(delegator).from("EmailAddressVerification").where("verifyHash",
verifyHash).queryList();
Modified:
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/promo/PromoServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/promo/PromoServices.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/promo/PromoServices.java
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/promo/PromoServices.java
Sat Jul 20 18:41:37 2019
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.StringReader;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.LinkedList;
@@ -244,7 +245,7 @@ public class PromoServices {
byte[] wrapper = bytebufferwrapper.array();
// read the bytes into a reader
- BufferedReader reader = new BufferedReader(new StringReader(new
String(wrapper, UtilIO.getUtf8())));
+ BufferedReader reader = new BufferedReader(new StringReader(new
String(wrapper, StandardCharsets.UTF_8)));
List<Object> errors = new LinkedList<>();
int lines = 0;
String line;
Modified:
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java
Sat Jul 20 18:41:37 2019
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.StringWriter;
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.HashMap;
import java.util.LinkedList;
@@ -850,7 +851,7 @@ public class DhlServices {
continue;
sb.append(encodedImageString.charAt(i));
}
- byte[] labelBytes =
Base64.getMimeDecoder().decode(sb.toString().getBytes(UtilIO.getUtf8()));
+ byte[] labelBytes =
Base64.getMimeDecoder().decode(sb.toString().getBytes(StandardCharsets.UTF_8));
if (labelBytes != null) {
// store in db blob
Modified:
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java
Sat Jul 20 18:41:37 2019
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.StringWriter;
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.util.Base64;
import java.util.HashMap;
@@ -1021,7 +1022,7 @@ public class FedexServices {
"fDXShipReplyString", fDXShipReplyString),
locale));
}
- byte[] labelBytes =
Base64.getMimeDecoder().decode(encodedImageString.getBytes(UtilIO.getUtf8()));
+ byte[] labelBytes =
Base64.getMimeDecoder().decode(encodedImageString.getBytes(StandardCharsets.UTF_8));
if (labelBytes != null) {
Modified:
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java
Sat Jul 20 18:41:37 2019
@@ -635,7 +635,7 @@ public class UpsServices {
if (shipmentUpsSaveCertificationInfo) {
String outFileName = shipmentUpsSaveCertificationPath +
"/UpsShipmentConfirmRequest" + shipmentId + "_" +
shipmentRouteSegment.getString("shipmentRouteSegmentId") + ".xml";
try (FileOutputStream fileOut = new
FileOutputStream(outFileName)) {
-
fileOut.write(xmlString.toString().getBytes(UtilIO.getUtf8()));
+
fileOut.write(xmlString.toString().getBytes(StandardCharsets.UTF_8));
fileOut.flush();
} catch (IOException e) {
Debug.logInfo(e, "Could not save UPS XML file: [[[" +
xmlString.toString() + "]]] to file: " + outFileName, module);
@@ -654,7 +654,7 @@ public class UpsServices {
if (shipmentUpsSaveCertificationInfo) {
String outFileName = shipmentUpsSaveCertificationPath +
"/UpsShipmentConfirmResponse" + shipmentId + "_" +
shipmentRouteSegment.getString("shipmentRouteSegmentId") + ".xml";
try (FileOutputStream fileOut = new
FileOutputStream(outFileName)) {
-
fileOut.write(shipmentConfirmResponseString.getBytes(UtilIO.getUtf8()));
+
fileOut.write(shipmentConfirmResponseString.getBytes(StandardCharsets.UTF_8));
fileOut.flush();
} catch (IOException e) {
Debug.logInfo(e, "Could not save UPS XML file: [[[" +
xmlString.toString() + "]]] to file: " + outFileName, module);
@@ -908,7 +908,7 @@ public class UpsServices {
if (shipmentUpsSaveCertificationInfo) {
String outFileName = shipmentUpsSaveCertificationPath +
"/UpsShipmentAcceptRequest" + shipmentId + "_" +
shipmentRouteSegment.getString("shipmentRouteSegmentId") + ".xml";
try (FileOutputStream fileOut = new
FileOutputStream(outFileName)) {
-
fileOut.write(xmlString.toString().getBytes(UtilIO.getUtf8()));
+
fileOut.write(xmlString.toString().getBytes(StandardCharsets.UTF_8));
fileOut.flush();
} catch (IOException e) {
Debug.logInfo(e, "Could not save UPS XML file: [[[" +
xmlString.toString() + "]]] to file: " + outFileName, module);
@@ -927,7 +927,7 @@ public class UpsServices {
if (shipmentUpsSaveCertificationInfo) {
String outFileName = shipmentUpsSaveCertificationPath +
"/UpsShipmentAcceptResponse" + shipmentId + "_" +
shipmentRouteSegment.getString("shipmentRouteSegmentId") + ".xml";
try (FileOutputStream fileOut = new
FileOutputStream(outFileName)) {
-
fileOut.write(shipmentAcceptResponseString.getBytes(UtilIO.getUtf8()));
+
fileOut.write(shipmentAcceptResponseString.getBytes(StandardCharsets.UTF_8));
fileOut.flush();
} catch (IOException e) {
Debug.logInfo(e, "Could not save UPS XML file: [[[" +
xmlString.toString() + "]]] to file: " + outFileName, module);
@@ -1105,12 +1105,12 @@ public class UpsServices {
}
byte[] labelImageBytes = null;
if (packageLabelGraphicImageString != null) {
- labelImageBytes =
Base64.getMimeDecoder().decode(packageLabelGraphicImageString.getBytes(UtilIO.getUtf8()));
+ labelImageBytes =
Base64.getMimeDecoder().decode(packageLabelGraphicImageString.getBytes(StandardCharsets.UTF_8));
shipmentPackageRouteSeg.setBytes("labelImage",
labelImageBytes);
}
byte[] labelInternationalSignatureGraphicImageBytes = null;
if (packageLabelInternationalSignatureGraphicImageString !=
null) {
- labelInternationalSignatureGraphicImageBytes =
Base64.getMimeDecoder().decode(packageLabelInternationalSignatureGraphicImageString.getBytes(UtilIO.getUtf8()));
+ labelInternationalSignatureGraphicImageBytes =
Base64.getMimeDecoder().decode(packageLabelInternationalSignatureGraphicImageString.getBytes(StandardCharsets.UTF_8));
shipmentPackageRouteSeg.set("labelIntlSignImage",
labelInternationalSignatureGraphicImageBytes);
}
String packageLabelHTMLImageStringDecoded =
Arrays.toString(Base64.getMimeDecoder().decode(packageLabelHTMLImageString.getBytes(StandardCharsets.UTF_8)));
@@ -1138,7 +1138,7 @@ public class UpsServices {
if (packageLabelHTMLImageStringDecoded != null) {
String outFileName = shipmentUpsSaveCertificationPath
+ "/UpsShipmentLabelHTMLImage" + shipmentRouteSegment.getString("shipmentId") +
"_" + shipmentRouteSegment.getString("shipmentRouteSegmentId") + "_" +
shipmentPackageRouteSeg.getString("shipmentPackageSeqId") + ".html";
try (FileOutputStream fileOut = new
FileOutputStream(outFileName)) {
-
fileOut.write(packageLabelHTMLImageStringDecoded.getBytes(UtilIO.getUtf8()));
+
fileOut.write(packageLabelHTMLImageStringDecoded.getBytes(StandardCharsets.UTF_8));
fileOut.flush();
} catch (IOException e) {
Debug.logInfo(e, "Could not save UPS LabelImage
HTML file: [[[" + packageLabelHTMLImageStringDecoded + "]]] to file: " +
outFileName, module);
@@ -1169,7 +1169,7 @@ public class UpsServices {
shipmentRouteSegment.store();
String outFileName = shipmentUpsSaveCertificationPath +
"/HighValueReport" + shipmentRouteSegment.getString("shipmentId") + "_" +
shipmentRouteSegment.getString("shipmentRouteSegmentId") + ".html";
try (FileOutputStream fileOut = new
FileOutputStream(outFileName)) {
-
fileOut.write(fileStringDecoded.getBytes(UtilIO.getUtf8()));
+
fileOut.write(fileStringDecoded.getBytes(StandardCharsets.UTF_8));
fileOut.flush();
} catch (IOException e) {
Debug.logInfo(e, "Could not save UPS High Value Report
data: [[[" + fileStringDecoded + "]]] to file: " + outFileName, module);
@@ -1290,7 +1290,7 @@ public class UpsServices {
if (shipmentUpsSaveCertificationInfo) {
String outFileName = shipmentUpsSaveCertificationPath +
"/UpsVoidShipmentRequest" + shipmentId + "_" +
shipmentRouteSegment.getString("shipmentRouteSegmentId") + ".xml";
try (FileOutputStream fileOut = new
FileOutputStream(outFileName)) {
-
fileOut.write(xmlString.toString().getBytes(UtilIO.getUtf8()));
+
fileOut.write(xmlString.toString().getBytes(StandardCharsets.UTF_8));
fileOut.flush();
} catch (IOException e) {
Debug.logInfo(e, "Could not save UPS XML file: [[[" +
xmlString.toString() + "]]] to file: " + outFileName, module);
@@ -1309,7 +1309,7 @@ public class UpsServices {
if (shipmentUpsSaveCertificationInfo) {
String outFileName = shipmentUpsSaveCertificationPath +
"/UpsVoidShipmentResponse" + shipmentId + "_" +
shipmentRouteSegment.getString("shipmentRouteSegmentId") + ".xml";
try (FileOutputStream fileOut = new
FileOutputStream(outFileName)) {
-
fileOut.write(voidShipmentResponseString.getBytes(UtilIO.getUtf8()));
+
fileOut.write(voidShipmentResponseString.getBytes(StandardCharsets.UTF_8));
fileOut.flush();
} catch (IOException e) {
Debug.logInfo(e, "Could not save UPS XML file: [[[" +
xmlString.toString() + "]]] to file: " + outFileName, module);
@@ -1486,7 +1486,7 @@ public class UpsServices {
if (shipmentUpsSaveCertificationInfo) {
String outFileName = shipmentUpsSaveCertificationPath +
"/UpsTrackRequest" + shipmentId + "_" +
shipmentRouteSegment.getString("shipmentRouteSegmentId") + ".xml";
try (FileOutputStream fileOut = new
FileOutputStream(outFileName)) {
-
fileOut.write(xmlString.toString().getBytes(UtilIO.getUtf8()));
+
fileOut.write(xmlString.toString().getBytes(StandardCharsets.UTF_8));
fileOut.flush();
} catch (IOException e) {
Debug.logInfo(e, "Could not save UPS XML file: [[[" +
xmlString.toString() + "]]] to file: " + outFileName, module);
@@ -1505,7 +1505,7 @@ public class UpsServices {
if (shipmentUpsSaveCertificationInfo) {
String outFileName = shipmentUpsSaveCertificationPath +
"/UpsTrackResponseString" + shipmentId + "_" +
shipmentRouteSegment.getString("shipmentRouteSegmentId") + ".xml";
try (FileOutputStream fileOut = new
FileOutputStream(outFileName)) {
-
fileOut.write(trackResponseString.getBytes(UtilIO.getUtf8()));
+
fileOut.write(trackResponseString.getBytes(StandardCharsets.UTF_8));
fileOut.flush();
} catch (IOException e) {
Debug.logInfo(e, "Could not save UPS XML file: [[[" +
xmlString.toString() + "]]] to file: " + outFileName, module);
@@ -2644,7 +2644,7 @@ public class UpsServices {
if (shipmentUpsSaveCertificationInfo) {
String outFileName = shipmentUpsSaveCertificationPath +
"/UpsShipmentAcceptRequest" + shipmentId + "_" +
shipmentRouteSegment.getString("shipmentRouteSegmentId") + ".xml";
try (FileOutputStream fileOut = new
FileOutputStream(outFileName)) {
-
fileOut.write(xmlString.toString().getBytes(UtilIO.getUtf8()));
+
fileOut.write(xmlString.toString().getBytes(StandardCharsets.UTF_8));
fileOut.flush();
} catch (IOException e) {
Debug.logInfo(e, "Could not save UPS XML file: [[[" +
xmlString.toString() + "]]] to file: " + outFileName, module);
Modified:
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java
Sat Jul 20 18:41:37 2019
@@ -24,6 +24,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.util.Base64;
import java.util.Collections;
@@ -1410,7 +1411,7 @@ public class UspsServices {
return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
"FacilityShipmentUspsDeliveryConfirmationResponseIncompleteElementDeliveryConfirmationLabel",
locale));
}
- shipmentPackageRouteSeg.setBytes("labelImage",
Base64.getMimeDecoder().decode(labelImageString.getBytes(UtilIO.getUtf8())));
+ shipmentPackageRouteSeg.setBytes("labelImage",
Base64.getMimeDecoder().decode(labelImageString.getBytes(StandardCharsets.UTF_8)));
String trackingCode =
UtilXml.childElementValue(responseElement, "DeliveryConfirmationNumber");
if (UtilValidate.isEmpty(trackingCode)) {
return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -1650,7 +1651,7 @@ public class UspsServices {
return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
"FacilityShipmentUspsPriorityMailLabelResponseIncompleteElementLabelImage",
locale));
}
- shipmentPackageRouteSeg.setBytes("labelImage",
Base64.getMimeDecoder().decode(labelImageString.getBytes(UtilIO.getUtf8())));
+ shipmentPackageRouteSeg.setBytes("labelImage",
Base64.getMimeDecoder().decode(labelImageString.getBytes(StandardCharsets.UTF_8)));
String trackingCode = UtilXml.childElementValue(responseElement,
"BarcodeNumber");
if (UtilValidate.isEmpty(trackingCode)) {
return
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -1704,7 +1705,7 @@ public class UspsServices {
UtilMisc.toMap("errorString", e.getMessage()),
locale));
}
- String xmlString = new String(os.toByteArray(), UtilIO.getUtf8());
+ String xmlString = new String(os.toByteArray(),
StandardCharsets.UTF_8);
Debug.logInfo("USPS XML request string: " + xmlString, module);
Modified:
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java
Sat Jul 20 18:41:37 2019
@@ -66,11 +66,11 @@ public class HashCrypt {
if (crypted.startsWith("{PBKDF2")) {
return doComparePbkdf2(crypted, password);
} else if (crypted.startsWith("{")) {
- return doCompareTypePrefix(crypted, defaultCrypt,
password.getBytes(UtilIO.getUtf8()));
+ return doCompareTypePrefix(crypted, defaultCrypt,
password.getBytes(StandardCharsets.UTF_8));
} else if (crypted.startsWith("$")) {
- return doComparePosix(crypted, defaultCrypt,
password.getBytes(UtilIO.getUtf8()));
+ return doComparePosix(crypted, defaultCrypt,
password.getBytes(StandardCharsets.UTF_8));
} else {
- return doCompareBare(crypted, defaultCrypt,
password.getBytes(UtilIO.getUtf8()));
+ return doCompareBare(crypted, defaultCrypt,
password.getBytes(StandardCharsets.UTF_8));
}
}
@@ -122,21 +122,21 @@ public class HashCrypt {
if (hashType.startsWith("PBKDF2")) {
return password != null ? pbkdf2HashCrypt(hashType, salt,
password) : null;
}
- return password != null ? cryptBytes(hashType, salt,
password.getBytes(UtilIO.getUtf8())) : null;
+ return password != null ? cryptBytes(hashType, salt,
password.getBytes(StandardCharsets.UTF_8)) : null;
}
public static String cryptUTF8(String hashType, String salt, String value)
{
if (hashType.startsWith("PBKDF2")) {
return value != null ? pbkdf2HashCrypt(hashType, salt, value) :
null;
}
- return value != null ? cryptBytes(hashType, salt,
value.getBytes(UtilIO.getUtf8())) : null;
+ return value != null ? cryptBytes(hashType, salt,
value.getBytes(StandardCharsets.UTF_8)) : null;
}
public static String cryptValue(String hashType, String salt, String
value) {
if (hashType.startsWith("PBKDF2")) {
return value != null ? pbkdf2HashCrypt(hashType, salt, value) :
null;
}
- return value != null ? cryptBytes(hashType, salt,
value.getBytes(UtilIO.getUtf8())) : null;
+ return value != null ? cryptBytes(hashType, salt,
value.getBytes(StandardCharsets.UTF_8)) : null;
}
public static String cryptBytes(String hashType, String salt, byte[]
bytes) {
@@ -155,7 +155,7 @@ public class HashCrypt {
private static String getCryptedBytes(String hashType, String salt, byte[]
bytes) {
try {
MessageDigest messagedigest = MessageDigest.getInstance(hashType);
- messagedigest.update(salt.getBytes(UtilIO.getUtf8()));
+ messagedigest.update(salt.getBytes(StandardCharsets.UTF_8));
messagedigest.update(bytes);
return
Base64.encodeBase64URLSafeString(messagedigest.digest()).replace('+', '.');
} catch (NoSuchAlgorithmException e) {
@@ -169,7 +169,7 @@ public class HashCrypt {
salt = getSalt();
}
try {
- PBEKeySpec spec = new PBEKeySpec(chars,
salt.getBytes(UtilIO.getUtf8()), PBKDF2_ITERATIONS, 64 * 4);
+ PBEKeySpec spec = new PBEKeySpec(chars,
salt.getBytes(StandardCharsets.UTF_8), PBKDF2_ITERATIONS, 64 * 4);
SecretKeyFactory skf = SecretKeyFactory.getInstance(hashType);
byte[] hash =
Base64.encodeBase64(skf.generateSecret(spec).getEncoded());
String pbkdf2Type = null;
@@ -208,8 +208,8 @@ public class HashCrypt {
String hashType = crypted.substring(1, typeEnd);
String[] parts = crypted.split("\\$");
int iterations = Integer.parseInt(parts[0].substring(typeEnd+1));
- byte[] salt =
Arrays.toString(java.util.Base64.getMimeDecoder().decode(parts[1].getBytes(StandardCharsets.UTF_8))).getBytes(UtilIO.getUtf8());
- byte[] hash =
Base64.decodeBase64(parts[2].getBytes(UtilIO.getUtf8()));
+ byte[] salt =
Arrays.toString(java.util.Base64.getMimeDecoder().decode(parts[1].getBytes(StandardCharsets.UTF_8))).getBytes(StandardCharsets.UTF_8);
+ byte[] hash =
Base64.decodeBase64(parts[2].getBytes(StandardCharsets.UTF_8));
PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt,
iterations, hash.length * 8);
switch (hashType.substring(hashType.indexOf("-")+1)) {
@@ -259,7 +259,7 @@ public class HashCrypt {
byte[] codeBytes;
try {
if (code == null) {
- codeBytes = str.getBytes(UtilIO.getUtf8());
+ codeBytes = str.getBytes(StandardCharsets.UTF_8);
} else {
codeBytes = str.getBytes(code);
}
@@ -344,7 +344,7 @@ public class HashCrypt {
}
try {
MessageDigest messagedigest = MessageDigest.getInstance(hashType);
- byte[] strBytes = str.getBytes(UtilIO.getUtf8());
+ byte[] strBytes = str.getBytes(StandardCharsets.UTF_8);
messagedigest.update(strBytes);
return oldFunnyHex(messagedigest.digest());
Modified:
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java
Sat Jul 20 18:41:37 2019
@@ -35,6 +35,7 @@ import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.net.MalformedURLException;
+import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
@@ -200,7 +201,7 @@ public final class FileUtil {
throw new IOException("Cannot obtain buffered writer for an empty
filename!");
}
- return new BufferedWriter(new OutputStreamWriter(new
FileOutputStream(fileName), UtilIO.getUtf8()));
+ return new BufferedWriter(new OutputStreamWriter(new
FileOutputStream(fileName), StandardCharsets.UTF_8));
}
public static OutputStream getBufferedOutputStream(String path, String
name) throws IOException {
@@ -243,8 +244,7 @@ public final class FileUtil {
StringBuffer buf = new StringBuffer();
try (
- BufferedReader in = new BufferedReader(new
InputStreamReader(new FileInputStream(file), UtilIO
- .getUtf8()));) {
+ BufferedReader in = new BufferedReader(new
InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));) {
String str;
while ((str = in.readLine()) != null) {
@@ -386,7 +386,7 @@ public final class FileUtil {
File inFile = new File(fileName);
if (inFile.exists()) {
try (
- BufferedReader in = new BufferedReader(new InputStreamReader(new
FileInputStream(inFile),UtilIO.getUtf8()));
+ BufferedReader in = new BufferedReader(new InputStreamReader(new
FileInputStream(inFile),StandardCharsets.UTF_8));
) {
return containsString(in, searchString);
}
Modified:
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java
Sat Jul 20 18:41:37 2019
@@ -23,6 +23,7 @@ package org.apache.ofbiz.base.util;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -137,7 +138,7 @@ public class HttpRequestFileUpload {
}
int boundaryLength = i - 2;
- String boundary = new String(line, 0, boundaryLength,
UtilIO.getUtf8()); // -2 discards the newline character
+ String boundary = new String(line, 0, boundaryLength,
StandardCharsets.UTF_8); // -2 discards the newline character
Debug.logInfo("boundary=[" + boundary + "] length is " +
boundaryLength, module);
fields = new HashMap<>();
@@ -146,11 +147,11 @@ public class HttpRequestFileUpload {
String newLine = "";
if (i > -1) {
- newLine = new String(line, 0, i, UtilIO.getUtf8());
+ newLine = new String(line, 0, i, StandardCharsets.UTF_8);
}
if (newLine.startsWith("Content-Disposition: form-data; name=\""))
{
if (newLine.indexOf("filename=\"") != -1) {
- setFilename(new String(line, 0, i - 2, UtilIO.getUtf8()));
+ setFilename(new String(line, 0, i - 2,
StandardCharsets.UTF_8));
if (filename == null) {
return;
}
@@ -158,7 +159,7 @@ public class HttpRequestFileUpload {
i = waitingReadLine(in, line, 0, BUFFER_SIZE,
requestLength);
requestLength -= i;
- setContentType(new String(line, 0, i - 2,
UtilIO.getUtf8()));
+ setContentType(new String(line, 0, i - 2,
StandardCharsets.UTF_8));
// blank line
i = waitingReadLine(in, line, 0, BUFFER_SIZE,
requestLength);
@@ -192,7 +193,7 @@ public class HttpRequestFileUpload {
}
try (
FileOutputStream fos = new
FileOutputStream(savePath + filenameToUse);) {
- boolean bail = (new String(line, 0, i,
UtilIO.getUtf8()).startsWith(boundary));
+ boolean bail = (new String(line, 0, i,
StandardCharsets.UTF_8).startsWith(boundary));
boolean oneByteLine = (i == 1); // handle one-byte
lines
while ((requestLength > 0/* i != -1 */) && !bail) {
@@ -247,7 +248,7 @@ public class HttpRequestFileUpload {
requestLength -= i;
i = waitingReadLine(in, line, 0, BUFFER_SIZE,
requestLength);
requestLength -= i;
- newLine = new String(line, 0, i, UtilIO.getUtf8());
+ newLine = new String(line, 0, i, StandardCharsets.UTF_8);
StringBuilder fieldValue = new StringBuilder(BUFFER_SIZE);
while (requestLength > 0/* i != -1*/ &&
!newLine.startsWith(boundary)) {
@@ -263,7 +264,7 @@ public class HttpRequestFileUpload {
} else {
fieldValue.append(newLine);
}
- newLine = new String(line, 0, i, UtilIO.getUtf8());
+ newLine = new String(line, 0, i,
StandardCharsets.UTF_8);
}
fields.put(fieldName, fieldValue.toString());
}
Modified:
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/KeyStoreUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/KeyStoreUtil.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/KeyStoreUtil.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/KeyStoreUtil.java
Sat Jul 20 18:41:37 2019
@@ -31,6 +31,7 @@ import java.io.PrintStream;
import java.io.Reader;
import java.io.StringReader;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.security.KeyFactory;
import java.security.KeyStore;
@@ -187,7 +188,7 @@ public final class KeyStoreUtil {
byte[] certBuf = cert.getEncoded();
StringBuilder buf = new StringBuilder();
buf.append("-----BEGIN CERTIFICATE-----\n");
- buf.append(new String(Base64.encodeBase64Chunked(certBuf),
UtilIO.getUtf8()));
+ buf.append(new String(Base64.encodeBase64Chunked(certBuf),
StandardCharsets.UTF_8));
buf.append("\n-----END CERTIFICATE-----\n");
return buf.toString();
}
@@ -201,7 +202,7 @@ public final class KeyStoreUtil {
}
public static Certificate pemToCert(InputStream is) throws IOException,
CertificateException {
- return pemToCert(new InputStreamReader(is, UtilIO.getUtf8()));
+ return pemToCert(new InputStreamReader(is, StandardCharsets.UTF_8));
}
public static Certificate pemToCert(Reader r) throws IOException,
CertificateException {
@@ -210,7 +211,7 @@ public final class KeyStoreUtil {
BufferedReader reader = new BufferedReader(r);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- PrintStream ps = new PrintStream(baos, false,
UtilIO.getUtf8().toString());
+ PrintStream ps = new PrintStream(baos, false,
StandardCharsets.UTF_8.toString());
String line;
Modified:
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java
Sat Jul 20 18:41:37 2019
@@ -23,6 +23,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -126,8 +127,7 @@ public final class ScriptUtil {
try {
Compilable compilableEngine = (Compilable) engine;
URL scriptUrl = FlexibleLocation.resolveLocation(filePath);
- BufferedReader reader = new BufferedReader(new
InputStreamReader(scriptUrl.openStream(), UtilIO
- .getUtf8()));
+ BufferedReader reader = new BufferedReader(new
InputStreamReader(scriptUrl.openStream(), StandardCharsets.UTF_8));
script = compilableEngine.compile(reader);
if (Debug.verboseOn()) {
Debug.logVerbose("Compiled script " + filePath + " using
engine " + engine.getClass().getName(), module);
@@ -363,8 +363,7 @@ public final class ScriptUtil {
engine.setContext(scriptContext);
URL scriptUrl = FlexibleLocation.resolveLocation(filePath);
try (
- InputStreamReader reader = new InputStreamReader(new
FileInputStream(scriptUrl.getFile()), UtilIO
- .getUtf8());) {
+ InputStreamReader reader = new InputStreamReader(new
FileInputStream(scriptUrl.getFile()), StandardCharsets.UTF_8);) {
Object result = engine.eval(reader);
if (UtilValidate.isNotEmpty(functionName)) {
try {
Modified:
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java
Sat Jul 20 18:41:37 2019
@@ -19,6 +19,7 @@
package org.apache.ofbiz.base.util;
import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.ParseException;
@@ -385,7 +386,7 @@ public final class UtilFormatOut {
if (data.length > 5120) {
return "[...binary data]";
}
- return new String(Base64.getMimeEncoder().encode(data),
UtilIO.getUtf8());
+ return new String(Base64.getMimeEncoder().encode(data),
StandardCharsets.UTF_8);
}
return obj1.toString();
}
Modified:
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java
Sat Jul 20 18:41:37 2019
@@ -31,9 +31,9 @@ import java.io.Writer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
public final class UtilIO {
- private static final Charset UTF8 = Charset.forName("UTF-8");
public static final String module = UtilIO.class.getName();
private UtilIO () {}
@@ -61,7 +61,7 @@ public final class UtilIO {
* to \n
*/
public static final String readString(byte[] bytes) {
- return readString(bytes, 0, bytes.length, UTF8);
+ return readString(bytes, 0, bytes.length, StandardCharsets.UTF_8);
}
/** Convert a byte array to a string; consistently uses \n line endings
@@ -75,7 +75,7 @@ public final class UtilIO {
* to \n
*/
public static final String readString(byte[] bytes, int offset, int
length) {
- return readString(bytes, offset, length, UTF8);
+ return readString(bytes, offset, length, StandardCharsets.UTF_8);
}
/** Convert a byte array to a string; consistently uses \n line endings
@@ -146,7 +146,7 @@ public final class UtilIO {
* to \n
*/
public static final String readString(InputStream stream) throws
IOException {
- return readString(stream, UTF8);
+ return readString(stream, StandardCharsets.UTF_8);
}
/** Convert an {@link InputStream} to a string; consistently uses \n line
endings
@@ -221,7 +221,7 @@ public final class UtilIO {
* @param value the value to write
*/
public static void writeString(File file, String value) throws IOException
{
- writeString(new FileOutputStream(file), UTF8, value);
+ writeString(new FileOutputStream(file), StandardCharsets.UTF_8, value);
}
/** Convert a \n string to a platform encoding. This uses a default
@@ -231,7 +231,7 @@ public final class UtilIO {
* @param value the value to write
*/
public static void writeString(OutputStream out, String value) throws
IOException {
- writeString(out, UTF8, value);
+ writeString(out, StandardCharsets.UTF_8, value);
}
/** Convert a \n string to a platform encoding. This uses the
@@ -269,8 +269,4 @@ public final class UtilIO {
writer.write(value.substring(r));
}
}
-
- public static Charset getUtf8() {
- return UTF8;
- }
}
Modified:
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java
Sat Jul 20 18:41:37 2019
@@ -26,6 +26,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.util.Collection;
@@ -526,7 +527,7 @@ public class UelFunctions {
sb.append("/>\n<xsl:template match=\"@*|node()\">\n");
sb.append("<xsl:copy><xsl:apply-templates
select=\"@*|node()\"/></xsl:copy>\n");
sb.append("</xsl:template>\n</xsl:stylesheet>\n");
- ByteArrayInputStream bis = new
ByteArrayInputStream(sb.toString().getBytes(UtilIO.getUtf8()));
+ ByteArrayInputStream bis = new
ByteArrayInputStream(sb.toString().getBytes(StandardCharsets.UTF_8));
TransformerFactory transformerFactory =
TransformerFactory.newInstance();
try (ByteArrayOutputStream os = new ByteArrayOutputStream();) {
UtilXml.transformDomDocument(transformerFactory.newTransformer(new
StreamSource(bis)), node, os);
Modified:
ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilIOTests.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilIOTests.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilIOTests.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilIOTests.java
Sat Jul 20 18:41:37 2019
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEqu
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import org.junit.Test;
@@ -68,13 +69,13 @@ public class UtilIOTests {
private static void readStringTest_1(String label, String wanted, byte[]
toRead) throws IOException {
assertEquals("readString bytes default:" + label, wanted,
UtilIO.readString(toRead));
assertEquals("readString bytes UTF-8:" + label, wanted,
UtilIO.readString(toRead, "UTF-8"));
- assertEquals("readString bytes UTF8:" + label, wanted,
UtilIO.readString(toRead, UtilIO.getUtf8()));
+ assertEquals("readString bytes UTF8:" + label, wanted,
UtilIO.readString(toRead, StandardCharsets.UTF_8));
assertEquals("readString bytes offset/length default:" + label,
wanted, UtilIO.readString(toRead, 0, toRead.length));
assertEquals("readString bytes offset/length UTF-8:" + label, wanted,
UtilIO.readString(toRead, 0, toRead.length, "UTF-8"));
- assertEquals("readString bytes offset/length UTF8:" + label, wanted,
UtilIO.readString(toRead, 0, toRead.length, UtilIO.getUtf8()));
+ assertEquals("readString bytes offset/length UTF8:" + label, wanted,
UtilIO.readString(toRead, 0, toRead.length, StandardCharsets.UTF_8));
assertEquals("readString stream default:" + label, wanted,
UtilIO.readString(new ByteArrayInputStream(toRead)));
assertEquals("readString stream UTF-8:" + label, wanted,
UtilIO.readString(new ByteArrayInputStream(toRead), "UTF-8"));
- assertEquals("readString stream UTF8:" + label, wanted,
UtilIO.readString(new ByteArrayInputStream(toRead), UtilIO.getUtf8()));
+ assertEquals("readString stream UTF8:" + label, wanted,
UtilIO.readString(new ByteArrayInputStream(toRead), StandardCharsets.UTF_8));
}
@Test
@@ -104,7 +105,7 @@ public class UtilIOTests {
UtilIO.writeString(baos, "UTF-8", toWrite);
assertArrayEquals("writeString UTF-8:" + label, wanted,
baos.toByteArray());
baos = new ByteArrayOutputStream();
- UtilIO.writeString(baos, UtilIO.getUtf8(), toWrite);
+ UtilIO.writeString(baos, StandardCharsets.UTF_8, toWrite);
assertArrayEquals("writeString UTF8:" + label, wanted,
baos.toByteArray());
}
}
Modified:
ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java
Sat Jul 20 18:41:37 2019
@@ -30,6 +30,7 @@ import java.io.OutputStreamWriter;
import java.io.RandomAccessFile;
import java.io.Writer;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.LinkedHashMap;
@@ -472,8 +473,8 @@ public class CommonServices {
String line;
- try (BufferedReader reader = new BufferedReader(new
InputStreamReader(in, UtilIO.getUtf8()));
- Writer writer = new OutputStreamWriter(out, UtilIO.getUtf8()))
{
+ try (BufferedReader reader = new BufferedReader(new
InputStreamReader(in, StandardCharsets.UTF_8));
+ Writer writer = new OutputStreamWriter(out,
StandardCharsets.UTF_8)) {
while ((line = reader.readLine()) != null) {
Debug.logInfo("Read line: " + line, module);
writer.write(line);
Modified:
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile.java
Sat Jul 20 18:41:37 2019
@@ -26,6 +26,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@@ -136,7 +137,7 @@ public class DataFile {
throw new IllegalStateException("Content is empty, can't read
file");
}
- ByteArrayInputStream bis = new
ByteArrayInputStream(content.getBytes(UtilIO.getUtf8()));
+ ByteArrayInputStream bis = new
ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8));
readDataFile(bis, null);
}
@@ -219,7 +220,7 @@ public class DataFile {
String line = record.writeLineString(modelDataFile);
try {
- outStream.write(line.getBytes(UtilIO.getUtf8()));
+ outStream.write(line.getBytes(StandardCharsets.UTF_8));
}
catch (IOException e) {
throw new DataFileException("Could not write to stream;", e);
Modified:
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile2EntityXml.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile2EntityXml.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile2EntityXml.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/DataFile2EntityXml.java
Sat Jul 20 18:41:37 2019
@@ -25,6 +25,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilFormatOut;
@@ -48,7 +49,7 @@ public class DataFile2EntityXml {
public static void writeToEntityXml(String fileName, DataFile dataFile)
throws DataFileException {
File file = new File(fileName);
- try (BufferedWriter outFile = new BufferedWriter(new
OutputStreamWriter(new FileOutputStream(file), UtilIO.getUtf8()));) {
+ try (BufferedWriter outFile = new BufferedWriter(new
OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8));) {
outFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
outFile.newLine();
@@ -96,7 +97,7 @@ public class DataFile2EntityXml {
String definitionLoc = args[1];
String definitionName = args[2];
- try (BufferedWriter outFile = new BufferedWriter(new
OutputStreamWriter(new FileOutputStream(dataFileLoc + ".xml"),
UtilIO.getUtf8()));) {
+ try (BufferedWriter outFile = new BufferedWriter(new
OutputStreamWriter(new FileOutputStream(dataFileLoc + ".xml"),
StandardCharsets.UTF_8));) {
URL dataFileUrl = UtilURL.fromFilename(dataFileLoc);
URL definitionUrl = UtilURL.fromFilename(definitionLoc);
Modified:
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
Sat Jul 20 18:41:37 2019
@@ -19,6 +19,7 @@
package org.apache.ofbiz.datafile;
import java.io.Serializable;
+import java.nio.charset.StandardCharsets;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -261,7 +262,7 @@ public class Record implements Serializa
else if (fieldType.equals("java.lang.String") ||
fieldType.equals("String")) {
if (field.format.equals("EncryptedString")) {
String hashType = LoginServices.getHashType();
- set(name, HashCrypt.digestHash(hashType,
value.getBytes(UtilIO.getUtf8())));
+ set(name, HashCrypt.digestHash(hashType,
value.getBytes(StandardCharsets.UTF_8)));
} else {
set(name, value);
}
@@ -283,11 +284,11 @@ public class Record implements Serializa
} else if (fieldType.equals("java.lang.Double") ||
fieldType.equals("Double")) {
set(name, Double.valueOf(value));
} else if (fieldType.equals("LEShort")) {
- set(name, readLEShort(value.getBytes(UtilIO.getUtf8())));
+ set(name, readLEShort(value.getBytes(StandardCharsets.UTF_8)));
} else if (fieldType.equals("LEInteger")) {
- set(name, readLEInt(value.getBytes(UtilIO.getUtf8())));
+ set(name, readLEInt(value.getBytes(StandardCharsets.UTF_8)));
} else if (fieldType.equals("LELong")) {
- set(name, readLELong(value.getBytes(UtilIO.getUtf8())));
+ set(name, readLELong(value.getBytes(StandardCharsets.UTF_8)));
} else {
throw new IllegalArgumentException("Field type " + fieldType + "
not currently supported. Sorry.");
}
Modified:
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java
Sat Jul 20 18:41:37 2019
@@ -22,6 +22,7 @@ import java.io.PrintWriter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.sql.Blob;
import java.sql.SQLException;
import java.util.Base64;
@@ -490,7 +491,7 @@ public class GenericEntity implements Ma
Debug.logError(e, module);
}
} else if ((value instanceof String) &&
"byte[]".equals(type.getJavaType())) {
- value = ((String) value).getBytes(UtilIO.getUtf8());
+ value = ((String) value).getBytes(StandardCharsets.UTF_8);
}
if (!ObjectType.instanceOf(value, type.getJavaType())) {
if (!("java.sql.Blob".equals(type.getJavaType()) && (value
instanceof byte[] || value == null || ByteBuffer.class.isInstance(value)))) {
@@ -1193,7 +1194,7 @@ public class GenericEntity implements Ma
boolean b1 = obj instanceof byte [];
if (b1) {
byte [] binData = (byte [])obj;
- String strData = new
String(Base64.getMimeEncoder().encode(binData), UtilIO.getUtf8());
+ String strData = new
String(Base64.getMimeEncoder().encode(binData), StandardCharsets.UTF_8);
cdataMap.put(name, strData);
} else {
Debug.logWarning("Field:" + name + " is not of type
'byte[]'. obj: " + obj, module);
@@ -1370,7 +1371,7 @@ public class GenericEntity implements Ma
// random encoding; just treat it as a series of raw bytes.
// This won't give the same output as the value stored in the
// database, but should be good enough for printing
- curValue = HashCrypt.cryptBytes(null, null,
encryptField.getBytes(UtilIO.getUtf8()));
+ curValue = HashCrypt.cryptBytes(null, null,
encryptField.getBytes(StandardCharsets.UTF_8));
}
theString.append('[');
theString.append(curKey);
Modified:
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
Sat Jul 20 18:41:37 2019
@@ -19,6 +19,7 @@
package org.apache.ofbiz.entity.util;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
@@ -377,7 +378,7 @@ public final class EntityCrypto {
@Override
protected String getHashedKeyName(String originalKeyName) {
- return HashCrypt.digestHash64("SHA",
originalKeyName.getBytes(UtilIO.getUtf8()));
+ return HashCrypt.digestHash64("SHA",
originalKeyName.getBytes(StandardCharsets.UTF_8));
}
@Override
Modified:
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java
Sat Jul 20 18:41:37 2019
@@ -26,6 +26,7 @@ import java.io.InputStreamReader;
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
@@ -314,7 +315,7 @@ public class EntitySaxReader extends Def
throw new SAXException("Could not find transform template with
resource path: " + templatePath);
} else {
try {
- BufferedReader templateReader = new BufferedReader(new
InputStreamReader(templateUrl.openStream(),UtilIO.getUtf8()));
+ BufferedReader templateReader = new BufferedReader(new
InputStreamReader(templateUrl.openStream(),StandardCharsets.UTF_8));
StringWriter outWriter = new StringWriter();
Configuration config = FreeMarkerWorker.newConfiguration();
Modified:
ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java
Sat Jul 20 18:41:37 2019
@@ -27,6 +27,7 @@ import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
@@ -175,7 +176,7 @@ public class EntityDataServices {
if (listFile.exists()) {
BufferedReader reader = null;
try {
- reader = new BufferedReader(new InputStreamReader(new
FileInputStream(listFile), UtilIO.getUtf8()));
+ reader = new BufferedReader(new InputStreamReader(new
FileInputStream(listFile), StandardCharsets.UTF_8));
} catch (FileNotFoundException e) {
Debug.logError(e, module);
}
@@ -227,7 +228,7 @@ public class EntityDataServices {
if (headerFile.exists()) {
try (
BufferedReader reader = new BufferedReader(new
InputStreamReader(new FileInputStream(headerFile),
- UtilIO.getUtf8()));) {
+ StandardCharsets.UTF_8));) {
String firstLine = reader.readLine();
if (firstLine != null) {
@@ -250,7 +251,7 @@ public class EntityDataServices {
private static int readEntityFile(File file, String delimiter, Delegator
delegator) throws IOException, GeneralException {
String entityName = file.getName().substring(0,
file.getName().lastIndexOf('.'));
- BufferedReader reader = new BufferedReader(new InputStreamReader(new
FileInputStream(file), UtilIO.getUtf8()));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(new
FileInputStream(file), StandardCharsets.UTF_8));
String[] header = readEntityHeader(file, delimiter, reader);
//Debug.logInfo("Opened data file [" + file.getName() + "] now
running...", module);
Modified:
ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonHelper.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonHelper.java?rev=1863505&r1=1863504&r2=1863505&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonHelper.java
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/EntityJsonHelper.java
Sat Jul 20 18:41:37 2019
@@ -25,6 +25,7 @@ import org.apache.ofbiz.entity.GenericVa
import org.apache.ofbiz.entity.model.ModelField;
import java.io.PrintWriter;
+import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.HashMap;
import java.util.Iterator;
@@ -52,7 +53,7 @@ public class EntityJsonHelper {
boolean b1 = obj instanceof byte[];
if (b1) {
byte[] binData = (byte[]) obj;
- String strData = new
String(Base64.getMimeEncoder().encode(binData), UtilIO.getUtf8());
+ String strData = new
String(Base64.getMimeEncoder().encode(binData), StandardCharsets.UTF_8);
if (UtilValidate.isNotEmpty(strData)) {
fieldMap.put(name, strData);
}
@@ -105,7 +106,7 @@ public class EntityJsonHelper {
boolean b1 = obj instanceof byte[];
if (b1) {
byte[] binData = (byte[]) obj;
- String strData = new
String(Base64.getMimeEncoder().encode(binData), UtilIO.getUtf8());
+ String strData = new
String(Base64.getMimeEncoder().encode(binData), StandardCharsets.UTF_8);
if (UtilValidate.isNotEmpty(strData)) {
fieldMap.put(name, strData);
}