[hg] main-silver: #225688:ArrayIndexOutOfBoundsException at java...

  • From: Tomas Zezula < >
  • To:
  • Subject: [hg] main-silver: #225688:ArrayIndexOutOfBoundsException at java...
  • Date: Mon, 04 Feb 2013 13:37:23 -0800

changeset 8d78e624545d in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/8d78e624545d
description:
        #225688:ArrayIndexOutOfBoundsException at java.lang.String.getChars

diffstat:

 
parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java
 |  11 +++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (28 lines):

diff --git 
a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java
 
b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java
--- 
a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java
+++ 
b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/ClusteredIndexables.java
@@ -734,7 +734,7 @@
                 docs[docsPointer + 1] = dataPointer;
                 docsPointer += 2;
                 if (data.length < dataPointer + fldValue.length()) {
-                    char[] newdata = new char[data.length << 1];
+                    char[] newdata = new 
char[newLength(data.length,dataPointer + fldValue.length())];
                     System.arraycopy(data, 0, newdata, 0, data.length);
                     data = newdata;
                     res = data.length<<1 > DATA_CACHE_SIZE;
@@ -822,6 +822,15 @@
             throw new UnsupportedOperationException();
         }
 
+        private static int newLength(
+                int currentLength,
+                final int minimalLength) {
+            do {
+                currentLength <<= 1;
+            } while (currentLength < minimalLength);
+            return currentLength;
+        }
+
         private class It implements Iterator<IndexDocument> {
 
             private int cur = 0;

[hg] main-silver: #225688:ArrayIndexOutOfBoundsException at java...

Tomas Zezula 02/04/2013

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close