You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2017/09/02 15:35:27 UTC
[07/50] [abbrv] oodt git commit: - if you can't find the product
based on ID, then send back a 404
- if you can't find the product based on ID, then send back a 404
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/191be29a
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/191be29a
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/191be29a
Branch: refs/heads/development
Commit: 191be29a5244f43c7b1ac6fc6f3e89d724a1da98
Parents: 57f9c77
Author: Chris Mattmann <ma...@apache.org>
Authored: Fri Jul 21 09:07:47 2017 -0700
Committer: Chris Mattmann <ma...@apache.org>
Committed: Fri Jul 21 09:07:47 2017 -0700
----------------------------------------------------------------------
.../oodt/cas/product/data/DataDeliveryServlet.java | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oodt/blob/191be29a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java
----------------------------------------------------------------------
diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java
index 4ab6b59..7324e28 100644
--- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java
+++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java
@@ -222,8 +222,21 @@ public class DataDeliveryServlet extends HttpServlet implements
private void deliverProductFile(HttpServletRequest req,
HttpServletResponse res, int index, String productID)
throws CatalogException, IOException {
- Product product = client.getProductById(productID);
- List refs = client.getProductReferences(product);
+ Product product = null;
+ List refs = null;
+
+ try{
+ product = client.getProductById(productID);
+ refs = client.getProductReferences(product);
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ LOG.warning("Unable to deliver product: ID: ["+productID+"]: "
+ + "Message: "+e.getMessage()+" throwing 404.");
+ res.sendError(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
Reference ref = (Reference) refs.get(index);
res.addHeader(CONTENT_LENGTH_HDR, String.valueOf(ref.getFileSize()));
String contentType = (ref.getMimeType() != null