@@ -1136,7 +1136,7 @@ public static URL[] findLibrary(Class cls, ClassProperties properties, String li
11361136 * @param cls the Class whose package name and {@link ClassLoader} are used to extract from resources
11371137 * @param properties contains the directories to scan for if we fail to extract the library from resources
11381138 * @param libnameversion ":" to disable prefixes and suffixes + the name of the library + "@" + optional version tag
1139- * + "#" + a second optional name used at extraction (or empty to prevent it)
1139+ * + "#" + a second optional name used at extraction (or empty to prevent it, unless it is a second "#" )
11401140 * + "!" to load all symbols globally
11411141 * @param pathsFirst search the paths first before bundled resources
11421142 * @return URLs that point to potential locations of the library
@@ -1150,11 +1150,11 @@ public static URL[] findLibrary(Class cls, ClassProperties properties, String li
11501150 if (libnameversion .endsWith ("!" )) {
11511151 libnameversion = libnameversion .substring (0 , libnameversion .length () - 1 );
11521152 }
1153- if (libnameversion .trim ().endsWith ("#" )) {
1153+ if (libnameversion .trim ().endsWith ("#" ) && ! libnameversion . trim (). endsWith ( "##" ) ) {
11541154 return new URL [0 ];
11551155 }
11561156 String [] split = libnameversion .split ("#" );
1157- boolean reference = split .length > 1 ;
1157+ boolean reference = split .length > 1 && split [ 1 ]. length () > 0 ;
11581158 String [] s = split [0 ].split ("@" );
11591159 String [] s2 = (reference ? split [1 ] : split [0 ]).split ("@" );
11601160 String libname = s [0 ];
@@ -1263,7 +1263,7 @@ public static URL[] findLibrary(Class cls, ClassProperties properties, String li
12631263 *
12641264 * @param urls the URLs to try loading the library from
12651265 * @param libnameversion ":" to disable prefixes and suffixes + the name of the library + "@" + optional version tag
1266- * + "#" + a second optional name used at extraction (or empty to prevent it)
1266+ * + "#" + a second optional name used at extraction (or empty to prevent it, unless it is a second "#" )
12671267 * + "!" to load all symbols globally
12681268 * @param preloaded libraries for which to create symbolic links in same cache directory
12691269 * @return the full path of the file loaded, or the library name if unknown
@@ -1284,7 +1284,7 @@ public static synchronized String loadLibrary(URL[] urls, String libnameversion,
12841284 }
12851285 String [] split = libnameversion .split ("#" );
12861286 String libnameversion2 = split [0 ];
1287- if (split .length > 1 ) {
1287+ if (split .length > 1 && split [ 1 ]. length () > 0 ) {
12881288 libnameversion2 = split [1 ];
12891289 }
12901290
@@ -1437,7 +1437,7 @@ public static String createLibraryLink(String filename, ClassProperties properti
14371437 String parent = file .getParent (), name = file .getName (), link = null ;
14381438
14391439 String [] split = libnameversion != null ? libnameversion .split ("#" ) : new String [] {"" };
1440- String [] s = (split .length > 1 ? split [1 ] : split [0 ]).split ("@" );
1440+ String [] s = (split .length > 1 && split [ 1 ]. length () > 0 ? split [1 ] : split [0 ]).split ("@" );
14411441 String libname = s [0 ];
14421442 String version = s .length > 1 ? s [s .length -1 ] : "" ;
14431443
0 commit comments