Question

I used dex2jar tool to de-compile an apk file, All code can de-compile correctly but this method,

  // ERROR //
  public void sendPacket(byte[] paramArrayOfByte)
  {
    // Byte code:
    //   0: new 82  android/net/LocalSocket
    //   3: dup
    //   4: invokespecial 83    android/net/LocalSocket:<init>  ()V
    //   7: astore_2
    //   8: aload_2
    //   9: new 85  android/net/LocalSocketAddress
    //   12: dup
    //   13: ldc 87
    //   15: getstatic 93   android/net/LocalSocketAddress$Namespace:FILESYSTEM Landroid/net/LocalSocketAddress$Namespace;
    //   18: invokespecial 96   android/net/LocalSocketAddress:<init>   (Ljava/lang/String;Landroid/net/LocalSocketAddress$Namespace;)V
    //   21: invokevirtual 100  android/net/LocalSocket:connect (Landroid/net/LocalSocketAddress;)V
    //   24: aload_2
    //   25: invokevirtual 104  android/net/LocalSocket:getOutputStream ()Ljava/io/OutputStream;
    //   28: astore 7
    //   30: aload_2
    //   31: invokevirtual 108  android/net/LocalSocket:getInputStream  ()Ljava/io/InputStream;
    //   34: astore 8
    //   36: aload 7
    //   38: aload_1
    //   39: invokevirtual 113  java/io/OutputStream:write  ([B)V
    //   42: aload 7
    //   44: invokevirtual 116  java/io/OutputStream:flush  ()V
    //   47: sipush 128
    //   50: newarray byte
    //   52: astore 9
    //   54: aload 8
    //   56: aload 9
    //   58: invokevirtual 122  java/io/InputStream:read    ([B)I
    //   61: pop
    //   62: new 124    com/qualcomm/logkit/settings/ConfigPacket
    //   65: dup
    //   66: aload 9
    //   68: invokespecial 126  com/qualcomm/logkit/settings/ConfigPacket:<init>    ([B)V
    //   71: astore 11
    //   73: aload 11
    //   75: getfield 130   com/qualcomm/logkit/settings/ConfigPacket:msg_type  B
    //   78: tableswitch    default:+26 -> 104, -127:+50->128, -126:+26->104, -125:+95->173
    //   105: iconst_4
    //   106: invokevirtual 133 java/io/OutputStream:close  ()V
    //   109: aload 8
    //   111: invokevirtual 134 java/io/InputStream:close   ()V
    //   114: aload_2
    //   115: ifnull +7 -> 122
    //   118: aload_2
    //   119: invokevirtual 135 android/net/LocalSocket:close   ()V
    //   122: aload_0
    //   123: iconst_0
    //   124: putfield 18   com/qualcomm/logkit/settings/UnixSocketSendThread:isRunning Z
    //   127: return
    //   128: aload 11
    //   130: getfield 139  com/qualcomm/logkit/settings/ConfigPacket:logConfig Lcom/qualcomm/logkit/settings/ConfigPacket$qlog_conf;
    //   133: getfield 144  com/qualcomm/logkit/settings/ConfigPacket$qlog_conf:filter_str  [B
    //   136: invokestatic 150  com/qualcomm/logkit/utils/UtilsStringOperation:byteToString ([B)Ljava/lang/String;
    //   139: invokestatic 152  com/qualcomm/logkit/settings/UnixSocketSendThread:logd  (Ljava/lang/Object;)V
    //   142: goto -38 -> 104
    //   145: astore 5
    //   147: aload 5
    //   149: invokestatic 154  com/qualcomm/logkit/settings/UnixSocketSendThread:loge  (Ljava/lang/Object;)V
    //   152: aload_2
    //   153: ifnull -31 -> 122
    //   156: aload_2
    //   157: invokevirtual 135 android/net/LocalSocket:close   ()V
    //   160: goto -38 -> 122
    //   163: astore 6
    //   165: aload 6
    //   167: invokestatic 154  com/qualcomm/logkit/settings/UnixSocketSendThread:loge  (Ljava/lang/Object;)V
    //   170: goto -48 -> 122
    //   173: aload 11
    //   175: getfield 158  com/qualcomm/logkit/settings/ConfigPacket:logGlobalConfig   Lcom/qualcomm/logkit/settings/ConfigPacket$qlog_global_conf;
    //   178: getfield 163  com/qualcomm/logkit/settings/ConfigPacket$qlog_global_conf:log_path [B
    //   181: invokestatic 152  com/qualcomm/logkit/settings/UnixSocketSendThread:logd  (Ljava/lang/Object;)V
    //   184: goto -80 -> 104
    //   187: astore_3
    //   188: aload_2
    //   189: ifnull +7 -> 196
    //   192: aload_2
    //   193: invokevirtual 135 android/net/LocalSocket:close   ()V
    //   196: aload_3
    //   197: athrow
    //   198: astore 12
    //   200: aload 12
    //   202: invokestatic 154  com/qualcomm/logkit/settings/UnixSocketSendThread:loge  (Ljava/lang/Object;)V
    //   205: goto -83 -> 122
    //   208: astore 4
    //   210: aload 4
    //   212: invokestatic 154  com/qualcomm/logkit/settings/UnixSocketSendThread:loge  (Ljava/lang/Object;)V
    //   215: goto -19 -> 196
    //
    // Exception table:
    //   from   to  target  type
    //   8  114 145 java/io/IOException
    //   128    142 145 java/io/IOException
    //   173    184 145 java/io/IOException
    //   156    160 163 java/io/IOException
    //   8  114 187 finally
    //   128    142 187 finally
    //   147    152 187 finally
    //   173    184 187 finally
    //   118    122 198 java/io/IOException
    //   192    196 208 java/io/IOException
  }

What's wrong?

Was it helpful?

Solution

What's wrong?

Nothing is wrong. Decompilers often have problems with code that is too complicated, or that has been obfuscated (to deliberately make it hard to decompile ...)

What can you do about it? Not much ... apart from decompiling the code your self by hand. (But that won't be easy. For a start, you will need to figure out the ranges of the exception handling, and recreate the try / catch / finally blocks.)

OTHER TIPS

It is either simply a limitation of the decompiler, or perhaps this method was obfuscated. Although, usually entire .apks are obfuscated, not just a method. Maybe if you say which .apk this is, it would suggest the more likely answer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top