svn commit: r1862296 - /ofbiz/ofbiz-plugins/trunk/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/misc/ThirdPartyEvents.java

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

svn commit: r1862296 - /ofbiz/ofbiz-plugins/trunk/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/misc/ThirdPartyEvents.java

mthl
Author: mthl
Date: Fri Jun 28 23:06:05 2019
New Revision: 1862296

URL: http://svn.apache.org/viewvc?rev=1862296&view=rev
Log:
Improved: Use ‘ServletRequest#getServletContext’ when possible
(OFBIZ-11129)

Avoid unecessary casts by using ‘ServletRequest#getServletContext’
instead of ‘ServletRequest#getAttribute’. This method is available
since Servlet specification 3.0.

Modified:
    ofbiz/ofbiz-plugins/trunk/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/misc/ThirdPartyEvents.java

Modified: ofbiz/ofbiz-plugins/trunk/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/misc/ThirdPartyEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/misc/ThirdPartyEvents.java?rev=1862296&r1=1862295&r2=1862296&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/misc/ThirdPartyEvents.java (original)
+++ ofbiz/ofbiz-plugins/trunk/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/misc/ThirdPartyEvents.java Fri Jun 28 23:06:05 2019
@@ -22,7 +22,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -110,7 +109,7 @@ public class ThirdPartyEvents {
         java.net.URL ecommercePropertiesUrl = null;
 
         try {
-            ecommercePropertiesUrl = ((ServletContext) request.getAttribute("servletContext")).getResource("/WEB-INF/ecommerce.properties");
+            ecommercePropertiesUrl = request.getServletContext().getResource("/WEB-INF/ecommerce.properties");
         } catch (java.net.MalformedURLException e) {
             Debug.logWarning(e, module);
         }
@@ -190,7 +189,7 @@ public class ThirdPartyEvents {
         java.net.URL ecommercePropertiesUrl = null;
 
         try {
-            ecommercePropertiesUrl = ((ServletContext) request.getAttribute("servletContext")).getResource("/WEB-INF/ecommerce.properties");
+            ecommercePropertiesUrl = request.getServletContext().getResource("/WEB-INF/ecommerce.properties");
         } catch (java.net.MalformedURLException e) {
             Debug.logWarning(e, module);
         }