diff --git a/build.gradle b/build.gradle index 5f66c99781..fffcde2899 100644 --- a/build.gradle +++ b/build.gradle @@ -61,7 +61,7 @@ ext { groovyVersion = '2.5.10' hamcrestVersion = '2.2' hazelcastVersion = '3.12.6' - hibernateVersion = '5.4.12.Final' + hibernateVersion = '5.4.13.Final' hsqldbVersion = '2.5.0' h2Version = '1.4.200' jacksonVersion = '2.10.3' @@ -79,7 +79,7 @@ ext { kryoShadedVersion = '4.0.2' lettuceVersion = '5.2.2.RELEASE' log4jVersion = '2.13.1' - micrometerVersion = '1.3.6' + micrometerVersion = '1.3.7' mockitoVersion = '3.3.3' mongoDriverVersion = '4.0.1' mysqlVersion = '8.0.19' @@ -92,12 +92,12 @@ ext { servletApiVersion = '4.0.1' smackVersion = '4.3.4' springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.2.5.RELEASE' - springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : 'Neumann-M4' - springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.3.0.RELEASE' + springDataVersion = project.hasProperty('springDataVersion') ? project.springDataVersion : 'Neumann-RC1' + springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '5.3.1.RELEASE' springRetryVersion = '1.2.5.RELEASE' springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.2.5.RELEASE' springWsVersion = '3.0.8.RELEASE' - tomcatVersion = "9.0.31" + tomcatVersion = "9.0.33" xstreamVersion = '1.4.11.1' javaProjects = subprojects - project(':spring-integration-bom') @@ -317,7 +317,7 @@ configure(javaProjects) { subproject -> checkstyle { configFile = file("$rootDir/src/checkstyle/checkstyle.xml") - toolVersion = project.hasProperty('checkstyleVersion') ? project.checkstyleVersion : '8.30' + toolVersion = project.hasProperty('checkstyleVersion') ? project.checkstyleVersion : '8.31' } jar { diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java index 8053166db4..50e53c6a2a 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java @@ -488,19 +488,18 @@ public class RemoteFileTemplate implements RemoteFileOperations, Initializ } private StreamHolder payloadToInputStream(Message message) throws MessageDeliveryException { + Object payload = message.getPayload(); try { - Object payload = message.getPayload(); - InputStream dataInputStream = null; - String name = null; if (payload instanceof File) { File inputFile = (File) payload; if (inputFile.exists()) { - dataInputStream = new BufferedInputStream(new FileInputStream(inputFile)); - name = inputFile.getAbsolutePath(); + return new StreamHolder( + new BufferedInputStream(new FileInputStream(inputFile)), inputFile.getAbsolutePath()); } } else if (payload instanceof byte[] || payload instanceof String) { byte[] bytes; + String name; if (payload instanceof String) { bytes = ((String) payload).getBytes(this.charset); name = "String payload"; @@ -509,17 +508,15 @@ public class RemoteFileTemplate implements RemoteFileOperations, Initializ bytes = (byte[]) payload; name = "byte[] payload"; } - dataInputStream = new ByteArrayInputStream(bytes); + return new StreamHolder(new ByteArrayInputStream(bytes), name); } else if (payload instanceof InputStream) { - dataInputStream = (InputStream) payload; - name = "InputStream payload"; + return new StreamHolder((InputStream) payload, "InputStream payload"); } else if (payload instanceof Resource) { Resource resource = (Resource) payload; - dataInputStream = resource.getInputStream(); String filename = resource.getFilename(); - name = filename != null ? filename : "Resource payload"; + return new StreamHolder(resource.getInputStream(), filename != null ? filename : "Resource payload"); } else { throw new IllegalArgumentException("Unsupported payload type [" @@ -527,16 +524,11 @@ public class RemoteFileTemplate implements RemoteFileOperations, Initializ + "]. The only supported payloads are " + "java.io.File, java.lang.String, byte[], and InputStream"); } - if (dataInputStream == null) { - return null; - } - else { - return new StreamHolder(dataInputStream, name); - } } catch (Exception e) { throw new MessageDeliveryException(message, "Failed to create sendable file.", e); } + return null; } private void sendFileToRemoteDirectory(InputStream inputStream, String temporaryRemoteDirectoryArg,