@@ -104,60 +104,44 @@ public static String getImplementationVersion(String manifestPath) {
104104 .getValue (Attributes .Name .IMPLEMENTATION_VERSION );
105105 }
106106
107- /**
108- * Get version from properties
109- * @return The common version
110- */
111- public static String getVersionFromProperties () {
112- final Properties PROPS = new Properties ();
107+ public static Properties loadProperties () {
108+ final Properties props = new Properties ();
113109
114110 try (InputStream is =
115111 VersionUtil .class .getResourceAsStream ("/version.properties" )) {
116- PROPS .load (is );
112+ props .load (is );
117113 } catch (IOException e ) {
118114 throw new RuntimeException ("Could not load version.properties" , e );
119115 }
120- return PROPS .getProperty ("Version" );
116+ return props ;
117+ }
118+
119+ /**
120+ * Get version from properties
121+ * @return The common version
122+ */
123+ public static String getVersionFromProperties () {
124+ Properties props = loadProperties ();
125+ return props .getProperty ("Version" );
121126 }
122127
123128 /**
124129 * Get api version from properties
125130 * @return The api version
126131 */
127132 public static String getApiVersionFromProperties () {
128- final Properties PROPS = new Properties ();
129-
130- try (InputStream is =
131- VersionUtil .class .getResourceAsStream ("/version.properties" )) {
132- PROPS .load (is );
133- } catch (IOException e ) {
134- throw new RuntimeException ("Could not load version.properties" , e );
135- }
136- return PROPS .getProperty ("ApiVersion" );
133+ Properties props = loadProperties ();
134+ return props .getProperty ("ApiVersion" );
137135 }
138136
139137 public static String getApiCheckBeginVersionFromProperties () {
140- final Properties PROPS = new Properties ();
141-
142- try (InputStream is =
143- VersionUtil .class .getResourceAsStream ("/version.properties" )) {
144- PROPS .load (is );
145- } catch (IOException e ) {
146- throw new RuntimeException ("Could not load version.properties" , e );
147- }
148- return PROPS .getProperty ("ApiCheckBeginVersion" );
138+ Properties props = loadProperties ();
139+ return props .getProperty ("ApiCheckBeginVersion" );
149140 }
150141
151142 public static String getApiCheckEndVersionFromProperties () {
152- final Properties PROPS = new Properties ();
153-
154- try (InputStream is =
155- VersionUtil .class .getResourceAsStream ("/version.properties" )) {
156- PROPS .load (is );
157- } catch (IOException e ) {
158- throw new RuntimeException ("Could not load version.properties" , e );
159- }
160- return PROPS .getProperty ("ApiCheckEndVersion" );
143+ Properties props = loadProperties ();
144+ return props .getProperty ("ApiCheckEndVersion" );
161145 }
162146
163147 /**
0 commit comments