Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > J2ME Application Error

Reply
Thread Tools

J2ME Application Error

 
 
Raffi
Guest
Posts: n/a
 
      06-28-2006
Hi Folks,

I have the Class below for deleting all record stores for a MIDLet.

It works fine with the SUN wireless toolkit as well as the IBM J9 VM,
but throws an application error on a Motorola V551 phone. If I replace
"names.length" with the actual count of the record stores, it works
fine. Am I doing something wrong? If not and this is a limitation of
the VM the phone uses, are there other ways to get the array length
besides "names.length"?

Thanks,
Raffi

Code-----------------------------------------------------------------------
public void deleteAllRMS()
{

names = RecordStore.listRecordStores();
int count = names.length;

for (int i = 0; i < count; ++i)
{
try
{
RecordStore.deleteRecordStore(names[i]);
}
catch (Exception e)
{
System.out.println("Error - " + e);
}
}
}
-------------------------------------------------------------------------------

 
Reply With Quote
 
 
 
 
Chris Uppal
Guest
Posts: n/a
 
      06-28-2006
Raffi wrote:

> It works fine with the SUN wireless toolkit as well as the IBM J9 VM,
> but throws an application error on a Motorola V551 phone. If I replace
> "names.length" with the actual count of the record stores, it works
> fine.


I know nothing about J2ME, but from what you say, either the JVM is so badly
screwed that it doesn't know how long an array is -- which seems unlikely -- or
the Motorola implementation has entries in the array which are not legal
arguments to deleteRecordStore(). I'd try putting check for null into the loop
and see what happens.

-- chris


 
Reply With Quote
 
 
 
 
Paul Hamaker
Guest
Posts: n/a
 
      06-28-2006
Guess it's a Motorola bug, did you try other phones ?

 
Reply With Quote
 
Raffi
Guest
Posts: n/a
 
      06-29-2006

Paul Hamaker wrote:
> Guess it's a Motorola bug, did you try other phones ?


Not yet. Code that doesn't run on Motorola phones won't fly since there
are so many of them out there.

 
Reply With Quote
 
Raffi
Guest
Posts: n/a
 
      06-29-2006
Chris Uppal wrote:
> Raffi wrote:
>
> > It works fine with the SUN wireless toolkit as well as the IBM J9 VM,
> > but throws an application error on a Motorola V551 phone. If I replace
> > "names.length" with the actual count of the record stores, it works
> > fine.

>
> I know nothing about J2ME, but from what you say, either the JVM is so badly
> screwed that it doesn't know how long an array is -- which seems unlikely -- or
> the Motorola implementation has entries in the array which are not legal
> arguments to deleteRecordStore(). I'd try putting check for null into the loop
> and see what happens.
>
> -- chris


The deleteRecordStore() method is not the problem since when I enter
the array length manually in the code, the class works fine. It's when
it tries to get the array length from the method that it throws the
application error.

I've already tried your suggestion and on the emulator both
array.length and a do-while loop with a null check give the same result
for the array length. I have since re-written the class to use a
do-while loop which does work on all the platforms available for me.
The only problem with a do-while loop is for it to exit, an array out
of bounds exception is thrown. I've hacked around that by ignoring the
error (I know - not a good idea but it's the only solution right now).

If anybody else has a suggestion please post it.

Thanks,
Raffi

 
Reply With Quote
 
Chris Uppal
Guest
Posts: n/a
 
      06-29-2006
Raffi wrote:

> The deleteRecordStore() method is not the problem since when I enter
> the array length manually in the code, the class works fine. It's when
> it tries to get the array length from the method that it throws the
> application error.


Eek ! Then that Java implementation has a /really/ serious bug. Expect to
find more...

-- chris


 
Reply With Quote
 
Rogan Dawes
Guest
Posts: n/a
 
      06-29-2006
Raffi wrote:
> Hi Folks,
>
> I have the Class below for deleting all record stores for a MIDLet.
>
> It works fine with the SUN wireless toolkit as well as the IBM J9 VM,
> but throws an application error on a Motorola V551 phone. If I replace
> "names.length" with the actual count of the record stores, it works
> fine. Am I doing something wrong? If not and this is a limitation of
> the VM the phone uses, are there other ways to get the array length
> besides "names.length"?
>
> Thanks,
> Raffi
>
> Code-----------------------------------------------------------------------
> public void deleteAllRMS()
> {
>
> names = RecordStore.listRecordStores();
> int count = names.length;
>
> for (int i = 0; i < count; ++i)
> {
> try
> {
> RecordStore.deleteRecordStore(names[i]);
> }
> catch (Exception e)
> {
> System.out.println("Error - " + e);
> }
> }
> }
> -------------------------------------------------------------------------------
>


How are you deciding on the length of names, to manually put it in your
code?

Can you see what names.length actually is on the hardware?


And, exactly what error does it throw?

Rogan
 
Reply With Quote
 
Raffi
Guest
Posts: n/a
 
      06-29-2006
Rogan Dawes wrote:
> Raffi wrote:
> > Hi Folks,
> >
> > I have the Class below for deleting all record stores for a MIDLet.
> >
> > It works fine with the SUN wireless toolkit as well as the IBM J9 VM,
> > but throws an application error on a Motorola V551 phone. If I replace
> > "names.length" with the actual count of the record stores, it works
> > fine. Am I doing something wrong? If not and this is a limitation of
> > the VM the phone uses, are there other ways to get the array length
> > besides "names.length"?
> >
> > Thanks,
> > Raffi
> >
> > Code-----------------------------------------------------------------------
> > public void deleteAllRMS()
> > {
> >
> > names = RecordStore.listRecordStores();
> > int count = names.length;
> >
> > for (int i = 0; i < count; ++i)
> > {
> > try
> > {
> > RecordStore.deleteRecordStore(names[i]);
> > }
> > catch (Exception e)
> > {
> > System.out.println("Error - " + e);
> > }
> > }
> > }
> > -------------------------------------------------------------------------------
> >

>
> How are you deciding on the length of names, to manually put it in your
> code?
>
> Can you see what names.length actually is on the hardware?
>
>
> And, exactly what error does it throw?
>
> Rogan


The Class generates a number of record stores which are used by
defferent Classes for data entry. For testing I statically populate the
record stores and know how many there are and what their content is. So
I substitute the number of recurd stores in the place of names.length.

The MIDLet installs fine on the V551 but throws an "Application Error"
alert when run.

Raffi

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Will application J2ME MIDP 2.0 based of one device run another J2ME MIDP 2.0 device? nishadixit Java 5 06-01-2005 05:40 AM
J2ME/ktoolbar: Send an sms to an emulated J2ME-App Markus Java 4 02-12-2005 01:20 PM
'current custom error settings for application prevent details of application error from being viewed. ' Damian ASP .Net 3 12-30-2003 08:01 PM
J2ME Lime error 10061 (Re: Help with J2ME Wireless Toolkit) Boldra Java 0 12-03-2003 11:30 AM
Can i using j2me program to download and run other j2me programs in emulator? robin Java 0 07-20-2003 12:59 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57