Skip to content

Commit d58fed4

Browse files
ahmedAlaaInstabuga7medevHeshamMegid
authored
fix(android) : OOM error in network log (#1162)
* fix(android): oom error in network log * fix(android): oom error in network log * fix: Unexpected token (??) on old version * Update CHANGELOG.md Co-authored-by: Ahmed Mahmoud <[email protected]> * fix: lint issue * fix: lint issue --------- Co-authored-by: Ahmed Mahmoud <[email protected]> Co-authored-by: Hesham Abd-Elmegid <[email protected]>
1 parent 9006668 commit d58fed4

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

android/src/main/java/com/instabug/reactlibrary/RNInstabugAPMModule.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public void run() {
220220
}
221221

222222
/**
223-
* Send Apm network log by Reflection
223+
* Send Apm network log by Reflection
224224
*/
225225
@ReactMethod
226226
public void networkLog(String networkData) throws JSONException {
@@ -242,8 +242,8 @@ public void networkLog(String networkData) throws JSONException {
242242
final Integer statusCode = (Integer) jsonObject.get("responseCode");
243243
final long requestDuration = ((Number) jsonObject.get("duration")).longValue();
244244
final long requestStartTime = ((Number) jsonObject.get("startTime")).longValue() * 1000;
245-
final String requestHeaders = (String) jsonObject.get("requestHeaders").toString();
246-
final String responseHeaders = (String) jsonObject.get("responseHeaders").toString();
245+
final String requestHeaders = (String) jsonObject.get("requestHeaders").toString();
246+
final String responseHeaders = (String) jsonObject.get("responseHeaders").toString();
247247
final String errorMessage;
248248
if(errorDomain.equals("")) {
249249
errorMessage = null;
@@ -254,25 +254,21 @@ public void networkLog(String networkData) throws JSONException {
254254
String gqlQueryName = null;
255255
if(jsonObject.has("gqlQueryName")){
256256
gqlQueryName = (String) jsonObject.get("gqlQueryName");
257-
}
257+
}
258258
final String serverErrorMessage = (String) jsonObject.get("serverErrorMessage");
259-
259+
260260
try {
261261
Method method = getMethod(Class.forName("com.instabug.apm.networking.APMNetworkLogger"), "log", long.class, long.class, String.class, String.class, long.class, String.class, String.class, String.class, String.class, String.class, long.class, int.class, String.class, String.class, String.class, String.class);
262262
if (method != null) {
263263
method.invoke(apmNetworkLogger, requestStartTime, requestDuration, requestHeaders, requestBody, requestBodySize, requestMethod, requestUrl, requestContentType, responseHeaders, responseBody, responseBodySize, statusCode, responseContentType, errorMessage, gqlQueryName, serverErrorMessage);
264264
} else {
265265
Log.e("IB-CP-Bridge", "apmNetworkLogByReflection was not found by reflection");
266266
}
267-
} catch (ClassNotFoundException e) {
268-
e.printStackTrace();
269-
} catch (IllegalAccessException e) {
270-
e.printStackTrace();
271-
} catch (InvocationTargetException e) {
267+
} catch (Throwable e) {
272268
e.printStackTrace();
273269
}
274270
}
275-
catch(Exception e) {
271+
catch(Throwable e) {
276272
e.printStackTrace();
277273
}
278274
}

0 commit comments

Comments
 (0)