Skip to content

Commit 7443cc1

Browse files
authored
update deprecated call to url (#9410)
Signed-off-by: Sally MacFarlane <[email protected]>
1 parent ebfee2d commit 7443cc1

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

util/src/main/java/org/hyperledger/besu/util/BesuVersionUtils.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,16 @@ public final class BesuVersionUtils {
4141

4242
static {
4343
String className = BesuVersionUtils.class.getSimpleName() + ".class";
44-
String classPath =
45-
Optional.ofNullable(BesuVersionUtils.class.getResource(className))
46-
.map(URL::toString)
47-
.orElse(null);
44+
final URL classUrl = BesuVersionUtils.class.getResource(className);
4845

4946
String commit = null;
5047
String implVersion =
5148
Optional.ofNullable(BesuVersionUtils.class.getPackage())
5249
.map(Package::getImplementationVersion)
5350
.orElse(null);
54-
if (classPath != null) {
51+
if (classUrl != null) {
5552
try {
56-
URL url = new URL(classPath);
57-
JarURLConnection jarConnection = (JarURLConnection) url.openConnection();
53+
JarURLConnection jarConnection = (JarURLConnection) classUrl.openConnection();
5854
Manifest manifest = jarConnection.getManifest();
5955
Attributes attributes = manifest.getMainAttributes();
6056
commit = attributes.getValue("Commit-Hash");

0 commit comments

Comments
 (0)