File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
hibernate-core/src/main/java/org/hibernate/engine/jdbc Expand file tree Collapse file tree 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 {
4949 * @see #generateProxy(byte[])
5050 */
5151 private BlobProxy (byte [] bytes ) {
52- binaryStream = new ArrayBackedBinaryStream ( bytes );
52+ binaryStream = new BinaryStreamImpl ( bytes );
5353 markBytes = bytes .length + 1 ;
5454 setStreamMark ();
5555 }
@@ -68,8 +68,9 @@ private BlobProxy(InputStream stream, long length) {
6868 }
6969
7070 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 );
7374 resetAllowed = true ;
7475 }
7576 else {
@@ -89,12 +90,14 @@ public BinaryStream getUnderlyingStream() throws SQLException {
8990 private void resetIfNeeded () throws SQLException {
9091 try {
9192 if ( needsReset ) {
92- if ( !resetAllowed ) {
93+ final InputStream inputStream = binaryStream .getInputStream ();
94+ if ( !resetAllowed && inputStream != null ) {
9395 throw new SQLException ( "Underlying stream does not allow reset" );
9496 }
95-
96- binaryStream .getInputStream ().reset ();
97- setStreamMark ();
97+ if ( inputStream != null ) {
98+ inputStream .reset ();
99+ setStreamMark ();
100+ }
98101 }
99102 }
100103 catch ( IOException ioe ) {
You can’t perform that action at this time.
0 commit comments