vgritsenko 2003/08/08 19:49:15
Modified: java/src/org/apache/xindice/client/xmldb/xmlrpc
CollectionImpl.java
Log:
Change implementation to closer match javadoc: exception should be thrown
on communication error.
Revision Changes Path
1.31 +9 -4
xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/CollectionImpl.java
Index: CollectionImpl.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/CollectionImpl.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- CollectionImpl.java 7 Aug 2003 20:13:20 -0000 1.30
+++ CollectionImpl.java 9 Aug 2003 02:49:15 -0000 1.31
@@ -85,6 +85,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.StringReader;
+import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Hashtable;
import java.util.Vector;
@@ -193,18 +194,22 @@
Hashtable params = new Hashtable();
params.put(RPCDefaultMessage.COLLECTION, collPath);
String exists = (String)
runRemoteCommand("GetCollectionConfiguration", params);
- if (!"yes".equals(exists)) {
+ if (!"yes".equals(exists)) {
throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION,
"Collection not found: " + collPath);
}
} catch (MalformedURLException e) {
client = null;
throw new XMLDBException(ErrorCodes.INVALID_URI, e);
} catch (XMLDBException x) {
-
throw x; // propagate any xmldb exception.
+ } catch (IOException e) {
+ client = null;
+ // TODO: What is appropriate error code?
+ throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, "Cannot
communicate with the server: " + xmlrpcURI, e);
} catch (Exception e) {
client = null;
+ // TODO: What is appropriate error code?
throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION,
"Collection not found: " + collPath, e);
}
}