4
  • Sardine version: 5.8
  • Java 1.8

(relevant for any dependency overwrites?)

  • Spring Boot 2.1.2 project
  • Tomcat9.0.14

I can connect to my Server (Nextcloud) via Sardine. Also the executed put-call has an effect to the server, as it places the expected File into the correct directory. But as stated in the title, the file is empty (0byte). Also there is no client Exception.

working with put(String, byte[]) works as expected and the File on the Server is completly working. But I don't want to be limited to maximum fileSize of byte[Integer.MAX-5].

Following Code is working which means, it's not about ssl, or any other connection related things

File file = new File(filePath);
byte[] data = new byte[(int) file.length()];
FileInputStream stream = new FileInputStream(file);
int readedBytes = stream.read(data);
if (readedBytes == file.length()) {
   client.put(remotePath, data);
}

This Code is NOT working

File file = new File(filePath);
client.put(remotePath, new FileInputStream(file));

On the Nextcloud Server i get following Log Entry:

"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"expected filesize 240823 got 0"

To me it looks like something is going wrong when copying the inputstream content to the actual http out stream. As the headers seem to havae the correct byte size as we see in the Log of the server, but the actual content is zero.

Did anyone else had problems with this? Am i missing something? Thanks for any hints and help!

Sunchezz
  • 740
  • 6
  • 21

0 Answers0