You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by "wuwangben (via GitHub)" <gi...@apache.org> on 2025/10/15 06:04:03 UTC

[I] [java] ForyInputStream当读取已经是EOF的流有问题 [fory]

wuwangben opened a new issue, #2772:
URL: https://github.com/apache/fory/issues/2772

   ### Search before asking
   
   - [x] I had searched in the [issues](https://github.com/apache/fory/issues) and found no similar issues.
   
   
   ### Version
   
   0.12.2
   
   ### Component(s)
   
   Java
   
   ### Minimal reproduce step
   
   当读取一个已经是EOF的流时返回非期望异常
   
   
   ### What did you expect to see?
   
   期望看到一致的异常new IndexOutOfBoundsException("No enough data in the stream " + stream);
   更合理似乎应该是EOFException("No enough data in the stream " + stream);
   
   ### What did you see instead?
   
   java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -1
   
   ### Anything Else?
   
   <img width="1871" height="823" alt="Image" src="https://github.com/user-attachments/assets/0ccbc91d-caeb-49ca-a65c-003204e3f2d5" />
   
   <img width="1787" height="538" alt="Image" src="https://github.com/user-attachments/assets/4e52117c-87c5-477a-9783-9d321744bd0b" />
   可以这样修改吗?
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
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-unsubscribe@fory.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [I] [java] ForyInputStream Read Error when EOF [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang closed issue #2772: [java] ForyInputStream Read Error when EOF
URL: https://github.com/apache/fory/issues/2772


-- 
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-unsubscribe@fory.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [I] [java] ForyInputStream Read Error when EOF [fory]

Posted by "alisha-1000 (via GitHub)" <gi...@apache.org>.
alisha-1000 commented on issue #2772:
URL: https://github.com/apache/fory/issues/2772#issuecomment-5646985399

   Hi @chaokunyang, I'd like to work on this issue. I'll investigate the EOF handling in `ForyInputStream`, add regression tests for the current behavior, and implement the appropriate fix. I'll submit a PR referencing this issue.
   


-- 
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-unsubscribe@fory.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [I] [java] ForyInputStream当读取已经是EOF的流有问题 [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang commented on issue #2772:
URL: https://github.com/apache/fory/issues/2772#issuecomment-3421653533

   @wuwangben 你好,没太理解你这里的改动,感觉跟之前的行为好像没有区别,方便提交一个带test的PR吗


-- 
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-unsubscribe@fory.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [I] [java] ForyInputStream当读取已经是EOF的流有问题 [fory]

Posted by "wuwangben (via GitHub)" <gi...@apache.org>.
wuwangben commented on issue #2772:
URL: https://github.com/apache/fory/issues/2772#issuecomment-3435713417

   package org.apache.fory.io;
   
   import org.testng.Assert;
   import org.testng.annotations.Test;
   
   import java.io.ByteArrayInputStream;
   import java.io.ByteArrayOutputStream;
   import java.io.IOException;
   import java.nio.ByteBuffer;
   
   import static org.testng.Assert.assertEquals;
   
   public class ForyInputStreamTest {
   
     @Test
     public void testFillBufferIndexOutOfBoundsException() throws IOException {
       try (ForyInputStream in = new ForyInputStream(new ByteArrayInputStream(new byte[0])) ) {
         try {
           in.fillBuffer(1);
           Assert.fail("Expected IndexOutOfBoundsException to be thrown");
         } catch (IndexOutOfBoundsException e) {
           Assert.assertTrue(e.getMessage().contains("No enough data in the stream"));
         }
       }
     }
   
     @Test
     public void testReadToIndexOutOfBoundsException() throws IOException {
       try (ForyInputStream in = new ForyInputStream(new ByteArrayInputStream(new byte[0])) ) {
         try {
           in.readTo(new byte[10], 0, 10);
           Assert.fail("Expected IndexOutOfBoundsException to be thrown");
         } catch (IndexOutOfBoundsException e) {
           Assert.assertTrue(e.getMessage().contains("No enough data in the stream"));
         }
       }
     }
   }


-- 
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-unsubscribe@fory.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org