mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -27,7 +27,6 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
/**
|
||||
* 时间工具类
|
||||
@@ -931,7 +930,6 @@ public class DateUtil extends CalendarUtil {
|
||||
|
||||
//标准日期格式(包括单个数字的日期时间)
|
||||
dateStr = normalize(dateStr);
|
||||
final Matcher matcher = DatePattern.REGEX_NORM.matcher(dateStr);
|
||||
if (ReUtil.isMatch(DatePattern.REGEX_NORM, dateStr)) {
|
||||
final int colonCount = StrUtil.count(dateStr, CharUtil.COLON);
|
||||
switch (colonCount) {
|
||||
|
@@ -778,9 +778,6 @@ public class GifDecoder {
|
||||
lastRect = new Rectangle(ix, iy, iw, ih);
|
||||
lastImage = image;
|
||||
lastBgColor = bgColor;
|
||||
int dispose = 0;
|
||||
boolean transparency = false;
|
||||
int delay = 0;
|
||||
lct = null;
|
||||
}
|
||||
|
||||
|
@@ -350,10 +350,7 @@ public class NeuQuant {
|
||||
/* Unbias network to give byte values 0..255 and record position i to prepare for sort
|
||||
----------------------------------------------------------------------------------- */
|
||||
public void unbiasnet() {
|
||||
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < NETSIZE; i++) {
|
||||
for (int i = 0; i < NETSIZE; i++) {
|
||||
network[i][0] >>= NETBIASSHIFT;
|
||||
network[i][1] >>= NETBIASSHIFT;
|
||||
network[i][2] >>= NETBIASSHIFT;
|
||||
|
@@ -387,7 +387,6 @@ public class IdcardUtil {
|
||||
|
||||
// 首字母A-Z,A表示1,以此类推
|
||||
char start = idcard.charAt(0);
|
||||
int iStart = start - 'A' + 1;
|
||||
String mid = card.substring(1, 7);
|
||||
String end = card.substring(7, 8);
|
||||
char[] chars = mid.toCharArray();
|
||||
|
@@ -2038,7 +2038,6 @@ public class PrimitiveArrayUtil {
|
||||
}
|
||||
int i = Math.max(startIndexInclusive, 0);
|
||||
int j = Math.min(array.length, endIndexExclusive) - 1;
|
||||
long tmp;
|
||||
while (j > i) {
|
||||
swap(array, i, j);
|
||||
j--;
|
||||
@@ -2073,7 +2072,6 @@ public class PrimitiveArrayUtil {
|
||||
}
|
||||
int i = Math.max(startIndexInclusive, 0);
|
||||
int j = Math.min(array.length, endIndexExclusive) - 1;
|
||||
int tmp;
|
||||
while (j > i) {
|
||||
swap(array, i, j);
|
||||
j--;
|
||||
@@ -2108,7 +2106,6 @@ public class PrimitiveArrayUtil {
|
||||
}
|
||||
int i = Math.max(startIndexInclusive, 0);
|
||||
int j = Math.min(array.length, endIndexExclusive) - 1;
|
||||
short tmp;
|
||||
while (j > i) {
|
||||
swap(array, i, j);
|
||||
j--;
|
||||
@@ -2143,7 +2140,6 @@ public class PrimitiveArrayUtil {
|
||||
}
|
||||
int i = Math.max(startIndexInclusive, 0);
|
||||
int j = Math.min(array.length, endIndexExclusive) - 1;
|
||||
char tmp;
|
||||
while (j > i) {
|
||||
swap(array, i, j);
|
||||
j--;
|
||||
@@ -2178,7 +2174,6 @@ public class PrimitiveArrayUtil {
|
||||
}
|
||||
int i = Math.max(startIndexInclusive, 0);
|
||||
int j = Math.min(array.length, endIndexExclusive) - 1;
|
||||
byte tmp;
|
||||
while (j > i) {
|
||||
swap(array, i, j);
|
||||
j--;
|
||||
@@ -2213,7 +2208,6 @@ public class PrimitiveArrayUtil {
|
||||
}
|
||||
int i = Math.max(startIndexInclusive, 0);
|
||||
int j = Math.min(array.length, endIndexExclusive) - 1;
|
||||
double tmp;
|
||||
while (j > i) {
|
||||
swap(array, i, j);
|
||||
j--;
|
||||
@@ -2248,7 +2242,6 @@ public class PrimitiveArrayUtil {
|
||||
}
|
||||
int i = Math.max(startIndexInclusive, 0);
|
||||
int j = Math.min(array.length, endIndexExclusive) - 1;
|
||||
float tmp;
|
||||
while (j > i) {
|
||||
swap(array, i, j);
|
||||
j--;
|
||||
@@ -2283,7 +2276,6 @@ public class PrimitiveArrayUtil {
|
||||
}
|
||||
int i = Math.max(startIndexInclusive, 0);
|
||||
int j = Math.min(array.length, endIndexExclusive) - 1;
|
||||
boolean tmp;
|
||||
while (j > i) {
|
||||
swap(array, i, j);
|
||||
j--;
|
||||
|
@@ -54,8 +54,7 @@ public class RadixUtil {
|
||||
public static String encode(final String radixs, final int num) {
|
||||
//考虑到负数问题
|
||||
long tmpNum = (num >= 0 ? num : (0x100000000L - (~num + 1)));
|
||||
|
||||
return encode(radixs, num, 32);
|
||||
return encode(radixs, tmpNum, 32);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +72,7 @@ public class RadixUtil {
|
||||
return encode(radixs, num, 64);
|
||||
}
|
||||
|
||||
private static String encode(final String radixs, final long num, int maxLength) {
|
||||
private static String encode(final String radixs, long num, int maxLength) {
|
||||
if (radixs.length() < 2) {
|
||||
throw new RuntimeException("自定义进制最少两个字符哦!");
|
||||
}
|
||||
|
@@ -660,7 +660,6 @@ public class ZipUtil {
|
||||
public static void read(ZipInputStream zipStream, Consumer<ZipEntry> consumer) {
|
||||
try {
|
||||
ZipEntry zipEntry;
|
||||
File outItemFile;
|
||||
while (null != (zipEntry = zipStream.getNextEntry())) {
|
||||
consumer.accept(zipEntry);
|
||||
}
|
||||
|
@@ -164,7 +164,7 @@ public class BeanUtilTest {
|
||||
public void mapToBeanWinErrorTest() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("age", "哈哈");
|
||||
Person user = BeanUtil.toBean(map, Person.class);
|
||||
BeanUtil.toBean(map, Person.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -559,7 +559,6 @@ public class BeanUtilTest {
|
||||
@Test
|
||||
public void toMapTest() {
|
||||
// 测试转map的时候返回key
|
||||
String name = null;
|
||||
PrivilegeIClassification a = new PrivilegeIClassification();
|
||||
a.setId("1");
|
||||
a.setName("2");
|
||||
|
@@ -47,7 +47,6 @@ public class TaskListenerManager implements Serializable {
|
||||
*/
|
||||
public void notifyTaskStart(TaskExecutor executor) {
|
||||
synchronized (listeners) {
|
||||
int size = listeners.size();
|
||||
TaskListener listener;
|
||||
for (TaskListener taskListener : listeners) {
|
||||
listener = taskListener;
|
||||
@@ -64,7 +63,6 @@ public class TaskListenerManager implements Serializable {
|
||||
*/
|
||||
public void notifyTaskSucceeded(TaskExecutor executor) {
|
||||
synchronized (listeners) {
|
||||
int size = listeners.size();
|
||||
for (TaskListener listener : listeners) {
|
||||
listener.onSucceeded(executor);
|
||||
}
|
||||
|
@@ -675,14 +675,12 @@ public class JSONUtil {
|
||||
return writer;
|
||||
}
|
||||
|
||||
char b; // 前一个字符
|
||||
char c; // 当前字符
|
||||
int len = str.length();
|
||||
if (isWrap) {
|
||||
writer.write('"');
|
||||
}
|
||||
for (int i = 0; i < len; i++) {
|
||||
// b = c;
|
||||
c = str.charAt(i);
|
||||
switch (c) {
|
||||
case '\\':
|
||||
@@ -690,13 +688,6 @@ public class JSONUtil {
|
||||
writer.write("\\");
|
||||
writer.write(c);
|
||||
break;
|
||||
//此处转义导致输出不和预期一致
|
||||
// case '/':
|
||||
// if (b == '<') {
|
||||
// writer.write('\\');
|
||||
// }
|
||||
// writer.write(c);
|
||||
// break;
|
||||
default:
|
||||
writer.write(escape(c));
|
||||
}
|
||||
|
14
pom.xml
14
pom.xml
@@ -44,6 +44,7 @@
|
||||
<compile.version>8</compile.version>
|
||||
<junit.version>4.13.2</junit.version>
|
||||
<lombok.version>1.18.20</lombok.version>
|
||||
<jmh.version>1.32</jmh.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -60,6 +61,19 @@
|
||||
<version>${lombok.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- 性能测试 -->
|
||||
<dependency>
|
||||
<groupId>org.openjdk.jmh</groupId>
|
||||
<artifactId>jmh-core</artifactId>
|
||||
<version>${jmh.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjdk.jmh</groupId>
|
||||
<artifactId>jmh-generator-annprocess</artifactId>
|
||||
<version>${jmh.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<issueManagement>
|
||||
|
Reference in New Issue
Block a user