ArrayIndexOutOfBounds in Thread.getState() ...

by Pent » Thu, 19 May 2011 04:56:32 GMT


Sponsored Links
 I've had this sometimes in the console, wrote it off as sporadic
malign alien influence. A user just contacted me that it started
happening after an upgrade from 2.2 to 2.2.2.

Brief version:

Caused by: java.lang.ArrayIndexOutOfBoundsException
at java.lang.Thread.getState(Thread.java:812)
at net.dinglisch.android.taskerm.ExecuteService.onStart(Unknown
Source)
at android.app.Service.onStartCommand(Service.java:420)

Looks like a bug in the library or ... ?

No idea if it happens with newer Android versions, it's not mentioned
by the console error reports.

Pent

--------------------------------------------------------------------------------
Full version:

java.lang.RuntimeException: Unable to start service
net.dinglisch.android.taskerm.ExecuteService@45d59050 with Intent
{ cmp=net.dinglisch.android.taskerm/.ExecuteService (has extras) }:
java.lang.ArrayIndexOutOfBoundsException
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:
3153)
at android.app.ActivityThread.access$3800(ActivityThread.java:129)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
2180)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:4717)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ArrayIndexOutOfBoundsException
at java.lang.Thread.getState(Thread.java:812)
at net.dinglisch.android.taskerm.ExecuteService.onStart(Unknown
Source)
at android.app.Service.onStartCommand(Service.java:420)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:
3143)

-- 



Re: ArrayIndexOutOfBounds in Thread.getState() ...

by fadden » Fri, 20 May 2011 07:57:39 GMT


 


Weird.  That line is:

            int state = thread.getStatus();
            if(state != -1) {
                return VMThread.STATE_MAP[state]; // 812
            }

The STATE_MAP array has Thread.State entries for all valid thread
states, suggesting that the thread is in some weird state.
Unfortunately the exception doesn't say what element it was trying to
access.  (Newer versions of the VM and core libs are more verbose on
these exceptions.)

-- 


Sponsored Links


Other Threads

1. Does App description matter in Android Market search listing

Lately I am seeing tons of spam apps that have huge app description
text. Take for example  the app "TOP Charlie Sheen Soundboard" from
Soundboard Master.

If you look at their app description it has like three of four pages
of all possible types of search keywords. Some of the keywords listed
are "car stunts jet", "plants vs zombies", "MADDEN NFL 11" and so on.
You get the picture.

My question is : does google do anything about it? Or their algorithm
just boost the app across all categories - which in my opinion is
happening because I do see such junk in lot of search listings in
Android Market.

Does google plan to address these kind of spam apps?

-- 

2. sending parcelable objects to different process

Hi there,
I want to send my custom object which implements Parcelable from one
process(application) to an activity in another one process. But I
still get error message: BadParcelableException:
ClassNotFoundException when unmarshalling. I accepted some advices but
still not working. Here is my code:

// here is my class which implements parcelable and which i want to
send
public class Place implements Parcelable{
        int ID;
        String name;
        boolean in;
        boolean notify;

        public Place(int ID , String name, boolean notify) {
                this.ID = ID;
                this.name = name;
                in = false;
                this.notify = notify;
        }

        @Override
        public int describeContents() {
                // TODO Auto-generated method stub
                return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
                dest.writeInt(ID);
                dest.writeString(name);
                dest.writeInt((in)? 1:0);
                dest.writeInt((notify)? 1:0);
        }

        public static final Parcelable.Creator<Place> CREATOR = new
Creator<Place>() {

                @Override
                public Place[] newArray(int size) {
                        return new Place[size];
                }

                @Override
                public Place createFromParcel(Parcel source) {
                        return new Place(source);
                }
        };

        private Place(Parcel p) {
                ID = p.readInt();
                name = p.readString();
                in = ((p.readInt() == 0)? false:true);
                notify = ((p.readInt() == 0)? false:true);
        }
}


// In the service I put the Place object into bundle and I add it as
data to message, then i send it to replyTo(Messenger of the activity)
try {
  b = new Bundle();
  b.putParcelable("place", allPlaces.get(0));
  m = Message.obtain(null, GET_PLACE);
  m.setData(b);
  msg.replyTo.send(m);
} catch (RemoteException e1) {
  e1.printStackTrace();
}

// Here is the handler which handles the message
b = new Bundle();
b = msg.getData();
b.setClassLoader(getClassLoader()); // somewhere i read i should reset
the class loader to the loader of the activity in different process
Place p = (Place) b.getParcelable("place");
Toast.makeText(getApplicationContext(), "name: "+p.name,
Toast.LENGTH_SHORT).show();

Can you help me pls or am I missing something? I'm going crazy, every
advice is worth.

-- 

3. Settine 3G only di Galaxy Gio

4. how to clear cache after read a file

5. [SIM unlocked Developer Phone]

6. internet filter

7. Fwd: WTS : [Pre-Order] NEW ITEMS!! High Quality Accessories From Korea (Sony Ericsson Xperia Arc, Samsung Galaxy SII / i9100, LG Optimus 2X, Nexus S, Atrix 4G, Galaxy Ace, dll)