Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

import java.lang.reflect.InvocationTargetException;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -461,8 +463,8 @@ protected ListResponse<VmMetricsStatsResponse> createVmMetricsStatsResponse(List
* @return the set of responses that was created.
*/
protected List<StatsResponse> createStatsResponse(List<VmStatsVO> vmStatsList) {
List<StatsResponse> statsResponseList = new ArrayList<StatsResponse>();
DecimalFormat decimalFormat = new DecimalFormat("#.##");
List<StatsResponse> statsResponseList = new ArrayList<>();
DecimalFormat decimalFormat = new DecimalFormat("#.##", DecimalFormatSymbols.getInstance(Locale.ENGLISH));
Copy link

Copilot AI Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting the DecimalFormat instantiation into a private static final constant, since the pattern and locale are constant. This reduces object creation overhead on each method call.

Suggested change
DecimalFormat decimalFormat = new DecimalFormat("#.##", DecimalFormatSymbols.getInstance(Locale.ENGLISH));
DecimalFormat decimalFormat = DECIMAL_FORMAT.get();

Copilot uses AI. Check for mistakes.
for (VmStatsVO vmStats : vmStatsList) {
StatsResponse response = new StatsResponse();
response.setTimestamp(vmStats.getTimestamp());
Expand Down