Skip to content

Commit 1d848b1

Browse files
committed
refactor: drop StreamingResultSet getObject(Class) bandaid
Now that QueryJDBCAccessor.getObject(Class) provides the raw + isInstance fallback as its base-class default, StreamingResultSet no longer needs the catch-and-retry path that worked around accessors which threw "Operation not supported." Collapse getObject(int, Class) to direct dispatch and update the regression test's WHY comment to point at the accessor base class as the load-bearing layer. Addresses: review comment on PR #175 line 388.
1 parent cb2d1d0 commit 1d848b1

1 file changed

Lines changed: 3 additions & 25 deletions

File tree

jdbc-core/src/main/java/com/salesforce/datacloud/jdbc/core/StreamingResultSet.java

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -360,32 +360,10 @@ public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLEx
360360

361361
@Override
362362
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
363-
if (type == null) {
364-
throw new SQLException("Target type must not be null");
365-
}
366-
// Default implementation: get the raw Object and check if it matches the requested type.
367-
// Accessors that need richer conversion (e.g. Arrow Decimal → BigInteger) can still
368-
// override the accessor-level getObject(Class) — in that case we dispatch to them first.
369363
val accessor = getAccessor(columnIndex);
370-
try {
371-
val typed = accessor.getObject(type);
372-
updateWasNull(accessor);
373-
return typed;
374-
} catch (SQLException ex) {
375-
// Accessor does not implement typed getObject — fall back to raw + isInstance check.
376-
val raw = accessor.getObject();
377-
updateWasNull(accessor);
378-
if (raw == null) {
379-
return null;
380-
}
381-
if (type.isInstance(raw)) {
382-
return type.cast(raw);
383-
}
384-
throw new SQLException(
385-
"Cannot convert column value to " + type.getName() + "; actual type is "
386-
+ raw.getClass().getName(),
387-
ex);
388-
}
364+
val result = accessor.getObject(type);
365+
updateWasNull(accessor);
366+
return result;
389367
}
390368

391369
@Override

0 commit comments

Comments
 (0)