To help troubleshooting the SystemConfigService has been modified
to chain the original exception and to log stack trace into the
debug log.

https://fedorahosted.org/pki/ticket/2399

Pushed under one-liner/trivial rule.

--
Endi S. Dewata
>From 526d5d60cf2f8befee86bc538ce066815e37f92b Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <[email protected]>
Date: Wed, 20 Jul 2016 00:38:41 +0200
Subject: [PATCH] Fixed error handling in SystemConfigService.

To help troubleshooting the SystemConfigService has been modified
to chain the original exception and to log stack trace into the
debug log.

https://fedorahosted.org/pki/ticket/2399
---
 .../src/org/dogtagpki/server/rest/SystemConfigService.java   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java
index 6fc37b5eec90547c25c420d0172953b91134d352..95afa4c6a071c27cc1f52edeb742ddbf199e4d83 100644
--- a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java
+++ b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java
@@ -782,7 +782,7 @@ public class SystemConfigService extends PKIService implements SystemConfigResou
                 ConfigurationUtils.populateVLVIndexes();
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            CMS.debug(e);
             throw new PKIException("Error in populating database: " + e, e);
         }
     }
@@ -1029,14 +1029,14 @@ public class SystemConfigService extends PKIService implements SystemConfigResou
                 String tokenpwd = data.getTokenPassword();
                 ConfigurationUtils.loginToken(ctoken, tokenpwd);
             } catch (NotInitializedException e) {
-                throw new PKIException("Token is not initialized");
+                throw new PKIException("Token is not initialized", e);
             } catch (NoSuchTokenException e) {
-                throw new BadRequestException("Invalid Token provided. No such token.");
+                throw new BadRequestException("Invalid Token provided. No such token.", e);
             } catch (TokenException e) {
-                e.printStackTrace();
-                throw new PKIException("Token Exception" + e);
+                CMS.debug(e);
+                throw new PKIException("Token Exception: " + e, e);
             } catch (IncorrectPasswordException e) {
-                throw new BadRequestException("Incorrect Password provided for token.");
+                throw new BadRequestException("Incorrect Password provided for token.", e);
             }
         }
     }
-- 
2.4.11

_______________________________________________
Pki-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/pki-devel

Reply via email to