Skip to content

Merging of undefined external option of type "list" overrides internal one actually defined #4205

@dalbani

Description

@dalbani

Integration

sentry

Java Version

21

Version

8.2.0

Steps to Reproduce

Create a SentryHandler like the following, in this case setting the list of ignored errors:

SentryOptions options = new SentryOptions();
options.setIgnoredErrors(List.of("error1", "error2"));
...
SentryHandler handler = new SentryHandler(options);
...

Register the handler and when an issue is handled by Sentry, realise that the list of ignored errors is actually empty.

This is due to the fact that:

  1. The SentryHandler constructor always sets enableExternalConfiguration = true and thus triggers a configuration merge
  2. PropertiesProvider::getList() returns an empty list if the property (e.g. ignored-errors in this case) is missing
  3. SentryOptions::setIgnoredErrors() called by the merge() function replaces the list containing [error1, error2] from the internal options with an empty list [] created previously

Could you provide a way to instantiate a SentryHandler which doesn't enable external configuration?

Expected Result

The list of ignored errors is [error1, error2].

Actual Result

The list of ignored errors is [] (empty list).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions