Skip to content

Commit c4e6b16

Browse files
author
Alain Knaff
committed
Fix off-by-2 error due to . and .. entries not always being included in sftp output. So they shouldn't be substracted from arry size, or we'll be making arrays of negative size on empty directories.
1 parent eb071fb commit c4e6b16

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ android {
1616
// of minor, and 2 digits of 3rd part. As major is still 0, and
1717
// as no leading zeroes are represented, 200 is what we get for
1818
// 0.2
19-
versionCode = 207
20-
versionName = "0.2.7"
19+
versionCode = 208
20+
versionName = "0.2.8"
2121
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2222
}
2323
buildTypes {

app/src/main/java/com/island/sftp/SFTP.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public synchronized void close() throws IOException
189189
try {
190190
reconnectIfNeeded();
191191
Vector vector=channel.ls(directory.getPath());
192-
List<SftpFile>files=new ArrayList<>(vector.size()-2);
192+
List<SftpFile>files=new ArrayList<>(vector.size());
193193
for(Object obj:vector) {
194194
ChannelSftp.LsEntry entry=
195195
(ChannelSftp.LsEntry) obj;

metadata/en-US/changelogs/208.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Fix listing of empty directories
2+
3+

0 commit comments

Comments
 (0)