[Git][java-team/jackson-dataformat-xml][master] 6 commits: New upstream version 2.9.8
Markus Koschany
gitlab at salsa.debian.org
Wed Dec 19 10:00:13 GMT 2018
Markus Koschany pushed to branch master at Debian Java Maintainers / jackson-dataformat-xml
Commits:
b86d18ff by Markus Koschany at 2018-12-19T09:50:31Z
New upstream version 2.9.8
- - - - -
4e8a0ccd by Markus Koschany at 2018-12-19T09:50:32Z
Update upstream source from tag 'upstream/2.9.8'
Update to upstream version '2.9.8'
with Debian dir 6d72e52e77c2ae4470b08be93377d547a3e2a0ff
- - - - -
7181180a by Markus Koschany at 2018-12-19T09:52:50Z
Change homepage to github address.
- - - - -
d3cdc2da by Markus Koschany at 2018-12-19T09:53:16Z
Update changelog
- - - - -
6166bcf4 by Markus Koschany at 2018-12-19T09:54:55Z
Drop jackson-base-version.patch
- - - - -
5e8e2407 by Markus Koschany at 2018-12-19T09:55:52Z
Refresh the patches.
- - - - -
12 changed files:
- debian/changelog
- debian/control
- debian/copyright
- debian/patches/jackson-base-version.patch
- debian/patches/javadoc-classpath.patch
- pom.xml
- release-notes/VERSION-2.x
- src/main/java/com/fasterxml/jackson/dataformat/xml/deser/XmlTokenStream.java
- src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java
- src/test/java/com/fasterxml/jackson/dataformat/xml/deser/builder/BuilderSimpleTest.java
- src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ListDeser294Test.java
- + src/test/java/com/fasterxml/jackson/dataformat/xml/ser/TestBinaryStreamToXMLSerialization.java
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+jackson-dataformat-xml (2.9.8-1) unstable; urgency=medium
+
+ * New upstream version 2.9.8
+ * Change homepage to github address.
+
+ -- Markus Koschany <apo at debian.org> Wed, 19 Dec 2018 10:53:03 +0100
+
jackson-dataformat-xml (2.9.7-2) unstable; urgency=medium
* Fix FTBFS by changing the jaxb api version to debian in
=====================================
debian/control
=====================================
@@ -28,7 +28,7 @@ Build-Depends:
Standards-Version: 4.2.1
Vcs-Git: https://anonscm.debian.org/git/pkg-java/jackson-dataformat-xml.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/jackson-dataformat-xml.git
-Homepage: http://wiki.fasterxml.com/JacksonExtensionXmlDataBinding
+Homepage: https://github.com/FasterXML/jackson-dataformat-xml
Package: libjackson2-dataformat-xml-java
Architecture: all
=====================================
debian/copyright
=====================================
@@ -1,6 +1,6 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Jackson-dataformat-XML
-Source: http://wiki.fasterxml.com/JacksonExtensionXmlDataBinding
+Source: https://github.com/FasterXML/jackson-dataformat-xml
Files-Excluded:
docs/*
=====================================
debian/patches/jackson-base-version.patch
=====================================
@@ -1,20 +1,20 @@
From: Markus Koschany <apo at debian.org>
-Date: Tue, 2 Oct 2018 18:54:25 +0200
-Subject: jackson-base-version
+Date: Wed, 19 Dec 2018 10:55:37 +0100
+Subject: jackson base version
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
-index 605c61e..7e8de1d 100644
+index b72dfa1..3264169 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-base</artifactId>
-- <version>2.9.7</version>
+- <version>2.9.8</version>
+ <version>debian</version>
</parent>
<groupId>com.fasterxml.jackson.dataformat</groupId>
=====================================
debian/patches/javadoc-classpath.patch
=====================================
@@ -10,10 +10,10 @@ Bug-Debian: https://bugs.debian.org/906368
1 file changed, 14 insertions(+)
diff --git a/pom.xml b/pom.xml
-index 181a0ae..605c61e 100644
+index 1b6a698..b72dfa1 100644
--- a/pom.xml
+++ b/pom.xml
-@@ -116,6 +116,20 @@ Some data-binding types overridden as well (ObjectMapper sub-classed as XmlMappe
+@@ -128,6 +128,20 @@ Some data-binding types overridden as well (ObjectMapper sub-classed as XmlMappe
</execution>
</executions>
</plugin>
=====================================
pom.xml
=====================================
@@ -4,11 +4,11 @@
<parent>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-base</artifactId>
- <version>2.9.7</version>
+ <version>2.9.8</version>
</parent>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
- <version>2.9.7</version>
+ <version>2.9.8</version>
<name>Jackson-dataformat-XML</name>
<packaging>bundle</packaging>
<description>Data format extension for Jackson (http://jackson.codehaus.org) to offer
@@ -21,7 +21,7 @@ Some data-binding types overridden as well (ObjectMapper sub-classed as XmlMappe
<connection>scm:git:git at github.com:FasterXML/jackson-dataformat-xml.git</connection>
<developerConnection>scm:git:git at github.com:FasterXML/jackson-dataformat-xml.git</developerConnection>
<url>http://github.com/FasterXML/jackson-dataformat-xml</url>
- <tag>jackson-dataformat-xml-2.9.7</tag>
+ <tag>jackson-dataformat-xml-2.9.8</tag>
</scm>
<properties>
<packageVersion.dir>com/fasterxml/jackson/dataformat/xml</packageVersion.dir>
@@ -103,6 +103,18 @@ Some data-binding types overridden as well (ObjectMapper sub-classed as XmlMappe
</dependency>
</dependencies>
+ <!-- Alas, need to include snapshot reference since otherwise can not find
+ snapshot of parent... -->
+ <repositories>
+ <repository>
+ <id>sonatype-nexus-snapshots</id>
+ <name>Sonatype Nexus Snapshots</name>
+ <url>https://oss.sonatype.org/content/repositories/snapshots</url>
+ <releases><enabled>false</enabled></releases>
+ <snapshots><enabled>true</enabled></snapshots>
+ </repository>
+ </repositories>
+
<build>
<plugins>
<plugin>
@@ -134,16 +146,4 @@ Some data-binding types overridden as well (ObjectMapper sub-classed as XmlMappe
</plugins>
</build>
- <profiles>
- <!-- 19-Feb-2012, tatu: Since we have some failing tests, may need to force release -->
- <profile>
- <id>force-release</id>
- <properties>
- <maven.test.skip>true</maven.test.skip>
- <skipTests>true</skipTests>
- </properties>
- </profile>
- </profiles>
- <!-- NOTE: repositories from parent POM -->
-
</project>
=====================================
release-notes/VERSION-2.x
=====================================
@@ -4,6 +4,13 @@ Project: jackson-dataformat-xml
= Releases
------------------------------------------------------------------------
+2.9.8 (15-Dec-2018)
+
+#270: Add support for `writeBinary()` with `InputStream` to `ToXMLGenerator`
+ (requested by csbxvs at github; contributed by marc-christian-schulze at github)
+#323: Replace slow string concatenation with faster `StringBuilder` (for
+ long text content)
+
2.9.7 (19-Sep-2018)
No changes since 2.9.6
=====================================
src/main/java/com/fasterxml/jackson/dataformat/xml/deser/XmlTokenStream.java
=====================================
@@ -377,11 +377,11 @@ public class XmlTokenStream
return "";
}
- String text = null;
+ CharSequence chars = null;
while (true) {
switch (_xmlReader.next()) {
case XMLStreamConstants.START_ELEMENT:
- return (text == null) ? "" : text;
+ return (chars == null) ? "" : chars.toString();
case XMLStreamConstants.END_ELEMENT:
case XMLStreamConstants.END_DOCUMENT:
@@ -389,26 +389,29 @@ public class XmlTokenStream
// as `null`, by below, but that breaks existing tests so not
// done at least until 3.0.
/*
- if (text == null) {
+ if (chars == null) {
if (FromXmlParser.Feature.EMPTY_ELEMENT_AS_NULL.enabledIn(_formatFeatures)) {
return null;
}
return "";
}
- return text;
+ return chars;
*/
- return (text == null) ? "" : text;
-
+ return (chars == null) ? "" : chars.toString();
+
// note: SPACE is ignorable (and seldom seen), not to be included
case XMLStreamConstants.CHARACTERS:
case XMLStreamConstants.CDATA:
// 17-Jul-2017, tatu: as per [dataformat-xml#236], need to try to...
{
String str = _getText(_xmlReader);
- if (text == null) {
- text = str;
- } else {
- text += str;
+ if (chars == null) {
+ chars = str;
+ } else {
+ if (chars instanceof String) {
+ chars = new StringBuilder(chars);
+ }
+ ((StringBuilder)chars).append(str);
}
}
break;
=====================================
src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java
=====================================
@@ -840,6 +840,69 @@ public final class ToXmlGenerator
}
}
+ @Override
+ public int writeBinary(Base64Variant b64variant, InputStream data, int dataLength) throws IOException
+ {
+ if (data == null) {
+ writeNull();
+ return 0;
+ }
+ _verifyValueWrite("write Binary value");
+ if (_nextName == null) {
+ handleMissingName();
+ }
+ try {
+ if (_nextIsAttribute) {
+ // Stax2 API only has 'full buffer' write method:
+ byte[] fullBuffer = toFullBuffer(data, dataLength);
+ _xmlWriter.writeBinaryAttribute("", _nextName.getNamespaceURI(), _nextName.getLocalPart(), fullBuffer);
+ } else if (checkNextIsUnwrapped()) {
+ // should we consider pretty-printing or not?
+ writeStreamAsBinary(data, dataLength);
+
+ } else {
+ if (_xmlPrettyPrinter != null) {
+ _xmlPrettyPrinter.writeLeafElement(_xmlWriter,
+ _nextName.getNamespaceURI(), _nextName.getLocalPart(),
+ toFullBuffer(data, dataLength), 0, dataLength);
+ } else {
+ _xmlWriter.writeStartElement(_nextName.getNamespaceURI(), _nextName.getLocalPart());
+ writeStreamAsBinary(data, dataLength);
+ _xmlWriter.writeEndElement();
+ }
+ }
+ } catch (XMLStreamException e) {
+ StaxUtil.throwAsGenerationException(e, this);
+ }
+
+ return dataLength;
+ }
+
+ private void writeStreamAsBinary(InputStream data, int len) throws IOException, XMLStreamException
+ {
+ // base64 encodes up to 3 bytes into a 4 bytes string
+ byte[] tmp = new byte[3];
+ int offset = 0;
+ int read;
+ while((read = data.read(tmp, offset, Math.min(3 - offset, len))) != -1) {
+ offset += read;
+ len -= read;
+ if(offset == 3) {
+ offset = 0;
+ _xmlWriter.writeBinary(tmp, 0, 3);
+ }
+ if (len == 0) {
+ break;
+ }
+ }
+
+ // we still have < 3 bytes in the buffer
+ if(offset > 0) {
+ _xmlWriter.writeBinary(tmp, 0, offset);
+ }
+ }
+
+
private byte[] toFullBuffer(byte[] data, int offset, int len)
{
// might already be ok:
@@ -852,7 +915,22 @@ public final class ToXmlGenerator
}
return result;
}
-
+
+ private byte[] toFullBuffer(InputStream data, final int len) throws IOException
+ {
+ byte[] result = new byte[len];
+ int offset = 0;
+
+ for (; offset < len; ) {
+ int count = data.read(result, offset, len - offset);
+ if (count < 0) {
+ _reportError("Too few bytes available: missing "+(len - offset)+" bytes (out of "+len+")");
+ }
+ offset += count;
+ }
+ return result;
+ }
+
/*
/**********************************************************
/* Output method implementations, primitive
=====================================
src/test/java/com/fasterxml/jackson/dataformat/xml/deser/builder/BuilderSimpleTest.java
=====================================
@@ -1,7 +1,5 @@
package com.fasterxml.jackson.dataformat.xml.deser.builder;
-import java.util.*;
-
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.core.Version;
=====================================
src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ListDeser294Test.java
=====================================
@@ -2,7 +2,6 @@ package com.fasterxml.jackson.dataformat.xml.failing;
import java.util.*;
-import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
=====================================
src/test/java/com/fasterxml/jackson/dataformat/xml/ser/TestBinaryStreamToXMLSerialization.java
=====================================
@@ -0,0 +1,61 @@
+package com.fasterxml.jackson.dataformat.xml.ser;
+
+import java.nio.*;
+
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import com.fasterxml.jackson.dataformat.xml.XmlTestBase;
+
+/**
+ * See <a href="https://github.com/FasterXML/jackson-dataformat-xml/issues/270">issue #270</a>
+ * for details
+ */
+public class TestBinaryStreamToXMLSerialization extends XmlTestBase
+{
+ private final XmlMapper MAPPER = new XmlMapper();
+
+ public void testWith0Bytes() throws Exception
+ {
+ String xml = MAPPER.writeValueAsString(createPojo());
+ assertEquals("<TestPojo><field/></TestPojo>", xml);
+ }
+
+ public void testWith1Byte() throws Exception
+ {
+ String xml = MAPPER.writeValueAsString(createPojo( 'A' ));
+ assertEquals("<TestPojo><field>QQ==</field></TestPojo>", xml);
+ }
+
+ public void testWith2Bytes() throws Exception
+ {
+ String xml = MAPPER.writeValueAsString(createPojo( 'A', 'B' ));
+ assertEquals("<TestPojo><field>QUI=</field></TestPojo>", xml);
+ }
+
+ public void testWith3Bytes() throws Exception
+ {
+ String xml = MAPPER.writeValueAsString(createPojo( 'A', 'B', 'C' ));
+ assertEquals("<TestPojo><field>QUJD</field></TestPojo>", xml);
+ }
+
+ public void testWith4Bytes() throws Exception
+ {
+ String xml = MAPPER.writeValueAsString(createPojo( 'A', 'B', 'C', 'D' ));
+ assertEquals("<TestPojo><field>QUJDRA==</field></TestPojo>", xml);
+ }
+
+ private TestPojo createPojo(char... content) {
+ TestPojo obj = new TestPojo();
+ // DirectByteBuffer does not have an underlying array
+ // so the ByteArraySerializer has to fallback to stream writing
+ obj.field = ByteBuffer.allocateDirect(content.length);
+ for(char b : content) {
+ obj.field.put((byte) b);
+ }
+ obj.field.position(0);
+ return obj;
+ }
+
+ public static class TestPojo {
+ public ByteBuffer field;
+ }
+}
View it on GitLab: https://salsa.debian.org/java-team/jackson-dataformat-xml/compare/e0a5cc39e59aa31024d090fe4ae65f576d69d0ce...5e8e24078b22b5446e434a066548ef274778f67a
--
View it on GitLab: https://salsa.debian.org/java-team/jackson-dataformat-xml/compare/e0a5cc39e59aa31024d090fe4ae65f576d69d0ce...5e8e24078b22b5446e434a066548ef274778f67a
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/20181219/bd174208/attachment.html>
More information about the pkg-java-commits
mailing list