IDEMPIERE-568 Review proper closing of JDBC statements and resultsets
This commit is contained in:
parent
9b0c13b9f5
commit
cb10e71ad0
|
@ -2698,15 +2698,22 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
List<MOrderLine> result = new Vector<MOrderLine>();
|
List<MOrderLine> result = new Vector<MOrderLine>();
|
||||||
Properties ctx = Env.getCtx();
|
Properties ctx = Env.getCtx();
|
||||||
MOrderLine line;
|
MOrderLine line;
|
||||||
PreparedStatement ps = conn.prepareStatement(OrderLinesToAllocate);
|
PreparedStatement ps = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try {
|
||||||
|
ps = conn.prepareStatement(OrderLinesToAllocate);
|
||||||
ps.setInt(1, productId);
|
ps.setInt(1, productId);
|
||||||
ResultSet rs = ps.executeQuery();
|
rs = ps.executeQuery();
|
||||||
while(rs.next()) {
|
while(rs.next()) {
|
||||||
line = new MOrderLine(ctx, rs, trxName);
|
line = new MOrderLine(ctx, rs, trxName);
|
||||||
result.add(line);
|
result.add(line);
|
||||||
}
|
}
|
||||||
rs.close();
|
} catch (SQLException e) {
|
||||||
ps.close();
|
throw e;
|
||||||
|
} finally {
|
||||||
|
DB.close(rs, ps);
|
||||||
|
rs = null; ps = null;
|
||||||
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2735,12 +2742,13 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
"(QtyOrdered-QtyDelivered)>0 AND (QtyOrdered-QtyDelivered)>C_OrderLine.QtyAllocated)" +
|
"(QtyOrdered-QtyDelivered)>0 AND (QtyOrdered-QtyDelivered)>C_OrderLine.QtyAllocated)" +
|
||||||
"group by M_Product_ID " +
|
"group by M_Product_ID " +
|
||||||
"order by M_Product_ID";
|
"order by M_Product_ID";
|
||||||
|
PreparedStatement ps = null;
|
||||||
PreparedStatement ps = conn.prepareStatement(query1);
|
ResultSet rs = null;
|
||||||
|
try {
|
||||||
|
ps = conn.prepareStatement(query1);
|
||||||
ps.setInt(1, WarehouseID);
|
ps.setInt(1, WarehouseID);
|
||||||
ps.setInt(2, WarehouseID);
|
ps.setInt(2, WarehouseID);
|
||||||
ResultSet rs = ps.executeQuery();
|
rs = ps.executeQuery();
|
||||||
|
|
||||||
while(rs.next()) {
|
while(rs.next()) {
|
||||||
si = new StockInfo();
|
si = new StockInfo();
|
||||||
si.productId = rs.getInt(1);
|
si.productId = rs.getInt(1);
|
||||||
|
@ -2750,8 +2758,12 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
si.qtyAllocated = rs.getBigDecimal(4);
|
si.qtyAllocated = rs.getBigDecimal(4);
|
||||||
result.add(si);
|
result.add(si);
|
||||||
}
|
}
|
||||||
rs.close();
|
} catch (SQLException e) {
|
||||||
ps.close();
|
throw e;
|
||||||
|
} finally {
|
||||||
|
DB.close(rs, ps);
|
||||||
|
rs = null; ps = null;
|
||||||
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue