From ebea2a1467fd61f78f5f1aed515d265791601ddd Mon Sep 17 00:00:00 2001 From: lionsoul Date: Sun, 7 Jul 2019 11:09:48 +0800 Subject: [PATCH] fix the bug of raf=null in the close interface of DbSearcher --- .../main/java/org/lionsoul/ip2region/DbSearcher.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/binding/java/src/main/java/org/lionsoul/ip2region/DbSearcher.java b/binding/java/src/main/java/org/lionsoul/ip2region/DbSearcher.java index 340ab62..d4a0ef1 100644 --- a/binding/java/src/main/java/org/lionsoul/ip2region/DbSearcher.java +++ b/binding/java/src/main/java/org/lionsoul/ip2region/DbSearcher.java @@ -59,8 +59,10 @@ public class DbSearcher } /** - * construct method with self-define std ip2region bianry string support - * Thanks to the issue from Wendal at https://gitee.com/lionsoul/ip2region/issues/IILFL + * construct method with self-define std ip2region binary string support + * Thanks to the issue from Wendal at https://gitee.com/lionsoul/ip2region/issues/IILFL. + * + * Note: This construtor should be used for memory search ONLY !!! * * @param dbConfig * @param dbBinStr @@ -399,7 +401,9 @@ public class DbSearcher HeaderSip = null; //let gc do its work HeaderPtr = null; dbBinStr = null; - raf.close(); + if ( raf != null ) { + raf.close(); + } } }