zhfeng commented on a change in pull request #5762:
URL: https://github.com/apache/camel/pull/5762#discussion_r660284970



##########
File path: 
components/camel-jms/src/main/java/org/apache/camel/component/jms/StreamMessageInputStream.java
##########
@@ -48,6 +48,11 @@ public int read() throws IOException {
     public int read(byte[] array) throws IOException {
         try {
             int num = message.readBytes(array);
+            if (num < 0) {
+                //the first 128K(FileUtil.BUFFER_SIZE/128K is used when 
sending JMS StreamMessage) 
+                //buffer reached, give a chance to see if there is the next 
128K buffer
+                num = message.readBytes(array);
+            }

Review comment:
       Well, how can we make sure there is the last chunk ? From the java docs 
https://docs.oracle.com/javaee/7/api/javax/jms/StreamMessage.html#readBytes-byte:A-
   ```
   To read the field value, readBytes should be successively called until it 
returns a value less than the length of the read buffer. The value of the bytes 
in the buffer following the last byte read is undefined.
   ```
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to