vgritsenko 2004/03/30 06:01:48
Modified: java/src/org/apache/xindice/client/xmldb/xmlrpc
DatabaseImpl.java
Log:
add extra check
Revision Changes Path
1.23 +12 -4
xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.java
Index: DatabaseImpl.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/xmlrpc/DatabaseImpl.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- DatabaseImpl.java 13 Feb 2004 03:34:17 -0000 1.22
+++ DatabaseImpl.java 30 Mar 2004 14:01:48 -0000 1.23
@@ -322,7 +322,8 @@
/* TODO: introduce authentication some day */
if (!acceptsURI(uri)) {
- throw new XMLDBException(ErrorCodes.INVALID_URI, "Invalid URL: "
+ uri);
+ throw new XMLDBException(ErrorCodes.INVALID_URI,
+ "Invalid URL: " + uri);
}
/* Chop off driver prefix, and '://' */
@@ -331,10 +332,17 @@
/* Extract host name & port, if present */
int firstSlash = uri.indexOf('/');
if (firstSlash == -1) {
- throw new XMLDBException(ErrorCodes.INVALID_URI, "Invalid URL
(must have '/'): " + uri);
+ throw new XMLDBException(ErrorCodes.INVALID_URI,
+ "Invalid URL (must have '/'): " + uri);
}
+ /* Extract collection name */
String collPath = uri.substring(firstSlash);
+ if (!collPath.startsWith("/")) {
+ throw new XMLDBException(ErrorCodes.INVALID_URI,
+ "Invalid URL (collection name must
start with '/'): " + uri);
+ }
+
String hostPort = uri.substring(0, firstSlash);
/* Absent host defaults to localhost and standard Xindice HTTP port
*/