Fix some iffy parameter type converions by nielsm5 · Pull Request #10143 · frankframework/frankframework

@nielsm5

@nielsm5

nielsm5

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

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.

nielsm5

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

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).

nielsm5

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);

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...

tnleeuw

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

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.

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...

tnleeuw

@sonarqubecloud

@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