You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2010/07/21 22:38:03 UTC

svn commit: r966406 - /xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java

Author: mrglavas
Date: Wed Jul 21 20:38:03 2010
New Revision: 966406

URL: http://svn.apache.org/viewvc?rev=966406&view=rev
Log:
Fixing JIRA Issue #1459: https://issues.apache.org/jira/browse/XERCESJ-1459. xs:anySimpleType and xs:anyAtomicType have no facets but we were reporting that they had a whitespace facet.

Modified:
    xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java

Modified: xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=966406&r1=966405&r2=966406&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java Wed Jul 21 20:38:03 2010
@@ -2127,12 +2127,19 @@ public class XSSimpleTypeDecl implements
      * @return  True if the facet is defined, false otherwise.
      */
     public boolean isDefinedFacet(short facetName) {
-        if ((fFacetsDefined & facetName) != 0)
+        if (fValidationDV == DV_ANYSIMPLETYPE ||
+            fValidationDV == DV_ANYATOMICTYPE) {
+            return false;
+        }
+        if ((fFacetsDefined & facetName) != 0) {
             return true;
-        if (fPatternType != SPECIAL_PATTERN_NONE)
+        }
+        if (fPatternType != SPECIAL_PATTERN_NONE) {
             return facetName == FACET_PATTERN;
-        if (fValidationDV == DV_INTEGER)
+        }
+        if (fValidationDV == DV_INTEGER) {
             return facetName == FACET_PATTERN || facetName == FACET_FRACTIONDIGITS;
+        }
         return false;
     }
 
@@ -2141,10 +2148,16 @@ public class XSSimpleTypeDecl implements
      * combination of FACET_XXX constants of all defined facets.
      */
     public short getDefinedFacets() {
-        if (fPatternType != SPECIAL_PATTERN_NONE)
+        if (fValidationDV == DV_ANYSIMPLETYPE ||
+            fValidationDV == DV_ANYATOMICTYPE) {
+            return FACET_NONE;
+        }
+        if (fPatternType != SPECIAL_PATTERN_NONE) {
             return (short)(fFacetsDefined | FACET_PATTERN);
-        if (fValidationDV == DV_INTEGER)
+        }
+        if (fValidationDV == DV_INTEGER) {
             return (short)(fFacetsDefined | FACET_PATTERN | FACET_FRACTIONDIGITS);
+        }
         return fFacetsDefined;
     }
 
@@ -2192,6 +2205,10 @@ public class XSSimpleTypeDecl implements
             case FACET_MAXLENGTH:
                 return (fMaxLength == -1)?null:Integer.toString(fMaxLength);
             case FACET_WHITESPACE:
+                if (fValidationDV == DV_ANYSIMPLETYPE ||
+                    fValidationDV == DV_ANYATOMICTYPE) {
+                    return null;
+                }
                 return WS_FACET_STRING[fWhiteSpace];
             case FACET_MAXINCLUSIVE:
                 return (fMaxInclusive == null)?null:fMaxInclusive.toString();
@@ -3011,7 +3028,9 @@ public class XSSimpleTypeDecl implements
 
             XSFacetImpl[] facets = new XSFacetImpl[10];
             int count = 0;
-            if ((fFacetsDefined & FACET_WHITESPACE) != 0) {
+            if ((fFacetsDefined & FACET_WHITESPACE) != 0 &&
+                fValidationDV != DV_ANYSIMPLETYPE &&
+                fValidationDV != DV_ANYATOMICTYPE) {
                 facets[count] =
                     new XSFacetImpl(
                             FACET_WHITESPACE,
@@ -3110,7 +3129,7 @@ public class XSSimpleTypeDecl implements
                             minInclusiveAnnotation);
                 count++;
             }
-            fFacets = new XSObjectListImpl(facets, count);
+            fFacets = (count > 0) ? new XSObjectListImpl(facets, count) : XSObjectListImpl.EMPTY_LIST;
         }
         return (fFacets != null) ? fFacets : XSObjectListImpl.EMPTY_LIST;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org