You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2013/11/27 23:44:03 UTC
git commit: TAP5-2168: Asset Not Found messages are prompting to put
assets into wrong location
Updated Branches:
refs/heads/master c02dcad37 -> 3fca91ef3
TAP5-2168: Asset Not Found messages are prompting to put assets into wrong location
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/3fca91ef
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/3fca91ef
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/3fca91ef
Branch: refs/heads/master
Commit: 3fca91ef3f9d74f088d2e828e9eba9e33eb7ad63
Parents: c02dcad
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Wed Nov 27 14:43:55 2013 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Wed Nov 27 14:43:55 2013 -0800
----------------------------------------------------------------------
.../internal/services/AssetSourceImpl.java | 16 +++++++++++++++-
.../tapestry5/integration/app1/MiscTests.groovy | 6 ++++++
.../tapestry5/integration/app1/pages/Index.java | 3 +++
.../integration/app1/pages/MissingAssetDemo.java | 11 +++++++++++
4 files changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3fca91ef/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetSourceImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetSourceImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetSourceImpl.java
index 239461b..2924d5b 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetSourceImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetSourceImpl.java
@@ -170,6 +170,13 @@ public class AssetSourceImpl extends LockSupport implements AssetSource
Asset result = getComponentAsset(resources, expanded, metaResource);
+ if (result == null)
+ {
+ throw new RuntimeException(String.format("Unable to locate asset '%s' for component %s. It should be located at %s.",
+ path, resources.getCompleteId(),
+ metaPath));
+ }
+
// This is the best way to tell if the result is an asset for a Classpath resource.
Resource resultResource = result.getResource();
@@ -219,7 +226,14 @@ public class AssetSourceImpl extends LockSupport implements AssetSource
return getAssetForResource(metaResource);
}
- return getAssetInLocale(resources.getBaseResource(), expandedPath, resources.getLocale());
+ Resource oldStyle = findLocalizedResource(resources.getBaseResource(), expandedPath, resources.getLocale());
+
+ if (oldStyle == null || !oldStyle.exists())
+ {
+ return null;
+ }
+
+ return getAssetForResource(oldStyle);
}
private String toPathPrefix(String libraryName)
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3fca91ef/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/MiscTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/MiscTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/MiscTests.groovy
index 8728d65..d7d8be6 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/MiscTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/MiscTests.groovy
@@ -42,5 +42,11 @@ class MiscTests extends App1TestCase {
}
+ @Test
+ void missing_asset_reports_location_under_meta_inf() {
+ openLinks "Missing Asset Demo"
+
+ assertTextPresent "Unable to locate asset 'does-not-exist.txt' for component MissingAssetDemo. It should be located at META-INF/assets/does-not-exist.txt."
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3fca91ef/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
index c17a02f..efd1345 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
@@ -58,6 +58,9 @@ public class Index
private static final List<Item> ITEMS = CollectionFactory
.newList(
+
+ new Item("MissingAssetDemo", "Missing Asset Demo", "Error when injecting an asset that does not exist."),
+
new Item("ConfirmDemo", "Confirm Mixin Demo", "Confirm an action when clicking it."),
new Item("SingleErrorDemo", "Single Error", "Using Error component to customize where the errors for a field will be displayed."),
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/3fca91ef/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/MissingAssetDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/MissingAssetDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/MissingAssetDemo.java
new file mode 100644
index 0000000..9d61cda
--- /dev/null
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/MissingAssetDemo.java
@@ -0,0 +1,11 @@
+package org.apache.tapestry5.integration.app1.pages;
+
+import org.apache.tapestry5.Asset;
+import org.apache.tapestry5.annotations.Path;
+import org.apache.tapestry5.ioc.annotations.Inject;
+
+public class MissingAssetDemo
+{
+ @Inject @Path("does-not-exist.txt")
+ private Asset missing;
+}