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() {
|
private void setStreamMark() {
|
||||||
if ( binaryStream.getInputStream().markSupported() ) {
|
final InputStream inputStream = binaryStream.getInputStream();
|
||||||
binaryStream.getInputStream().mark( markBytes );
|
if ( inputStream != null && inputStream.markSupported() ) {
|
||||||
|
inputStream.mark( markBytes );
|
||||||
resetAllowed = true;
|
resetAllowed = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -92,14 +93,16 @@ public final class BlobProxy implements Blob, BlobImplementer {
|
||||||
private void resetIfNeeded() throws SQLException {
|
private void resetIfNeeded() throws SQLException {
|
||||||
try {
|
try {
|
||||||
if ( needsReset ) {
|
if ( needsReset ) {
|
||||||
if ( !resetAllowed ) {
|
final InputStream inputStream = binaryStream.getInputStream();
|
||||||
|
if ( !resetAllowed && inputStream != null) {
|
||||||
throw new SQLException( "Underlying stream does not allow reset" );
|
throw new SQLException( "Underlying stream does not allow reset" );
|
||||||
}
|
}
|
||||||
|
if ( inputStream != null ) {
|
||||||
binaryStream.getInputStream().reset();
|
inputStream.reset();
|
||||||
setStreamMark();
|
setStreamMark();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch ( IOException ioe) {
|
catch ( IOException ioe) {
|
||||||
throw new SQLException("could not reset reader");
|
throw new SQLException("could not reset reader");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue