提交 2e660dfe 编写于 作者: F Furkan KAMACI 提交者: Xiaojie Li

Dubbo-3473 Fix Not Properly Closed Resources (#3474)

上级 d414c7b5
...@@ -76,8 +76,7 @@ public class GenericFilter implements Filter { ...@@ -76,8 +76,7 @@ public class GenericFilter implements Filter {
} else if (ProtocolUtils.isJavaGenericSerialization(generic)) { } else if (ProtocolUtils.isJavaGenericSerialization(generic)) {
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
if (byte[].class == args[i].getClass()) { if (byte[].class == args[i].getClass()) {
try { try(UnsafeByteArrayInputStream is = new UnsafeByteArrayInputStream((byte[]) args[i])) {
UnsafeByteArrayInputStream is = new UnsafeByteArrayInputStream((byte[]) args[i]);
args[i] = ExtensionLoader.getExtensionLoader(Serialization.class) args[i] = ExtensionLoader.getExtensionLoader(Serialization.class)
.getExtension(Constants.GENERIC_SERIALIZATION_NATIVE_JAVA) .getExtension(Constants.GENERIC_SERIALIZATION_NATIVE_JAVA)
.deserialize(null, is).readObject(); .deserialize(null, is).readObject();
......
...@@ -55,8 +55,7 @@ public class LogTelnetHandler implements TelnetHandler { ...@@ -55,8 +55,7 @@ public class LogTelnetHandler implements TelnetHandler {
int showLogLength = Integer.parseInt(str[0]); int showLogLength = Integer.parseInt(str[0]);
if (file != null && file.exists()) { if (file != null && file.exists()) {
try { try(FileInputStream fis = new FileInputStream(file)) {
FileInputStream fis = new FileInputStream(file);
FileChannel filechannel = fis.getChannel(); FileChannel filechannel = fis.getChannel();
size = filechannel.size(); size = filechannel.size();
ByteBuffer bb; ByteBuffer bb;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册