From 7ec411991002186fe6e6beeab13ad2d237656a24 Mon Sep 17 00:00:00 2001 From: Rhys Williams <170514543+Viii3@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:55:49 +0100 Subject: [PATCH 1/3] FISH-9195 string concatenation. --- .../admingui/extras/rest/PayaraRestApiHandlers.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/appserver/admingui/payara-console-extras/src/main/java/fish/payara/admingui/extras/rest/PayaraRestApiHandlers.java b/appserver/admingui/payara-console-extras/src/main/java/fish/payara/admingui/extras/rest/PayaraRestApiHandlers.java index eff56a21025..0d0199016c3 100644 --- a/appserver/admingui/payara-console-extras/src/main/java/fish/payara/admingui/extras/rest/PayaraRestApiHandlers.java +++ b/appserver/admingui/payara-console-extras/src/main/java/fish/payara/admingui/extras/rest/PayaraRestApiHandlers.java @@ -1,5 +1,5 @@ -/* - * Copyright (c) [2016-2020] Payara Foundation and/or its affiliates. All rights reserved. +/* + * Copyright (c) [2016-2024] Payara Foundation and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -164,13 +164,14 @@ public static void sendAsadminCommandToSelectedInstances(HandlerContext handlerC command = splitCommand[0]; // Convert the parameters into a space-separated string - String parameters = ""; + String parameters; + StringBuilder paramBuilder = new StringBuilder(); for (int i = 1; i < splitCommand.length; i++) { - parameters += splitCommand[i] + " "; + paramBuilder.append(splitCommand[i]).append(" "); } // Remove any trailing spaces - parameters = parameters.trim(); + parameters = paramBuilder.toString().trim(); // Get the parameters from each row, and send the asadmin command for (Map row : selectedRows) { From ba957e092e2b1b9b7c902577a1fcf9aa26ce551a Mon Sep 17 00:00:00 2001 From: Rhys Williams <170514543+Viii3@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:57:02 +0100 Subject: [PATCH 2/3] FISH-9194 string concatenation. --- .../recorder/AsadminRecorderService.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nucleus/payara-modules/asadmin-recorder/src/main/java/fish/payara/asadmin/recorder/AsadminRecorderService.java b/nucleus/payara-modules/asadmin-recorder/src/main/java/fish/payara/asadmin/recorder/AsadminRecorderService.java index 35e59a57e49..421afa66672 100644 --- a/nucleus/payara-modules/asadmin-recorder/src/main/java/fish/payara/asadmin/recorder/AsadminRecorderService.java +++ b/nucleus/payara-modules/asadmin-recorder/src/main/java/fish/payara/asadmin/recorder/AsadminRecorderService.java @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2016-2021 Payara Foundation and/or its affiliates. All rights reserved. + * Copyright (c) 2016-2024 Payara Foundation and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -107,12 +107,12 @@ public void event(Event event) { private String constructAsadminCommand(String commandName, ParameterMap parameters) { - String asadminCommand = commandName; - String mandatoryOption = ""; + StringBuilder asadminCommand = new StringBuilder(commandName); + StringBuilder mandatoryOption = new StringBuilder(); if (Boolean.parseBoolean(asadminRecorderConfiguration.prependEnabled()) && prependedOptions != null) { for (String s : prependedOptions) { - asadminCommand += " " + s; + asadminCommand.append(" ").append(s); } } @@ -123,21 +123,21 @@ private String constructAsadminCommand(String commandName, ParameterMap paramete // This can have sub-parameters, so loop through and add spaces // between the sub-parameters. for (int i = 0; i < parameter.getValue().size(); i++) { - mandatoryOption += parameter.getValue().get(i); + mandatoryOption.append(parameter.getValue().get(i)); if (i != (parameter.getValue().size() - 1)) { - mandatoryOption += " "; + mandatoryOption.append(" "); } } } else { - asadminCommand += " --" + parameter.getKey() + "=" + parameter.getValue().get(0); + asadminCommand.append(" --").append(parameter.getKey()).append("=").append(parameter.getValue().get(0)); } } } - asadminCommand += " " + mandatoryOption; - asadminCommand += "\n"; + asadminCommand.append(" ").append(mandatoryOption); + asadminCommand.append("\n"); - return asadminCommand; + return asadminCommand.toString(); } /** From 819e9073053271f1a21f4babd2e15c8093d8b2a3 Mon Sep 17 00:00:00 2001 From: Rhys Williams <170514543+Viii3@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:58:59 +0100 Subject: [PATCH 3/3] FISH-9193 primitive unboxing --- .../java/org/glassfish/admin/rest/readers/InputObject.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/InputObject.java b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/InputObject.java index 1d6b13cf98b..e8bc6cdb9ef 100644 --- a/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/InputObject.java +++ b/nucleus/admin/rest/rest-service/src/main/java/org/glassfish/admin/rest/readers/InputObject.java @@ -37,7 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ -// Portions Copyright [2019] Payara Foundation and/or affiliates +// Portions Copyright [2024] Payara Foundation and/or affiliates package org.glassfish.admin.rest.readers; @@ -112,7 +112,7 @@ public double getDouble(String key) throws InputException { try { return o instanceof Number ? ((Number)o).doubleValue() : - Double.valueOf((String) o); + Double.parseDouble((String) o); } catch (Exception e) { throw new InputException("InputObject[" + quote(key) + "] is not a number.");