diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java index 6ceb92f9420..78bbf3fafb6 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java @@ -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. @@ -29,6 +29,7 @@ * * @author Gary Russell * @author Artem Bilan + * @author Ngoc Nhan * * @since 3.0 * @@ -56,7 +57,7 @@ public static void makeDirectories(String path, Session session, String r List 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; } diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/RetrievingJpaOutboundGatewayParser.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/RetrievingJpaOutboundGatewayParser.java index 68f657be6a6..90596d6f8b6 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/RetrievingJpaOutboundGatewayParser.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/RetrievingJpaOutboundGatewayParser.java @@ -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. @@ -37,6 +37,7 @@ * @author Amol Nayak * @author Gunnar Hillert * @author Artem Bilan + * @author Ngoc Nhan * * @since 2.2 */ @@ -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.", diff --git a/spring-integration-xml/src/main/java/org/springframework/integration/xml/transformer/support/XPathExpressionEvaluatingHeaderValueMessageProcessor.java b/spring-integration-xml/src/main/java/org/springframework/integration/xml/transformer/support/XPathExpressionEvaluatingHeaderValueMessageProcessor.java index 3acac604881..0875f4f5a41 100644 --- a/spring-integration-xml/src/main/java/org/springframework/integration/xml/transformer/support/XPathExpressionEvaluatingHeaderValueMessageProcessor.java +++ b/spring-integration-xml/src/main/java/org/springframework/integration/xml/transformer/support/XPathExpressionEvaluatingHeaderValueMessageProcessor.java @@ -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. @@ -40,6 +40,7 @@ * @author Jonas Partner * @author Mark Fisher * @author Artem Bilan + * @author Ngoc Nhan * * @since 2.0 */ @@ -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) {