Skip to content

Commit

Permalink
fix: add NP check
Browse files Browse the repository at this point in the history
  • Loading branch information
emptyOVO committed Sep 7, 2024
1 parent 91582d2 commit 24c1306
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ public DecodeFunction(Function expr) {

@Override
public Object parse(SourceData sourceData, int rowIndex, Context context) {
String binaryString = OperatorTools.parseString(binaryParser.parse(sourceData, rowIndex, context));
String characterSetValue =
OperatorTools.parseString(characterSetParser.parse(sourceData, rowIndex, context)).toUpperCase();
Object binaryObj = binaryParser.parse(sourceData, rowIndex, context);
Object characterObj = characterSetParser.parse(sourceData, rowIndex, context);
if (binaryObj == null || characterObj == null) {
return null;
}
String binaryString = OperatorTools.parseString(binaryObj);
String characterSetValue = OperatorTools.parseString(characterObj).toUpperCase();
return decode(binaryString, characterSetValue);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ public EncodeFunction(Function expr) {

@Override
public Object parse(SourceData sourceData, int rowIndex, Context context) {
String stringValue = OperatorTools.parseString(stringParser.parse(sourceData, rowIndex, context));
String characterSetValue =
OperatorTools.parseString(characterSetParser.parse(sourceData, rowIndex, context)).toUpperCase();
Object stringObj = stringParser.parse(sourceData, rowIndex, context);
Object characterObj = characterSetParser.parse(sourceData, rowIndex, context);
if (stringObj == null || characterObj == null) {
return null;
}
String stringValue = OperatorTools.parseString(stringObj);
String characterSetValue = OperatorTools.parseString(characterObj).toUpperCase();
byte[] encodeBytes = encode(stringValue, characterSetValue);
StringBuilder res = new StringBuilder();
if (encodeBytes != null) {
Expand Down

0 comments on commit 24c1306

Please sign in to comment.