Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private class ProfileEventVisitor implements EventCollector.Visitor {
private final @NotNull JfrReader jfr;
private final @NotNull Arguments args;

public ProfileEventVisitor(
ProfileEventVisitor(
@NotNull SentryProfile sentryProfile,
@NotNull SentryStackTraceFactory stackTraceFactory,
@NotNull JfrReader jfr,
Expand Down
3 changes: 3 additions & 0 deletions sentry-jul/src/main/java/io/sentry/jul/SentryHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
import org.slf4j.MDC;

/** Logging handler in charge of sending the java.util.logging records to a Sentry server. */
// temp fix for JDK 21: Constructors call overridable methods; making them final would break the
// public API.
@SuppressWarnings("this-escape")
@Open
public class SentryHandler extends Handler {
public static final String MECHANISM_TYPE = "JulSentryHandler";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private void finishTransaction(

try {
final double enqueuedTimeSeconds = Double.parseDouble(enqueuedTimeStr);
final double nowSeconds = DateUtils.millisToSeconds(System.currentTimeMillis());
final double nowSeconds = DateUtils.millisToSeconds((double) System.currentTimeMillis());
final long latencyMs = (long) ((nowSeconds - enqueuedTimeSeconds) * 1000);
return latencyMs >= 0 ? latencyMs : null;
} catch (NumberFormatException ignored) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ static final class SentryProducerHandler<K, V> implements InvocationHandler {
}

@Override
@SuppressWarnings("unchecked")
// temp fix for JDK 21: Proxy equals() is identity-based.
@SuppressWarnings({"unchecked", "ReferenceEquality"})
public @Nullable Object invoke(
final @NotNull Object proxy, final @NotNull Method method, final @Nullable Object[] args)
throws Throwable {
Expand Down Expand Up @@ -236,7 +237,8 @@ private void maybeInjectHeaders(final @NotNull Headers headers, final @Nullable
headers.remove(SENTRY_ENQUEUED_TIME_HEADER);
headers.add(
SENTRY_ENQUEUED_TIME_HEADER,
DateUtils.doubleToBigDecimal(DateUtils.millisToSeconds(System.currentTimeMillis()))
DateUtils.doubleToBigDecimal(
DateUtils.millisToSeconds((double) System.currentTimeMillis()))
.toString()
.getBytes(StandardCharsets.UTF_8));
} catch (Throwable t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ protected void captureLog(@NotNull ILoggingEvent loggingEvent) {
final @NotNull SentryLogParameters params = SentryLogParameters.create(attributes);
params.setOrigin("auto.log.logback");

Sentry.logger().log(sentryLevel, params, formattedMessage, arguments);
Sentry.logger()
.log(sentryLevel, params, formattedMessage, arguments != null ? arguments : new Object[0]);
}

@SuppressWarnings("deprecation")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public final class OtelContextScopesStorage implements IScopesStorage {

@Override
public void init() {
/**
/*
* We're currently overriding the storage mechanism to allow for cleanup of non closed OTel
* scopes. These happen when using e.g. Sentry static API due to getCurrentScopes() invoking
* Context.makeCurrent and then ignoring the returned lifecycle token (OTel Scope). After fixing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public final class SentryOtelThreadLocalStorage implements ContextStorage {

private static final ThreadLocal<Context> THREAD_LOCAL_STORAGE = new ThreadLocal<>();

// temp fix for JDK 21: Same identity check as OpenTelemetry's ThreadLocalContextStorage.
@SuppressWarnings("ReferenceEquality")
@Override
public Scope attach(Context toAttach) {
if (toAttach == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static <T> Mono<T> withSentryForkedRoots(final @NotNull Mono<T> mono) {
*/
public static <T> Mono<T> withSentryScopes(
final @NotNull Mono<T> mono, final @NotNull IScopes scopes) {
/**
/*
* WARNING: Cannot set the scopes as current. It would be used by others to clone again causing
* shared scopes and thus leading to issues like unrelated breadcrumbs showing up in events.
*/
Expand Down Expand Up @@ -96,7 +96,7 @@ public static <T> Flux<T> withSentryForkedRoots(final @NotNull Flux<T> flux) {
*/
public static <T> Flux<T> withSentryScopes(
final @NotNull Flux<T> flux, final @NotNull IScopes scopes) {
/**
/*
* WARNING: Cannot set the scopes as current. It would be used by others to fork again causing
* shared scopes and thus leading to issues like unrelated breadcrumbs showing up in events.
*/
Expand Down
Loading