Use parseInt without substring method

This commit is contained in:
김보배(Bobae Kim)/Platform Engineering팀/11ST
2021-11-12 14:53:27 +09:00
committed by Arjen Poutsma
parent 79d3f5c64c
commit 804b343cab
13 changed files with 24 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -106,8 +106,8 @@ public class TaskExecutorFactoryBean implements
int maxPoolSize;
int separatorIndex = this.poolSize.indexOf('-');
if (separatorIndex != -1) {
corePoolSize = Integer.parseInt(this.poolSize.substring(0, separatorIndex));
maxPoolSize = Integer.parseInt(this.poolSize.substring(separatorIndex + 1));
corePoolSize = Integer.parseInt(this.poolSize, 0, separatorIndex, 10);
maxPoolSize = Integer.parseInt(this.poolSize, separatorIndex + 1, this.poolSize.length(), 10);
if (corePoolSize > maxPoolSize) {
throw new IllegalArgumentException(
"Lower bound of pool-size range must not exceed the upper bound");

View File

@@ -161,8 +161,8 @@ final class BitsCronField extends CronField {
return ValueRange.of(result, result);
}
else {
int min = Integer.parseInt(value.substring(0, hyphenPos));
int max = Integer.parseInt(value.substring(hyphenPos + 1));
int min = Integer.parseInt(value, 0, hyphenPos, 10);
int max = Integer.parseInt(value, hyphenPos + 1, value.length(), 10);
min = type.checkValidValue(min);
max = type.checkValidValue(max);
if (type == Type.DAY_OF_WEEK && min == 7) {

View File

@@ -86,7 +86,7 @@ final class QuartzCronField extends CronField {
adjuster = lastDayOfMonth();
}
else { // "L-[0-9]+"
int offset = Integer.parseInt(value.substring(idx + 1));
int offset = Integer.parseInt(value, idx + 1, value.length(), 10);
if (offset >= 0) {
throw new IllegalArgumentException("Offset '" + offset + " should be < 0 '" + value + "'");
}
@@ -104,7 +104,7 @@ final class QuartzCronField extends CronField {
throw new IllegalArgumentException("Unrecognized characters after 'W' in '" + value + "'");
}
else { // "[0-9]+W"
int dayOfMonth = Integer.parseInt(value.substring(0, idx));
int dayOfMonth = Integer.parseInt(value, 0, idx, 10);
dayOfMonth = Type.DAY_OF_MONTH.checkValidValue(dayOfMonth);
TemporalAdjuster adjuster = weekdayNearestTo(dayOfMonth);
return new QuartzCronField(Type.DAY_OF_MONTH, adjuster, value);
@@ -152,7 +152,7 @@ final class QuartzCronField extends CronField {
}
// "[0-7]#[0-9]+"
DayOfWeek dayOfWeek = parseDayOfWeek(value.substring(0, idx));
int ordinal = Integer.parseInt(value.substring(idx + 1));
int ordinal = Integer.parseInt(value, idx + 1, value.length(), 10);
if (ordinal <= 0) {
throw new IllegalArgumentException("Ordinal '" + ordinal + "' in '" + value +
"' must be positive number ");