Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Problem with results returned from criteriaFind

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my code My search algorithm works find but I cant get it to return values when I set to another temprv array..

else if(source == searchButton)
{
try {

Data myData = new Data("db.db");
.
.
.
.
.
myInfo[] = myData.criteriaFind(criteria);
.
.
//this above code is my client
then for the data class.........

if (found)
{
DataInfo temprv = new DataInfo(r, description, values);
System.out.println(temprv.toString());
//rv[counter] = temprv;//insert temp rv into rv forrecordfound counter++;
found = false;
System.out.println("Match Found!!!");
}
else //debugg
{
System.out.println("No Match Found!!!");

}
when I comment out the new array rv[counter] i can print everything all records found in DOS
but when I uncomment it it returns null to the client
any help is greatly appreciated
Thanks Lisa
 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lisa,
I think you have forgotten to allocate memory for the array of object reference rv.
Rudy
 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi rudy
I believe I did allocate memory by
DataInfo rv = new DataInfo[recordCount];
 
Rudy Yeung
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lisa,
Could it be your counter available out of range or you are referencing an incorrect counter value?
Rudy
 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hat was a good thought but no I checked that too.
Thanks Rudy see my other problem I just recently posted
 
Rudy Yeung
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so have you resolved the problem then, and what is it all about?
 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rudy still working on the problem..
Lisa
 
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic