You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2007/11/03 22:04:20 UTC

svn commit: r591690 - in /wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket: Localizer.java util/convert/converters/AbstractDecimalConverter.java util/lang/EnumeratedType.java util/time/TimeMap.java util/watch/ModificationWatcher.java

Author: jcompagner
Date: Sat Nov  3 14:04:20 2007
New Revision: 591690

URL: http://svn.apache.org/viewvc?rev=591690&view=rev
Log:
some more fixes from WICKET-1082

Modified:
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Localizer.java
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/convert/converters/AbstractDecimalConverter.java
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/time/TimeMap.java
    wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/watch/ModificationWatcher.java

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Localizer.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Localizer.java?rev=591690&r1=591689&r2=591690&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Localizer.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Localizer.java Sat Nov  3 14:04:20 2007
@@ -16,7 +16,6 @@
  */
 package org.apache.wicket;
 
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
@@ -71,7 +70,7 @@
 	 */
 	public final void clearCache()
 	{
-		cache = new HashMap();
+		cache = new ConcurrentHashMap();
 	}
 
 	/**
@@ -86,7 +85,7 @@
 	 *             If resource not found and configuration dictates that exception should be thrown
 	 */
 	public String getString(final String key, final Component component)
-			throws MissingResourceException
+		throws MissingResourceException
 	{
 		return getString(key, component, null, null);
 	}
@@ -105,7 +104,7 @@
 	 *             If resource not found and configuration dictates that exception should be thrown
 	 */
 	public String getString(final String key, final Component component, final IModel model)
-			throws MissingResourceException
+		throws MissingResourceException
 	{
 		return getString(key, component, model, null);
 	}
@@ -124,7 +123,7 @@
 	 *             If resource not found and configuration dictates that exception should be thrown
 	 */
 	public String getString(final String key, final Component component, final String defaultValue)
-			throws MissingResourceException
+		throws MissingResourceException
 	{
 		return getString(key, component, null, defaultValue);
 	}
@@ -144,8 +143,8 @@
 	 * @Deprecated please use {@link #getString(String, Component, IModel, String)}
 	 */
 	public String getString(final String key, final Component component, final IModel model,
-			final Locale locale, final String style, final String defaultValue)
-			throws MissingResourceException
+		final Locale locale, final String style, final String defaultValue)
+		throws MissingResourceException
 	{
 		return getString(key, component, model, defaultValue);
 	}
@@ -169,7 +168,7 @@
 	 *             If resource not found and configuration dictates that exception should be thrown
 	 */
 	public String getString(final String key, final Component component, final IModel model,
-			final String defaultValue) throws MissingResourceException
+		final String defaultValue) throws MissingResourceException
 	{
 		final IResourceSettings resourceSettings = Application.get().getResourceSettings();
 
@@ -184,11 +183,11 @@
 			if (!addedToPage)
 			{
 				logger
-						.warn(
-								"Tried to retrieve a localized string for a component that has not yet been added to the page. "
-										+ "This can sometimes lead to an invalid or no localized resource returned. "
-										+ "Make sure you are not calling Component#getString() inside your Component's constructor. "
-										+ "Offending component: {}", component);
+					.warn(
+						"Tried to retrieve a localized string for a component that has not yet been added to the page. "
+							+ "This can sometimes lead to an invalid or no localized resource returned. "
+							+ "Make sure you are not calling Component#getString() inside your Component's constructor. "
+							+ "Offending component: {}", component);
 			}
 		}
 
@@ -250,8 +249,8 @@
 
 		if (resourceSettings.getThrowExceptionOnMissingResource())
 		{
-			AppendingStringBuffer message = new AppendingStringBuffer("Unable to find resource: "
-					+ key);
+			AppendingStringBuffer message = new AppendingStringBuffer("Unable to find resource: " +
+				key);
 			if (component != null)
 			{
 				message.append(" for component: ");
@@ -259,7 +258,7 @@
 				message.append(" [class=").append(component.getClass().getName()).append("]");
 			}
 			throw new MissingResourceException(message.toString(), (component != null ? component
-					.getClass().getName() : ""), key);
+				.getClass().getName() : ""), key);
 		}
 
 		return "[Warning: String resource for '" + key + "' not found]";
@@ -288,7 +287,7 @@
 	 * Get the value associated with the key from the cache.
 	 * 
 	 * @param cacheKey
-	 * @return
+	 * @return The value of the key
 	 */
 	protected String getFromCache(final String cacheKey)
 	{
@@ -310,7 +309,7 @@
 	 * 
 	 * @param key
 	 * @param component
-	 * @return
+	 * @return The value of the key
 	 */
 	protected String getCacheKey(final String key, final Component component)
 	{
@@ -342,7 +341,7 @@
 	 * @return The resulting string
 	 */
 	private String substitutePropertyExpressions(final Component component, final String string,
-			final IModel model)
+		final IModel model)
 	{
 		if ((string != null) && (model != null))
 		{

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/convert/converters/AbstractDecimalConverter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/convert/converters/AbstractDecimalConverter.java?rev=591690&r1=591689&r2=591690&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/convert/converters/AbstractDecimalConverter.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/convert/converters/AbstractDecimalConverter.java Sat Nov  3 14:04:20 2007
@@ -17,10 +17,11 @@
 package org.apache.wicket.util.convert.converters;
 
 import java.text.NumberFormat;
-import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
 
+import org.apache.wicket.util.concurrent.ConcurrentHashMap;
+
 /**
  * Base class for all number converters.
  * 
@@ -33,10 +34,10 @@
 	 */
 	private static final long serialVersionUID = 1L;
 	/** The date format to use */
-	private final Map/* <Locale, NumberFormat> */numberFormats = new HashMap/*
-																			 * <Locale,
-																			 * NumberFormat>
-																			 */();
+	private final Map/* <Locale, NumberFormat> */numberFormats = new ConcurrentHashMap/*
+	 * <Locale,
+	 * NumberFormat>
+	 */();
 
 
 	/**

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java?rev=591690&r1=591689&r2=591690&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/lang/EnumeratedType.java Sat Nov  3 14:04:20 2007
@@ -17,11 +17,11 @@
 package org.apache.wicket.util.lang;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.wicket.util.concurrent.ConcurrentHashMap;
 import org.apache.wicket.util.string.StringValue;
 
 
@@ -41,7 +41,7 @@
 	 */
 	private static final long serialVersionUID = 1L;
 	/** Map of type values by class */
-	private static final Map valueListByClass = new HashMap();
+	private static final Map valueListByClass = new ConcurrentHashMap();
 
 	/**
 	 * Constructor.

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/time/TimeMap.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/time/TimeMap.java?rev=591690&r1=591689&r2=591690&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/time/TimeMap.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/time/TimeMap.java Sat Nov  3 14:04:20 2007
@@ -16,10 +16,11 @@
  */
 package org.apache.wicket.util.time;
 
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.wicket.util.concurrent.ConcurrentHashMap;
+
 /**
  * This class maps <code>ITimeFrame</code>s to <code>Object</code>s. Since values are stored
  * using <code>ITimeFrameSource</code> implementing objects, the value returned by the source may
@@ -42,7 +43,7 @@
 	 * <code>Map</code> from <code>ITimeFrameSource</code> implementing objects to
 	 * <code>Object</code> values.
 	 */
-	private final Map sources = new HashMap();
+	private final Map sources = new ConcurrentHashMap();
 
 	/**
 	 * Retrieves an <code>Object</code> for the current <code>Time</code> value.
@@ -97,7 +98,7 @@
 			if (timeframe.overlaps(current))
 			{
 				throw new IllegalArgumentException("Timeframe " + timeframe +
-						" overlaps timeframe " + current);
+					" overlaps timeframe " + current);
 			}
 		}
 

Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/watch/ModificationWatcher.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/watch/ModificationWatcher.java?rev=591690&r1=591689&r2=591690&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/watch/ModificationWatcher.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/watch/ModificationWatcher.java Sat Nov  3 14:04:20 2007
@@ -17,11 +17,11 @@
 package org.apache.wicket.util.watch;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.wicket.util.concurrent.ConcurrentHashMap;
 import org.apache.wicket.util.listener.ChangeListenerSet;
 import org.apache.wicket.util.listener.IChangeListener;
 import org.apache.wicket.util.thread.ICode;
@@ -45,7 +45,7 @@
 	private static final Logger log = LoggerFactory.getLogger(ModificationWatcher.class);
 
 	/** maps <code>IModifiable</code> objects to <code>Entry</code> objects */
-	private final Map modifiableToEntry = new HashMap();
+	private final Map modifiableToEntry = new ConcurrentHashMap();
 
 	/** the <code>Task</code> to run */
 	private Task task;
@@ -166,7 +166,7 @@
 				// modification problems without the associated liveness issues
 				// of holding a lock while potentially polling file times!
 				for (final Iterator iterator = new ArrayList(modifiableToEntry.values()).iterator(); iterator
-						.hasNext();)
+					.hasNext();)
 				{
 					// Get next entry
 					final Entry entry = (Entry)iterator.next();
@@ -207,6 +207,6 @@
 	 */
 	public final Set getEntries()
 	{
-		return this.modifiableToEntry.keySet();
+		return modifiableToEntry.keySet();
 	}
 }