vgritsenko    2004/01/08 19:48:19

  Modified:    java/src/org/apache/xindice/server/rpc/messages
                        GetIndexerConfiguration.java RemoveCollection.java
  Log:
  Correcting exception handling
  
  Revision  Changes    Path
  1.9       +12 -9     
xml-xindice/java/src/org/apache/xindice/server/rpc/messages/GetIndexerConfiguration.java
  
  Index: GetIndexerConfiguration.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/server/rpc/messages/GetIndexerConfiguration.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- GetIndexerConfiguration.java      25 Dec 2003 19:33:23 -0000      1.8
  +++ GetIndexerConfiguration.java      9 Jan 2004 03:48:19 -0000       1.9
  @@ -83,16 +83,19 @@
           Hashtable result = new Hashtable();
           try {
               Collection col = getCollection((String) message.get(COLLECTION));
  -            Indexer idx = col.getIndexer((String) message.get(NAME));
  -
  -            if (idx != null) {
  -                result.put(RESULT, "yes");
  -            } else {
  +            if (col == null) {
  +                // No such collection
                   result.put(RESULT, "no");
  +            } else {
  +                Indexer idx = col.getIndexer((String) message.get(NAME));
  +                if (idx != null) {
  +                    result.put(RESULT, "yes");
  +                } else {
  +                    result.put(RESULT, "no");
  +                }
               }
           } catch (Exception e) {
  -            // FIXME "No such collection" is when col == null
  -            /* No such collection */
  +            // FIXME Error handling
               result.put(RESULT, "no");
           }
   
  
  
  
  1.8       +12 -10    
xml-xindice/java/src/org/apache/xindice/server/rpc/messages/RemoveCollection.java
  
  Index: RemoveCollection.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/server/rpc/messages/RemoveCollection.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RemoveCollection.java     25 Dec 2003 19:33:23 -0000      1.7
  +++ RemoveCollection.java     9 Jan 2004 03:48:19 -0000       1.8
  @@ -77,21 +77,23 @@
           }
   
           final String childName= (String) message.get(NAME);
  -        if (null == childName || childName.length() == 0)
  -        {
  +        if (null == childName || childName.length() == 0) {
               throw new Exception(MISSING_NAME_PARAM);
           }
   
           Hashtable result = new Hashtable();
           try {
  -                        
  -            Collection col = getCollection((String) message.get(COLLECTION) 
+ "/" + childName);
  -            col.dropCollection(col);
  -            result.put(RESULT, "yes");
   
  +            Collection col = getCollection((String) message.get(COLLECTION) 
+ "/" + childName);
  +            if (col == null) {
  +                // No such collection
  +                result.put(RESULT, "no");
  +            } else {
  +                col.dropCollection(col);
  +                result.put(RESULT, "yes");
  +            }
           } catch (Exception e) {
  -            // FIXME "No such collection" is when col == null
  -            /* No such collection... */
  +            // FIXME Exception handling
               result.put(RESULT, "no");
           }
   
  
  
  

Reply via email to