This closes #477

This commit is contained in:
Martyn Taylor 2016-04-20 15:12:19 +01:00
commit 725379920e
1 changed files with 5 additions and 2 deletions

View File

@ -276,6 +276,10 @@ public final class LargeServerMessageImpl extends ServerMessageImpl implements L
try {
LargeServerMessage newMessage = storageManager.createLargeMessage(newID, this);
boolean originallyOpen = file != null && file.isOpen();
validateFile();
byte[] bufferBytes = new byte[100 * 1024];
@ -283,7 +287,6 @@ public final class LargeServerMessageImpl extends ServerMessageImpl implements L
long oldPosition = file.position();
boolean originallyOpen = file.isOpen();
file.open();
file.position(0);
@ -294,7 +297,7 @@ public final class LargeServerMessageImpl extends ServerMessageImpl implements L
int bytesRead = file.read(buffer);
byte[] bufferToWrite;
if (bytesRead == 0) {
if (bytesRead <= 0) {
break;
}
else if (bytesRead == bufferBytes.length) {