Skip to content

Commit

Permalink
Merge pull request #9 from lukashinsch/error-details
Browse files Browse the repository at this point in the history
Provide information on what property cannot be decrypted / version++
  • Loading branch information
lukashinsch committed Jun 25, 2015
2 parents b8f2130 + 3b2d9c7 commit a11e31c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.1.9
- Provide information on what property cannot be decrypted (fixes [#8](https://github.com/lukashinsch/spring-properties-decrypter/issues/8))

## 0.1.8
- Bugfix: application listener was not working for most types of property sources (fixes [#4](https://github.com/lukashinsch/spring-properties-decrypter/issues/4))

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'

group = 'eu.hinsch'
version = '0.1.8'
version = '0.1.9'

jar {
baseName = 'spring-properties-decrypter'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.hinsch.spring.propertiesdecrypter;

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.exceptions.EncryptionOperationNotPossibleException;
import org.jasypt.salt.ZeroSaltGenerator;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.context.ApplicationListener;
Expand Down Expand Up @@ -80,7 +81,12 @@ private void addDecryptedValues(Environment environment, MutablePropertySources

private String decryptPropertyValue(String encryptedPropertyValue) {
String cypher = getCypher(encryptedPropertyValue);
return encrypter.decrypt(cypher);
try {
return encrypter.decrypt(cypher);
}
catch (EncryptionOperationNotPossibleException e) {
throw new RuntimeException("Unable to decrypt property value '" + encryptedPropertyValue + "'", e);
}
}

private boolean isEncrypted(Object propertyValue) {
Expand Down

0 comments on commit a11e31c

Please sign in to comment.