@@ -71,10 +71,10 @@ private byte[] getOrCreateAesKey(String aesKeyPath) {
7171 throw new ExceptionInInitializerError ("Failed to get aesKeyPath" );
7272 }
7373
74- boolean shouldGenerateKey = !new File (aesKeyPath ).exists ();
74+ final boolean shouldGenerateKey = !new File (aesKeyPath ).exists ();
7575
7676 if (shouldGenerateKey ) {
77- byte [] newAesKey = CipherHelper .generateAesKey ();
77+ final byte [] newAesKey = CipherHelper .generateAesKey ();
7878
7979 if (newAesKey == null ) {
8080 throw new ExceptionInInitializerError ("Failed to generate AES key" );
@@ -84,7 +84,7 @@ private byte[] getOrCreateAesKey(String aesKeyPath) {
8484 }
8585 }
8686
87- byte [] aesKey = FileHelper .readFileBytes (aesKeyPath );
87+ final byte [] aesKey = FileHelper .readFileBytes (aesKeyPath );
8888
8989 if (aesKey == null ) {
9090 throw new ExceptionInInitializerError ("Failed to load AES key" );
@@ -98,7 +98,7 @@ private byte[] getOrCreateAesKey(String aesKeyPath) {
9898
9999 public String encrypt (String data ) {
100100 if (StringUtils .isNotBlank (data )) {
101- byte [] encryptedData = CipherHelper .aesEncrypt (data .getBytes (), aesKey );
101+ final byte [] encryptedData = CipherHelper .aesEncrypt (data .getBytes (), aesKey );
102102 if (encryptedData != null ) {
103103 return new String (encryptedData );
104104 }
@@ -108,7 +108,7 @@ public String encrypt(String data) {
108108
109109 public String decrypt (String encryptedData ) {
110110 if (StringUtils .isNotBlank (encryptedData )) {
111- byte [] decryptedData = CipherHelper .aesDecrypt (encryptedData .getBytes (), aesKey );
111+ final byte [] decryptedData = CipherHelper .aesDecrypt (encryptedData .getBytes (), aesKey );
112112 if (decryptedData != null ) {
113113 return new String (decryptedData );
114114 }
0 commit comments