From eb7df23072846331cde25f91f35e1840a580b69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Falvai?= Date: Mon, 17 Aug 2026 10:56:32 +0200 Subject: [PATCH] Android: fix broken stack trace logging in signature/JWT verification CodePushUtils.log(ex.getStackTrace().toString()) never printed an actual stack trace - getStackTrace() returns an array, and Object.toString() on an array just prints its identity hash (e.g. "[Ljava.lang.StackTraceElement;@1a2b3c"). That line has never been useful. Replace the getMessage()+getStackTrace().toString() pair in verifyAndDecodeJWT, parsePublicKey, and getSignature with a single CodePushUtils.log(Throwable) call, which does print the real trace via Log.e. This is the least-diagnosable failure class in the codebase today (JWT/signature verification failures all collapse into "not signed"/"no public key" with zero trace), so this restores real visibility into those three failure modes. --- .../microsoft/codepush/react/CodePushUpdateUtils.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java b/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java index 0a6d4d86..2c90b851 100644 --- a/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +++ b/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java @@ -199,8 +199,7 @@ public static Map verifyAndDecodeJWT(String jwt, PublicKey publi } return null; } catch (Exception ex) { - CodePushUtils.log(ex.getMessage()); - CodePushUtils.log(ex.getStackTrace().toString()); + CodePushUtils.log(ex); return null; } } @@ -218,8 +217,7 @@ public static PublicKey parsePublicKey(String stringPublicKey) { return kf.generatePublic(X509Key); } catch (Exception e) { - CodePushUtils.log(e.getMessage()); - CodePushUtils.log(e.getStackTrace().toString()); + CodePushUtils.log(e); return null; } } @@ -237,8 +235,7 @@ public static String getSignature(String folderPath) { try { return FileUtils.readFileToString(signatureFilePath); } catch (IOException e) { - CodePushUtils.log(e.getMessage()); - CodePushUtils.log(e.getStackTrace().toString()); + CodePushUtils.log(e); return null; } }