Skip to content

Commit 99e421e

Browse files
Tobias Knellmichaelklishin
Tobias Knell
authored andcommitted
close InputStream of version.properties in ClientVersion after reading
1 parent 23bf6fd commit 99e421e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main/java/com/rabbitmq/client/impl/ClientVersion.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package com.rabbitmq.client.impl;
1717

1818
import java.io.IOException;
19+
import java.io.InputStream;
1920
import java.util.Properties;
2021

2122
/**
@@ -28,10 +29,18 @@ public class ClientVersion {
2829

2930
static {
3031
version = new Properties();
32+
InputStream inputStream = ClientVersion.class.getClassLoader()
33+
.getResourceAsStream("version.properties");
3134
try {
32-
version.load(ClientVersion.class.getClassLoader()
33-
.getResourceAsStream("version.properties"));
35+
version.load(inputStream);
3436
} catch (IOException e) {
37+
} finally {
38+
try {
39+
if(inputStream!=null) {
40+
inputStream.close();
41+
}
42+
} catch (IOException e) {
43+
}
3544
}
3645

3746
VERSION = version.getProperty("com.rabbitmq.client.version",

0 commit comments

Comments
 (0)