Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
olegz committed Dec 22, 2024
1 parent 9de725d commit c1cb638
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ public <T> T lookup(Class<?> type, String functionDefinition, String... expected
else if (functionCandidate instanceof BiFunction || functionCandidate instanceof BiConsumer) {
functionRegistration = this.registerMessagingBiFunction(functionCandidate, functionName);
}
//else if (KotlinDetector.isKotlinType(functionCandidate.getClass())) {
else if (KotlinUtils.isKotlinType(functionCandidate)) {
KotlinLambdaToFunctionAutoConfiguration.KotlinFunctionWrapper wrapper =
new KotlinLambdaToFunctionAutoConfiguration.KotlinFunctionWrapper(functionCandidate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.springframework.cloud.function.web.util;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -233,15 +234,14 @@ private static Object postProcessResult(Object result, boolean isMessage) {
else if (result instanceof Mono) {
result = ((Mono) result).map(v -> postProcessResult(v, isMessage));
}
else if (result instanceof Message) {
if (((Message) result).getPayload() instanceof byte[]) {
String str = new String((byte[]) ((Message) result).getPayload());
result = MessageBuilder.withPayload(str).copyHeaders(((Message) result).getHeaders()).build();
else if (result instanceof Message messageResult) {
if (messageResult.getPayload() instanceof byte[]) {
//String str = new String((byte[]) messageResult.getPayload());
result = MessageBuilder.withPayload(messageResult.getPayload()).copyHeaders(((Message) result).getHeaders()).build();
}
}

if (result instanceof byte[]) {
result = new String((byte[]) result);
else if (result instanceof byte[]) {
result = new String((byte[]) result, StandardCharsets.UTF_8);
}
return result;
}
Expand Down

0 comments on commit c1cb638

Please sign in to comment.