Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cde3c46
fix OOM error handling
fadidurah Jan 10, 2025
4f24891
changes
fadidurah Jan 10, 2025
443fcc2
t push originMerge branch 'dev' of https://github.com/AzureAD/microso…
fadidurah Jan 29, 2025
3bf1b13
comments
fadidurah Jan 29, 2025
0e7b05b
On getBrowserSafeList return empty list if null
p3dr0rv Jan 29, 2025
09e7137
Merge branch 'dev' into pedroro/empty-list-browser-safe-list
p3dr0rv Jan 29, 2025
c756cac
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
fadidurah Jan 30, 2025
584a2aa
Merge branch 'pedroro/empty-list-browser-safe-list' of https://github…
fadidurah Jan 30, 2025
03e1946
changes for common
fadidurah Jan 30, 2025
bcf7347
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
fadidurah Jan 30, 2025
6f85009
adapter
fadidurah Jan 30, 2025
26d9247
switch to killProcess
fadidurah Jan 30, 2025
880625d
platform specific
fadidurah Jan 31, 2025
21d79f7
dev
fadidurah Feb 21, 2025
acf5a66
attributeName
fadidurah Feb 21, 2025
8ccd046
suppress spotbugs
fadidurah Feb 21, 2025
9906e9e
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
fadidurah Feb 25, 2025
f92b7b1
revert
fadidurah Feb 26, 2025
a85a25d
take out changes
fadidurah Feb 26, 2025
8761d65
comment
fadidurah Feb 26, 2025
1783748
track telemetry
fadidurah Feb 26, 2025
0294fc7
Merge branch 'dev' into fadi/oom-handle
fadidurah Feb 28, 2025
9009b65
comments
fadidurah Feb 28, 2025
b20b8ad
try-catch
fadidurah Feb 28, 2025
af1fe6f
throwable
fadidurah Feb 28, 2025
2ccf080
comment
fadidurah Feb 28, 2025
7f675af
Merge branch 'dev' into fadi/oom-handle
fadidurah Feb 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Version 19.0.0
- [MINOR] Managed profile Android util method (#2561)
- [PATCH] Make userHandle response field optional (#2560)
- [MINOR] Nonce redirect changes (#2552)
- [PATCH] Fix OOM error handling (#2567)

Version 18.2.2
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import com.microsoft.identity.common.java.exception.UserCancelException;
import com.microsoft.identity.common.java.logging.Logger;
import com.microsoft.identity.common.java.net.HttpResponse;
import com.microsoft.identity.common.java.opentelemetry.AttributeName;
import com.microsoft.identity.common.java.opentelemetry.SpanExtension;
import com.microsoft.identity.common.java.providers.microsoft.MicrosoftAuthorizationErrorResponse;
import com.microsoft.identity.common.java.providers.oauth2.AuthorizationErrorResponse;
import com.microsoft.identity.common.java.providers.oauth2.AuthorizationResult;
Expand All @@ -66,6 +68,7 @@

import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.opentelemetry.api.trace.Span;
import lombok.NonNull;

public class ExceptionAdapter {
Expand Down Expand Up @@ -436,6 +439,18 @@ public static ClientException clientExceptionFromException(@NonNull final Throwa


if (e instanceof OutOfMemoryError) {
// Log status code and record exception in span
final Span currentSpan = SpanExtension.current();

// Attach the stack trace, to debug in telemetry later
currentSpan.setAttribute(
AttributeName.out_of_memory_exception_stacktrace.name(),
StringUtil.getStacktraceAsStringFromElementArray(e.getStackTrace())
);

com.microsoft.identity.common.java.logging.Logger.warn(
TAG, "Received an out of memory error, stacktrace attached to span.");

return new ClientException(
ClientException.OUT_OF_MEMORY,
e.getMessage(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,5 +327,10 @@ public enum AttributeName {
/**
* Indicates the exception in generating a keypair.
*/
keypair_gen_exception
keypair_gen_exception,

/**
* Records the stacktrace for an out-of-memory exception.
*/
out_of_memory_exception_stacktrace
}
Original file line number Diff line number Diff line change
Expand Up @@ -463,4 +463,24 @@ public static void overwriteWithNull(final char[] chars) {
chars[i] = '\0';
}
}

/**
* Converts an array of stack trace elements (one method invocation) into one concatenated string object.
*
* @param elements list of stacktrace elements
* @return concatenated string list
*/
@NonNull
public static String getStacktraceAsStringFromElementArray(@NonNull final StackTraceElement[] elements) {
final StringBuilder builder = new StringBuilder();

builder.append(elements[0]);

for (int i = 1; i < elements.length; i++) {
builder.append("\n");
builder.append(elements[i]);
}

return builder.toString();
}
}
Loading