This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

help plz why am i getting this exception

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all
i'm doin a school project in j2me
i have develop a address book for the mobile phone
heres where i have got stuck this simple peice of code to browse the address boook is throwing an exception i don't know why..
plz help

public int enumerateContacts(String [] contacts)//string[] is passed by reference send names in array contacts
{String dummy;
int x=0;

try{
numOfRec=rs.getNumRecords();
contacts=new String[numOfRec];
for( x=1;x<=numOfRec;x++)
{dummy=new String (rs.getRecord(x));
System.out.println("dummy created" + dummy);
contacts[x-1]=getName(dummy);
System.out.println("name added"+contacts[x-1]);
}}
catch(Exception e){ //<-----why is exception being generated
System.out.println("error "+e.getMessage());
}
return x-1;
}


on running the application i get the foll output on the wtk console:

dummy createdname=CATHYcompany=IBMtitle=CFOadd1=BOSTONadd2=FLORIDAphone=78542996email=
name addedCATHY
error null ------->exception


i ideally all the records in the record store should have been shown in the console
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would help if you'd do a "e.printStackTrace()" in the catch block and post the stack trace for us to see.
 
shobhit garg
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Lasse Koskela:
It would help if you'd do a "e.printStackTrace()" in the catch block and post the stack trace for us to see.



here's what i got on doing e.printStackTrace

Could not create icon com.sun.midp.midlet.Selector$MIDletInfo@a9179cchk pnt 1
dummy createdname=CATHYcompany=IBMtitle=CFOadd1=BOSTONadd2=FLORIDAphone=78542996email=
name addedCATHY
error null
**Dummy PrintStackTrace**

plz help
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And from which line in your code is the exception thrown?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic