Skip to content

Commit

Permalink
fix getYamlOption with null
Browse files Browse the repository at this point in the history
  • Loading branch information
F-ca7 committed Sep 7, 2022
1 parent def5136 commit e62c052
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion batch-tool/src/main/java/cmd/FlagOption.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class FlagOption extends ConfigArgOption {

public Boolean defaultValue = null;

private FlagOption(String argShort, String argLong, String desc, String argName, boolean defaultValue) {
private FlagOption(String argShort, String argLong, String desc, String argName, Boolean defaultValue) {
super(argShort, argLong, desc, argName);
this.defaultValue = defaultValue;
}
Expand Down
9 changes: 5 additions & 4 deletions batch-tool/src/main/java/cmd/YamlConfigResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ public String getOptionValue(ConfigArgOption option) {

private String getYamlOption(ConfigArgOption option) {
String result = null;
if (argMap.containsKey(option.argShort)) {
result = String.valueOf(argMap.get(option.argShort));
Object o;
if ((o = argMap.get(option.argShort)) != null) {
result = String.valueOf(o);
}
if (argMap.containsKey(option.argLong)) {
result = String.valueOf(argMap.get(option.argLong));
if ((o = argMap.get(option.argLong)) != null) {
result = String.valueOf(o);
}
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion batch-tool/src/main/java/model/config/BaseConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int bitCount() {
/**
* 第一行是否为字段名
*/
protected boolean isWithHeader = ConfigConstant.DEFAULT_WITH_HEADER;
protected boolean isWithHeader;

protected boolean shardingEnabled;

Expand Down

0 comments on commit e62c052

Please sign in to comment.