[jackson-dataformat-yaml] 03/04: SnakeYAML 1.11 compatibility

Wolodja Wentland babilen-guest at alioth.debian.org
Fri Sep 27 12:19:16 UTC 2013


This is an automated email from the git hooks/post-receive script.

babilen-guest pushed a commit to annotated tag debian/2.2.3-1
in repository jackson-dataformat-yaml.

commit be0e891c26c342ff7ffe7ad3da20c57509002999
Author: Wolodja Wentland <babilen at gmail.com>
Date:   Thu Sep 26 15:42:38 2013 +0100

    SnakeYAML 1.11 compatibility
    
    This patch allows compilation against SnakeYAML versions >= 1.11 which
    introduced backwards incompatible changes.
    
        * Use Version enum instead of Array of Integers (1428:3262575396ab)
    
    Furthermore version 1.11 fixes issue 146 [0] in SnakeYAML so that no explicit
    document start marker (i.e. "---") is written if tags are empty. This
    necessitated changes to the generation tests that codified the (buggy)
    behaviour.
---
 .../0001-SnakeYAML-1.11-compatibility.patch        |  104 ++++++++++++++++++++
 debian/patches/series                              |    1 +
 2 files changed, 105 insertions(+)

diff --git a/debian/patches/0001-SnakeYAML-1.11-compatibility.patch b/debian/patches/0001-SnakeYAML-1.11-compatibility.patch
new file mode 100644
index 0000000..cfb9cf2
--- /dev/null
+++ b/debian/patches/0001-SnakeYAML-1.11-compatibility.patch
@@ -0,0 +1,104 @@
+From: Wolodja Wentland <babilen at gmail.com>
+Date: Thu, 26 Sep 2013 15:41:13 +0100
+Subject: SnakeYAML 1.11 compatibility
+
+This patch allows compilation against SnakeYAML versions >= 1.11 which
+introduced backwards incompatible changes.
+
+    * Use Version enum instead of Array of Integers (1428:3262575396ab)
+
+Furthermore version 1.11 fixes issue 146 [0] in SnakeYAML so that no explicit
+document start marker (i.e. "---") is written if tags are empty. This
+necessitated changes to the generation tests that codified the (buggy)
+behaviour.
+
+[0] https://code.google.com/p/snakeyaml/issues/detail?id=146
+---
+ .../java/com/fasterxml/jackson/dataformat/yaml/YAMLFactory.java  | 5 ++---
+ .../com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java     | 2 +-
+ .../fasterxml/jackson/dataformat/yaml/SimpleGenerationTest.java  | 9 ++++-----
+ 3 files changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLFactory.java b/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLFactory.java
+index 73d2d25..1a4b621 100644
+--- a/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLFactory.java
++++ b/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLFactory.java
+@@ -56,7 +56,7 @@ public class YAMLFactory extends JsonFactory
+ 
+     protected transient DumperOptions _outputOptions;
+ 
+-    protected Integer[] _version;
++    protected DumperOptions.Version _version;
+     
+     /**
+      * Default constructor used to create factory instances.
+@@ -76,8 +76,7 @@ public class YAMLFactory extends JsonFactory
+         _yamlParserFeatures = DEFAULT_YAML_PARSER_FEATURE_FLAGS;
+         _yamlGeneratorFeatures = DEFAULT_YAML_GENERATOR_FEATURE_FLAGS;
+         _outputOptions = _defaultOptions();
+-        DumperOptions.Version version = _outputOptions.getVersion();
+-        _version = (version == null) ? null : version.getArray();
++        _version = _outputOptions.getVersion();
+     }
+ 
+     /**
+diff --git a/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java b/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java
+index 5687331..d9ea4ac 100644
+--- a/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java
++++ b/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java
+@@ -100,7 +100,7 @@ public class YAMLGenerator extends GeneratorBase
+     
+     public YAMLGenerator(IOContext ctxt, int jsonFeatures, int yamlFeatures,
+             ObjectCodec codec, Writer out,
+-            DumperOptions outputOptions, Integer[] version
++            DumperOptions outputOptions, DumperOptions.Version version
+             ) throws IOException
+     {
+         super(jsonFeatures, codec);
+diff --git a/src/test/java/com/fasterxml/jackson/dataformat/yaml/SimpleGenerationTest.java b/src/test/java/com/fasterxml/jackson/dataformat/yaml/SimpleGenerationTest.java
+index f2aa032..6750d21 100644
+--- a/src/test/java/com/fasterxml/jackson/dataformat/yaml/SimpleGenerationTest.java
++++ b/src/test/java/com/fasterxml/jackson/dataformat/yaml/SimpleGenerationTest.java
+@@ -22,7 +22,7 @@ public class SimpleGenerationTest extends ModuleTestBase
+         
+         String yaml = w.toString();
+         // should probably parse...
+-        assertEquals("---\n- 3\n- \"foobar\"\n", yaml);
++        assertEquals("- 3\n- \"foobar\"\n", yaml);
+     }
+ 
+     public void testStreamingObject() throws Exception
+@@ -37,7 +37,7 @@ public class SimpleGenerationTest extends ModuleTestBase
+         gen.close();
+         
+         String yaml = w.toString();
+-        assertEquals("---\nname: \"Brad\"\nage: 39\n", yaml);
++        assertEquals("name: \"Brad\"\nage: 39\n", yaml);
+     }
+     
+     public void testBasicPOJO() throws Exception
+@@ -47,14 +47,13 @@ public class SimpleGenerationTest extends ModuleTestBase
+                 FiveMinuteUser.Gender.MALE, new byte[] { 1, 3, 13, 79 });
+         String yaml = mapper.writeValueAsString(user).trim();
+         String[] parts = yaml.split("\n");
+-        assertEquals(6, parts.length);
++        assertEquals(5, parts.length);
+         // unify ordering, need to use TreeSets
+         TreeSet<String> exp = new TreeSet<String>();
+         for (String part : parts) {
+             exp.add(part.trim());
+         }
+         Iterator<String> it = exp.iterator();
+-        assertEquals("---", it.next());
+         assertEquals("firstName: \"Bob\"", it.next());
+         assertEquals("gender: \"MALE\"", it.next());
+         assertEquals("lastName: \"Dabolito\"", it.next());
+@@ -70,7 +69,7 @@ public class SimpleGenerationTest extends ModuleTestBase
+         ObjectMapper mapper = mapperForYAML();
+         mapper.writeValue(f, "Foobar");
+         assertTrue(f.canRead());
+-        assertEquals(13L, f.length());
++        assertEquals(9L, f.length());
+         f.delete();
+     }
+ }
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..40283dd
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-SnakeYAML-1.11-compatibility.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jackson-dataformat-yaml.git



More information about the pkg-java-commits mailing list