You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by vg...@apache.org on 2004/10/29 20:52:23 UTC

cvs commit: xml-xindice status.xml

vgritsenko    2004/10/29 11:52:23

  Modified:    java/src/org/apache/xindice/tools/command
                        AddMultipleDocuments.java
               .        status.xml
  Log:
  clean up AddMultiple command, fix memory leak.
  
  Revision  Changes    Path
  1.13      +19 -24    xml-xindice/java/src/org/apache/xindice/tools/command/AddMultipleDocuments.java
  
  Index: AddMultipleDocuments.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/tools/command/AddMultipleDocuments.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AddMultipleDocuments.java	20 Jul 2004 20:31:37 -0000	1.12
  +++ AddMultipleDocuments.java	29 Oct 2004 18:52:23 -0000	1.13
  @@ -87,38 +87,33 @@
                       children = dir.list();
                   }
   
  -                System.out.println("Reading files from: " + dir.getName());
  +                System.out.println("Reading files from: " + dir.getCanonicalPath());
  +
  +                // Use the functionality already provided in AddDocument command to add this document
  +                final Command cmd = new AddDocument();
  +
  +                // Command parameters
  +                Hashtable localtable = new Hashtable();
  +                localtable.put(XMLTools.COLLECTION, table.get(XMLTools.COLLECTION));
  +                if (local != null) {
  +                    localtable.put(XMLTools.LOCAL, local);
  +                }
   
                   // Loop over documents, adding to db
                   for (int i = 0; i < children.length; i++) {
   
  -                    File files = new File(dir, children[i]);
  -                    if (files.isFile()) {
  -                        FileInputStream insr = new FileInputStream(files);
  -                        byte[] fileBuffer = new byte[(int) files.length()];
  -                        insr.read(fileBuffer);
  -
  +                    File file = new File(dir, children[i]);
  +                    if (file.isFile()) {
                           try {
  -
  -                            // Use the functionality already provided in Command.AddDocument to add this document
  -                            Command cmd = (Command) Class.forName("org.apache.xindice.tools.command.AddDocument").newInstance();
  -                            Hashtable localtable = new Hashtable();
  -                            String filepath = dir.getPath() + "/" + files.getName();
  -
                               // Populate hashtable to pass to AddDocument class
  -                            localtable.put(XMLTools.COLLECTION, table.get(XMLTools.COLLECTION));
  -                            localtable.put(XMLTools.NAME_OF, files.getName());
  -                            localtable.put(XMLTools.FILE_PATH, filepath);
  -                            if (local != null) {
  -                                localtable.put(XMLTools.LOCAL, local);
  -                            }
  +                            localtable.put(XMLTools.NAME_OF, file.getName());
  +                            localtable.put(XMLTools.FILE_PATH, file.getPath());
   
                               // Execute the class!
                               cmd.execute(localtable);
  -
                           } catch (Exception e) {
  -                            System.out.println("Error Adding File: " + files.getName());
  -                            //System.out.println(e);
  +                            System.out.println("Error Adding File: " + file.getName());
  +                            // System.out.println(e);
                               continue;
                           }
                       } else
  
  
  
  1.50      +4 -1      xml-xindice/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/xml-xindice/status.xml,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- status.xml	28 Sep 2004 13:17:39 -0000	1.49
  +++ status.xml	29 Oct 2004 18:52:23 -0000	1.50
  @@ -73,7 +73,10 @@
       </todo>
   
       <changes>
  -        <release version="1.1b5-dev" date="September 28 2004">
  +        <release version="1.1b5-dev" date="October 29 2004">
  +            <action dev="VG" type="fix" due-to="Daniel Migowski">
  +                Fixed memory leak in command line tool, addmultiple command.
  +            </action>
               <action dev="VG" type="fix" fixes-bug="31205" due-to="Tim O'Brien">
                   Fixed bug in xindice.bat, support JAVA_HOME with spaces.
               </action>