HHH-14725 Fix reset handling on BlobProxy
This commit is contained in:
parent
c475770d09
commit
57c0b26d86
|
@ -70,8 +70,9 @@ public final class BlobProxy implements Blob, BlobImplementer {
|
|||
}
|
||||
|
||||
private void setStreamMark() {
|
||||
if ( binaryStream.getInputStream().markSupported() ) {
|
||||
binaryStream.getInputStream().mark( markBytes );
|
||||
final InputStream inputStream = binaryStream.getInputStream();
|
||||
if ( inputStream != null && inputStream.markSupported() ) {
|
||||
inputStream.mark( markBytes );
|
||||
resetAllowed = true;
|
||||
}
|
||||
else {
|
||||
|
@ -92,14 +93,16 @@ public final class BlobProxy implements Blob, BlobImplementer {
|
|||
private void resetIfNeeded() throws SQLException {
|
||||
try {
|
||||
if ( needsReset ) {
|
||||
if ( !resetAllowed ) {
|
||||
final InputStream inputStream = binaryStream.getInputStream();
|
||||
if ( !resetAllowed && inputStream != null) {
|
||||
throw new SQLException( "Underlying stream does not allow reset" );
|
||||
}
|
||||
|
||||
binaryStream.getInputStream().reset();
|
||||
if ( inputStream != null ) {
|
||||
inputStream.reset();
|
||||
setStreamMark();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( IOException ioe) {
|
||||
throw new SQLException("could not reset reader");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue