Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm using tFileInputRaw to read a jpg file followed by tJavaRow to get the base64 encoding for the file. I get "java.lang.NullPointerException: Cannot read the array length because "src" is null" at the line in the tJavaRow when I attempt to encode the byte array. I've set the Mode for the tFileInputRaw to Read the file as a bytes array. I also tried the other modes without success. Here's the code in the tJavaRow:
byte[] bytes = (byte[]) output_row.content;
//Encode the byte array to a Base64 string
String base64String = java.util.Base64.getEncoder().encodeToString(bytes);
//Pass the Base64 string to the output column
//output_row.base64ImageString = base64String;
Hello
To access the input data, here should be input_row.content rather than output_row.content.
byte[] bytes = (byte[]) input_row.content;
//Encode the byte array to a Base64 string
String base64String = java.util.Base64.getEncoder().encodeToString(bytes);
Regards
Shicong
Hello
To access the input data, here should be input_row.content rather than output_row.content.
byte[] bytes = (byte[]) input_row.content;
//Encode the byte array to a Base64 string
String base64String = java.util.Base64.getEncoder().encodeToString(bytes);
Regards
Shicong
Hello,
Thank you. I switched to input_row and got the same error at the same line. I then changed the name of the flow between the tFileInputRaw to the tJavaRow2 from "output_row" to row4 and the error disappeared.
Are "input_row" and "output_row" special attributes/properties for a tJavaRow?
Hi @Dobby1 if you need to access the input data, should use "input_row.columnName". To assign the data to next component, use "output_columnName".