You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by js...@apache.org on 2025/03/17 16:01:59 UTC
(sis) branch geoapi-4.0 updated: Fix shapefile parsing of string floating point data types
This is an automated email from the ASF dual-hosted git repository.
jsorel pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new 07fa48c9e6 Fix shapefile parsing of string floating point data types
07fa48c9e6 is described below
commit 07fa48c9e6791464625864f3e699f23925c6ef65
Author: jsorel <jo...@geomatys.com>
AuthorDate: Mon Mar 17 17:01:40 2025 +0100
Fix shapefile parsing of string floating point data types
---
.../main/org/apache/sis/storage/shapefile/dbf/DBFField.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/dbf/DBFField.java b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/dbf/DBFField.java
index 4670033b9e..8df23402f3 100644
--- a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/dbf/DBFField.java
+++ b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/dbf/DBFField.java
@@ -159,7 +159,16 @@ public final class DBFField {
case TYPE_TIMESTAMP : valueClass = Object.class; reader = this::readTimeStamp; writer = this::writeTimeStamp; break;
case TYPE_LONG : valueClass = Object.class; reader = this::readLong; writer = this::writeLong; break;
case TYPE_INC : valueClass = Object.class; reader = this::readAutoIncrement; writer = this::writeAutoIncrement; break;
- case TYPE_FLOAT : valueClass = Object.class; reader = this::readFloat; writer = this::writeFloat; break;
+ case TYPE_FLOAT : {
+ valueClass = Double.class;
+ reader = this::readNumber;
+ writer = this::writeNumber;
+ format = NumberFormat.getNumberInstance(Locale.US);
+ format.setGroupingUsed(false);
+ format.setMaximumFractionDigits(fieldDecimals);
+ format.setMinimumFractionDigits(fieldDecimals);
+ break;
+ }
case TYPE_DOUBLE : valueClass = Object.class; reader = this::readDouble; writer = this::writeDouble; break;
case TYPE_OLE : valueClass = Object.class; reader = this::readOLE; writer = this::writeOLE; break;
default: throw new IllegalArgumentException("Unknown field type " + fieldType);