Bug in JRuby BigDecimal.to_s when amount is in cents
We found an interesting bug yesterday while working on one of our JRuby projects. In our application we are downloading transactions from various banks. I noticed an interesting bug while testing against my bank account where transactions with only cents and no whole amount were downloaded incorrectly. A transaction for $0.45 would, incorrectly be downloaded as $4.50. We determined that the issue stemmed from a JRuby bug in BigDecimal. The following test cases showcase the bug.
BigDecimal.new("0.10").to_s("F") => "1.0" BigDecimal.new("0.01").to_s("F") => "1.0"
I have created a patch for JRuby 1.0.2 which fixes the issue. I have submitted to the JRuby project and Headius told me it should make it into JRuby 1.0.3 and also the trunk. If you can’t wait for 1.0.3, which is due in the next couple of weeks, you can download the patch I submitted. If you are too lazy to apply the patch your self, let me know and I’ll send you the JRuby jar file with the applied patch that I created for our project.
www.paybackable.com
Well, we got frustrated enough with handling our own out-of-pocket expenses that we wrote a small app to help create online expense reports. It’s live at http://www.paybackable.com. It lets you track expenses and submit expense reports as IIF files for import into QuickBooks. It will also pull the expense categories from a QuickBooks chart of accounts IIF file so everything matches up. There are some nifty elements, like auto-complete of payee names with memorized categorization, plus keyboard shortcuts for quickly changing the date.
While it’s been very helpful for us (took the whole process from 20-30 minutes per expense report down to less than 5), we were wondering if anyone else might find it useful. Feel free to give it a try and let us know what you think. You can email me (Kevin) at esomnie dot com