This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Vector problem  RSS feed

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • 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
  • 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
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!