Skip to content
Permalink
Browse files

Enable checkstyle and fix errors it calls out

Updated checkstyle to use the latest version.  Enabled it in the
build process, and fixed a lot of problems that it found.  Note that
some checkstyle rules are currently disabled because there are too
many violations to fix right now.  I hope to address these in the
future, but the set of changes here are good.
  • Loading branch information...
dirmgr committed Mar 31, 2019
1 parent 9e9f417 commit b2a384beb8c794e6002eb54e9920f8bc23d72026
Showing with 2,478 additions and 1,945 deletions.
  1. +1 −0 .gitignore
  2. +19 −7 build.xml
  3. BIN ext/checkstyle/checkstyle-8.18-all.jar
  4. BIN ext/checkstyle/checkstyle-all-4.1.jar
  5. +191 −30 ext/checkstyle/slamd-checkstyle.xml
  6. +11 −1 src/com/slamd/admin/AdminAccess.java
  7. +1 −1 src/com/slamd/admin/AdminConfig.java
  8. +11 −2 src/com/slamd/admin/AdminDebug.java
  9. +10 −0 src/com/slamd/admin/AdminJob.java
  10. +11 −1 src/com/slamd/admin/AdminJobGroup.java
  11. +10 −0 src/com/slamd/admin/AdminOptimizingJob.java
  12. +11 −1 src/com/slamd/admin/AdminUI.java
  13. +3 −3 src/com/slamd/client/ClientMessageWriter.java
  14. +1 −1 src/com/slamd/client/ClientShutdownListener.java
  15. +10 −0 src/com/slamd/common/Constants.java
  16. +14 −4 src/com/slamd/common/DurationParser.java
  17. +1 −1 src/com/slamd/common/RateLimiter.java
  18. +2 −2 src/com/slamd/db/SLAMDDB.java
  19. +2 −2 src/com/slamd/dslogplay/DeleteOperation.java
  20. +7 −7 src/com/slamd/job/JobClass.java
  21. +3 −3 src/com/slamd/job/JobItem.java
  22. +6 −6 src/com/slamd/job/OptimizationAlgorithm.java
  23. +2 −1 src/com/slamd/job/OptimizingJob.java
  24. +4 −3 src/com/slamd/job/SingleStatisticWithConstraintOptimizationAlgorithm.java
  25. +2 −1 src/com/slamd/job/SingleStatisticWithReplicationLatencyOptimizationAlgorithm.java
  26. +4 −4 src/com/slamd/jobgroup/JobGroupItem.java
  27. +11 −14 src/com/slamd/jobgroup/JobGroupOptimizingJob.java
  28. +4 −4 src/com/slamd/jobs/ldap/AddAndDeleteRateJob.java
  29. +4 −4 src/com/slamd/jobs/ldap/AsynchronousModifyRateJob.java
  30. +14 −0 src/com/slamd/jobs/ldap/AsynchronousModifyRateListener.java
  31. +4 −4 src/com/slamd/jobs/ldap/AsynchronousSearchRateJob.java
  32. +14 −0 src/com/slamd/jobs/ldap/AsynchronousSearchRateListener.java
  33. +1 −1 src/com/slamd/jobs/ldap/BasicSearchAndBindRateJob.java
  34. +4 −4 src/com/slamd/jobs/ldap/CompareRateJob.java
  35. +2 −1 src/com/slamd/jobs/ldap/ComprehensiveBindRateJob.java
  36. +13 −10 src/com/slamd/jobs/ldap/ComprehensiveModifyRateJob.java
  37. +3 −2 src/com/slamd/jobs/ldap/ComprehensiveSearchAndBindRateJob.java
  38. +2 −1 src/com/slamd/jobs/ldap/ComprehensiveSearchAndModifyRateJob.java
  39. +2 −1 src/com/slamd/jobs/ldap/ComprehensiveSearchRateJob.java
  40. +4 −4 src/com/slamd/jobs/ldap/FileBasedModifyRateJob.java
  41. +4 −4 src/com/slamd/jobs/ldap/FileBasedSearchRateJob.java
  42. +4 −4 src/com/slamd/jobs/ldap/LDAPJob.java
  43. +6 −5 src/com/slamd/jobs/ldap/MixedLoadJob.java
  44. +4 −4 src/com/slamd/jobs/ldap/ModifyDNRateJob.java
  45. +4 −4 src/com/slamd/jobs/ldap/MultiConnectionSearchRateJob.java
  46. +4 −4 src/com/slamd/jobs/ldap/WaitForDirectoryServerJob.java
  47. +4 −4 src/com/slamd/jobs/legacy/AuthRateJob.java
  48. +4 −4 src/com/slamd/jobs/legacy/ModifyRateJob.java
  49. +4 −4 src/com/slamd/jobs/legacy/SearchAndModifyRateJob.java
  50. +4 −4 src/com/slamd/jobs/legacy/SearchRateJob.java
  51. +10 −0 src/com/slamd/protocol/ProtocolConstants.java
  52. +3 −5 src/com/slamd/protocol/SLAMDMessage.java
  53. +7 −7 src/com/slamd/report/ReportGenerator.java
  54. +1 −2 src/com/slamd/resourcemonitor/LDAPMonitoredEntry.java
  55. +6 −0 src/com/slamd/resourcemonitor/LDAPResourceMonitor.java
  56. +9 −4 src/com/slamd/resourcemonitor/NetStatResourceMonitor.java
  57. +0 −2 src/com/slamd/resourcemonitor/SunONEDirectoryServerResourceMonitor.java
  58. +9 −2 src/com/slamd/resourcemonitor/ZFSPoolResourceMonitor.java
  59. +1 −0 src/com/slamd/resourcemonitor/netstat/AIXNetStatCollector.java
  60. +3 −0 src/com/slamd/resourcemonitor/netstat/AggregateInterfaceStatistics.java
  61. +1 −0 src/com/slamd/resourcemonitor/netstat/HPUXNetStatCollector.java
  62. +3 −3 src/com/slamd/resourcemonitor/netstat/InterfaceStatistics.java
  63. +1 −0 src/com/slamd/resourcemonitor/netstat/LinuxNetStatCollector.java
  64. +3 −0 src/com/slamd/resourcemonitor/netstat/SingleInterfaceStatistics.java
  65. +1 −0 src/com/slamd/resourcemonitor/netstat/SolarisNetStatCollector.java
  66. +1 −0 src/com/slamd/resourcemonitor/netstat/WindowsNetStatCollector.java
  67. +5 −5 src/com/slamd/scripting/engine/Argument.java
  68. +1 −1 src/com/slamd/scripting/engine/BreakException.java
  69. +1 −1 src/com/slamd/scripting/engine/ContinueException.java
  70. +1 −1 src/com/slamd/scripting/general/RateLimiterVariable.java
  71. +650 −603 src/com/slamd/scripting/tftp/TFTPClientVariable.java
  72. +0 −1 src/com/slamd/server/ClientConnection.java
  73. +14 −8 src/com/slamd/server/ClientManagerListener.java
  74. +6 −6 src/com/slamd/server/ConfigSubscriber.java
  75. +0 −1 src/com/slamd/server/ResourceMonitorClientConnection.java
  76. +2 −1 src/com/slamd/server/Scheduler.java
  77. +0 −1 src/com/slamd/server/StatClientConnection.java
  78. +1 −1 src/com/slamd/stat/PersistentStatViewer.java
  79. +11 −1 src/com/slamd/stat/StatEncoder.java
  80. +30 −6 src/com/slamd/stat/StatGrapher.java
  81. +44 −44 src/com/slamd/stat/StatTracker.java
  82. +1,126 −1,061 src/com/slamd/tftp/TFTPClient.java
  83. +11 −1 src/com/slamd/tools/CreateEgg.java
  84. +11 −1 src/com/slamd/tools/DBDump.java
  85. +11 −1 src/com/slamd/tools/FindJavaHome.java
  86. +11 −1 src/com/slamd/tools/tcpreplay/TCPCapture.java
  87. +11 −1 src/com/slamd/tools/tcpreplay/TCPReplay.java
  88. +11 −1 src/com/slamd/tools/udpping/UDPPingServer.java
@@ -1,4 +1,5 @@
build
src/com/slamd/common/DynamicConstants.java
.checkstyle-cache-main
.idea
*.iml
@@ -110,7 +110,7 @@ package com.slamd.common;
* This file has been dynamically generated as part of the SLAMD build
* process. Do not edit it directly.
*/
public class DynamicConstants
public final class DynamicConstants
{
/**
* Indicates whether this is an official build.
@@ -158,6 +158,16 @@ public class DynamicConstants
* The version qualifier string for this SLAMD build.
*/
public static final String VERSION_QUALIFIER = "${VERSION_QUALIFIER}";



/**
* Prevent this utility class from being instantiated.
*/
private DynamicConstants()
{
// No implementation required.
}
}
</echo>
</target>
@@ -335,7 +345,8 @@ public class DynamicConstants


<!-- Package the SLAMD Server into a ZIP file -->
<target name="package" depends="clean,init,build,create-package-dir"
<target name="package"
depends="clean,init,build,checkstyle,create-package-dir"
description="Package the SLAMD Server for distribution">
<echo message="Packaging SLAMD...." />

@@ -422,12 +433,13 @@ public class DynamicConstants
<!-- Perform Basic Code Style Checks -->
<target name="checkstyle" description="Perform basic code style checks">
<echo message="Checking source code style characteristics...." />
<taskdef resource="checkstyletask.properties"
classpath="${checkstyle.dir}/checkstyle-all-4.1.jar" />

<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
classpath="${checkstyle.dir}/checkstyle-8.18-all.jar"/>
<checkstyle config="${checkstyle.dir}/slamd-checkstyle.xml"
failOnViolation="true">
<fileset dir="${source.dir}" includes="**/*.java" />
classpath="${classes.dir}" failOnViolation="true">
<fileset dir="${source.dir}" includes="**/*.java"
excludes="**/Version.java" />
<formatter type="plain" />
</checkstyle>
</target>

Binary file not shown.
Binary file not shown.
@@ -3,61 +3,222 @@
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<!--
! Sun Public License
!
! The contents of this file are subject to the Sun Public License Version
! 1.0 (the "License"). You may not use this file except in compliance with
! the License. A copy of the License is available at http://www.sun.com/
!
! The Original Code is the SLAMD Distributed Load Generation Engine.
! The Initial Developer of the Original Code is Neil A. Wilson.
! Portions created by Neil A. Wilson are Copyright (C) 2004-2019.
! Some preexisting portions Copyright (C) 2002-2006 Sun Microsystems, Inc.
! All Rights Reserved.
!
! Contributor(s): Neil A. Wilson
! -->

<module name="Checker">
<module name="TreeWalker">
<!-- Ensure that each source file starts with the appropriate header -->
<module name="Header">
<property name="headerFile"
value="ext/checkstyle/sun-public-license.header" />
</module>
<property name="cacheFile" value=".checkstyle-cache-main" />


<!-- Ensure that all classes and interfaces are documented -->
<module name="JavadocType">
<property name="scope" value="private" />
</module>
<!-- Make sure that all source files have an appropriate header -->
<module name="Header">
<property name="headerFile"
value="ext/checkstyle/sun-public-license.header" />
</module>


<!-- Ensure that there is always a newline at the end of each file. -->
<module name="NewlineAtEndOfFile" />

<!-- Ensure that all methods are documented -->

<module name="TreeWalker">
<!-- Ensure that all methods have Javadoc documentation. -->
<!--
<module name="JavadocMethod">
<property name="scope" value="private" />
<property name="allowUndeclaredRTE" value="false" />
<property name="allowMissingParamTags" value="false" />
<property name="allowMissingJavadoc" value="false" />
<property name="scope" value="private" />
<property name="allowUndeclaredRTE" value="false" />
<property name="allowMissingParamTags" value="false" />
<property name="allowMissingThrowsTags" value="false" />
<property name="allowMissingReturnTag" value="false" />
<property name="allowMissingJavadoc" value="false" />
<property name="allowMissingPropertyJavadoc" value="false" />
<property name="suppressLoadErrors" value="true" />
</module>
-->


<!-- Ensure that all public and protected fields are documented -->
<!-- Ensure that all non-private variables have Javadoc documentation. -->
<!--
<module name="JavadocVariable">
<property name="scope" value="protected" />
<property name="scope" value="package" />
</module>
-->


<!-- Ensure that all Javadoc comments are well-formed -->
<!-- Ensure that all Javadoc comments are well-formed. -->
<!--
<module name="JavadocStyle">
<property name="scope" value="private" />
<property name="checkFirstSentence" value="true" />
<property name="checkEmptyJavadoc" value="true" />
<property name="checkHtml" value="true" />
<property name="scope" value="private" />
<property name="checkFirstSentence" value="true" />
<property name="checkEmptyJavadoc" value="false" />
<property name="checkHtml" value="true" />
</module>
-->


<!-- Ensure that no line exceeds 80 characters in length -->
<!-- Ensure that there are no star imports. -->
<module name="AvoidStarImport">
<property name="allowStaticMemberImports" value="true" />
</module>

<!-- Ensure that there are no imports from a "sun.*" package. -->
<module name="IllegalImport">
<property name="illegalPkgs" value="sun" />
</module>


<!-- Ensure that there are no redundant imports. -->
<module name="RedundantImport" />


<!-- Ensure that there are no unused imports. -->
<module name="UnusedImports" />


<!-- Ensure that there are no lines longer than 80 characters. -->
<module name="LineLength">
<property name="max" value="80" />
</module>


<!-- Ensure that no tab characters are used -->
<module name="TabCharacter" />
<!-- Ensure that modifiers are provided in the correct order. -->
<module name="ModifierOrder" />


<!-- Check to ensure there are no redundant modifiers. -->
<module name="RedundantModifier" />

<!-- Ensure that no line ends with whitespace -->
<module name="GenericIllegalRegexp">
<property name="format" value="\s$" />
<property name="message" value="Line ends with whitespace." />

<!-- Check to ensure that all code blocks include curly braces. -->
<module name="NeedBraces" />


<!-- Ensure that any class containing an equals method includes an
equals(Object) method. -->
<module name="CovariantEquals" />


<!-- Ensure that there are no empty statements in the code. -->
<module name="EmptyStatement" />


<!-- Ensure that any class containing an equals method also includes a
hashCode method. -->
<module name="EqualsHashCode" />


<!-- Ensure that local variables do not hide class variables. -->
<!--
<module name="HiddenField">
<property name="tokens" value="VARIABLE_DEF" />
</module>
-->


<!-- Ensure that utility classes do not have a public constructor. -->
<module name="HideUtilityClassConstructor" />


<!-- Ensure that checks for boolean values are simple where possible. -->
<module name="SimplifyBooleanExpression" />


<!-- Ensure that boolean returns are simple where possible. -->
<module name="SimplifyBooleanReturn" />


<!-- Ensure that string literal equality doesn't use "==". -->
<module name="StringLiteralEquality" />


<!-- Ensure that an overriding clone method invokes super.clone. -->
<!--
<module name="SuperClone" />
-->


<!-- Ensure that an overriding finalize method invokes super.finalize. -->
<module name="SuperFinalize" />


<!-- Ensure that all classes have a package declaration. -->
<module name="PackageDeclaration" />


<!-- Ensure that all package annotations are in package-info.java. -->
<module name="PackageAnnotation" />


<!-- Ensure that any switch statement that has a default clause always has
the default clause after all other clauses. -->
<module name="DefaultComesLast" />


<!-- Ensure that all cases of a switch statement that have any code also
have a break, return, or throw and don't fall through to the next
case. -->
<module name="FallThrough" />


<!-- Ensure that all local fields are declared private unless they are
static final. -->
<!--
<module name="VisibilityModifier" />
-->


<!-- Ensure that classes with only private constructors are final. -->
<module name="FinalClass" />


<!-- Ensure that all parameters are final. -->
<!--
<module name="FinalParameters">
<property name="ignorePrimitiveTypes" value="false" />
<property name="tokens"
value="METHOD_DEF,CTOR_DEF,LITERAL_CATCH,FOR_EACH_CLAUSE" />
</module>
-->


<!-- Ensure that all local variables that can be final are final. -->
<!--
<module name="FinalLocalVariable" />
-->


<!-- Ensure that all exceptions are immutable. -->
<module name="MutableException" />

<!-- Ensure that all long constants are followed by a capital L. -->
<module name="UpperEll" />


<!-- Ensure that all method/constructor/catch parameters are final. -->
<!--
<module name="FinalParameters" />
-->


<!-- Ensure that the @Override annotation is used where appropriate. -->
<module name="MissingOverride" />


<!-- Ensure that the @Deprecated annotation and @deprecated javadoc tag are
always used together. -->
<module name="MissingDeprecated" />
</module>
</module>

@@ -29,8 +29,18 @@
* This class provides a set of methods for providing access control for the
* administrative user interface.
*/
public class AdminAccess
public final class AdminAccess
{
/**
* Prevent this utility class from being instantiated.
*/
private AdminAccess()
{
// No implementation required.
}



/**
* Retrieves the access manager associated with this admin servlet.
*
@@ -55,7 +55,7 @@
* This class provides a set of methods for providing the interface to the
* SLAMD server configuration.
*/
public class AdminConfig
public final class AdminConfig
implements ConfigSubscriber
{
static AdminConfig ADMIN_CONFIG = new AdminConfig();
@@ -17,7 +17,6 @@



import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
@@ -39,8 +38,18 @@
* This class provides a set of methods for providing debug access to the
* administrative interface.
*/
public class AdminDebug
public final class AdminDebug
{
/**
* Prevent this utility class from being instantiated.
*/
private AdminDebug()
{
// No implementation required.
}



/**
* Handles the work of generating debug information about all thread groups
* and threads defined in the JVM.
@@ -81,6 +81,16 @@
*/
public final class AdminJob
{
/**
* Prevent this utility class from being instantiated.
*/
private AdminJob()
{
// No implementation required.
}



/**
* Handle all processing related to viewing summary for information for a set
* of jobs in a particular category (pending, running, or completed), or for
Oops, something went wrong.

0 comments on commit b2a384b

Please sign in to comment.
You can’t perform that action at this time.