Skip to content

Commit 01e93d6

Browse files
闻仲Binary Wang
authored andcommitted
🎨 修复使用java.nio.file.Files打开公私钥文件无法释放句柄的问题
1 parent c4a834f commit 01e93d6

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

  • weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfig.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
import org.apache.http.ssl.SSLContexts;
1717

1818
import javax.net.ssl.SSLContext;
19-
import java.io.ByteArrayInputStream;
20-
import java.io.File;
21-
import java.io.IOException;
22-
import java.io.InputStream;
19+
import java.io.*;
2320
import java.net.URL;
2421
import java.nio.charset.StandardCharsets;
2522
import java.nio.file.Files;
@@ -385,7 +382,8 @@ private InputStream loadConfigInputStream(String configPath) throws WxPayExcepti
385382
throw new WxPayException(fileNotFoundMsg);
386383
}
387384

388-
return Files.newInputStream(file.toPath());
385+
// return Files.newInputStream(file.toPath());
386+
return new FileInputStream(file);
389387
} catch (IOException e) {
390388
throw new WxPayException(fileHasProblemMsg, e);
391389
}

0 commit comments

Comments
 (0)