[seam-commits] Seam SVN: r14131 - in branches/enterprise/JBPAPP_4_3_FP01: src/main/org/jboss/seam and 3 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Jul 19 07:48:38 EDT 2011


Author: manaRH
Date: 2011-07-19 07:48:37 -0400 (Tue, 19 Jul 2011)
New Revision: 14131

Modified:
   branches/enterprise/JBPAPP_4_3_FP01/build/default.build.properties
   branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/blacklist.properties
   branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/core/Expressions.java
   branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/exception/ErrorHandler.java
   branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/exception/RedirectHandler.java
   branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/faces/Navigator.java
Log:
JBPAPP-6853 backporting fix for EL expr. interpolation in FacesMessages

Modified: branches/enterprise/JBPAPP_4_3_FP01/build/default.build.properties
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/build/default.build.properties	2011-07-19 11:19:02 UTC (rev 14130)
+++ branches/enterprise/JBPAPP_4_3_FP01/build/default.build.properties	2011-07-19 11:48:37 UTC (rev 14131)
@@ -8,7 +8,7 @@
 major.version 2
 minor.version .0
 patchlevel .2
-qualifier -FP
+qualifier -FP_SEC1
 #
 # Other program locations
 # -----------------------

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/blacklist.properties
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/blacklist.properties	2011-07-19 11:19:02 UTC (rev 14130)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/blacklist.properties	2011-07-19 11:48:37 UTC (rev 14131)
@@ -1,4 +1,5 @@
-.getClass()
+.class.
+.getClass(
 .addRole(
 .getPassword(
 .removeRole(
\ No newline at end of file

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/core/Expressions.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/core/Expressions.java	2011-07-19 11:19:02 UTC (rev 14130)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/core/Expressions.java	2011-07-19 11:48:37 UTC (rev 14131)
@@ -10,6 +10,7 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.regex.Pattern;
 
 import javax.el.ELContext;
 import javax.el.ExpressionFactory;
@@ -299,18 +300,28 @@
       return (Expressions) Component.getInstance(Expressions.class, ScopeType.APPLICATION);
    }
 
+   // optimalization of REGEX
+   final static String WHITESPACE_REGEX_STRING = "\\s";
+   final static Pattern WHITESPACE_REGEX_PATTERN = Pattern.compile(WHITESPACE_REGEX_STRING);
+   
    private static void checkELExpression(final String expression)
    {
+      if (expression == null)
+      {
+         return;
+      }
+      
+      final String expressionTrimmed = WHITESPACE_REGEX_PATTERN.matcher(expression).replaceAll("");
+      
       for (int index = 0; blacklist.size() > index; index++)
       {
-         if ( expression.contains(blacklist.get(index)) ) 
-         {
+         if ( expressionTrimmed.contains(blacklist.get(index)) ) {
             throw new IllegalArgumentException("This EL expression is not allowed!");
          }
       }
-   
+      
       // for any case blacklist is not provided this is definitely not permitted
-      if ( expression.contains(".getClass()") )
+      if ( expressionTrimmed.contains(".getClass(") ||  expressionTrimmed.contains(".class.") )
       {
          throw new IllegalArgumentException("This EL expression is not allowed!");
       }

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/exception/ErrorHandler.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/exception/ErrorHandler.java	2011-07-19 11:19:02 UTC (rev 14130)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/exception/ErrorHandler.java	2011-07-19 11:48:37 UTC (rev 14131)
@@ -2,7 +2,6 @@
 
 import org.jboss.seam.contexts.Contexts;
 import org.jboss.seam.core.Conversation;
-import org.jboss.seam.core.Interpolator;
 
 /**
  * Base implementation of HTTP error exception handlers.
@@ -25,8 +24,7 @@
          Conversation.instance().end();
       }
       
-      String msg = getDisplayMessage( e, getMessage(e) );
-      msg = msg==null ? null : Interpolator.instance().interpolate(msg);
+      String msg = getDisplayMessage( e, getMessage(e) );      
       error( getCode(e), msg );
    }
 

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/exception/RedirectHandler.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/exception/RedirectHandler.java	2011-07-19 11:19:02 UTC (rev 14130)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/exception/RedirectHandler.java	2011-07-19 11:48:37 UTC (rev 14131)
@@ -39,7 +39,7 @@
          viewId = servletPath.substring(0, servletPath.lastIndexOf('.')) + Pages.getSuffix();
       }
       
-      addFacesMessage( getDisplayMessage(e, getMessage(e)), getMessageSeverity(e), null, e );
+      addFacesMessage( "#0", getMessageSeverity(e), null, getDisplayMessage(e, getMessage(e)));
       
       if ( Contexts.isConversationContextActive() && isEnd(e) ) 
       {

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/faces/Navigator.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/faces/Navigator.java	2011-07-19 11:19:02 UTC (rev 14130)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/faces/Navigator.java	2011-07-19 11:48:37 UTC (rev 14131)
@@ -7,6 +7,7 @@
 import javax.faces.context.FacesContext;
 
 import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Interpolator;
 import org.jboss.seam.log.LogProvider;
 import org.jboss.seam.log.Logging;
 import org.jboss.seam.navigation.Pages;
@@ -74,7 +75,7 @@
       }
       else
       {
-         return message;
+         return Interpolator.instance().interpolate(message, e);         
       }
    }
    



More information about the seam-commits mailing list