Skip to content

Commit 77ecb6c

Browse files
JM-Labvalery1707
andauthored
Update spring-ai-model/src/main/java/org/springframework/ai/tool/execution/DefaultToolCallResultConverter.java
refactor: replace Optional null check with String.valueOf Co-authored-by: valery1707 <valery1707@gmail.com> Signed-off-by: Jemin Huh <hjm1980@gmail.com>
1 parent 14812e5 commit 77ecb6c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-ai-model/src/main/java/org/springframework/ai/tool/execution/DefaultToolCallResultConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public String convert(@Nullable Object result, @Nullable Type returnType) {
5151
}
5252
if (returnType instanceof Class<?> cls && cls.equals(String.class)) {
5353
logger.debug("Tool return type is String. Returning result as is.");
54-
return Optional.ofNullable((String) result).orElse("null");
54+
return String.valueOf(result);
5555
}
5656
if (result instanceof RenderedImage) {
5757
final var buf = new ByteArrayOutputStream(1024 * 4);

0 commit comments

Comments
 (0)