fix #I7SVZF 修正yml配置文件空值没有正常处理的bug

This commit is contained in:
zy
2023-10-09 00:08:33 +08:00
parent ef424a6037
commit b93358c05f
4 changed files with 6 additions and 9 deletions

View File

@@ -252,7 +252,8 @@ public class ParserHelper {
//首先需要对继承自抽象Chain的chain进行字符串替换
parseImplChain(abstratChainMap, implChainSet, chainNode);
//如果一个chain不为抽象chain则进行解析
String chainName = Optional.ofNullable(chainNode).map(JsonNode::textValue).orElse(null);
JsonNode chainNameJsonNode = Optional.ofNullable(chainNode.get(ID)).orElse(chainNode.get(NAME));
String chainName = Optional.ofNullable(chainNameJsonNode).map(JsonNode::textValue).orElse(null);
if(!abstratChainMap.containsKey(chainName)){
parseOneChainConsumer.accept(chainNode);
}
@@ -321,7 +322,7 @@ public class ParserHelper {
* @param implChainSet 已经解析过的实现Chain
*/
private static void parseImplChain(Map<String, JsonNode> abstratChainMap, Set<JsonNode> implChainSet, JsonNode chainNode) {
if(ObjectUtil.isNotNull(chainNode.hasNonNull(EXTENDS))){
if(chainNode.hasNonNull(EXTENDS)){
String baseChainId = chainNode.get(EXTENDS).textValue();
JsonNode baseChain= abstratChainMap.get(baseChainId);
if(baseChain!=null) {

View File

@@ -13,7 +13,6 @@
},
{
"id": "base",
"abstract": true,
"value": "THEN(a, b, {0}, {1});"
},
{
@@ -24,7 +23,6 @@
{
"id": "base2",
"extends": "base",
"abstract": true,
"value": "{0}=THEN(a,b,{3});\n {1}=SWITCH(f).to({4},k);"
}
]

View File

@@ -10,7 +10,7 @@
{4}=THEN(a,b).id("j");
</chain>
<chain abstract="true" name="base">
<chain name="base">
THEN(a, b, {0}, {1})
</chain>
@@ -19,12 +19,12 @@
{1}=SWITCH(f).to(j,k);
</chain>
<chain abstract="true" id="base2" extends="base">
<chain id="base2" extends="base">
{0}=THEN(a,b,{3});
{1}=SWITCH(f).to({4},k);
</chain>
<chain abstract="true" name="base3">
<chain name="base3">
THEN({_pre},{mainChain}, {subChain1},{subChain2},{end_chain})
</chain>

View File

@@ -7,12 +7,10 @@ flow:
extends: base2
value: "{3}=THEN(a,b);\n {4}=THEN(a,b).id(\"j\");"
- id: base
abstract: true
value: "THEN(a, b, {0}, {1});"
- id: implA
extends: base
value: "{0}=IF(c, d, e);\n {1}=SWITCH(f).to(j,k);"
- id: base2
extends: base
abstract: true
value: "{0}=THEN(a,b,{3});\n {1}=SWITCH(f).to({4},k);"