myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bara...@apache.org
Subject svn commit: r267243 - /myfaces/impl/trunk/src/java/org/apache/myfaces/application/ApplicationImpl.java
Date Fri, 02 Sep 2005 18:21:18 GMT
Author: baranda
Date: Fri Sep  2 11:21:14 2005
New Revision: 267243

URL: http://svn.apache.org/viewcvs?rev=267243&view=rev
Log:
Fixes MYFACES-481. Now a FacesException is thrown when a converter is not created using Application.createConverter(class).
applicationCreateConverterByClassFETest 

Modified:
    myfaces/impl/trunk/src/java/org/apache/myfaces/application/ApplicationImpl.java

Modified: myfaces/impl/trunk/src/java/org/apache/myfaces/application/ApplicationImpl.java
URL: http://svn.apache.org/viewcvs/myfaces/impl/trunk/src/java/org/apache/myfaces/application/ApplicationImpl.java?rev=267243&r1=267242&r2=267243&view=diff
==============================================================================
--- myfaces/impl/trunk/src/java/org/apache/myfaces/application/ApplicationImpl.java (original)
+++ myfaces/impl/trunk/src/java/org/apache/myfaces/application/ApplicationImpl.java Fri Sep
 2 11:21:14 2005
@@ -80,7 +80,7 @@
 
     // components, converters, and validators can be added at runtime--must synchronize
     private final Map _converterIdToClassMap = Collections.synchronizedMap(new HashMap());
-    private final Map _converterClassToClassMap = Collections.synchronizedMap(new HashMap());
+    private final Map _converterClassNameToClassMap = Collections.synchronizedMap(new HashMap());
     private final Map _converterClassNameToConfigurationMap = Collections.synchronizedMap(new
HashMap());
     private final Map _componentClassMap = Collections.synchronizedMap(new HashMap());
     private final Map _validatorClassMap = Collections.synchronizedMap(new HashMap());
@@ -132,7 +132,7 @@
 
     public Iterator getConverterTypes()
     {
-        return _converterClassToClassMap.keySet().iterator();
+        return _converterClassNameToClassMap.keySet().iterator();
     }
 
     public void setDefaultLocale(Locale locale)
@@ -318,7 +318,7 @@
 
         try
         {
-            _converterClassToClassMap.put(targetClass, ClassUtils.simpleClassForName(converterClass));
+            _converterClassNameToClassMap.put(targetClass, converterClass);
             if (log.isTraceEnabled()) log.trace("add Converter for class = " + targetClass
+
                     " converterClass = " + converterClass);
         }
@@ -478,11 +478,11 @@
     private Converter internalCreateConverter(Class targetClass)
     {
         // Locate a Converter registered for the target class itself.
-        Class converterClass = (Class)_converterClassToClassMap.get(targetClass);
+        String converterClassName = (String)_converterClassNameToClassMap.get(targetClass);
 
         //Locate a Converter registered for interfaces that are
         // implemented by the target class (directly or indirectly).
-        if (converterClass == null)
+        if (converterClassName == null)
         {
             Class interfaces[] = targetClass.getInterfaces();
             if (interfaces != null)
@@ -499,10 +499,12 @@
             }
         }
 
-        if (converterClass != null)
+        if (converterClassName != null)
         {
             try
             {
+                Class converterClass = ClassUtils.simpleClassForName(converterClassName);
+                
                 Converter converter = (Converter) converterClass.newInstance();
 
                 setConverterProperties(converterClass, converter);
@@ -511,8 +513,8 @@
             }
             catch (Exception e)
             {
-                log.error("Could not instantiate converter " + converterClass, e);
-                throw new FacesException("Could not instantiate converter: " + converterClass,
e);
+                log.error("Could not instantiate converter " + converterClassName, e);
+                throw new FacesException("Could not instantiate converter: " + converterClassName,
e);
             }
         }
 



Mime
View raw message