details:   https://code.openbravo.com/erp/devel/pi/rev/b434c7af3cfd
changeset: 24312:b434c7af3cfd
user:      Rafa Alonso <rafael.alonso <at> openbravo.com>
date:      Sun Aug 24 06:12:23 2014 +0200
summary:   Related to issue 27370: If the session is invalidated while setting 
session attributes,
- the session will end
- the console log will properly report that the session was invalidated
Method affected:
- setSessionValue
Methods not affected any longer:
- getSessionValue
- removeSessionValue

details:   https://code.openbravo.com/erp/devel/pi/rev/8355dc1cb215
changeset: 24313:8355dc1cb215
user:      Rafa Alonso <rafael.alonso <at> openbravo.com>
date:      Sun Aug 24 06:14:12 2014 +0200
summary:   Related to issue 27200: If the authentication is not required, 
return null
- the check has changed its location

diffstat:

 src-core/src/org/openbravo/base/VariablesBase.java          |   6 +-----
 src/org/openbravo/authentication/AuthenticationManager.java |  10 +++++-----
 2 files changed, 6 insertions(+), 10 deletions(-)

diffs (57 lines):

diff -r 887f90e3a811 -r 8355dc1cb215 
src-core/src/org/openbravo/base/VariablesBase.java
--- a/src-core/src/org/openbravo/base/VariablesBase.java        Sat Aug 23 
14:29:41 2014 +0000
+++ b/src-core/src/org/openbravo/base/VariablesBase.java        Sun Aug 24 
06:14:12 2014 +0200
@@ -1321,8 +1321,6 @@
       auxStr = (String) session.getAttribute(sessionAttribute.toUpperCase());
       if (auxStr == null || auxStr.trim().equals(""))
         auxStr = defaultValue;
-    } catch (final IllegalStateException ise) {
-      throw new IllegalStateException(ise);
     } catch (Exception e) {
       auxStr = defaultValue;
     }
@@ -1347,7 +1345,7 @@
         if (log4j.isDebugEnabled())
           log4j.debug("Set session attribute: " + attribute + ":..." + 
value.toString());
     } catch (final IllegalStateException ise) {
-      throw new IllegalStateException(ise);
+      throw (IllegalStateException) new IllegalStateException().initCause(ise);
     } catch (final Exception e) {
       log4j.error("setSessionValue error: " + attribute + ":..." + value);
     }
@@ -1364,8 +1362,6 @@
       if (log4j.isDebugEnabled())
         log4j.debug("Remove session attribute: " + attribute + ":..." + 
getSessionValue(attribute));
       session.removeAttribute(attribute.toUpperCase());
-    } catch (final IllegalStateException ise) {
-      throw new IllegalStateException(ise);
     } catch (Exception e) {
       log4j.error("removeSessionValue error: " + attribute);
     }
diff -r 887f90e3a811 -r 8355dc1cb215 
src/org/openbravo/authentication/AuthenticationManager.java
--- a/src/org/openbravo/authentication/AuthenticationManager.java       Sat Aug 
23 14:29:41 2014 +0000
+++ b/src/org/openbravo/authentication/AuthenticationManager.java       Sun Aug 
24 06:14:12 2014 +0200
@@ -139,11 +139,6 @@
       localAdress = HttpBaseUtils.getLocalAddress(request);
     }
 
-    // if we in 'forceLogin' state, there is no need to process any other code
-    if ("Y".equals(request.getSession().getAttribute("forceLogin"))) {
-      return null;
-    }
-
     final String userId = doAuthenticate(request, response);
 
     final VariablesSecureApp vars = new VariablesSecureApp(request, false);
@@ -151,6 +146,11 @@
       setDBSession(request, userId, SUCCESS_SESSION_STANDARD, true);
     }
 
+    // if we in 'forceLogin' state, there is no need to process any other code
+    if ("Y".equals(request.getSession().getAttribute("forceLogin"))) {
+      return null;
+    }
+
     // A restricted resource can define a custom login URL
     // It just need to set an the attribute loginURL in the request
     final String customLoginURL = (String) request.getAttribute("loginURL");

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to