incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r591383 - in /incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting: MicroslingScriptResolver.java helpers/ScriptFilenameBuilder.java
Date Fri, 02 Nov 2007 16:09:40 GMT
Author: bdelacretaz
Date: Fri Nov  2 09:09:39 2007
New Revision: 591383

URL: http://svn.apache.org/viewvc?rev=591383&view=rev
Log:
be a bit more defensive in ScriptFilenameBuilder

Modified:
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
    incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/helpers/ScriptFilenameBuilder.java

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java?rev=591383&r1=591382&r2=591383&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/MicroslingScriptResolver.java
Fri Nov  2 09:09:39 2007
@@ -147,7 +147,7 @@
     }
 
     public SlingScript resolveScriptInternal(
-            final SlingHttpServletRequest request) throws RepositoryException {
+            final SlingHttpServletRequest request) throws RepositoryException, SlingException
{
 
         final Resource r = request.getResource();
 

Modified: incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/helpers/ScriptFilenameBuilder.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/helpers/ScriptFilenameBuilder.java?rev=591383&r1=591382&r2=591383&view=diff
==============================================================================
--- incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/helpers/ScriptFilenameBuilder.java
(original)
+++ incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/scripting/helpers/ScriptFilenameBuilder.java
Fri Nov  2 09:09:39 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.sling.microsling.scripting.helpers;
 
+import org.apache.sling.api.SlingException;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.microsling.helpers.constants.HttpConstants;
 
@@ -86,8 +87,11 @@
      * and the resource type, where all backslashes and colons are replaced by
      * forward slashes.
      */
-    public String buildScriptPath(Resource resource) {
+    public String buildScriptPath(Resource resource) throws SlingException {
+        if(resource.getResourceType() == null) {
+            throw new SlingException("resource.getResourceType()==null, cannot build script
path");
+        }
         String typePath = resource.getResourceType().replaceAll("\\:","/");
-        return SCRIPT_BASE_PATH + "/" + typePath;
+        return SCRIPT_BASE_PATH + "/" + typePath.trim();
     }
 }



Mime
View raw message