aspose file tools
The moose likes Java Micro Edition and the fly likes help plz why am i getting this exception Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Mobile » Java Micro Edition
Reply Bookmark "help plz why am i getting this exception" Watch "help plz why am i getting this exception" New topic
Author

help plz why am i getting this exception

shobhit garg
Ranch Hand

Joined: Mar 07, 2004
Posts: 42
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
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
It would help if you'd do a "e.printStackTrace()" in the catch block and post the stack trace for us to see.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
shobhit garg
Ranch Hand

Joined: Mar 07, 2004
Posts: 42
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
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
And from which line in your code is the exception thrown?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: help plz why am i getting this exception
 
Similar Threads
Pesudo coding
Head1stJava - pg 88 - 24 lines of confusion
how to accept an instance of a class as a parameter
Problem with ObjectInputStream
Address Book Java Issues