You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2008/11/12 16:02:50 UTC

svn commit: r713392 [1/2] - in /myfaces/extensions/validator/branches/jsf_1.1: component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/ component-support/trinidad-support/src/main/java/org/apache/myfaces/extens...

Author: gpetracek
Date: Wed Nov 12 07:02:48 2008
New Revision: 713392

URL: http://svn.apache.org/viewvc?rev=713392&view=rev
Log:
EXTVAL-26 and EXTVAL-27 validation exception interceptor, label support, reuse jsf required message per default

Added:
    myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/
    myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/DefaultValidationExceptionInterceptor.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/DefaultValidationExceptionInterceptorFactory.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java
Modified:
    myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/WebXmlParameter.java
    myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/RequiredInitializer.java
    myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInfo.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java
    myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
    myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties
    myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/helloWorld.jsp
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ar.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ca.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_es.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_fr.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_it.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_tr.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ar.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ca.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_es.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_fr.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_it.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_tr.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/RequiredStrategy.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/CrossValidationPhaseListener.java
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_ar.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_ca.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_es.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_fr.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_it.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages_tr.properties
    myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/AbstractCrossValidationStrategy.java

Modified: myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/WebXmlParameter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/WebXmlParameter.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/WebXmlParameter.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/WebXmlParameter.java Wed Nov 12 07:02:48 2008
@@ -36,4 +36,7 @@
      */
     static final String DEACTIVATE_CLIENT_SIDE_TRINIDAD_VALIDATION = WebXmlUtils
         .getInitParameter("DEACTIVATE_CLIENT_SIDE_TRINIDAD_VALIDATION");
-}
+
+    static final String DEACTIVATE_TRINIDAD_VALIDATION_EXCEPTION_INTERCEPTOR = WebXmlUtils
+        .getInitParameter("DEACTIVATE_TRINIDAD_VALIDATION_EXCEPTION_INTERCEPTOR");
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/RequiredInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/RequiredInitializer.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/RequiredInitializer.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/initializer/component/RequiredInitializer.java Wed Nov 12 07:02:48 2008
@@ -64,10 +64,10 @@
     protected Boolean isComponentRequired(UIComponent uiComponent)
     {
         //compare with false so true = true or null
-        boolean isReadOnly = !Boolean.FALSE.equals(ReflectionUtils
-            .tryToInvokeMethodOfClassAndMethodName(uiComponent.getClass().getName(), "isReadOnly"));
-        boolean isDisabled = !Boolean.FALSE.equals(ReflectionUtils
-            .tryToInvokeMethodOfClassAndMethodName(uiComponent.getClass().getName(), "isDisabled"));
+        boolean isReadOnly = !Boolean.FALSE.equals(ReflectionUtils.tryToInvokeMethod(
+                uiComponent, ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "isReadOnly")));
+        boolean isDisabled = !Boolean.FALSE.equals(ReflectionUtils.tryToInvokeMethod(
+                uiComponent, ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "isDisabled")));
 
         return !(isReadOnly || isDisabled);
     }

Added: myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java?rev=713392&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/interceptor/TrinidadValidationExceptionInterceptor.java Wed Nov 12 07:02:48 2008
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.trinidad.interceptor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.validator.ValidatorException;
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class TrinidadValidationExceptionInterceptor implements ValidationExceptionInterceptor
+{
+    private static final String TRINIDAD_CORE_INPUT_TEXT
+                                         = "org.apache.myfaces.trinidad.component.core.input.CoreInputText";
+    private static final String TRINIDAD_CORE_INPUT_DATE
+                                         = "org.apache.myfaces.trinidad.component.core.input.CoreInputDate";
+
+    public boolean afterThrowing(UIComponent uiComponent,
+                                 MetaDataEntry metaDataEntry,
+                                 Object convertedObject,
+                                 ValidatorException validatorException)
+    {
+
+        if(processComponent(uiComponent))
+        {
+            FacesMessage facesMessage = validatorException.getFacesMessage();
+
+            String label = getLabel(uiComponent);
+
+            if(label == null)
+            {
+                label = uiComponent.getClientId(FacesContext.getCurrentInstance());
+            }
+
+            //override the label if the annotation provides a label
+            if(metaDataEntry.getProperty(PropertyInformationKeys.LABEL) != null)
+            {
+                label = metaDataEntry.getProperty(PropertyInformationKeys.LABEL, String.class);
+            }
+
+            if(facesMessage.getSummary() != null && facesMessage.getSummary().contains("{0}"))
+            {
+                String newSummary = facesMessage.getSummary().replace("{0}", label);
+                facesMessage.setSummary(newSummary);
+            }
+
+            if(facesMessage.getDetail() != null && facesMessage.getDetail().contains("{0}"))
+            {
+                String newDetail = facesMessage.getDetail().replace("{0}", label);
+                facesMessage.setDetail(newDetail);
+            }
+        }
+        return true;
+    }
+
+    protected boolean processComponent(UIComponent uiComponent)
+    {
+        return TRINIDAD_CORE_INPUT_TEXT.equals(uiComponent.getClass().getName()) ||
+               TRINIDAD_CORE_INPUT_DATE.equals(uiComponent.getClass().getName());
+    }
+
+    private String getLabel(UIComponent uiComponent)
+    {
+        return (String)ReflectionUtils.tryToInvokeMethod(uiComponent,
+                ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "getLabel"));
+    }
+}

Modified: myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/component-support/trinidad-support/src/main/java/org/apache/myfaces/extensions/validator/trinidad/startup/TrinidadModuleStartupListener.java Wed Nov 12 07:02:48 2008
@@ -24,6 +24,7 @@
 import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
 import org.apache.myfaces.extensions.validator.trinidad.initializer.component.TrinidadComponentInitializer;
 import org.apache.myfaces.extensions.validator.trinidad.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.trinidad.interceptor.TrinidadValidationExceptionInterceptor;
 import org.apache.myfaces.extensions.validator.internal.Priority;
 import org.apache.myfaces.extensions.validator.internal.ToDo;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
@@ -48,8 +49,7 @@
     {
         //deactivate default approach
         ExtValContext.getContext().getFactoryFinder()
-            .getFactory(FactoryNames.RENDERKIT_WRAPPER_FACTORY, AbstractRenderKitWrapperFactory.class)
-            .deactivate();
+            .getFactory(FactoryNames.RENDERKIT_WRAPPER_FACTORY, AbstractRenderKitWrapperFactory.class).deactivate();
         
         String deactivateClientSideValidation = WebXmlParameter.DEACTIVATE_CLIENT_SIDE_TRINIDAD_VALIDATION;
 
@@ -57,5 +57,14 @@
         {
             ExtValContext.getContext().addComponentInitializer(new TrinidadComponentInitializer());
         }
+
+        String deactivateTrinidadValidationExceptionInterceptor =
+                WebXmlParameter.DEACTIVATE_TRINIDAD_VALIDATION_EXCEPTION_INTERCEPTOR;
+
+        if(deactivateTrinidadValidationExceptionInterceptor == null ||
+                !deactivateTrinidadValidationExceptionInterceptor.equalsIgnoreCase("true"))
+        {
+            ExtValContext.getContext().addValidationExceptionInterceptor(new TrinidadValidationExceptionInterceptor());
+        }
     }
 }

Modified: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInfo.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInfo.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInfo.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/CustomInfo.java Wed Nov 12 07:02:48 2008
@@ -41,10 +41,12 @@
 
     STARTUP_LISTENER,
     COMPONENT_INITIALIZER,
+    VALIDATION_EXCEPTION_INTERCEPTOR,
 
     MESSAGE_RESOLVER_FACTORY,
     VALIDATION_STRATEGY_FACTORY,
     COMPONENT_INITIALIZER_FACTORY,
+    VALIDATION_EXCEPTION_INTERCEPTOR_FACTORY,
     COMPONENT_META_DATA_EXTRACTOR_FACTORY,
     META_DATA_TRANSFORMER_FACTORY,
 

Modified: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/ExtValContext.java Wed Nov 12 07:02:48 2008
@@ -21,6 +21,8 @@
 import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
 import org.apache.myfaces.extensions.validator.core.initializer.component.DefaultComponentInitializer;
 import org.apache.myfaces.extensions.validator.core.interceptor.RendererInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.DefaultValidationExceptionInterceptor;
 import org.apache.myfaces.extensions.validator.core.recorder.ProcessedInformationRecorder;
 import org.apache.myfaces.extensions.validator.core.factory.FactoryFinder;
 import org.apache.myfaces.extensions.validator.core.factory.DefaultFactoryFinder;
@@ -128,6 +130,11 @@
         DefaultComponentInitializer.addComponentInitializer(componentInitializer);
     }
 
+    public void addValidationExceptionInterceptor(ValidationExceptionInterceptor validationExceptionInterceptor)
+    {
+        DefaultValidationExceptionInterceptor.addComponentInitializer(validationExceptionInterceptor);
+    }
+
     public List<ProcessedInformationRecorder> getProcessedInformationRecorders()
     {
         return processedInformationRecorders;

Modified: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/InformationProviderBean.java Wed Nov 12 07:02:48 2008
@@ -83,6 +83,7 @@
         customizableInfos.put(CustomInfo.VALIDATION_ERROR_MESSAGE_RESOLVER_POSTFIX, "ValidationErrorMessageResolver");
 
         customizableInfos.put(CustomInfo.COMPONENT_INITIALIZER, "ComponentInitializer");
+        customizableInfos.put(CustomInfo.VALIDATION_EXCEPTION_INTERCEPTOR, "ValidationExceptionInterceptor");
 
         customizableInfos.put(CustomInfo.VALIDATION_STRATEGY_TO_MSG_RESOLVER_NAME_MAPPER,
             "ValidationStrategyToMsgResolverNameMapper");
@@ -96,6 +97,8 @@
         customizableInfos.put(CustomInfo.MESSAGE_RESOLVER_FACTORY, "MessageResolverFactory");
         customizableInfos.put(CustomInfo.VALIDATION_STRATEGY_FACTORY, "ValidationStrategyFactory");
         customizableInfos.put(CustomInfo.COMPONENT_INITIALIZER_FACTORY, "ComponentInitializerFactory");
+        customizableInfos.put(CustomInfo.VALIDATION_EXCEPTION_INTERCEPTOR_FACTORY,
+                "ValidationExceptionInterceptorFactory");
         customizableInfos.put(CustomInfo.COMPONENT_META_DATA_EXTRACTOR_FACTORY, "ComponentMetaDataExtractorFactory");
         customizableInfos.put(CustomInfo.META_DATA_TRANSFORMER_FACTORY, "MetaDataTransformerFactory");
 

Modified: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/WebXmlParameter.java Wed Nov 12 07:02:48 2008
@@ -52,6 +52,9 @@
     static final String CUSTOM_COMPONENT_INITIALIZER = WebXmlUtils
         .getInitParameter("CUSTOM_COMPONENT_INITIALIZER");
 
+    static final String CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR = WebXmlUtils
+        .getInitParameter("CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR");
+
     /*
      * name mapper
      */
@@ -82,6 +85,9 @@
     static final String CUSTOM_COMPONENT_INITIALIZER_FACTORY = WebXmlUtils
         .getInitParameter("CUSTOM_COMPONENT_INITIALIZER_FACTORY");
 
+    static final String CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR_FACTORY = WebXmlUtils
+            .getInitParameter("CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR_FACTORY");
+
     /*
      * deactivate
      */

Modified: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/DefaultFactoryFinder.java Wed Nov 12 07:02:48 2008
@@ -24,6 +24,7 @@
 import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
 import org.apache.myfaces.extensions.validator.core.ExtValContext;
 import org.apache.myfaces.extensions.validator.core.CustomInfo;
+import org.apache.myfaces.extensions.validator.core.interceptor.DefaultValidationExceptionInterceptorFactory;
 import org.apache.myfaces.extensions.validator.core.el.DefaultELHelperFactory;
 import org.apache.myfaces.extensions.validator.core.renderkit.DefaultRenderKitWrapperFactory;
 import org.apache.myfaces.extensions.validator.core.initializer.component.DefaultComponentInitializerFactory;
@@ -93,6 +94,10 @@
                 factory = createComponentInitializerFactory();
                 break;
 
+            case VALIDATION_EXCEPTION_INTERCEPTOR_FACTORY:
+                factory = createValidationExceptionInterceptorFactory();
+                break;
+
             case RENDERKIT_WRAPPER_FACTORY:
                 factory = createRenderKitWrapperFactory();
                 break;
@@ -229,6 +234,32 @@
         return factory;
     }
 
+    private Object createValidationExceptionInterceptorFactory()
+    {
+        Object factory = null;
+        List<String> validationExceptionInterceptorFactoryClassNames = new ArrayList<String>();
+
+        validationExceptionInterceptorFactoryClassNames
+                .add(WebXmlParameter.CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR_FACTORY);
+        validationExceptionInterceptorFactoryClassNames
+            .add(ExtValContext.getContext().getInformationProviderBean().get(
+                    CustomInfo.VALIDATION_EXCEPTION_INTERCEPTOR_FACTORY));
+        validationExceptionInterceptorFactoryClassNames
+                .add(DefaultValidationExceptionInterceptorFactory.class.getName());
+
+        for (String className : validationExceptionInterceptorFactoryClassNames)
+        {
+            factory = ClassUtils.tryToInstantiateClassForName(className);
+
+            if (factory != null)
+            {
+                break;
+            }
+        }
+
+        return factory;
+    }
+
     protected Object createRenderKitWrapperFactory()
     {
         return new DefaultRenderKitWrapperFactory();

Modified: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/factory/FactoryNames.java Wed Nov 12 07:02:48 2008
@@ -33,6 +33,7 @@
     MESSAGE_RESOLVER_FACTORY,
     META_DATA_TRANSFORMER_FACTORY,
     COMPONENT_INITIALIZER_FACTORY,
+    VALIDATION_EXCEPTION_INTERCEPTOR_FACTORY,
     RENDERKIT_WRAPPER_FACTORY,
     EL_HELPER_FACTORY
 }

Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/DefaultValidationExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/DefaultValidationExceptionInterceptor.java?rev=713392&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/DefaultValidationExceptionInterceptor.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/DefaultValidationExceptionInterceptor.java Wed Nov 12 07:02:48 2008
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.interceptor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import javax.faces.validator.ValidatorException;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultValidationExceptionInterceptor implements ValidationExceptionInterceptor
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+    private static List<ValidationExceptionInterceptor> validationExceptionInterceptors =
+            new ArrayList<ValidationExceptionInterceptor>();
+
+    public DefaultValidationExceptionInterceptor()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+
+    public boolean afterThrowing(UIComponent uiComponent,
+                                 MetaDataEntry metaDataEntry,
+                                 Object convertedObject,
+                                 ValidatorException validatorException)
+    {
+        boolean result = true;
+
+        for(ValidationExceptionInterceptor validationExceptionInterceptor : validationExceptionInterceptors)
+        {
+            if(!validationExceptionInterceptor
+                    .afterThrowing(uiComponent, metaDataEntry, convertedObject, validatorException))
+            {
+                result = false;
+            }
+
+            if(logger.isTraceEnabled())
+            {
+                logger.trace(
+                        "configureComponent of " + validationExceptionInterceptor.getClass().getName() + " called");
+            }
+        }
+
+        return result;
+    }
+
+    @UsageInformation(UsageCategory.INTERNAL)
+    public static void addComponentInitializer(ValidationExceptionInterceptor validationExceptionInterceptor)
+    {
+        synchronized (DefaultValidationExceptionInterceptor.class)
+        {
+            validationExceptionInterceptors.add(validationExceptionInterceptor);
+        }
+    }
+}

Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/DefaultValidationExceptionInterceptorFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/DefaultValidationExceptionInterceptorFactory.java?rev=713392&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/DefaultValidationExceptionInterceptorFactory.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/DefaultValidationExceptionInterceptorFactory.java Wed Nov 12 07:02:48 2008
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.interceptor;
+
+import org.apache.myfaces.extensions.validator.core.mapper.ClassMappingFactory;
+import org.apache.myfaces.extensions.validator.core.WebXmlParameter;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.CustomInfo;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.ClassUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.component.UIComponent;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
+public class DefaultValidationExceptionInterceptorFactory implements
+        ClassMappingFactory<UIComponent, ValidationExceptionInterceptor>
+{
+    protected final Log logger = LogFactory.getLog(getClass());
+
+    private static Map<String, ValidationExceptionInterceptor> componentToValidationExceptionInterceptorMapping
+        = new HashMap<String, ValidationExceptionInterceptor>();
+    private static List<String> validationExceptionInterceptorClassNames = new ArrayList<String>();
+
+    static
+    {
+        validationExceptionInterceptorClassNames
+            .add(WebXmlParameter.CUSTOM_VALIDATION_EXCEPTION_INTERCEPTOR);
+        validationExceptionInterceptorClassNames
+            .add(ExtValContext.getContext().getInformationProviderBean().get(
+                    CustomInfo.VALIDATION_EXCEPTION_INTERCEPTOR));
+        validationExceptionInterceptorClassNames
+            .add(DefaultValidationExceptionInterceptor.class.getName());
+    }
+
+    public DefaultValidationExceptionInterceptorFactory()
+    {
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(getClass().getName() + " instantiated");
+        }
+    }
+
+    public ValidationExceptionInterceptor create(UIComponent uiComponent)
+    {
+        String componentKey = uiComponent.getClass().getName();
+
+        if (componentToValidationExceptionInterceptorMapping.containsKey(componentKey))
+        {
+            return componentToValidationExceptionInterceptorMapping.get(componentKey);
+        }
+
+        ValidationExceptionInterceptor validationExceptionInterceptor;
+
+        for (String validationExceptionInterceptorName : validationExceptionInterceptorClassNames)
+        {
+            validationExceptionInterceptor =
+                (ValidationExceptionInterceptor)
+                        ClassUtils.tryToInstantiateClassForName(validationExceptionInterceptorName);
+
+            if (validationExceptionInterceptor != null)
+            {
+                componentToValidationExceptionInterceptorMapping.put(componentKey, validationExceptionInterceptor);
+
+                if(logger.isTraceEnabled())
+                {
+                    logger.trace(validationExceptionInterceptor.getClass().getName() + " used for " + componentKey);
+                }
+
+                return validationExceptionInterceptor;
+            }
+        }
+
+        return null;
+    }
+}

Added: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.java?rev=713392&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/ValidationExceptionInterceptor.java Wed Nov 12 07:02:48 2008
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.interceptor;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+
+import javax.faces.component.UIComponent;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * Allows to intercept validatior exceptions.
+ *
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.API)
+public interface ValidationExceptionInterceptor
+{
+    /**
+     *
+     * @param uiComponent the current component
+     * @param metaDataEntry the meta data entry which contains the meta data of the property
+     * @param convertedObject the converted user input
+     * @param validatorException the current exception
+     * @return false to stop throwing the exception
+     */
+    boolean afterThrowing(UIComponent uiComponent,
+                          MetaDataEntry metaDataEntry,
+                          Object convertedObject,
+                          ValidatorException validatorException);
+}

Modified: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/property/PropertyInformationKeys.java Wed Nov 12 07:02:48 2008
@@ -30,4 +30,5 @@
 {
     static final String PROPERTY_DETAILS = "property_details";
     static final String SKIP_VALIDATION = "skip_validation";
+    static final String LABEL = "label";
 }

Modified: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/message/resolver/AbstractValidationErrorMessageResolver.java Wed Nov 12 07:02:48 2008
@@ -42,6 +42,8 @@
 @UsageInformation({UsageCategory.INTERNAL, UsageCategory.CUSTOMIZABLE})
 public abstract class AbstractValidationErrorMessageResolver implements MessageResolver
 {
+    public static final String MISSING_RESOURCE_MARKER = "???";
+
     protected final Log logger = LogFactory.getLog(getClass());
 
     private static String deactivateDefaultConvention = WebXmlParameter.DEACTIVATE_DEFAULT_CONVENTION;
@@ -155,7 +157,7 @@
         }
         catch (MissingResourceException e)
         {
-            return "???" + key + "???";
+            return MISSING_RESOURCE_MARKER + key + MISSING_RESOURCE_MARKER;
         }
     }
 

Modified: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractAnnotationValidationStrategy.java Wed Nov 12 07:02:48 2008
@@ -28,6 +28,7 @@
 import java.lang.annotation.Annotation;
 import java.util.Locale;
 import java.util.MissingResourceException;
+import java.util.ResourceBundle;
 
 /**
  * Provides the ability of message resolving to ValidationStrategies
@@ -38,7 +39,7 @@
 @UsageInformation({UsageCategory.INTERNAL, UsageCategory.REUSE})
 public abstract class AbstractAnnotationValidationStrategy extends AbstractValidatorAdapter
 {
-    protected static final String DETAIL_MESSAGE_KEY_POSTFIX = "_details";
+    protected static final String DETAIL_MESSAGE_KEY_POSTFIX = "_detail";
     private MessageResolver messageResolver;
 
     protected String resolveMessage(String key)
@@ -84,4 +85,17 @@
     {
         this.messageResolver = messageResolver;
     }
+
+    protected ResourceBundle getDefaultFacesMessageBundle()
+    {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        String bundleName = facesContext.getApplication().getMessageBundle();
+
+        if(bundleName == null)
+        {
+            bundleName = FacesMessage.FACES_MESSAGES;
+        }
+
+        return ResourceBundle.getBundle(bundleName, facesContext.getViewRoot().getLocale());
+    }
 }

Modified: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/strategy/AbstractValidatorAdapter.java Wed Nov 12 07:02:48 2008
@@ -19,8 +19,10 @@
 package org.apache.myfaces.extensions.validator.core.validation.strategy;
 
 import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -87,8 +89,7 @@
                 logger.trace("start processAfterValidatorException of " + getClass().getName());
             }
 
-            if (processAfterValidatorException(facesContext, uiComponent,
-                metaDataEntry, convertedObject, e))
+            if (processAfterValidatorException(facesContext, uiComponent, metaDataEntry, convertedObject, e))
             {
                 if(logger.isTraceEnabled())
                 {
@@ -117,10 +118,21 @@
 
     //override if needed
     protected boolean processAfterValidatorException(FacesContext facesContext,
-                                                     UIComponent uiComponent, MetaDataEntry metaDataEntry,
-                                                     Object convertedObject, ValidatorException e)
+                                                     UIComponent uiComponent,
+                                                     MetaDataEntry metaDataEntry,
+                                                     Object convertedObject,
+                                                     ValidatorException validatorException)
     {
-        return true;
+        metaDataEntry.setProperty(PropertyInformationKeys.LABEL, getLabel(facesContext, uiComponent, metaDataEntry));
+
+        return ExtValUtils.executeAfterThrowingInterceptors(
+                uiComponent, metaDataEntry, convertedObject, validatorException);
+    }
+
+    //override if needed
+    protected String getLabel(FacesContext facesContext, UIComponent uiComponent, MetaDataEntry metaDataEntry)
+    {
+        return null;
     }
 
     protected abstract void processValidation(FacesContext facesContext,

Modified: myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/core/src/main/java/org/apache/myfaces/extensions/validator/util/ExtValUtils.java Wed Nov 12 07:02:48 2008
@@ -24,6 +24,7 @@
 import org.apache.myfaces.extensions.validator.core.validation.message.resolver.MessageResolver;
 import org.apache.myfaces.extensions.validator.core.mapper.ClassMappingFactory;
 import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
 import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
 import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
 import org.apache.myfaces.extensions.validator.core.el.ELHelper;
@@ -38,6 +39,7 @@
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
 import java.util.Map;
 
 
@@ -81,6 +83,18 @@
                     .configureComponent(facesContext, uiComponent, metaData);
     }
 
+    public static boolean executeAfterThrowingInterceptors(UIComponent uiComponent,
+                                                        MetaDataEntry metaDataEntry,
+                                                        Object convertedObject,
+                                                        ValidatorException validatorException)
+    {
+        return ((ClassMappingFactory<UIComponent, ValidationExceptionInterceptor>)
+                ExtValContext.getContext().getFactoryFinder()
+                    .getFactory(FactoryNames.VALIDATION_EXCEPTION_INTERCEPTOR_FACTORY, ClassMappingFactory.class))
+                    .create(uiComponent)
+                    .afterThrowing(uiComponent, metaDataEntry, convertedObject, validatorException);
+    }
+
     public static MessageResolver getMessageResolverForValidationStrategy(ValidationStrategy validationStrategy)
     {
         return ((ClassMappingFactory<ValidationStrategy, MessageResolver>)ExtValContext.getContext()

Modified: myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/examples/feature-set_01/src/main/java/org/apache/myfaces/extensions/validator/custom/validation_messages.properties Wed Nov 12 07:02:48 2008
@@ -1,3 +1,3 @@
 # this message bundle is picked up via convention
 repeated_password_required=please retype the password
-repeated_password_required_details=please retype the password
\ No newline at end of file
+repeated_password_required_detail=please retype the password
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/helloWorld.jsp
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/helloWorld.jsp?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/helloWorld.jsp (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/examples/hello_world/src/main/webapp/helloWorld.jsp Wed Nov 12 07:02:48 2008
@@ -10,11 +10,11 @@
               <h:panelGrid columns="3">
                 <h:outputLabel for="first_name" value="First name:"/>
                 <h:inputText id="first_name" value="#{helloWorld.person.firstName}"/>
-                <h:message for="first_name" showSummary="true" showDetail="false"/>
+                <h:message for="first_name" showSummary="false" showDetail="true"/>
 
                 <h:outputLabel for="last_name" value="Last name:"/>
                 <h:inputText id="last_name" value="#{helloWorld.person.lastName}"/>
-                <h:message for="last_name" showSummary="true" showDetail="false"/>
+                <h:message for="last_name" showSummary="false" showDetail="true"/>
 
                 <h:commandButton value="Press me" action="#{helloWorld.send}"/>
                 <h:panelGroup/>

Added: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java?rev=713392&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java (added)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/HtmlCoreComponentsValidationExceptionInterceptor.java Wed Nov 12 07:02:48 2008
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator;
+
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformationKeys;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.1
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public class HtmlCoreComponentsValidationExceptionInterceptor implements ValidationExceptionInterceptor
+{
+    public boolean afterThrowing(UIComponent uiComponent,
+                                 MetaDataEntry metaDataEntry,
+                                 Object convertedObject,
+                                 ValidatorException validatorException)
+    {
+
+        if(uiComponent instanceof HtmlInputText)
+        {
+            FacesMessage facesMessage = validatorException.getFacesMessage();
+
+            //use reflection for easier sync between trunk/branch
+            String label = (String) ReflectionUtils.tryToInvokeMethod(uiComponent,
+                ReflectionUtils.tryToGetMethod(uiComponent.getClass(), "getLabel"));
+
+            if(label == null)
+            {
+                label = uiComponent.getClientId(FacesContext.getCurrentInstance());
+            }
+
+            //override the label if the annotation provides a label
+            if(metaDataEntry.getProperty(PropertyInformationKeys.LABEL) != null)
+            {
+                label = metaDataEntry.getProperty(PropertyInformationKeys.LABEL, String.class);
+            }
+
+            if(facesMessage.getSummary() != null && facesMessage.getSummary().contains("{0}"))
+            {
+                String newSummary = facesMessage.getSummary().replace("{0}", label);
+                facesMessage.setSummary(newSummary);
+            }
+
+            if(facesMessage.getDetail() != null && facesMessage.getDetail().contains("{0}"))
+            {
+                String newDetail = facesMessage.getDetail().replace("{0}", label);
+                facesMessage.setDetail(newDetail);
+            }
+        }
+        return true;
+    }
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/PropertyValidationModuleStartupListener.java Wed Nov 12 07:02:48 2008
@@ -43,7 +43,8 @@
         ExtValContext.getContext().addProcessedInformationRecorder(new CrossValidationUserInputRecorder());
 
         initStaticStrategyMappings();
-        initDefaultComponentInitializerName();
+        initDefaultComponentInitializer();
+        initDefaultValidationExceptionInterceptor();
         addSkipValidationSupport();
     }
 
@@ -63,11 +64,18 @@
     }
 
     @ToDo(value = Priority.MEDIUM, description = "web.xml parameter to deactivate it")
-    private void initDefaultComponentInitializerName()
+    private void initDefaultComponentInitializer()
     {
         ExtValContext.getContext().addComponentInitializer(new HtmlCoreComponentsComponentInitializer());
     }
 
+    @ToDo(value = Priority.MEDIUM, description = "web.xml parameter to deactivate it")
+    private void initDefaultValidationExceptionInterceptor()
+    {
+        ExtValContext.getContext().addValidationExceptionInterceptor(
+                new HtmlCoreComponentsValidationExceptionInterceptor());
+    }
+
     private void addSkipValidationSupport()
     {
         if(logger.isInfoEnabled())

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/annotation/Required.java Wed Nov 12 07:02:48 2008
@@ -36,5 +36,13 @@
 @UsageInformation(UsageCategory.API)
 public @interface Required
 {
+    String label() default "none";
+
+    /**
+     * to customize the error message or
+     * to override the default jsf required message with the usage of the message resolver mechanism
+     *
+     * @return an optional error message key
+     */
     String validationErrorMsgKey() default "field_required";
 }

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=field is required
-field_required_details=field is required
-
 field_too_long=field too long
-field_too_long_details=field too long (max. length: {0})
\ No newline at end of file
+field_too_long_detail=field too long (max. length: {0})
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ar.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ar.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ar.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ar.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=\u0645\u0637\u0644\u0648\u0628 \u0625\u062f\u062e\u0627\u0644 \u0642\u064a\u0645\u0629  \u0644\u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644
-field_required_details=\u0645\u0637\u0644\u0648\u0628 \u0625\u062f\u062e\u0627\u0644 \u0642\u064a\u0645 \u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644
-
 field_too_long = \u0637\u0648\u0644 \u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644 \u062a\u0639 \u062f\u0649 \u0627\u0644\u0642\u064a\u0645\u0629 \u0627\u0644\u0645\u0633\u0645\u0648\u062d \u0628 \u0647\u0627 
-field_too_long_details=\u0637\u0648\u0644 \u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644 \u062a\u0639 \u062f\u0649 \u0627\u0644\u0642\u064a\u0645\u0629 \u0627\u0644\u0645\u0633\u0645\u0648\u062d \u0628 \u0647\u0627 (\u0623\u0642\u0635\u0649 \u0637\u0648\u0644 \u0644\u0644\u062d\u0642\u0644: {0})
\ No newline at end of file
+field_too_long_detail=\u0637\u0648\u0644 \u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644 \u062a\u0639 \u062f\u0649 \u0627\u0644\u0642\u064a\u0645\u0629 \u0627\u0644\u0645\u0633\u0645\u0648\u062d \u0628 \u0647\u0627 (\u0623\u0642\u0635\u0649 \u0637\u0648\u0644 \u0644\u0644\u062d\u0642\u0644: {0})
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ca.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ca.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ca.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_ca.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=Camp requerit
-field_required_details=Camp requerit
-
 field_too_long=Camp massa llarg
-field_too_long_details=Camp massa llarg (m\u00e0x. longitut: {0})
\ No newline at end of file
+field_too_long_detail=Camp massa llarg (m\u00e0x. longitut: {0})
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_es.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_es.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_es.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_es.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=El campo es requerido
-field_required_details=El campo es requerido
-
 field_too_long=El campo es demasiado largo
-field_too_long_details=El campo es demasiado largo (max. longitud: {0})
\ No newline at end of file
+field_too_long_detail=El campo es demasiado largo (max. longitud: {0})
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_fr.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_fr.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_fr.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_fr.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=Ce champ est requis
-field_required_details=Ce champ est requis
-
 field_too_long=Le contenu de ce champ est trop long
-field_too_long_details=Le contenu de ce champ est trop long ({0} caract&egrave;res au maximum)
\ No newline at end of file
+field_too_long_detail=Le contenu de ce champ est trop long ({0} caract&egrave;res au maximum)
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_it.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_it.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_it.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_it.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=Il campo &egrave; obbligatorio
-field_required_details=Il campo &egrave; obbligatorio
-
 field_too_long=Il campo &egrave; troppo lungo
-field_too_long_details=Il campo &egrave; troppo lungo (lunghezza max.: {0})
\ No newline at end of file
+field_too_long_detail=Il campo &egrave; troppo lungo (lunghezza max.: {0})
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_tr.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_tr.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_tr.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/jpa_messages_tr.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=alan zorunludur
-field_required_details=alan zorunludur
-
 field_too_long=de\u011fer \u00e7ok uzun
-field_too_long_details=de\u011fer \u00e7ok uzun (maks. uzunluk: {0})
\ No newline at end of file
+field_too_long_detail=de\u011fer \u00e7ok uzun (maks. uzunluk: {0})
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=field is required
-field_required_details=field is required
-
-no_match=invalid format
-no_match_details=the required formate is: {0}
\ No newline at end of file
+no_match=Invalid format
+no_match_detail=The required formate is: {0}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ar.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ar.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ar.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ar.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=\u0645\u0637\u0644\u0648\u0628 \u0625\u062f\u062e\u0627\u0644 \u0642\u064a\u0645\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644
-field_required_details=\u0645\u0637\u0644\u0648\u0628 \u0625\u062f\u062e\u0627\u0644 \u0642\u064a\u0645\u0629 \u0644\u0647\u0630\u0627 \u0627\u0644\u062d\u0642\u0644
-
 no_match=\u0627\u0644\u0635\u064a\u063a\u0629 \u062e\u0627\u0637\u0626\u0629
-no_match_details=\u0627\u0644\u0635\u064a\u063a\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629 \u0647\u0649: {0}
\ No newline at end of file
+no_match_detail=\u0627\u0644\u0635\u064a\u063a\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629 \u0647\u0649: {0}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ca.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ca.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ca.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_ca.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=Camp requerit
-field_required_details=Camp requerit
-
 no_match=Format inv\u00e0lid
-no_match_details=El format requerit \u00e9s: {0}
\ No newline at end of file
+no_match_detail=El format requerit \u00e9s: {0}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_es.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_es.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_es.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_es.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=El campo es requerido
-field_required_details=El campo es requerido
-
 no_match=Formato inv\u00e1lido 
-no_match_details=El formato requerido es: {0}
\ No newline at end of file
+no_match_detail=El formato requerido es: {0}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_fr.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_fr.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_fr.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_fr.properties Wed Nov 12 07:02:48 2008
@@ -15,9 +15,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=Ce champ est requis
-field_required_details=Ce champ est requis
-
 no_match=Le format est invalide
-no_match_details=Le format doit &ecirc;tre de la forme: {0}
+no_match_detail=Le format doit &ecirc;tre de la forme: {0}
 

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_it.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_it.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_it.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_it.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=Il campo &egrave; obbligatorio
-field_required_details=Il campo &egrave; obbligatorio
-
 no_match=Formato non valido
-no_match_details=Il formato richiesto &egrave;: {0}
\ No newline at end of file
+no_match_detail=Il formato richiesto &egrave;: {0}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_tr.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_tr.properties?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_tr.properties (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/message/bundle/validation_messages_tr.properties Wed Nov 12 07:02:48 2008
@@ -15,8 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 
-field_required=alan zorunludur
-field_required_details=alan zorunludur
-
-no_match=ge\u00e7ersiz bi\u00e7im
-no_match_details=gereken bi\u00e7im: {0}
\ No newline at end of file
+no_match=Ge\u00e7ersiz bi\u00e7im
+no_match_detail=gereken bi\u00e7im: {0}
\ No newline at end of file

Modified: myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java?rev=713392&r1=713391&r2=713392&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java (original)
+++ myfaces/extensions/validator/branches/jsf_1.1/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/baseval/strategy/JpaValidationStrategy.java Wed Nov 12 07:02:48 2008
@@ -21,6 +21,7 @@
 import org.apache.myfaces.extensions.validator.core.metadata.CommonMetaDataKeys;
 import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
 import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractAnnotationValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.AbstractValidationErrorMessageResolver;
 import org.apache.myfaces.extensions.validator.internal.Priority;
 import org.apache.myfaces.extensions.validator.internal.ToDo;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
@@ -29,12 +30,14 @@
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.validator.ValidatorException;
+import javax.faces.application.FacesMessage;
 import javax.persistence.Basic;
 import javax.persistence.Column;
 import javax.persistence.ManyToOne;
 import javax.persistence.OneToOne;
 import javax.persistence.Id;
 import java.lang.annotation.Annotation;
+import java.util.MissingResourceException;
 
 /**
  * @author Gerhard Petracek
@@ -43,6 +46,9 @@
 @UsageInformation(UsageCategory.INTERNAL)
 public class JpaValidationStrategy extends AbstractAnnotationValidationStrategy
 {
+    private boolean useFacesBundle = false;
+    private static final String JAVAX_FACES_REQUIRED = "javax.faces.component.UIInput.REQUIRED";
+    private static final String JAVAX_FACES_REQUIRED_DETAIL = "javax.faces.component.UIInput.REQUIRED_detail";
 
     private static final String VALIDATE_LENGTH = "length";
 
@@ -50,8 +56,9 @@
     private int maxLength;
 
     public void processValidation(FacesContext facesContext,
-            UIComponent uiComponent, MetaDataEntry metaDataEntry,
-            Object convertedObject) throws ValidatorException
+                                  UIComponent uiComponent,
+                                  MetaDataEntry metaDataEntry,
+                                  Object convertedObject) throws ValidatorException
     {
         Annotation annotation = metaDataEntry.getValue(Annotation.class);
         if (annotation instanceof Column)
@@ -156,4 +163,52 @@
             return message;
         }
     }
+
+    @Override
+    protected String resolveMessage(String key)
+    {
+        String result = super.resolveMessage(key);
+        String marker = AbstractValidationErrorMessageResolver.MISSING_RESOURCE_MARKER;
+
+        if((marker + key + marker).equals(result))
+        {
+            this.useFacesBundle = true;
+        }
+
+        return result;
+    }
+
+    @Override
+    protected boolean processAfterValidatorException(FacesContext facesContext,
+                                                     UIComponent uiComponent,
+                                                     MetaDataEntry metaDataEntry,
+                                                     Object convertedObject,
+                                                     ValidatorException e)
+    {
+        FacesMessage facesMessage = e.getFacesMessage();
+
+        if(this.useFacesBundle && !VALIDATE_LENGTH.equals(this.violation))
+        {
+            String facesRequiredMessage = getDefaultFacesMessageBundle().getString(JAVAX_FACES_REQUIRED);
+            String facesRequiredMessageDetail = facesRequiredMessage;
+
+            //use try/catch for easier sync between trunk/branch
+            try
+            {
+                if(getDefaultFacesMessageBundle().getString(JAVAX_FACES_REQUIRED_DETAIL) != null)
+                {
+                    facesRequiredMessageDetail = getDefaultFacesMessageBundle().getString(JAVAX_FACES_REQUIRED_DETAIL);
+                }
+            }
+            catch (MissingResourceException missingResourceException)
+            {
+                //jsf 1.2 doesn't have a detail message
+            }
+
+            facesMessage.setSummary(facesRequiredMessage);
+            facesMessage.setDetail(facesRequiredMessageDetail);
+        }
+
+        return super.processAfterValidatorException(facesContext, uiComponent, metaDataEntry, convertedObject, e);
+    }
 }