Skip to content

Commit 04869c6

Browse files
author
Evan Hu
committed
fix error
1 parent b64aed0 commit 04869c6

File tree

1 file changed

+5
-6
lines changed
  • src/main/java/info/xiaomo/core/common/utils

1 file changed

+5
-6
lines changed

src/main/java/info/xiaomo/core/common/utils/Cast.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.io.*;
44
import java.nio.ByteBuffer;
5-
import java.nio.charset.StandardCharsets;
65

76
/**
87
* @author xiaomo
@@ -32,7 +31,7 @@ public static double toDouble(Object number) {
3231
} else if (number instanceof String) {
3332
final String str = (String) number;
3433
if (isNumeric(str) > 0) {
35-
return Double.parseDouble(str);
34+
return Double.valueOf(str);
3635
} else {
3736
return 0L;
3837
}
@@ -111,7 +110,7 @@ public static String objectToString(Object obj) {
111110
try {
112111
ObjectOutputStream oos = new ObjectOutputStream(out);
113112
oos.writeObject(obj);
114-
return out.toString(StandardCharsets.ISO_8859_1);
113+
return out.toString("ISO-8859-1");
115114
} catch (IOException e) {
116115
e.printStackTrace();
117116
}
@@ -121,7 +120,7 @@ public static String objectToString(Object obj) {
121120

122121
public static Object stringToObject(String string) {
123122
try {
124-
byte[] bytes = string.getBytes(StandardCharsets.ISO_8859_1);
123+
byte[] bytes = string.getBytes("ISO-8859-1");
125124
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
126125
ObjectInputStream ois;
127126
ois = new ObjectInputStream(in);
@@ -242,7 +241,7 @@ public static int[] stringToInts(String str, String regex) {
242241
* @return hex string
243242
*/
244243
public static String bytesToHexString(byte[] src) {
245-
StringBuilder stringBuilder = new StringBuilder();
244+
StringBuilder stringBuilder = new StringBuilder("");
246245
if (src == null || src.length <= 0) {
247246
return null;
248247
}
@@ -285,7 +284,7 @@ public static double strToDouble(String str) {
285284
int len = str.length();
286285
int p = str.indexOf('%');
287286
if (p == len - 1) {
288-
return Double.parseDouble(str.substring(0, len - 1)) / 100;
287+
return Double.valueOf(str.substring(0, len - 1)) / 100;
289288
} else if (p > -1) {
290289
return 0.0;
291290
}

0 commit comments

Comments
 (0)