vgritsenko    2003/12/24 07:46:46

  Modified:    java/src/org/apache/xindice/client/xmldb/xmlrpc
                        CollectionImpl.java
  Log:
  Return null if key is null.
  Do not ignore exception, rethrow.
  
  Revision  Changes    Path
  1.40      +15 -5     
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.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- CollectionImpl.java       24 Dec 2003 04:52:53 -0000      1.39
  +++ CollectionImpl.java       24 Dec 2003 15:46:46 -0000      1.40
  @@ -226,6 +226,10 @@
   
           checkOpen();
           try {
  +            if (id == null) {
  +                return null;
  +            }
  +
               Hashtable params = new Hashtable();
               params.put(RPCDefaultMessage.COLLECTION, collPath);
               params.put(RPCDefaultMessage.NAME, id);
  @@ -234,7 +238,10 @@
               Object result = runRemoteCommand("GetResource", params);
   
               // If we get a Hashtable back then the result is compressed.
  -            if (result instanceof Hashtable) {
  +            if (result == null) {
  +                // No resource found
  +                return null;
  +            } else if (result instanceof Hashtable) {
                   Hashtable compressed = (Hashtable) result;
                   SymbolDeserializer symbolDeserial = new SymbolDeserializer();
                   return new XMLResourceImpl(id, id, this, 
symbolDeserial.getSymbols(compressed), (byte[]) compressed.get("document"));
  @@ -244,9 +251,12 @@
                   return new XMLResourceImpl(id, this, (String) result);
               }
   
  +        } catch (XMLDBException x) {
  +
  +            throw x;  // propagate any xmldb exception.
           } catch (Exception e) {
  -            // FIXME Differentiate between NOT_FOUND and everything else
  -            return null;
  +
  +            throw new XMLDBException(ErrorCodes.UNKNOWN_ERROR, e);
           }
       }
   
  
  
  

Reply via email to