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=5184>. 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=5184 ComponentUtil.setWriteOnceObject broken Summary: ComponentUtil.setWriteOnceObject broken Product: Avalon Version: unspecified Platform: Other OS/Version: Other Status: NEW Severity: Major Priority: Other Component: Framework AssignedTo: avalon-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] The setWriteOnceObject method is broken. public static final void setWriteOnceObject( Object source, final Object value, final String message ) { if ( null == source ) { source = value; } else { throw new IllegalStateException( message ); } } The source = value assignment has no effect whatsoever. As it is now, setWriteOnceObject is equivalent to: public static final void setWriteOnceObject( Object source, final String message ) { if ( null != source ) { throw new IllegalStateException( message ); } } Test case: import org.apache.avalon.framework.ComponentUtil; public class TestComponentUtil { public static void main (String args[]) throws Exception { String source = null; String value = "valued"; String message = "Already set."; // Prints "null". System.out.println (source); // Prints attempts to set source to "valued" ComponentUtil.setWriteOnceObject (source, value, message); // This should print "valued", but prints "null". System.out.println (source); // Set it again. This should fail, but since source hasn't been // set, it passes. ComponentUtil.setWriteOnceObject (source, value, message); // This should print "valued", but prints "null". System.out.println (source); } } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>