Fix loging in Utils 19/29019/2
authorburdziak <olaf.burdziakowski@nokia.com>
Wed, 24 Jan 2018 09:37:15 +0000 (10:37 +0100)
committerMarcus Williams <marcus.williams@intel.com>
Thu, 25 Jan 2018 16:48:05 +0000 (16:48 +0000)
Change-Id: Ibe5250e426bfc3387cbe886be4048f18dbe45c13
Issue-ID: APPC-491
Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
appc-adapters/appc-chef-adapter/appc-chef-adapter-bundle/src/main/java/org/onap/appc/adapter/chef/chefclient/Utils.java

index 33b20dc..3f7f203 100644 (file)
@@ -41,8 +41,11 @@ import org.bouncycastle.openssl.PEMParser;
 import org.bouncycastle.util.encoders.Base64;
 import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
 import org.bouncycastle.openssl.PEMKeyPair;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class Utils {
+    private final static Logger logger = LoggerFactory.getLogger(Utils.class);
     private Utils(){}
     
     public static String sha1AndBase64(String inStr) {
@@ -53,7 +56,7 @@ public class Utils {
             byte[] digest = md.digest(inStr.getBytes());
             outbty = Base64.encode(digest);
         } catch (NoSuchAlgorithmException nsae) {
-            nsae.printStackTrace();
+            logger.error(nsae.getMessage());
         }
         return new String(outbty);
     }
@@ -74,13 +77,13 @@ public class Utils {
             outStr = Base64.encode(signature);
             String tmp = new String(outStr);
         } catch (InvalidKeyException e) {
-            e.printStackTrace();
+            logger.error(e.getMessage());
         } catch (IOException e) {
-            e.printStackTrace();
+            logger.error(e.getMessage());
         } catch (SignatureException e) {
-            e.printStackTrace();
+            logger.error(e.getMessage());
         } catch (NoSuchAlgorithmException e) {
-            e.printStackTrace();
+            logger.error(e.getMessage());
         }
         return new String(outStr);
     }