cnthompson / Beer366

It's a One-A-Day Leap Year Beer Celebration
6 stars 2 forks source link

Exception while entering unbounded data for a beer #37

Open cnthompson opened 10 years ago

cnthompson commented 10 years ago

On the Add Beer page, I attempted to add a beer with an ABV of 200%. I got the following exception. It seems to me that this should be guarded against up front by putting an upper bound on the ABV field. It already seems to have a lower bound as it did not accept a negative number.

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value for column 'abv' at row 1

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4094)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2683)

at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2144)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2444)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2362)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2347)

at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)

at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)

at beer366.BeerController.save(BeerController.groovy:44)

at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:195)

at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:744)