Andrius Merkys pushed to branch upstream at Debian Java Maintainers / ciftools-java
Commits: 3482a174 by Andrius Merkys at 2023-01-13T06:11:17-05:00 New upstream version 4.0.5 - - - - - 4 changed files: - CHANGELOG.md - pom.xml - src/main/java/org/rcsb/cif/text/TextCifWriter.java - src/test/java/org/rcsb/cif/WriterTest.java Changes: ===================================== CHANGELOG.md ===================================== @@ -3,6 +3,11 @@ CIFTools Changelog This project uses semantic versioning. Furthermore, this project provides code that was generated from schemata. Any schema change that introduces a breaking change in the generated code is considered as breaking for the whole project. Additional information is provided below when this occurs (named `Breaking schema changes`). Most of these occur in experimental categories and are unlikely to affect your code. `Breaking API changes` will be avoided starting with version 1.0.0. +ciftools-java 4.0.5 - January 2023 +------------- +### Bug fixes +* fix text writing when non-English number formats are used on the platform + ciftools-java 4.0.4 - November 2022 ------------- ### Bug fixes ===================================== pom.xml ===================================== @@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.rcsb</groupId> <artifactId>ciftools-java</artifactId> - <version>4.0.4</version> + <version>4.0.5</version> <packaging>jar</packaging> <description> A Java library for handling text and binary CIF files. @@ -35,7 +35,7 @@ <connection>scm:git:git://github.com/rcsb/ciftools-java.git</connection> <developerConnection>scm:git:g...@github.com:rcsb/ciftools-java.git</developerConnection> <url>https://github.com/rcsb/ciftools-java</url> - <tag>ciftools-java-4.0.4</tag> + <tag>ciftools-java-4.0.5</tag> </scm> <dependencies> ===================================== src/main/java/org/rcsb/cif/text/TextCifWriter.java ===================================== @@ -11,7 +11,9 @@ import org.rcsb.cif.model.ValueKind; import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; import java.util.List; +import java.util.Locale; import java.util.NoSuchElementException; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -136,9 +138,10 @@ public class TextCifWriter { return false; } - private static final DecimalFormat FLOAT_2 = new DecimalFormat("0.00"); - private static final DecimalFormat FLOAT_3 = new DecimalFormat("0.000"); - private static final DecimalFormat FLOAT_6 = new DecimalFormat("0.######"); + private static final DecimalFormatSymbols SYMBOLS = new DecimalFormatSymbols(Locale.US); + private static final DecimalFormat FLOAT_2 = new DecimalFormat("0.00", SYMBOLS); + private static final DecimalFormat FLOAT_3 = new DecimalFormat("0.000", SYMBOLS); + private static final DecimalFormat FLOAT_6 = new DecimalFormat("0.######", SYMBOLS); /** * Some columns (i.e. CartnX, CartnY, CartnZ, and Occupancy demand for more fine-grained over the values they report. * @param val the double value ===================================== src/test/java/org/rcsb/cif/WriterTest.java ===================================== @@ -26,6 +26,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; +import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; @@ -222,4 +223,21 @@ class WriterTest { assertNotNull(authAsymId); assertNull(authAsymId.get("mask"), "empty mask must be encoded by 'null' value"); } + + @Test + void testNonEnglishLocaleSupport() throws IOException { + // set to some locale that has a different number format + Locale.setDefault(Locale.FRANCE); + + MmCifFile cifFile = CifIO.readFromInputStream(TestHelper.getInputStream("cif/1a2c.cif")) + .as(StandardSchemata.MMCIF); + byte[] written = CifIO.writeText(cifFile); + + MmCifFile back = CifIO.readFromInputStream(new ByteArrayInputStream(written)) + .as(StandardSchemata.MMCIF); + org.rcsb.cif.schema.mm.AtomSite atomSite = back.getFirstBlock().getAtomSite(); + assertEquals(18.623, atomSite.getCartnX().get(0)); + assertEquals(1.00, atomSite.getOccupancy().get(0)); + assertEquals(0.013895, back.getFirstBlock().getAtomSites().getFractTransfMatrix11().get(0)); + } } View it on GitLab: https://salsa.debian.org/java-team/ciftools-java/-/commit/3482a174028c037d29c0f0580da559cb8f4947bb -- View it on GitLab: https://salsa.debian.org/java-team/ciftools-java/-/commit/3482a174028c037d29c0f0580da559cb8f4947bb You're receiving this email because of your account on salsa.debian.org.
_______________________________________________ pkg-java-commits mailing list pkg-java-comm...@alioth-lists.debian.net https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-java-commits