{"action":"closed","issue":{"url":"https://api.github.com/repos/square/retrofit/issues/1992","repository_url":"https://api.github.com/repos/square/retrofit","labels_url":"https://api.github.com/repos/square/retrofit/issues/1992/labels{/name}","comments_url":"https://api.github.com/repos/square/retrofit/issues/1992/comments","events_url":"https://api.github.com/repos/square/retrofit/issues/1992/events","html_url":"https://github.com/square/retrofit/issues/1992","id":173103172,"number":1992,"title":"please help me ","user":{"login":"Guolei1130","id":12966526,"avatar_url":"https://avatars.githubusercontent.com/u/12966526?v=3","gravatar_id":"","url":"https://api.github.com/users/Guolei1130","html_url":"https://github.com/Guolei1130","followers_url":"https://api.github.com/users/Guolei1130/followers","following_url":"https://api.github.com/users/Guolei1130/following{/other_user}","gists_url":"https://api.github.com/users/Guolei1130/gists{/gist_id}","starred_url":"https://api.github.com/users/Guolei1130/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Guolei1130/subscriptions","organizations_url":"https://api.github.com/users/Guolei1130/orgs","repos_url":"https://api.github.com/users/Guolei1130/repos","events_url":"https://api.github.com/users/Guolei1130/events{/privacy}","received_events_url":"https://api.github.com/users/Guolei1130/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-25T02:54:23Z","updated_at":"2016-08-25T03:19:24Z","closed_at":"2016-08-25T03:19:24Z","body":"this is error message.\r\n```\r\napplication interceptor com.blueware.agent.android.instrumentation.okhttp3.d@41c1cec0 returned null\r\n```\r\nthis is code \r\n```\r\nRetrofit.Builder builder = new Retrofit.Builder()\r\n                .baseUrl(\"http://api.xxxx:8080\")\r\n                .addConverterFactory(SecurityGsonConverterFactory.create());\r\n        OkHttpClient client = new OkHttpClient().newBuilder()\r\n                .addInterceptor(new SecurityInterceptor())\r\n                .build();\r\n        Retrofit retrofit = builder.client(client).build();\r\n        ;\r\n        try {\r\n            retrofit.create(UserApi.class).sign(\r\n                    URLEncoder.encode(userName, \"UTF-8\").replace(\"*\", \"%2A\").replace(\"+\", \"%20\").replace(\"%7E\", \"~\"),\r\n                    URLEncoder.encode(pwd, \"UTF-8\").replace(\"*\", \"%2A\").replace(\"+\", \"%20\").replace(\"%7E\", \"~\")\r\n            ).enqueue(new retrofit2.Callback<USER>() {\r\n                @Override\r\n                public void onResponse(retrofit2.Call<USER> call, retrofit2.Response<USER> response) {\r\n\r\n                }\r\n\r\n                @Override\r\n                public void onFailure(retrofit2.Call<USER> call, Throwable t) {\r\n\r\n                }\r\n            });\r\n        } catch (UnsupportedEncodingException e) {\r\n            e.printStackTrace();\r\n        }\r\n```\r\n\r\nand \r\n```\r\n@Override\r\n    public Response intercept(Chain chain) throws IOException {\r\n\r\n        String model = android.os.Build.MODEL;\r\n        model = model.replaceAll(\"[`~!@#$%^&*()+=|{}':;',\\\\[\\\\].<>/?~！@#￥%……& amp;*（）——+|{}【】‘；：”“’。，、？|-]\", \"\");\r\n\r\n        Request request = chain.request();\r\n        RequestBody oldBody = request.body();\r\n        Buffer buffer = new Buffer();\r\n        oldBody.writeTo(buffer);\r\n        StringBuffer stringBuffer = new StringBuffer();\r\n        String s ;\r\n        while((s = buffer.readUtf8Line()) != null){\r\n            stringBuffer.append(s);\r\n        }\r\n        MediaType mediaType = MediaType.parse(\"text/plain; charset=utf-8\");\r\n        StringBuilder resultUrl = encrypt(stringBuffer.toString().trim());\r\n\r\n        String newString = null;\r\n        String signString = null;\r\n        if (resultUrl.length()>0){\r\n            int last = resultUrl.lastIndexOf(\"&\");\r\n            String str = resultUrl.substring(0, last);\r\n            String timestamp = System.currentTimeMillis() / 1000 + \"\";\r\n            String sign = HmacSHA256.getHmacSHA256(timestamp + str, UserAppConst.SIGN_KEY);\r\n            signString = sign + \",\" + timestamp;\r\n            newString = \"x=\"+ XXTEA.encryptToBase64String(str, AppDataCenter.AppDataKey);\r\n        }\r\n\r\n        RequestBody body = RequestBody.create(mediaType, newString);\r\n        request = request.newBuilder().\r\n                header(\"Content-Type\", body.contentType().toString()).\r\n                header(\"Content-Length\", String.valueOf(body.contentLength()))\r\n                // TODO: 2016/8/23 添加其他header\r\n                .header(\"X-ECAPI-Authorization\", SESSION.getInstance().getToken())\r\n                .header(\"X-ECAPI-UserAgent\", \"Platform/Android, Device/\"+model+\", Lang/\"+ UserAgent.getInstance().lang+\", ScreenWidth/\"+UserAgent.getInstance().width+\", ScreenHeight/\"+UserAgent.getInstance().height)\r\n                .header(\"X-ECAPI-UDID\", UserAgent.getInstance().UDID)\r\n                .header(\"X-ECAPI-Ver\", UserAgent.getInstance().ver)\r\n                .header(\"X-ECAPI-Sign\",signString)\r\n                .method(request.method(), body)\r\n                .build();\r\n        Log.e(\"test\", \"intercept: \" + newString);\r\n        Response response = chain.proceed(request);\r\n        if (response == null){\r\n            Log.e(\"test\", \"intercept: \" + \"null\");\r\n        }\r\n        return response;\r\n    }\r\n```\r\n\r\n"}}
{"actor":{"display_login":"JakeWharton"}}