diff --git a/HISTORY.md b/HISTORY.md
index 726d5107..5be8f379 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -1,5 +1,18 @@
# 更新记录
+## 2.23.4
+
+1. 修复plain模式下,有oneof时。字段数量检查失败的输出信息错误的问题。
+2. 优化plain模式失败的提示输出。
+3. 更新依赖库
+ + `com.google.protobuf:protobuf-java` -> 4.33.5
+ + `org.apache.poi:poi` -> 5.5.1
+ + `org.apache.poi:poi-ooxml` -> 5.5.1
+ + `org.msgpack:msgpack-core` -> 0.9.11
+ + `org.junit.jupiter:junit-jupiter` -> 6.0.2
+ + `org.junit.platform:junit-platform-launcher` -> 6.0.2
+ + `com.gradleup.shadow` (gradle plugin) -> 9.3.1
+
## 2.23.3
1. 通过 `-Dlog4j.configurationFile=log4j2.xml` 重定向日志输出,可能导致stdout被关闭的问题。
diff --git a/build.gradle b/build.gradle
index 90dc77ef..9d3906e4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,11 +1,11 @@
plugins {
id 'java'
id 'jacoco'
- id 'com.gradleup.shadow' version '9.2.2'
+ id 'com.gradleup.shadow' version '9.3.1'
}
group = 'org.xresloader'
-version = '2.23.3'
+version = '2.23.4'
description = 'xresloader'
buildDir = 'target'
@@ -14,19 +14,19 @@ ext {
targetJavaVersion = JavaVersion.toVersion(targetJava)
versions = [
nashorn : '15.7',
- protobuf : '4.33.1',
- poi : '5.5.0',
- log4j : '2.25.2',
+ protobuf : '4.33.5',
+ poi : '5.5.1',
+ log4j : '2.25.3',
commonsCli : '1.11.0',
commonsCodec : '1.20.0',
ini4j : '0.5.4',
- msgpack : '0.9.10',
+ msgpack : '0.9.11',
json : '20250517',
dom4j : '2.2.0',
commonsCsv : '1.14.1',
snakeyamlEngine: '3.0.1',
- junitJupiter : '6.0.1',
- junitPlatform : '6.0.1'
+ junitJupiter : '6.0.2',
+ junitPlatform : '6.0.2'
]
}
diff --git a/pom.xml b/pom.xml
index 62b8be5e..acf31674 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
org.xresloader
xresloader
- 2.23.3
+ 2.23.4
jar
xresloader
@@ -14,8 +14,8 @@
UTF-8
17
15.7
- 4.33.1
- 5.5.0
+ 4.33.5
+ 5.5.1
2.25.3
1.11.0
1.20.0
@@ -30,7 +30,7 @@
3.5.4
3.6.1
3.6.1
- 6.0.1
+ 6.0.2
22.3.3
1.8.0
diff --git a/sample/proto_v2/role_cfg.bin b/sample/proto_v2/role_cfg.bin
index e55dc832..1649730d 100755
Binary files a/sample/proto_v2/role_cfg.bin and b/sample/proto_v2/role_cfg.bin differ
diff --git a/sample/proto_v3/role_cfg.bin b/sample/proto_v3/role_cfg.bin
index 8fe8c340..c2fa4ad5 100755
Binary files a/sample/proto_v3/role_cfg.bin and b/sample/proto_v3/role_cfg.bin differ
diff --git a/src/org/xresloader/core/data/dst/DataDstImpl.java b/src/org/xresloader/core/data/dst/DataDstImpl.java
index 6e09059f..d6117908 100644
--- a/src/org/xresloader/core/data/dst/DataDstImpl.java
+++ b/src/org/xresloader/core/data/dst/DataDstImpl.java
@@ -821,4 +821,29 @@ static public String getPlainOneofSeparator(DataDstWriterNode.DataDstOneofDescri
return oneof.mutableExtension().plainSeparator;
}
+
+ static public String joinPlainInputHint(String sep, String[] inputs) {
+ if (inputs == null || inputs.length <= 0) {
+ return "";
+ }
+
+ if (sep == null || sep.isEmpty()) {
+ sep = ProgramOptions.getInstance().defaultFieldSeparator;
+ }
+ for (char c : sep.toCharArray()) {
+ boolean valid = true;
+ for (int i = 0; i < inputs.length; ++i) {
+ if (inputs[i].indexOf(c) != -1) {
+ valid = false;
+ break;
+ }
+ }
+ if (valid) {
+ sep = String.valueOf(c);
+ break;
+ }
+ }
+
+ return String.join(sep, inputs);
+ }
}
diff --git a/src/org/xresloader/core/data/dst/DataDstJava.java b/src/org/xresloader/core/data/dst/DataDstJava.java
index 7d50815e..fffc10b1 100644
--- a/src/org/xresloader/core/data/dst/DataDstJava.java
+++ b/src/org/xresloader/core/data/dst/DataDstJava.java
@@ -1171,7 +1171,7 @@ private ParseResult parsePlainDataMessage(String[] inputs, IdentifyDescriptor id
int usedInputIdx = 0;
int fieldSize = 0;
- int atLeastFieldSize = 0;
+ int atLeastFieldSize = field.getTypeDescriptor().getSortedOneofs().size();
HashMap missingFields = new HashMap<>();
for (int i = 0; i < children.size(); ++i) {
DataDstFieldDescriptor child = children.get(i);
@@ -1183,10 +1183,11 @@ private ParseResult parsePlainDataMessage(String[] inputs, IdentifyDescriptor id
if (child.getReferOneof().allowMissingInPlainMode()) {
continue;
}
+
+ atLeastFieldSize += 1;
}
missingFields.put(child.getIndex(), child);
- atLeastFieldSize += 1;
}
for (int i = 0; i < children.size(); ++i) {
@@ -1259,7 +1260,7 @@ && dumpPlainField(ret.value, field.getTypeDescriptor(), null, children.get(i), n
if (!missingFields.isEmpty()) {
String message = String.format(
- "Try to convert %s need at least %d fields, at most %d fields, but only provide %d fields.%s > File: %s, Table: %s, Row: %d, Column: %d(%s)%s > Missing fields: %s",
+ "Try to convert %s need at least %d fields, at most %d fields, but only provide %d fields.%s > File: %s, Table: %s, Row: %d, Column: %d(%s)%s > Missing fields: %s%s > Data: %s",
field.getTypeDescriptor().getFullName(), atLeastFieldSize, fieldSize, inputs.length,
ProgramOptions.getEndl(),
rowContext.fileName, rowContext.tableName,
@@ -1268,13 +1269,16 @@ && dumpPlainField(ret.value, field.getTypeDescriptor(), null, children.get(i), n
ExcelEngine.getColumnName(DataSrcImpl.getOurInstance().getLastColumnNum() + 1),
ProgramOptions.getEndl(),
String.join(",", missingFields.values().stream().map(DataDstFieldDescriptor::getName)
- .collect(Collectors.toList())));
+ .collect(Collectors.toList())),
+ ProgramOptions.getEndl(),
+ joinPlainInputHint(field.getTypeDescriptor().mutableExtension().plainSeparator, inputs));
ProgramOptions.getLoger().warn(message);
} else if (inputs.length > fieldSize) {
String message = String.format(
- "Try to convert %s need at least %d fields, at most %d fields, but provide %d fields.",
+ "Try to convert %s need at least %d fields, at most %d fields, but provide %d fields.%s > Data: %s",
field.getTypeDescriptor().getFullName(), atLeastFieldSize, fieldSize, inputs.length,
- ProgramOptions.getEndl());
+ ProgramOptions.getEndl(),
+ joinPlainInputHint(field.getTypeDescriptor().mutableExtension().plainSeparator, inputs));
throw new ConvException(message);
}
diff --git a/src/org/xresloader/core/data/dst/DataDstPb.java b/src/org/xresloader/core/data/dst/DataDstPb.java
index fa959cde..36a90dce 100644
--- a/src/org/xresloader/core/data/dst/DataDstPb.java
+++ b/src/org/xresloader/core/data/dst/DataDstPb.java
@@ -37,7 +37,6 @@
import org.xresloader.core.data.vfy.DataVerifyImpl.ValidatorTokens;
import org.xresloader.core.data.vfy.DataVerifyPbEnum;
import org.xresloader.core.data.vfy.DataVerifyPbEnumValue;
-import org.xresloader.core.data.vfy.DataVerifyPbMsgOneField;
import org.xresloader.core.data.vfy.DataVerifyPbMsgField;
import org.xresloader.core.data.vfy.DataVerifyPbMsgOneField;
import org.xresloader.core.data.vfy.DataVerifyPbOneof;
@@ -2808,7 +2807,7 @@ private ParseResult parsePlainDataMessage(String[] inputs, IdentifyDescriptor id
int usedInputIdx = 0;
int fieldSize = 0;
- int atLeastFieldSize = 0;
+ int atLeastFieldSize = field.getTypeDescriptor().getSortedOneofs().size();
HashMap missingFields = new HashMap<>();
for (int i = 0; i < children.size(); ++i) {
DataDstFieldDescriptor child = children.get(i);
@@ -2820,10 +2819,10 @@ private ParseResult parsePlainDataMessage(String[] inputs, IdentifyDescriptor id
if (child.getReferOneof().allowMissingInPlainMode()) {
continue;
}
+ atLeastFieldSize += 1;
}
missingFields.put(child.getIndex(), child);
- atLeastFieldSize += 1;
}
for (int i = 0; i < children.size(); ++i) {
@@ -2897,7 +2896,7 @@ && dumpPlainField(builder, null, child, null, inputs[usedInputIdx], rowContext,
if (!missingFields.isEmpty()) {
String message = String.format(
- "Try to convert %s need at least %d fields, at most %d fields, but only provide %d fields.%s > File: %s, Table: %s, Row: %d, Column: %d(%s)%s > Missing fields: %s",
+ "Try to convert %s need at least %d fields, at most %d fields, but only provide %d fields.%s > File: %s, Table: %s, Row: %d, Column: %d(%s)%s > Missing fields: %s%s > Data: %s",
field.getTypeDescriptor().getFullName(), atLeastFieldSize, fieldSize, inputs.length,
ProgramOptions.getEndl(),
rowContext.fileName, rowContext.tableName,
@@ -2906,13 +2905,16 @@ && dumpPlainField(builder, null, child, null, inputs[usedInputIdx], rowContext,
ExcelEngine.getColumnName(DataSrcImpl.getOurInstance().getLastColumnNum() + 1),
ProgramOptions.getEndl(),
String.join(",", missingFields.values().stream().map(DataDstFieldDescriptor::getName)
- .collect(Collectors.toList())));
+ .collect(Collectors.toList())),
+ ProgramOptions.getEndl(),
+ joinPlainInputHint(field.getTypeDescriptor().mutableExtension().plainSeparator, inputs));
ProgramOptions.getLoger().warn(message);
} else if (inputs.length > fieldSize) {
String message = String.format(
- "Try to convert %s need at least %d fields, at most %d fields, but provide %d fields.",
+ "Try to convert %s need at least %d fields, at most %d fields, but provide %d fields.%s > Data: %s",
field.getTypeDescriptor().getFullName(), atLeastFieldSize, fieldSize, inputs.length,
- ProgramOptions.getEndl());
+ ProgramOptions.getEndl(), ProgramOptions.getEndl(),
+ joinPlainInputHint(field.getTypeDescriptor().mutableExtension().plainSeparator, inputs));
throw new ConvException(message);
}