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 318a3a5906 Fix a null charset in some cases in DBF field class
318a3a5906 is described below
commit 318a3a5906511c1082c4df9a400f058b0bc235db
Author: jsorel <[email protected]>
AuthorDate: Fri Aug 2 16:11:00 2024 +0200
Fix a null charset in some cases in DBF field class
---
.../main/org/apache/sis/storage/shapefile/dbf/DBFField.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 8f0fb83db0..4a6293796d 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
@@ -129,7 +129,7 @@ public final class DBFField {
* @param fieldAddress unused for now, has a meaning in some
specifications but not all
* @param fieldLength total field length in bytes
* @param fieldDecimals number of decimals for floating points
- * @param charset String base field encoding
+ * @param charset String base field encoding, can be null, default is
ISO_LATIN1
*/
public DBFField(String fieldName, char fieldType, int fieldAddress, int
fieldLength, int fieldDecimals, Charset charset) {
this.fieldName = fieldName;
@@ -137,7 +137,7 @@ public final class DBFField {
this.fieldAddress = fieldAddress;
this.fieldLength = fieldLength;
this.fieldDecimals = fieldDecimals;
- this.charset = charset;
+ this.charset = charset == null ? StandardCharsets.ISO_8859_1 : charset;
switch (Character.toUpperCase(fieldType)) {
case TYPE_BINARY : valueClass = Long.class; reader =
this::readBinary; writer = this::writeBinary; break;