You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Arvind Srinivasan <ar...@sun.com> on 2002/06/15 11:39:24 UTC

ArrayIndexOutOfBoundsException in WebappClassLoader

I'm unable to reproduce this easily but I was running some tests (using
a multithreaded load generator) on a 4 cpu machine and encountered a
couple of ArrayIndexOutOfBoundsException @ lines 1747 and 1754 in
o.a.c.loaders.WebappClassLoader.java.


737            // Register the full path for modification checking
1738           synchronized (paths) {
1739            
1740                int j;
1741  
1742                long[] result2 = 
1743                    new long[lastModifiedDates.length + 1];
1744                for (j = 0; j < lastModifiedDates.length; j++) {
1745                    result2[j] = lastModifiedDates[j];
1746                }
1747                result2[lastModifiedDates.length] =
entry.lastModified;
1748                lastModifiedDates = result2;
1749   
1750                String[] result = new String[paths.length + 1];
1751                for (j = 0; j < paths.length; j++) {
1752                    result[j] = paths[j];
1753                }
1754                result[paths.length] = fullPath;
1755                paths = result;
1756   
1757            }

Shouldn't line 1738 synchronize on 'this' rather than 'paths' because
'paths' is changed to point to a new array within the synchronized block
itself @ line 1755 ?

Thanks,
 Arvind

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>