Skip to content

Commit

Permalink
Merge pull request pentaho#8755 from smmribeiro/PDI-19690
Browse files Browse the repository at this point in the history
[PDI-19690] 'Add a checksum' step errors when processing a field with…
  • Loading branch information
renato-s authored Dec 7, 2022
2 parents 00fdbe6 + 8868c65 commit 9887e82
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,13 @@ private byte[] getBytesFromBinary( Object[] row ) throws KettleException {
}

private byte[] getBytesFromNonBinary( Object[] row ) throws KettleException {
return vmi.getNativeDataType( row[ fieldIndex ] ).toString().getBytes();
byte[] ret = null;

if ( null != row[ fieldIndex ] ) {
ret = vmi.getNativeDataType( row[ fieldIndex ] ).toString().getBytes();
}

return ret;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,16 @@ public void testHexOutput_sha256_bytes_withSeparator() throws Exception {
results.getWritten().get( 0 )[ 2 ] );
}

private Trans buildHexadecimalChecksumTrans( int checksumType, int evaluationMethod, boolean compatibilityMode,
@Test
public void test_pdi19690() throws Exception {
MockRowListener results =
executeHexTest( SHA256, CheckSumMeta.EVALUATION_METHOD_BYTES, false, null, string1Meta );
assertEquals( 1, results.getWritten().size() );
assertEquals( "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
results.getWritten().get( 0 )[ 1 ] );
}

private Trans buildHexadecimalChecksumTrans( int checksumType, int evaluationMethod, boolean compatibilityMode,
String fieldSeparatorString, String[] fieldNames ) throws Exception {
// Create a new transformation...
TransMeta transMeta = new TransMeta();
Expand Down

0 comments on commit 9887e82

Please sign in to comment.