ARTEMIS-490 Fixing new largeMessage copy

This commit is contained in:
Clebert Suconic 2016-04-20 09:51:44 -04:00
parent de0ac57aa4
commit b89faae458
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) {