@@ -682,20 +682,7 @@ static <T> T getFromServiceLoader(Class<? extends T> clazz, T defaultInstance) {
682682 private static String defaultLibraryVersion () {
683683 String version = getPomVersion ();
684684 if (version == null ) {
685- try {
686- Enumeration <URL > resources =
687- ServiceOptions .class .getClassLoader ().getResources (JarFile .MANIFEST_NAME );
688- while (resources .hasMoreElements () && version == null ) {
689- Manifest manifest = new Manifest (resources .nextElement ().openStream ());
690- Attributes manifestAttributes = manifest .getMainAttributes ();
691- String artifactId = manifestAttributes .getValue (MANIFEST_ARTIFACT_ID_KEY );
692- if (artifactId != null && artifactId .equals (ARTIFACT_ID )) {
693- version = manifestAttributes .getValue (MANIFEST_VERSION_KEY );
694- }
695- }
696- } catch (IOException e ) {
697- // ignore
698- }
685+ version = getManifestVersion ();
699686 }
700687 return version ;
701688 }
@@ -716,4 +703,23 @@ private static String getPomVersion() {
716703 }
717704 return null ;
718705 }
706+
707+ private static String getManifestVersion () {
708+ String version = null ;
709+ try {
710+ Enumeration <URL > resources =
711+ ServiceOptions .class .getClassLoader ().getResources (JarFile .MANIFEST_NAME );
712+ while (resources .hasMoreElements () && version == null ) {
713+ Manifest manifest = new Manifest (resources .nextElement ().openStream ());
714+ Attributes manifestAttributes = manifest .getMainAttributes ();
715+ String artifactId = manifestAttributes .getValue (MANIFEST_ARTIFACT_ID_KEY );
716+ if (artifactId != null && artifactId .equals (ARTIFACT_ID )) {
717+ version = manifestAttributes .getValue (MANIFEST_VERSION_KEY );
718+ }
719+ }
720+ } catch (IOException e ) {
721+ // ignore
722+ }
723+ return version ;
724+ }
719725}
0 commit comments