Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 17977 invoked from network); 8 May 2003 21:37:23 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 8 May 2003 21:37:23 -0000 Received: (qmail 5482 invoked by uid 97); 8 May 2003 21:39:30 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 5475 invoked from network); 8 May 2003 21:39:30 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 8 May 2003 21:39:30 -0000 Received: (qmail 17764 invoked by uid 500); 8 May 2003 21:37:21 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 17750 invoked from network); 8 May 2003 21:37:21 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 8 May 2003 21:37:21 -0000 Received: (qmail 5472 invoked by uid 50); 8 May 2003 21:39:28 -0000 Date: 8 May 2003 21:39:28 -0000 Message-ID: <20030508213928.5471.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: commons-dev@jakarta.apache.org Cc: Subject: DO NOT REPLY [Bug 19781] New: - PropertyUtils.copyProperties throws exceptions contrary to documentation X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . 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=19781 PropertyUtils.copyProperties throws exceptions contrary to documentation Summary: PropertyUtils.copyProperties throws exceptions contrary to documentation Product: Commons Version: unspecified Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Bean Utilities AssignedTo: commons-dev@jakarta.apache.org ReportedBy: apacheBugzilla@AMammenT.cotse.net 1) The copyProperties method is documented as throwing IllegalAccessException when access to a particular method is not available. In fact, because internally the methods to be invoked are filtered for accessiblity (MethodUtils.getAccessibleMethod) before invocation, the possible sources of the IllegalAccessException will never actually throw an IllegalAccessException. Worse, however, is that the result of a failure to return an accessible method is actually taken as occasion to throw a NoSuchMethodException instead. 2) The copyProperties method is also documented as throwing NoSuchMethodException when a method cannot be found. I'm not sure if this is an error or not, but a NoSuchMethodException is not thrown when a property of the same name but a different type is found. (This would, to my mind, be an occasion of not finding an appropriate method for the setter to function properly). Unfortunately, again, there is something worse. In this case, instead of throwing NoSuchMethodException, an IllegalArgumentException is thrown. IllegalArgumentException, as a runtime exception, might have been appropriateexcept for the fact that it is explicitly documented as being thrown when either the source or the destination arguments are null - no other reasons for throwing this are detailed. (Wouldn't NullPointerException be more appropriate anyway? Curious about the decision to recast this to IllegalArgumentException....) While this is certainly allowed for RuntimeExceptions, in this case, the documentation is quite misleading about what is actually to be expected. I'll attach a JUnitTestCase that captures both of these items. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org