You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dg...@apache.org on 2003/09/22 02:41:35 UTC
cvs commit: jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl WebappXMLResourcesFactory.java WebappPropertyResourcesFactory.java WebappXMLResources.java ResourceBundleResources.java ResourceBundleResourcesFactory.java XMLResources.java WebappPropertyResources.java XMLResourcesFactory.java PropertyResourcesFactory.java CollectionResourcesBase.java
dgraham 2003/09/21 17:41:35
Modified: resources/src/java/org/apache/commons/resources/impl
WebappXMLResourcesFactory.java
WebappPropertyResourcesFactory.java
WebappXMLResources.java
ResourceBundleResources.java
ResourceBundleResourcesFactory.java
XMLResources.java WebappPropertyResources.java
XMLResourcesFactory.java
PropertyResourcesFactory.java
CollectionResourcesBase.java
Log:
Fixed unused imports, changed log variables to private.
Revision Changes Path
1.5 +4 -5 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/WebappXMLResourcesFactory.java
Index: WebappXMLResourcesFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/WebappXMLResourcesFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WebappXMLResourcesFactory.java 8 Sep 2003 18:39:12 -0000 1.4
+++ WebappXMLResourcesFactory.java 22 Sep 2003 00:41:35 -0000 1.5
@@ -67,7 +67,6 @@
import org.apache.commons.resources.Resources;
import org.apache.commons.resources.ResourcesException;
-import org.apache.commons.resources.ResourcesFactory;
/**
1.5 +4 -5 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/WebappPropertyResourcesFactory.java
Index: WebappPropertyResourcesFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/WebappPropertyResourcesFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WebappPropertyResourcesFactory.java 8 Sep 2003 18:41:01 -0000 1.4
+++ WebappPropertyResourcesFactory.java 22 Sep 2003 00:41:35 -0000 1.5
@@ -67,7 +67,6 @@
import org.apache.commons.resources.Resources;
import org.apache.commons.resources.ResourcesException;
-import org.apache.commons.resources.ResourcesFactory;
/**
1.5 +9 -14 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/WebappXMLResources.java
Index: WebappXMLResources.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/WebappXMLResources.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WebappXMLResources.java 8 Sep 2003 18:39:12 -0000 1.4
+++ WebappXMLResources.java 22 Sep 2003 00:41:35 -0000 1.5
@@ -75,7 +75,6 @@
import org.apache.commons.digester.Digester;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.commons.resources.Resources;
import org.xml.sax.SAXException;
@@ -103,7 +102,11 @@
public class WebappXMLResources extends CollectionResourcesBase {
-
+ /**
+ * <p>The <code>Log</code> instance for this class.</p>
+ */
+ private static final Log log = LogFactory.getLog(WebappXMLResources.class);
+
// ----------------------------------------------------------- Constructors
@@ -127,14 +130,6 @@
// ----------------------------------------------------- Instance Variables
-
-
- /**
- * <p>The <code>Log</code> instance for this class.</p>
- */
- protected static final Log log =
- LogFactory.getLog(XMLResources.class);
-
/**
* <p>The <code>ServletContext</code> instance for resolving
1.10 +17 -18 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/ResourceBundleResources.java
Index: ResourceBundleResources.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/ResourceBundleResources.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ResourceBundleResources.java 8 Sep 2003 18:41:01 -0000 1.9
+++ ResourceBundleResources.java 22 Sep 2003 00:41:35 -0000 1.10
@@ -59,10 +59,8 @@
*
*/
-
package org.apache.commons.resources.impl;
-
import java.io.InputStream;
import java.io.Reader;
import java.util.Collections;
@@ -79,11 +77,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.commons.resources.Resources;
import org.apache.commons.resources.ResourcesException;
import org.apache.commons.resources.ResourcesKeyException;
-
/**
* <p>Concrete implementation of {@link Resources} that wraps a set
* (one per Locale) of <code>java.util.ResourceBundle</code> instances
@@ -93,9 +89,13 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
-
public class ResourceBundleResources extends ResourcesBase {
+ /**
+ * <p>The logging instance for this class.</p>
+ */
+ private static final Log log =
+ LogFactory.getLog(ResourceBundleResources.class);
// ----------------------------------------------------------- Constructors
@@ -137,13 +137,6 @@
protected Map bundles = new HashMap();
- /**
- * <p>The logging instance for this class.</p>
- */
- protected static Log log =
- LogFactory.getLog(ResourceBundleResources.class);
-
-
// ------------------------------------------------------ Lifecycle Methods
@@ -176,6 +169,7 @@
if (log.isDebugEnabled()) {
log.debug("Finalizing for base name '" + base + "'");
}
+
synchronized (bundles) {
Iterator loaders = bundles.keySet().iterator();
while (loaders.hasNext()) {
@@ -304,6 +298,7 @@
try {
ResourceBundle bundle = getBundle(locale, timeZone);
return (bundle.getObject(key));
+
} catch (MissingResourceException e) {
if (isReturnNull()) {
return (null);
@@ -362,6 +357,7 @@
log.trace("Retrieving message for key '" + key + "' for locale '"
+ locale + "'");
}
+
try {
ResourceBundle bundle = getBundle(locale, timeZone);
String message = bundle.getString(key);
@@ -369,8 +365,10 @@
log.trace("Retrieved message is '" + message + "'");
}
return (message);
+
} catch (ClassCastException e) {
throw new ResourcesException(e);
+
} catch (MissingResourceException e) {
if (log.isTraceEnabled()) {
log.trace("No message found");
@@ -444,11 +442,12 @@
*/
protected ClassLoader getClassLoader() {
- ClassLoader loader =
- Thread.currentThread().getContextClassLoader();
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
if (loader == null) {
loader = this.getClass().getClassLoader();
}
+
return (loader);
}
1.8 +4 -5 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/ResourceBundleResourcesFactory.java
Index: ResourceBundleResourcesFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/ResourceBundleResourcesFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ResourceBundleResourcesFactory.java 8 Sep 2003 18:40:00 -0000 1.7
+++ ResourceBundleResourcesFactory.java 22 Sep 2003 00:41:35 -0000 1.8
@@ -65,7 +65,6 @@
import org.apache.commons.resources.Resources;
import org.apache.commons.resources.ResourcesException;
-import org.apache.commons.resources.ResourcesFactory;
/**
1.5 +8 -20 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/XMLResources.java
Index: XMLResources.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/XMLResources.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLResources.java 21 Jul 2003 04:57:22 -0000 1.4
+++ XMLResources.java 22 Sep 2003 00:41:35 -0000 1.5
@@ -59,10 +59,8 @@
*
*/
-
package org.apache.commons.resources.impl;
-
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -74,10 +72,8 @@
import org.apache.commons.digester.Digester;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.commons.resources.Resources;
import org.xml.sax.SAXException;
-
/**
* <p>Concrete implementation of {@link Resources} that wraps a family
* (one per <code>Locale</code> of XML documents that share a base URL
@@ -108,9 +104,12 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
-
public class XMLResources extends CollectionResourcesBase {
+ /**
+ * <p>The <code>Log</code> instance for this class.</p>
+ */
+ private static final Log log = LogFactory.getLog(XMLResources.class);
// ----------------------------------------------------------- Constructors
@@ -124,19 +123,8 @@
* the resource keys and values
*/
public XMLResources(String name, String base) {
-
super(name, base);
-
}
-
-
- // ----------------------------------------------------- Instance Variables
-
-
- /**
- * <p>The <code>Log</code> instance for this class.</p>
- */
- protected static final Log log = LogFactory.getLog(XMLResources.class);
// ------------------------------------------------------ Protected Methods
1.5 +9 -16 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/WebappPropertyResources.java
Index: WebappPropertyResources.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/WebappPropertyResources.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WebappPropertyResources.java 21 Jul 2003 04:57:21 -0000 1.4
+++ WebappPropertyResources.java 22 Sep 2003 00:41:35 -0000 1.5
@@ -59,10 +59,8 @@
*
*/
-
package org.apache.commons.resources.impl;
-
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -74,8 +72,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.commons.resources.Resources;
-
/**
* <p>Concrete implementation of {@link Resources} that wraps a family
@@ -98,9 +94,13 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
-
public class WebappPropertyResources extends CollectionResourcesBase {
+ /**
+ * <p>The <code>Log</code> instance for this class.</p>
+ */
+ private static final Log log =
+ LogFactory.getLog(WebappPropertyResources.class);
// ----------------------------------------------------------- Constructors
@@ -125,13 +125,6 @@
// ----------------------------------------------------- Instance Variables
-
-
- /**
- * <p>The <code>Log</code> instance for this class.</p>
- */
- protected static final Log log =
- LogFactory.getLog(PropertyResources.class);
/**
1.5 +4 -12 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/XMLResourcesFactory.java
Index: XMLResourcesFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/XMLResourcesFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XMLResourcesFactory.java 8 Sep 2003 18:39:12 -0000 1.4
+++ XMLResourcesFactory.java 22 Sep 2003 00:41:35 -0000 1.5
@@ -59,14 +59,10 @@
*
*/
-
package org.apache.commons.resources.impl;
-
import org.apache.commons.resources.Resources;
import org.apache.commons.resources.ResourcesException;
-import org.apache.commons.resources.ResourcesFactory;
-
/**
* <p>Concrete implementation of {@link ResourcesFactory} that creates
@@ -88,11 +84,7 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
-
public class XMLResourcesFactory extends ResourcesFactoryBase {
-
-
- // --------------------------------------------------------- Public Methods
// ------------------------------------------------------ Protected Methods
1.5 +4 -12 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/PropertyResourcesFactory.java
Index: PropertyResourcesFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/PropertyResourcesFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PropertyResourcesFactory.java 8 Sep 2003 18:40:00 -0000 1.4
+++ PropertyResourcesFactory.java 22 Sep 2003 00:41:35 -0000 1.5
@@ -59,14 +59,10 @@
*
*/
-
package org.apache.commons.resources.impl;
-
import org.apache.commons.resources.Resources;
import org.apache.commons.resources.ResourcesException;
-import org.apache.commons.resources.ResourcesFactory;
-
/**
* <p>Concrete implementation of {@link ResourcesFactory} that creates
@@ -88,11 +84,7 @@
* @author Craig R. McClanahan
* @version $Revision$ $Date$
*/
-
public class PropertyResourcesFactory extends ResourcesFactoryBase {
-
-
- // --------------------------------------------------------- Public Methods
// ------------------------------------------------------ Protected Methods
1.7 +5 -5 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/CollectionResourcesBase.java
Index: CollectionResourcesBase.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/CollectionResourcesBase.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CollectionResourcesBase.java 17 Aug 2003 03:34:14 -0000 1.6
+++ CollectionResourcesBase.java 22 Sep 2003 00:41:35 -0000 1.7
@@ -72,7 +72,7 @@
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
-import org.apache.commons.resources.Resources;
+
import org.apache.commons.resources.ResourcesException;
import org.apache.commons.resources.ResourcesKeyException;
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org