You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@juddi.apache.org by Al Caponi <do...@yahoo.com.sg> on 2002/02/26 05:16:02 UTC
[jUDDI-users] Logic error in JDBCDataSource?
Hi all,
In JDBCDataSource find methods e.g. findBusiness(String sqlQuery, int
maxRow)
<snippet>
private UDDIResponse findBusiness (String sqlQuery, int maxRow) throws
UDDIException {
BusinessListResponse response = new BusinessListResponse();
int currow = 0;
try {
// sqlQuery is the statement to conduct our criteria search by
ResultSet entities = JDBCUtility.executeQuery(sqlQuery);
while (entities.next()) {
if (maxRow != 0 && currow < maxRow) { // <======= LOGIC ERROR!
...
...
</snippet>
If the client never specified a max_rows value, the default maxRow value
of -1 would cause jUDDI to return zero record all the time.
Shouldn't it be something like this?
<snippet>
private UDDIResponse findBusiness (String sqlQuery, int maxRow) throws
UDDIException {
BusinessListResponse response = new BusinessListResponse();
int currow = 0;
try {
// sqlQuery is the statement to conduct our criteria search by
ResultSet entities = JDBCUtility.executeQuery(sqlQuery);
while (entities.next()) {
if ((maxRow == -1 && !entities.isAfterLast())|| (maxRow != 0 &&
currow < maxRow)) { // <==== CHANGED!
...
...
</snippet>
Being aware that there's a complete rewriting, is this going to change?
Regards,
Al
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com