Skip to content

Commit

Permalink
KNOX-3047 - Classpath extension for optional dependencies (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanicz authored Aug 1, 2024
1 parent 163cacc commit d21cf8f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
main.class = org.apache.knox.gateway.GatewayServer
class.path = ../conf;../lib/*.jar;../dep/*.jar;../ext;../ext/*.jar
class.path = ../conf;../lib/*.jar;../dep/*.jar;../ext;../ext/*.jar;/usr/share/java/*.jar
GATEWAY_HOME=${launcher.dir}/..
log4j.configurationFile=${GATEWAY_HOME}/conf/${launcher.name}-log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private static List<URL> loadClassPath( File base, String classPath ) throws Mal
StringTokenizer parser = new StringTokenizer( classPath, CLASS_PATH_DELIM, false );
while( parser.hasMoreTokens() ) {
String libPath = parser.nextToken().trim();
File libFile = new File( base, libPath );
File libFile = loadFileByPath( base, libPath );
if( libFile.canRead() && ( libFile.isFile() || libFile.isDirectory() ) ) {
urls.add( libFile.toURI().toURL() );
} else if( libPath.endsWith( "*" ) || libPath.endsWith( "*.jar" ) ) {
Expand All @@ -131,6 +131,17 @@ private static List<URL> loadClassPath( File base, String classPath ) throws Mal
return urls;
}

/* KNOX-3047 */
private static File loadFileByPath( File base, String libPath ) {
File file;
if( libPath.startsWith( "/" ) ) {
file = new File( libPath );
} else {
file = new File( base, libPath );
}
return file;
}

private static class WildcardFilenameFilter implements FilenameFilter {
private static String SAFE = new String( new char[]{ (char)0 } );

Expand Down

0 comments on commit d21cf8f

Please sign in to comment.