Home Demos Forum Research Guide
Viewing topic in forum 'bugs'
back to topic list

Return null
Hi,

I got the following situation:


// BUG!
        Row row[] = database.executeQuery(sql);

        if (row != null) {
            out.println("why?");
            for (int i = 0; i < row.arrayLength; i++) {
                for (int j = 0; j < row[i].column.arrayLength; j++) {
                    out.println("The value on row $(iu.intToString(i)) column $(iu.intToString(j)) is: $(row[i].column[j].value)");
                }
            }
        } else {
            out.println("no results");
        }
 


I'm using a component to retrieve data from a database. If there is no data to be returned it would return null. However, even though in the database I explicitly return null from the executeQuery function when it gets to row, it does not set row null, it sets row an array with size 0.

by roberto on 2015-04-11 22:13:41 (2 replies)

Hi Roberto,

Thanks for the bug report - you're right, this is incorrect behaviour and is caused by the compiler automatically generating array instances for return values that aren't of array type. A fix for this has now been integrated into the current release :-)

- Barry
by barry on 2015-04-12 09:50:50
Thank you! (:
by roberto on 2015-04-12 22:20:52
© Francis Research Ltd. 2018