• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Vector problem

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm having a problem adding an object to a Vector. I'm not really sure what's wrong because my debugger just stops when actually adding a choice object to the Vector:
private Vector getChoiceHelper(RecordEnumeration re, String design)
{
Vector choiceVector = new Vector();
try
{
while(re.hasNextElement())
{
int id = re.nextRecordId();
ByteArrayInputStream bais = new ByteArrayInputStream(choiceStore.getRecord(id));
DataInputStream inputStream = new DataInputStream(bais);
try
{
Choice choice = DesignStorage.readChoice(inputStream, design);
if (choice != null)
{
choiceVector.addElement(choice); //<- Stops here
}
}
catch (EOFException eofe)
{
System.out.println(eofe);
eofe.printStackTrace();
}
}
}
catch (RecordStoreException rse)
{
System.out.println(rse);
rse.printStackTrace();
}
catch (IOException ioe)
{
System.out.println(ioe);
ioe.printStackTrace();
}
return choiceVector;
}
Neither the choice, nor the vector are null, so I'm a bit bemused. I'm using JBuilder 8 MobileSet if that's any help.
Any help on this is greatly appreciated.
Cheers,
Steve
 
wrangler
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very random thoughts:
- You might try a couple of different emulators
from different vendors and see if the same behaviour
occurs or differs?
- You might try putting a debug print statement before and after
the Vector.addElement(...) line where it stops, just to
double-check that it is that line?
- Sometimes it can help to add a catchall
"catch(Exception e)" or "catch (Throwable t)"
(Only for a very short period of debugging; and if
something unexpected is caught there then examine
why and add the proper logic or correction for it.
And of course remove the catchall afterwards.)
br,
jim
 
Steve Wood
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.
I've tried adding some debugging around the method call, but it's not giving anything useful.
It's very strange, the debugging just stops. Nothing, no messages, no errors, just stops.
I'll try some other emulators, maybe JBuilder is messing up.
Thanks for your help. I just wanted to check I wasn't missing something really stupid.
Cheers,
Steve
 
James Reilly
wrangler
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's possible that running it in two different vendors' MIDP
device emulators could help shed some light. You might also try
running your code under e.g. both WTK vs. JBuilder, with different
underlying device emulators to see if the same thing happens
in all cases, or if different effects occur.
(If your MIDlet application code has started any threads, it
might be worth checking the other threads too?)
br,
jim
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
also check sun's midp bug databse usually you wil se bug reports comign from vendors..easy tell as they test against the cdc and lcdc fc implenetations...
easy way to find if its a bug is do a keyword search fro vector..
offhand I have not rolled the bug db lately and thus I am not sure if its a bug in either MIDP1.0 or MIDP2.0
 
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic