Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Jackson Blackbird #4905

Merged
merged 2 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,14 @@ Copyright (c) 2012 Jeremy Long. All Rights Reserved.
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-afterburner</artifactId>
<version>${jackson.version}</version>
<artifactId>jackson-module-blackbird</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.h3xstream.retirejs</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.module.blackbird.BlackbirdModule;

import java.io.EOFException;
import java.io.File;
Expand Down Expand Up @@ -80,13 +81,16 @@ public NvdCveParser(Settings settings, CveDB db) {
*
* @param file the NVD JSON file to parse
* @throws UpdateException thrown if the file could not be read
* @throws CorruptedDatastreamException thrown if the file was found to be a corrupted download (ZipException or premature EOF)
* @throws CorruptedDatastreamException thrown if the file was found to be a
* corrupted download (ZipException or premature EOF)
*/
public void parse(File file) throws UpdateException, CorruptedDatastreamException {
LOGGER.debug("Parsing " + file.getName());

final ObjectMapper objectMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
objectMapper.registerModule(new AfterburnerModule());
final ObjectMapper objectMapper = JsonMapper.builder()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.addModule(new BlackbirdModule())
.build();

final ObjectReader objectReader = objectMapper.readerFor(DefCveItem.class);

Expand Down