felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1187704 - /felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java
Date Sat, 22 Oct 2011 12:29:20 GMT
Author: fmeschbe
Date: Sat Oct 22 12:29:20 2011
New Revision: 1187704

URL: http://svn.apache.org/viewvc?rev=1187704&view=rev
Log:
FELIX-3183 Fail validation if a required value is missing from an attribute

Modified:
    felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java

Modified: felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java
URL: http://svn.apache.org/viewvc/felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java?rev=1187704&r1=1187703&r2=1187704&view=diff
==============================================================================
--- felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java (original)
+++ felix/trunk/metatype/src/main/java/org/apache/felix/metatype/AD.java Sat Oct 22 12:29:20
2011
@@ -56,6 +56,13 @@ public class AD
      */
     public static final String VALIDATE_LESS_THAN_MINIMUM = "%less than minimum";
 
+    /**
+     * The message returned from the {@link #validate(String)} method if the
+     * value is null or cannot be converted to an attribute value and a value
+     * is {@link #isRequired() required} (value is "%missing required value").
+     */
+    public static final String VALIDATE_MISSING = "%missing required value";
+
     private String id;
     private String name;
     private String description;
@@ -174,6 +181,11 @@ public class AD
         Comparable value = convertToType( valueString );
         if ( value == null )
         {
+            if ( isRequired() )
+            {
+                return VALIDATE_MISSING;
+            }
+
             return ""; // accept null value
         }
 



Mime
View raw message