You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ra...@apache.org on 2006/03/01 21:43:59 UTC

svn commit: r382150 - /xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java

Author: radup
Date: Wed Mar  1 12:43:58 2006
New Revision: 382150

URL: http://svn.apache.org/viewcvs?rev=382150&view=rev
Log:
Fix for XMLBEANS-46 in the V1 branch.

Modified:
    xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java

Modified: xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java
URL: http://svn.apache.org/viewcvs/xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java?rev=382150&r1=382149&r2=382150&view=diff
==============================================================================
--- xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java (original)
+++ xmlbeans/branches/1.x/src/typeimpl/org/apache/xmlbeans/impl/regex/RangeToken.java Wed Mar  1 12:43:58 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