Merge "Change to fix SQLInvalidAuthorizationSpecException"
[policy/xacml-pdp.git] / applications / common / src / main / java / org / onap / policy / pdp / xacml / application / common / operationshistory / CountRecentOperationsPip.java
index 00f7680..7304dfc 100644 (file)
@@ -33,6 +33,7 @@ import java.sql.Timestamp;
 import java.time.Instant;
 import java.time.temporal.ChronoUnit;
 import java.util.Arrays;
+import java.util.Base64;
 import java.util.Collection;
 import java.util.Properties;
 
@@ -70,6 +71,14 @@ public class CountRecentOperationsPip extends StdOnapPip {
             //
             Properties emProperties = new Properties();
             emProperties.putAll(properties);
+
+            //
+            // Need to decode the password before creating the EntityManager
+            //
+            String decodedPassword = new String(Base64.getDecoder()
+                    .decode(emProperties.getProperty("javax.persistence.jdbc.password")));
+            emProperties.setProperty("javax.persistence.jdbc.password", decodedPassword);
+
             //
             // Create the entity manager factory
             //