6.7.0 - Alpha7 - 修复项目配置文件中构建版本号或构建时间出现较大数字时可能导致应用崩溃的问题
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
"images 部分相关方法可能引发内存泄露的问题 _[`issue #372`](http://issues.autojs6.com/372)_",
|
"images 部分相关方法可能引发内存泄露的问题 _[`issue #372`](http://issues.autojs6.com/372)_",
|
||||||
"Android 10 UiObject#child 方法可能出现 ArrayIndexOutOfBoundsException 异常的问题 _[`issue #416`](http://issues.autojs6.com/416)_",
|
"Android 10 UiObject#child 方法可能出现 ArrayIndexOutOfBoundsException 异常的问题 _[`issue #416`](http://issues.autojs6.com/416)_",
|
||||||
"运行项目时 project.json 配置参数无法正常解析的问题",
|
"运行项目时 project.json 配置参数无法正常解析的问题",
|
||||||
|
"修复项目配置文件中构建版本号或构建时间出现较大数字时可能导致应用崩溃的问题",
|
||||||
"频繁获取或重建 ImageReader 时可能因缓冲区暂无可用帧导致应用崩溃的问题",
|
"频繁获取或重建 ImageReader 时可能因缓冲区暂无可用帧导致应用崩溃的问题",
|
||||||
"打包应用无法正常使用 Paddle OCR 与 Rapid OCR 功能的问题",
|
"打包应用无法正常使用 Paddle OCR 与 Rapid OCR 功能的问题",
|
||||||
"版本历史页面部分系统因字体差别导致统计数据显示不完整的问题",
|
"版本历史页面部分系统因字体差别导致统计数据显示不完整的问题",
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@@ -256,7 +257,7 @@ public class ProjectConfig {
|
|||||||
|
|
||||||
setFieldIfMatches(namePattern, s, projectConfig::setName);
|
setFieldIfMatches(namePattern, s, projectConfig::setName);
|
||||||
setFieldIfMatches(versionNamePattern, s, projectConfig::setVersionName);
|
setFieldIfMatches(versionNamePattern, s, projectConfig::setVersionName);
|
||||||
setFieldForIntIfMatches(versionCodePattern, s, projectConfig::setVersionCode);
|
setFieldForDoubleIfMatches(versionCodePattern, s, versionCode -> projectConfig.setVersionCode((int) versionCode));
|
||||||
setFieldIfMatches(packageNamePattern, s, projectConfig::setPackageName);
|
setFieldIfMatches(packageNamePattern, s, projectConfig::setPackageName);
|
||||||
setFieldIfMatches(mainPattern, s, projectConfig::setMainScriptFileName);
|
setFieldIfMatches(mainPattern, s, projectConfig::setMainScriptFileName);
|
||||||
setFieldIfMatches(iconPattern, s, projectConfig::setIconPath);
|
setFieldIfMatches(iconPattern, s, projectConfig::setIconPath);
|
||||||
@@ -266,8 +267,8 @@ public class ProjectConfig {
|
|||||||
setListIfMatches(libsPattern, s, projectConfig::setLibs);
|
setListIfMatches(libsPattern, s, projectConfig::setLibs);
|
||||||
setListIfMatches(useFeaturesPattern, s, projectConfig::setFeatures);
|
setListIfMatches(useFeaturesPattern, s, projectConfig::setFeatures);
|
||||||
|
|
||||||
setFieldForIntIfMatches(buildTimePattern, s, buildInfo::setBuildTime);
|
setFieldForDoubleIfMatches(buildTimePattern, s, buildTime -> buildInfo.setBuildTime((long) buildTime));
|
||||||
setFieldForIntIfMatches(buildNumberPattern, s, buildInfo::setBuildNumber);
|
setFieldForDoubleIfMatches(buildNumberPattern, s, buildNumber -> buildInfo.setBuildNumber((long) buildNumber));
|
||||||
setFieldIfMatches(buildIdPattern, s, buildInfo::setBuildId);
|
setFieldIfMatches(buildIdPattern, s, buildInfo::setBuildId);
|
||||||
|
|
||||||
setFieldForBooleanIfMatches(launchConfigHideLogsPattern, s, value -> launchConfig.setLogsVisible(!value));
|
setFieldForBooleanIfMatches(launchConfigHideLogsPattern, s, value -> launchConfig.setLogsVisible(!value));
|
||||||
@@ -327,17 +328,17 @@ public class ProjectConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setFieldForIntIfMatches(Pattern pattern, String s, java.util.function.IntConsumer setter) {
|
private static void setFieldForDoubleIfMatches(Pattern pattern, String s, java.util.function.DoubleConsumer setter) {
|
||||||
Matcher matcher = pattern.matcher(s);
|
Matcher matcher = pattern.matcher(s);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
setter.accept(Integer.parseInt(matcher.group(1)));
|
setter.accept(Double.parseDouble(Objects.requireNonNull(matcher.group(1))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setFieldForBooleanIfMatches(Pattern pattern, String s, java.util.function.Consumer<Boolean> setter) {
|
private static void setFieldForBooleanIfMatches(Pattern pattern, String s, java.util.function.Consumer<Boolean> setter) {
|
||||||
Matcher matcher = pattern.matcher(s);
|
Matcher matcher = pattern.matcher(s);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
setter.accept(Boolean.getBoolean(matcher.group(1)));
|
setter.accept(Boolean.getBoolean(Objects.requireNonNull(matcher.group(1))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user