You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "gharris1727 (via GitHub)" <gi...@apache.org> on 2023/05/25 18:58:53 UTC

[GitHub] [kafka] gharris1727 commented on a diff in pull request #13334: MINOR: Move plugin path parsing from DelegatingClassLoader to PluginUtils

gharris1727 commented on code in PR #13334:
URL: https://github.com/apache/kafka/pull/13334#discussion_r1205901798


##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginUtils.java:
##########
@@ -188,11 +191,34 @@ public static boolean isClassFile(Path path) {
         return path.toString().toLowerCase(Locale.ROOT).endsWith(".class");
     }
 
-    public static List<Path> pluginLocations(Path topPath) throws IOException {
+    public static List<Path> pluginLocations(String pluginPath) {
+        if (pluginPath == null) {
+            return Collections.emptyList();
+        }
+        String[] pluginPathElements = COMMA_WITH_WHITESPACE.split(pluginPath.trim(), -1);
+        List<Path> pluginLocations = new ArrayList<>();
+        for (String path : pluginPathElements) {
+            try {
+                Path pluginPathElement = Paths.get(path).toAbsolutePath();
+                // Currently 'plugin.paths' property is a list of top-level directories
+                // containing plugins
+                if (Files.isDirectory(pluginPathElement)) {
+                    pluginLocations.addAll(pluginLocations(pluginPathElement));
+                } else if (isArchive(pluginPathElement)) {
+                    pluginLocations.add(pluginPathElement);
+                }

Review Comment:
   Thanks for catching that, the Paths.get() throws this exception but it's not checked.
   
   I'm not sure if the catch in initLoaders still needs the InvalidPathException, but I left it in just to be safe.



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org