From d7be3cce0a9f26836f54413c1b187b5346bc7e17 Mon Sep 17 00:00:00 2001 From: rpiazzi Date: Fri, 14 Oct 2011 11:24:15 +0000 Subject: Corrected error that happened when the session variable error_within_iframe was null git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@867 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../at/gv/egiz/pdfas/web/servlets/SignServlet.java | 49 ++++++++++------------ 1 file changed, 21 insertions(+), 28 deletions(-) (limited to 'pdf-as-web') diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java index 94c8cd0..03db607 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/SignServlet.java @@ -27,12 +27,14 @@ package at.gv.egiz.pdfas.web.servlets; import java.io.BufferedInputStream; +import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URL; +import java.util.Enumeration; import java.util.Iterator; import java.util.List; @@ -111,6 +113,7 @@ public class SignServlet extends HttpServlet public static final String SUBMITFORM_FILE_KEY = "signupload.jsp:fileKey"; public static final String SUBMITFORM_FILENAME_KEY = "signupload.jsp:filenameKey"; public static final String SUBMITFORM_PREVIEW = "signupload.jsp:previewKey"; + @@ -148,6 +151,7 @@ public class SignServlet extends HttpServlet ExternAppInformation exappinf = null; SignaturePositioning sigpos = null; + // for performance measurement long startTime = 0; if (statLog.isInfoEnabled()) { @@ -221,7 +225,8 @@ public class SignServlet extends HttpServlet { // tzefferer: modified // UploadedData ud = retrieveUploadedDataFromRequest(request); - UploadedData ud_form = retrieveUploadedDataFromRequest(request); + + UploadedData ud_form = retrieveUploadedDataFromRequest(request); ud = ud_form; // end modify @@ -230,14 +235,11 @@ public class SignServlet extends HttpServlet { log.error(e); - //Added by rpiazzi to know if error happened when request was within iframe - //In this case the visualization of the error has to be done differently + //Added by rpiazzi to check if this attribute is still null HttpSession session = request.getSession(); - if (((String)session.getAttribute(SUBMITFORM_SIGNATURE_DEVICE_KEY)).equals(Constants.SIGNATURE_DEVICE_BKU)) { - request.setAttribute(ERROR_WITHIN_IFRAME, "no"); - } - else { - request.setAttribute(ERROR_WITHIN_IFRAME, "yes"); + String error_within_iframe = (String)session.getAttribute(SUBMITFORM_SIGNATURE_DEVICE_KEY); + if (error_within_iframe==null) { + session.setAttribute(SignServlet.ERROR_WITHIN_IFRAME, "no"); } //end added @@ -252,14 +254,11 @@ public class SignServlet extends HttpServlet catch (FileUploadException e) { log.error(e); - //Added by rpiazzi to know if error happened when request was within iframe - //In this case the visualization of the error has to be done differently + //Added by rpiazzi to check if this attribute is still null HttpSession session = request.getSession(); - if (((String)session.getAttribute(SUBMITFORM_SIGNATURE_DEVICE_KEY)).equals(Constants.SIGNATURE_DEVICE_BKU)) { - request.setAttribute(ERROR_WITHIN_IFRAME, "no"); - } - else { - request.setAttribute(ERROR_WITHIN_IFRAME, "yes"); + String error_within_iframe = (String)session.getAttribute(SUBMITFORM_SIGNATURE_DEVICE_KEY); + if (error_within_iframe==null) { + session.setAttribute(SignServlet.ERROR_WITHIN_IFRAME, "no"); } //end added @@ -271,14 +270,11 @@ public class SignServlet extends HttpServlet catch (IOException e) { log.error(e); - //Added by rpiazzi to know if error happened when request was within iframe - //In this case the visualization of the error has to be done differently + //Added by rpiazzi to check if this attribute is still null HttpSession session = request.getSession(); - if (((String)session.getAttribute(SUBMITFORM_SIGNATURE_DEVICE_KEY)).equals(Constants.SIGNATURE_DEVICE_BKU)) { - request.setAttribute(ERROR_WITHIN_IFRAME, "no"); - } - else { - request.setAttribute(ERROR_WITHIN_IFRAME, "yes"); + String error_within_iframe = (String)session.getAttribute(SUBMITFORM_SIGNATURE_DEVICE_KEY); + if (error_within_iframe==null) { + session.setAttribute(SignServlet.ERROR_WITHIN_IFRAME, "no"); } //end added @@ -478,9 +474,6 @@ public class SignServlet extends HttpServlet session.setAttribute(SUBMITFORM_SIGNATURE_DEVICE_KEY, "bku"); sig_app = "bku"; - session.setAttribute(SignServlet.ERROR_WITHIN_IFRAME, "no"); - - mode = (String)session.getAttribute(SUBMITFORM_SIGNATURE_MODE_KEY); doc_file_name = (String)session.getAttribute(SUBMITFORM_FILENAME_KEY); pdfDataSource = (DataSource)session.getAttribute(SUBMITFORM_FILE_KEY); @@ -508,7 +501,7 @@ public class SignServlet extends HttpServlet log.debug(" filesize = " + item.getSize()); //$NON-NLS-1$ } } - + if (item.getFieldName().equals(FormFields.FIELD_SIGNATURE_TYPE)) { sig_type_fi = item; @@ -742,13 +735,13 @@ public class SignServlet extends HttpServlet //Added by rpiazzi to know if error happened when request was within iframe //In this case the visualization of the error has to be done differently - HttpSession session = request.getSession(); + /*HttpSession session = request.getSession(); if (((String)session.getAttribute(SUBMITFORM_SIGNATURE_DEVICE_KEY)).equals(Constants.SIGNATURE_DEVICE_BKU)) { request.setAttribute(ERROR_WITHIN_IFRAME, "no"); } else { request.setAttribute(ERROR_WITHIN_IFRAME, "yes"); - } + }*/ //end added -- cgit v1.2.3