You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/03/17 22:54:17 UTC

svn commit: r924512 - in /myfaces/core/trunk: api/src/main/java/javax/faces/validator/ impl/src/main/java/org/apache/myfaces/util/

Author: lu4242
Date: Wed Mar 17 21:54:17 2010
New Revision: 924512

URL: http://svn.apache.org/viewvc?rev=924512&view=rev
Log:
MYFACES-2613 ExternalSpecifications has an import from javax.validation api, and this one should be optional

Added:
    myfaces/core/trunk/api/src/main/java/javax/faces/validator/_ValidationUtils.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/_ValidationUtils.java
Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/validator/_ExternalSpecifications.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/ExternalSpecifications.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/validator/_ExternalSpecifications.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/validator/_ExternalSpecifications.java?rev=924512&r1=924511&r2=924512&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/validator/_ExternalSpecifications.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/validator/_ExternalSpecifications.java Wed Mar 17 21:54:17 2010
@@ -22,7 +22,6 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.el.ELContext;
-import javax.validation.Validation;
 
 /**
  * <p>
@@ -66,7 +65,7 @@ final class _ExternalSpecifications
                         // Trial-error approach to check for Bean Validation impl existence.
                         // If any Exception occurs here, we assume that Bean Validation is not available.
                         // The cause may be anything, i.e. NoClassDef, config error...
-                        Validation.buildDefaultValidatorFactory().getValidator();
+                        _ValidationUtils.tryBuildDefaultValidatorFactory();
                     }
                     catch (Throwable t)
                     {

Added: myfaces/core/trunk/api/src/main/java/javax/faces/validator/_ValidationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/validator/_ValidationUtils.java?rev=924512&view=auto
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/validator/_ValidationUtils.java (added)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/validator/_ValidationUtils.java Wed Mar 17 21:54:17 2010
@@ -0,0 +1,37 @@
+/*
+ * 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 javax.faces.validator;
+
+import javax.validation.Validation;
+
+/**
+ * Utility class that isolates javax.validation, to prevent ClassNotFoundException
+ * 
+ * @since 2.0
+ * @author Leonardo Uribe (latest modification by $Author: slessard $)
+ * @version $Revision: 696523 $ $Date: 2008-09-24 18:31:37 -0400 (mer., 17 sept. 2008) $
+ */
+final class _ValidationUtils
+{
+
+    public static void tryBuildDefaultValidatorFactory()
+    {
+        Validation.buildDefaultValidatorFactory().getValidator();
+    }
+}

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/ExternalSpecifications.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/ExternalSpecifications.java?rev=924512&r1=924511&r2=924512&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/ExternalSpecifications.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/ExternalSpecifications.java Wed Mar 17 21:54:17 2010
@@ -20,8 +20,8 @@ package org.apache.myfaces.util;
 
 import java.util.logging.Level;
 import java.util.logging.Logger;
+
 import javax.el.ELContext;
-import javax.validation.Validation;
 
 /**
  * <p>
@@ -65,7 +65,7 @@ public final class ExternalSpecification
                         // Trial-error approach to check for Bean Validation impl existence.
                         // If any Exception occurs here, we assume that Bean Validation is not available.
                         // The cause may be anything, i.e. NoClassDef, config error...
-                        Validation.buildDefaultValidatorFactory().getValidator();
+                        _ValidationUtils.tryBuildDefaultValidatorFactory();
                     }
                     catch (Throwable t)
                     {

Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/_ValidationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/_ValidationUtils.java?rev=924512&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/_ValidationUtils.java (added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/_ValidationUtils.java Wed Mar 17 21:54:17 2010
@@ -0,0 +1,37 @@
+/*
+ * 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.util;
+
+import javax.validation.Validation;
+
+/**
+ * Utility class that isolates javax.validation, to prevent ClassNotFoundException
+ * 
+ * @since 2.0
+ * @author Leonardo Uribe (latest modification by $Author: slessard $)
+ * @version $Revision: 696523 $ $Date: 2008-09-24 18:31:37 -0400 (mer., 17 sept. 2008) $
+ */
+final class _ValidationUtils
+{
+
+    public static void tryBuildDefaultValidatorFactory()
+    {
+        Validation.buildDefaultValidatorFactory().getValidator();
+    }
+}