To fix
http://java.net/jira/browse/GLASSFISH-11665. I've added a method to GFLauncher to check the jvm options and upgrade flag like so:
private void setupUpgradeSecurity() {
// If this is an upgrade and the security manager is on,
// copy the current server.policy file to the domain
// before the upgrade.
if (info.isUpgrade() &&
jvmOptions.sysProps.containsKey("java.security.manager")) {
File source = // <info.installDir>/lib/templates/server.policy
File target = new File(info.getConfigDir(), "server.policy");
}
}
Is there some utility code already written that I can call to copy source to target above?
Bonus question: anyone have a preference as to whether the path for 'source' above is created with a string of StringBuilder appends (info.installDir's path, File.separator, 'lib', File.separator, etc.) or the concise but for-all-I-know wasteful new File(new File(new File(info.installDir, "lib"), "templates"), "server.policy")? Or maybe we even have a utility method for this somewhere that takes a file and string array?
The intent of the above is to copy the 3.1 policy to the domain. I could try to use it *only* during the upgrade and not at runtime (-Djava.security.policy), or simply turn off the security manager during the upgrade and leave it alone, but I see doing that results in a 3.1 installation with an old policy, and then the server won't start.
Thanks,
Bobby