mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Codacy fixes
This commit is contained in:
parent
d606c99305
commit
8495e6e204
@ -603,7 +603,7 @@ public final class EnterpriseHealthMonitor implements PropertyChangeListener {
|
||||
* and enable/disable as needed.
|
||||
* @throws HealthMonitorException
|
||||
*/
|
||||
final synchronized void updateFromGlobalEnabledStatus() throws HealthMonitorException {
|
||||
synchronized void updateFromGlobalEnabledStatus() throws HealthMonitorException {
|
||||
|
||||
boolean previouslyEnabled = monitorIsEnabled();
|
||||
|
||||
@ -645,10 +645,8 @@ public final class EnterpriseHealthMonitor implements PropertyChangeListener {
|
||||
}
|
||||
|
||||
boolean currentlyEnabled = getGlobalEnabledStatusFromDB();
|
||||
if( currentlyEnabled == previouslyEnabled) {
|
||||
// Nothing needs to be done
|
||||
} else {
|
||||
if(currentlyEnabled == false) {
|
||||
if( currentlyEnabled != previouslyEnabled) {
|
||||
if( ! currentlyEnabled ) {
|
||||
isEnabled.set(false);
|
||||
deactivateMonitorLocally();
|
||||
} else {
|
||||
@ -845,7 +843,7 @@ public final class EnterpriseHealthMonitor implements PropertyChangeListener {
|
||||
* It will delete all current timing data and replace it with randomly generated values.
|
||||
* If there is more than one node, the second node's times will trend upwards.
|
||||
*/
|
||||
final void populateDatabaseWithSampleData(int nDays, int nNodes, boolean createVerificationData) throws HealthMonitorException {
|
||||
void populateDatabaseWithSampleData(int nDays, int nNodes, boolean createVerificationData) throws HealthMonitorException {
|
||||
|
||||
if(! isEnabled.get()) {
|
||||
throw new HealthMonitorException("Can't populate database - monitor not enabled");
|
||||
@ -900,6 +898,7 @@ public final class EnterpriseHealthMonitor implements PropertyChangeListener {
|
||||
break;
|
||||
default:
|
||||
minIndexTimeNanos = baseIndex * 1000 * 1000;
|
||||
break;
|
||||
}
|
||||
|
||||
long maxIndexTimeOverMin = minIndexTimeNanos * 3;
|
||||
@ -1169,12 +1168,12 @@ public final class EnterpriseHealthMonitor implements PropertyChangeListener {
|
||||
* All times will be in milliseconds.
|
||||
*/
|
||||
static class DatabaseTimingResult {
|
||||
private long timestamp; // Time the metric was recorded
|
||||
private String hostname; // Host that recorded the metric
|
||||
private long count; // Number of metrics collected
|
||||
private double average; // Average of the durations collected (milliseconds)
|
||||
private double max; // Maximum value found (milliseconds)
|
||||
private double min; // Minimum value found (milliseconds)
|
||||
private final long timestamp; // Time the metric was recorded
|
||||
private final String hostname; // Host that recorded the metric
|
||||
private final long count; // Number of metrics collected
|
||||
private final double average; // Average of the durations collected (milliseconds)
|
||||
private final double max; // Maximum value found (milliseconds)
|
||||
private final double min; // Minimum value found (milliseconds)
|
||||
|
||||
DatabaseTimingResult(ResultSet resultSet) throws SQLException {
|
||||
this.timestamp = resultSet.getLong("timestamp");
|
||||
|
@ -48,19 +48,19 @@ class TimingMetricGraphPanel extends JPanel {
|
||||
|
||||
private final static Logger logger = Logger.getLogger(TimingMetricGraphPanel.class.getName());
|
||||
|
||||
private int padding = 25;
|
||||
private int labelPadding = 25;
|
||||
private Color lineColor = new Color(0x12, 0x20, 0xdb, 180);
|
||||
private Color gridColor = new Color(200, 200, 200, 200);
|
||||
private Color trendLineColor = new Color(150, 10, 10, 200);
|
||||
private final int padding = 25;
|
||||
private final int labelPadding = 25;
|
||||
private final Color lineColor = new Color(0x12, 0x20, 0xdb, 180);
|
||||
private final Color gridColor = new Color(200, 200, 200, 200);
|
||||
private final Color trendLineColor = new Color(150, 10, 10, 200);
|
||||
private static final Stroke GRAPH_STROKE = new BasicStroke(2f);
|
||||
private static final Stroke NARROW_STROKE = new BasicStroke(1f);
|
||||
private int pointWidth = 4;
|
||||
private int numberYDivisions = 10;
|
||||
private final int pointWidth = 4;
|
||||
private final int numberYDivisions = 10;
|
||||
private List<DatabaseTimingResult> timingResults;
|
||||
private TimingMetricType timingMetricType;
|
||||
private String metricName;
|
||||
private boolean doLineGraph;
|
||||
private final TimingMetricType timingMetricType;
|
||||
private final String metricName;
|
||||
private final boolean doLineGraph;
|
||||
private String yUnitString;
|
||||
private TrendLine trendLine;
|
||||
private final long MILLISECONDS_PER_DAY = 1000 * 60 * 60 * 24;
|
||||
@ -264,7 +264,7 @@ class TimingMetricGraphPanel extends JPanel {
|
||||
int y0 = getHeight() - ((i * graphHeight) / numberYDivisions + bottomGraphPadding);
|
||||
int y1 = y0;
|
||||
|
||||
if (timingResults.size() > 0) {
|
||||
if ( ! timingResults.isEmpty()) {
|
||||
// Draw the grid line
|
||||
g2.setColor(gridColor);
|
||||
g2.drawLine(leftGraphPadding + 1 + pointWidth, y0, getWidth() - rightGraphPadding, y1);
|
||||
@ -272,7 +272,7 @@ class TimingMetricGraphPanel extends JPanel {
|
||||
// Create the label
|
||||
g2.setColor(Color.BLACK);
|
||||
double yValue = minValueOnYAxis + ((maxValueOnYAxis - minValueOnYAxis) * ((i * 1.0) / numberYDivisions));
|
||||
String yLabel = ((int) (yValue * 100 * yLabelScale)) / 100.0 + "";
|
||||
String yLabel = Double.toString(((int) (yValue * 100 * yLabelScale)) / 100.0);
|
||||
FontMetrics fontMetrics = g2.getFontMetrics();
|
||||
labelWidth = fontMetrics.stringWidth(yLabel);
|
||||
g2.drawString(yLabel, x0 - labelWidth - 5, y0 + (fontMetrics.getHeight() / 2) - 3);
|
||||
|
Loading…
x
Reference in New Issue
Block a user