You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2010/09/20 18:12:23 UTC

svn commit: r998978 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/PackageResource.java

Author: mgrigorov
Date: Mon Sep 20 16:12:23 2010
New Revision: 998978

URL: http://svn.apache.org/viewvc?rev=998978&view=rev
Log:
WICKET-3061 Whole page returns 404 when resource cannot be found

Get the resource stream safely.
The whole page request fails because we are just trying to get the resource modification time to add it in the query string for this resource


Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/PackageResource.java

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/PackageResource.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/PackageResource.java?rev=998978&r1=998977&r2=998978&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/PackageResource.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/PackageResource.java Mon Sep 20 16:12:23 2010
@@ -258,8 +258,10 @@ public class PackageResource extends Web
 		final String style)
 	{
 		String absolutePath = Packages.absolutePath(scope, path);
-		return Application.get().getResourceSettings().getResourceStreamLocator().locate(scope,
-			absolutePath, style, locale, null) != null;
+		return Application.get()
+			.getResourceSettings()
+			.getResourceStreamLocator()
+			.locate(scope, absolutePath, style, locale, null) != null;
 	}
 
 	/**
@@ -644,7 +646,11 @@ public class PackageResource extends Web
 		if (lastModifiedTimeUpdate == 0 ||
 			lastModifiedTimeUpdate < System.currentTimeMillis() - 5 * (1000 * 60))
 		{
-			lastModifiedTime = getResourceStream().lastModifiedTime();
+			IResourceStream resourceStream = getResourceStream(false);
+			if (resourceStream != null)
+			{
+				lastModifiedTime = resourceStream.lastModifiedTime();
+			}
 			lastModifiedTimeUpdate = System.currentTimeMillis();
 		}
 		return lastModifiedTime;