• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Still stuck on returning InfoData from searchCriteria()

 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

//DataInfo[] rv = new DataInfo[recordCount];
DataInfo[] rv = null;

if (found)
{
rv[counter] = new DataInfo(r, description, values);
DataInfo temprv = new DataInfo(r, description, values);
System.out.println(rv[counter].toString());//all records print dos screen ok
rv[counter] = temprv; //insert temp rv into rv for everyfound record
System.out.println(temprv.toString());
counter++;
found = false;


}



}//end for loop

}
catch (IOException e)
{
throw new DatabaseException(UNEXPECTED + e);
}



return rv;
}
when I return rv i get null I dont understand whats going on.
thanks Lisa
 
Jeff Holmes
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just another thought on how to handle this, use a Vector that has the ability to grow and then convert the vector to an Array. The code is a lot easier. See Vecotor API and the toArray Method.
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lisa:
Your code DataInfo[] rv = null; is in the for loop, so everytime the for loop is execute, it's declared to null.
 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks I will look further into these issues.
My declaration is outside of the loop. My fault the way I displayed it..
Thanks Lisa
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic