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. Listening to camera image capture

I'm quite new to android development and I'm doing some experiments to
try it out. Currently what I am trying to do is every time a picture
is taken get it's file path. I understand that Broadcast Receiver is
one way of implementing listeners in android.
I successfully implemented one (which listens to AIRPLANE_MODE and
outputs log messages), but for camera pictures I can't find an
appropriate intent. I already tried MEDIA_SCANNER_SCAN_FILE with no
success. Here is my current android manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="test.app" android:versionCode="1"
   android:versionName="1.0">
   <application android:icon="@drawable/icon" android:label="@string/
app_name">
      <receiver android:name="TestBroadcastReceiver">
         <intent-filter>
            <action
android:name="android.intent.action.MEDIA_SCANNER_SCAN_FILE" />
            <data android:scheme="file" />
         </intent-filter>
      </receiver>
   </application>
   <uses-sdk android:minSdkVersion="8" />
</manifest>

Is this possible to achieve? Any clue anyone?

Thanks in advance,
Thiago Souza

-- 

2. Extend android.hardware.Camera to support new function

Hi everyone,

i create my own class which extends camera class
(android.hardware.camera).
i want to check if application can use my own class instead of
android.hardware.camera when i run ApiDemos.
i write one function to be override and a new function in my own
class. Those codes i modify are:

A.the MyCamera.java in android\frameworks\base\core\java\android
\hardware :


package android.hardware;
import android.hardware.Camera;


public class MyCamera extends Camera{
   int test1;
   int test2;

    public MyCamera(){
     test1 = 0;
    }

    // Override the function in android.hardware.Camera //
    public int getJpegQuality() {
           test1 = 8;
           return test1;
        }


    public int mytest() {
     test2 = 9;
     return test2;
    }
}


B. The CameraPreview.java in android_sdk\samples\android-8\ApiDemos\src
\com\example\android\apis\graphics:


package com.example.android.apis.graphics;

import android.app.Activity;

import android.content.Context;
import android.hardware.Camera;
import android.hardware.Camera.Size;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.Window;
import android.hardware.MyCamera;
import java.io.IOException;
import java.util.List;


public class CameraPreview extends Activity {
    private Preview mPreview;

    @Override
 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Hide the window title.
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        MyCamera mycamera = new MyCamera();
        int tmp1 = 0;
        int tmp2 = 0 ;
        tmp1  = mycamera.mytest();
        tmp2 = mycamera.getJpegQuality();

        // Create our Preview view and set it as the content of our
activity.
        mPreview = new Preview(this);
        setContentView(mPreview);
    }
    .....
    .....

i also add MyCamera class infomation in android.jar(extract
MyCamera.java
from android\out\target\common\obj\JAVA_LIBRARIES
\android_stubs_current_intermediates\javalib.jar
and add it in android_sdk\platforms\android-8\android.jar)
and when i use eclipse to debug my code, i get
"ERROR/dalvikvm(266): Could not find class
'android.hardware.MyCamera',
referenced from method
com.example.android.apis.graphics.CameraPreview.onCreate"

Please give me any suggestion.

Thanks a lot.

Steven

-- 

3. InstrumentationTestCase.sendKeys() fails on headless emulators

4. Adding a tabhost in viewflipper

5. integrating skyhook in android application

6. About NexusOne Android2.1 contacts problem

7. statelistdrawable in xml