Skip to content

Commit

Permalink
Sonarcloud updates (#74)
Browse files Browse the repository at this point in the history
* Sonarcloud updates

* further sonarcloud updates

* further sonarcloud updates
  • Loading branch information
tmiddlet2666 committed Oct 11, 2023
1 parent 79964c4 commit 75be8ac
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,60 +468,57 @@ public List<Entry<Object, Data>> getData(RequestSender requestSender, Class<?> c

// if we have not yet evaluated if the reporter is available, e.g. value of null,
// then do it. Also check for the version as well.
if (isReporterAvailable() == null || is1213AndAbove() == null)
if ((isReporterAvailable() == null || is1213AndAbove() == null) && clusterData != null)
{
// get the Coherence version. Easier to do if we are connected to a cluster,
// but we have JMX connection as we have to look in data we collected.

if (clusterData != null)
for (Entry<Object, Data> entry : clusterData)
{
for (Entry<Object, Data> entry : clusterData)
// there will only be one cluster entry

String sCoherenceVersion =
entry.getValue().getColumn(ClusterData.VERSION).toString().replaceFirst(" .*$", "")
.replaceFirst("[\\.-]SNAPSHOT.*$","").replaceAll("-",".");
m_sClusterVersion = sCoherenceVersion;

int nVersion = 0;

if (sCoherenceVersion.startsWith("3.5"))
{
// manual check as version numbering changed after 35
nVersion = 353;
}
else if (sCoherenceVersion.startsWith("2"))
{
// check for versions such as 20.06 or 20.06.01 and convert them to an ever-increasing number
// 20.06 -> 2006000
// 20.06.1 -> 2006100
// 20.06.10 -> 2006100
String sStrippedVersion = sCoherenceVersion.replaceAll("\\.", "");
nVersion = Integer.parseInt(sStrippedVersion) * (int) Math.pow(10, 7 - (double) sStrippedVersion.length());
}
else
{
nVersion = Integer.parseInt(sCoherenceVersion.replaceAll("\\.", ""));
}

LOGGER.log(Level.INFO, "Raw Coherence version identified as {0}", m_sClusterVersion);
LOGGER.log(Level.INFO, "Numeric Coherence version identified as {0}", String.format("%d", nVersion));

if (nVersion >= 121300)
{
// only set if the reporter available is it is not already set as we may have
// got to this code path because is1213AndAbove() is still null
setReporterAvailable(isReporterAvailable() == null || isReporterAvailable());
m_fis1213AndAbove = true;
}
else
{
// there will only be one cluster entry

String sCoherenceVersion =
entry.getValue().getColumn(ClusterData.VERSION).toString().replaceFirst(" .*$", "")
.replaceFirst("[\\.-]SNAPSHOT.*$","").replaceAll("-",".");
m_sClusterVersion = sCoherenceVersion;

int nVersion = 0;

if (sCoherenceVersion.startsWith("3.5"))
{
// manual check as version numbering changed after 35
nVersion = 353;
}
else if (sCoherenceVersion.startsWith("2"))
{
// check for versions such as 20.06 or 20.06.01 and convert them to an ever-increasing number
// 20.06 -> 2006000
// 20.06.1 -> 2006100
// 20.06.10 -> 2006100
String sStrippedVersion = sCoherenceVersion.replaceAll("\\.", "");
nVersion = Integer.parseInt(sStrippedVersion) * (int) Math.pow(10, 7 - (double) sStrippedVersion.length());
}
else
{
nVersion = Integer.parseInt(sCoherenceVersion.replaceAll("\\.", ""));
}

LOGGER.log(Level.INFO, "Raw Coherence version identified as {0}", m_sClusterVersion);
LOGGER.log(Level.INFO, "Numeric Coherence version identified as {0}", String.format("%d", nVersion));

if (nVersion >= 121300)
{
// only set if the reporter available is it is not already set as we may have
// got to this code path because is1213AndAbove() is still null
setReporterAvailable(isReporterAvailable() == null || isReporterAvailable());
m_fis1213AndAbove = true;
}
else
{
setReporterAvailable(isReporterAvailable() != null && isReporterAvailable());
m_fis1213AndAbove = false;
}
m_nClusterVersion = nVersion;
setReporterAvailable(isReporterAvailable() != null && isReporterAvailable());
m_fis1213AndAbove = false;
}
m_nClusterVersion = nVersion;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -75,5 +75,5 @@ public static void unregister()
/**
* The static singleton instance of {@link CoherenceClusterDataSourceDescriptorProvider}.
*/
final private static CoherenceClusterDataSourceDescriptorProvider INSTANCE = new CoherenceClusterDataSourceDescriptorProvider();
private final static CoherenceClusterDataSourceDescriptorProvider INSTANCE = new CoherenceClusterDataSourceDescriptorProvider();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -80,5 +80,5 @@ public static void unregister()
/**
* The singleton instance of {@link CoherenceClusterDataSourceViewProvider}.
*/
final protected static CoherenceClusterDataSourceViewProvider INSTANCE = new CoherenceClusterDataSourceViewProvider();
protected final static CoherenceClusterDataSourceViewProvider INSTANCE = new CoherenceClusterDataSourceViewProvider();
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected boolean isEnabled(Host host) {
@Override
protected void updateState(Set<Host> selectedHosts)
{
if (tracksSelection)
if (m_fTracksSelection)
{
super.updateState(selectedHosts);
}
Expand All @@ -187,7 +187,7 @@ public static synchronized DiscoverCoherenceClusterAction selectionAware()
if (selectionAware == null)
{
selectionAware = new DiscoverCoherenceClusterAction();
selectionAware.tracksSelection = true;
selectionAware.m_fTracksSelection = true;
}
return selectionAware;
}
Expand All @@ -208,5 +208,5 @@ public static synchronized DiscoverCoherenceClusterAction selectionAware()

private static DiscoverCoherenceClusterAction alwaysEnabled;
private static DiscoverCoherenceClusterAction selectionAware;
private boolean tracksSelection = false;
private boolean m_fTracksSelection = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public static void addValuesToCompletedTasksGraph(SimpleXYChartSupport graph, lo
*/
public static void addValuesToTotalProxyConnectionsGraph(SimpleXYChartSupport graph, int cTotalConnections)
{
graph.addValues(System.currentTimeMillis(), new long[] {(long) cTotalConnections});
graph.addValues(System.currentTimeMillis(), new long[] {cTotalConnections});
}

/**
Expand Down
Loading

0 comments on commit 75be8ac

Please sign in to comment.