You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2023/12/07 11:20:00 UTC
[jira] [Commented] (CAMEL-20204) StringSource and SourceCache using the isEmpty method will always return true
[ https://issues.apache.org/jira/browse/CAMEL-20204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17794134#comment-17794134 ]
Claus Ibsen commented on CAMEL-20204:
-------------------------------------
The JDK17 implementation is
public boolean isEmpty() {
return (publicId == null && systemId == null && isStreamEmpty());
}
And isStreamEmpty then fetches the input stream and check that. So that will check correct in camel.
However we can optimize isEmpty to check the given input string directly instead, that is faster.
> StringSource and SourceCache using the isEmpty method will always return true
> -----------------------------------------------------------------------------
>
> Key: CAMEL-20204
> URL: https://issues.apache.org/jira/browse/CAMEL-20204
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 3.20.8
> Reporter: Richard Groote
> Priority: Minor
>
> When using StringSource#isEmpty or SourceCache#isEmpty it will always return true because the StreamSource#isEmpty of java 17 works on member variables instead of the getters.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)