Skip to content

Commit

Permalink
Fix String to int conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
lucarota committed Aug 1, 2024
1 parent a3d271c commit 1c96640
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,27 +388,31 @@ public long getLong(int columnIndex) {
}

public int getInt(String columnName) {
return new ColumnValueParser<>(Integer::parseInt, Integer.class)
return new ColumnValueParser<>(Double::parseDouble, Double.class)
.parse(columnName)
.orElse(0);
.orElse(0d)
.intValue();
}

public int getInt(int columnIndex) {
return new ColumnValueParser<>(Integer::parseInt, Integer.class)
return new ColumnValueParser<>(Double::parseDouble, Double.class)
.parse(columnIndex)
.orElse(0);
.orElse(0d)
.intValue();
}

public short getShort(String columnName) {
return new ColumnValueParser<>(Short::parseShort, Short.class)
return new ColumnValueParser<>(Double::parseDouble, Double.class)
.parse(columnName)
.orElse((short) 0);
.orElse(0d)
.shortValue();
}

public short getShort(int columnIndex) {
return new ColumnValueParser<>(Short::parseShort, Short.class)
return new ColumnValueParser<>(Double::parseDouble, Double.class)
.parse(columnIndex)
.orElse((short) 0);
.orElse(0d)
.shortValue();
}

public InputStream getBinaryStream(int columnIndex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ private TypeInfo findColumnType(String name) {
if (name == null) {
return TypeInfo.OTHER_TYPE_INFO;
}
if (name.indexOf(".") != 1) {
if (name.contains(".")) {
/* Remove relation reference */
name = name.substring(name.indexOf(".") + 1);
}
Expand Down

0 comments on commit 1c96640

Please sign in to comment.