]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/attachment/FileAttachmentsStorage.java
Attachments management
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / core / attachment / FileAttachmentsStorage.java
index fad4db19eeaf5e373ffa45389ad472a8640057da..1f1089bb263aedb58ffed903eaaf467d0d1f1341 100644 (file)
@@ -39,8 +39,9 @@ public class FileAttachmentsStorage implements AttachmentsStorage {
                try {
                        byte[] buffer = new byte[1024 * 1024];
                        out = new FileOutputStream(file);
-                       while (inputStream.read(buffer) >= 0) {
-                               out.write(buffer);
+                       int read = -1;
+                       while ((read = inputStream.read(buffer)) >= 0) {
+                               out.write(buffer, 0, read);
                        }
                } catch (IOException e) {
                        throw new SlcException("Cannot write attachment " + attachment