From 21600ee32642f981cc4ef4b90c764acbcf8101a8 Mon Sep 17 00:00:00 2001 From: Vitalii Ananev Date: Fri, 28 Jan 2022 02:17:56 +0300 Subject: [PATCH 1/2] impl CellDataAccessObject.getDoubleValue() for '.' and ',' separators --- .../table_wrapper/api/CellDataAccessObject.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/spacious_team/table_wrapper/api/CellDataAccessObject.java b/src/main/java/org/spacious_team/table_wrapper/api/CellDataAccessObject.java index b533ee1..c2de57a 100644 --- a/src/main/java/org/spacious_team/table_wrapper/api/CellDataAccessObject.java +++ b/src/main/java/org/spacious_team/table_wrapper/api/CellDataAccessObject.java @@ -66,7 +66,17 @@ default double getDoubleValue(C cell) { if (value instanceof Number) { return ((Number) value).doubleValue(); } else if (value != null) { - return Double.parseDouble(spacePattern.matcher((CharSequence) value).replaceAll("")); + String str = spacePattern.matcher((CharSequence) value).replaceAll(""); + try { + return Double.parseDouble(str); + } catch (NumberFormatException e) { + if (str.indexOf(',') != -1) { + return Double.parseDouble(str.replace(',', '.')); + } else if (str.indexOf('.') != -1) { + return Double.parseDouble(str.replace('.', ',')); + } + throw e; + } } else { throw new NullPointerException(NO_CELL_VALUE_EXCEPTION_MESSAGE); } From 022d9b441360ce4dbc75e15f9c4c3ca85b1cc103 Mon Sep 17 00:00:00 2001 From: Vitalii Ananev Date: Fri, 28 Jan 2022 02:18:51 +0300 Subject: [PATCH 2/2] version 2022.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 405cf34..7405ca6 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.spacious-team table-wrapper-api - 2021.6.1 + 2022.2 jar Table Wrapper API