[Git][java-team/msgpack-java][upstream] New upstream version 0.9.1
Andrius Merkys (@merkys)
gitlab at salsa.debian.org
Tue Mar 8 06:37:02 GMT 2022
Andrius Merkys pushed to branch upstream at Debian Java Maintainers / msgpack-java
Commits:
d5012fc5 by Andrius Merkys at 2022-03-08T00:39:21-05:00
New upstream version 0.9.1
- - - - -
11 changed files:
- README.md
- RELEASE_NOTES.md
- build.sbt
- msgpack-core/src/main/java/org/msgpack/core/MessageBufferPacker.java
- msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java
- msgpack-core/src/test/scala/org/msgpack/core/MessageUnpackerTest.scala
- msgpack-jackson/README.md
- + msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/MessagePackMapper.java
- project/build.properties
- project/plugins.sbt
- sbt
Changes:
=====================================
README.md
=====================================
@@ -40,14 +40,14 @@ dependencies {
}
```
-- [Usage examples](msgpack-core/src/test/java/org/msgpack/core/example/MessagePackExample.java)
+- [Usage examples](https://github.com/msgpack/msgpack-java/blob/develop/msgpack-core/src/test/java/org/msgpack/core/example/MessagePackExample.java)
### Integration with Jackson ObjectMapper (jackson-databind)
msgpack-java supports serialization and deserialization of Java objects through [jackson-databind](https://github.com/FasterXML/jackson-databind).
-For details, see [msgpack-jackson/README.md](msgpack-jackson/README.md). The template-based serialization mechanism used in v06 is deprecated.
+For details, see [msgpack-jackson/README.md](https://github.com/msgpack/msgpack-java/blob/develop/msgpack-jackson/README.md). The template-based serialization mechanism used in v06 is deprecated.
-- [Release Notes](RELEASE_NOTES.md)
+- [Release Notes](https://github.com/msgpack/msgpack-java/blob/develop/RELEASE_NOTES.md)
## For MessagePack Developers [![Travis CI](https://travis-ci.org/msgpack/msgpack-java.svg?branch=v07-develop)](https://travis-ci.org/msgpack/msgpack-java)
=====================================
RELEASE_NOTES.md
=====================================
@@ -1,19 +1,39 @@
# Release Notes
+## 0.9.1
+
+Bug fixes and improvements:
+
+- Keep consistent read size after closing MessageUnpacker (#621) @okumin
+- Fixed examples relative link in README (#622) @zbuster05
+- Add an ObjectMapper shorthand @cyberdelia (#620)
+- Specify the bufferSize of the ArrayBufferOutput (#597) @szh
+
+Internal updates:
+
+- Update akka-actor to 2.6.18 (#614) @Scala Steward
+- Update airframe-json, airspec to 22.2.0 (#626) @Scala Steward
+- Update junit-interface to 0.13.3 (#617) @Scala Steward
+- Update sbt-scalafmt to 2.4.6 (#616) @Scala Steward
+- Upgrade sbt to 1.5.6 (#610) @Taro L. Saito
+- Update scala-collection-compat to 2.6.0 (#604) @Scala Steward
+
+Known issues:
+- Unpack method doesn't work in JDK17 https://github.com/msgpack/msgpack-java/issues/600
+
## 0.9.0
This version support reading and writing [Timestamp values](https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type).
Packer and unpacker interfaces added pack/unpackTimestamp methods.
-Timestamp value in MessagePack is an extension type value whose code is -1. If MessgageUnapcker.unpackValue method is used,
-TimestampValue object can be retrieved automatically. If you are using low-level unpack methods (e.g., unpackInt, unpackExtension, etc.),
-you need to read unpackExtensionHeader first, and if extHeader.isTimestampType is true, call unpackTimestamp(ext).
-
-When reading Timestamp values, [java.time.Instant](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/Instant.html) will be returned.
-You can extract the unixtime with Instant.getEpochSecond(), unixtime with milliseconds resolution with Instant.toEpochMilli(), and nano-resolution time with Instant.getNano().
+Timestamp value in MessagePack is an extension type value whose code is -1. You can read TimestampValue object with MessgageUnapcker.unpackValue method.
+If you are using low-level unpack methods (e.g., unpackInt, unpackExtension, etc.),
+you need to read unpackExtensionHeader first, and if extHeader.isTimestampType() is true, call unpackTimestamp(extHeader).
-As TimestampValue is a sub class of ExtensionValue, your code traversing MessagePack data with MessageUnpacker.unpackValue should require no change.
+Timestamp values are represented with [java.time.Instant](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/Instant.html) objects.
+You can extract the unixtime value with Instant.getEpochSecond(), unixtime with milliseconds resolution with Instant.toEpochMilli(), and nano-resolution time with Instant.getNano().
+As TimestampValue is just a sub class of ExtensionValue, no change requierd in your code that are traversing MessagePack data with MessageUnpacker.unpackValue method.
* Added Timestamp support [#565](http://github.com/msgpack/msgpack-java/pull/565) and low-level APIs [#580](https://github.com/msgpack/msgpack-java/pull/580) for
reading timestamp values.
=====================================
build.sbt
=====================================
@@ -5,7 +5,7 @@ Global / concurrentRestrictions := Seq(
Tags.limit(Tags.Test, 1)
)
-val AIRFRAME_VERSION = "21.6.0"
+val AIRFRAME_VERSION = "22.2.0"
// Use dynamic snapshot version strings for non tagged versions
ThisBuild / dynverSonatypeSnapshots := true
@@ -46,7 +46,7 @@ val buildSettings = Seq[Setting[_]](
Test / compile := ((Test / compile) dependsOn (Test / jcheckStyle)).value
)
-val junitInterface = "com.novocode" % "junit-interface" % "0.11" % "test"
+val junitInterface = "com.github.sbt" % "junit-interface" % "0.13.3" % "test"
// Project settings
lazy val root = Project(id = "msgpack-java", base = file("."))
@@ -84,8 +84,8 @@ lazy val msgpackCore = Project(id = "msgpack-core", base = file("msgpack-core"))
// For performance comparison with msgpack v6
"org.msgpack" % "msgpack" % "0.6.12" % "test",
// For integration test with Akka
- "com.typesafe.akka" %% "akka-actor" % "2.6.14" % "test",
- "org.scala-lang.modules" %% "scala-collection-compat" % "2.4.4" % "test"
+ "com.typesafe.akka" %% "akka-actor" % "2.6.18" % "test",
+ "org.scala-lang.modules" %% "scala-collection-compat" % "2.6.0" % "test"
)
)
=====================================
msgpack-core/src/main/java/org/msgpack/core/MessageBufferPacker.java
=====================================
@@ -34,7 +34,7 @@ public class MessageBufferPacker
{
protected MessageBufferPacker(MessagePack.PackerConfig config)
{
- this(new ArrayBufferOutput(), config);
+ this(new ArrayBufferOutput(config.getBufferSize()), config);
}
protected MessageBufferPacker(ArrayBufferOutput out, MessagePack.PackerConfig config)
=====================================
msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java
=====================================
@@ -1735,6 +1735,7 @@ public class MessageUnpacker
public void close()
throws IOException
{
+ totalReadBytes += position;
buffer = EMPTY_BUFFER;
position = 0;
in.close();
=====================================
msgpack-core/src/test/scala/org/msgpack/core/MessageUnpackerTest.scala
=====================================
@@ -254,6 +254,9 @@ class MessageUnpackerTest extends AirSpec with Benchmark {
}
count shouldBe 6
unpacker.getTotalReadBytes shouldBe arr.length
+
+ unpacker.close()
+ unpacker.getTotalReadBytes shouldBe arr.length
}
}
@@ -268,6 +271,9 @@ class MessageUnpackerTest extends AirSpec with Benchmark {
skipCount shouldBe 2
unpacker.getTotalReadBytes shouldBe testData.length
+
+ unpacker.close()
+ unpacker.getTotalReadBytes shouldBe testData.length
}
}
@@ -322,6 +328,9 @@ class MessageUnpackerTest extends AirSpec with Benchmark {
ib.result() shouldBe intSeq.toSeq
unpacker.getTotalReadBytes shouldBe testData2.length
+
+ unpacker.close()
+ unpacker.getTotalReadBytes shouldBe testData2.length
}
}
@@ -352,6 +361,9 @@ class MessageUnpackerTest extends AirSpec with Benchmark {
}
count shouldBe numElems
unpacker.getTotalReadBytes shouldBe data.length
+
+ unpacker.close()
+ unpacker.getTotalReadBytes shouldBe data.length
}
}
}
@@ -869,6 +881,9 @@ class MessageUnpackerTest extends AirSpec with Benchmark {
unpacker.unpackInt shouldBe 1
unpacker.getTotalReadBytes shouldBe arr.length
+
+ unpacker.close()
+ unpacker.getTotalReadBytes shouldBe arr.length
}
}
}
=====================================
msgpack-jackson/README.md
=====================================
@@ -58,11 +58,17 @@ Only thing you need to do is to instantiate `MessagePackFactory` and pass it to
System.out.println(deserialized.getName()); // => komamitsu
```
+Or more easily:
+
+```java
+ObjectMapper objectMapper = new MessagePackMapper();
+```
+
### Serialization/Deserialization of List
```java
// Instantiate ObjectMapper for MessagePack
- ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory());
+ ObjectMapper objectMapper = new MessagePackMapper();
// Serialize a List to byte array
List<Object> list = new ArrayList<>();
@@ -80,7 +86,7 @@ Only thing you need to do is to instantiate `MessagePackFactory` and pass it to
```java
// Instantiate ObjectMapper for MessagePack
- ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory());
+ ObjectMapper objectMapper = MessagePackMapper();
// Serialize a Map to byte array
Map<String, Object> map = new HashMap<>();
@@ -146,7 +152,7 @@ On the other hand, jackson-databind serializes and deserializes a POJO as a key-
But if you want to make this library handle POJOs in the same way as msgpack-java:0.6 or earlier, you can use `JsonArrayFormat` like this:
```java
- ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory());
+ ObjectMapper objectMapper = new MessagePackMapper();
objectMapper.setAnnotationIntrospector(new JsonArrayFormat());
```
@@ -156,7 +162,7 @@ But if you want to make this library handle POJOs in the same way as msgpack-jav
```java
OutputStream out = new FileOutputStream(tempFile);
- ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory());
+ ObjectMapper objectMapper = new MessagePackMapper();
objectMapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
objectMapper.writeValue(out, 1);
@@ -181,7 +187,7 @@ But if you want to make this library handle POJOs in the same way as msgpack-jav
packer.close();
FileInputStream in = new FileInputStream(tempFile);
- ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory());
+ ObjectMapper objectMapper = new MessagePackMapper();
objectMapper.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false);
System.out.println(objectMapper.readValue(in, Integer.class));
System.out.println(objectMapper.readValue(in, String.class));
@@ -194,7 +200,7 @@ Old msgpack-java (e.g 0.6.7) doesn't support MessagePack str8 type. When your ap
```java
MessagePack.PackerConfig config = new MessagePack.PackerConfig().withStr8FormatSupport(false);
- ObjectMapper mapperWithConfig = new ObjectMapper(new MessagePackFactory(config));
+ ObjectMapper mapperWithConfig = new MessagePackMapper(new MessagePackFactory(config));
// This string is serialized as bin8 type
byte[] resultWithoutStr8Format = mapperWithConfig.writeValueAsBytes(str8LengthString);
```
@@ -211,7 +217,7 @@ When you want to use non-String value as a key of Map, use `MessagePackKeySerial
intMap.put(42, "Hello");
- ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory());
+ ObjectMapper objectMapper = new MessagePackMapper();
byte[] bytes = objectMapper.writeValueAsBytes(intMap);
Map<Integer, String> deserialized = objectMapper.readValue(bytes, new TypeReference<Map<Integer, String>>() {});
@@ -407,7 +413,7 @@ When you serialize an object that has a nested object also serializing with Obje
@Test
public void testNestedSerialization() throws Exception
{
- ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory());
+ ObjectMapper objectMapper = new MessagePackMapper();
objectMapper.writeValueAsBytes(new OuterClass());
}
@@ -415,7 +421,7 @@ When you serialize an object that has a nested object also serializing with Obje
{
public String getInner() throws JsonProcessingException
{
- ObjectMapper m = new ObjectMapper(new MessagePackFactory());
+ ObjectMapper m = new MessagePackMapper();
m.writeValueAsBytes(new InnerClass());
return "EFG";
}
=====================================
msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/MessagePackMapper.java
=====================================
@@ -0,0 +1,52 @@
+//
+// MessagePack for Java
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+package org.msgpack.jackson.dataformat;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.cfg.MapperBuilder;
+
+public class MessagePackMapper extends ObjectMapper
+{
+ private static final long serialVersionUID = 3L;
+
+ public static class Builder extends MapperBuilder<MessagePackMapper, Builder>
+ {
+ public Builder(MessagePackMapper m)
+ {
+ super(m);
+ }
+ }
+
+ public MessagePackMapper()
+ {
+ this(new MessagePackFactory());
+ }
+
+ public MessagePackMapper(MessagePackFactory f)
+ {
+ super(f);
+ }
+
+ public static Builder builder()
+ {
+ return new Builder(new MessagePackMapper());
+ }
+
+ public static Builder builder(MessagePackFactory f)
+ {
+ return new Builder(new MessagePackMapper(f));
+ }
+}
=====================================
project/build.properties
=====================================
@@ -1,2 +1,2 @@
-sbt.version=1.5.3
+sbt.version=1.5.8
=====================================
project/plugins.sbt
=====================================
@@ -1,11 +1,11 @@
-addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
+addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.10")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
// TODO: Fixes jacoco error:
// java.lang.NoClassDefFoundError: Could not initialize class org.jacoco.core.internal.flow.ClassProbesAdapter
//addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.3.0")
addSbtPlugin("org.xerial.sbt" % "sbt-jcheckstyle" % "0.2.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.6")
-addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
+addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
scalacOptions ++= Seq("-deprecation", "-feature")
=====================================
sbt
=====================================
@@ -34,11 +34,11 @@
set -o pipefail
-declare -r sbt_release_version="1.5.1"
-declare -r sbt_unreleased_version="1.5.1"
+declare -r sbt_release_version="1.5.5"
+declare -r sbt_unreleased_version="1.6.0-M1"
-declare -r latest_213="2.13.5"
-declare -r latest_212="2.12.13"
+declare -r latest_213="2.13.7"
+declare -r latest_212="2.12.15"
declare -r latest_211="2.11.12"
declare -r latest_210="2.10.7"
declare -r latest_29="2.9.3"
@@ -216,7 +216,8 @@ getJavaVersion() {
# but on 9 and 10 it's 9.x.y and 10.x.y.
if [[ "$str" =~ ^1\.([0-9]+)(\..*)?$ ]]; then
echo "${BASH_REMATCH[1]}"
- elif [[ "$str" =~ ^([0-9]+)(\..*)?$ ]]; then
+ # Fixes https://github.com/dwijnand/sbt-extras/issues/326
+ elif [[ "$str" =~ ^([0-9]+)(\..*)?(-ea)?$ ]]; then
echo "${BASH_REMATCH[1]}"
elif [[ -n "$str" ]]; then
echoerr "Can't parse java version from: $str"
@@ -252,7 +253,9 @@ is_apple_silicon() { [[ "$(uname -s)" == "Darwin" && "$(uname -m)" == "arm64" ]]
# MaxPermSize critical on pre-8 JVMs but incurs noisy warning on 8+
default_jvm_opts() {
local -r v="$(java_version)"
- if [[ $v -ge 10 ]]; then
+ if [[ $v -ge 17 ]]; then
+ echo "$default_jvm_opts_common"
+ elif [[ $v -ge 10 ]]; then
if is_apple_silicon; then
# As of Dec 2020, JVM for Apple Silicon (M1) doesn't support JVMCI
echo "$default_jvm_opts_common"
View it on GitLab: https://salsa.debian.org/java-team/msgpack-java/-/commit/d5012fc5f107447d5caa9425d8126f03f2870c48
--
View it on GitLab: https://salsa.debian.org/java-team/msgpack-java/-/commit/d5012fc5f107447d5caa9425d8126f03f2870c48
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20220308/73edae18/attachment.htm>
More information about the pkg-java-commits
mailing list