You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by al...@apache.org on 2007/06/05 18:01:46 UTC

svn commit: r544531 - /incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ResourceReference.java

Author: almaw
Date: Tue Jun  5 09:01:45 2007
New Revision: 544531

URL: http://svn.apache.org/viewvc?view=rev&rev=544531
Log:
Ditch the WeakReferences - causing Serialization issues. Use the name instead.

Modified:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ResourceReference.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ResourceReference.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ResourceReference.java?view=diff&rev=544531&r1=544530&r2=544531
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ResourceReference.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ResourceReference.java Tue Jun  5 09:01:45 2007
@@ -16,7 +16,6 @@
  */
 package org.apache.wicket;
 
-import java.lang.ref.WeakReference;
 import java.util.Locale;
 
 import org.apache.wicket.markup.html.PackageResource;
@@ -55,7 +54,7 @@
  */
 public class ResourceReference implements IClusterable
 {
-	private static final long serialVersionUID = 1L;
+	private static final long serialVersionUID = 2L;
 
 	/** The locale of the resource */
 	protected Locale locale;
@@ -65,9 +64,9 @@
 
 	/** The actual resource */
 	private transient Resource resource;
-
+	
 	/** The scope of the named resource */
-	private final WeakReference scope;
+	private final String scopeName;
 
 	/** The style of the resource */
 	private String style;
@@ -106,7 +105,7 @@
 	 */
 	public ResourceReference(final Class scope, final String name, Locale locale, String style)
 	{
-		this.scope = new WeakReference(scope);
+		this.scopeName = scope.getName();
 		this.name = name;
 		this.locale = locale;
 		this.style = style;
@@ -218,7 +217,8 @@
 	 */
 	public final Class getScope()
 	{
-		return (Class)scope.get();
+		return Application.get().getApplicationSettings().getClassResolver()
+				.resolveClass(scopeName);
 	}
 
 	/**
@@ -245,7 +245,7 @@
 	public int hashCode()
 	{
 		int result = 17;
-		result = 37 * result + (scope != null ? scope.hashCode() : 0);
+		result = 37 * result + (scopeName != null ? scopeName.hashCode() : 0);
 		result = 37 * result + (name != null ? name.hashCode() : 0);
 		result = 37 * result + (locale != null ? locale.hashCode() : 0);
 		result = 37 * result + (style != null ? style.hashCode() : 0);
@@ -286,7 +286,7 @@
 	 */
 	public String toString()
 	{
-		return "[ResourceReference name = " + name + ", scope = " + scope + ", locale = " + locale
+		return "[ResourceReference name = " + name + ", scope = " + scopeName + ", locale = " + locale
 				+ ", style = " + style + "]";
 	}