From 5fabad649844ef4fa3c8726c0bb80e8667926756 Mon Sep 17 00:00:00 2001 From: Ivan Gagarkin Date: Wed, 6 Nov 2024 13:10:04 +0100 Subject: [PATCH] dbeaver/pro#3407 Fix AbstractJdbcResultSet.getBigDecimal(int) to handle empty strings (#52) * dbeaver/pro#3407 Fix AbstractJdbcResultSet.getBigDecimal(int) to handle empty strings Ensure `getBigDecimal(int)` checks for empty strings before processing to avoid potential errors. * dbeaver/pro#3407 Cover FF CSV Driver by tests --------- Co-authored-by: Ivan Gagarkin Co-authored-by: kseniaguzeeva <112612526+kseniaguzeeva@users.noreply.github.com> --- .../src/com/dbeaver/jdbc/model/AbstractJdbcResultSet.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/com.dbeaver.jdbc.api/src/com/dbeaver/jdbc/model/AbstractJdbcResultSet.java b/modules/com.dbeaver.jdbc.api/src/com/dbeaver/jdbc/model/AbstractJdbcResultSet.java index 1486595..f1e38fb 100644 --- a/modules/com.dbeaver.jdbc.api/src/com/dbeaver/jdbc/model/AbstractJdbcResultSet.java +++ b/modules/com.dbeaver.jdbc.api/src/com/dbeaver/jdbc/model/AbstractJdbcResultSet.java @@ -619,7 +619,11 @@ public Reader getCharacterStream(int columnIndex) throws SQLException { @Override public BigDecimal getBigDecimal(int columnIndex) throws SQLException { final String value = getString(columnIndex); - return value != null ? new BigDecimal(value) : null; + if (value == null || value.isBlank()) { + return null; + } + + return new BigDecimal(value); } @Override