Skip to content

Commit 1ce7a13

Browse files
committed
Merge branch 'main' into cdi-ear-exception
2 parents 5475ead + 7e54e7d commit 1ce7a13

File tree

10 files changed

+96
-79
lines changed

10 files changed

+96
-79
lines changed

appserver/tests/payara-samples/samples/cleanboot/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</parent>
4242

4343
<properties>
44-
<playwright.version>1.49.0</playwright.version>
44+
<playwright.version>1.50.0</playwright.version>
4545
</properties>
4646

4747

core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
<junit.version>4.13.2</junit.version>
132132
<mockito.version>2.28.2</mockito.version>
133133
<logging-annotation-processor.version>1.9</logging-annotation-processor.version>
134-
<jline.version>3.28.0</jline.version>
134+
<jline.version>3.29.0</jline.version>
135135
<grizzly.npn.api.version>2.0.0.payara-p1</grizzly.npn.api.version>
136136
<tiger.types.version>1.4.payara-p1</tiger.types.version>
137137
<mimepull.version>1.10.0</mimepull.version>

nucleus/cluster/cli/src/main/java/com/sun/enterprise/admin/cli/cluster/ChangeNodeMasterPasswordCommand.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* only if the new code is made subject to such option by the copyright
3838
* holder.
3939
*/
40-
// Portions Copyright [2016-2021] [Payara Foundation and/or its affiliates]
40+
// Portions Copyright [2016-2025] [Payara Foundation and/or its affiliates]
4141

4242
package com.sun.enterprise.admin.cli.cluster;
4343

@@ -47,6 +47,7 @@
4747

4848
import java.io.File;
4949
import java.io.IOException;
50+
import java.nio.charset.StandardCharsets;
5051
import java.util.HashMap;
5152
import java.util.List;
5253
import java.util.logging.Level;
@@ -87,7 +88,7 @@ public class ChangeNodeMasterPasswordCommand extends LocalInstanceCommand {
8788
protected static final String NEW_PASSWORD_ALIAS = "AS_ADMIN_NEWMASTERPASSWORD";
8889

8990
@Param(name = "node", primary = true)
90-
protected String node;
91+
protected String passwordNode;
9192

9293
@Param(name = "savemasterpassword", optional = true)
9394
private boolean saveMasterPassword;
@@ -100,7 +101,7 @@ public class ChangeNodeMasterPasswordCommand extends LocalInstanceCommand {
100101
protected void inject() throws CommandException {
101102
super.inject();
102103

103-
selectedNodeDir = new File(nodeDir, node);
104+
selectedNodeDir = new File(nodeDir, passwordNode);
104105
}
105106

106107
@Override
@@ -157,7 +158,7 @@ protected int executeCommand() throws CommandException {
157158
try {
158159
// Write the master password file
159160
PasswordAdapter p = new PasswordAdapter(pwdFile.getAbsolutePath(), MASTERPASSWORD_FILE.toCharArray());
160-
p.setPasswordForAlias(MASTERPASSWORD_FILE, newPassword.getBytes());
161+
p.setPasswordForAlias(MASTERPASSWORD_FILE, newPassword.getBytes(StandardCharsets.UTF_8));
161162
FileProtectionUtility.chmod0600(pwdFile);
162163
return 0;
163164
} catch (Exception ex) {

nucleus/cluster/cli/src/main/java/com/sun/enterprise/admin/cli/cluster/CreateLocalInstanceCommand.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* holder.
3939
*/
4040

41-
// Portions Copyright [2016-2020] [Payara Foundation and/or its affiliates]
41+
// Portions Copyright [2016-2025] [Payara Foundation and/or its affiliates]
4242

4343

4444
package com.sun.enterprise.admin.cli.cluster;
@@ -58,6 +58,7 @@
5858
import java.io.File;
5959
import java.net.InetAddress;
6060
import java.net.UnknownHostException;
61+
import java.nio.charset.StandardCharsets;
6162
import java.util.ArrayList;
6263
import java.util.logging.Level;
6364
import org.glassfish.api.ActionReport;
@@ -356,7 +357,7 @@ protected void createMasterPasswordFile(String masterPassword) throws CommandExc
356357
final File pwdFile = new File(this.getServerDirs().getAgentDir(), MASTERPASSWORD_FILE);
357358
try {
358359
PasswordAdapter p = new PasswordAdapter(pwdFile.getAbsolutePath(), MASTERPASSWORD_FILE.toCharArray());
359-
p.setPasswordForAlias(MASTERPASSWORD_FILE, masterPassword.getBytes());
360+
p.setPasswordForAlias(MASTERPASSWORD_FILE, masterPassword.getBytes(StandardCharsets.UTF_8));
360361
FileProtectionUtility.chmod0600(pwdFile);
361362
} catch (Exception ex) {
362363
throw new CommandException(Strings.get("masterPasswordFileNotCreated", pwdFile),

nucleus/cluster/cli/src/main/java/com/sun/enterprise/admin/cli/cluster/InstallNodeBaseCommand.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
* only if the new code is made subject to such option by the copyright
3838
* holder.
3939
*/
40+
// Portions Copyright [2025] [Payara Foundation and/or its affiliates]
4041
package com.sun.enterprise.admin.cli.cluster;
4142

4243
import com.sun.enterprise.universal.io.SmartFile;
@@ -45,6 +46,7 @@
4546
import com.sun.enterprise.util.io.FileUtils;
4647
import com.sun.enterprise.util.zip.ZipFileException;
4748
import com.sun.enterprise.util.zip.ZipWriter;
49+
import java.nio.charset.StandardCharsets;
4850
import org.glassfish.api.Param;
4951
import org.glassfish.api.admin.CommandException;
5052
import org.glassfish.hk2.api.PerLookup;
@@ -224,7 +226,7 @@ private static boolean isFileWithinBinDirectory(String file) {
224226

225227
public static String toString(InputStream ins) throws IOException {
226228
StringWriter sw = new StringWriter();
227-
InputStreamReader reader = new InputStreamReader(ins);
229+
InputStreamReader reader = new InputStreamReader(ins, StandardCharsets.UTF_8);
228230

229231
char[] buffer = new char[4096];
230232
int n;

nucleus/cluster/cli/src/main/java/com/sun/enterprise/admin/cli/cluster/InstallNodeSshCommand.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@
3737
* only if the new code is made subject to such option by the copyright
3838
* holder.
3939
*/
40-
// Portions Copyright [2019-2021] Payara Foundation and/or affiliates
40+
// Portions Copyright [2019-2025] Payara Foundation and/or affiliates
4141

4242
package com.sun.enterprise.admin.cli.cluster;
4343

44+
import java.nio.charset.StandardCharsets;
4445
import java.util.logging.Level;
4546
import com.sun.enterprise.util.SystemPropertyConstants;
4647
import com.sun.enterprise.util.io.FileUtils;
@@ -200,14 +201,15 @@ private void copyToHostsInternal(File zipFile, ArrayList<String> binDirFiles) th
200201
String unzipCommand = "cd '" + sshInstallDir + "'; jar -xvf " + getArchiveName();
201202
int status = sshLauncher.runCommand(unzipCommand, outStream);
202203
if (status != 0) {
203-
logger.info(Strings.get("jar.failed", host, outStream.toString()));
204-
throw new CommandException("Remote command output: " + outStream.toString());
204+
String outStreamToString = outStream.toString(StandardCharsets.UTF_8);
205+
logger.info(Strings.get("jar.failed", host, outStreamToString));
206+
throw new CommandException("Remote command output: " + outStreamToString);
205207
}
206208
if (logger.isLoggable(Level.FINER))
207209
logger.log(Level.FINER, "Installed {0} into {1}:{2}", new Object[]{getArchiveName(), host, sshInstallDir});
208210
}
209211
catch (IOException ioe) {
210-
logger.info(Strings.get("jar.failed", host, outStream.toString()));
212+
logger.info(Strings.get("jar.failed", host, outStream.toString(StandardCharsets.UTF_8)));
211213
throw new IOException(ioe);
212214
}
213215

@@ -311,11 +313,11 @@ private void checkIfAlreadyInstalled(String host, String sshInstallDir) throws C
311313
int status = sshLauncher.runCommand(cmd, outStream);
312314
if (status == 0) {
313315
if (logger.isLoggable(Level.FINER))
314-
logger.log(Level.FINER, "{0}:''{1}'' returned [{2}]", new Object[]{host, cmd, outStream.toString()});
316+
logger.log(Level.FINER, "{0}:''{1}'' returned [{2}]", new Object[]{host, cmd, outStream.toString(StandardCharsets.UTF_8)});
315317
throw new CommandException(Strings.get("install.dir.exists", sshInstallDir));
316318
} else {
317319
if (logger.isLoggable(Level.FINER))
318-
logger.log(Level.FINER, "{0}:''{1}'' failed [{2}]", new Object[]{host, cmd, outStream.toString()});
320+
logger.log(Level.FINER, "{0}:''{1}'' failed [{2}]", new Object[]{host, cmd, outStream.toString(StandardCharsets.UTF_8)});
319321
}
320322
}
321323
catch (IOException ex) {

nucleus/cluster/cli/src/main/java/com/sun/enterprise/admin/cli/cluster/LocalInstanceCommand.java

+17-11
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* only if the new code is made subject to such option by the copyright
3838
* holder.
3939
*/
40-
// Portios Copyright [2019] [Payara Foundation and/or its affiliates]
40+
// Portios Copyright [2019-2025] [Payara Foundation and/or its affiliates]
4141

4242
package com.sun.enterprise.admin.cli.cluster;
4343

@@ -407,9 +407,13 @@ protected final void whackFilesystem() throws CommandException {
407407
StringBuilder sb = new StringBuilder();
408408
sb.append("whackee=").append(whackee.toString());
409409
sb.append(", files in parent:");
410-
files = parent.listFiles();
411-
for (File f : files) {
412-
sb.append(f.toString()).append(", ");
410+
if (parent != null) {
411+
files = parent.listFiles();
412+
if (files != null) {
413+
for (File f : files) {
414+
sb.append(f.toString()).append(", ");
415+
}
416+
}
413417
}
414418
File f1 = new File(whackee.toString());
415419
sb.append(", new wackee.exists=").append(f1.exists());
@@ -419,15 +423,17 @@ protected final void whackFilesystem() throws CommandException {
419423
// now see if the parent dir is empty. If so wipe it out.
420424
// Don't be too picky with throwin errors here...
421425
try {
422-
files = parent.listFiles();
426+
if (parent != null) {
427+
files = parent.listFiles();
423428

424-
if (noInstancesRemain(files)) {
425-
File tmpwhackee = File.createTempFile("oldnode", null, grandParent);
426-
if (!tmpwhackee.delete()) {
427-
throw new IOException(Strings.get("cantdelete", tmpwhackee));
429+
if (noInstancesRemain(files)) {
430+
File tmpwhackee = File.createTempFile("oldnode", null, grandParent);
431+
if (!tmpwhackee.delete()) {
432+
throw new IOException(Strings.get("cantdelete", tmpwhackee));
433+
}
434+
FileUtils.renameFile(parent, tmpwhackee);
435+
FileUtils.whack(tmpwhackee);
428436
}
429-
FileUtils.renameFile(parent, tmpwhackee);
430-
FileUtils.whack(tmpwhackee);
431437
}
432438
} catch (IOException ioe) {
433439
// we tried!!!

nucleus/cluster/cli/src/main/java/com/sun/enterprise/admin/cli/cluster/NativeRemoteCommandsBase.java

+49-46
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* only if the new code is made subject to such option by the copyright
3838
* holder.
3939
*/
40-
// Portions Copyright [2018-2019] [Payara Foundation and/or its affiliates]
40+
// Portions Copyright [2018-2025] [Payara Foundation and/or its affiliates]
4141

4242
package com.sun.enterprise.admin.cli.cluster;
4343

@@ -296,55 +296,58 @@ String expandPasswordAlias(String host, String alias, boolean verifyConn) {
296296

297297
try {
298298
File domainsDirFile = DomainDirs.getDefaultDomainsDir();
299-
300-
//get the list of domains
301-
File[] files = domainsDirFile.listFiles(new FileFilter() {
302-
@Override
303-
public boolean accept(File f) {
304-
return f.isDirectory();
305-
}
306-
});
307-
308-
for (File f : files) {
309-
//the following property is required for initializing the password helper
310-
System.setProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY, f.getAbsolutePath());
311-
try {
312-
final PasswordAdapter pa = new PasswordAdapter(null);
313-
final boolean exists = pa.aliasExists(alias);
314-
if (exists) {
315-
String mPass = getMasterPassword(f.getName());
316-
expandedPassword = new PasswordAdapter(mPass.toCharArray()).getPasswordForAlias(alias);
317-
}
318-
} catch (Exception e) {
319-
if (logger.isLoggable(Level.FINER)) {
320-
logger.finer(StringUtils.cat(": ", alias, e.getMessage()));
299+
if (domainsDirFile != null) {
300+
//get the list of domains
301+
//if(domainsDirFile != null) {
302+
File[] files = domainsDirFile.listFiles(new FileFilter() {
303+
@Override
304+
public boolean accept(File f) {
305+
return f.isDirectory();
321306
}
322-
logger.warning(Strings.get("GetPasswordFailure", f.getName()));
323-
continue;
324-
}
325-
326-
if (expandedPassword != null) {
327-
SSHLauncher sshL = new SSHLauncher();
328-
if (host != null) {
329-
sshpassword = expandedPassword;
330-
sshL.init(getRemoteUser(), host, getRemotePort(), sshpassword, null, null, logger);
331-
connStatus = sshL.checkPasswordAuth();
332-
if (!connStatus) {
333-
logger.warning(Strings.get("PasswordAuthFailure", f.getName()));
334-
}
335-
} else {
336-
sshkeypassphrase = expandedPassword;
337-
if (verifyConn) {
338-
sshL.init(getRemoteUser(), hosts[0], getRemotePort(), sshpassword, getSshKeyFile(), sshkeypassphrase, logger);
339-
connStatus = sshL.checkConnection();
340-
if (!connStatus) {
341-
logger.warning(Strings.get("PasswordAuthFailure", f.getName()));
307+
});
308+
if (files != null) {
309+
for (File f : files) {
310+
//the following property is required for initializing the password helper
311+
System.setProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY, f.getAbsolutePath());
312+
try {
313+
final PasswordAdapter pa = new PasswordAdapter(null);
314+
final boolean exists = pa.aliasExists(alias);
315+
if (exists) {
316+
String mPass = getMasterPassword(f.getName());
317+
expandedPassword = new PasswordAdapter(mPass.toCharArray()).getPasswordForAlias(alias);
342318
}
319+
} catch (Exception e) {
320+
if (logger.isLoggable(Level.FINER)) {
321+
logger.finer(StringUtils.cat(": ", alias, e.getMessage()));
322+
}
323+
logger.warning(Strings.get("GetPasswordFailure", f.getName()));
324+
continue;
343325
}
344-
}
345326

346-
if (connStatus) {
347-
break;
327+
if (expandedPassword != null) {
328+
SSHLauncher sshL = new SSHLauncher();
329+
if (host != null) {
330+
sshpassword = expandedPassword;
331+
sshL.init(getRemoteUser(), host, getRemotePort(), sshpassword, null, null, logger);
332+
connStatus = sshL.checkPasswordAuth();
333+
if (!connStatus) {
334+
logger.warning(Strings.get("PasswordAuthFailure", f.getName()));
335+
}
336+
} else {
337+
sshkeypassphrase = expandedPassword;
338+
if (verifyConn) {
339+
sshL.init(getRemoteUser(), hosts[0], getRemotePort(), sshpassword, getSshKeyFile(), sshkeypassphrase, logger);
340+
connStatus = sshL.checkConnection();
341+
if (!connStatus) {
342+
logger.warning(Strings.get("PasswordAuthFailure", f.getName()));
343+
}
344+
}
345+
}
346+
347+
if (connStatus) {
348+
break;
349+
}
350+
}
348351
}
349352
}
350353
}

nucleus/cluster/cli/src/main/java/com/sun/enterprise/admin/cli/cluster/SynchronizeInstanceCommand.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* only if the new code is made subject to such option by the copyright
3838
* holder.
3939
*/
40-
// Portions Copyright [2019-2021] Payara Foundation and/or affiliates
40+
// Portions Copyright [2019-2025] Payara Foundation and/or affiliates
4141

4242
package com.sun.enterprise.admin.cli.cluster;
4343

@@ -286,10 +286,12 @@ protected boolean synchronizeInstance() throws CommandException {
286286
sr.instance = instanceName;
287287
sr.dir = "config-specific";
288288
File configDir = new File(instanceDir, "config");
289-
for (File f : configDir.listFiles()) {
290-
if (!f.isDirectory())
291-
continue;
292-
getFileModTimes(f, configDir, sr, SyncLevel.DIRECTORY);
289+
if(configDir.exists()) {
290+
for (File f : Objects.requireNonNull(configDir.listFiles())) {
291+
if (!f.isDirectory())
292+
continue;
293+
getFileModTimes(f, configDir, sr, SyncLevel.DIRECTORY);
294+
}
293295
}
294296
/*
295297
* Before sending the last sync request revert to using the original
@@ -372,7 +374,7 @@ private void getFileModTimes(File dir, File baseDir, SyncRequest sr,
372374
sr.files.add(mt);
373375
return;
374376
}
375-
for (String file : dir.list()) {
377+
for (String file : Objects.requireNonNull(dir.list())) {
376378
File f = new File(dir, file);
377379
long time = f.lastModified();
378380
if (time == 0)

nucleus/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113

114114
<!-- Apache Felix is an open source implementation of the OSGi Core Release 8 framework specification. -->
115115
<org.apache.felix.main.version>7.0.5</org.apache.felix.main.version>
116-
<org.apache.felix.webconsole.version>5.0.8</org.apache.felix.webconsole.version>
116+
<org.apache.felix.webconsole.version>5.0.10</org.apache.felix.webconsole.version>
117117
<org.apache.felix.eventadmin.version>1.6.4</org.apache.felix.eventadmin.version>
118118
<org.apache.felix.shell.version>1.4.3</org.apache.felix.shell.version>
119119
<org.apache.felix.gogo.runtime.version>1.1.6</org.apache.felix.gogo.runtime.version>

0 commit comments

Comments
 (0)