Close inputstream. (#4184)
Co-authored-by: kezhenxu94 <kezhenxu94@163.com> Co-authored-by: 吴晟 Wu Sheng <wu.sheng@foxmail.com>
This commit is contained in:
parent
8e9a1121cd
commit
b1b1615926
|
|
@ -51,14 +51,15 @@ public class AgentIDDecorator implements ChannelDecorator {
|
|||
Enumeration<URL> resources = AgentIDDecorator.class.getClassLoader().getResources(JarFile.MANIFEST_NAME);
|
||||
while (resources.hasMoreElements()) {
|
||||
URL url = resources.nextElement();
|
||||
InputStream is = url.openStream();
|
||||
if (is != null) {
|
||||
Manifest manifest = new Manifest(is);
|
||||
Attributes mainAttribs = manifest.getMainAttributes();
|
||||
String projectName = mainAttribs.getValue("Implementation-Vendor-Id");
|
||||
if (projectName != null) {
|
||||
if ("org.apache.skywalking".equals(projectName)) {
|
||||
version = mainAttribs.getValue("Implementation-Version");
|
||||
try (InputStream is = url.openStream()) {
|
||||
if (is != null) {
|
||||
Manifest manifest = new Manifest(is);
|
||||
Attributes mainAttribs = manifest.getMainAttributes();
|
||||
String projectName = mainAttribs.getValue("Implementation-Vendor-Id");
|
||||
if (projectName != null) {
|
||||
if ("org.apache.skywalking".equals(projectName)) {
|
||||
version = mainAttribs.getValue("Implementation-Version");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue