aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src
diff options
context:
space:
mode:
authorThomas <>2023-06-14 15:20:41 +0200
committerThomas <>2023-06-14 15:20:41 +0200
commit27e22c7a57839db3fbd73bd4dbe4bfbe92a29abb (patch)
tree23c6bcc9833eec018f93413ef98aea8d69a9a432 /pdf-as-web/src
parent0dcdd23594b79087302b474aa7ec9d0723309bbd (diff)
downloadpdf-as-4-27e22c7a57839db3fbd73bd4dbe4bfbe92a29abb.tar.gz
pdf-as-4-27e22c7a57839db3fbd73bd4dbe4bfbe92a29abb.tar.bz2
pdf-as-4-27e22c7a57839db3fbd73bd4dbe4bfbe92a29abb.zip
fix(web): catch possible nullPointerException in case of wrong or unknown session cookie
Diffstat (limited to 'pdf-as-web/src')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java
index bf45745d..4e613ed4 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java
@@ -37,6 +37,7 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import at.gv.egiz.pdfas.api.processing.PdfasSignResponse;
import at.gv.egiz.pdfas.api.processing.SignedDocument;
import at.gv.egiz.pdfas.api.ws.PDFASVerificationResponse;
import at.gv.egiz.pdfas.web.config.WebConfiguration;
@@ -85,7 +86,15 @@ public class PDFData extends HttpServlet {
protected void process(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
- if (PdfAsHelper.getPdfSigningResponse(request).getSignedPdfs().isEmpty()) {
+ PdfasSignResponse resultObject = PdfAsHelper.getPdfSigningResponse(request);
+
+ if (resultObject == null) {
+ log.warn("No data for session with Id: {}", request.getSession().getId());
+ PdfAsHelper.setSessionException(request, response,
+ "No signed pdf document available.", null);
+ PdfAsHelper.gotoError(getServletContext(), request, response);
+
+ } else if (resultObject.getSignedPdfs().isEmpty()) {
log.info("No signed pdf document available.");
PdfAsHelper.setSessionException(request, response,
"No signed pdf document available.", null);