Author: toad
Date: 2008-02-28 19:59:44 +0000 (Thu, 28 Feb 2008)
New Revision: 18229

Modified:
   trunk/plugins/XMLSpider/XMLSpider.java
Log:
25: Fix synchronization: ConcurrentModificationException causing failure to 
write indexes

Modified: trunk/plugins/XMLSpider/XMLSpider.java
===================================================================
--- trunk/plugins/XMLSpider/XMLSpider.java      2008-02-28 19:56:18 UTC (rev 
18228)
+++ trunk/plugins/XMLSpider/XMLSpider.java      2008-02-28 19:59:44 UTC (rev 
18229)
@@ -141,7 +141,7 @@
        public Set allowedMIMETypes;
        private static final int MAX_ENTRIES = 2000;
        private static final long MAX_SUBINDEX_UNCOMPRESSED_SIZE = 256*1024;
-       private static int version = 24;
+       private static int version = 25;
        private static final String pluginName = "XML spider "+version;
        /**
         * Gives the allowed fraction of total time spent on generating indices 
with
@@ -1161,7 +1161,8 @@

                }

-               private synchronized void addWord(String word, int 
position,Integer id) throws Exception{
+               private void addWord(String word, int position,Integer id) 
throws Exception{
+                       synchronized(XMLSpider.this) {
                        if(word.length() < 3)
                                return;

@@ -1206,6 +1207,7 @@
                        //long time_indexing = System.currentTimeMillis();
 //                     FileWriter outp = new FileWriter("logfile",true);
                        mustWriteIndex = true;
+                       }
                }
        }



Reply via email to