File tree 1 file changed +10
-7
lines changed
hibernate-core/src/main/java/org/hibernate/engine/jdbc
1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public final class BlobProxy implements Blob, BlobImplementer {
49
49
* @see #generateProxy(byte[])
50
50
*/
51
51
private BlobProxy (byte [] bytes ) {
52
- binaryStream = new ArrayBackedBinaryStream ( bytes );
52
+ binaryStream = new BinaryStreamImpl ( bytes );
53
53
markBytes = bytes .length + 1 ;
54
54
setStreamMark ();
55
55
}
@@ -68,8 +68,9 @@ private BlobProxy(InputStream stream, long length) {
68
68
}
69
69
70
70
private void setStreamMark () {
71
- if ( binaryStream .getInputStream ().markSupported () ) {
72
- binaryStream .getInputStream ().mark ( markBytes );
71
+ final InputStream inputStream = binaryStream .getInputStream ();
72
+ if ( inputStream != null && inputStream .markSupported () ) {
73
+ inputStream .mark ( markBytes );
73
74
resetAllowed = true ;
74
75
}
75
76
else {
@@ -89,12 +90,14 @@ public BinaryStream getUnderlyingStream() throws SQLException {
89
90
private void resetIfNeeded () throws SQLException {
90
91
try {
91
92
if ( needsReset ) {
92
- if ( !resetAllowed ) {
93
+ final InputStream inputStream = binaryStream .getInputStream ();
94
+ if ( !resetAllowed && inputStream != null ) {
93
95
throw new SQLException ( "Underlying stream does not allow reset" );
94
96
}
95
-
96
- binaryStream .getInputStream ().reset ();
97
- setStreamMark ();
97
+ if ( inputStream != null ) {
98
+ inputStream .reset ();
99
+ setStreamMark ();
100
+ }
98
101
}
99
102
}
100
103
catch ( IOException ioe ) {
You can’t perform that action at this time.
0 commit comments