commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 30990] New: - ClasCastException if TraceEnabled during parse of XML String
Date Wed, 01 Sep 2004 14:27:49 GMT
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


Mime
View raw message