You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2016/07/02 15:34:57 UTC
commons-crypto git commit: Simplify cleanup
Repository: commons-crypto
Updated Branches:
refs/heads/master 250e9184e -> 98af9d7df
Simplify cleanup
Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/98af9d7d
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/98af9d7d
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/98af9d7d
Branch: refs/heads/master
Commit: 98af9d7df9dc95dc02b178691679138653d17ed2
Parents: 250e918
Author: Sebb <se...@apache.org>
Authored: Sat Jul 2 16:34:54 2016 +0100
Committer: Sebb <se...@apache.org>
Committed: Sat Jul 2 16:34:54 2016 +0100
----------------------------------------------------------------------
.../org/apache/commons/crypto/NativeCodeLoader.java | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/98af9d7d/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java b/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java
index 8158908..5308e0b 100644
--- a/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java
+++ b/src/main/java/org/apache/commons/crypto/NativeCodeLoader.java
@@ -28,6 +28,7 @@ import java.util.Properties;
import java.util.UUID;
import org.apache.commons.crypto.conf.ConfigurationKeys;
+import org.apache.commons.crypto.utils.IoUtils;
/**
* A helper to load the native code i.e. libcommons-crypto.so. This handles the
@@ -156,10 +157,8 @@ final class NativeCodeLoader {
writer.close();
- if (reader != null) {
- reader.close();
- reader = null;
- }
+ IoUtils.cleanup(reader);
+ reader = null;
}
// Set executable (x) flag to enable Java to load the native library
@@ -198,13 +197,7 @@ final class NativeCodeLoader {
e.printStackTrace(System.err);
return null;
} finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ IoUtils.cleanup(reader);
}
}