This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git
commit 9f3c4479c0b9ba3f46a37d7292062f73cb6523b4 Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Feb 8 17:17:25 2021 +0000 Only write the part of the buffer that contains data --- src/main/java/org/apache/tomcat/jakartaee/Migration.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/tomcat/jakartaee/Migration.java b/src/main/java/org/apache/tomcat/jakartaee/Migration.java index 7a4cbe9..c6a6371 100644 --- a/src/main/java/org/apache/tomcat/jakartaee/Migration.java +++ b/src/main/java/org/apache/tomcat/jakartaee/Migration.java @@ -209,6 +209,7 @@ public class Migration { // Read the source into memory ByteArrayOutputStream baos = new ByteArrayOutputStream(); IOUtils.copy(src, baos); + baos.flush(); SeekableInMemoryByteChannel srcByteChannel = new SeekableInMemoryByteChannel(baos.toByteArray()); // Create the destination in memory SeekableInMemoryByteChannel destByteChannel = new SeekableInMemoryByteChannel(); @@ -234,7 +235,7 @@ public class Migration { } // Write the destination back to the stream - ByteArrayInputStream bais = new ByteArrayInputStream(destByteChannel.array()); + ByteArrayInputStream bais = new ByteArrayInputStream(destByteChannel.array(), 0, (int) destByteChannel.size()); IOUtils.copy(bais, dest); return result; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org