IDEMPIERE-496 Exception when changing Organization Info

This commit is contained in:
Carlos Ruiz 2012-11-09 11:00:33 -05:00
parent 4993ffe5bf
commit faf9c28733
1 changed files with 18 additions and 15 deletions

View File

@ -983,19 +983,7 @@ public class GridTable extends AbstractTableModel
return null; return null;
} }
// need to wait for data read into buffer waitLoadm_sort(row);
int loops = 0;
while (row >= m_sort.size() && m_loaderFuture != null && !m_loaderFuture.isDone() && loops < 15)
{
log.fine("Waiting for loader row=" + row + ", size=" + m_sort.size());
try
{
Thread.sleep(500); // 1/2 second
}
catch (InterruptedException ie)
{}
loops++;
}
// empty buffer // empty buffer
if (row >= m_sort.size()) if (row >= m_sort.size())
@ -1015,6 +1003,22 @@ public class GridTable extends AbstractTableModel
return rowData[col]; return rowData[col];
} // getValueAt } // getValueAt
private void waitLoadm_sort(int row) {
// need to wait for data read into buffer
int loops = 0;
while (row >= m_sort.size() && m_loaderFuture != null && !m_loaderFuture.isDone() && loops < 15)
{
log.fine("Waiting for loader row=" + row + ", size=" + m_sort.size());
try
{
Thread.sleep(500); // 1/2 second
}
catch (InterruptedException ie)
{}
loops++;
}
}
private Object[] getDataAtRow(int row) private Object[] getDataAtRow(int row)
{ {
return getDataAtRow(row, true); return getDataAtRow(row, true);
@ -1022,6 +1026,7 @@ public class GridTable extends AbstractTableModel
private Object[] getDataAtRow(int row, boolean fetchIfNotFound) private Object[] getDataAtRow(int row, boolean fetchIfNotFound)
{ {
waitLoadm_sort(row);
MSort sort = (MSort)m_sort.get(row); MSort sort = (MSort)m_sort.get(row);
Object[] rowData = null; Object[] rowData = null;
if (m_virtual) if (m_virtual)
@ -2754,7 +2759,6 @@ public class GridTable extends AbstractTableModel
if (row < 0 || m_sort.size() == 0 || m_inserting) if (row < 0 || m_sort.size() == 0 || m_inserting)
return; return;
MSort sort = (MSort)m_sort.get(row);
Object[] rowData = getDataAtRow(row); Object[] rowData = getDataAtRow(row);
// ignore // ignore
@ -2765,7 +2769,6 @@ public class GridTable extends AbstractTableModel
if (where == null || where.length() == 0) if (where == null || where.length() == 0)
where = "1=2"; where = "1=2";
String sql = m_SQL_Select + " WHERE " + where; String sql = m_SQL_Select + " WHERE " + where;
sort = (MSort)m_sort.get(row);
Object[] rowDataDB = null; Object[] rowDataDB = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;