svn commit: r1818551 - /ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeEvents.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1818551 - /ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeEvents.java

mbrohl
Author: mbrohl
Date: Mon Dec 18 10:52:13 2017
New Revision: 1818551

URL: http://svn.apache.org/viewvc?rev=1818551&view=rev
Log:
Improved: General refactoring and code improvements, package
org.apache.ofbiz.common.qrcode.
(OFBIZ-9883)

Thanks Julian Leichert for reporting and providing the patches.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeEvents.java

Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeEvents.java?rev=1818551&r1=1818550&r2=1818551&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/qrcode/QRCodeEvents.java Mon Dec 18 10:52:13 2017
@@ -45,7 +45,7 @@ import org.apache.ofbiz.service.ServiceU
 public class QRCodeEvents {
 
     public static final String module = QRCodeEvents.class.getName();
-    
+
     /** Streams QR Code to the output. */
     public static String serveQRCodeImage(HttpServletRequest request, HttpServletResponse response) {
         HttpSession session = request.getSession();
@@ -53,10 +53,14 @@ public class QRCodeEvents {
         Map<String, Object> parameters = UtilHttp.getParameterMap(request);
         String message = (String) parameters.get("message");
         GenericValue userLogin = (GenericValue) request.getAttribute("userLogin");
-        if (userLogin == null) userLogin = (GenericValue) session.getAttribute("userLogin");
-        if (userLogin == null) userLogin = (GenericValue) session.getAttribute("autoUserLogin");
+        if (userLogin == null) {
+            userLogin = (GenericValue) session.getAttribute("userLogin");
+        }
+        if (userLogin == null) {
+            userLogin = (GenericValue) session.getAttribute("autoUserLogin");
+        }
         Locale locale = UtilHttp.getLocale(request);
-        
+
         if (UtilValidate.isEmpty(message)) {
             message = "Error get message parameter.";
         }
@@ -138,11 +142,7 @@ public class QRCodeEvents {
                 request.setAttribute("_ERROR_MESSAGE_", errMsg);
                 return "error";
             }
-        } catch (IOException e) {
-            String errMsg = UtilProperties.getMessage("QRCodeUiLabels", "ErrorGenerateQRCode", new Object[] { e.getMessage() }, locale);
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        } catch (GenericServiceException e) {
+        } catch (IOException | GenericServiceException e) {
             String errMsg = UtilProperties.getMessage("QRCodeUiLabels", "ErrorGenerateQRCode", new Object[] { e.getMessage() }, locale);
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";