Skip to content

Commit aab5e37

Browse files
committed
Undoing part of last commit that introduced a test issue
1 parent 7cc316f commit aab5e37

1 file changed

Lines changed: 24 additions & 30 deletions

File tree

biojava-core/src/main/java/org/biojava/nbio/core/util/InputStreamProvider.java

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -196,34 +196,32 @@ else if ( fileName.endsWith(".gz")) {
196196

197197
else if ( fileName.endsWith(".zip")){
198198

199-
try (ZipFile zipfile = new ZipFile(f)) {
200-
201-
// stream to first entry is returned ...
202-
ZipEntry entry;
203-
Enumeration<? extends ZipEntry> e = zipfile.entries();
204-
if (e.hasMoreElements()) {
205-
entry = e.nextElement();
206-
inputStream = zipfile.getInputStream(entry);
207-
} else {
208-
throw new IOException("Zip file has no entries");
209-
}
199+
ZipFile zipfile = new ZipFile(f);
200+
201+
// stream to first entry is returned ...
202+
ZipEntry entry;
203+
Enumeration<? extends ZipEntry> e = zipfile.entries();
204+
if ( e.hasMoreElements()){
205+
entry = e.nextElement();
206+
inputStream = zipfile.getInputStream(entry);
207+
} else {
208+
throw new IOException ("Zip file has no entries");
210209
}
211210

212211
}
213212

214213
else if ( fileName.endsWith(".jar")) {
215214

216-
try (JarFile jarFile = new JarFile(f)) {
217-
218-
// stream to first entry is returned
219-
JarEntry entry;
220-
Enumeration<JarEntry> e = jarFile.entries();
221-
if (e.hasMoreElements()) {
222-
entry = e.nextElement();
223-
inputStream = jarFile.getInputStream(entry);
224-
} else {
225-
throw new IOException("Jar file has no entries");
226-
}
215+
JarFile jarFile = new JarFile(f);
216+
217+
// stream to first entry is returned
218+
JarEntry entry;
219+
Enumeration<JarEntry> e = jarFile.entries();
220+
if ( e.hasMoreElements()){
221+
entry = e.nextElement();
222+
inputStream = jarFile.getInputStream(entry);
223+
} else {
224+
throw new IOException ("Jar file has no entries");
227225
}
228226
}
229227

@@ -282,10 +280,8 @@ private InputStream openCompressedFile(File f)
282280
private InputStream openCompressedURL(URL u)
283281
throws IOException{
284282

285-
InputStream inputStream;
286-
try (InputStream is = u.openStream()) {
287-
inputStream = new UncompressInputStream(is);
288-
}
283+
InputStream is = u.openStream();
284+
InputStream inputStream = new UncompressInputStream(is);
289285
return inputStream;
290286
}
291287

@@ -301,10 +297,8 @@ private InputStream openGZIPFile(File f)
301297
private InputStream openGZIPURL(URL u)
302298
throws IOException{
303299

304-
InputStream inputStream;
305-
try (InputStream is = u.openStream()) {
306-
inputStream = new GZIPInputStream(is);
307-
}
300+
InputStream is = u.openStream();
301+
InputStream inputStream = new GZIPInputStream(is);
308302
return inputStream;
309303
}
310304
}

0 commit comments

Comments
 (0)