Skip to content

Commit 57b8631

Browse files
committed
Polishing previous commit
1 parent f2edb4c commit 57b8631

File tree

1 file changed

+11
-8
lines changed
  • spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/java/org/springframework/cloud/function/adapter/aws

1 file changed

+11
-8
lines changed

spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/java/org/springframework/cloud/function/adapter/aws/AWSLambdaUtils.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ public static byte[] generateOutputFromObject(Message<?> requestMessage, Object
156156
}
157157
result.add(value);
158158
}
159+
159160
if (result.size() > 1) {
160161
output = result;
161162
}
@@ -165,15 +166,17 @@ else if (result.size() == 1) {
165166
else {
166167
output = null;
167168
}
168-
if (output instanceof Message<?> && ((Message<?>) output).getPayload() instanceof byte[]) {
169-
responseMessage = (Message<byte[]>) output;
170-
}
171-
else if (output != null) {
172-
if (logger.isDebugEnabled()) {
173-
logger.debug("OUTPUT: " + output + " - " + output.getClass().getName());
169+
if (output != null && output instanceof Message<?>) {
170+
if (output instanceof Message<?>) {
171+
responseMessage = (Message<byte[]>) output;
172+
}
173+
else {
174+
if (logger.isDebugEnabled()) {
175+
logger.debug("OUTPUT: " + output + " - " + output.getClass().getName());
176+
}
177+
byte[] payload = objectMapper.toJson(output);
178+
responseMessage = MessageBuilder.withPayload(payload).build();
174179
}
175-
byte[] payload = objectMapper.toJson(output);
176-
responseMessage = MessageBuilder.withPayload(payload).build();
177180
}
178181
}
179182
else {

0 commit comments

Comments
 (0)