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/02/19 03:50:44 UTC

cvs commit: xml-xindice/java/src/org/apache/xindice/client/xmldb/embed CollectionImpl.java

vgritsenko    2004/02/18 18:50:44

  Modified:    java/src/org/apache/xindice/client/xmldb/embed
                        CollectionImpl.java
  Log:
  Add check on null/empty collection name
  
  Revision  Changes    Path
  1.32      +11 -4     xml-xindice/java/src/org/apache/xindice/client/xmldb/embed/CollectionImpl.java
  
  Index: CollectionImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/client/xmldb/embed/CollectionImpl.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- CollectionImpl.java	8 Feb 2004 02:43:01 -0000	1.31
  +++ CollectionImpl.java	19 Feb 2004 02:50:44 -0000	1.32
  @@ -502,13 +502,20 @@
   
       /* see superclass for documentation */
       public void removeCollection(String childName) throws XMLDBException {
  +
  +        if (null == childName || childName.length() == 0) {
  +            throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION,
  +                                     FaultCodes.COL_COLLECTION_NOT_FOUND,
  +                                     "Cannot remove child collection '" + childName + "': Name is empty");
  +        }
  +
           checkOpen();
           try {
               col.dropCollection(col.getCollection(childName));
           } catch (Exception e) {
               throw FaultCodes.createXMLDBException(ErrorCodes.INVALID_COLLECTION,
                                                     FaultCodes.GEN_UNKNOWN,
  -                                                  "Cannot remove child collection", e);
  +                                                  "Cannot remove child collection '" + childName + "'", e);
           }
       }
   
  @@ -553,7 +560,7 @@
   
       // search result handling
   
  -    private Document nodesetToDocument(NodeSet ns) {
  +    private static Document nodesetToDocument(NodeSet ns) {
   
           //
           // FIXME: There is a copy of this same code in org.apache.xindice.server.xmldb.rpc.messages.Query#queryWrapper