From 82f28cc18b9371c81f3e6fa147080371a00443f5 Mon Sep 17 00:00:00 2001 From: Tobias Kellner Date: Sat, 15 Mar 2014 00:25:37 +0100 Subject: Don't use raw types! Also check casts where possible --- .../main/java/at/gv/egiz/pdfas/web/filter/ExceptionCatchFilter.java | 1 + .../src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java | 5 +++++ .../src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java | 2 +- .../main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java | 2 +- .../src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) (limited to 'pdf-as-web/src/main/java') diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/filter/ExceptionCatchFilter.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/filter/ExceptionCatchFilter.java index 6beff606..085976f0 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/filter/ExceptionCatchFilter.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/filter/ExceptionCatchFilter.java @@ -70,6 +70,7 @@ public class ExceptionCatchFilter implements Filter { logger.debug("Processing Parameters into Attributes"); HttpServletRequest httpRequest = (HttpServletRequest)request; PdfAsHelper.logAccess(httpRequest); + @SuppressWarnings("unchecked") Enumeration parameterNames = httpRequest.getParameterNames(); while(parameterNames.hasMoreElements()) { String name = parameterNames.nextElement(); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java index 2d14a99a..47243a43 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java @@ -774,12 +774,17 @@ public class PdfAsHelper { session.setAttribute(VERIFICATION_RESULT, value); } + @SuppressWarnings("unchecked") public static List getVerificationResult( HttpServletRequest request) { HttpSession session = request.getSession(); Object obj = session.getAttribute(VERIFICATION_RESULT); if (obj != null) { try { + if (!(obj instanceof List)) { + logger.error("Invalid object type"); + return null; + } return (List) obj; } catch (Throwable e) { logger.error("Invalid object type"); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java index ecdc4a8c..cf25c2f2 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java @@ -83,7 +83,7 @@ public class DataURLServlet extends HttpServlet { //System.out.println(xmlResponse); - JAXBElement jaxbObject = (JAXBElement) SLMarschaller.unmarshalFromString(xmlResponse); + JAXBElement jaxbObject = (JAXBElement) SLMarschaller.unmarshalFromString(xmlResponse); if(jaxbObject.getValue() instanceof InfoboxReadResponseType) { InfoboxReadResponseType infoboxReadResponseType = (InfoboxReadResponseType)jaxbObject.getValue(); logger.info("Got InfoboxReadResponseType"); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java index 28ce628a..ac22f6c8 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java @@ -157,7 +157,7 @@ public class ExternSignServlet extends HttpServlet { uploadDir.mkdir(); } - List formItems = upload.parseRequest(request); + List formItems = upload.parseRequest(request); logger.debug(formItems.size() + " Items in form data"); if (formItems.size() < 1) { // No Uploaded data! diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java index f6b65245..42a5175a 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java @@ -143,7 +143,7 @@ public class VerifyServlet extends HttpServlet { uploadDir.mkdir(); } - List formItems = upload.parseRequest(request); + List formItems = upload.parseRequest(request); logger.debug(formItems.size() + " Items in form data"); if (formItems.size() < 1) { // No Uploaded data! -- cgit v1.2.3