[android-developers] Re: JNI check failures when trying to use a configured SOCKS Proxy object...

2009-06-22 Thread Billy Cui

I do have the same problem.  Seems android sdk's problem..


On 5月14日, 上午6时16分, fadden  wrote:
> On May 12, 6:53 pm, fadden  wrote:
>
> > Are you including any of your own native code?  If not, this is likely
> > a bug in the core libraries.
>
> ...and so it is.
>
> OSNetworkSystem.java declares:
>
>static native InetAddress getHostByNameImpl(String addr,
>boolean preferIPv6Addresses) throws UnknownHostException;
>
> That ends up here:
>
> static jobject osNetworkSystem_getHostByNameImpl(JNIEnv* env, jclass
> clazz,
>jstring nameStr, jboolean preferIPv6Addresses) {
>
> which does this:
>
>jbyteArray addr = env->NewByteArray(4);
>  ...
>return addr;
>
> So, it's returning a byte array when an InetAddress object is
> expected.
>
> I'm not sure what a workaround would be.  For reference, here's the
> stack trace (via a new extension to the "Check JNI" feature), using
> the provided APK:
>
> I/InetAddress( 2771): gethostbyaddr: getnameinfo: 192.168.1.4 =
> 192.168.1.4
> W/dalvikvm( 2771): JNI WARNING: method declared to return 'Ljava/net/
> InetAddress;' returned '[B'
> W/dalvikvm( 2771):  failed in Lorg/apache/harmony/luni/
> platform/OSNetworkSystem;.getHostByNameImpl
> I/dalvikvm( 2771): "main" prio=5 tid=3 RUNNABLE
> I/dalvikvm( 2771):   | group="main" sCount=0 dsCount=0 s=N
> obj=0x40018e70
> I/dalvikvm( 2771):   | sysTid=2771 nice=0 sched=0/0 handle=-1094144900
> I/dalvikvm( 2771):   at
> org.apache.harmony.luni.platform.OSNetworkSystem.getHostByNameImpl
> (Native Method)
> I/dalvikvm( 2771):   at
> org.apache.harmony.luni.platform.OSNetworkSystem.getHostByName
> (OSNetworkSystem.java:389)
> I/dalvikvm( 2771):   at
> org.apache.harmony.luni.net.PlainSocketImpl.socksGetServerAddress
> (PlainSocketImpl.java:368)
> I/dalvikvm( 2771):   at
> org.apache.harmony.luni.net.PlainSocketImpl.socksConnect
> (PlainSocketImpl.java:380)
> I/dalvikvm( 2771):   at
> org.apache.harmony.luni.net.PlainSocketImpl.connect
> (PlainSocketImpl.java:224)
> I/dalvikvm( 2771):   at
> org.apache.harmony.luni.net.PlainSocketImpl.connect
> (PlainSocketImpl.java:521)
> I/dalvikvm( 2771):   at java.net.Socket.connect(Socket.java:1019)
> I/dalvikvm( 2771):   at
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.
> (HttpConnection.java:67)
> I/dalvikvm( 2771):   at
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager
> $ConnectionPool.getHttpConnection(HttpConnectionManager.java:151)
> I/dalvikvm( 2771):   at
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection
> (HttpConnectionManager.java:79)
> I/dalvikvm( 2771):   at
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection
> (HttpURLConnection.java:828)
> I/dalvikvm( 2771):   at
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect
> (HttpURLConnection.java:800)
> I/dalvikvm( 2771):   at com.test.socks.Socks5ProxyTest.onStart
> (Socks5ProxyTest.java:103)
> I/dalvikvm( 2771):   at android.app.Instrumentation.callActivityOnStart
> (Instrumentation.java:1205)
> I/dalvikvm( 2771):   at android.app.Activity.performStart
> (Activity.java:3490)
> I/dalvikvm( 2771):   at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2302)
> I/dalvikvm( 2771):   at android.app.ActivityThread.handleLaunchActivity
> (ActivityThread.java:2346)
> I/dalvikvm( 2771):   at android.app.ActivityThread.access$1800
> (ActivityThread.java:112)
> I/dalvikvm( 2771):   at android.app.ActivityThread$H.handleMessage
> (ActivityThread.java:1751)
> I/dalvikvm( 2771):   at android.os.Handler.dispatchMessage
> (Handler.java:99)
> I/dalvikvm( 2771):   at android.os.Looper.loop(Looper.java:123)
> I/dalvikvm( 2771):   at android.app.ActivityThread.main
> (ActivityThread.java:4021)
> I/dalvikvm( 2771):   at java.lang.reflect.Method.invokeNative(Native
> Method)
> I/dalvikvm( 2771):   at java.lang.reflect.Method.invoke(Method.java:
> 521)
> I/dalvikvm( 2771):   at com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:841)
> I/dalvikvm( 2771):   at com.android.internal.os.ZygoteInit.main
> (ZygoteInit.java:599)
> I/dalvikvm( 2771):   at dalvik.system.NativeStart.main(Native Method)
> I/dalvikvm( 2771):
> E/dalvikvm( 2771): VM aborting
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: JNI check failures when trying to use a configured SOCKS Proxy object...

2009-05-13 Thread fadden

On May 12, 6:53 pm, fadden  wrote:
> Are you including any of your own native code?  If not, this is likely
> a bug in the core libraries.

...and so it is.

OSNetworkSystem.java declares:

   static native InetAddress getHostByNameImpl(String addr,
   boolean preferIPv6Addresses) throws UnknownHostException;

That ends up here:

static jobject osNetworkSystem_getHostByNameImpl(JNIEnv* env, jclass
clazz,
   jstring nameStr, jboolean preferIPv6Addresses) {

which does this:

   jbyteArray addr = env->NewByteArray(4);
 ...
   return addr;

So, it's returning a byte array when an InetAddress object is
expected.

I'm not sure what a workaround would be.  For reference, here's the
stack trace (via a new extension to the "Check JNI" feature), using
the provided APK:

I/InetAddress( 2771): gethostbyaddr: getnameinfo: 192.168.1.4 =
192.168.1.4
W/dalvikvm( 2771): JNI WARNING: method declared to return 'Ljava/net/
InetAddress;' returned '[B'
W/dalvikvm( 2771):  failed in Lorg/apache/harmony/luni/
platform/OSNetworkSystem;.getHostByNameImpl
I/dalvikvm( 2771): "main" prio=5 tid=3 RUNNABLE
I/dalvikvm( 2771):   | group="main" sCount=0 dsCount=0 s=N
obj=0x40018e70
I/dalvikvm( 2771):   | sysTid=2771 nice=0 sched=0/0 handle=-1094144900
I/dalvikvm( 2771):   at
org.apache.harmony.luni.platform.OSNetworkSystem.getHostByNameImpl
(Native Method)
I/dalvikvm( 2771):   at
org.apache.harmony.luni.platform.OSNetworkSystem.getHostByName
(OSNetworkSystem.java:389)
I/dalvikvm( 2771):   at
org.apache.harmony.luni.net.PlainSocketImpl.socksGetServerAddress
(PlainSocketImpl.java:368)
I/dalvikvm( 2771):   at
org.apache.harmony.luni.net.PlainSocketImpl.socksConnect
(PlainSocketImpl.java:380)
I/dalvikvm( 2771):   at
org.apache.harmony.luni.net.PlainSocketImpl.connect
(PlainSocketImpl.java:224)
I/dalvikvm( 2771):   at
org.apache.harmony.luni.net.PlainSocketImpl.connect
(PlainSocketImpl.java:521)
I/dalvikvm( 2771):   at java.net.Socket.connect(Socket.java:1019)
I/dalvikvm( 2771):   at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.
(HttpConnection.java:67)
I/dalvikvm( 2771):   at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager
$ConnectionPool.getHttpConnection(HttpConnectionManager.java:151)
I/dalvikvm( 2771):   at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection
(HttpConnectionManager.java:79)
I/dalvikvm( 2771):   at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection
(HttpURLConnection.java:828)
I/dalvikvm( 2771):   at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect
(HttpURLConnection.java:800)
I/dalvikvm( 2771):   at com.test.socks.Socks5ProxyTest.onStart
(Socks5ProxyTest.java:103)
I/dalvikvm( 2771):   at android.app.Instrumentation.callActivityOnStart
(Instrumentation.java:1205)
I/dalvikvm( 2771):   at android.app.Activity.performStart
(Activity.java:3490)
I/dalvikvm( 2771):   at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2302)
I/dalvikvm( 2771):   at android.app.ActivityThread.handleLaunchActivity
(ActivityThread.java:2346)
I/dalvikvm( 2771):   at android.app.ActivityThread.access$1800
(ActivityThread.java:112)
I/dalvikvm( 2771):   at android.app.ActivityThread$H.handleMessage
(ActivityThread.java:1751)
I/dalvikvm( 2771):   at android.os.Handler.dispatchMessage
(Handler.java:99)
I/dalvikvm( 2771):   at android.os.Looper.loop(Looper.java:123)
I/dalvikvm( 2771):   at android.app.ActivityThread.main
(ActivityThread.java:4021)
I/dalvikvm( 2771):   at java.lang.reflect.Method.invokeNative(Native
Method)
I/dalvikvm( 2771):   at java.lang.reflect.Method.invoke(Method.java:
521)
I/dalvikvm( 2771):   at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:841)
I/dalvikvm( 2771):   at com.android.internal.os.ZygoteInit.main
(ZygoteInit.java:599)
I/dalvikvm( 2771):   at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm( 2771):
E/dalvikvm( 2771): VM aborting

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: JNI check failures when trying to use a configured SOCKS Proxy object...

2009-05-12 Thread fadden

On May 11, 4:58 pm, AndyK  wrote:
> I'm trying to write a simple application that will utilize a Socks5
> proxy server to connect to a web server (www.google.com).  I am using
> an instance of 'java.net.Proxy' of type 'SOCKS' in my application and
> am using my implementation of ProxySelector.  I can see from the
> logcat output that my implementation of ProxySelector is being called
> and will passback a list containing one Proxy instance.  When I run
> this code in the emulator, I consistently get a JNI check error
> resulting in the VM aborting.  I have attempted to run this
> application with recent public releases of the SDK, all resulting in
> the same behavior, JNI check failure and VM abort.

Are you including any of your own native code?  If not, this is likely
a bug in the core libraries.

Can you send me an APK that demonstrates the behavior?

FWIW, some bit of code is trying to access a field in a byte array,
which doesn't work very well since byte arrays don't have fields.  I
wasn't able to convert the native stack trace you posted to symbolic
form.  If I have a reproducible case it'll be easy to figure out.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---