You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/10/06 14:16:15 UTC

svn commit: r453569 - /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/bean/ResourceMap.java

Author: weber
Date: Fri Oct  6 05:16:14 2006
New Revision: 453569

URL: http://svn.apache.org/viewvc?view=rev&rev=453569
Log:
TOBAGO-147 (ResourceMap don't work from faces-config.xml with myfaces impl)

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/bean/ResourceMap.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/bean/ResourceMap.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/bean/ResourceMap.java?view=diff&rev=453569&r1=453568&r2=453569
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/bean/ResourceMap.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/bean/ResourceMap.java Fri Oct  6 05:16:14 2006
@@ -38,8 +38,7 @@
     }
   }
 
-  public void setFilename(String filename) throws IOException {
-//    String filename = "de/inexso/erm/ui/image.properties";
+  public void setFilename(String filename) {
     if (LOG.isDebugEnabled()) {
       LOG.debug("filename = '" + filename + "'");
     }
@@ -52,15 +51,30 @@
     } catch (IOException e) {
       LOG.error("Cannot load resource map from file: " + filename, e);
     }
-    for (Object x : keySet()) {
-      LOG.debug(x);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("size() = \"" + size() + "\"");
+      for (Object x : keySet()) {
+        LOG.debug(x);
+      }
+    }
+  }
+
+  // setFilename() is never called with myfaces implementation,
+  // because we implement Map. This hotfix enables filename setting via put().
+  public Object put(Object key, Object value) {
+    if ("filename".equals(key)) {
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("put(\"filename\", \"" + value + "\")");
+      }
+      setFilename(value.toString());
     }
+    return super.put(key, value);
   }
 
   public Object get(Object key) {
     Object value = super.get(key);
     if (LOG.isDebugEnabled()) {
-      LOG.debug("Unknown value for key='" + key + "'");
+      LOG.debug("Query value for key='" + key + "' -> '" + value + "'");
     }
     if (value == null) {
       LOG.warn("Unknown value for key='" + key + "'");