Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.parquet.crypto.ParquetCryptoRuntimeException;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -75,7 +76,7 @@ public String getKeyMaterial(String keyIDInFile) throws ParquetCryptoRuntimeExc
private void loadKeyMaterialMap() {
try (FSDataInputStream keyMaterialStream = hadoopFileSystem.open(keyMaterialFile)) {
JsonNode keyMaterialJson = objectMapper.readTree(keyMaterialStream);
keyMaterialMap = objectMapper.readValue(keyMaterialJson,
keyMaterialMap = objectMapper.readValue(keyMaterialJson.traverse(),
new TypeReference<Map<String, String>>() { });
} catch (FileNotFoundException e) {
throw new ParquetCryptoRuntimeException("External key material not found at " + keyMaterialFile, e);
Expand All @@ -87,7 +88,7 @@ private void loadKeyMaterialMap() {
@Override
public void saveMaterial() throws ParquetCryptoRuntimeException {
try (FSDataOutputStream keyMaterialStream = hadoopFileSystem.create(keyMaterialFile)) {
objectMapper.writeValue(keyMaterialStream, keyMaterialMap);
objectMapper.writeValue((OutputStream) keyMaterialStream, keyMaterialMap);
} catch (IOException e) {
throw new ParquetCryptoRuntimeException("Failed to save key material in " + keyMaterialFile, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import java.util.Map;

import org.apache.parquet.crypto.ParquetCryptoRuntimeException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.type.TypeReference;

/**
* KeyMaterial class represents the "key material", keeping the information that allows readers to recover an encryption key (see
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import java.util.Map;

import org.apache.parquet.crypto.ParquetCryptoRuntimeException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.type.TypeReference;

/**
* Parquet encryption specification defines "key metadata" as an arbitrary byte array, generated by file writers for each encryption key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.parquet.crypto.KeyAccessDeniedException;
import org.apache.parquet.crypto.ParquetCryptoRuntimeException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.type.TypeReference;

import java.io.IOException;
import java.io.StringReader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.apache.parquet.crypto.ParquetCryptoRuntimeException;
import org.apache.parquet.crypto.keytools.KeyToolkit;
import org.apache.parquet.crypto.keytools.KmsClient;
import org.codehaus.jackson.map.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -171,7 +171,7 @@ private String executeAndGetResponse(String endPoint, Request request) {
private static String parseReturn(String response, String searchKey) {
String matchingValue;
try {
matchingValue = objectMapper.readTree(response).findValue(searchKey).getTextValue();
matchingValue = objectMapper.readTree(response).findValue(searchKey).textValue();
} catch (IOException e) {
throw new ParquetCryptoRuntimeException("Failed to parse vault response. " + searchKey + " not found." + response, e);
}
Expand Down