-
Notifications
You must be signed in to change notification settings - Fork 435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling Blob#length() causes an InputStream obtained from Blob#getBinaryStream() to close #611
Comments
Fix to issue microsoft#611, where calling length() would close the stream.
Hi @permagnushansson, thank you for bringing the issue to our attention. The behavior described is unintended, and I have been able to reproduce it. A fix has been pushed and is currently under review. In the meantime, you can test the changes by forking this branch. |
Hi @rene-ye , I cloned the forked branch and I can confirm that the fix works for me. Great! A side note - I followed the instructions and built the driver with Java 9(.0.4) and Maven (
Looks like the |
Hi @permagnushansson, the fix for that error has already been resolved in the main branches. The blobStream branch hasn't been updated for awhile, and that's probably why you're seeing that error. I've updated the branch with the latest changes and that should fix the problem. Please try again and feel free update us on any issues you encounter. |
PR #595 has been merged and can be expected in 6.5.0. Closing issue. |
Driver version or jar name
6.1.6 and later
SQL Server version
Microsoft SQL Server 2012
Client operating system
Mac OS, Windows, Linux
Java/JVM version
1.8.161
Table schema
Problem description
In versions prior to 6.1.6 it was possible to:
myBlob.getBinaryStream()
.myBlob.length()
to get the size of the BLOB.In version 6.1.6 and later, the InputStream cannot be consumed, because it has been closed, and an exception is thrown:
The following works, of course:
myBlob.length()
to get the size of the BLOB.myBlob.getBinaryStream()
.I suspect that the change of behavior came about with the resolution #16.
Expected behavior and actual behavior
Expected: that the obtained InputStream survives the call to
Blob#length()
.On the other hand, the stream closing might be expected behavior: 66e395d.
Repro code
The text was updated successfully, but these errors were encountered: