Skip to main content

BoxFile file = new BoxFile(boxAPIConnection, "Some-id");
try (FileOutputStream stream = new FileOutputStream(fi)) {
file.download(stream);
// Do Sth
}

At the line file.download(stream) I got an error


java.lang.NullPointerException: Cannot invoke "java.io.InputStream.read(byte[])" because "input" is null
    at com.box.sdk.BinaryBodyUtils.writeStreamTo(BinaryBodyUtils.java:55)
    at com.box.sdk.BinaryBodyUtils.writeStream(BinaryBodyUtils.java:41)
    at com.box.sdk.BoxFile.download(BoxFile.java:311)
  at com.box.sdk.BoxFile.download(BoxFile.java:298)

 

I look at the lib of box sdk and see that this line got nullpointer exception beacause the input is null. This only happens when I try to upload an empty txt file then download it.

mdw01HMQKY1ABW6KNPN5V1KG0YKHN.png

Hi there,


Welcome to Box Community and glad to assist! 


Let me create a new case and a member of our team will be in touch, please keep an eye out.


Thanks for posting!


Reply