Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0022650Openbravo ERPA. Platformpublic2012-12-21 08:162013-02-20 04:49
malsasua 
AugustoMauch 
normalminorsometimes
closedfixed 
20Community Appliance
 
3.0MP213.0MP21 
shankarb
Google Chrome
Core
Production - Confirmed Stable
2012-10-29
https://code.openbravo.com/erp/devel/pi/rev/8d14f5d88c458fd555bdfc4202205bc58b2bd8e0 [^]
No
0022650: error in the log file is displayed when login is done without "User-Agent"
when a login is done from request without "User-Agent", an error is displayed in the log file
The error is:

ef0fb8d 11:26:48 [ajp-8009-39] ERROR org.openbravo.dal.core.ThreadHandler -
java.lang.NullPointerException
        at org.openbravo.erpCommon.utility.Utility.isMobileBrowser(Utility.java:2500)
        at org.openbravo.erpCommon.security.Login.doPost(Login.java:55)
        at org.openbravo.base.HttpBaseServlet.doGet(HttpBaseServlet.java:287)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at org.openbravo.base.HttpBaseServlet.service(HttpBaseServlet.java:245)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.openbravo.utils.SessionExpirationFilter.doFilter(SessionExpirationFilter.java:66)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.openbravo.utils.CharsetFilter.doFilter(CharsetFilter.java:35)
....
In Utility.java, replace the method
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));
  }

by
public static boolean isMobileBrowser(HttpServletRequest request) {
    final String ua = request.getHeader("User-Agent");
    if (ua == null) then return null;
    return (ua.toLowerCase().matches(MOBILE_VENDORS) || ua.toLowerCase().substring(0, 4).matches(MOBILE_VERSION));
  }
No tags attached.
diff issue22650.diff (646) 2013-02-05 16:57
https://issues.openbravo.com/file_download.php?file_id=5936&type=bug
Issue History
2012-12-21 08:16malsasuaNew Issue
2012-12-21 08:16malsasuaAssigned To => AugustoMauch
2012-12-21 08:16malsasuaWeb browser => Google Chrome
2012-12-21 08:16malsasuaModules => Core
2012-12-21 08:16malsasuaTriggers an Emergency Pack => No
2013-01-22 15:47AugustoMauchWeb browserGoogle Chrome => Google Chrome
2013-01-22 15:47AugustoMauchFixed in Version => 3.0MP20
2013-01-22 15:52AugustoMauchWeb browserGoogle Chrome => Google Chrome
2013-01-22 15:52AugustoMauchRegression level => Production - Confirmed Stable
2013-01-22 15:52AugustoMauchRegression date => 2012-10-29
2013-01-22 15:52AugustoMauchRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/8d14f5d88c458fd555bdfc4202205bc58b2bd8e0 [^]
2013-02-05 16:57AugustoMauchWeb browserGoogle Chrome => Google Chrome
2013-02-05 16:57AugustoMauchFixed in Version3.0MP20 =>
2013-02-05 16:57AugustoMauchTarget Version => 3.0MP21
2013-02-05 16:57AugustoMauchFile Added: issue22650.diff
2013-02-05 16:58AugustoMauchNote Added: 0056175
2013-02-05 16:59AugustoMauchStatusnew => scheduled
2013-02-05 16:59AugustoMauchfix_in_branch => pi
2013-02-11 17:35AugustoMauchIssue Monitored: shankarb
2013-02-11 17:35AugustoMauchReview Assigned To => shankarb
2013-02-11 17:35AugustoMauchWeb browserGoogle Chrome => Google Chrome
2013-02-11 17:35AugustoMauchfix_in_branchpi =>
2013-02-11 17:37hgbotCheckin
2013-02-11 17:37hgbotNote Added: 0056344
2013-02-11 17:37hgbotStatusscheduled => resolved
2013-02-11 17:37hgbotResolutionopen => fixed
2013-02-11 17:37hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/1f39c81dc9b9090197eac10ae23a413fc07504b5 [^]
2013-02-12 12:20shankarbNote Added: 0056370
2013-02-12 12:20shankarbStatusresolved => closed
2013-02-12 12:20shankarbFixed in Version => 3.0MP21
2013-02-20 04:49hudsonbotCheckin
2013-02-20 04:49hudsonbotNote Added: 0056567

Notes
(0056175)
AugustoMauch   
2013-02-05 16:58   
A patch for this issue has been attached. It will be pushed to pi once it is unfrozen for MP21 issues.
(0056344)
hgbot   
2013-02-11 17:37   
Repository: erp/devel/pi
Changeset: 1f39c81dc9b9090197eac10ae23a413fc07504b5
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Mon Feb 11 17:35:08 2013 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/1f39c81dc9b9090197eac10ae23a413fc07504b5 [^]

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.

---
M src/org/openbravo/erpCommon/utility/Utility.java
---
(0056370)
shankarb   
2013-02-12 12:20   
Code reviewed and verified in pi changeset 5265a23b7dbe
(0056567)
hudsonbot   
2013-02-20 04:49   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/d828167a9e83 [^]

Maturity status: Test