fix regression from redundant String mapping in SecretResponse getter
All checks were successful
continuous-integration/drone/push Build is passing

Mapping a JSON string into String using a JSON parser will fail, so we
should use the string directly instead of applying double conversion.

Fixes: f3e1f01e38
This commit is contained in:
2023-06-16 18:18:11 +02:00
parent f3e1f01e38
commit 1195b447a2
2 changed files with 12 additions and 2 deletions

View File

@ -83,7 +83,11 @@ public abstract class SecretResponse extends VaultDataResponse {
return type.cast(rawValue);
} else {
var om = new ObjectMapper();
return om.readValue(om.writeValueAsString(rawValue), type);
if (rawValue instanceof String) {
return om.readValue((String) rawValue, type);
} else {
return om.readValue(om.writeValueAsString(rawValue), type);
}
}
} catch (IOException e) {
throw new InvalidResponseException("Unable to parse response payload: " + e.getMessage());