Question

BNY Mellon
IN
Last activity: 8 Jun 2022 4:35 EDT
Issue when downloading TXT file using sendFile()
Hi,
I am trying to download the files from the external repository using REST API. I use the below Java code to download the file. This is working fine for all the file types(.docx, .pdf, .xlsx etc), but I get the below cast error when try to download .txt file. Any help in is appreciated.
Java Code:
tools.sendFile((byte[])myStepPage.getObject("DownloadedFile"), myStepPage.getString(".FileName"), false, null, true);
ERROR:
java.lang.ClassCastException: class java.lang.String cannot be cast to class [B (java.lang.String and [B are in module java.base of loader 'bootstrap')