[ http://nagoya.apache.org/jira/browse/IBATIS-30?page=comments#action_56846 ] Clinton Begin commented on IBATIS-30: -------------------------------------
I agree with that, and also your conclusion that it's not done for performance reasons. In any case, that's what the spec reads, so that's what we support. Cheers, Clinton > A bug in the dropCase method of Classinfo.java causes problem for property > that has an uppercase letter on the 2nd character > ---------------------------------------------------------------------------------------------------------------------------- > > Key: IBATIS-30 > URL: http://nagoya.apache.org/jira/browse/IBATIS-30 > Project: iBatis for Java > Type: Bug > Components: SQL Maps > Versions: 2.0.8 > Reporter: leo chan > Assignee: Clinton Begin > > There is a bug in the following dropCase method of the Classinfo.java in > com.ibatis.common.beans package. The line that conatins: > !Character.isUpperCase(name.charAt(1) > should be > !Character.isUpperCase(name.charAt(0) instead. > The code is trying to change the first character of the name to toLowerCase > (not the second letter). Therefore, it should check the first character of > the name which is indexed by 0 (not 1) and to see if it is lowerCase. > Here is the section of the Classinfo.java that contains the bug: > private static String dropCase(String name) { > if (name.startsWith("is")) { > name = name.substring(2); > } else if (name.startsWith("get") || name.startsWith("set")) { > name = name.substring(3); > } else { > throw new ProbeException("Error parsing property name '" + name + "'. > Didn't start with 'is', 'get' or 'set'."); > } > > if (name.length() == 1 || (name.length() > 1 && > !Character.isUpperCase(name.charAt(1)))) { > name = name.substring(0, 1).toLowerCase(Locale.US) + name.substring(1); > } > > return name; > } > This will cause a problem for property that has second letter as upper case > letter. For example, if you have a property called "aRank". The getter and > setter for that property will be getARank and setARank. The code will first > extract the name as "ARank". Then it will check the second character instead > of the first character and see if it is lowercase. If it is, it will not > change the first character to lower case. So it will still be "ARank". So > the problem will complain the if can't find the writable property called > "aRank". > This bug only found in 2.0. In 1.0, Classinfo.java doesn't contain the > method called dropCase. > Submitted by > Leo Chan > SRA International -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://nagoya.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira
