Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'release/2.0.6'

  • Loading branch information...
commit 7404fb95e11986b80e5d60d7d1ae2309034e4f55 2 parents dfe4e03 + 6f78b3f
Ben Lucchesi authored February 09, 2013
2  CookieSessionGrailsPlugin.groovy
@@ -25,7 +25,7 @@ import com.granicus.grails.plugins.cookiesession.ExceptionCondenser
25 25
 import org.codehaus.groovy.grails.orm.hibernate.ConfigurableLocalSessionFactoryBean
26 26
 
27 27
 class CookieSessionGrailsPlugin {
28  
-    def version = "2.0.5"
  28
+    def version = "2.0.6"
29 29
     def grailsVersion = "1.2.4 > *"
30 30
     def title = "Cookie Session Plugin" // Headline display name of the plugin
31 31
     def author = "Ben Lucchesi"
3  README.md
Source Rendered
... ...
@@ -1,7 +1,7 @@
1 1
 
2 2
 # Cookie Session Grails Plugin
3 3
 
4  
-Current Version: 2.0.5
  4
+Current Version: 2.0.6
5 5
 
6 6
 The Cookie Session plugin enables grails applications to store session data in http cookies between requests instead of in memory on the server. Client sessions are transmitted from the browser to the application with each request and transmitted back with each response. This allows application deployments to be more stateless. Benefits of managing sessions this way include:
7 7
 
@@ -39,7 +39,6 @@ edit grails/conf/Build.config and add the following line under the plugins closu
39 39
 
40 40
   runtime ":cookie-session:2.0.5"
41 41
 
42  
-
43 42
 # Configuration
44 43
 The following parameters are supported directly by the cookie-session-v2 plugin. Note, additional configuration is needed for webflow and large session support. See additional instructions below.
45 44
 
14  src/groovy/com/granicus/grails/plugins/cookiesession/CookieSessionRepository.groovy
@@ -373,21 +373,21 @@ class CookieSessionRepository implements SessionRepository, InitializingBean  {
373 373
   private String[] splitString(String input){
374 374
     log.trace "splitString()"
375 375
 
376  
-    def list = new String[cookieCount];
  376
+    String[] list = new String[cookieCount];
377 377
 
378 378
     if( !input ){
379 379
       log.trace "input empty or null."
380 380
       return list
381 381
     }
382 382
 
383  
-    def partitions = input.size() / maxCookieSize 
  383
+    int inputLength = input.size()
  384
+
  385
+    def partitions = Math.ceil(inputLength / maxCookieSize)
384 386
     log.trace "splitting input of size ${input.size()} string into ${partitions} paritions"
385 387
 
386  
-    (0..partitions).each{ i ->
387  
-      def start = i * maxCookieSize;
388  
-      def end = start + maxCookieSize - 1
389  
-      if( end >= input.size() )
390  
-        end = start + input.size() % maxCookieSize - 1
  388
+    for (int i = 0; i < partitions; i++){ 
  389
+      int start = i * maxCookieSize
  390
+      int end = Math.min(start + maxCookieSize - 1, inputLength - 1)
391 391
       list[i] = input[start..end]
392 392
     }
393 393
 

0 notes on commit 7404fb9

Please sign in to comment.
Something went wrong with that request. Please try again.