MySQL issue ArithmeticException: / by zero [message #1097400] |
Thu, 29 August 2013 17:05 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Chris Snow![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=chsnow123%40gmail.com) Messages: 50 Registered: December 2011 |
Member |
|
|
When a table's execLoadTableData is run, I get the following error:
Caused by: java.lang.ArithmeticException: / by zero
at org.eclipse.scout.rt.server.services.common.jdbc.internal.exec.StatementProcessor.processResultRows(StatementProcessor.java:230)
at org.eclipse.scout.rt.server.services.common.jdbc.internal.exec.StatementProcessor.processSelect(StatementProcessor.java:265)
... 70 more
A bit of debugging reveals the root cause in StatementProcessor:
protected List<Object[]> processResultRows(ResultSet rs, int maxRowCount) throws SQLException, ProcessingException {
boolean isDynamicPrefetch = false;
int rowCount = 0;
int initialFetchSize = 0;
int dynamicFetchSize = 0;
if (m_callerService.getSqlStyle() != null && m_callerService.getSqlStyle() instanceof OracleSqlStyle) {
// init prefetch params
isDynamicPrefetch = true;
initialFetchSize = rs.getFetchSize();
dynamicFetchSize = initialFetchSize;
}
ArrayList<Object[]> rows = new ArrayList<Object[]>();
while (rs.next()) {
if (isDynamicPrefetch && ++rowCount % dynamicFetchSize == 0 && dynamicFetchSize < getMaxFetchSize(rs)) {
dynamicFetchSize = Math.min(Math.max(initialFetchSize, rowCount / 2), getMaxFetchSize(rs));
rs.setFetchSize(dynamicFetchSize);
}
Object[] row = processResultRow(rs);
rows.add(row);
if (maxRowCount > 0 && rows.size() >= maxRowCount) {
break;
}
}
return rows;
}
The problem seems to be that m_callerService.getSqlStyle() is returning org.eclipse.scout.rt.server.services.common.jdbc.style.OracleSqlStyle and
then initialFetchSize = rs.getFetchSize() is returning 0 which is causing a divide by zero on ++rowCount % dynamicFetchSize
Scout: 3.9
MySQL: 5.6
MySQL Connector: 5.1.17
[Updated on: Thu, 29 August 2013 17:22] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04900 seconds