提交 b1b16159 编写于 作者: W Weiyi Liu 提交者: kezhenxu94

Close inputstream. (#4184)

Co-authored-by: Nkezhenxu94 <kezhenxu94@163.com>
Co-authored-by: wu-sheng's avatar吴晟 Wu Sheng <wu.sheng@foxmail.com>
上级 8e9a1121
......@@ -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");
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册