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 2007/03/14 21:33:11 UTC

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

Author: mrglavas
Date: Wed Mar 14 13:33:10 2007
New Revision: 518311

URL: http://svn.apache.org/viewvc?view=rev&rev=518311
Log:
Fixing JIRA Bug #1079 and #1237:
http://issues.apache.org/jira/browse/XERCESJ-1079
http://issues.apache.org/jira/browse/XERCESJ-1237

If a type derived from xs:integer specifies a fractionDigits facet with a value other than one
its an error. We weren't reporting one before.

"0" was always being returned as the lexical value for the totalDigits facet of a type derived
from xs:integer. This should be the value returned for fractionDigits.

If a fractionDigits facet is specified on a type derived from xs:integer we need to take special
care that we only create one instance of XSFacet for fractionDigits.

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?view=diff&rev=518311&r1=518310&r2=518311
==============================================================================
--- 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 Mar 14 13:33:10 2007
@@ -1360,13 +1360,17 @@
 			// check fixed value for fractionDigits
 			if (((fFacetsDefined & FACET_FRACTIONDIGITS) != 0)) {
 				if ((( fBase.fFacetsDefined & FACET_FRACTIONDIGITS) != 0)) {
-					if ((fBase.fFixedFacet & FACET_FRACTIONDIGITS) != 0 && fFractionDigits != fBase.fFractionDigits) {
+					if (((fBase.fFixedFacet & FACET_FRACTIONDIGITS) != 0 && fFractionDigits != fBase.fFractionDigits) ||
+                        (fValidationDV == DV_INTEGER && fFractionDigits != 0)) {
 						reportError("FixedFacetValue", new Object[]{"fractionDigits", Integer.toString(fFractionDigits), Integer.toString(fBase.fFractionDigits), fTypeName});
 					}
 					if (fFractionDigits > fBase.fFractionDigits) {
 						reportError( "fractionDigits-valid-restriction", new Object[]{Integer.toString(fFractionDigits), Integer.toString(fBase.fFractionDigits), fTypeName});
 					}
 				}
+                else if (fValidationDV == DV_INTEGER && fFractionDigits != 0) {
+                    reportError("FixedFacetValue", new Object[]{"fractionDigits", Integer.toString(fFractionDigits), "0", fTypeName});
+                }
 			}
 			
 			// check 4.3.6.c1 error:
@@ -2162,10 +2166,11 @@
 		case FACET_MININCLUSIVE:
 			return (fMinInclusive == null)?null:fMinInclusive.toString();
 		case FACET_TOTALDIGITS:
-			if (fValidationDV == DV_INTEGER)
-				return "0";
 			return (fTotalDigits == -1)?null:Integer.toString(fTotalDigits);
 		case FACET_FRACTIONDIGITS:
+            if (fValidationDV == DV_INTEGER) {
+                return "0";
+            }
 			return (fFractionDigits == -1)?null:Integer.toString(fFractionDigits);
 		}
 		return null;
@@ -3000,10 +3005,10 @@
 							FACET_FRACTIONDIGITS,
 							"0",
 							true,
-							null);
+                            fractionDigitsAnnotation);
 				count++;
 			}
-			if (fFractionDigits != -1) {
+            else if (fFractionDigits != -1) {
 				facets[count] =
 					new XSFacetImpl(
 							FACET_FRACTIONDIGITS,



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