On Tue, Feb 28, 2023 at 8:18 PM Akhil Ranjan
<[email protected]> wrote:
>
> I use jackson-core:2.14.1 in my application, and I tried upgrading to newly 
> released snakeyaml:2.0, to get rid of vulnerabilities in the earlier 
> snakeyaml version.
>
> I started getting the following runtime Exception with the 
> jackson-core:2.14.1 + snakeyaml:2.0 combination :-
>
> EXCEPTION=org.yaml.snakeyaml.parser.ParserImpl.<init>(Lorg/yaml/snakeyaml/reader/StreamReader;)V
>
> java.lang.NoSuchMethodError: 
> org.yaml.snakeyaml.parser.ParserImpl.<init>(Lorg/yaml/snakeyaml/reader/StreamReader;)V
>
> at 
> com.fasterxml.jackson.dataformat.yaml.YAMLParser.<init>(YAMLParser.java:191)
>
> at 
> com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createParser(YAMLFactory.java:509)
>
> at 
> com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:413)
>
> at 
> com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:386)
>
> at 
> com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:15)
>
> at 
> com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3677)
>
> at 
> com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3645)
>
>
> I then upgraded to jackson-core:2.14.2, and the above error was resolved. The 
> latest jackson-core version worked with snakeyaml:2.0.
>
> I'm curious above the changes in the jackson-core v2.14.2, that makes it 
> compatible with the new snakeyaml artifact. Release notes for v2.14.2 states 
> the following changes
> :-
>
> 2.14.2 (28-Jan-2023) #854: Backport schubfach changes from v2.15#8 
> (contributed by @pjfanning) #882: Allow TokenFIlter to skip last elements in 
> arrays (contributed by Przemyslaw G) #886: Avoid instance creations in fast 
> parser code (contributed by @pjfanning) #890: `FilteringGeneratorDelegate` 
> does not create new `filterContext` if `tokenFilter` is null (contributed by 
> @DemonicTutor)
> Request inputs on why jackson-core:2.14.2 works with snakeyaml:2.0, but 
> jackson-core:2.14.1 doesn't.

As the stack trace shows, constructor of "ParserImpl":

org.yaml.snakeyaml.parser.ParserImpl.<init>(Lorg/yaml/snakeyaml/reader/StreamReader;)V

which version of YAML module 2.14.1 used was removed by SnakeYAML
version 2.0 -- 1.x -> 2.x is a major version upgrade and as such not
(guaranteed to be) backwards compatible.

Also note that the version incompatibility is not with `jackson-core`
but rather with `jackson-dataformat-yaml`.
You probably upgraded versions of both components.

Release notes for YAML module have the fix listed:

#370: (yaml) Replace use of deprecated constructor of SnakeYAML ParserImpl
  (see https://github.com/FasterXML/jackson-dataformats-text/issues/370 )

Hope this helps,

-+ Tatu +-

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/CAL4a10iAa5cpv7EuedynaGwPyLMCoGDMAqbaginp3GO%2BYi6pCg%40mail.gmail.com.

Reply via email to