xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r382149 - /xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java
Date Wed, 01 Mar 2006 20:43:24 GMT
Author: radup
Date: Wed Mar  1 12:43:24 2006
New Revision: 382149

URL: http://svn.apache.org/viewcvs?rev=382149&view=rev
Log:
Fix for XMLBEANS-46.

Modified:
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java?rev=382149&r1=382148&r2=382149&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java Wed Mar  1
12:43:24 2006
@@ -503,24 +503,31 @@
     private static final int MAPSIZE = 256;
     private void createMap() {
         int asize = MAPSIZE/32;                 // 32 is the number of bits in `int'.
-        this.map = new int[asize];
-        this.nonMapIndex = this.ranges.length;
-        for (int i = 0;  i < asize;  i ++)  this.map[i] = 0;
+        // CHANGE(radup) we need a new map, since this is not synchronized
+        // and if we init the instance map with 0's it's going to be trouble
+        // -this.map = new int[asize];
+        // -this.nonMapIndex = this.ranges.length;
+        // -for (int i = 0; i < asize; i++) this.map[i] = 0;
+        int[] localmap = new int[asize]; // +
+        int localnonMapIndex = this.ranges.length; // +
+        for (int i = 0;  i < asize;  i ++)  localmap[i] = 0; // + redundant
         for (int i = 0;  i < this.ranges.length;  i += 2) {
             int s = this.ranges[i];
             int e = this.ranges[i+1];
             if (s < MAPSIZE) {
                 for (int j = s;  j <= e && j < MAPSIZE;  j ++)
-                    this.map[j/32] |= 1<<(j&0x1f); // s&0x1f : 0-31
+                    localmap[j/32] |= 1<<(j&0x1f); // s&0x1f : 0-31
             } else {
-                this.nonMapIndex = i;
+                localnonMapIndex = i;
                 break;
             }
             if (e >= MAPSIZE) {
-                this.nonMapIndex = i;
+                localnonMapIndex = i;
                 break;
             }
         }
+        this.nonMapIndex = localnonMapIndex; // +
+        this.map = localmap; // +
         //for (int i = 0;  i < asize;  i ++)  System.err.println("Map: "+Integer.toString(this.map[i],
16));
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org


Mime
View raw message