pranavshuklaa commented on code in PR #1091:
URL: https://github.com/apache/flink-agents/pull/1091#discussion_r4543803239


##########
runtime/src/main/java/org/apache/flink/agents/runtime/skill/repository/SkillMaterializer.java:
##########
@@ -203,19 +448,16 @@ public static Materialized 
extractClasspathFromJars(List<URL> jarUrls, String re
         if (jarUrls == null || jarUrls.isEmpty()) {
             throw new IllegalArgumentException("jarUrls must be non-empty");
         }
+
         Path extractDir = Files.createTempDirectory(TEMP_DIR_PREFIX);
         Thread hook = registerCleanup(extractDir);
         String prefix = resourcePrefix.endsWith("/") ? resourcePrefix : 
resourcePrefix + "/";
-        Materialized materialized = new Materialized(extractDir, hook);
-        try {
-            for (URL jarUrl : jarUrls) {
-                copyJarEntries(jarUrl, prefix, extractDir);
-            }
-            return materialized;
-        } catch (IOException | RuntimeException | Error e) {
-            materialized.close();
-            throw e;
+
+        for (URL jarUrl : jarUrls) {
+            copyJarEntries(jarUrl, prefix, extractDir);
         }
+
+        return new Materialized(extractDir, hook);

Review Comment:
   Yes, I restored `main`'s cleanup (`catch (IOException | RuntimeException | 
Error e) { materialized.close(); throw e; }`). 
`extractClasspathFromJarsCleansUpWhenALaterJarFails` extracts a valid first 
JAR, then a second JAR with a zip-slip entry, and asserts that the error is 
thrown and no temp dir is left. It fails on the previous code.



-- 
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]

Reply via email to