@@ -71,7 +71,7 @@ typedef struct URLElements {
71
71
} URLElements ;
72
72
73
73
74
- static J9ClassPathEntry * getCachedURL (JNIEnv * env , jint helperID , const char * pathChars , jsize pathLen , UDATA cpeType , U_16 cpeStatus , const char * correctedPath );
74
+ static J9ClassPathEntry * getCachedURL (JNIEnv * env , jint helperID , const URLElements * urlElements , U_16 cpeStatus );
75
75
static const char * copyString (J9PortLibrary * portlib , const char * toCopy , UDATA length , J9SharedStringFarm * * farmRoot , const J9UTF8 * * makeUTF8 );
76
76
UDATA urlHashFn (void * item , void * userData );
77
77
static jint createURLEntry (JNIEnv * env , jint helperID , J9ClassPathEntry * * cpEntry_ , const char * correctedPathCopy , UDATA cpeType , U_16 cpeStatus );
@@ -615,7 +615,7 @@ getCpeTypeForProtocol(JNIEnv *env, const char *protocol, jsize protocolLen, cons
615
615
616
616
/* THREADING: Must be protected by jclCacheMutex */
617
617
static J9ClassPathEntry *
618
- getCachedURL (JNIEnv * env , jint helperID , const char * pathChars , jsize pathLen , UDATA cpeType , U_16 cpeStatus , const char * correctedPath )
618
+ getCachedURL (JNIEnv * env , jint helperID , const URLElements * urlElements , U_16 cpeStatus )
619
619
{
620
620
J9JavaVM * vm = ((J9VMThread * )env )-> javaVM ;
621
621
struct URLhtEntry * anElement = NULL ;
@@ -625,15 +625,14 @@ getCachedURL(JNIEnv *env, jint helperID, const char *pathChars, jsize pathLen, U
625
625
626
626
PORT_ACCESS_FROM_JAVAVM (vm );
627
627
628
- Trc_JCL_com_ibm_oti_shared_getCachedURL_Entry (env , helperID , cpeType );
628
+ Trc_JCL_com_ibm_oti_shared_getCachedURL_Entry_1 (env , helperID );
629
629
630
630
if (urlHashTable ) {
631
631
struct URLhtEntry dummy ;
632
632
633
- dummy .origPath = pathChars ;
634
- dummy .origPathLen = pathLen ;
633
+ dummy .origPath = urlElements -> pathChars ;
634
+ dummy .origPathLen = urlElements -> pathLen ;
635
635
dummy .helperID = helperID ;
636
- dummy .cpeType = cpeType ;
637
636
638
637
anElement = (struct URLhtEntry * )hashTableFind (urlHashTable , (void * )& dummy );
639
638
}
@@ -643,10 +642,21 @@ getCachedURL(JNIEnv *env, jint helperID, const char *pathChars, jsize pathLen, U
643
642
} else {
644
643
URLhtEntry newEntry ;
645
644
const char * origPathCopy ;
645
+ char * correctedPath = NULL ;
646
+ UDATA cpeType = getCpeTypeForProtocol (
647
+ env ,
648
+ urlElements -> protocolChars ,
649
+ urlElements -> protocolLen ,
650
+ urlElements -> pathChars ,
651
+ urlElements -> pathLen ,
652
+ & correctedPath );
653
+ if (CPE_TYPE_UNKNOWN == cpeType ) {
654
+ goto _error ;
655
+ }
646
656
647
657
/* We must make a copy of the path
648
658
This is kept in the URLhtEntry and must be valid for the lifetime of the JVM */
649
- if (!(origPathCopy = getCachedString (env , ( const char * ) pathChars , ( jsize ) pathLen , & (config -> jclStringFarm ), NULL ))) {
659
+ if (!(origPathCopy = getCachedString (env , urlElements -> pathChars , urlElements -> pathLen , & (config -> jclStringFarm ), NULL ))) {
650
660
Trc_JCL_com_ibm_oti_shared_getCachedURL_FailedStringCopy (env );
651
661
goto _error ;
652
662
}
@@ -657,7 +667,7 @@ getCachedURL(JNIEnv *env, jint helperID, const char *pathChars, jsize pathLen, U
657
667
658
668
/* The original (not corrected) path is used as a key so that the correction does not have to be performed for each lookup */
659
669
newEntry .origPath = (const char * )origPathCopy ;
660
- newEntry .origPathLen = pathLen ;
670
+ newEntry .origPathLen = urlElements -> pathLen ;
661
671
newEntry .helperID = helperID ;
662
672
newEntry .cpeType = cpeType ;
663
673
newEntry .data = urlEntry ;
@@ -818,10 +828,6 @@ urlHashEqualFn(void* left, void* right, void *userData)
818
828
Trc_JCL_com_ibm_oti_shared_urlHashEqualFn_Exit1 ();
819
829
return 0 ;
820
830
}
821
- if (leftItem -> cpeType != rightItem -> cpeType ) {
822
- Trc_JCL_com_ibm_oti_shared_urlHashEqualFn_Exit2 ();
823
- return 0 ;
824
- }
825
831
result = J9UTF8_DATA_EQUALS (leftItem -> origPath , leftItem -> origPathLen , rightItem -> origPath , rightItem -> origPathLen );
826
832
Trc_JCL_com_ibm_oti_shared_urlHashEqualFn_ExitResult (result );
827
833
return result ;
@@ -1246,14 +1252,12 @@ Java_com_ibm_oti_shared_SharedClassURLHelperImpl_findSharedClassImpl3(JNIEnv* en
1246
1252
jmethodID urlGetProtocolID = NULL ;
1247
1253
J9ROMClass * romClass = NULL ;
1248
1254
J9ClassPathEntry * urlEntry = NULL ;
1249
- UDATA cpeType = 0 ;
1250
1255
UDATA oldState ;
1251
1256
const J9UTF8 * partition = NULL ;
1252
1257
omrthread_monitor_t jclCacheMutex = config -> jclCacheMutex ;
1253
1258
U_16 cpeStatus = minimizeUpdateChecks ? CPE_STATUS_IGNORE_ZIP_LOAD_STATE : 0 ;
1254
1259
J9ClassLoader * classloader ;
1255
1260
URLElements urlElements = {0 };
1256
- char * correctedPath = NULL ;
1257
1261
1258
1262
Trc_JCL_com_ibm_oti_shared_SharedClassURLHelperImpl_findSharedClassImpl_Entry (env , helperID );
1259
1263
@@ -1285,20 +1289,10 @@ Java_com_ibm_oti_shared_SharedClassURLHelperImpl_findSharedClassImpl3(JNIEnv* en
1285
1289
if (!getStringPair (env , & nameChars , & nameLen , & partitionChars , & partitionLen , classNameObj , partitionObj )) {
1286
1290
goto _errorPostClassNamePartition ;
1287
1291
}
1288
- cpeType = getCpeTypeForProtocol (
1289
- env ,
1290
- urlElements .protocolChars ,
1291
- urlElements .protocolLen ,
1292
- urlElements .pathChars ,
1293
- urlElements .pathLen ,
1294
- & correctedPath );
1295
- if (CPE_TYPE_UNKNOWN == cpeType ) {
1296
- goto _errorPostClassNamePartition ;
1297
- }
1298
1292
1299
1293
omrthread_monitor_enter (jclCacheMutex );
1300
1294
1301
- urlEntry = getCachedURL (env , helperID , urlElements . pathChars , urlElements . pathLen , cpeType , cpeStatus , correctedPath );
1295
+ urlEntry = getCachedURL (env , helperID , & urlElements , cpeStatus );
1302
1296
if (NULL == urlEntry ) {
1303
1297
omrthread_monitor_exit (jclCacheMutex );
1304
1298
goto _errorPostClassNamePartition ;
@@ -1364,7 +1358,6 @@ Java_com_ibm_oti_shared_SharedClassURLHelperImpl_storeSharedClassImpl3(JNIEnv* e
1364
1358
J9ROMClass * romClass = NULL ;
1365
1359
J9ROMClass * newROMClass = NULL ;
1366
1360
J9ClassPathEntry * urlEntry = NULL ;
1367
- UDATA cpeType = 0 ;
1368
1361
J9ClassLoader * classloader ;
1369
1362
UDATA oldState ;
1370
1363
jint result ;
@@ -1373,7 +1366,6 @@ Java_com_ibm_oti_shared_SharedClassURLHelperImpl_storeSharedClassImpl3(JNIEnv* e
1373
1366
SCAbstractAPI * sharedapi = (SCAbstractAPI * )(config -> sharedAPIObject );
1374
1367
U_16 cpeStatus = minimizeUpdateChecks ? CPE_STATUS_IGNORE_ZIP_LOAD_STATE : 0 ;
1375
1368
URLElements urlElements = {0 };
1376
- char * correctedPath = NULL ;
1377
1369
1378
1370
Trc_JCL_com_ibm_oti_shared_SharedClassURLHelperImpl_storeSharedClassImpl_Entry (env , helperID );
1379
1371
@@ -1406,20 +1398,10 @@ Java_com_ibm_oti_shared_SharedClassURLHelperImpl_storeSharedClassImpl3(JNIEnv* e
1406
1398
if (!getStringChars (env , & partitionChars , & partitionLen , partitionObj )) {
1407
1399
goto _errorPostPathProtocol ;
1408
1400
}
1409
- cpeType = getCpeTypeForProtocol (
1410
- env ,
1411
- urlElements .protocolChars ,
1412
- urlElements .protocolLen ,
1413
- urlElements .pathChars ,
1414
- urlElements .pathLen ,
1415
- & correctedPath );
1416
- if (CPE_TYPE_UNKNOWN == cpeType ) {
1417
- goto _errorPostPartition ;
1418
- }
1419
1401
1420
1402
omrthread_monitor_enter (jclCacheMutex );
1421
1403
1422
- urlEntry = getCachedURL (env , helperID , urlElements . pathChars , urlElements . pathLen , cpeType , cpeStatus , correctedPath );
1404
+ urlEntry = getCachedURL (env , helperID , & urlElements , cpeStatus );
1423
1405
if (NULL == urlEntry ) {
1424
1406
omrthread_monitor_exit (jclCacheMutex );
1425
1407
goto _errorPostPartition ;
0 commit comments