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 "Bill Michell (JIRA)" <xe...@xml.apache.org> on 2007/11/06 18:28:50 UTC

[jira] Created: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
-------------------------------------------------------------------------------------------------

                 Key: XERCESJ-1279
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
             Project: Xerces2-J
          Issue Type: Bug
          Components: DOM (Level 3 Core)
    Affects Versions: 2.9.1
         Environment: Windows, Sun JRE 1.6.00_03
            Reporter: Bill Michell


Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB

According to the documentation, the field has the following characteristics:
    // to store substitution group information
    // the key to the hashtable is an element decl, and the value is
    // - a Vector, which contains all elements that has this element as their
    //   substitution group affilication
    // - an array of OneSubGroup, which contains its substitution group before block.

Unfortuntately, addSubstitutionGroup() contains the following line:
            subGroup = (Vector)fSubGroupsB.get(subHead);

This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]

The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:

        // Convert to an array
        OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
        for (int i = newGroup.size()-1; i >= 0; i--) {
            ret[i] = (OneSubGroup)newGroup.elementAt(i);
        }
        // Store the potential sub group
        fSubGroupsB.put(element, ret);
        
 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Bill Michell (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600164#action_12600164 ] 

Bill Michell commented on XERCESJ-1279:
---------------------------------------

Is anyone goign to pick this up? Or at least provide some himts as to how I might sidestep it?

> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema Structures
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>         Attachments: ContentComponents.xsd, Crash.java, iCI.xsd, test.xml, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Bill Michell (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Michell updated XERCESJ-1279:
----------------------------------

    Attachment: Crash.java
                test.xml

A simple bit of Xml together with a simple java application that can be used to illustrate the problem.

You'll probably need to update the source path in the code to point to the appropriate files on your file system.

> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>         Attachments: ContentComponents.xsd, Crash.java, iCI.xsd, test.xml, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich updated XERCESJ-1279:
------------------------------------------

    Component/s:     (was: DOM (Level 3 Core))
                 XML Schema Structures

> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema Structures
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>         Attachments: ContentComponents.xsd, Crash.java, iCI.xsd, test.xml, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Arthur De Magalhaes (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657418#action_12657418 ] 

Arthur De Magalhaes commented on XERCESJ-1279:
----------------------------------------------

Hi Bill,

I have also worked on this issue, and the patch is being reviewed (also for side-effect implications).

One thing I see in the code you posted is that you are adding OneSubGroup objects into the Vector, but the hashtable fSubGroupsB assumes that if a Vector is returned, it contains the *elements* themselves, not the OneSubGroup objects.  So we could run into problems in there.

Here's what I have in my patch:

    public void addSubstitutionGroup(XSElementDecl[] elements) {
        XSElementDecl subHead, element;
        Object subGroup;
        
        // for all elements with substitution group affiliation
        for (int i = elements.length-1; i >= 0; i--) {
            element = elements[i];
            subHead = element.fSubGroup;
            
            // check whether this an entry for this element
            subGroup = fSubGroupsB.get(subHead);
            if (subGroup == null) {
                // if not, create a new one vector to store it
                subGroup = new Vector();
                fSubGroupsB.put(subHead, subGroup);
            }
            
            //Add the element to subGroup, which could be:
            //(1) a OneSubGroup array that was inside the Hashtable fSubGroupsB, OR
            //(2) a Vector that was inside the Hashtable fSubGroupsB, OR
            //(3) a new Vector, since nothing was inside the Hashtable fSubGroupsB for this elem.
            if (subGroup instanceof OneSubGroup[]){
                //(1), so we need to grow the array and insert the element into it
                
                //First we will make our OneSubGroup
                OneSubGroup methods = new OneSubGroup();
                getDBMethods(element.fType, subHead.fType, methods);
                OneSubGroup newOneSubGroup = new OneSubGroup(element, methods.dMethod, methods.bMethod);
                
                //Now we will add it to the new array
                int size = ((OneSubGroup[])subGroup).length;
                OneSubGroup[] newSubGroupArray = new OneSubGroup[size + 1];   
                System.arraycopy(subGroup, 0, newSubGroupArray, 0, size);
                newSubGroupArray[size] = newOneSubGroup;
                
                //Place the new array into the Hashtable fSubGroupsB
                fSubGroupsB.put(subHead, newSubGroupArray);

            }
            else{ 
                //(2) or (3), so add element to vector
                ((Vector)subGroup).addElement(element);
            }
        }
    }


> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>            Assignee: Arthur De Magalhaes
>         Attachments: ContentComponents.xsd, Crash.java, iCI.xsd, test.xml, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Assigned: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich reassigned XERCESJ-1279:
---------------------------------------------

    Assignee: Arthur De Magalhaes

Arthur has volunteered to take a look at this one.

> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>            Assignee: Arthur De Magalhaes
>         Attachments: ContentComponents.xsd, Crash.java, iCI.xsd, test.xml, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Bill Michell (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657420#action_12657420 ] 

Bill Michell commented on XERCESJ-1279:
---------------------------------------

Well, I've dropped your patch into my code instead of mine, and all my tests are still green :-)

> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>            Assignee: Arthur De Magalhaes
>         Attachments: ContentComponents.xsd, Crash.java, iCI.xsd, test.xml, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Bill Michell (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657413#action_12657413 ] 

Bill Michell commented on XERCESJ-1279:
---------------------------------------

A little more analysis:

The problem is with substitution groups, and appears to be related to an oprdering issue within the schema file.

The fundamental problem is in SubstitutionGroyupHandler.java

Hashtable fSubGroupsB is used to store two different types of values. It can either store Vectors, which hold all elements that claim to have the named element as their affiliation or - in what seems to be an optimisation - an array, which caches the calculated value of all elements which could be part of the group, including indirectly affiliated members. The comments and the code are rather conflicted about whether this array includes the effects of any blocked elements.

The problem is that addSubstitutionGroup() assumes that the Hashtable will always contain the raw Vector, whereas getSubGroupB will at the slightest provocation swap any vector it finds for the calculated array.

If all the addSubstituitionGroup calls are made before the first getSubGroupB call is made, then all proceeds normally. However, any addSubstitutionGroup call made after the first getSubGroupB for the element concerned will always fail with the ClassCastException.

The following change to the addSubstitutionGroup() method makes the exception go away, but I'm really unclear about what other side effects may transpire - particularly in regard to blocked element handling... Note that this code also uses the new for(Object:Array) construct, which is why I haven't bothered to prepare it as a patch...

	public void addSubstitutionGroup(XSElementDecl[] elements) {
		XSElementDecl subHead, element;
		Vector subGroup;
		// for all elements with substitution group affiliation
		for (int i = elements.length-1; i >= 0; i--) {
			element = elements[i];
			subHead = element.fSubGroup;
			// check whether this an entry for this element
			Object previousEntry = fSubGroupsB.get(subHead);
			if (previousEntry instanceof OneSubGroup[]) {
				OneSubGroup[] previousArray=(OneSubGroup[]) previousEntry;
				Vector temp=new Vector();
				for (OneSubGroup group:previousArray) {
					temp.add(group);
				}
				previousEntry=temp;
			}
			subGroup = (Vector)previousEntry;
			if (subGroup == null) {
				// if not, create a new one
				subGroup = new Vector();
				fSubGroupsB.put(subHead, subGroup);
			}
			// add to the vector
			subGroup.addElement(element);
		}
	}




> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>            Assignee: Arthur De Magalhaes
>         Attachments: ContentComponents.xsd, Crash.java, iCI.xsd, test.xml, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Bill Michell (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Michell updated XERCESJ-1279:
----------------------------------

    Attachment: ContentComponents.xsd
                iCI.xsd
                test.xsd

Sample schema documents illustrating the crash.

I haven't attempted to reduce them to a minimum set of data to reproduce the problem.

> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>         Attachments: ContentComponents.xsd, iCI.xsd, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Issue Comment Edited: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Bill Michell (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600164#action_12600164 ] 

billmichell edited comment on XERCESJ-1279 at 5/27/08 8:57 AM:
----------------------------------------------------------------

Is anyone going to pick this up? Or at least provide some hints as to how I might sidestep it?

      was (Author: billmichell):
    Is anyone goign to pick this up? Or at least provide some himts as to how I might sidestep it?
  
> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema Structures
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>         Attachments: ContentComponents.xsd, Crash.java, iCI.xsd, test.xml, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12657422#action_12657422 ] 

Michael Glavassevich commented on XERCESJ-1279:
-----------------------------------------------

FYI: I'm planning to review it. Was hoping to get to it sooner, but realistically looks like it will be in the new year.

> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>            Assignee: Arthur De Magalhaes
>         Attachments: ContentComponents.xsd, Crash.java, iCI.xsd, test.xml, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Arthur De Magalhaes (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600171#action_12600171 ] 

Arthur De Magalhaes commented on XERCESJ-1279:
----------------------------------------------

Hello.   I am currently looking at this issue.

> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema Structures
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>         Attachments: ContentComponents.xsd, Crash.java, iCI.xsd, test.xml, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Issue Comment Edited: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540590 ] 

mrglavas@ca.ibm.com edited comment on XERCESJ-1279 at 11/6/07 2:00 PM:
------------------------------------------------------------------------

(I vaguely remember someone reporting a bug similar to this one ages ago. I thought it was fixed.)

It would be very helpful if you provided a test case. Can you attach a schema and instance document which reproduces this problem? Thanks.

      was (Author: mrglavas@ca.ibm.com):
    (I vaguely remember someone reporting a bug similar to this one ages ago. I thought it was fixed.)

It would be very helpful you provided a test case. Can you attach a schema and instance document which reproduces this problem? Thanks.
  
> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540590 ] 

Michael Glavassevich commented on XERCESJ-1279:
-----------------------------------------------

(I vaguely remember someone reporting a bug similar to this one ages ago. I thought it was fixed.)

It would be very helpful you provided a test case. Can you attach a schema and instance document which reproduces this problem? Thanks.

> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (XERCESJ-1279) ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()

Posted by "Arthur De Magalhaes (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arthur De Magalhaes updated XERCESJ-1279:
-----------------------------------------

    Attachment: subXercesPatch.txt

Forgot to attach the patch.  =)

> ClassCastException in SubstitutionGroupHandler.addSubstitutionGroup() during Document.normalize()
> -------------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1279
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1279
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.9.1
>         Environment: Windows, Sun JRE 1.6.00_03
>            Reporter: Bill Michell
>            Assignee: Arthur De Magalhaes
>         Attachments: ContentComponents.xsd, Crash.java, iCI.xsd, subXercesPatch.txt, test.xml, test.xsd
>
>
> Change 319073 introduced the class SubstitutionGroupHandler$OneSubGroup and the Hashtable fSubGroupB
> According to the documentation, the field has the following characteristics:
>     // to store substitution group information
>     // the key to the hashtable is an element decl, and the value is
>     // - a Vector, which contains all elements that has this element as their
>     //   substitution group affilication
>     // - an array of OneSubGroup, which contains its substitution group before block.
> Unfortuntately, addSubstitutionGroup() contains the following line:
>             subGroup = (Vector)fSubGroupsB.get(subHead);
> This fails with a ClassCastException if the value for the key passed turns out to be a OneSubGroup[]
> The following lines of getSubGroupB() appear to ensure that a OneSubGroup[] is in the map:
>         // Convert to an array
>         OneSubGroup[] ret = new OneSubGroup[newGroup.size()];
>         for (int i = newGroup.size()-1; i >= 0; i--) {
>             ret[i] = (OneSubGroup)newGroup.elementAt(i);
>         }
>         // Store the potential sub group
>         fSubGroupsB.put(element, ret);
>         
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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