From 7916c117627db0411b35f202f88b2ab6e115361a Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@d688527b-c9ab-4aba-bd8d-4036d912da1d> Date: Fri, 28 Jan 2005 14:10:50 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'MOA-ID-1_20d09'. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/tags/MOA-ID-1_20d09@264 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../egovernment/moa/util/ResourceBundleChain.java | 66 ---------------------- 1 file changed, 66 deletions(-) delete mode 100644 common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java (limited to 'common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java') diff --git a/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java b/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java deleted file mode 100644 index 90b28548a..000000000 --- a/common/src/at/gv/egovernment/moa/util/ResourceBundleChain.java +++ /dev/null @@ -1,66 +0,0 @@ -package at.gv.egovernment.moa.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * A class to chain ResourceBundles. - * - * @author Patrick Peck - * @version $Id$ - */ -public class ResourceBundleChain { - /** Error message indicating the resource is not available. */ - private static final String ERROR_MISSING_RESOURCE = "Missing resource"; - /** The ResourceBundles contained in this chain. */ - private List resourceBundles = new ArrayList(); - - /** - * Add a ResourceBundle to the chain. - * - * @param resourceBundle The ResourceBundle to add. - */ - public void addResourceBundle(ResourceBundle resourceBundle) { - resourceBundles.add(resourceBundle); - } - - /** - * Return the value of the resource. - * - * @param key The key to access the String resource. - * @return The resource value. All the registered ResourceBundles - * are searched in the order in which they have previously been added to this - * ResourceBundleChain. - * @throws MissingResourceException The resource coult not be found in any of - * the bundles. - */ - public String getString(String key) throws MissingResourceException { - MissingResourceException lastException = null; - Iterator iter; - - // handle case where no resource bundles have been added - if (resourceBundles.size() == 0) { - throw new MissingResourceException( - ERROR_MISSING_RESOURCE, - this.getClass().getName(), - key); - } - - // try to find the resource in one of the bundles; if it cannot be found, - // return the exception thrown by the last bundle in the list - for (iter = resourceBundles.iterator(); iter.hasNext();) { - ResourceBundle resourceBundle = (ResourceBundle) iter.next(); - try { - String value = resourceBundle.getString(key); - return value; - } catch (MissingResourceException e) { - lastException = e; - } - } - throw lastException; - } - -} -- cgit v1.2.3