You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Justin Lipton <ju...@ns.xn.com.au> on 2003/02/24 06:12:10 UTC

Patch for org.apache.xerces.impl.dtd.models.SimpleContentModel

Hi,

I just found a bug in the SimpleContentModel class - looks like it had 
been lurking for a while.
The bug rears it's head when attempting to check the allowable content 
for the following simple content scenario:

a, b

when only one child is passed in (eg x) the SimpleContentModel returns 1 
(a valid state) regardless of whether not x is valid.

Here's a patch that should work:

@@ -297,7 +297,11 @@
                      }
                  }
                  else {
-                    if (length > 2) {
+                    if (length == 1) {
+                        if (children[offset].rawname != 
fFirstChild.rawname) {
+                            return 0;
+                        }
+                    } else if (length > 2) {
                          return 2;
                      }

Cheers,
Justin.



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


Re: Patch for org.apache.xerces.impl.dtd.models.SimpleContentModel

Posted by Justin Lipton <ju...@ns.xn.com.au>.
What's the correct way to submit a Xerces class patch.
Should I put it into bugzilla with the patch or is posting here (see 
below) sufficient?

Justin Lipton wrote:
> Hi,
> 
> I just found a bug in the SimpleContentModel class - looks like it had 
> been lurking for a while.
> The bug rears it's head when attempting to check the allowable content 
> for the following simple content scenario:
> 
> a, b
> 
> when only one child is passed in (eg x) the SimpleContentModel returns 1 
> (a valid state) regardless of whether not x is valid.
> 
> Here's a patch that should work:
> 
> @@ -297,7 +297,11 @@
>                      }
>                  }
>                  else {
> -                    if (length > 2) {
> +                    if (length == 1) {
> +                        if (children[offset].rawname != 
> fFirstChild.rawname) {
> +                            return 0;
> +                        }
> +                    } else if (length > 2) {
>                          return 2;
>                      }
> 
> Cheers,
> Justin.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
> 
> 
> 



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