Skip to content

Commit

Permalink
fix #88 avoid loading null fields to Redis Hash (#90)
Browse files Browse the repository at this point in the history
* fix #88 avoid loading null fields to Redis Hash

* Update ReadSource.java
  • Loading branch information
gkorland authored Aug 7, 2022
1 parent fcf849a commit 5377be3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/main/java/com/redislabs/ReadSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ public void foreach(KeysReaderRecord r) throws Exception {
GearsBuilder.overrideReply(error);
throw new Exception(error);
}
command.add(propKey);
Object value = e.getValue();
command.add(pd.convertToStr(value));
if (value != null) {
command.add(propKey);
command.add(pd.convertToStr(value));
}
}


Expand Down Expand Up @@ -131,16 +133,22 @@ public void foreach(KeysReaderRecord r) throws Exception {
GearsBuilder.overrideReply(error);
throw new Exception(error);
}
response.add(propKey);
Object value = e.getValue();
response.add(pd.convertToStr(value));
if (value != null){
response.add(propKey);
response.add(pd.convertToStr(value));
}
}
}else {
for(String f : fields) {
if(res.containsKey(f)) {
PropertyData pd = getPropertyMapping(f);
Object value = res.get(f);
response.add(pd != null ? pd.convertToStr(value) : value.toString());
if( value == null) {
response.add(null);
} else {
response.add(pd != null ? pd.convertToStr(value) : value.toString());
}
}else {
response.add(null);
}
Expand Down

0 comments on commit 5377be3

Please sign in to comment.