Skip to content

Commit d49637c

Browse files
committed
Revert "Remove skipConversion in FunctionAroundWrapper"
This reverts commit 240098f.
1 parent 609035b commit d49637c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/catalog/FunctionAroundWrapper.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2022 the original author or authors.
2+
* Copyright 2020-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,28 +27,33 @@
2727
* If registered as bean it will be autowired into {@link FunctionInvocationWrapper}.
2828
* Keep in mind that it only affects imperative invocations where input is {@link Message}
2929
*
30-
* NOTE: This API is experimental and could change without notice. It is
30+
* NOTE: This API is experimental and and could change without notice. It is
3131
* intended for internal use only (e.g., spring-cloud-sleuth)
3232
*
3333
* @author Oleg Zhurakousky
34-
* @author Artem Bilan
3534
* @since 3.1
3635
*/
3736
public abstract class FunctionAroundWrapper implements BiFunction<Object, FunctionInvocationWrapper, Object> {
3837

3938
@Override
4039
public final Object apply(Object input, FunctionInvocationWrapper targetFunction) {
4140
String functionalTracingEnabledStr = System.getProperty("spring.sleuth.function.enabled");
42-
boolean functionalTracingEnabled =
43-
!StringUtils.hasText(functionalTracingEnabledStr) || Boolean.parseBoolean(functionalTracingEnabledStr);
41+
boolean functionalTracingEnabled = StringUtils.hasText(functionalTracingEnabledStr)
42+
? Boolean.parseBoolean(functionalTracingEnabledStr) : true;
4443
if (functionalTracingEnabled) {
45-
return this.doApply(input, targetFunction);
44+
boolean isSkipOutputConversion = targetFunction.isSkipOutputConversion();
45+
targetFunction.setSkipOutputConversion(true);
46+
try {
47+
return this.doApply(input, targetFunction);
48+
}
49+
finally {
50+
targetFunction.setSkipOutputConversion(isSkipOutputConversion);
51+
}
4652
}
4753
else {
4854
return targetFunction.apply(input);
4955
}
5056
}
5157

5258
protected abstract Object doApply(Object input, FunctionInvocationWrapper targetFunction);
53-
5459
}

0 commit comments

Comments
 (0)