Skip to content

Commit 31debf8

Browse files
committed
[#1312] Refactor ResultSetAdaptor#getBlob
Since Vert.x 4.3.1, Oracle might return a class that's only available in the vertx-sql-oracle client when using Row#getValue for a blob column. This means that we cannot check for the type of the instance and we have to make a last attempt hoping that the value can be returned as Buffer. It will throw a ClassCastException if that's not the case.
1 parent 22f3b20 commit 31debf8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/adaptor/impl/ResultSetAdaptor.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -720,17 +720,14 @@ public Blob getBlob(String columnLabel) {
720720
return null;
721721
}
722722

723-
if ( value instanceof Buffer ) {
724-
return BlobProxy.generateProxy( ( (Buffer) value ).getBytes() );
725-
}
726-
else if ( value instanceof String ) {
723+
if ( value instanceof String ) {
727724
return BlobProxy.generateProxy( ( (String) value ).getBytes() );
728725
}
729-
else if ( value instanceof byte[] ) {
726+
if ( value instanceof byte[] ) {
730727
return BlobProxy.generateProxy( (byte[]) value );
731728
}
732729

733-
throw new IllegalArgumentException( "Unexpected type: " + value.getClass() );
730+
return BlobProxy.generateProxy( row.getBuffer( columnLabel ).getBytes() );
734731
}
735732

736733
@Override

0 commit comments

Comments
 (0)