myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r518076 - in /myfaces/core/branches/jsf12/impl/src: main/java/org/apache/myfaces/application/ApplicationImpl.java test/java/org/apache/myfaces/application/ApplicationImplTest.java
Date Wed, 14 Mar 2007 08:58:58 GMT
Author: mbr
Date: Wed Mar 14 01:58:57 2007
New Revision: 518076

URL: http://svn.apache.org/viewvc?view=rev&rev=518076
Log:
createMethodBinding must throw an exception if an invalid expression is used

Modified:
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
    myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/application/ApplicationImplTest.java

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java?view=diff&rev=518076&r1=518075&r2=518076
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
(original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
Wed Mar 14 01:58:57 2007
@@ -836,6 +836,12 @@
     {
         checkNull(reference, "reference");
         checkEmpty(reference, "reference");
+        
+        // TODO: this check should be performed by the expression factory. It is a requirement
of the TCK
+        if(! (reference.startsWith("#{") && reference.endsWith("}")))
+        {
+            throw new ReferenceSyntaxException("Invalid method reference: '" + reference
+ "'");
+        }
 
         if (params == null)
             params = new Class[0];

Modified: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/application/ApplicationImplTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/application/ApplicationImplTest.java?view=diff&rev=518076&r1=518075&r2=518076
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/application/ApplicationImplTest.java
(original)
+++ myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/application/ApplicationImplTest.java
Wed Mar 14 01:58:57 2007
@@ -35,6 +35,7 @@
 import javax.faces.component.UIOutput;
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
+import javax.faces.el.ReferenceSyntaxException;
 
 import junit.framework.TestCase;
 
@@ -56,6 +57,16 @@
     {
         app = new ApplicationImpl(new RuntimeConfig());
         context = new MockFacesContext();
+    }
+    
+    public void testCreateMethodBinding() throws Exception
+    {
+        assertThrowable(ReferenceSyntaxException.class, new TestRunnable() {
+            public void run() throws Throwable
+            {
+                app.createMethodBinding("xxx", null);
+            }
+        });
     }
 
     /**



Mime
View raw message