@@ -506,23 +506,12 @@ boolean hasAnyExternallyManagedInitMethod(String initMethod) {
506
506
if (isExternallyManagedInitMethod (initMethod )) {
507
507
return true ;
508
508
}
509
- if (this .externallyManagedInitMethods != null ) {
510
- for (String candidate : this .externallyManagedInitMethods ) {
511
- int indexOfDot = candidate .lastIndexOf ('.' );
512
- if (indexOfDot >= 0 ) {
513
- String methodName = candidate .substring (indexOfDot + 1 );
514
- if (methodName .equals (initMethod )) {
515
- return true ;
516
- }
517
- }
518
- }
519
- }
520
- return false ;
509
+ return hasAnyExternallyManagedMethod (this .externallyManagedInitMethods , initMethod );
521
510
}
522
511
}
523
512
524
513
/**
525
- * Return all externally managed initialization methods (as an immutable Set).
514
+ * Get all externally managed initialization methods (as an immutable Set).
526
515
* <p>See {@link #registerExternallyManagedInitMethod} for details
527
516
* regarding the format for the initialization methods in the returned set.
528
517
* @since 5.3.11
@@ -583,19 +572,23 @@ boolean hasAnyExternallyManagedDestroyMethod(String destroyMethod) {
583
572
if (isExternallyManagedDestroyMethod (destroyMethod )) {
584
573
return true ;
585
574
}
586
- if (this .externallyManagedDestroyMethods != null ) {
587
- for (String candidate : this .externallyManagedDestroyMethods ) {
588
- int indexOfDot = candidate .lastIndexOf ('.' );
589
- if (indexOfDot >= 0 ) {
590
- String methodName = candidate .substring (indexOfDot + 1 );
591
- if (methodName .equals (destroyMethod )) {
592
- return true ;
593
- }
575
+ return hasAnyExternallyManagedMethod (this .externallyManagedDestroyMethods , destroyMethod );
576
+ }
577
+ }
578
+
579
+ private static boolean hasAnyExternallyManagedMethod (Set <String > candidates , String methodName ) {
580
+ if (candidates != null ) {
581
+ for (String candidate : candidates ) {
582
+ int indexOfDot = candidate .lastIndexOf ('.' );
583
+ if (indexOfDot > 0 ) {
584
+ String candidateMethodName = candidate .substring (indexOfDot + 1 );
585
+ if (candidateMethodName .equals (methodName )) {
586
+ return true ;
594
587
}
595
588
}
596
589
}
597
- return false ;
598
590
}
591
+ return false ;
599
592
}
600
593
601
594
/**
0 commit comments