aloyszhang commented on code in PR #9901:
URL: https://github.com/apache/inlong/pull/9901#discussion_r1544154346
##########
inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java:
##########
@@ -213,6 +219,49 @@ private boolean updateModules(List<ModuleConfig>
managerModuleList) {
return true;
}
+ private boolean downloadModule(ModuleConfig module) {
+ LOGGER.info("download module {} begin", module.getId());
+ try {
+ LOGGER.info("download url {}",
module.getPackageConfig().getDownloadUrl());
+ URL url = new URL(module.getPackageConfig().getDownloadUrl());
+ URLConnection conn = url.openConnection();
+ Map<String, String> authHeader = httpManager.getAuthHeader();
+ authHeader.forEach((k, v) -> {
+ conn.setRequestProperty(k, v);
+ });
+ InputStream inStream = conn.getInputStream();
+ String path = module.getPackageConfig().getStoragePath() + "/" +
module.getPackageConfig().getFileName();
+ FileOutputStream fs = new FileOutputStream(path);
Review Comment:
resource leak for the InputStream and FileOutputStream
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]