Change to fix SQLInvalidAuthorizationSpecException
[policy/xacml-pdp.git] / applications / common / src / main / java / org / onap / policy / pdp / xacml / application / common / operationshistory / GetOperationOutcomePip.java
index 717e537..f2339b1 100644 (file)
@@ -29,10 +29,10 @@ import com.att.research.xacml.std.pip.StdPIPResponse;
 import com.google.common.base.Strings;
 
 import java.util.Arrays;
+import java.util.Base64;
 import java.util.Collection;
 import java.util.Properties;
 
-import javax.persistence.NoResultException;
 import javax.persistence.Persistence;
 
 import org.onap.policy.pdp.xacml.application.common.ToscaDictionary;
@@ -65,7 +65,16 @@ public class GetOperationOutcomePip extends StdOnapPip {
             //
             // In case there are any overloaded properties for the JPA
             //
-            Properties emProperties = new Properties(properties);
+            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
             //