Sophie

Sophie

distrib > Mageia > 2 > i586 > media > core-release-src > by-pkgid > 6149519608cfbe5b7b49e5318447f6ac > files > 1

apache-abdera-1.1-1.mga2.src.rpm

--- adapters/couchdb/src/main/java/org/apache/abdera/protocol/server/adapters/couchdb/CouchDbAdapter.java	2010-06-05 09:44:32.000000000 +0200
+++ adapters/couchdb/src/main/java/org/apache/abdera/protocol/server/adapters/couchdb/CouchDbAdapter.java-gil	2012-01-18 20:20:33.764720848 +0100
@@ -104,7 +104,11 @@
         List<Document> entries = new ArrayList<Document>();
         List<Document> docs = res.getResults();
         for (Document doc : docs) {
-            entries.add(db.getDocument(doc.getString("id")));
+            try {
+                entries.add(db.getDocument(doc.getString("id")));
+            } catch (Exception e) {
+                // error if the doc isn't found, we deal with the null result below
+            }
         }
         Collections.sort(entries, sorter);
         return new JsonObjectResponseContext(request.getAbdera(), config, res, entries.toArray(new Document[entries
@@ -124,7 +128,11 @@
             // error if the doc isn't found, we deal with the null result below
         }
         if (doc != null) {
-            db.deleteDocument(doc);
+            try {
+                db.deleteDocument(doc);
+            } catch (Exception e) {
+                // error if the doc isn't found, we deal with the null result below
+            }
             return ProviderHelper.nocontent();
         } else
             return ProviderHelper.notfound(request);