details:   https://code.openbravo.com/erp/devel/pi/rev/1f39c81dc9b9
changeset: 19639:1f39c81dc9b9
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Mon Feb 11 17:35:08 2013 +0100
summary:   Fixes issue 22650: NPE not thrown if login is done without 
'User-Agent'

The isMobileBrowser of the Utility class was not taking into account that the 
'User-Agent' property of the requeste could be null.

diffstat:

 src/org/openbravo/erpCommon/utility/Utility.java |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (16 lines):

diff -r 07891c3b09b7 -r 1f39c81dc9b9 
src/org/openbravo/erpCommon/utility/Utility.java
--- a/src/org/openbravo/erpCommon/utility/Utility.java  Mon Feb 11 17:10:03 
2013 +0100
+++ b/src/org/openbravo/erpCommon/utility/Utility.java  Mon Feb 11 17:35:08 
2013 +0100
@@ -2502,7 +2502,11 @@
 
   public static boolean isMobileBrowser(HttpServletRequest request) {
     final String ua = request.getHeader("User-Agent").toLowerCase();
-    return (ua.matches(MOBILE_VENDORS) || ua.substring(0, 
4).matches(MOBILE_VERSION));
+    if (ua == null) {
+      return false;
+    } else {
+      return (ua.matches(MOBILE_VENDORS) || ua.substring(0, 
4).matches(MOBILE_VERSION));
+    }
   }
 
   /**

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to