[Yanel-commits] rev 43148 - public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet

michi at wyona.com michi at wyona.com
Sat Jun 6 17:52:49 CEST 2009


Author: michi
Date: 2009-06-06 17:52:48 +0200 (Sat, 06 Jun 2009)
New Revision: 43148

Modified:
   public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
Log:
if resource is workflowable, then check if it actually exists and if not send 404

Modified: public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
===================================================================
--- public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java	2009-06-06 15:52:00 UTC (rev 43147)
+++ public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java	2009-06-06 15:52:48 UTC (rev 43148)
@@ -411,6 +411,13 @@
                             view = ((VersionableV2) res).getView(viewId, revisionName);
                         } else if (ResourceAttributeHelper.hasAttributeImplemented(res, "Workflowable", "1") && environment.getStateOfView().equals(StateOfView.LIVE)) {
                             // TODO: Check if resource actually exists (see the exist problem above), because even it doesn't exist, the workflowable interfaces can return something although it doesn't really make sense. For example if a resource type is workflowable, but it has no workflow associated with it, then WorkflowHelper.isLive will nevertheless return true, whereas WorkflowHelper.getLiveView will throw an exception!
+                            if (!((ViewableV2) res).exists()) {
+                                log.warn("No such ViewableV2 resource: " + res.getPath());
+                                log.warn("TODO: It seems like many ViewableV2 resources are not implementing exists() properly!");
+                                do404(request, response, doc, res.getPath());
+                                return;
+                            }
+
                             WorkflowableV1 workflowable = (WorkflowableV1)res;
                             if (workflowable.isLive()) {
                                 view = workflowable.getLiveView(viewId);



More information about the Yanel-commits mailing list