From 47b89a4566e73fbdbd4fd66896bfc221309f6bbf Mon Sep 17 00:00:00 2001 From: Luc Boudreau Date: Thu, 24 Mar 2011 05:04:05 +0000 Subject: [PATCH] Fixes bug 3192302. Cookie manager was not tokenizing the session cookies properly. git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@428 c6a108a4-781c-0410-a6c6-c2d559e19af0 --- .../xmla/proxy/XmlaOlap4jCookieManager.java | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jCookieManager.java b/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jCookieManager.java index 4b5ae94..3600a9e 100644 --- a/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jCookieManager.java +++ b/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jCookieManager.java @@ -131,25 +131,30 @@ public void storeCookies(URLConnection conn) { while (st.hasMoreTokens()) { String token = st.nextToken(); - cookie.put( - token.substring( - 0, - token.indexOf(NAME_VALUE_SEPARATOR)).toLowerCase(), - token.substring( - token.indexOf(NAME_VALUE_SEPARATOR) + 1, - token.length())); - if (this.debug) { - System.out.println( - "Saving cookie : " - + token.substring( + // Check if the separator does exist + // The other attributes are not stored (Ex: HttpOnly) + int separatorIndex = token.indexOf(NAME_VALUE_SEPARATOR); + + if (separatorIndex > 0) { + String tokenName = + token.substring( 0, - token.indexOf( - NAME_VALUE_SEPARATOR)).toLowerCase() - + "=" - + token.substring( - token.indexOf(NAME_VALUE_SEPARATOR) + 1, - token.length())); + separatorIndex) + .toLowerCase(); + String tokenValue = + token.substring( + separatorIndex + 1, + token.length()); + + cookie.put(tokenName, tokenValue); + + if (this.debug) { + System.out.println( + "Saving cookie : " + + tokenName + + "=" + tokenValue); + } } } }