Skip to content

Commit 963a2fb

Browse files
garyrussellartembilan
authored andcommitted
INT-4498: SFTP: Close privateKey resource
JIRA: https://jira.spring.io/browse/INT-4498 Use `FileCopyUtils` instead of `StreamUtils`. **cherry-pick to 5.0.x, 4.3.x** (cherry picked from commit 8eac5b4)
1 parent 3a13e59 commit 963a2fb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
2929
import org.springframework.integration.file.remote.session.SessionFactory;
3030
import org.springframework.integration.file.remote.session.SharedSessionCapable;
3131
import org.springframework.util.Assert;
32-
import org.springframework.util.StreamUtils;
32+
import org.springframework.util.FileCopyUtils;
3333
import org.springframework.util.StringUtils;
3434

3535
import com.jcraft.jsch.ChannelSftp.LsEntry;
@@ -404,7 +404,7 @@ private com.jcraft.jsch.Session initJschSession() throws Exception {
404404

405405
// private key
406406
if (this.privateKey != null) {
407-
byte[] keyByteArray = StreamUtils.copyToByteArray(this.privateKey.getInputStream());
407+
byte[] keyByteArray = FileCopyUtils.copyToByteArray(this.privateKey.getInputStream());
408408
String passphrase = this.userInfoWrapper.getPassphrase();
409409
if (StringUtils.hasText(passphrase)) {
410410
this.jsch.addIdentity(this.user, keyByteArray, null, passphrase.getBytes());

0 commit comments

Comments
 (0)