diff --git a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java index 5f1da73e4ec..437a41b61bb 100644 --- a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java +++ b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/CLIBootstrap.java @@ -882,7 +882,7 @@ static class GlassFishInfo { GlassFishInfo() { String asInstallPath = System.getProperty(ENV_VAR_PROP_PREFIX + "AS_INSTALL"); - if (asInstallPath == null || asInstallPath.length() == 0) { + if (asInstallPath == null || asInstallPath.isEmpty()) { throw new IllegalArgumentException("AS_INSTALL == null"); } this.home = new File(asInstallPath); diff --git a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/ACCStartupContext.java b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/ACCStartupContext.java index 0ae12f0f2ef..8d2fcef3299 100644 --- a/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/ACCStartupContext.java +++ b/appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/ACCStartupContext.java @@ -72,7 +72,7 @@ private static Properties accEnvironment() { "AS_DEF_NODES_PATH", AGENT_ROOT_PROPERTY); Map files = new EnvToPropsConverter(rootDirectory.toPath()).convert(pairs); Properties env = new Properties(); - files.entrySet().forEach(e -> env.put(e.getKey(), e.getValue().getAbsolutePath())); + files.entrySet().forEach(e -> env.put(e.getKey(), e.getValue().getPath())); return env; } diff --git a/appserver/jms/jms-core/src/main/java/com/sun/enterprise/connectors/jms/util/JmsRaUtil.java b/appserver/jms/jms-core/src/main/java/com/sun/enterprise/connectors/jms/util/JmsRaUtil.java index 7647e291620..7a9f0603ba0 100755 --- a/appserver/jms/jms-core/src/main/java/com/sun/enterprise/connectors/jms/util/JmsRaUtil.java +++ b/appserver/jms/jms-core/src/main/java/com/sun/enterprise/connectors/jms/util/JmsRaUtil.java @@ -342,9 +342,9 @@ public void upgradeIfNecessary() { return; } - final Path imqLib = Path.of(imqLibPath); + final Path imqLib = new File(imqLibPath).toPath(); + final Path deployedDir = new File(installRoot).toPath().resolve(SYSTEM_APP_DIR).resolve(DEFAULT_JMS_ADAPTER); final File imqLibRar = imqLib.resolve(MQ_RAR).toFile(); - final Path deployedDir = Path.of(installRoot).resolve(SYSTEM_APP_DIR).resolve(DEFAULT_JMS_ADAPTER); final String installedMqVersion; final String deployedMqVersion; try { diff --git a/nucleus/admin/launcher/src/main/java/com/sun/enterprise/admin/launcher/GlassFishMainLauncher.java b/nucleus/admin/launcher/src/main/java/com/sun/enterprise/admin/launcher/GlassFishMainLauncher.java index d5ad1ca10f9..4a24640dbce 100644 --- a/nucleus/admin/launcher/src/main/java/com/sun/enterprise/admin/launcher/GlassFishMainLauncher.java +++ b/nucleus/admin/launcher/src/main/java/com/sun/enterprise/admin/launcher/GlassFishMainLauncher.java @@ -17,8 +17,6 @@ package com.sun.enterprise.admin.launcher; -import com.sun.enterprise.universal.io.SmartFile; - import java.io.File; import java.nio.file.Path; import java.util.List; @@ -66,8 +64,8 @@ List getMainClasspath() throws GFLauncherException { @Override List getMainModulepath() throws GFLauncherException { - return List - .of(SmartFile.sanitize(Path.of(getEnvProps().get(INSTALL_ROOT_PROPERTY), "lib", "bootstrap").toFile())); + Path installRoot = new File(getEnvProps().get(INSTALL_ROOT_PROPERTY)).toPath(); + return List.of(installRoot.resolve(Path.of("lib", "bootstrap")).toAbsolutePath().normalize().toFile()); } @Override diff --git a/nucleus/common/common-util/src/main/java/com/sun/enterprise/universal/glassfish/ASenvPropertyReader.java b/nucleus/common/common-util/src/main/java/com/sun/enterprise/universal/glassfish/ASenvPropertyReader.java index e08749952ce..ba881c25445 100644 --- a/nucleus/common/common-util/src/main/java/com/sun/enterprise/universal/glassfish/ASenvPropertyReader.java +++ b/nucleus/common/common-util/src/main/java/com/sun/enterprise/universal/glassfish/ASenvPropertyReader.java @@ -128,11 +128,12 @@ public String toString() { static class ASenvMap extends HashMap { ASenvMap(File installDir) { new EnvToPropsConverter(installDir.toPath()).convert(ENV_TO_SYS_PROPERTY).entrySet() - .forEach(e -> this.put(e.getKey(), e.getValue().getAbsolutePath())); - put(JAVA_ROOT_PROPERTY, System.getProperty("java.home")); - put(JAVA_ROOT_PROPERTY_ASENV, System.getProperty("java.home")); - put(INSTALL_ROOT_PROPERTY, installDir.getAbsolutePath()); - put(PRODUCT_ROOT_PROPERTY, installDir.getParentFile().getAbsolutePath()); + .forEach(e -> this.put(e.getKey(), e.getValue().getPath())); + String javaHome = new File(System.getProperty("java.home")).toPath().toString(); + put(JAVA_ROOT_PROPERTY, javaHome); + put(JAVA_ROOT_PROPERTY_ASENV, javaHome); + put(INSTALL_ROOT_PROPERTY, installDir.toPath().toString()); + put(PRODUCT_ROOT_PROPERTY, installDir.getParentFile().toPath().toString()); put(HOST_NAME_PROPERTY, getHostname()); } @@ -146,21 +147,5 @@ private static String getHostname() { } return hostname; } - - private static boolean isValidJavaRoot(String javaRootName) { - if (!GFLauncherUtils.ok(javaRootName)) { - return false; - } - - // look for ${javaRootName}/bin/java[.exe] - File f = new File(javaRootName); - - if (GFLauncherUtils.isWindows()) { - f = new File(f, "bin/java.exe"); - } else { - f = new File(f, "bin/java"); - } - return f.exists(); - } } } diff --git a/nucleus/common/glassfish-jdk-extensions/src/main/java/org/glassfish/main/jdke/props/EnvToPropsConverter.java b/nucleus/common/glassfish-jdk-extensions/src/main/java/org/glassfish/main/jdke/props/EnvToPropsConverter.java index 7129887143a..9691c0c9a62 100644 --- a/nucleus/common/glassfish-jdk-extensions/src/main/java/org/glassfish/main/jdke/props/EnvToPropsConverter.java +++ b/nucleus/common/glassfish-jdk-extensions/src/main/java/org/glassfish/main/jdke/props/EnvToPropsConverter.java @@ -53,7 +53,7 @@ public EnvToPropsConverter(final Path relativePathAnchor) { * There is no guarantee the file does exist. * * @param envToSys - key is env name, value is system property name. - * @return map of system property names and files. + * @return map of system property names and absolute files. */ public Map convert(final Map envToSys) { final Map files = new HashMap<>(envToSys.size()); @@ -86,7 +86,7 @@ public Map convert(final Map envToSys) { */ public File convert(final String envPropertyName, final String systemPropertyName) { final String value = evaluate(envPropertyName, systemPropertyName); - return value == null ? null : toAbsoluteFile(Path.of(value)); + return value == null ? null : toAbsoluteFile(new File(value)); } @@ -104,13 +104,10 @@ private String evaluate(final String envPropertyName, final String systemPropert } - private File toAbsoluteFile(final Path path) { - File absoluteFile; - if (path.isAbsolute()) { - absoluteFile = path.normalize().toFile(); - } else { - absoluteFile = anchor.resolve(path).normalize().toFile(); + private File toAbsoluteFile(final File file) { + if (file.isAbsolute()) { + return file.toPath().normalize().toFile(); } - return absoluteFile; + return anchor.resolve(file.toPath()).toAbsolutePath().normalize().toFile(); } } diff --git a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/EmbeddedOSGiGlassFishRuntime.java b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/EmbeddedOSGiGlassFishRuntime.java index cdc711bee88..2f092f215fb 100644 --- a/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/EmbeddedOSGiGlassFishRuntime.java +++ b/nucleus/core/bootstrap-osgi/src/main/java/org/glassfish/main/boot/osgi/EmbeddedOSGiGlassFishRuntime.java @@ -244,14 +244,14 @@ private void setEnv(Properties bootstrapProperties) { File installRoot = new File(installRootValue); new EnvToPropsConverter(installRoot.toPath()).convert(pairs).entrySet() - .forEach(e -> System.setProperty(e.getKey(), e.getValue().getAbsolutePath())); + .forEach(e -> System.setProperty(e.getKey(), e.getValue().getPath())); System.setProperty(INSTALL_ROOT_PROP_NAME, installRootValue); System.setProperty(INSTALL_ROOT_URI_PROP_NAME, installRoot.toURI().toString()); } final String instanceRootValue = bootstrapProperties.getProperty(INSTANCE_ROOT_PROP_NAME); if (instanceRootValue != null && !instanceRootValue.isEmpty()) { - File instanceRoot = new File(instanceRootValue); + File instanceRoot = new File(instanceRootValue).toPath().normalize().toFile(); System.setProperty(INSTANCE_ROOT_PROP_NAME, instanceRoot.getAbsolutePath()); System.setProperty(INSTANCE_ROOT_URI_PROP_NAME, instanceRoot.toURI().toString()); } diff --git a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/CommonClassLoaderServiceImpl.java b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/CommonClassLoaderServiceImpl.java index dc340138559..ccfbb57df8b 100644 --- a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/CommonClassLoaderServiceImpl.java +++ b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/CommonClassLoaderServiceImpl.java @@ -185,7 +185,7 @@ private static Path getDerbyDir(File installDir) { if (derbyHomeProperty == null) { return installDir.toPath().resolve(Path.of("..", "javadb")); } - Path derbyHome = Path.of(derbyHomeProperty); + Path derbyHome = new File(derbyHomeProperty).toPath(); if (derbyHome.isAbsolute()) { return derbyHome; } diff --git a/nucleus/distributions/nucleus-common/src/main/resources/bin/nadmin.bat b/nucleus/distributions/nucleus-common/src/main/resources/bin/nadmin.bat index 50cebcbe7f5..0390a24c76d 100644 --- a/nucleus/distributions/nucleus-common/src/main/resources/bin/nadmin.bat +++ b/nucleus/distributions/nucleus-common/src/main/resources/bin/nadmin.bat @@ -33,4 +33,5 @@ goto run set JAVA=java :run +ECHO ON; %JAVA% %ASADMIN_JVM_OPTIONS% --module-path "%ASADMIN_MODULEPATH%" --add-modules ALL-MODULE-PATH -cp "%ASADMIN_CLASSPATH%" com.sun.enterprise.admin.cli.AdminMain %*