You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by tu...@apache.org on 2022/04/01 15:53:39 UTC

[nifi] branch NIFI-9854 created (now 2e66cf7)

This is an automated email from the ASF dual-hosted git repository.

turcsanyi pushed a change to branch NIFI-9854
in repository https://gitbox.apache.org/repos/asf/nifi.git.


      at 2e66cf7  NIFI-9854: Include slf4j-api as runtime scope for nifi-stateless-system-test-suite; When constructing the classes to block for the stateless ClassLoader, allow through any classes that come from Java Home's lib/ directory

This branch includes the following new commits:

     new 2e66cf7  NIFI-9854: Include slf4j-api as runtime scope for nifi-stateless-system-test-suite; When constructing the classes to block for the stateless ClassLoader, allow through any classes that come from Java Home's lib/ directory

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[nifi] 01/01: NIFI-9854: Include slf4j-api as runtime scope for nifi-stateless-system-test-suite; When constructing the classes to block for the stateless ClassLoader, allow through any classes that come from Java Home's lib/ directory

Posted by tu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

turcsanyi pushed a commit to branch NIFI-9854
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit 2e66cf711469da804a60bcd596a10ea8ea5afb0a
Author: Mark Payne <ma...@hotmail.com>
AuthorDate: Thu Mar 31 12:32:15 2022 -0400

    NIFI-9854: Include slf4j-api as runtime scope for nifi-stateless-system-test-suite; When constructing the classes to block for the stateless ClassLoader, allow through any classes that come from Java Home's lib/ directory
    
    This closes #5920.
    
    Signed-off-by: Peter Turcsanyi <tu...@apache.org>
---
 .../apache/nifi/stateless/bootstrap/StatelessBootstrap.java    | 10 ++++++++++
 nifi-system-tests/nifi-stateless-system-test-suite/pom.xml     |  3 +--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/StatelessBootstrap.java b/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/StatelessBootstrap.java
index 58b1d4e..ed1169c 100644
--- a/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/StatelessBootstrap.java
+++ b/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/StatelessBootstrap.java
@@ -195,6 +195,11 @@ public class StatelessBootstrap {
     }
 
     private static void findClassNamesInJars(final Collection<URL> jarUrls, final Set<String> classesFound, final Set<String> jarFilesFound) throws IOException {
+        final String javaHome = System.getProperty("java.home");
+        final File javaHomeDir = new File(javaHome);
+        final File javaLib = new File(javaHomeDir, "lib");
+        final String javaLibPath = javaLib.getAbsolutePath();
+
         for (final URL url : jarUrls) {
             final File file;
             try {
@@ -204,6 +209,11 @@ public class StatelessBootstrap {
                 continue;
             }
 
+            final String absolutePath = file.getAbsolutePath();
+            if (absolutePath.startsWith(javaLibPath)) {
+                continue;
+            }
+
             findClassNamesInJar(file, classesFound);
             jarFilesFound.add(file.getName());
         }
diff --git a/nifi-system-tests/nifi-stateless-system-test-suite/pom.xml b/nifi-system-tests/nifi-stateless-system-test-suite/pom.xml
index 3246042..19ddd04 100644
--- a/nifi-system-tests/nifi-stateless-system-test-suite/pom.xml
+++ b/nifi-system-tests/nifi-stateless-system-test-suite/pom.xml
@@ -103,12 +103,11 @@
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
-            <scope>test</scope>
+            <scope>runtime</scope>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
-            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>javax.servlet</groupId>