Author: j16sdiz
Date: 2008-12-19 15:29:27 +0000 (Fri, 19 Dec 2008)
New Revision: 24611

Modified:
   trunk/plugins/XMLLibrarian/XMLLibrarian.java
Log:
one less global variable

Modified: trunk/plugins/XMLLibrarian/XMLLibrarian.java
===================================================================
--- trunk/plugins/XMLLibrarian/XMLLibrarian.java        2008-12-19 15:29:09 UTC 
(rev 24610)
+++ trunk/plugins/XMLLibrarian/XMLLibrarian.java        2008-12-19 15:29:27 UTC 
(rev 24611)
@@ -13,6 +13,8 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
 import java.util.Vector;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -96,7 +98,6 @@
        
        private HashMap<String, String> uris;
        private HashMap<String, String> titles;
-       private Vector<URIWrapper> fileuris;
        private String prefix_match;
        private int prefix;
        private boolean test;
@@ -730,7 +731,7 @@
                try {
                        SAXParser saxParser = factory.newSAXParser();
                        InputStream is = res.asBucket().getInputStream();
-                       saxParser.parse(is, new LibrarianHandler() );
+                       saxParser.parse(is, new LibrarianHandler(new 
Vector<URIWrapper>()) );
                        is.close();
                } catch (Throwable err) {
                        err.printStackTrace ();}
@@ -747,7 +748,7 @@
         */
        public Vector<URIWrapper> getEntry(String str,String subIndex)throws 
Exception{
                //search for the word in the given subIndex
-               fileuris = new Vector<URIWrapper>();
+               Vector<URIWrapper> fileuris = new Vector<URIWrapper>();
                HighLevelSimpleClient hlsc = pr.getHLSimpleClient();
                try{
                        FreenetURI u = new FreenetURI(DEFAULT_INDEX_SITE + 
"index_"+subIndex+".xml");
@@ -769,7 +770,7 @@
                        try {
                                SAXParser saxParser = factory.newSAXParser();
                                InputStream is = 
res.asBucket().getInputStream();
-                               saxParser.parse(is, new LibrarianHandler() );
+                               saxParser.parse(is, new 
LibrarianHandler(fileuris) );
                                is.close();
                        } catch (Throwable err) {
                                err.printStackTrace ();
@@ -807,7 +808,9 @@
        public class LibrarianHandler extends DefaultHandler {
                // now we need to adapt this to read subindexing 
                private boolean found_match ;
-               public LibrarianHandler() throws Exception{
+               private List<URIWrapper> fileuris;
+               public LibrarianHandler(List<URIWrapper> fileuris) throws 
Exception{
+                       this.fileuris = fileuris;
                }
                public void setDocumentLocator(Locator value) {
 

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to