diff --git a/.mvn/local-settings.xml b/.mvn/local-settings.xml new file mode 100644 index 0000000..84b37cf --- /dev/null +++ b/.mvn/local-settings.xml @@ -0,0 +1,14 @@ + + + + + + + ossrh + ${env.OSSRH_USERNAME} + ${env.OSSRH_PASSWORD} + + + \ No newline at end of file diff --git a/README.md b/README.md index e2e2ed1..4cd5dd1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This library is available on Maven Central. Use the following information to inc com.riscure trsfile - 2.2.6 + 2.2.7 #### Basic diff --git a/pom.xml b/pom.xml index e5de10a..de92e60 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.riscure trsfile - 2.2.6 + 2.2.7 jar ${project.groupId}:${project.artifactId} @@ -209,7 +209,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.7 + 1.6.14 @@ -223,7 +223,12 @@ test + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + ossrh https://s01.oss.sonatype.org/content/repositories/snapshots diff --git a/src/main/java/com/riscure/trs/TraceSet.java b/src/main/java/com/riscure/trs/TraceSet.java index 85cf8dc..ee46acb 100644 --- a/src/main/java/com/riscure/trs/TraceSet.java +++ b/src/main/java/com/riscure/trs/TraceSet.java @@ -36,7 +36,6 @@ public class TraceSet implements AutoCloseable { private static final String UNKNOWN_SAMPLE_CODING = "Error reading TRS file: unknown sample coding '%d'"; private static final long MAX_BUFFER_SIZE = Integer.MAX_VALUE; private static final String PARAMETER_NOT_DEFINED = "Parameter %s is saved in the trace, but was not found in the header definition"; - private static final CharsetDecoder UTF8_DECODER = StandardCharsets.UTF_8.newDecoder(); //Reading variables private int metaDataSize; @@ -56,9 +55,11 @@ public class TraceSet implements AutoCloseable { //Shared variables private final TRSMetaData metaData; - private boolean open; private final boolean writing; //whether the trace is opened in write mode private final Path path; + private final CharsetDecoder utf8Decoder = StandardCharsets.UTF_8.newDecoder(); + + private boolean open; private TraceSet(String inputFileName) throws IOException, TRSFormatException { this.writing = false; @@ -244,10 +245,10 @@ private String fitUtf8StringToByteLength(String s, int maxBytes) { ByteBuffer bb = ByteBuffer.wrap(sba, 0, maxBytes); CharBuffer cb = CharBuffer.allocate(maxBytes); // Ignore an incomplete character - UTF8_DECODER.reset(); - UTF8_DECODER.onMalformedInput(CodingErrorAction.IGNORE); - UTF8_DECODER.decode(bb, cb, true); - UTF8_DECODER.flush(cb); + utf8Decoder.reset(); + utf8Decoder.onMalformedInput(CodingErrorAction.IGNORE); + utf8Decoder.decode(bb, cb, true); + utf8Decoder.flush(cb); return new String(cb.array(), 0, cb.position()); }