You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/09/01 16:27:49 UTC

DO NOT REPLY [Bug 30990] New: - ClasCastException if TraceEnabled during parse of XML String

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: commons-dev@jakarta.apache.org
        ReportedBy: info@deicon.de


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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org