Skip to content

Fix some iffy parameter type converions#10143

Merged
nielsm5 merged 1 commit intorelease/9.3from
bug/parameter-return-types
Dec 13, 2025
Merged

Fix some iffy parameter type converions#10143
nielsm5 merged 1 commit intorelease/9.3from
bug/parameter-return-types

Conversation

@nielsm5
Copy link
Member

@nielsm5 nielsm5 commented Dec 12, 2025

No description provided.

registerSubstitute(entry.getKey(), cleanseValue(entry.getValue()));
}
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V in this case is a parameter map with may (or more certainly does) contain Message's.

throw Lombok.sneakyThrow(new SenderException("unable to read parameter [" + e.getKey() + "]", ex));
}
}
return (String) e.getValue();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very strange casts... Right now at least it will always be a String (a look a lot cleaner).

Object sharedSecretParam = parameterMap.remove(SHARED_SECRET_PARAMETER_NAME); //Remove the SharedKey, else it will be added as a JWT Claim
Map<String, Object> parameterMap = getSanitizedParameterValueMap(message, session);
Object sharedSecretParam = parameterMap.remove(SHARED_SECRET_PARAMETER_NAME); // Remove the SharedKey, else it will be added as a JWT Claim
parameterMap.forEach(claimsSetBuilder::claim);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handy a method that takes an Object...

private V cleanseValue(V value) {
if (value instanceof Message message) {
try {
return (V) message.asString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die cast ziet er erg lelijk uit.

Nou is het type van <V> in de praktijk altijd en alleen maar Object dus het gaat nooit fout ... maar toch. Lelijk.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, viel veel om toen ik het weg probeerde te poetsen...

@nielsm5 nielsm5 requested a review from tnleeuw December 12, 2025 18:23
@sonarqubecloud
Copy link

@nielsm5 nielsm5 merged commit f7b998b into release/9.3 Dec 13, 2025
28 checks passed
@nielsm5 nielsm5 deleted the bug/parameter-return-types branch December 13, 2025 10:18
@nielsm5 nielsm5 linked an issue Dec 13, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Figure out parameter return types

2 participants