Skip to content

Commit

Permalink
Meke check for a VehicleClient instance more robust to not cause CNFEs.
Browse files Browse the repository at this point in the history
Signed-off-by: Scott M Stark <[email protected]>
#1562
  • Loading branch information
starksm64 committed Oct 7, 2024
1 parent c4291be commit ec4846d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion common/src/main/java/com/sun/ts/lib/harness/ServiceEETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,18 @@ public Properties getVehicleSpecificClientProps(Properties p) {
public Status run(String[] argv, Properties p) {
Status status = null;
boolean inTestHarness = TestUtil.iWhereAreWe == TestUtil.VM_HARNESS;
boolean isVehicleClient = this instanceof com.sun.ts.tests.common.vehicle.VehicleClient;
boolean isVehicleClient = false;
URL thisURL = getClass().getProtectionDomain().getCodeSource().getLocation();
TestUtil.logTrace("in ServiceEETest.run(), this URL is: " + thisURL);
try {
Class<?> vcClass = getClass().getClassLoader().loadClass("com.sun.ts.tests.common.vehicle.VehicleClient");
URL vcClassURL = vcClass.getProtectionDomain().getCodeSource().getLocation();
TestUtil.logTrace("VehicleClient URL is: " + vcClassURL);
isVehicleClient = vcClass.isAssignableFrom(getClass());
TestUtil.logTrace("VehicleClient URL is: " + vcClassURL);
} catch (ClassNotFoundException e) {
TestUtil.logTrace("VehicleClient class not found, so not a vehicle client.");
}
if (inTestHarness && isVehicleClient) {
TestUtil.logTrace("in ServiceEETest.run() method");
String sVehicle = TestUtil.getProperty(p, "vehicle");
Expand Down

0 comments on commit ec4846d

Please sign in to comment.