8299470: sun/jvm/hotspot/SALauncher.java handling of negative rmiport args
Reviewed-by: clanger, sspitsyn, kevinw
This commit is contained in:
parent
578c287a68
commit
2ccdefc81c
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot
test/hotspot/jtreg/serviceability/sa/sadebugd
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -59,7 +59,8 @@ public class SAGetopt {
|
||||
}
|
||||
|
||||
if (! _argv[_optind].isEmpty() && _argv[_optind].charAt(0) == '-') {
|
||||
throw new SAGetoptException("Argument is expected for '" + opt + "'");
|
||||
throw new SAGetoptException("Successor argument without leading - is expected for '" + opt +
|
||||
"' but we got '" + _argv[_optind] + "'");
|
||||
}
|
||||
|
||||
_optarg = _argv[_optind];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -500,7 +500,8 @@ public class SALauncher {
|
||||
func.accept(oldArgs);
|
||||
}
|
||||
} catch (SAGetoptException e) {
|
||||
System.err.println(e.getMessage());
|
||||
System.err.println("SA agent option related exception occurred: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
toolHelp(args[0]);
|
||||
// Exit with error status
|
||||
System.exit(1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -101,12 +101,18 @@ public class SADebugDTest {
|
||||
int registryPort = REGISTRY_DEFAULT_PORT;
|
||||
if (useRegistryPort) {
|
||||
registryPort = Utils.findUnreservedFreePort(REGISTRY_DEFAULT_PORT);
|
||||
if (registryPort == -1) {
|
||||
throw new RuntimeException("Cannot find a registryPort, findUnreservedFreePort returns -1");
|
||||
}
|
||||
jhsdbLauncher.addToolArg("--registryport");
|
||||
jhsdbLauncher.addToolArg(Integer.toString(registryPort));
|
||||
}
|
||||
|
||||
final int rmiPort = useRmiPort ? Utils.findUnreservedFreePort(REGISTRY_DEFAULT_PORT, registryPort) : -1;
|
||||
if (useRmiPort) {
|
||||
if (rmiPort == -1) {
|
||||
throw new RuntimeException("Cannot find an rmiPort, findUnreservedFreePort returns -1");
|
||||
}
|
||||
jhsdbLauncher.addToolArg("--rmiport");
|
||||
jhsdbLauncher.addToolArg(Integer.toString(rmiPort));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user