Skip to content

Commit e7677da

Browse files
committed
fix multiple class loader test edge cases
1 parent 4f44548 commit e7677da

1 file changed

Lines changed: 18 additions & 19 deletions

File tree

sqlite-jdbc-jni/src/test/java/org/sqlite/MultipleClassLoaderTest.java

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -203,27 +203,26 @@ private void addJarEntry(File source, String changeDir, JarOutputStream target)
203203
for (File nestedFile : source.listFiles()) {
204204
addJarEntry(nestedFile, changeDir, target);
205205
}
206-
return;
207-
}
208-
209-
JarEntry entry =
210-
new JarEntry(
211-
source.getPath()
212-
.replace("\\", "/")
213-
.substring(changeDir.length() + 1));
214-
entry.setTime(source.lastModified());
215-
target.putNextEntry(entry);
216-
in = new BufferedInputStream(Files.newInputStream(source.toPath()));
217-
218-
byte[] buffer = new byte[8192];
219-
while (true) {
220-
int count = in.read(buffer);
221-
if (count == -1) {
222-
break;
206+
} else if (source.isFile()) {
207+
JarEntry entry =
208+
new JarEntry(
209+
source.getPath()
210+
.replace("\\", "/")
211+
.substring(changeDir.length() + 1));
212+
entry.setTime(source.lastModified());
213+
target.putNextEntry(entry);
214+
in = new BufferedInputStream(Files.newInputStream(source.toPath()));
215+
216+
byte[] buffer = new byte[8192];
217+
while (true) {
218+
int count = in.read(buffer);
219+
if (count == -1) {
220+
break;
221+
}
222+
target.write(buffer, 0, count);
223223
}
224-
target.write(buffer, 0, count);
224+
target.closeEntry();
225225
}
226-
target.closeEntry();
227226
} finally {
228227
if (in != null) {
229228
in.close();

0 commit comments

Comments
 (0)