25
25
import org .openqa .grid .internal .utils .HtmlRenderer ;
26
26
import org .openqa .grid .internal .utils .configuration .GridHubConfiguration ;
27
27
import org .openqa .grid .web .servlet .RegistryBasedServlet ;
28
+ import org .openqa .selenium .internal .BuildInfo ;
28
29
import org .openqa .selenium .remote .DesiredCapabilities ;
29
30
30
31
import java .io .ByteArrayInputStream ;
31
32
import java .io .IOException ;
32
33
import java .io .InputStream ;
33
- import java .net .URL ;
34
- import java .net .URLClassLoader ;
35
34
import java .util .ArrayList ;
36
35
import java .util .List ;
37
- import java .util .Properties ;
38
- import java .util .jar .Manifest ;
39
36
import java .util .logging .Logger ;
40
37
41
38
import javax .servlet .ServletException ;
@@ -54,7 +51,7 @@ public ConsoleServlet() {
54
51
55
52
public ConsoleServlet (Registry registry ) {
56
53
super (registry );
57
- getVersion ();
54
+ coreVersion = new BuildInfo (). getReleaseLabel ();
58
55
}
59
56
60
57
@ Override
@@ -245,25 +242,4 @@ private String getConfigInfo(boolean verbose) {
245
242
private String prettyHtmlPrint (GridHubConfiguration config ) {
246
243
return config .toString ("<abbr title='%1$s'>%1$s : </abbr>%2$s</br>" );
247
244
}
248
-
249
- private void getVersion () {
250
- InputStream stream = null ;
251
- try {
252
- String classPath = this .getClass ().getResource (this .getClass ().getSimpleName () + ".class" ).toString ();
253
- String manifest = classPath .substring (0 , classPath .lastIndexOf ("!" ) + 1 ) + "/META-INF/MANIFEST.MF" ;
254
- stream = new URL (manifest ).openStream ();
255
- } catch (Exception e ) {
256
- e .printStackTrace ();
257
- }
258
- if (stream == null ) {
259
- log .severe ("Couldn't determine version number" );
260
- return ;
261
- }
262
- try {
263
- Manifest manifest = new Manifest (stream );
264
- coreVersion = manifest .getEntries ().get ("Build-Info" ).getValue ("Selenium-Version" ).trim ();
265
- } catch (IOException e ) {
266
- log .severe ("Cannot load version from VERSION.txt" + e .getMessage ());
267
- }
268
- }
269
245
}
0 commit comments