volume upload: fixed the post body parsing logic as long as the boundary is completely in the byte buffer it works.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7231daa7 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7231daa7 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7231daa7 Branch: refs/heads/volume-upload Commit: 7231daa71d183a016395d680c659d2f8acaea783 Parents: 92669e3 Author: Rajani Karuturi <[email protected]> Authored: Fri Jan 23 12:28:27 2015 +0530 Committer: Rajani Karuturi <[email protected]> Committed: Thu Jan 29 16:55:29 2015 +0530 ---------------------------------------------------------------------- .../storage/resource/NfsSecondaryStorageResource.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7231daa7/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java ---------------------------------------------------------------------- diff --git a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java index 5227659..907d4ff 100755 --- a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java +++ b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java @@ -44,6 +44,7 @@ import java.net.UnknownHostException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -2903,6 +2904,9 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S output.write(bytebuf[i]); i++; } + readBytes = readBytes - read + i; + input.reset(); + input.skip(readBytes); break; } if (stringBuf.contains("-")) { @@ -2911,13 +2915,16 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S output.write(bytebuf[i]); i++; } - readBytes+=i; + readBytes = readBytes - read + i; input.reset(); input.skip(readBytes); } else { output.write(bytebuf,0,1024); } } + Arrays.fill(bytebuf, (byte)0); + input.read(bytebuf,0,1024); + reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bytebuf))); } }
