From d22c2b0e45463aee75e1327158a6c0cc3f577051 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Sat, 13 May 2023 20:07:56 -0700 Subject: [PATCH 01/15] Fix tests wrt updated (2.15.1) max default string value length --- .../dataformat/csv/deser/CSVBigStringsTest.java | 15 ++++++++------- .../dataformat/toml/TomlBigStringsTest.java | 11 ++++++----- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java index 657685b7..ff4a3e55 100644 --- a/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java +++ b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java @@ -29,12 +29,13 @@ public void testBigString() throws Exception MappingIterator> it = MAPPER .readerForListOf(String.class) .with(CsvParser.Feature.WRAP_AS_ARRAY) - .readValues(generateCsv(5001000)); + .readValues(generateCsv(20_001_000)); it.readAll(); fail("expected DatabindException"); } catch (DatabindException e) { - assertTrue("unexpected exception message: " + e.getMessage(), - e.getMessage().startsWith("String length (5001000) exceeds the maximum length (5000000)")); + final String message = e.getMessage(); + assertTrue("unexpected exception message: " + message, message.startsWith("String length")); + assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (")); } } @@ -44,15 +45,15 @@ public void testBiggerString() throws Exception MappingIterator> it = MAPPER .readerForListOf(String.class) .with(CsvParser.Feature.WRAP_AS_ARRAY) - .readValues(generateCsv(7_000_000)); + .readValues(generateCsv(21_000_000)); it.readAll(); fail("expected DatabindException"); } catch (DatabindException e) { final String message = e.getMessage(); // this test fails when the TextBuffer is being resized, so we don't yet know just how big the string is - // so best not to assert that the String length value in the message is the full 2000000 value + // so best not to assert that the String length value in the message is the full 20_000_000 value assertTrue("unexpected exception message: " + message, message.startsWith("String length")); - assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (5000000)")); + assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (")); } } @@ -77,4 +78,4 @@ private String generateCsv(final int len) { } return sb.toString(); } -} +} \ No newline at end of file diff --git a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java index d94790a6..a1f3afbf 100644 --- a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java +++ b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java @@ -38,11 +38,12 @@ private TomlMapper newMapperWithUnlimitedStringSizeSupport() { public void testBigString() throws Exception { try { - MAPPER.readValue(generateToml(5001000), StringWrapper.class); + MAPPER.readValue(generateToml(20_001_000), StringWrapper.class); fail("expected StreamConstraintsException"); } catch (StreamConstraintsException e) { - assertTrue("unexpected exception message: " + e.getMessage(), - e.getMessage().startsWith("String length (5001000) exceeds the maximum length (5000000)")); + final String message = e.getMessage(); + assertTrue("unexpected exception message: " + message, message.startsWith("String length")); + assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (")); } } @@ -50,14 +51,14 @@ public void testBigString() throws Exception public void testBiggerString() throws Exception { try { - MAPPER.readValue(generateToml(6000000), StringWrapper.class); + MAPPER.readValue(generateToml(20_100_000), StringWrapper.class); fail("expected StreamConstraintsException"); } catch (StreamConstraintsException e) { final String message = e.getMessage(); // this test fails when the TextBuffer is being resized, so we don't yet know just how big the string is // so best not to assert that the String length value in the message is the full 6000000 value assertTrue("unexpected exception message: " + message, message.startsWith("String length")); - assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (5000000)")); + assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (")); } } From ea850727af5f84fc2fe706e3ca8d009aeb1f27dc Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Sat, 13 May 2023 20:10:51 -0700 Subject: [PATCH 02/15] Further minor test refactoring --- .../jackson/dataformat/csv/deser/CSVBigStringsTest.java | 8 +++++--- .../jackson/dataformat/toml/TomlBigStringsTest.java | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java index ff4a3e55..8cc718dc 100644 --- a/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java +++ b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java @@ -16,6 +16,8 @@ public class CSVBigStringsTest extends ModuleTestBase { private final CsvMapper MAPPER = mapperForCsv(); + private final static int TOO_LONG_STRING_VALUE_LEN = 20_000_100; + private CsvMapper newCsvMapperWithUnlimitedStringSizeSupport() { CsvFactory csvFactory = CsvFactory.builder() .streamReadConstraints(StreamReadConstraints.builder().maxStringLength(Integer.MAX_VALUE).build()) @@ -29,7 +31,7 @@ public void testBigString() throws Exception MappingIterator> it = MAPPER .readerForListOf(String.class) .with(CsvParser.Feature.WRAP_AS_ARRAY) - .readValues(generateCsv(20_001_000)); + .readValues(generateCsv(TOO_LONG_STRING_VALUE_LEN)); it.readAll(); fail("expected DatabindException"); } catch (DatabindException e) { @@ -45,7 +47,7 @@ public void testBiggerString() throws Exception MappingIterator> it = MAPPER .readerForListOf(String.class) .with(CsvParser.Feature.WRAP_AS_ARRAY) - .readValues(generateCsv(21_000_000)); + .readValues(generateCsv(TOO_LONG_STRING_VALUE_LEN)); it.readAll(); fail("expected DatabindException"); } catch (DatabindException e) { @@ -59,7 +61,7 @@ public void testBiggerString() throws Exception public void testUnlimitedString() throws Exception { - final int len = 5001000; + final int len = TOO_LONG_STRING_VALUE_LEN; MappingIterator> it = newCsvMapperWithUnlimitedStringSizeSupport() .readerForListOf(String.class) .with(CsvParser.Feature.WRAP_AS_ARRAY) diff --git a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java index a1f3afbf..1a88f52a 100644 --- a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java +++ b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java @@ -11,6 +11,7 @@ public class TomlBigStringsTest extends TomlMapperTestBase { + private final static int TOO_LONG_STRING_VALUE_LEN = 20_000_100; final static class StringWrapper { @@ -38,7 +39,7 @@ private TomlMapper newMapperWithUnlimitedStringSizeSupport() { public void testBigString() throws Exception { try { - MAPPER.readValue(generateToml(20_001_000), StringWrapper.class); + MAPPER.readValue(generateToml(TOO_LONG_STRING_VALUE_LEN), StringWrapper.class); fail("expected StreamConstraintsException"); } catch (StreamConstraintsException e) { final String message = e.getMessage(); @@ -51,7 +52,7 @@ public void testBigString() throws Exception public void testBiggerString() throws Exception { try { - MAPPER.readValue(generateToml(20_100_000), StringWrapper.class); + MAPPER.readValue(generateToml(TOO_LONG_STRING_VALUE_LEN), StringWrapper.class); fail("expected StreamConstraintsException"); } catch (StreamConstraintsException e) { final String message = e.getMessage(); @@ -65,7 +66,7 @@ public void testBiggerString() throws Exception @Test public void testUnlimitedString() throws Exception { - final int len = 5001000; + final int len = TOO_LONG_STRING_VALUE_LEN; StringWrapper sw = newMapperWithUnlimitedStringSizeSupport() .readValue(generateToml(len), StringWrapper.class); assertEquals(len, sw.string.length()); From 06b93c6a2c7f2ba8a4bd1eb37374bd9ade41aac2 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Sat, 13 May 2023 20:14:39 -0700 Subject: [PATCH 03/15] test fix wrt failure message changes --- .../jackson/dataformat/csv/deser/CSVBigStringsTest.java | 8 ++++---- .../jackson/dataformat/toml/TomlBigStringsTest.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java index 8cc718dc..06d67543 100644 --- a/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java +++ b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/deser/CSVBigStringsTest.java @@ -36,8 +36,8 @@ public void testBigString() throws Exception fail("expected DatabindException"); } catch (DatabindException e) { final String message = e.getMessage(); - assertTrue("unexpected exception message: " + message, message.startsWith("String length")); - assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (")); + assertTrue("unexpected exception message: " + message, message.startsWith("String value length")); + assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum allowed (")); } } @@ -54,8 +54,8 @@ public void testBiggerString() throws Exception final String message = e.getMessage(); // this test fails when the TextBuffer is being resized, so we don't yet know just how big the string is // so best not to assert that the String length value in the message is the full 20_000_000 value - assertTrue("unexpected exception message: " + message, message.startsWith("String length")); - assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (")); + assertTrue("unexpected exception message: " + message, message.startsWith("String value length")); + assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum allowed (")); } } diff --git a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java index 1a88f52a..f65ef709 100644 --- a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java +++ b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/TomlBigStringsTest.java @@ -43,8 +43,8 @@ public void testBigString() throws Exception fail("expected StreamConstraintsException"); } catch (StreamConstraintsException e) { final String message = e.getMessage(); - assertTrue("unexpected exception message: " + message, message.startsWith("String length")); - assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (")); + assertTrue("unexpected exception message: " + message, message.startsWith("String value length")); + assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum allowed (")); } } @@ -58,8 +58,8 @@ public void testBiggerString() throws Exception final String message = e.getMessage(); // this test fails when the TextBuffer is being resized, so we don't yet know just how big the string is // so best not to assert that the String length value in the message is the full 6000000 value - assertTrue("unexpected exception message: " + message, message.startsWith("String length")); - assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (")); + assertTrue("unexpected exception message: " + message, message.startsWith("String value length")); + assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum allowed (")); } } From 3092c1263351d013172d7e85cf2b30c073462d6d Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 16 May 2023 15:15:59 -0700 Subject: [PATCH 04/15] 2.15.1 release --- pom.xml | 2 +- release-notes/VERSION-2.x | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 51ae078d..b39b348e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.fasterxml.jackson jackson-base - 2.15.1-SNAPSHOT + 2.15.1 com.fasterxml.jackson.dataformat jackson-dataformats-text diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index db8e0c7d..6e6febd5 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -14,7 +14,7 @@ Active Maintainers: === Releases === ------------------------------------------------------------------------ -2.15.1 (not yet released) +2.15.1 (16-May-2023) #404: (yaml) Cannot serialize YAML with Deduction-Based Polymorphism (reported by Peter H) From d339564765bd137525b7627f9be87e3757f8efa7 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 16 May 2023 15:20:28 -0700 Subject: [PATCH 05/15] [maven-release-plugin] prepare release jackson-dataformats-text-2.15.1 --- csv/pom.xml | 2 +- pom.xml | 6 +++--- properties/pom.xml | 2 +- toml/pom.xml | 2 +- yaml/pom.xml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/csv/pom.xml b/csv/pom.xml index 629162d4..f818f370 100644 --- a/csv/pom.xml +++ b/csv/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.1-SNAPSHOT + 2.15.1 jackson-dataformat-csv Jackson-dataformat-CSV diff --git a/pom.xml b/pom.xml index b39b348e..c668731d 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text Jackson dataformats: Text - 2.15.1-SNAPSHOT + 2.15.1 pom Parent pom for Jackson text-based dataformats (as opposed to binary). @@ -33,7 +33,7 @@ scm:git:git@github.com:FasterXML/jackson-dataformats-text.git scm:git:git@github.com:FasterXML/jackson-dataformats-text.git https://github.com/FasterXML/jackson-dataformats-text - HEAD + jackson-dataformats-text-2.15.1 https://github.com/FasterXML/jackson-dataformats-text/issues @@ -41,7 +41,7 @@ - 2023-04-24T00:29:07Z + 2023-05-16T22:20:05Z diff --git a/properties/pom.xml b/properties/pom.xml index dd147e37..0d0dbebc 100644 --- a/properties/pom.xml +++ b/properties/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.1-SNAPSHOT + 2.15.1 jackson-dataformat-properties Jackson-dataformat-Properties diff --git a/toml/pom.xml b/toml/pom.xml index 2a65b37e..eef22959 100644 --- a/toml/pom.xml +++ b/toml/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.1-SNAPSHOT + 2.15.1 jackson-dataformat-toml jar diff --git a/yaml/pom.xml b/yaml/pom.xml index 634b5e6f..19127584 100644 --- a/yaml/pom.xml +++ b/yaml/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.1-SNAPSHOT + 2.15.1 jackson-dataformat-yaml jar From 17b83c973c88ac7453cf43abab309ad51e39165d Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 16 May 2023 15:20:31 -0700 Subject: [PATCH 06/15] [maven-release-plugin] prepare for next development iteration --- csv/pom.xml | 2 +- pom.xml | 6 +++--- properties/pom.xml | 2 +- toml/pom.xml | 2 +- yaml/pom.xml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/csv/pom.xml b/csv/pom.xml index f818f370..605f3353 100644 --- a/csv/pom.xml +++ b/csv/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.1 + 2.15.2-SNAPSHOT jackson-dataformat-csv Jackson-dataformat-CSV diff --git a/pom.xml b/pom.xml index c668731d..25ca4b36 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text Jackson dataformats: Text - 2.15.1 + 2.15.2-SNAPSHOT pom Parent pom for Jackson text-based dataformats (as opposed to binary). @@ -33,7 +33,7 @@ scm:git:git@github.com:FasterXML/jackson-dataformats-text.git scm:git:git@github.com:FasterXML/jackson-dataformats-text.git https://github.com/FasterXML/jackson-dataformats-text - jackson-dataformats-text-2.15.1 + HEAD https://github.com/FasterXML/jackson-dataformats-text/issues @@ -41,7 +41,7 @@ - 2023-05-16T22:20:05Z + 2023-05-16T22:20:31Z diff --git a/properties/pom.xml b/properties/pom.xml index 0d0dbebc..3b7993d4 100644 --- a/properties/pom.xml +++ b/properties/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.1 + 2.15.2-SNAPSHOT jackson-dataformat-properties Jackson-dataformat-Properties diff --git a/toml/pom.xml b/toml/pom.xml index eef22959..1f44dc63 100644 --- a/toml/pom.xml +++ b/toml/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.1 + 2.15.2-SNAPSHOT jackson-dataformat-toml jar diff --git a/yaml/pom.xml b/yaml/pom.xml index 19127584..300e3572 100644 --- a/yaml/pom.xml +++ b/yaml/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.1 + 2.15.2-SNAPSHOT jackson-dataformat-yaml jar From 563d9b3fd1f86f420eda8b8ddfe39a8d47c662db Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 16 May 2023 15:22:48 -0700 Subject: [PATCH 07/15] Back to snapshot dep --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 25ca4b36..c6789955 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.fasterxml.jackson jackson-base - 2.15.1 + 2.15.2-SNAPSHOT com.fasterxml.jackson.dataformat jackson-dataformats-text From d09526a7cec105472555444092dec99630978c72 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 30 May 2023 16:46:41 -0700 Subject: [PATCH 08/15] 2.15.2 release --- pom.xml | 2 +- release-notes/VERSION-2.x | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c6789955..f2febe78 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.fasterxml.jackson jackson-base - 2.15.2-SNAPSHOT + 2.15.2 com.fasterxml.jackson.dataformat jackson-dataformats-text diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 6e6febd5..dd84098b 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -14,6 +14,10 @@ Active Maintainers: === Releases === ------------------------------------------------------------------------ +2.15.2 (30-May-2023) + +No changes since 2.15.1 + 2.15.1 (16-May-2023) #404: (yaml) Cannot serialize YAML with Deduction-Based Polymorphism From 19554b4e4daf2f400bcba8b30fc44a6d6c40101a Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 30 May 2023 16:55:02 -0700 Subject: [PATCH 09/15] [maven-release-plugin] prepare release jackson-dataformats-text-2.15.2 --- csv/pom.xml | 2 +- pom.xml | 6 +++--- properties/pom.xml | 2 +- toml/pom.xml | 2 +- yaml/pom.xml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/csv/pom.xml b/csv/pom.xml index 605f3353..ec2c3069 100644 --- a/csv/pom.xml +++ b/csv/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.2-SNAPSHOT + 2.15.2 jackson-dataformat-csv Jackson-dataformat-CSV diff --git a/pom.xml b/pom.xml index f2febe78..af1ec3a3 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text Jackson dataformats: Text - 2.15.2-SNAPSHOT + 2.15.2 pom Parent pom for Jackson text-based dataformats (as opposed to binary). @@ -33,7 +33,7 @@ scm:git:git@github.com:FasterXML/jackson-dataformats-text.git scm:git:git@github.com:FasterXML/jackson-dataformats-text.git https://github.com/FasterXML/jackson-dataformats-text - HEAD + jackson-dataformats-text-2.15.2 https://github.com/FasterXML/jackson-dataformats-text/issues @@ -41,7 +41,7 @@ - 2023-05-16T22:20:31Z + 2023-05-30T23:54:39Z diff --git a/properties/pom.xml b/properties/pom.xml index 3b7993d4..036c3430 100644 --- a/properties/pom.xml +++ b/properties/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.2-SNAPSHOT + 2.15.2 jackson-dataformat-properties Jackson-dataformat-Properties diff --git a/toml/pom.xml b/toml/pom.xml index 1f44dc63..e5ebf50a 100644 --- a/toml/pom.xml +++ b/toml/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.2-SNAPSHOT + 2.15.2 jackson-dataformat-toml jar diff --git a/yaml/pom.xml b/yaml/pom.xml index 300e3572..a91ce7da 100644 --- a/yaml/pom.xml +++ b/yaml/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.2-SNAPSHOT + 2.15.2 jackson-dataformat-yaml jar From bcc9b0e3a95ec91916191bc6e87820a12de6421e Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 30 May 2023 16:55:05 -0700 Subject: [PATCH 10/15] [maven-release-plugin] prepare for next development iteration --- csv/pom.xml | 2 +- pom.xml | 6 +++--- properties/pom.xml | 2 +- toml/pom.xml | 2 +- yaml/pom.xml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/csv/pom.xml b/csv/pom.xml index ec2c3069..cc0d4411 100644 --- a/csv/pom.xml +++ b/csv/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.2 + 2.15.3-SNAPSHOT jackson-dataformat-csv Jackson-dataformat-CSV diff --git a/pom.xml b/pom.xml index af1ec3a3..13062990 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text Jackson dataformats: Text - 2.15.2 + 2.15.3-SNAPSHOT pom Parent pom for Jackson text-based dataformats (as opposed to binary). @@ -33,7 +33,7 @@ scm:git:git@github.com:FasterXML/jackson-dataformats-text.git scm:git:git@github.com:FasterXML/jackson-dataformats-text.git https://github.com/FasterXML/jackson-dataformats-text - jackson-dataformats-text-2.15.2 + HEAD https://github.com/FasterXML/jackson-dataformats-text/issues @@ -41,7 +41,7 @@ - 2023-05-30T23:54:39Z + 2023-05-30T23:55:05Z diff --git a/properties/pom.xml b/properties/pom.xml index 036c3430..bd2b3e9f 100644 --- a/properties/pom.xml +++ b/properties/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.2 + 2.15.3-SNAPSHOT jackson-dataformat-properties Jackson-dataformat-Properties diff --git a/toml/pom.xml b/toml/pom.xml index e5ebf50a..28a11657 100644 --- a/toml/pom.xml +++ b/toml/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.2 + 2.15.3-SNAPSHOT jackson-dataformat-toml jar diff --git a/yaml/pom.xml b/yaml/pom.xml index a91ce7da..9de57d59 100644 --- a/yaml/pom.xml +++ b/yaml/pom.xml @@ -9,7 +9,7 @@ com.fasterxml.jackson.dataformat jackson-dataformats-text - 2.15.2 + 2.15.3-SNAPSHOT jackson-dataformat-yaml jar From cd8605f549897bdca0cbf1c74991325930a3982d Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 30 May 2023 16:58:58 -0700 Subject: [PATCH 11/15] 2.15.3-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 13062990..b699887c 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.fasterxml.jackson jackson-base - 2.15.2 + 2.15.3-SNAPSHOT com.fasterxml.jackson.dataformat jackson-dataformats-text From 95c10ca35cfedcdf7eb88732064835818e8f970a Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Tue, 18 Jul 2023 04:22:43 +0100 Subject: [PATCH 12/15] police against issues with writing cyclic data (#421) --- .../jackson/dataformat/csv/CsvGenerator.java | 7 ++++ .../csv/impl/SimpleTokenWriteContext.java | 1 + .../csv/ser/dos/CyclicDataSerTest.java | 32 ++++++++++++++++ .../javaprop/JavaPropsGenerator.java | 7 ++++ .../javaprop/io/JPropWriteContext.java | 1 + .../javaprop/dos/CyclicDataSerTest.java | 32 ++++++++++++++++ .../javaprop/dos/DeepNestParserTest.java | 4 +- .../dataformat/toml/TomlGenerator.java | 7 ++++ .../dataformat/toml/TomlWriteContext.java | 1 + .../dataformat/toml/FuzzTomlReadTest.java | 10 ++++- .../toml/dos/CyclicDataSerTest.java | 37 +++++++++++++++++++ .../dataformat/yaml/YAMLGenerator.java | 7 ++++ .../yaml/ser/dos/CyclicDataSerTest.java | 33 +++++++++++++++++ 13 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/CyclicDataSerTest.java create mode 100644 properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/CyclicDataSerTest.java create mode 100644 toml/src/test/java/com/fasterxml/jackson/dataformat/toml/dos/CyclicDataSerTest.java create mode 100644 yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ser/dos/CyclicDataSerTest.java diff --git a/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvGenerator.java b/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvGenerator.java index 776df7ae..aa73e62b 100644 --- a/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvGenerator.java +++ b/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvGenerator.java @@ -478,6 +478,11 @@ public CsvGenerator disable(Feature f) { return this; } + @Override + public StreamWriteConstraints streamWriteConstraints() { + return _ioContext.streamWriteConstraints(); + } + /* /********************************************************** /* Public API: low-level I/O @@ -551,6 +556,7 @@ && _skipValue && isEnabled(JsonGenerator.Feature.IGNORE_UNKNOWN)) { } } _tokenWriteContext = _tokenWriteContext.createChildArrayContext(null); + streamWriteConstraints().validateNestingDepth(_tokenWriteContext.getNestingDepth()); // and that's about it, really } @@ -597,6 +603,7 @@ public final void writeStartObject() throws IOException } } _tokenWriteContext = _tokenWriteContext.createChildObjectContext(null); + streamWriteConstraints().validateNestingDepth(_tokenWriteContext.getNestingDepth()); } @Override diff --git a/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/impl/SimpleTokenWriteContext.java b/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/impl/SimpleTokenWriteContext.java index 0c270fec..734a4754 100644 --- a/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/impl/SimpleTokenWriteContext.java +++ b/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/impl/SimpleTokenWriteContext.java @@ -60,6 +60,7 @@ protected SimpleTokenWriteContext(int type, SimpleTokenWriteContext parent, DupD super(); _type = type; _parent = parent; + _nestingDepth = parent == null ? 0 : parent._nestingDepth + 1; _dups = dups; _index = -1; _currentValue = currentValue; diff --git a/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/CyclicDataSerTest.java b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/CyclicDataSerTest.java new file mode 100644 index 00000000..23440889 --- /dev/null +++ b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/CyclicDataSerTest.java @@ -0,0 +1,32 @@ +package com.fasterxml.jackson.dataformat.csv.ser.dos; + +import com.fasterxml.jackson.core.StreamWriteConstraints; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.dataformat.csv.CsvMapper; +import com.fasterxml.jackson.dataformat.csv.ModuleTestBase; + +import java.util.ArrayList; +import java.util.List; + +/** + * Simple unit tests to verify that we fail gracefully if you attempt to serialize + * data that is cyclic (eg a list that contains itself). + */ +public class CyclicDataSerTest extends ModuleTestBase +{ + private final CsvMapper MAPPER = mapperForCsv(); + + public void testListWithSelfReference() throws Exception { + List list = new ArrayList<>(); + list.add(list); + try { + MAPPER.writeValueAsString(list); + fail("expected JsonMappingException"); + } catch (JsonMappingException jmex) { + String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", + StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1); + assertTrue("JsonMappingException message is as expected?", + jmex.getMessage().startsWith(exceptionPrefix)); + } + } +} diff --git a/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/JavaPropsGenerator.java b/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/JavaPropsGenerator.java index 34bc1adc..90f3a2b4 100644 --- a/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/JavaPropsGenerator.java +++ b/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/JavaPropsGenerator.java @@ -80,6 +80,11 @@ public JavaPropsGenerator(IOContext ctxt, int stdFeatures, ObjectCodec codec) _jpropContext = JPropWriteContext.createRootContext(); } + @Override + public StreamWriteConstraints streamWriteConstraints() { + return _ioContext.streamWriteConstraints(); + } + @Override // since 2.13 public Object currentValue() { return _jpropContext.getCurrentValue(); @@ -267,6 +272,7 @@ public void writeFieldName(String name) throws IOException public void writeStartArray() throws IOException { _verifyValueWrite("start an array"); _jpropContext = _jpropContext.createChildArrayContext(_basePath.length()); + streamWriteConstraints().validateNestingDepth(_jpropContext.getNestingDepth()); } @Override @@ -281,6 +287,7 @@ public void writeEndArray() throws IOException { public void writeStartObject() throws IOException { _verifyValueWrite("start an object"); _jpropContext = _jpropContext.createChildObjectContext(_basePath.length()); + streamWriteConstraints().validateNestingDepth(_jpropContext.getNestingDepth()); } @Override diff --git a/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/io/JPropWriteContext.java b/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/io/JPropWriteContext.java index 4117612b..a857e7f3 100644 --- a/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/io/JPropWriteContext.java +++ b/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/io/JPropWriteContext.java @@ -59,6 +59,7 @@ protected JPropWriteContext(int type, JPropWriteContext parent, super(); _type = type; _parent = parent; + _nestingDepth = parent == null ? 0 : parent._nestingDepth + 1; _basePathLength = basePathLength; _index = -1; } diff --git a/properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/CyclicDataSerTest.java b/properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/CyclicDataSerTest.java new file mode 100644 index 00000000..01020172 --- /dev/null +++ b/properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/CyclicDataSerTest.java @@ -0,0 +1,32 @@ +package com.fasterxml.jackson.dataformat.javaprop.dos; + +import com.fasterxml.jackson.core.StreamWriteConstraints; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.dataformat.javaprop.JavaPropsMapper; +import com.fasterxml.jackson.dataformat.javaprop.ModuleTestBase; + +import java.util.ArrayList; +import java.util.List; + +/** + * Simple unit tests to verify that we fail gracefully if you attempt to serialize + * data that is cyclic (eg a list that contains itself). + */ +public class CyclicDataSerTest extends ModuleTestBase +{ + private final JavaPropsMapper MAPPER = newPropertiesMapper(); + + public void testListWithSelfReference() throws Exception { + List list = new ArrayList<>(); + list.add(list); + try { + MAPPER.writeValueAsString(list); + fail("expected JsonMappingException"); + } catch (JsonMappingException jmex) { + String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", + StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1); + assertTrue("JsonMappingException message is as expected?", + jmex.getMessage().startsWith(exceptionPrefix)); + } + } +} diff --git a/properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/DeepNestParserTest.java b/properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/DeepNestParserTest.java index 87098278..6cd5ded7 100644 --- a/properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/DeepNestParserTest.java +++ b/properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/DeepNestParserTest.java @@ -23,8 +23,10 @@ public void testDeeplyNestedData() throws IOException { } fail("expected StreamConstraintsException"); } catch (StreamConstraintsException e) { + String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", + StreamReadConstraints.DEFAULT_MAX_DEPTH + 1); assertTrue("unexpected exception message: " + e.getMessage(), - e.getMessage().startsWith("Document nesting depth (1001) exceeds the maximum allowed")); + e.getMessage().startsWith(exceptionPrefix)); } } diff --git a/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlGenerator.java b/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlGenerator.java index c9a864d2..d27941cc 100644 --- a/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlGenerator.java +++ b/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlGenerator.java @@ -91,6 +91,11 @@ public TomlGenerator(IOContext ioCtxt, int stdFeatures, int tomlFeatures, Object _outputEnd = _outputBuffer.length; } + @Override + public StreamWriteConstraints streamWriteConstraints() { + return _ioContext.streamWriteConstraints(); + } + /* /********************************************************************** /* Versioned @@ -343,6 +348,7 @@ public void writeStartArray(Object currValue) throws IOException { _verifyValueWrite("start an array", true); _streamWriteContext = _streamWriteContext.createChildArrayContext(currValue, _basePath.length()); + streamWriteConstraints().validateNestingDepth(_streamWriteContext.getNestingDepth()); if (_streamWriteContext._inline) { _writeRaw('['); } @@ -373,6 +379,7 @@ public void writeStartObject(Object forValue) throws IOException { // objects aren't always materialized right now _verifyValueWrite("start an object", false); _streamWriteContext = _streamWriteContext.createChildObjectContext(forValue, _basePath.length()); + streamWriteConstraints().validateNestingDepth(_streamWriteContext.getNestingDepth()); if (_streamWriteContext._inline) { writeRaw('{'); } diff --git a/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlWriteContext.java b/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlWriteContext.java index d81eb7d2..41ad2051 100644 --- a/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlWriteContext.java +++ b/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlWriteContext.java @@ -56,6 +56,7 @@ final class TomlWriteContext extends JsonStreamContext { super(); _type = type; _parent = parent; + _nestingDepth = parent == null ? 0 : parent._nestingDepth + 1; _basePathLength = basePathLength; _index = -1; _currentValue = currValue; diff --git a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/FuzzTomlReadTest.java b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/FuzzTomlReadTest.java index db7bd88e..f0adafd6 100644 --- a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/FuzzTomlReadTest.java +++ b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/FuzzTomlReadTest.java @@ -4,6 +4,8 @@ import java.io.InputStream; import java.util.Arrays; +import com.fasterxml.jackson.core.StreamReadConstraints; +import com.fasterxml.jackson.core.StreamWriteConstraints; import com.fasterxml.jackson.core.exc.StreamConstraintsException; import org.junit.Assert; import org.junit.Test; @@ -62,7 +64,9 @@ public void testParseInlineTable50432() throws Exception TOML_MAPPER.readTree(is); Assert.fail("Should not pass"); } catch (IOException e) { - verifyException(e, "Document nesting depth (1001) exceeds the maximum allowed"); + String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", + StreamReadConstraints.DEFAULT_MAX_DEPTH + 1); + verifyException(e, exceptionPrefix); } } } @@ -120,7 +124,9 @@ public void testStackOverflow50083() throws Exception TOML_MAPPER.readTree(input.toString()); Assert.fail("Should not pass"); } catch (StreamConstraintsException e) { - verifyException(e, "Document nesting depth (1001) exceeds the maximum allowed"); + String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", + StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1); + verifyException(e, exceptionPrefix); } } diff --git a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/dos/CyclicDataSerTest.java b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/dos/CyclicDataSerTest.java new file mode 100644 index 00000000..23dd3bb3 --- /dev/null +++ b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/dos/CyclicDataSerTest.java @@ -0,0 +1,37 @@ +package com.fasterxml.jackson.dataformat.toml.dos; + +import com.fasterxml.jackson.core.StreamWriteConstraints; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.toml.TomlMapperTestBase; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** + * Simple unit tests to verify that we fail gracefully if you attempt to serialize + * data that is cyclic (eg a list that contains itself). + */ +public class CyclicDataSerTest extends TomlMapperTestBase +{ + private final ObjectMapper MAPPER = newTomlMapper(); + + @Test + public void testListWithSelfReference() throws Exception { + List list = new ArrayList<>(); + list.add(list); + try { + MAPPER.writeValueAsString(list); + fail("expected JsonMappingException"); + } catch (JsonMappingException jmex) { + String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", + StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1); + assertTrue("JsonMappingException message is as expected?", + jmex.getMessage().startsWith(exceptionPrefix)); + } + } +} diff --git a/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java b/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java index e7073c95..f127f9a3 100644 --- a/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java +++ b/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java @@ -380,6 +380,11 @@ protected DumperOptions buildDumperOptions(int jsonFeatures, int yamlFeatures, return opt; } + @Override + public StreamWriteConstraints streamWriteConstraints() { + return _ioContext.streamWriteConstraints(); + } + /* /********************************************************************** /* Versioned @@ -585,6 +590,7 @@ public final void writeStartArray() throws IOException { _verifyValueWrite("start an array"); _writeContext = _writeContext.createChildArrayContext(); + streamWriteConstraints().validateNestingDepth(_writeContext.getNestingDepth()); FlowStyle style = _outputOptions.getDefaultFlowStyle(); String yamlTag = _typeId; boolean implicit = (yamlTag == null); @@ -613,6 +619,7 @@ public final void writeStartObject() throws IOException { _verifyValueWrite("start an object"); _writeContext = _writeContext.createChildObjectContext(); + streamWriteConstraints().validateNestingDepth(_writeContext.getNestingDepth()); FlowStyle style = _outputOptions.getDefaultFlowStyle(); String yamlTag = _typeId; boolean implicit = (yamlTag == null); diff --git a/yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ser/dos/CyclicDataSerTest.java b/yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ser/dos/CyclicDataSerTest.java new file mode 100644 index 00000000..d0239480 --- /dev/null +++ b/yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ser/dos/CyclicDataSerTest.java @@ -0,0 +1,33 @@ +package com.fasterxml.jackson.dataformat.yaml.ser.dos; + +import com.fasterxml.jackson.core.StreamWriteConstraints; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.ModuleTestBase; +import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; + +import java.util.ArrayList; +import java.util.List; + +/** + * Simple unit tests to verify that we fail gracefully if you attempt to serialize + * data that is cyclic (eg a list that contains itself). + */ +public class CyclicDataSerTest extends ModuleTestBase +{ + private final ObjectMapper MAPPER = YAMLMapper.builder().build(); + + public void testListWithSelfReference() throws Exception { + List list = new ArrayList<>(); + list.add(list); + try { + MAPPER.writeValueAsString(list); + fail("expected JsonMappingException"); + } catch (JsonMappingException jmex) { + String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", + StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1); + assertTrue("JsonMappingException message is as expected?", + jmex.getMessage().startsWith(exceptionPrefix)); + } + } +} From 1759da4f8d71d655b451562111aa37b7be13d923 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Mon, 17 Jul 2023 20:36:36 -0700 Subject: [PATCH 13/15] Minor tweaks post StreamWriteConstraints check PR --- .../jackson/dataformat/csv/CsvGenerator.java | 11 ++++++++-- ...SerTest.java => CyclicCSVDataSerTest.java} | 19 +++++++++--------- .../javaprop/JavaPropsGenerator.java | 8 +++++++- ...rTest.java => CyclicPropsDataSerTest.java} | 17 ++++++++-------- .../dataformat/toml/TomlGenerator.java | 9 +++++++-- .../dataformat/toml/LongTokenTest.java | 2 ++ .../jackson/dataformat/toml/ParserTest.java | 6 +++++- .../dataformat/toml/StringOutputUtilTest.java | 6 +++++- ...erTest.java => CyclicTOMLDataSerTest.java} | 18 +++++++++-------- .../dataformat/yaml/YAMLGenerator.java | 11 ++++++++-- ...erTest.java => CyclicYAMLDataSerTest.java} | 20 ++++++++++--------- 11 files changed, 84 insertions(+), 43 deletions(-) rename csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/{CyclicDataSerTest.java => CyclicCSVDataSerTest.java} (71%) rename properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/{CyclicDataSerTest.java => CyclicPropsDataSerTest.java} (77%) rename toml/src/test/java/com/fasterxml/jackson/dataformat/toml/dos/{CyclicDataSerTest.java => CyclicTOMLDataSerTest.java} (78%) rename yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ser/dos/{CyclicDataSerTest.java => CyclicYAMLDataSerTest.java} (72%) diff --git a/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvGenerator.java b/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvGenerator.java index aa73e62b..76f4cf6d 100644 --- a/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvGenerator.java +++ b/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvGenerator.java @@ -145,8 +145,13 @@ private Feature(boolean defaultState) { EMPTY_SCHEMA = CsvSchema.emptySchema(); } - final protected IOContext _ioContext; + protected final IOContext _ioContext; + /** + * @since 2.16 + */ + protected final StreamWriteConstraints _streamWriteConstraints; + /** * Bit flag composed of bits that indicate which * {@link CsvGenerator.Feature}s @@ -243,6 +248,7 @@ public CsvGenerator(IOContext ctxt, int jsonFeatures, int csvFeatures, { super(jsonFeatures, codec); _ioContext = ctxt; + _streamWriteConstraints = ctxt.streamWriteConstraints(); _formatFeatures = csvFeatures; _schema = schema; boolean useFastDoubleWriter = isEnabled(StreamWriteFeature.USE_FAST_DOUBLE_WRITER); @@ -257,6 +263,7 @@ public CsvGenerator(IOContext ctxt, int jsonFeatures, int csvFeatures, { super(jsonFeatures, codec); _ioContext = ctxt; + _streamWriteConstraints = ctxt.streamWriteConstraints(); _formatFeatures = csvFeatures; _writer = csvWriter; _writeContext = null; // just to make sure it won't be used @@ -480,7 +487,7 @@ public CsvGenerator disable(Feature f) { @Override public StreamWriteConstraints streamWriteConstraints() { - return _ioContext.streamWriteConstraints(); + return _streamWriteConstraints; } /* diff --git a/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/CyclicDataSerTest.java b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/CyclicCSVDataSerTest.java similarity index 71% rename from csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/CyclicDataSerTest.java rename to csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/CyclicCSVDataSerTest.java index 23440889..0f8a82bb 100644 --- a/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/CyclicDataSerTest.java +++ b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/ser/dos/CyclicCSVDataSerTest.java @@ -1,18 +1,19 @@ package com.fasterxml.jackson.dataformat.csv.ser.dos; +import java.util.ArrayList; +import java.util.List; + import com.fasterxml.jackson.core.StreamWriteConstraints; -import com.fasterxml.jackson.databind.JsonMappingException; + +import com.fasterxml.jackson.databind.DatabindException; import com.fasterxml.jackson.dataformat.csv.CsvMapper; import com.fasterxml.jackson.dataformat.csv.ModuleTestBase; -import java.util.ArrayList; -import java.util.List; - /** * Simple unit tests to verify that we fail gracefully if you attempt to serialize * data that is cyclic (eg a list that contains itself). */ -public class CyclicDataSerTest extends ModuleTestBase +public class CyclicCSVDataSerTest extends ModuleTestBase { private final CsvMapper MAPPER = mapperForCsv(); @@ -21,12 +22,12 @@ public void testListWithSelfReference() throws Exception { list.add(list); try { MAPPER.writeValueAsString(list); - fail("expected JsonMappingException"); - } catch (JsonMappingException jmex) { + fail("expected DatabindException"); + } catch (DatabindException e) { String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1); - assertTrue("JsonMappingException message is as expected?", - jmex.getMessage().startsWith(exceptionPrefix)); + assertTrue("DatabindException message is as expected?", + e.getMessage().startsWith(exceptionPrefix)); } } } diff --git a/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/JavaPropsGenerator.java b/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/JavaPropsGenerator.java index 90f3a2b4..58155731 100644 --- a/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/JavaPropsGenerator.java +++ b/properties/src/main/java/com/fasterxml/jackson/dataformat/javaprop/JavaPropsGenerator.java @@ -38,6 +38,11 @@ public abstract class JavaPropsGenerator extends GeneratorBase protected final IOContext _ioContext; + /** + * @since 2.16 + */ + protected final StreamWriteConstraints _streamWriteConstraints; + /** * Definition of columns being written, if available. */ @@ -77,12 +82,13 @@ public JavaPropsGenerator(IOContext ctxt, int stdFeatures, ObjectCodec codec) { super(stdFeatures, codec, BOGUS_WRITE_CONTEXT); _ioContext = ctxt; + _streamWriteConstraints = ctxt.streamWriteConstraints(); _jpropContext = JPropWriteContext.createRootContext(); } @Override public StreamWriteConstraints streamWriteConstraints() { - return _ioContext.streamWriteConstraints(); + return _streamWriteConstraints; } @Override // since 2.13 diff --git a/properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/CyclicDataSerTest.java b/properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/CyclicPropsDataSerTest.java similarity index 77% rename from properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/CyclicDataSerTest.java rename to properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/CyclicPropsDataSerTest.java index 01020172..68211eba 100644 --- a/properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/CyclicDataSerTest.java +++ b/properties/src/test/java/com/fasterxml/jackson/dataformat/javaprop/dos/CyclicPropsDataSerTest.java @@ -1,18 +1,19 @@ package com.fasterxml.jackson.dataformat.javaprop.dos; +import java.util.ArrayList; +import java.util.List; + import com.fasterxml.jackson.core.StreamWriteConstraints; -import com.fasterxml.jackson.databind.JsonMappingException; + +import com.fasterxml.jackson.databind.DatabindException; import com.fasterxml.jackson.dataformat.javaprop.JavaPropsMapper; import com.fasterxml.jackson.dataformat.javaprop.ModuleTestBase; -import java.util.ArrayList; -import java.util.List; - /** * Simple unit tests to verify that we fail gracefully if you attempt to serialize * data that is cyclic (eg a list that contains itself). */ -public class CyclicDataSerTest extends ModuleTestBase +public class CyclicPropsDataSerTest extends ModuleTestBase { private final JavaPropsMapper MAPPER = newPropertiesMapper(); @@ -21,12 +22,12 @@ public void testListWithSelfReference() throws Exception { list.add(list); try { MAPPER.writeValueAsString(list); - fail("expected JsonMappingException"); - } catch (JsonMappingException jmex) { + fail("expected DatabindException"); + } catch (DatabindException e) { String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1); assertTrue("JsonMappingException message is as expected?", - jmex.getMessage().startsWith(exceptionPrefix)); + e.getMessage().startsWith(exceptionPrefix)); } } } diff --git a/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlGenerator.java b/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlGenerator.java index d27941cc..50fc44f5 100644 --- a/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlGenerator.java +++ b/toml/src/main/java/com/fasterxml/jackson/dataformat/toml/TomlGenerator.java @@ -30,6 +30,11 @@ final class TomlGenerator extends GeneratorBase protected final IOContext _ioContext; + /** + * @since 2.16 + */ + protected final StreamWriteConstraints _streamWriteConstraints; + /** * Underlying {@link Writer} used for output. */ @@ -37,7 +42,6 @@ final class TomlGenerator extends GeneratorBase private final int _tomlFeatures; - /* /********************************************************************** /* Output state @@ -84,6 +88,7 @@ final class TomlGenerator extends GeneratorBase public TomlGenerator(IOContext ioCtxt, int stdFeatures, int tomlFeatures, ObjectCodec codec, Writer out) { super(stdFeatures, codec); _ioContext = ioCtxt; + _streamWriteConstraints = ioCtxt.streamWriteConstraints(); _tomlFeatures = tomlFeatures; _streamWriteContext = TomlWriteContext.createRootContext(); _out = out; @@ -93,7 +98,7 @@ public TomlGenerator(IOContext ioCtxt, int stdFeatures, int tomlFeatures, Object @Override public StreamWriteConstraints streamWriteConstraints() { - return _ioContext.streamWriteConstraints(); + return _streamWriteConstraints; } /* diff --git a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/LongTokenTest.java b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/LongTokenTest.java index 0fc43822..5e6a37e9 100644 --- a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/LongTokenTest.java +++ b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/LongTokenTest.java @@ -1,6 +1,7 @@ package com.fasterxml.jackson.dataformat.toml; import com.fasterxml.jackson.core.StreamReadConstraints; +import com.fasterxml.jackson.core.StreamWriteConstraints; import com.fasterxml.jackson.core.io.ContentReference; import com.fasterxml.jackson.core.io.IOContext; import com.fasterxml.jackson.core.util.BufferRecyclers; @@ -130,6 +131,7 @@ public void stringEscapes() throws IOException { private IOContext _ioContext(CharSequence toml) { return new IOContext(StreamReadConstraints.defaults(), + StreamWriteConstraints.defaults(), BufferRecyclers.getBufferRecycler(), ContentReference.rawReference(toml), false); } } diff --git a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/ParserTest.java b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/ParserTest.java index 5a06d465..15ddce19 100644 --- a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/ParserTest.java +++ b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/ParserTest.java @@ -1,6 +1,8 @@ package com.fasterxml.jackson.dataformat.toml; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.StreamReadConstraints; +import com.fasterxml.jackson.core.StreamWriteConstraints; import com.fasterxml.jackson.core.io.ContentReference; import com.fasterxml.jackson.core.io.IOContext; import com.fasterxml.jackson.core.json.JsonReadFeature; @@ -45,7 +47,9 @@ static ObjectNode toml(@Language("toml") String toml) throws IOException { static ObjectNode toml(TomlFactory factory, @Language("toml") String toml) throws IOException { return Parser.parse( factory, - new IOContext(BufferRecyclers.getBufferRecycler(), + new IOContext(StreamReadConstraints.defaults(), + StreamWriteConstraints.defaults(), + BufferRecyclers.getBufferRecycler(), ContentReference.rawReference(toml), false), new StringReader(toml) ); diff --git a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/StringOutputUtilTest.java b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/StringOutputUtilTest.java index f4522e23..94aba866 100644 --- a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/StringOutputUtilTest.java +++ b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/StringOutputUtilTest.java @@ -1,5 +1,7 @@ package com.fasterxml.jackson.dataformat.toml; +import com.fasterxml.jackson.core.StreamReadConstraints; +import com.fasterxml.jackson.core.StreamWriteConstraints; import com.fasterxml.jackson.core.io.ContentReference; import com.fasterxml.jackson.core.io.IOContext; import com.fasterxml.jackson.core.util.BufferRecyclers; @@ -99,7 +101,9 @@ public void exhaustiveWriteReadTest() throws IOException { } private IOContext _ioContext(CharSequence toml) { - return new IOContext(BufferRecyclers.getBufferRecycler(), + return new IOContext(StreamReadConstraints.defaults(), + StreamWriteConstraints.defaults(), + BufferRecyclers.getBufferRecycler(), ContentReference.rawReference(true, toml), false); } } diff --git a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/dos/CyclicDataSerTest.java b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/dos/CyclicTOMLDataSerTest.java similarity index 78% rename from toml/src/test/java/com/fasterxml/jackson/dataformat/toml/dos/CyclicDataSerTest.java rename to toml/src/test/java/com/fasterxml/jackson/dataformat/toml/dos/CyclicTOMLDataSerTest.java index 23dd3bb3..e8ad0276 100644 --- a/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/dos/CyclicDataSerTest.java +++ b/toml/src/test/java/com/fasterxml/jackson/dataformat/toml/dos/CyclicTOMLDataSerTest.java @@ -1,13 +1,15 @@ package com.fasterxml.jackson.dataformat.toml.dos; +import java.util.ArrayList; +import java.util.List; + import com.fasterxml.jackson.core.StreamWriteConstraints; -import com.fasterxml.jackson.databind.JsonMappingException; + +import com.fasterxml.jackson.databind.DatabindException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.toml.TomlMapperTestBase; -import org.junit.Test; -import java.util.ArrayList; -import java.util.List; +import org.junit.Test; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -16,7 +18,7 @@ * Simple unit tests to verify that we fail gracefully if you attempt to serialize * data that is cyclic (eg a list that contains itself). */ -public class CyclicDataSerTest extends TomlMapperTestBase +public class CyclicTOMLDataSerTest extends TomlMapperTestBase { private final ObjectMapper MAPPER = newTomlMapper(); @@ -26,11 +28,11 @@ public void testListWithSelfReference() throws Exception { list.add(list); try { MAPPER.writeValueAsString(list); - fail("expected JsonMappingException"); - } catch (JsonMappingException jmex) { + fail("expected DatabindException"); + } catch (DatabindException jmex) { String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1); - assertTrue("JsonMappingException message is as expected?", + assertTrue("DatabindException message is as expected?", jmex.getMessage().startsWith(exceptionPrefix)); } } diff --git a/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java b/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java index f127f9a3..b9819dfa 100644 --- a/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java +++ b/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLGenerator.java @@ -226,7 +226,12 @@ private Feature(boolean defaultState) { /********************************************************************** */ - final protected IOContext _ioContext; + protected final IOContext _ioContext; + + /** + * @since 2.16 + */ + protected final StreamWriteConstraints _streamWriteConstraints; /** * Bit flag composed of bits that indicate which @@ -295,6 +300,7 @@ public YAMLGenerator(IOContext ctxt, int jsonFeatures, int yamlFeatures, { super(jsonFeatures, codec); _ioContext = ctxt; + _streamWriteConstraints = ctxt.streamWriteConstraints(); _formatFeatures = yamlFeatures; _quotingChecker = (quotingChecker == null) ? StringQuotingChecker.Default.instance() : quotingChecker; @@ -320,6 +326,7 @@ public YAMLGenerator(IOContext ctxt, int jsonFeatures, int yamlFeatures, { super(jsonFeatures, codec); _ioContext = ctxt; + _streamWriteConstraints = ctxt.streamWriteConstraints(); _formatFeatures = yamlFeatures; _quotingChecker = (quotingChecker == null) ? StringQuotingChecker.Default.instance() : quotingChecker; @@ -382,7 +389,7 @@ protected DumperOptions buildDumperOptions(int jsonFeatures, int yamlFeatures, @Override public StreamWriteConstraints streamWriteConstraints() { - return _ioContext.streamWriteConstraints(); + return _streamWriteConstraints; } /* diff --git a/yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ser/dos/CyclicDataSerTest.java b/yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ser/dos/CyclicYAMLDataSerTest.java similarity index 72% rename from yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ser/dos/CyclicDataSerTest.java rename to yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ser/dos/CyclicYAMLDataSerTest.java index d0239480..722f463c 100644 --- a/yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ser/dos/CyclicDataSerTest.java +++ b/yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/ser/dos/CyclicYAMLDataSerTest.java @@ -1,19 +1,21 @@ package com.fasterxml.jackson.dataformat.yaml.ser.dos; +import java.util.ArrayList; +import java.util.List; + import com.fasterxml.jackson.core.StreamWriteConstraints; -import com.fasterxml.jackson.databind.JsonMappingException; + +import com.fasterxml.jackson.databind.DatabindException; import com.fasterxml.jackson.databind.ObjectMapper; + import com.fasterxml.jackson.dataformat.yaml.ModuleTestBase; import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; -import java.util.ArrayList; -import java.util.List; - /** * Simple unit tests to verify that we fail gracefully if you attempt to serialize * data that is cyclic (eg a list that contains itself). */ -public class CyclicDataSerTest extends ModuleTestBase +public class CyclicYAMLDataSerTest extends ModuleTestBase { private final ObjectMapper MAPPER = YAMLMapper.builder().build(); @@ -22,12 +24,12 @@ public void testListWithSelfReference() throws Exception { list.add(list); try { MAPPER.writeValueAsString(list); - fail("expected JsonMappingException"); - } catch (JsonMappingException jmex) { + fail("expected DatabindException"); + } catch (DatabindException e) { String exceptionPrefix = String.format("Document nesting depth (%d) exceeds the maximum allowed", StreamWriteConstraints.DEFAULT_MAX_DEPTH + 1); - assertTrue("JsonMappingException message is as expected?", - jmex.getMessage().startsWith(exceptionPrefix)); + assertTrue("DatabindException message is as expected?", + e.getMessage().startsWith(exceptionPrefix)); } } } From ed1157d87b08e94a3df96e091878ba6afcdf9126 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Thu, 27 Jul 2023 20:32:41 -0700 Subject: [PATCH 14/15] ... --- .../com/fasterxml/jackson/dataformat/yaml/YAMLFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLFactory.java b/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLFactory.java index 10443a25..47cb07a5 100644 --- a/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLFactory.java +++ b/yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLFactory.java @@ -3,13 +3,13 @@ import java.io.*; import java.net.URL; -import org.yaml.snakeyaml.DumperOptions; - import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.core.format.InputAccessor; import com.fasterxml.jackson.core.format.MatchStrength; import com.fasterxml.jackson.core.io.IOContext; import com.fasterxml.jackson.dataformat.yaml.util.StringQuotingChecker; + +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.LoaderOptions; @SuppressWarnings("resource") From 82feedebb984c2fef756abf21f219e8b370e2f85 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Thu, 27 Jul 2023 20:52:26 -0700 Subject: [PATCH 15/15] Fix 422: add `CsvSchema.Builder.removeColumn()` method (#423) --- .../jackson/dataformat/csv/CsvSchema.java | 39 ++++++------------- .../dataformat/csv/schema/CsvSchemaTest.java | 5 +++ release-notes/VERSION-2.x | 4 ++ 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvSchema.java b/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvSchema.java index 3b68a57a..2f49df0a 100644 --- a/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvSchema.java +++ b/csv/src/main/java/com/fasterxml/jackson/dataformat/csv/CsvSchema.java @@ -279,14 +279,6 @@ public Column(int index, String name, ColumnType type) { this(index, name, type, ""); } - /** - * @deprecated use variant where `arrayElementSep` is String - */ - @Deprecated // in 2.7; remove from 2.8 - public Column(int index, String name, ColumnType type, int arrayElementSep) { - this(index, name, type, (arrayElementSep < 0) ? NO_ARRAY_ELEMENT_SEPARATOR : Character.toString((char) arrayElementSep)); - } - public Column(int index, String name, ColumnType type, String arrayElementSep) { _index = index; @@ -529,15 +521,6 @@ public Builder addArrayColumn(String name) { return addColumn(new Column(index, name, ColumnType.ARRAY, "")); } - /** - * @deprecated use {@link #addArrayColumn(String, String)} instead - */ - @Deprecated // in 2.7; remove from 2.8 - public Builder addArrayColumn(String name, int elementSeparator) { - int index = _columns.size(); - return addColumn(new Column(index, name, ColumnType.ARRAY, elementSeparator)); - } - /** * @since 2.7 */ @@ -554,15 +537,24 @@ public Builder addBooleanColumn(String name) { return addColumn(new Column(index, name, ColumnType.BOOLEAN)); } + public Builder renameColumn(int index, String newName) { + _checkIndex(index); + _columns.set(index, _columns.get(index).withName(newName)); + return this; + } + public Builder replaceColumn(int index, Column c) { _checkIndex(index); _columns.set(index, c); return this; } - public Builder renameColumn(int index, String newName) { + /** + * @since 2.16 + */ + public Builder removeColumn(int index) { _checkIndex(index); - _columns.set(index, _columns.get(index).withName(newName)); + _columns.remove(index); return this; } @@ -594,15 +586,6 @@ public Builder removeArrayElementSeparator(int index) { return this; } - /** - * @deprecated use {@link #setArrayElementSeparator(String)} instead - */ - @Deprecated // in 2.7; remove from 2.8 - public void setArrayElementSeparator(int index, char sep) { - _checkIndex(index); - _columns.set(index, _columns.get(index).withElementSeparator(sep)); - } - /** * @since 2.7 */ diff --git a/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/schema/CsvSchemaTest.java b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/schema/CsvSchemaTest.java index 5f98937e..7aee09f4 100644 --- a/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/schema/CsvSchemaTest.java +++ b/csv/src/test/java/com/fasterxml/jackson/dataformat/csv/schema/CsvSchemaTest.java @@ -94,6 +94,11 @@ public void testUserWithTypedAutoSchema() throws Exception // Then verify linkage _verifyLinks(schema); + + // and then modify it a bit + CsvSchema.Builder b = schema.rebuild(); + b.removeColumn(1); // lastName; + assertEquals(4, b.build().size()); } public void testArrayWithTypedAutoSchema() throws Exception diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index dd84098b..211ec22d 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -14,6 +14,10 @@ Active Maintainers: === Releases === ------------------------------------------------------------------------ +2.16.0 (not yet released) + +#422: (csv) Add `removeColumn()` method in `CsvSchema.Builder` + 2.15.2 (30-May-2023) No changes since 2.15.1