Author: andyhot
Date: Sun Nov 8 01:13:18 2009
New Revision: 833788
URL:
http://svn.apache.org/viewvc?rev=833788&view=revLog:
TAPESTRY-2581: Non-existent .jwc file caused confusing error message "Could not parse specification null." + now report missing path and show line-precise report
Modified:
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ImplMessages.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ImplStrings.properties
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/NamespaceResourcesImpl.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestNamespaceResources.java
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ImplMessages.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ImplMessages.java?rev=833788&r1=833787&r2=833788&view=diff==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ImplMessages.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ImplMessages.java Sun Nov 8 01:13:18 2009
@@ -287,4 +287,9 @@
{
return _formatter.getMessage("service-name-is-null");
}
+
+ static String templatePathNotFound(String path)
+ {
+ return _formatter.format("template-path-not-found", path);
+ }
}
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ImplStrings.properties
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ImplStrings.properties?rev=833788&r1=833787&r2=833788&view=diff==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ImplStrings.properties (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ImplStrings.properties Sun Nov 8 01:13:18 2009
@@ -64,3 +64,5 @@
service-name-is-null=The service name is null. Engine services must implement method getServiceName() and return a non-null value.
unknown-request=Unable to find a suitable ResponseBuilder for the incoming request.
+
+template-path-not-found=Couldn''t find ''{0}''
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/NamespaceResourcesImpl.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/NamespaceResourcesImpl.java?rev=833788&r1=833787&r2=833788&view=diff==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/NamespaceResourcesImpl.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/NamespaceResourcesImpl.java Sun Nov 8 01:13:18 2009
@@ -14,6 +14,7 @@
package org.apache.tapestry.services.impl;
+import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
import org.apache.hivemind.util.Defense;
@@ -61,6 +62,9 @@
Resource childResource = childAsset.getResourceLocation();
+ if (childResource==null)
+ throw new ApplicationRuntimeException(ImplMessages.templatePathNotFound(path), location, null);
+
return childResource;
}
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestNamespaceResources.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestNamespaceResources.java?rev=833788&r1=833787&r2=833788&view=diff==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestNamespaceResources.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestNamespaceResources.java Sun Nov 8 01:13:18 2009
@@ -18,6 +18,7 @@
import java.net.URL;
+import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
import org.apache.tapestry.BaseComponentTestCase;
@@ -99,7 +100,7 @@
expect(assetSource.findAsset(parent, childPath, null, location)).andReturn(asset);
expect(asset.getResourceLocation()).andReturn(child);
- }
+ }
protected IAsset newAsset()
{
@@ -165,4 +166,28 @@
verify();
}
+
+ public void test_Get_Missing_Component_Specification()
+ {
+ Resource libraryResource = newResource();
+ ISpecificationSource source = newSource();
+ AssetSource assetSource = newAssetSource();
+ Location l = newLocation();
+
+ trainResolveChildResource(assetSource, libraryResource, "Missing_Foo.jwc", l, null);
+
+ replay();
+
+ NamespaceResources nr = new NamespaceResourcesImpl(source, assetSource);
+
+ try {
+ nr.getComponentSpecification(libraryResource, "Missing_Foo.jwc", l);
+
+ fail("exception should be thrown when resource is missing");
+ } catch (ApplicationRuntimeException e) {System.out.println(e);
+ assertEquals(e.getLocation(), l);
+ }
+
+ verify();
+ }
}