Skip to content

Use isEmpty() for String type instead #9494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,6 +29,7 @@
*
* @author Gary Russell
* @author Artem Bilan
* @author Ngoc Nhan
*
* @since 3.0
*
Expand Down Expand Up @@ -56,7 +57,7 @@ public static <F> void makeDirectories(String path, Session<F> session, String r
List<String> pathsToCreate = new LinkedList<>();
while (nextSeparatorIndex > -1) {
String pathSegment = path.substring(0, nextSeparatorIndex);
if (pathSegment.length() == 0 || session.exists(pathSegment)) {
if (pathSegment.isEmpty() || session.exists(pathSegment)) {
// no more paths to create
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,6 +37,7 @@
* @author Amol Nayak
* @author Gunnar Hillert
* @author Artem Bilan
* @author Ngoc Nhan
*
* @since 2.2
*/
Expand Down Expand Up @@ -99,9 +100,9 @@ private static void parseIdExpression(Element gatewayElement, ParserContext pars

boolean childElementsExist = !CollectionUtils.isEmpty(DomUtils.getChildElementsByTagName(gatewayElement,
"parameter"));
if (others.length() > 0 || childElementsExist) {
if (!others.isEmpty() || childElementsExist) {
parserContext.getReaderContext().error(
(others.length() == 0 ? "" : "'" + others + "' "
(others.isEmpty() ? "" : "'" + others + "' "
+ (childElementsExist ? "and " : ""))
+ (childElementsExist ? "child elements " : "")
+ "not allowed with an 'id-expression' attribute.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,6 +40,7 @@
* @author Jonas Partner
* @author Mark Fisher
* @author Artem Bilan
* @author Ngoc Nhan
*
* @since 2.0
*/
Expand Down Expand Up @@ -122,7 +123,7 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
public Object processMessage(Message<?> message) {
Node node = this.converter.convertToNode(message.getPayload());
Object result = this.evaluationType.evaluateXPath(this.expression, node);
if (result instanceof String && ((String) result).length() == 0) {
if (result instanceof String string && string.isEmpty()) {
result = null;
}
if (result != null && this.headerTypeDescriptor != null) {
Expand Down