vgritsenko 2004/05/25 08:58:46
Modified: . status.xml
java/src/org/apache/xindice/tools/command
AddMultipleDocuments.java
Log:
Fix bug 27187: addmultiple command with local database
Revision Changes Path
1.44 +3 -0 xml-xindice/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/xml-xindice/status.xml,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- status.xml 20 May 2004 01:35:58 -0000 1.43
+++ status.xml 25 May 2004 15:58:46 -0000 1.44
@@ -74,6 +74,9 @@
<changes>
<release version="1.1b5-dev">
+ <action dev="VG" type="fix" fixes-bug="27187" due-to="Fredy
Dobler">
+ Fixed addmultiple command with local (-l) database
+ </action>
<action dev="VG" type="fix" fixes-bug="28317" due-to="Dominic
Battre">
Fixed NullPointerException in importNamespaces.
</action>
1.11 +8 -8
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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- AddMultipleDocuments.java 8 Feb 2004 02:57:35 -0000 1.10
+++ AddMultipleDocuments.java 25 May 2004 15:58:46 -0000 1.11
@@ -55,9 +55,11 @@
return false;
}
+ final String local = (String) table.get(XMLTools.LOCAL);
+
// Get a Collection reference to the collection
String colstring = normalizeCollectionURI((String)
table.get(XMLTools.COLLECTION),
- (String)
table.get(XMLTools.LOCAL));
+ local);
col = DatabaseManager.getCollection(colstring);
if (col == null) {
System.out.println("ERROR : Collection not found!");
@@ -69,7 +71,6 @@
// Get a File object for the Directory passed in
File dir = new File((String) table.get(XMLTools.FILE_PATH));
-
if (dir.isDirectory()) {
String[] children = new String[]{};
@@ -77,7 +78,6 @@
// If the user supplied a file extension, filter on it, else
use entire contents of the directory
if (!ext.equals("")) {
-
children = dir.list(new FilenameFilter() {
public boolean accept(File none, String name) {
return name.endsWith("." + ext);
@@ -93,7 +93,6 @@
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()];
@@ -110,6 +109,9 @@
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);
+ }
// Execute the class!
cmd.execute(localtable);
@@ -133,6 +135,4 @@
return true;
}
-
}
-