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

This commit is contained in:
Furkan KAMACI 2019-03-07 13:08:55 +03:00 committed by Xiaojie Li
parent d414c7b53f
commit 2e660dfef7
2 changed files with 2 additions and 4 deletions

View File

@ -76,8 +76,7 @@ public class GenericFilter implements Filter {
} else if (ProtocolUtils.isJavaGenericSerialization(generic)) {
for (int i = 0; i < args.length; i++) {
if (byte[].class == args[i].getClass()) {
try {
UnsafeByteArrayInputStream is = new UnsafeByteArrayInputStream((byte[]) args[i]);
try(UnsafeByteArrayInputStream is = new UnsafeByteArrayInputStream((byte[]) args[i])) {
args[i] = ExtensionLoader.getExtensionLoader(Serialization.class)
.getExtension(Constants.GENERIC_SERIALIZATION_NATIVE_JAVA)
.deserialize(null, is).readObject();

View File

@ -55,8 +55,7 @@ public class LogTelnetHandler implements TelnetHandler {
int showLogLength = Integer.parseInt(str[0]);
if (file != null && file.exists()) {
try {
FileInputStream fis = new FileInputStream(file);
try(FileInputStream fis = new FileInputStream(file)) {
FileChannel filechannel = fis.getChannel();
size = filechannel.size();
ByteBuffer bb;