Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support-3.7' into support-3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Apr 9, 2018
2 parents d53f15d + 4b8fc61 commit 9a56289
Showing 1 changed file with 15 additions and 10 deletions.
Expand Up @@ -145,16 +145,21 @@ private static <T extends ObjectType> void encryptValue(Protector protector, Pri
}

private static void encryptProtectedStringType(Protector protector, ProtectedStringType ps, String propName) throws EncryptionException {
if (ps.isHashed()) {
throw new EncryptionException("Attempt to encrypt hashed value for "+propName);
}
if (ps != null && ps.getClearValue() != null) {
try {
protector.encrypt(ps);
} catch (EncryptionException e) {
throw new EncryptionException("Failed to encrypt value for field " + propName + ": " + e.getMessage(), e);
}
}
if (ps == null) {
return;
}

if (ps.isHashed()) {
throw new EncryptionException("Attempt to encrypt hashed value for "+propName);
}

if (ps.getClearValue() != null) {
try {
protector.encrypt(ps);
} catch (EncryptionException e) {
throw new EncryptionException("Failed to encrypt value for field " + propName + ": " + e.getMessage(), e);
}
}
}

// Checks that everything is encrypted
Expand Down

0 comments on commit 9a56289

Please sign in to comment.