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

http://issues.apache.org/bugzilla/show_bug.cgi?id=30990

ClasCastException if TraceEnabled during parse of XML String

           Summary: ClasCastException if TraceEnabled during parse of XML
                    String
           Product: Commons
           Version: unspecified
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Betwixt
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Once I set my Log4j LogLevel to DEBUG I am receiving a ClassClastException in
ReadContext.java:getCurrentElement. Switching the log level back to INFO 
everything works fine. 

which is called in BeanBindAction.java:update(...)

private void update(ReadContext context, Object value) throws Exception {
        Log log = context.getLog();

        Updater updater = context.getCurrentUpdater();
        
        if ( updater == null ) {
            if ( context.getLog().isTraceEnabled() ) {
                context.getLog().trace("No updater for " + 
context.getCurrentElement());
}
        } else {
            updater.update(context, value);
        }

        String poppedElement = context.popElement();
    }



My temporary hack to fix this is done in ReadContext to avoid the String cast 
if possible and simply return null. I am going to post a cvs patch as well 
soon.
 

/**
     * Gets the element name for the currently mapped element.
     * @return the name of the currently mapped element, 
     * or null if there has been no element mapped 
     */
        public String getCurrentElement() {
                Object retVal = elementMappingStack.peek();
                if (retVal instanceof String) { 
                        return (String) retVal;
                } else {
                        return null;
                }
                
        }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to