Skip to content

Commit fcdae7c

Browse files
author
duke
committed
Backport 04f30185e914c10c918d0eff1fb63fd96e1139fb
1 parent c3ee57c commit fcdae7c

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

test/jdk/javax/management/MBeanServer/ExceptionTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -123,10 +123,13 @@ public void run(Map<String, Object> args) {
123123
} finally {
124124
try {
125125
// Close JMX Connector Client
126-
cc.close();
126+
if (cc != null) {
127+
cc.close();
128+
}
127129
// Stop connertor server
128-
cs.stop();
129-
130+
if (cs != null) {
131+
cs.stop();
132+
}
130133
} catch (Exception e) {
131134
Utils.printThrowable(e, true);
132135
throw new RuntimeException(

test/jdk/javax/management/security/HashedPasswordFileTest.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -200,6 +200,12 @@ private JMXServiceURL createServerSide(boolean useHash)
200200
return cs.getAddress();
201201
}
202202

203+
private void stopServerSide() throws IOException {
204+
if (cs != null) {
205+
cs.stop();
206+
}
207+
}
208+
203209
@Test
204210
public void testClearTextPasswordFile() throws IOException {
205211
Boolean[] bvals = new Boolean[]{true, false};
@@ -217,7 +223,7 @@ public void testClearTextPasswordFile() throws IOException {
217223
}
218224
Assert.assertEquals(isPasswordFileHashed(), bval);
219225
} finally {
220-
cs.stop();
226+
stopServerSide();
221227
}
222228
}
223229
}
@@ -241,7 +247,7 @@ public void testReadOnlyPasswordFile() throws IOException {
241247
}
242248
Assert.assertEquals(isPasswordFileHashed(), false);
243249
} finally {
244-
cs.stop();
250+
stopServerSide();
245251
}
246252
}
247253
}
@@ -263,7 +269,7 @@ public void testHashedPasswordFile() throws IOException {
263269
}
264270
}
265271
} finally {
266-
cs.stop();
272+
stopServerSide();
267273
}
268274
}
269275
}
@@ -400,7 +406,7 @@ public void testPasswordChange() throws IOException {
400406
}
401407
}
402408
} finally {
403-
cs.stop();
409+
stopServerSide();
404410
}
405411
}
406412

0 commit comments

Comments
 (0)