diff options
author | Alexander Marsalek <amarsalek@iaik.tugraz.at> | 2021-04-16 14:51:31 +0200 |
---|---|---|
committer | Alexander Marsalek <amarsalek@iaik.tugraz.at> | 2021-04-16 14:51:31 +0200 |
commit | 0ee66ba66a9ea84cd6f31589ce0b0192f24a6258 (patch) | |
tree | ca38ab924bf39bf1b84f5415f60ab1be95cfaa63 /pdf-as-web/src/main/java/at/gv/egiz | |
parent | b05ea2be957b199968e0a854df149c2cb8fc9ee1 (diff) | |
download | pdf-as-4-0ee66ba66a9ea84cd6f31589ce0b0192f24a6258.tar.gz pdf-as-4-0ee66ba66a9ea84cd6f31589ce0b0192f24a6258.tar.bz2 pdf-as-4-0ee66ba66a9ea84cd6f31589ce0b0192f24a6258.zip |
errorhandling
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz')
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java index 6a56c9dc..78bb3c69 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java @@ -136,16 +136,21 @@ public class JSONAPIServlet extends HttpServlet { parameters.setProfile(profile); Map<String, String> signatureBlockParametersMap = new HashMap<>(); - JSONArray jsonArray = jsonObject.getJSONArray(JSON_SBP); - for(int i=0; i<jsonArray.length();i++){ - String s = jsonArray.getString(0); - if(!s.contains("=")) {//TODO or pass as map? - throw new Exception("Invalid parameter: "+s); + try { + JSONArray jsonArray = jsonObject.getJSONArray(JSON_SBP); + if (jsonArray != null) { + for (int i = 0; i < jsonArray.length(); i++) { + String s = jsonArray.getString(0); + if (!s.contains("=")) {//TODO or pass as map? + throw new Exception("Invalid parameter: " + s); + } + String[] values = s.split("=", 2); + signatureBlockParametersMap.put(values[0], values[1]); + } } - String[] values = s.split("=", 2); - signatureBlockParametersMap.put(values[0], values[1]); + }catch(Exception e){ + e.printStackTrace(); } - if (PDFASSignParameters.Connector.MOA.equals(connectorEnum) || PDFASSignParameters.Connector.JKS.equals(connectorEnum)) { // Plain server based signatures!! |