You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ni...@apache.org on 2005/12/06 07:05:39 UTC
svn commit: r354330 - in /jakarta/commons/proper/resources/trunk:
src/java/org/apache/commons/resources/
src/java/org/apache/commons/resources/impl/
src/test/org/apache/commons/resources/impl/ xdocs/
Author: niallp
Date: Mon Dec 5 22:05:19 2005
New Revision: 354330
URL: http://svn.apache.org/viewcvs?rev=354330&view=rev
Log:
Remove TimeZone from Resources API (see Bug 37709)
Modified:
jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/Messages.java
jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/Resources.java
jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/CollectionResourcesBase.java
jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/ResourceBundleResources.java
jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/ResourcesBase.java
jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/CollectionResourcesBaseTestCase.java
jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourceBundleResourcesTestCase.java
jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourcesBaseMethodTestCase.java
jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourcesBaseTestCase.java
jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/TestResources.java
jakarta/commons/proper/resources/trunk/xdocs/changes.xml
jakarta/commons/proper/resources/trunk/xdocs/index.xml
Modified: jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/Messages.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/Messages.java?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/Messages.java (original)
+++ jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/Messages.java Mon Dec 5 22:05:19 2005
@@ -233,7 +233,7 @@
String message = null;
try {
- message = resources.getString(key, locale, null);
+ message = resources.getString(key, locale);
} catch (ResourcesException e) {
Log log = LogFactory.getLog(Messages.class);
if (log.isDebugEnabled()) {
Modified: jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/Resources.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/Resources.java?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/Resources.java (original)
+++ jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/Resources.java Mon Dec 5 22:05:19 2005
@@ -28,13 +28,12 @@
import java.io.Serializable;
import java.util.Iterator;
import java.util.Locale;
-import java.util.TimeZone;
/**
* <p>An abstract representation of a set of internationalized resources,
* which are arbitrary objects identified by a unique String <code>key</code>.
- * Localized versions of the resources (based on Locale and optional
- * TimeZone parameters) can be retrieved in a variety of formats.</p>
+ * Localized versions of the resources (based on Locale parameter)
+ * can be retrieved in a variety of formats.</p>
*
* <p>When presented with an invalid <code>key</code> value, resource
* getter methods will behave differently based on the current value of
@@ -50,8 +49,8 @@
* application resources, and other specialized approaches as desired.</p>
*
* <p>Different implementations of the {@link Resources} interface may apply
- * different semantics to the use of the <code>locale</code> and/or
- * <code>timeZone</code> attributes used to perform localization. Consult
+ * different semantics to the use of the <code>locale</code>
+ * attribute used to perform localization. Consult
* the documentation for the specific {@link Resources} implementation you
* are using for the specific details of your implementation.</p>
*
@@ -140,14 +139,12 @@
/**
* <p>Return the content for the specified <code>key</code> as a
- * byte array, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * byte array, localized based on the specified <code>locale</code>.
+ * </p>
*
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return content for a specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -156,19 +153,17 @@
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
*/
- public byte[] getBytes(String key, Locale locale, TimeZone timeZone);
+ public byte[] getBytes(String key, Locale locale);
/**
* <p>Return the content for the specified <code>key</code> as an
- * InputStream, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * InputStream, localized based on the specified <code>locale</code>.
+ * </p>
*
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return content for a specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -177,20 +172,17 @@
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
*/
- public InputStream getInputStream(String key, Locale locale,
- TimeZone timeZone);
+ public InputStream getInputStream(String key, Locale locale);
/**
* <p>Return the content for the specified <code>key</code> as an
- * Object, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * Object, localized based on the specified <code>locale</code>.
+ * </p>
*
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return content for a specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -199,19 +191,17 @@
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
*/
- public Object getObject(String key, Locale locale, TimeZone timeZone);
+ public Object getObject(String key, Locale locale);
/**
* <p>Return the content for the specified <code>key</code> as a
- * Reader, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * Reader, localized based on the specified <code>locale</code>.
+ * </p>
*
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return content for a specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -220,19 +210,17 @@
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
*/
- public Reader getReader(String key, Locale locale, TimeZone timeZone);
+ public Reader getReader(String key, Locale locale);
/**
* <p>Return the content for the specified <code>key</code> as a
- * String, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * String, localized based on the specified <code>locale</code>.
+ * </p>
*
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return content for a specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -241,7 +229,7 @@
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
*/
- public String getString(String key, Locale locale, TimeZone timeZone);
+ public String getString(String key, Locale locale);
}
Modified: jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/CollectionResourcesBase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/CollectionResourcesBase.java?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/CollectionResourcesBase.java (original)
+++ jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/CollectionResourcesBase.java Mon Dec 5 22:05:19 2005
@@ -31,7 +31,6 @@
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-import java.util.TimeZone;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -45,9 +44,6 @@
* in a URL-accessible resource file with a common base URL. Subclasses
* need only override <code>loadLocale()</code> to manage the details of
* loading the name-value mappings for a particular Locale.</p>
- *
- * <p>The <code>timeZone</code> paramter, if any, is ignored by the
- * default content retrieval methods.</p>
*/
public abstract class CollectionResourcesBase extends ResourcesBase {
@@ -151,14 +147,12 @@
/**
* <p>Return the content for the specified <code>key</code> as an
- * Object, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * Object, localized based on the specified <code>locale</code>.
+ * </p>
*
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return The content for the specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -166,10 +160,8 @@
* @exception ResourcesKeyException if the no value for the specified
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
- *
- * @TODO - FIXME - timeZone is ignored
*/
- public Object getObject(String key, Locale locale, TimeZone timeZone) {
+ public Object getObject(String key, Locale locale) {
if (getLog().isTraceEnabled()) {
getLog().trace("Retrieving message for key '" + key + "' and locale '"
Modified: jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/ResourceBundleResources.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/ResourceBundleResources.java?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/ResourceBundleResources.java (original)
+++ jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/ResourceBundleResources.java Mon Dec 5 22:05:19 2005
@@ -35,7 +35,6 @@
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Set;
-import java.util.TimeZone;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -46,8 +45,7 @@
* <p>Concrete implementation of
* {@link org.apache.commons.resources.Resources} that wraps a set
* (one per Locale) of <code>java.util.ResourceBundle</code> instances
- * that share a common base name. The <code>timeZone</code> argument
- * is ignored in all resource getter method implementations.</p>
+ * that share a common base name.</p>
*/
public class ResourceBundleResources extends ResourcesBase {
@@ -195,14 +193,12 @@
/**
* <p>Return the content for the specified <code>key</code> as an
- * Object, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * Object, localized based on the specified <code>locale</code>.
+ * </p>
*
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return content for a specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -211,7 +207,7 @@
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
*/
- public Object getObject(String key, Locale locale, TimeZone timeZone) {
+ public Object getObject(String key, Locale locale) {
if (getLog().isTraceEnabled()) {
getLog().trace("Retrieving message for key '" + key + "' and locale '"
@@ -219,7 +215,7 @@
}
try {
- ResourceBundle bundle = getBundle(locale, timeZone);
+ ResourceBundle bundle = getBundle(locale);
Object object = bundle.getObject(key);
if (getLog().isTraceEnabled()) {
getLog().trace("Retrieved object for key '" + key +
@@ -248,24 +244,18 @@
/**
* <p>Return the appropriate <code>ResourceBundle</code> instance
- * that corresponds to the specified <code>locale</code> and
- * <code>timeZone</code> parameters. The first time a particular
- * bundle is requested, cache it so that subsequent requests will
- * operate more quickly.</p>
- *
- * <p>The default implementation of this method unconditionally ignores the
- * <code>timeZone</code> argument.</p>
+ * that corresponds to the specified <code>locale</code> parameter.
+ * The first time a particular bundle is requested, cache it so
+ * that subsequent requests will operate more quickly.</p>
*
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return The Resource Bundle corresponding to the locale and time zone.
*
* @exception MissingResourceException if the requested Resourcebundle
* cannot be acquired
*/
- protected ResourceBundle getBundle(Locale locale, TimeZone timeZone)
+ protected ResourceBundle getBundle(Locale locale)
throws MissingResourceException {
if (locale == null) {
Modified: jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/ResourcesBase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/ResourcesBase.java?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/ResourcesBase.java (original)
+++ jakarta/commons/proper/resources/trunk/src/java/org/apache/commons/resources/impl/ResourcesBase.java Mon Dec 5 22:05:19 2005
@@ -31,7 +31,6 @@
import java.io.IOException;
import java.util.Iterator;
import java.util.Locale;
-import java.util.TimeZone;
import org.apache.commons.resources.Resources;
import org.apache.commons.resources.ResourcesException;
@@ -226,8 +225,8 @@
/**
* <p>Return the content for the specified <code>key</code> as a
- * byte array, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * byte array, localized based on the specified <code>locale</code>.
+ * </p>
*
* <p>The default implementation calls <code>getString()</code> and
* converts the value to a byte array.</p>
@@ -235,8 +234,6 @@
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return content for a specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -245,9 +242,9 @@
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
*/
- public byte[] getBytes(String key, Locale locale, TimeZone timeZone) {
+ public byte[] getBytes(String key, Locale locale) {
- Object value = getObject(key, locale, timeZone);
+ Object value = getObject(key, locale);
if (value == null) {
return (null);
} else if (value instanceof String) {
@@ -275,8 +272,8 @@
/**
* <p>Return the content for the specified <code>key</code> as an
- * InputStream, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * InputStream, localized based on the specified <code>locale</code>.
+ * </p>
*
* <p>The default implementation calls <code>getsBytes()</code>
* and returns an input stream over the resulting byte array.</p>
@@ -284,8 +281,6 @@
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return content for a specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -294,9 +289,9 @@
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
*/
- public InputStream getInputStream(String key, Locale locale,
- TimeZone timeZone) {
- Object value = getObject(key, locale, timeZone);
+ public InputStream getInputStream(String key, Locale locale) {
+
+ Object value = getObject(key, locale);
if (value == null) {
return (null);
} else if (value instanceof String) {
@@ -323,8 +318,8 @@
/**
* <p>Return the content for the specified <code>key</code> as an
- * Object, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * Object, localized based on the specified <code>locale</code>.
+ * </p>
*
* <p>There is no default implementation of this method. Concrete
* subclasses must provide such an implementation.</p>
@@ -332,8 +327,6 @@
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return content for a specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -342,13 +335,13 @@
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
*/
- public abstract Object getObject(String key, Locale locale, TimeZone timeZone);
+ public abstract Object getObject(String key, Locale locale);
/**
* <p>Return the content for the specified <code>key</code> as a
- * Reader, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * Reader, localized based on the specified <code>locale</code>.
+ * </p>
*
* <p>The default implementation calls <code>getString()</code>
* and returns a reader over the resulting characters.</p>
@@ -356,8 +349,6 @@
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return content for a specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -366,9 +357,9 @@
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
*/
- public Reader getReader(String key, Locale locale, TimeZone timeZone) {
+ public Reader getReader(String key, Locale locale) {
- Object value = getObject(key, locale, timeZone);
+ Object value = getObject(key, locale);
if (value == null) {
return (null);
} else if (value instanceof String) {
@@ -389,8 +380,8 @@
/**
* <p>Return the content for the specified <code>key</code> as a
- * String, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * String, localized based on the specified <code>locale</code>.
+ * </p>
*
* <p>The default implementation calls <code>getObject()</code>
* and converts the result to a String if necessary.</p>
@@ -398,8 +389,6 @@
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
* @return content for a specified key.
*
* @exception ResourcesException if an error occurs retrieving or
@@ -408,9 +397,9 @@
* key was found, and <code>isReturnNull()</code> returns
* <code>false</code>
*/
- public String getString(String key, Locale locale, TimeZone timeZone) {
+ public String getString(String key, Locale locale) {
- Object value = getObject(key, locale, timeZone);
+ Object value = getObject(key, locale);
if (value == null) {
return (null);
} else if (value instanceof String) {
Modified: jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/CollectionResourcesBaseTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/CollectionResourcesBaseTestCase.java?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/CollectionResourcesBaseTestCase.java (original)
+++ jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/CollectionResourcesBaseTestCase.java Mon Dec 5 22:05:19 2005
@@ -1,11 +1,11 @@
/*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//resources/src/test/org/apache/commons/resources/impl/CollectionResourcesBaseTestCase.java,v 1.11 2004/09/07 23:49:47 jmitchell Exp $
+ * $Id$
* $Revision$
* $Date$
*
* ====================================================================
*
- * Copyright 2003-2004 The Apache Software Foundation
+ * Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -91,12 +91,12 @@
locale = new Locale("en", "US");
assertEquals("en_US inherit value",
"[en] INHERIT",
- resources.getString("test.inherit", locale, null));
+ resources.getString("test.inherit", locale));
locale = new Locale("fr", "FR");
assertEquals("fr_FR inherit value",
"[fr] INHERIT",
- resources.getString("test.inherit", locale, null));
+ resources.getString("test.inherit", locale));
}
@@ -152,7 +152,7 @@
Locale locale = new Locale("en","");
try {
resources.setReturnNull(true);
- String value = resources.getString("test.missing", locale, null);
+ String value = resources.getString("test.missing", locale);
assertTrue("Should have returned null", value == null);
} catch (ResourcesException e) {
fail("Should have returned null");
@@ -160,7 +160,7 @@
try {
resources.setReturnNull(false);
- resources.getString("test.missing", locale, null);
+ resources.getString("test.missing", locale);
fail("Should have thrown ResourcesException");
} catch (ResourcesKeyException e) {
// Expected result
@@ -177,17 +177,17 @@
locale = new Locale("en", "");
assertEquals("en specific value",
"[en] SPECIFIC",
- resources.getString("test.specific", locale, null));
+ resources.getString("test.specific", locale));
locale = new Locale("en", "US");
assertEquals("en_US specific value",
"[en_US] SPECIFIC",
- resources.getString("test.specific", locale, null));
+ resources.getString("test.specific", locale));
locale = new Locale("fr", "");
assertEquals("fr specific value",
"[fr] SPECIFIC",
- resources.getString("test.specific", locale, null));
+ resources.getString("test.specific", locale));
}
Modified: jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourceBundleResourcesTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourceBundleResourcesTestCase.java?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourceBundleResourcesTestCase.java (original)
+++ jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourceBundleResourcesTestCase.java Mon Dec 5 22:05:19 2005
@@ -1,11 +1,11 @@
/*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//resources/src/test/org/apache/commons/resources/impl/ResourceBundleResourcesTestCase.java,v 1.10 2004/09/07 23:49:47 jmitchell Exp $
+ * $Id$
* $Revision$
* $Date$
*
* ====================================================================
*
- * Copyright 2003-2004 The Apache Software Foundation
+ * Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -88,12 +88,12 @@
locale = new Locale("en", "US");
assertEquals("en_US inherit value",
"[en] INHERIT",
- resources.getString("test.inherit", locale, null));
+ resources.getString("test.inherit", locale));
locale = new Locale("fr", "FR");
assertEquals("fr_FR inherit value",
"[fr] INHERIT",
- resources.getString("test.inherit", locale, null));
+ resources.getString("test.inherit", locale));
}
@@ -104,14 +104,14 @@
Locale locale = new Locale("en","");
try {
resources.setReturnNull(false);
- resources.getString("test.missing", locale, null);
+ resources.getString("test.missing", locale);
fail("Should have thrown ResourcesException");
} catch (ResourcesKeyException e) {
// Expected result
}
try {
resources.setReturnNull(true);
- String value = resources.getString("test.missing", locale, null);
+ String value = resources.getString("test.missing", locale);
assertTrue("Should have returned null", value == null);
} catch (ResourcesException e) {
fail("Should have returned null");
@@ -137,17 +137,17 @@
locale = new Locale("en","");
assertEquals("en specific value",
"[en] SPECIFIC",
- resources.getString("test.specific", locale, null));
+ resources.getString("test.specific", locale));
locale = new Locale("en", "US");
assertEquals("en_US specific value",
"[en_US] SPECIFIC",
- resources.getString("test.specific", locale, null));
+ resources.getString("test.specific", locale));
locale = new Locale("fr","");
assertEquals("fr specific value",
"[fr] SPECIFIC",
- resources.getString("test.specific", locale, null));
+ resources.getString("test.specific", locale));
}
Modified: jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourcesBaseMethodTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourcesBaseMethodTestCase.java?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourcesBaseMethodTestCase.java (original)
+++ jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourcesBaseMethodTestCase.java Mon Dec 5 22:05:19 2005
@@ -27,7 +27,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
-import java.util.TimeZone;
import java.util.Map;
import java.util.HashMap;
import java.io.Reader;
@@ -197,7 +196,7 @@
String mapValue = (String)testMap.get(keys[i]);
byte[] resValue = null;
try {
- resValue = resources.getBytes(keys[i], null, null);
+ resValue = resources.getBytes(keys[i], null);
} catch(Exception e) {
fail("Error checking Bytes for key " + keys[i] + " " + e);
}
@@ -222,7 +221,7 @@
String mapValue = (String)testMap.get(keys[i]);
String resValue = null;
try {
- resValue = resources.getString(keys[i], null, null);
+ resValue = resources.getString(keys[i], null);
} catch(Exception e) {
fail("Error checking String for key " + keys[i] + " " + e);
}
@@ -241,7 +240,7 @@
String mapValue = (String)testMap.get(keys[i]);
Reader reader = null;
try {
- reader = resources.getReader(keys[i], null, null);
+ reader = resources.getReader(keys[i], null);
if (reader == null && mapValue.length() == 0) {
continue;
}
@@ -278,7 +277,7 @@
String mapValue = (String)testMap.get(keys[i]);
InputStream stream = null;
try {
- stream = resources.getInputStream(keys[i], null, null);
+ stream = resources.getInputStream(keys[i], null);
if (stream == null && mapValue.length() == 0) {
continue;
}
@@ -319,7 +318,7 @@
public Iterator getKeys() {
return map.keySet().iterator();
}
- public Object getObject(String key, Locale locale, TimeZone timeZone) {
+ public Object getObject(String key, Locale locale) {
return map.get(key);
}
}
@@ -332,7 +331,7 @@
public ReaderResources() {
super();
}
- public Object getObject(String key, Locale locale, TimeZone timeZone) {
+ public Object getObject(String key, Locale locale) {
return new java.io.StringReader((String)map.get(key));
}
}
@@ -345,7 +344,7 @@
public StreamResources() {
super();
}
- public Object getObject(String key, Locale locale, TimeZone timeZone) {
+ public Object getObject(String key, Locale locale) {
return new java.io.ByteArrayInputStream(((String)map.get(key)).getBytes());
}
}
@@ -358,7 +357,7 @@
public ByteArrayResources() {
super();
}
- public Object getObject(String key, Locale locale, TimeZone timeZone) {
+ public Object getObject(String key, Locale locale) {
return ((String)map.get(key)).getBytes();
}
}
@@ -371,7 +370,7 @@
public StringResources() {
super();
}
- public Object getObject(String key, Locale locale, TimeZone timeZone) {
+ public Object getObject(String key, Locale locale) {
return (String)map.get(key);
}
}
@@ -384,7 +383,7 @@
public ObjectResources() {
super();
}
- public Object getObject(String key, Locale locale, TimeZone timeZone) {
+ public Object getObject(String key, Locale locale) {
return new StringBuffer((String)map.get(key));
}
}
Modified: jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourcesBaseTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourcesBaseTestCase.java?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourcesBaseTestCase.java (original)
+++ jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/ResourcesBaseTestCase.java Mon Dec 5 22:05:19 2005
@@ -1,11 +1,11 @@
/*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//resources/src/test/org/apache/commons/resources/impl/ResourcesBaseTestCase.java,v 1.12 2004/09/07 23:49:47 jmitchell Exp $
+ * $Id$
* $Revision$
* $Date$
*
* ====================================================================
*
- * Copyright 2003-2004 The Apache Software Foundation
+ * Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -90,12 +90,12 @@
locale = new Locale("en", "US");
assertEquals("en_US inherit value",
"[test] INHERIT",
- resources.getString("test.inherit", locale, null));
+ resources.getString("test.inherit", locale));
locale = new Locale("fr", "FR");
assertEquals("fr_FR inherit value",
"[test] INHERIT",
- resources.getString("test.inherit", locale, null));
+ resources.getString("test.inherit", locale));
}
@@ -105,10 +105,10 @@
// Pre-seed all of the keys we expect to find
Locale locale = new Locale("en", "US");
- resources.getString("test.base", locale, null);
- resources.getString("test.specific", locale, null);
- resources.getString("test.inherit", locale, null);
- resources.getString("test.message", locale, null);
+ resources.getString("test.base", locale);
+ resources.getString("test.specific", locale);
+ resources.getString("test.inherit", locale);
+ resources.getString("test.message", locale);
// Accumulate all of the keys that are actually returned
List results = new ArrayList();
@@ -133,14 +133,14 @@
Locale locale = new Locale("en","");
try {
resources.setReturnNull(false);
- resources.getString("test.missing", locale, null);
+ resources.getString("test.missing", locale);
fail("Should have thrown ResourcesException");
} catch (ResourcesKeyException e) {
// Expected result
}
try {
resources.setReturnNull(true);
- String value = resources.getString("test.missing", locale, null);
+ String value = resources.getString("test.missing", locale);
assertTrue("Should have returned null", value == null);
} catch (ResourcesException e) {
fail("Should have returned null");
@@ -178,17 +178,17 @@
locale = new Locale("en","");
assertEquals("en specific value",
"[test] SPECIFIC",
- resources.getString("test.specific", locale, null));
+ resources.getString("test.specific", locale));
locale = new Locale("en", "US");
assertEquals("en_US specific value",
"[test] SPECIFIC",
- resources.getString("test.specific", locale, null));
+ resources.getString("test.specific", locale));
locale = new Locale("fr","");
assertEquals("fr specific value",
"[test] SPECIFIC",
- resources.getString("test.specific", locale, null));
+ resources.getString("test.specific", locale));
}
Modified: jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/TestResources.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/TestResources.java?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/TestResources.java (original)
+++ jakarta/commons/proper/resources/trunk/src/test/org/apache/commons/resources/impl/TestResources.java Mon Dec 5 22:05:19 2005
@@ -1,11 +1,11 @@
/*
- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//resources/src/test/org/apache/commons/resources/impl/TestResources.java,v 1.11 2004/09/07 23:49:47 jmitchell Exp $
+ * $Id$
* $Revision$
* $Date$
*
* ====================================================================
*
- * Copyright 2003-2004 The Apache Software Foundation
+ * Copyright 2003-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.TimeZone;
import org.apache.commons.resources.ResourcesException;
import org.apache.commons.resources.ResourcesKeyException;
@@ -113,24 +112,20 @@
/**
* <p>Return the content for the specified <code>key</code> as an
- * Object, localized based on the specified <code>locale</code>
- * and/or <code>timeZone</code>.</p>
+ * Object, localized based on the specified <code>locale</code>.
+ * </p>
*
* @param key Identifier for the requested content
* @param locale Locale with which to localize retrieval,
* or <code>null</code> for the default Locale
- * @param timeZone TimeZone with which to localize retrieval,
- * or <code>null</code> for the default TimeZone
*
* @exception ResourcesException if an error occurs retrieving or
* returning the requested content
- *
- * @TODO - FIXME - why is locale and timeZone ignored here?
*/
public Object getObject(String key){
- return getObject(key, null, null);
+ return getObject(key, null);
}
- public Object getObject(String key, Locale locale, TimeZone timeZone)
+ public Object getObject(String key, Locale locale)
throws ResourcesException {
Object value = map.get(key);
Modified: jakarta/commons/proper/resources/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/xdocs/changes.xml?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/resources/trunk/xdocs/changes.xml Mon Dec 5 22:05:19 2005
@@ -39,6 +39,10 @@
<body>
<release version="1.0.0" date="(not yet released)" description="Initial Release">
+ <action dev="niallp" type="update" issue="37709">
+ Remove TimeZone from Resources API
+ <i>(Dec 2005)</i>.
+ </action>
<action dev="niallp" type="add" issue="33379" due-to="Anaximandro de Godinho">
Resources Class diagram - added to the
<a href="http://wiki.apache.org/jakarta-commons/ResourcesClassDiagram">Wiki</a>
Modified: jakarta/commons/proper/resources/trunk/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/resources/trunk/xdocs/index.xml?rev=354330&r1=354329&r2=354330&view=diff
==============================================================================
--- jakarta/commons/proper/resources/trunk/xdocs/index.xml (original)
+++ jakarta/commons/proper/resources/trunk/xdocs/index.xml Mon Dec 5 22:05:19 2005
@@ -53,7 +53,7 @@
<li><a href="apidocs/org/apache/commons/resources/Resources.html">Resources</a>
Representation of a set of internationalized resources, which are arbitrary
objects identified by a unique String key and can be accessed for different
- <code>java.util.Locale</code> and <code>java.util.TimeZone</code>.</li>
+ <code>java.util.Locale</code>.</li>
<li><a href="apidocs/org/apache/commons/resources/ResourcesFactory.html">ResourcesFactory</a>
Factory class to configure and instantiate an appropriate
<code>Resources</code> instance.</li>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org