This is an automated email from the ASF dual-hosted git repository.

rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bval.git


The following commit(s) were added to refs/heads/master by this push:
     new 847d23e  BVAL-170 no need to test #{ in DefaultMessageInterpolator
847d23e is described below

commit 847d23e4f6ad313b2e7a8077631e79485e61be49
Author: Romain Manni-Bucau <[email protected]>
AuthorDate: Sun Feb 17 11:50:48 2019 +0100

    BVAL-170 no need to test #{ in DefaultMessageInterpolator
---
 bval-jsr/pom.xml                                   |  2 +-
 .../src/main/java/org/apache/bval/el/ELFacade.java | 28 ++++++++++------------
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/bval-jsr/pom.xml b/bval-jsr/pom.xml
index 2021ee4..7f12bbc 100644
--- a/bval-jsr/pom.xml
+++ b/bval-jsr/pom.xml
@@ -255,7 +255,7 @@
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>jaxb2-maven-plugin</artifactId>
-                <version>2.3.1</version>
+                <version>2.4</version>
                 <executions>
                     <execution>
                         <goals>
diff --git a/bval-jsr/src/main/java/org/apache/bval/el/ELFacade.java 
b/bval-jsr/src/main/java/org/apache/bval/el/ELFacade.java
index e1c96c1..acdf5e0 100644
--- a/bval-jsr/src/main/java/org/apache/bval/el/ELFacade.java
+++ b/bval-jsr/src/main/java/org/apache/bval/el/ELFacade.java
@@ -62,22 +62,20 @@ public final class ELFacade implements MessageEvaluator {
     public String interpolate(final String message, final Map<String, Object> 
annotationParameters,
         final Object validatedValue) {
         // BVAL-170: simple pre-check to improve performance
-        if (message.contains("${") || message.contains("#{")) {
+        if (message.contains("${")) {
             try {
-                if (EvaluationType.IMMEDIATE.regex.matcher(message).find()) {
-                    final BValELContext context = new BValELContext();
-                    final VariableMapper variables = 
context.getVariableMapper();
-                    annotationParameters.forEach(
-                        (k, v) -> variables.setVariable(k, 
expressionFactory.createValueExpression(v, Object.class)));
-    
-                    variables.setVariable("validatedValue",
-                        
expressionFactory.createValueExpression(validatedValue, Object.class));
-    
-                    // Java Bean Validation does not support EL expressions 
that look like JSP "deferred" expressions
-                    return expressionFactory.createValueExpression(context,
-                        
EvaluationType.DEFERRED.regex.matcher(message).replaceAll("\\$0"), 
String.class).getValue(context)
-                        .toString();
-                }
+                final BValELContext context = new BValELContext();
+                final VariableMapper variables = context.getVariableMapper();
+                annotationParameters.forEach(
+                    (k, v) -> variables.setVariable(k, 
expressionFactory.createValueExpression(v, Object.class)));
+
+                variables.setVariable("validatedValue",
+                    expressionFactory.createValueExpression(validatedValue, 
Object.class));
+
+                // Java Bean Validation does not support EL expressions that 
look like JSP "deferred" expressions
+                return expressionFactory.createValueExpression(context,
+                    
EvaluationType.DEFERRED.regex.matcher(message).replaceAll("\\$0"), 
String.class).getValue(context)
+                    .toString();
             } catch (final Exception e) {
                 // no-op
             }

Reply via email to