DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5964>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5964

XLSTC: ClassCastException in Stylesheet.setImportPrecedence(int)

           Summary: XLSTC: ClassCastException in
                    Stylesheet.setImportPrecedence(int)
           Product: XalanJ2
           Version: 2.2.0
          Platform: All
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Blocker
          Priority: High
         Component: org.apache.xalan.xsltc
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


XLSTC throws a ClassCastException in method setImportPrecedence(int) of class 
Stylesheet.

For some reason it is possible that 'elements' contains not only 
TopLevelElements which causes a compilation to fail.

Changing the Implementation of the method to:

public void setImportPrecedence(final int precedence) {
        _importPrecedence = precedence;

        final Enumeration elements = elements();
        while (elements.hasMoreElements()) {
                Object child2 = elements.nextElement();
                if (child2 instanceof TopLevelElement) {
                        final TopLevelElement child = (TopLevelElement) child2;
                        if (child instanceof Include) {
                                Stylesheet included = ((Include) 
child).getIncludedStylesheet();
                                if (included != null) {
                                        included.setImportPrecedence
(precedence);
                                }
                        }

                }
        }
}

works well.

------- Additional Comments From [EMAIL PROTECTED]  2002-01-29 20:23 -------
This needs to be evaluated but assuming it is correct and the 
suggested fix is good, I'm setting the priority high so it 
gets attention sooner rather than later.

Reply via email to