Author: adityasharma
Date: Wed Dec 26 04:56:33 2018
New Revision: 1849738
URL:
http://svn.apache.org/viewvc?rev=1849738&view=revLog:
Improved: Refactor boolean returns for UtilHttp methods
(OFBIZ-10726)
Improves code in isJavaScriptEnabled()
Instead of using if-else block, a ternary operator is used for improving readability.
Modified:
ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java?rev=1849738&r1=1849737&r2=1849738&view=diff==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java Wed Dec 26 04:56:33 2018
@@ -1551,10 +1551,7 @@ public final class UtilHttp {
public static boolean isJavaScriptEnabled(HttpServletRequest request) {
HttpSession session = request.getSession();
Boolean javaScriptEnabled = (Boolean) session.getAttribute("javaScriptEnabled");
- if (javaScriptEnabled != null) {
- return javaScriptEnabled;
- }
- return false;
+ return javaScriptEnabled != null ? javaScriptEnabled : false;
}
/** Returns the number or rows submitted by a multi form.