kward 2002/06/09 19:07:14
Modified: java/scratchpad/src/org/apache/xindice/server/rpc/messages
InsertDocument.java
Log:
added parameter checking
Revision Changes Path
1.4 +14 -1
xml-xindice/java/scratchpad/src/org/apache/xindice/server/rpc/messages/InsertDocument.java
Index: InsertDocument.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/scratchpad/src/org/apache/xindice/server/rpc/messages/InsertDocument.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- InsertDocument.java 2 Apr 2002 22:57:05 -0000 1.3
+++ InsertDocument.java 10 Jun 2002 02:07:14 -0000 1.4
@@ -56,7 +56,7 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
- * $Id: InsertDocument.java,v 1.3 2002/04/02 22:57:05 kstaken Exp $
+ * $Id: InsertDocument.java,v 1.4 2002/06/10 02:07:14 kward Exp $
*/
import java.util.Hashtable;
@@ -73,6 +73,19 @@
*/
public class InsertDocument extends RPCDefaultMessage {
public Hashtable execute(Hashtable message) throws Exception {
+
+ if(!message.containsKey(COLLECTION)) {
+ throw new Exception("Collection parameter not specified");
+ }
+
+ if(!message.containsKey(NAME)) {
+ throw new Exception("Name parameter not specified");
+ }
+
+ if(!message.containsKey(DOCUMENT)) {
+ throw new Exception("Document parameter not specified");
+ }
+
Collection col = getCollection((String) message.get(COLLECTION));
Document doc = DOMParser.toDocument((String) message.get(DOCUMENT));