Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 83321 invoked from network); 15 Jul 2007 02:32:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Jul 2007 02:32:27 -0000 Received: (qmail 58709 invoked by uid 500); 15 Jul 2007 02:32:27 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 58631 invoked by uid 500); 15 Jul 2007 02:32:27 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: 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 58620 invoked by uid 99); 15 Jul 2007 02:32:27 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Jul 2007 19:32:27 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Jul 2007 19:32:24 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 76F8F7141F6 for ; Sat, 14 Jul 2007 19:32:04 -0700 (PDT) Message-ID: <14232162.1184466724476.JavaMail.jira@brutus> Date: Sat, 14 Jul 2007 19:32:04 -0700 (PDT) From: "Paul Benedict (JIRA)" To: commons-dev@jakarta.apache.org Subject: [jira] Issue Comment Edited: (BEANUTILS-91) PropertyUtils.copyProperties throws exceptions contrary to documentation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/BEANUTILS-91?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512770 ] Paul Benedict edited comment on BEANUTILS-91 at 7/14/07 7:31 PM: ----------------------------------------------------------------- Exceptions are not part of the binary method signature. Because both the aforementioned exceptions are checked exceptions, removing them may cause a compiler error for newly recompiled code. The java compiler may find code catching exceptions that are never thrown and may error, but for already compiled code, no problems. was: Exceptions are not part of the method signature. Because both the aforementioned exceptions are checked exceptions, removing them may cause a compiler error for newly compiled code. The java compiler may find code catching exceptions that are never thrown and may error, but for already compiled code, no problems. > PropertyUtils.copyProperties throws exceptions contrary to documentation > ------------------------------------------------------------------------ > > Key: BEANUTILS-91 > URL: https://issues.apache.org/jira/browse/BEANUTILS-91 > Project: Commons BeanUtils > Issue Type: Bug > Components: Bean / Property Utils > Affects Versions: 1.5 > Environment: Operating System: other > Platform: Other > Reporter: Arun Mammen Thomas > Priority: Minor > Fix For: 1.8.0 > > Attachments: PropertyUtilsTest.java, temp.java > > > 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. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org