OPENNLP-458 getCorpus now return null if corpus does not exist.
diff --git a/corpus-server/src/main/java/org/apache/opennlp/corpus_server/CorporaResource.java b/corpus-server/src/main/java/org/apache/opennlp/corpus_server/CorporaResource.java
index eca6ec1..bb278c8 100644
--- a/corpus-server/src/main/java/org/apache/opennlp/corpus_server/CorporaResource.java
+++ b/corpus-server/src/main/java/org/apache/opennlp/corpus_server/CorporaResource.java
@@ -27,6 +27,7 @@
 import javax.ws.rs.core.MediaType;
 
 import org.apache.opennlp.corpus_server.store.CorporaStore;
+import org.apache.opennlp.corpus_server.store.CorpusStore;
 import org.codehaus.jettison.json.JSONArray;
 
 @Path("/corpora")
@@ -58,11 +59,18 @@
 
   @Path("{corpus}")
 	public CorpusResource getCorpus(
-			@PathParam("corpus") String corpus) throws IOException {
+			@PathParam("corpus") String corpusId) throws IOException {
     
       CorpusServer corpusServer = CorpusServer.getInstance();
       CorporaStore store = corpusServer.getStore();
     
-      return new CorpusResource(store.getCorpus(corpus), corpusServer.getSearchService());
+      CorpusStore corpus = store.getCorpus(corpusId);
+      
+      if (corpus != null) {
+        return new CorpusResource(corpus, corpusServer.getSearchService());
+      }
+      else {
+        return null;
+      }
 	}
 }