Updated PMD rules.
This commit is contained in:
parent
c3adfb1f07
commit
b967f13230
4 changed files with 90 additions and 245 deletions
35
build.gradle
35
build.gradle
|
@ -34,6 +34,7 @@ mainClassName = 'net.thauvin.erik.httpstatus.Reasons'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
versions = [
|
versions = [
|
||||||
|
pmd: '6.35.0',
|
||||||
spotbugs: '4.2.3'
|
spotbugs: '4.2.3'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -92,8 +93,8 @@ clean {
|
||||||
|
|
||||||
test {
|
test {
|
||||||
testLogging {
|
testLogging {
|
||||||
exceptionFormat "full"
|
exceptionFormat = "full"
|
||||||
events "passed", "skipped", "failed"
|
events("passed", "skipped", "failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
useTestNG()
|
useTestNG()
|
||||||
|
@ -105,6 +106,7 @@ spotbugs {
|
||||||
}
|
}
|
||||||
|
|
||||||
pmd {
|
pmd {
|
||||||
|
toolVersion = versions.pmd
|
||||||
ignoreFailures = true
|
ignoreFailures = true
|
||||||
ruleSets = []
|
ruleSets = []
|
||||||
ruleSetFiles = files("${projectDir}/config/pmd.xml")
|
ruleSetFiles = files("${projectDir}/config/pmd.xml")
|
||||||
|
@ -121,9 +123,9 @@ tasks.withType(Checkstyle) {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
from components.java
|
from(components.java)
|
||||||
groupId project.group
|
groupId = project.group
|
||||||
artifactId rootProject.name
|
artifactId = rootProject.name
|
||||||
|
|
||||||
pom {
|
pom {
|
||||||
name = mavenName
|
name = mavenName
|
||||||
|
@ -171,19 +173,18 @@ signing {
|
||||||
|
|
||||||
task copyToDeploy(type: Copy) {
|
task copyToDeploy(type: Copy) {
|
||||||
from(configurations.runtimeClasspath) {
|
from(configurations.runtimeClasspath) {
|
||||||
exclude 'javax.servlet-api-*.jar'
|
exclude('javax.servlet-api-*.jar', 'jsp-api-*.jar')
|
||||||
exclude 'jsp-api-*.jar'
|
|
||||||
}
|
}
|
||||||
from jar
|
from(jar)
|
||||||
into deployDir
|
into(deployDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
task deploy(dependsOn: ['clean', 'build', 'copyToDeploy']) {
|
task deploy(dependsOn: ['clean', 'build', 'copyToDeploy']) {
|
||||||
description = "Copies all needed files to the ${deployDir} directory."
|
description = "Copies all needed files to the ${deployDir} directory."
|
||||||
group = 'Publishing'
|
group = 'Publishing'
|
||||||
outputs.dir deployDir
|
outputs.dir(deployDir)
|
||||||
inputs.files copyToDeploy
|
inputs.files(copyToDeploy)
|
||||||
mustRunAfter clean
|
mustRunAfter(clean)
|
||||||
}
|
}
|
||||||
|
|
||||||
task release(dependsOn: ['wrapper', 'deploy', 'pandoc', 'publishToMavenLocal']) {
|
task release(dependsOn: ['wrapper', 'deploy', 'pandoc', 'publishToMavenLocal']) {
|
||||||
|
@ -203,8 +204,8 @@ task pandoc(type: Exec) {
|
||||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
||||||
} else {
|
} else {
|
||||||
executable 'pandoc'
|
executable = 'pandoc'
|
||||||
args pandoc_args
|
args(pandoc_args)
|
||||||
}
|
}
|
||||||
standardOutput = new ByteArrayOutputStream()
|
standardOutput = new ByteArrayOutputStream()
|
||||||
ext.output = {
|
ext.output = {
|
||||||
|
@ -220,9 +221,9 @@ jacocoTestReport {
|
||||||
|
|
||||||
sonarqube {
|
sonarqube {
|
||||||
properties {
|
properties {
|
||||||
property "sonar.organization", "ethauvin-github"
|
property("sonar.organization", "ethauvin-github")
|
||||||
property "sonar.projectKey", "ethauvin_HttpStatus"
|
property("sonar.projectKey", "ethauvin_HttpStatus")
|
||||||
property "sonar.host.url", "https://sonarcloud.io"
|
property("sonar.host.url", "https://sonarcloud.io")
|
||||||
property("sonar.sourceEncoding", "UTF-8")
|
property("sonar.sourceEncoding", "UTF-8")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
286
config/pmd.xml
286
config/pmd.xml
|
@ -1,120 +1,82 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!--
|
|
||||||
~ pmd.xml
|
|
||||||
~
|
|
||||||
~ Copyright (c) 2010-2020, Erik C. Thauvin (erik@thauvin.net)
|
|
||||||
~ All rights reserved.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<ruleset name="erik"
|
<ruleset name="erik"
|
||||||
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
||||||
<description>Erik's Ruleset</description>
|
<description>Erik's Ruleset</description>
|
||||||
<!-- BEST PRACTICES -->
|
<!-- BEST PRACTICES -->
|
||||||
<!-- <rule ref="category/java/bestpractices.xml/AvoidStringBufferField"/>-->
|
<rule ref="category/java/bestpractices.xml">
|
||||||
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"/>
|
<exclude name="AvoidPrintStackTrace"/>
|
||||||
<rule ref="category/java/bestpractices.xml/CheckResultSet"/>
|
<exclude name="JUnit4TestShouldUseTestAnnotation"/>
|
||||||
<rule ref="category/java/bestpractices.xml/ConstantsInInterface"/>
|
<exclude name="JUnitTestContainsTooManyAsserts"/>
|
||||||
<rule ref="category/java/bestpractices.xml/DefaultLabelNotLastInSwitchStmt"/>
|
</rule>
|
||||||
<rule ref="category/java/bestpractices.xml/ForLoopCanBeForeach"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/GuardLogStatement"/>
|
|
||||||
<!-- <rule ref="category/java/bestpractices.xml/LooseCoupling"/> -->
|
|
||||||
<rule ref="category/java/bestpractices.xml/MethodReturnsInternalArray"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/MissingOverride">
|
<rule ref="category/java/bestpractices.xml/MissingOverride">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="violationSuppressXPath"
|
<property name="violationSuppressXPath"
|
||||||
value="./MethodDeclarator[@Image='hashCode' or @Image='equals' or @Image='toString']"/>
|
value="//MethodDeclaration[@Name='hashCode' or @Name='equals' or @Name='toString']"/>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="category/java/bestpractices.xml/PreserveStackTrace"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/ReplaceEnumerationWithIterator"/>
|
|
||||||
<!-- <rule ref="category/java/bestpractices.xml/ReplaceHashtableWithMap"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/ReplaceVectorWithList"/> -->
|
|
||||||
<rule ref="category/java/bestpractices.xml/SwitchStmtsShouldHaveDefault"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/SystemPrintln"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/UnusedFormalParameter"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/UnusedImports"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/UnusedLocalVariable"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/UnusedPrivateField"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/UnusedPrivateMethod"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/UseAssertEqualsInsteadOfAssertTrue"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/UseAssertNullInsteadOfAssertTrue"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/UseAssertSameInsteadOfAssertTrue"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/UseAssertTrueInsteadOfAssertEquals"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/UseCollectionIsEmpty"/>
|
|
||||||
<rule ref="category/java/bestpractices.xml/UseVarargs"/>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- NAMING CONVENTIONS -->
|
<!-- CODE STYLE -->
|
||||||
<rule ref="category/java/codestyle.xml/FormalParameterNamingConventions"/>
|
<rule ref="category/java/codestyle.xml">
|
||||||
<rule ref="category/java/codestyle.xml/GenericsNaming"/>
|
<exclude name="AtLeastOneConstructor"/>
|
||||||
<rule ref="category/java/codestyle.xml/LocalVariableNamingConventions"/>
|
<exclude name="ClassNamingConventions"/>
|
||||||
<rule ref="category/java/codestyle.xml/MethodNamingConventions"/>
|
<exclude name="ConfusingTernary"/>
|
||||||
<!-- <rule ref="category/java/codestyle.xml/PackageCase"/>-->
|
<exclude name="CommentDefaultAccessModifier"/>
|
||||||
|
<exclude name="DefaultPackage"/>
|
||||||
|
<exclude name="FieldNamingConventions"/>
|
||||||
<!-- OTHER -->
|
<exclude name="LongVariable"/>
|
||||||
<rule ref="category/java/codestyle.xml/AvoidDollarSigns"/>
|
<exclude name="OnlyOneReturn"/>
|
||||||
<rule ref="category/java/codestyle.xml/AvoidProtectedFieldInFinalClass"/>
|
<exclude name="PackageCase"/>
|
||||||
<rule ref="category/java/codestyle.xml/AvoidProtectedMethodInFinalClassNotExtending"/>
|
<exclude name="ShortClassName"/>
|
||||||
<rule ref="category/java/codestyle.xml/AvoidUsingNativeCode"/>
|
<exclude name="ShortMethodName"/>
|
||||||
<rule ref="category/java/codestyle.xml/BooleanGetMethodName"/>
|
<exclude name="ShortVariable"/>
|
||||||
<rule ref="category/java/codestyle.xml/CallSuperInConstructor"/>
|
<exclude name="UselessParentheses"/>
|
||||||
<rule ref="category/java/codestyle.xml/ControlStatementBraces"/>
|
<exclude name="UseUnderscoresInNumericLiterals"/>
|
||||||
<rule ref="category/java/codestyle.xml/DontImportJavaLang"/>
|
</rule>
|
||||||
<rule ref="category/java/codestyle.xml/DuplicateImports"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/EmptyMethodInAbstractClassShouldBeAbstract"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/ExtendsObject"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/FieldDeclarationsShouldBeAtStartOfClass"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/IdenticalCatchBranches"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/LocalVariableCouldBeFinal"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/MethodArgumentCouldBeFinal"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/NoPackage"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/PrematureDeclaration"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/TooManyStaticImports"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/UnnecessaryAnnotationValueElement"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/UnnecessaryConstructor"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/UnnecessaryLocalBeforeReturn"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/UnnecessaryReturn"/>
|
|
||||||
<rule ref="category/java/codestyle.xml/UselessQualifiedThis"/>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- DESIGN -->
|
<!-- DESIGN -->
|
||||||
<rule ref="category/java/design.xml/AbstractClassWithoutAnyMethod"/>
|
<rule ref="category/java/design.xml">
|
||||||
<rule ref="category/java/design.xml/AvoidRethrowingException"/>
|
<exclude name="AvoidCatchingGenericException"/>
|
||||||
<rule ref="category/java/design.xml/AvoidThrowingNewInstanceOfSameException"/>
|
<exclude name="AvoidDeeplyNestedIfStmts"/>
|
||||||
<rule ref="category/java/design.xml/AvoidThrowingNullPointerException"/>
|
<exclude name="AvoidUncheckedExceptionsInSignatures"/>
|
||||||
<rule ref="category/java/design.xml/AvoidThrowingRawExceptionTypes"/>
|
<exclude name="CognitiveComplexity"/>
|
||||||
<rule ref="category/java/design.xml/ClassWithOnlyPrivateConstructorsShouldBeFinal"/>
|
<exclude name="CyclomaticComplexity"/>
|
||||||
<rule ref="category/java/design.xml/CollapsibleIfStatements"/>
|
<exclude name="ExcessiveClassLength"/>
|
||||||
<rule ref="category/java/design.xml/CouplingBetweenObjects"/>
|
<exclude name="ExcessiveMethodLength"/>
|
||||||
<rule ref="category/java/design.xml/DataClass"/>
|
<exclude name="ExcessiveParameterList"/>
|
||||||
<rule ref="category/java/design.xml/DoNotExtendJavaLangError"/>
|
<exclude name="ExcessivePublicCount"/>
|
||||||
<rule ref="category/java/design.xml/ExceptionAsFlowControl"/>
|
<exclude name="GodClass"/>
|
||||||
<!-- <rule ref="category/java/design.xml/ExcessivePublicCount"/>-->
|
<exclude name="LawOfDemeter"/>
|
||||||
<rule ref="category/java/design.xml/FinalFieldCouldBeStatic"/>
|
<exclude name="LoosePackageCoupling"/>
|
||||||
<rule ref="category/java/design.xml/ImmutableField"/>
|
<exclude name="NPathComplexity"/>
|
||||||
<rule ref="category/java/design.xml/LogicInversion"/>
|
<exclude name="NcssCount"/>
|
||||||
<rule ref="category/java/design.xml/SignatureDeclareThrowsException"/>
|
<exclude name="TooManyFields"/>
|
||||||
<rule ref="category/java/design.xml/SimplifiedTernary"/>
|
<exclude name="TooManyMethods"/>
|
||||||
<rule ref="category/java/design.xml/SimplifyBooleanAssertion"/>
|
<exclude name="UseObjectForClearerAPI"/>
|
||||||
<rule ref="category/java/design.xml/SimplifyBooleanExpressions"/>
|
</rule>
|
||||||
<rule ref="category/java/design.xml/SimplifyBooleanReturns"/>
|
|
||||||
<rule ref="category/java/design.xml/SimplifyConditional"/>
|
|
||||||
<rule ref="category/java/design.xml/SingularField"/>
|
|
||||||
<rule ref="category/java/design.xml/SwitchDensity"/>
|
|
||||||
<rule ref="category/java/design.xml/UselessOverridingMethod"/>
|
|
||||||
<rule ref="category/java/design.xml/UseUtilityClass"/>
|
|
||||||
|
|
||||||
<!-- DOCUMENTATION -->
|
<!-- DOCUMENTATION -->
|
||||||
<rule ref="category/java/documentation.xml/UncommentedEmptyConstructor"/>
|
<rule ref="category/java/documentation.xml">
|
||||||
<rule ref="category/java/documentation.xml/UncommentedEmptyMethodBody"/>
|
<exclude name="CommentRequired"/>
|
||||||
|
<exclude name="CommentSize"/>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<!-- ERROR PRONE -->
|
<!-- ERROR PRONE -->
|
||||||
|
<rule ref="category/java/errorprone.xml">
|
||||||
|
<exclude name="AssignmentInOperand"/>
|
||||||
|
<exclude name="AvoidCatchingNPE"/>
|
||||||
|
<exclude name="AvoidDuplicateLiterals"/>
|
||||||
|
<exclude name="AvoidFieldNameMatchingMethodName"/>
|
||||||
|
<exclude name="AvoidFieldNameMatchingTypeName"/>
|
||||||
|
<exclude name="AvoidLiteralsInIfCondition"/>
|
||||||
|
<exclude name="BeanMembersShouldSerialize"/>
|
||||||
|
<exclude name="EmptyCatchBlock"/>
|
||||||
|
<exclude name="NullAssignment"/>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<rule ref="category/java/errorprone.xml/AssignmentInOperand">
|
<rule ref="category/java/errorprone.xml/AssignmentInOperand">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="allowWhile" value="true"/>
|
<property name="allowWhile" value="true"/>
|
||||||
|
@ -122,86 +84,11 @@
|
||||||
<property name="allowIf" value="true"/>
|
<property name="allowIf" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="category/java/errorprone.xml/AssignmentToNonFinalStatic"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidAccessibilityAlteration"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidAssertAsIdentifier"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidBranchingStatementAsLastInLoop"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidCallingFinalize"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidCatchingThrowable"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidDecimalLiteralsInBigDecimalConstructor"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals">
|
<rule ref="category/java/errorprone.xml/AvoidDuplicateLiterals">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="skipAnnotations" value="true"/>
|
<property name="skipAnnotations" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="category/java/errorprone.xml/AvoidEnumAsIdentifier"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidInstanceofChecksInCatchClause"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidLosingExceptionInformation"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidMultipleUnaryOperators"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/AvoidUsingOctalValues"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/BadComparison"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/BrokenNullCheck"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/CallSuperFirst"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/CallSuperLast"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/CheckSkipResult"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/CloneMethodMustBePublic"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/CloneMethodMustImplementCloneable"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/CloneMethodReturnTypeMustMatchClassName"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/CloneThrowsCloneNotSupportedException"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/CloseResource"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/CompareObjectsWithEquals"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/ConstructorCallsOverridableMethod"/>>
|
|
||||||
<rule ref="category/java/errorprone.xml/DoNotCallGarbageCollectionExplicitly"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/DoNotExtendJavaLangThrowable"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/DoNotHardCodeSDCard"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/DoNotThrowExceptionInFinally"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/DontImportSun"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/EqualsNull"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/FinalizeDoesNotCallSuperFinalize"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/FinalizeOnlyCallsSuperFinalize"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/FinalizeOverloaded"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/FinalizeShouldBeProtected"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/IdempotentOperations"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/ImportFromSamePackage"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/InstantiationToGetClass"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/InvalidLogMessageFormat"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/JumbledIncrementer"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/JUnitSpelling"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/JUnitStaticSuite"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/MethodWithSameNameAsEnclosingClass"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/MissingBreakInSwitch"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/MissingSerialVersionUID"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/MissingStaticMethodInNonInstantiatableClass"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/MoreThanOneLogger"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitchStatement"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/NonStaticInitializer"/>
|
|
||||||
<!-- <rule ref="category/java/errorprone.xml/NullAssignment"/>-->
|
|
||||||
<rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/ProperCloneImplementation"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/ProperLogger"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/ReturnEmptyArrayRatherThanNull"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/ReturnFromFinallyBlock"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/SimpleDateFormatNeedsLocale"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/SingleMethodSingleton"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/SingletonClassReturningNewInstance"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/StaticEJBFieldShouldBeFinal"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/StringBufferInstantiationWithChar"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/SuspiciousEqualsMethodName"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/SuspiciousHashcodeMethodName"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/SuspiciousOctalEscape"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/TestClassWithoutTestCases"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/UnconditionalIfStatement"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/UnnecessaryBooleanAssertion"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/UnnecessaryCaseChange"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/UnnecessaryConversionTemporary"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/UnusedNullCheckInEquals"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/UseCorrectExceptionLogging"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/UseEqualsToCompareStrings"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/UselessOperationOnImmutable"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/UseLocaleWithCaseConversions"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/EmptyCatchBlock">
|
<rule ref="category/java/errorprone.xml/EmptyCatchBlock">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="allowExceptionNameRegex">
|
<property name="allowExceptionNameRegex">
|
||||||
|
@ -209,59 +96,16 @@
|
||||||
</property>
|
</property>
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="category/java/errorprone.xml/EmptyFinalizer"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/EmptyFinallyBlock"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/EmptyIfStmt"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/EmptyInitializer"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/EmptyStatementBlock"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/EmptyStatementNotInLoop"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/EmptySwitchStatements"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/EmptySynchronizedBlock"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/EmptyTryBlock"/>
|
|
||||||
<rule ref="category/java/errorprone.xml/EmptyWhileStmt"/>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- MULTITHREADING -->
|
<!-- MULTITHREADING -->
|
||||||
<rule ref="category/java/multithreading.xml/AvoidSynchronizedAtMethodLevel"/>
|
<rule ref="category/java/multithreading.xml">
|
||||||
<rule ref="category/java/multithreading.xml/AvoidThreadGroup"/>
|
</rule>
|
||||||
<rule ref="category/java/multithreading.xml/AvoidUsingVolatile"/>
|
|
||||||
<rule ref="category/java/multithreading.xml/DontCallThreadRun"/>
|
|
||||||
<rule ref="category/java/multithreading.xml/DoubleCheckedLocking"/>
|
|
||||||
<rule ref="category/java/multithreading.xml/NonThreadSafeSingleton"/>
|
|
||||||
<rule ref="category/java/multithreading.xml/UseConcurrentHashMap"/>
|
|
||||||
<rule ref="category/java/multithreading.xml/UseNotifyAllInsteadOfNotify"/>
|
|
||||||
|
|
||||||
<!-- PERFORMANCE -->
|
<!-- PERFORMANCE -->
|
||||||
<rule ref="category/java/performance.xml/AddEmptyString"/>
|
<rule ref="category/java/performance.xml">
|
||||||
<rule ref="category/java/performance.xml/AppendCharacterWithChar"/>
|
</rule>
|
||||||
<rule ref="category/java/performance.xml/AvoidArrayLoops"/>
|
|
||||||
<rule ref="category/java/performance.xml/AvoidFileStream"/>
|
|
||||||
<rule ref="category/java/performance.xml/AvoidInstantiatingObjectsInLoops"/>
|
|
||||||
<rule ref="category/java/performance.xml/BigIntegerInstantiation"/>
|
|
||||||
<rule ref="category/java/performance.xml/BooleanInstantiation"/>
|
|
||||||
<rule ref="category/java/performance.xml/ByteInstantiation"/>
|
|
||||||
<rule ref="category/java/performance.xml/ConsecutiveAppendsShouldReuse"/>
|
|
||||||
<rule ref="category/java/performance.xml/ConsecutiveLiteralAppends"/>
|
|
||||||
<rule ref="category/java/performance.xml/InefficientEmptyStringCheck"/>
|
|
||||||
<rule ref="category/java/performance.xml/InefficientStringBuffering"/>
|
|
||||||
<rule ref="category/java/performance.xml/InsufficientStringBufferDeclaration"/>
|
|
||||||
<rule ref="category/java/performance.xml/IntegerInstantiation"/>
|
|
||||||
<rule ref="category/java/performance.xml/LongInstantiation"/>
|
|
||||||
<rule ref="category/java/performance.xml/OptimizableToArrayCall"/>
|
|
||||||
<rule ref="category/java/performance.xml/RedundantFieldInitializer"/>
|
|
||||||
<rule ref="category/java/performance.xml/ShortInstantiation"/>
|
|
||||||
<rule ref="category/java/performance.xml/StringInstantiation"/>
|
|
||||||
<rule ref="category/java/performance.xml/StringToString"/>
|
|
||||||
<rule ref="category/java/performance.xml/TooFewBranchesForASwitchStatement"/>
|
|
||||||
<rule ref="category/java/performance.xml/UnnecessaryWrapperObjectCreation"/>
|
|
||||||
<!-- <rule ref="category/java/performance.xml/UseArrayListInsteadOfVector"/> -->
|
|
||||||
<rule ref="category/java/performance.xml/UseArraysAsList"/>
|
|
||||||
<rule ref="category/java/performance.xml/UseIndexOfChar"/>
|
|
||||||
<rule ref="category/java/performance.xml/UselessStringValueOf"/>
|
|
||||||
<rule ref="category/java/performance.xml/UseStringBufferForStringAppends"/>
|
|
||||||
<rule ref="category/java/performance.xml/UseStringBufferLength"/>
|
|
||||||
|
|
||||||
<!-- SECURITY -->
|
<!-- SECURITY -->
|
||||||
<rule ref="category/java/security.xml/HardCodedCryptoKey"/>
|
<rule ref="category/java/security.xml">
|
||||||
<rule ref="category/java/security.xml/InsecureCryptoIv"/>
|
</rule>
|
||||||
</ruleset>
|
</ruleset>
|
||||||
|
|
|
@ -80,7 +80,7 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
|
||||||
<h1 id="httpstatus-jsp-tag-library">HttpStatus JSP Tag Library</h1>
|
<h1 id="httpstatus-jsp-tag-library">HttpStatus JSP Tag Library</h1>
|
||||||
<p><a href="https://github.com/ethauvin/httpstatus/releases/latest"><img src="https://img.shields.io/github/release/ethauvin/httpstatus.svg" alt="Release" /></a> <a href="https://search.maven.org/search?q=g:%22net.thauvin.erik.httpstatus%22%20AND%20a:%22httpstatus%22"><img src="https://img.shields.io/maven-central/v/net.thauvin.erik.httpstatus/httpstatus.svg?label=maven%20central" alt="Maven Central" /></a><br />
|
<p><a href="https://github.com/ethauvin/httpstatus/releases/latest"><img src="https://img.shields.io/github/release/ethauvin/httpstatus.svg" alt="Release" /></a> <a href="https://search.maven.org/search?q=g:%22net.thauvin.erik.httpstatus%22%20AND%20a:%22httpstatus%22"><img src="https://img.shields.io/maven-central/v/net.thauvin.erik.httpstatus/httpstatus.svg?label=maven%20central" alt="Maven Central" /></a><br />
|
||||||
<a href="http://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square" alt="License (3-Clause BSD)" /></a> <a href="https://snyk.io/test/github/ethauvin/httpstatus?targetFile=build.gradle"><img src="https://snyk.io/test/github/ethauvin/httpstatus/badge.svg?targetFile=build.gradle" alt="Known Vulnerabilities" /></a> <a href="https://sonarcloud.io/dashboard?id=ethauvin_HttpStatus"><img src="https://sonarcloud.io/api/project_badges/measure?project=ethauvin_HttpStatus&metric=alert_status" alt="Quality Gate Status" /></a><br />
|
<a href="http://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square" alt="License (3-Clause BSD)" /></a> <a href="https://snyk.io/test/github/ethauvin/httpstatus?targetFile=build.gradle"><img src="https://snyk.io/test/github/ethauvin/httpstatus/badge.svg?targetFile=build.gradle" alt="Known Vulnerabilities" /></a> <a href="https://sonarcloud.io/dashboard?id=ethauvin_HttpStatus"><img src="https://sonarcloud.io/api/project_badges/measure?project=ethauvin_HttpStatus&metric=alert_status" alt="Quality Gate Status" /></a><br />
|
||||||
<a href="https://travis-ci.com/ethauvin/HttpStatus"><img src="https://travis-ci.com/ethauvin/HttpStatus.svg?branch=master" alt="Build Status" /></a> <a href="https://ci.appveyor.com/project/ethauvin/httpstatus"><img src="https://ci.appveyor.com/api/projects/status/w5j4kul3w2rkigxb?svg=true" alt="Build status" /></a> <a href="https://circleci.com/gh/ethauvin/HttpStatus/tree/master"><img src="https://circleci.com/gh/ethauvin/HttpStatus/tree/master.svg?style=shield" alt="CircleCI" /></a></p>
|
<a href="https://github.com/ethauvin/httpstatus/actions/workflows/gradle.yml"><img src="https://github.com/ethauvin/httpstatus/actions/workflows/gradle.yml/badge.svg" alt="GitHub CI" /></a> <a href="https://ci.appveyor.com/project/ethauvin/httpstatus"><img src="https://ci.appveyor.com/api/projects/status/w5j4kul3w2rkigxb?svg=true" alt="Build status" /></a> <a href="https://circleci.com/gh/ethauvin/HttpStatus/tree/master"><img src="https://circleci.com/gh/ethauvin/HttpStatus/tree/master.svg?style=shield" alt="CircleCI" /></a></p>
|
||||||
<p>A simple <a href="http://www.oracle.com/technetwork/java/javaee/jsp/index.html">JSP</a> Tag Library to display the <a href="#hscode">code</a>, <a href="#hsreason">reason</a>, <a href="#hscode">cause</a> and/or <a href="#hsmessage">message</a> for <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP status codes</a> in JSP error pages.</p>
|
<p>A simple <a href="http://www.oracle.com/technetwork/java/javaee/jsp/index.html">JSP</a> Tag Library to display the <a href="#hscode">code</a>, <a href="#hsreason">reason</a>, <a href="#hscode">cause</a> and/or <a href="#hsmessage">message</a> for <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP status codes</a> in JSP error pages.</p>
|
||||||
<p>For example:</p>
|
<p>For example:</p>
|
||||||
<div class="sourceCode" id="cb1"><pre class="sourceCode jsp"><code class="sourceCode jsp"><a class="sourceLine" id="cb1-1" title="1"><%@ page<span class="ot"> isErrorPage</span>=<span class="st">"true"</span><span class="ot"> </span>%></a>
|
<div class="sourceCode" id="cb1"><pre class="sourceCode jsp"><code class="sourceCode jsp"><a class="sourceLine" id="cb1-1" title="1"><%@ page<span class="ot"> isErrorPage</span>=<span class="st">"true"</span><span class="ot"> </span>%></a>
|
||||||
|
@ -547,22 +547,22 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
|
||||||
<h2 id="usage-with-gradle-or-maven">Usage with <a href="https://gradle.org/">Gradle</a> or <a href="http://maven.apache.org/">Maven</a></h2>
|
<h2 id="usage-with-gradle-or-maven">Usage with <a href="https://gradle.org/">Gradle</a> or <a href="http://maven.apache.org/">Maven</a></h2>
|
||||||
<p>Include the following in your <code>build.gradle</code> file:</p>
|
<p>Include the following in your <code>build.gradle</code> file:</p>
|
||||||
<pre class="gradle"><code>dependencies {
|
<pre class="gradle"><code>dependencies {
|
||||||
implementation 'net.thauvin.erik.httpstatus:httpstatus:1.0.5'
|
implementation 'net.thauvin.erik.httpstatus:httpstatus:1.0.6'
|
||||||
}
|
}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>or as a Maven artifact:</p>
|
<p>or as a Maven artifact:</p>
|
||||||
<div class="sourceCode" id="cb8"><pre class="sourceCode xml"><code class="sourceCode xml"><a class="sourceLine" id="cb8-1" title="1"><span class="kw"><dependency></span></a>
|
<div class="sourceCode" id="cb8"><pre class="sourceCode xml"><code class="sourceCode xml"><a class="sourceLine" id="cb8-1" title="1"><span class="kw"><dependency></span></a>
|
||||||
<a class="sourceLine" id="cb8-2" title="2"> <span class="kw"><groupId></span>net.thauvin.erik.httpstatus<span class="kw"></groupId></span></a>
|
<a class="sourceLine" id="cb8-2" title="2"> <span class="kw"><groupId></span>net.thauvin.erik.httpstatus<span class="kw"></groupId></span></a>
|
||||||
<a class="sourceLine" id="cb8-3" title="3"> <span class="kw"><artifactId></span>httpstatus<span class="kw"></artifactId></span></a>
|
<a class="sourceLine" id="cb8-3" title="3"> <span class="kw"><artifactId></span>httpstatus<span class="kw"></artifactId></span></a>
|
||||||
<a class="sourceLine" id="cb8-4" title="4"> <span class="kw"><version></span>1.0.5<span class="kw"></version></span></a>
|
<a class="sourceLine" id="cb8-4" title="4"> <span class="kw"><version></span>1.0.6<span class="kw"></version></span></a>
|
||||||
<a class="sourceLine" id="cb8-5" title="5"><span class="kw"></dependency></span></a></code></pre></div>
|
<a class="sourceLine" id="cb8-5" title="5"><span class="kw"></dependency></span></a></code></pre></div>
|
||||||
<h2 id="command-line-usage">Command Line Usage</h2>
|
<h2 id="command-line-usage">Command Line Usage</h2>
|
||||||
<p>You can query the reason phrase for status codes as follows:</p>
|
<p>You can query the reason phrase for status codes as follows:</p>
|
||||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb9-1" title="1">$ <span class="ex">java</span> -jar httpstatus-1.0.5.jar 404 500</a>
|
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb9-1" title="1">$ <span class="ex">java</span> -jar httpstatus-1.0.6.jar 404 500</a>
|
||||||
<a class="sourceLine" id="cb9-2" title="2"><span class="ex">404</span>: Not Found</a>
|
<a class="sourceLine" id="cb9-2" title="2"><span class="ex">404</span>: Not Found</a>
|
||||||
<a class="sourceLine" id="cb9-3" title="3"><span class="ex">500</span>: Internal Server Error</a></code></pre></div>
|
<a class="sourceLine" id="cb9-3" title="3"><span class="ex">500</span>: Internal Server Error</a></code></pre></div>
|
||||||
<p>If no status code is specified, all will be printed:</p>
|
<p>If no status code is specified, all will be printed:</p>
|
||||||
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb10-1" title="1">$ <span class="ex">java</span> -jar httpstatus-1.0.5.jar</a>
|
<div class="sourceCode" id="cb10"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb10-1" title="1">$ <span class="ex">java</span> -jar httpstatus-1.0.6.jar</a>
|
||||||
<a class="sourceLine" id="cb10-2" title="2"><span class="ex">100</span>: Continue</a>
|
<a class="sourceLine" id="cb10-2" title="2"><span class="ex">100</span>: Continue</a>
|
||||||
<a class="sourceLine" id="cb10-3" title="3"><span class="ex">101</span>: Switching Protocols</a>
|
<a class="sourceLine" id="cb10-3" title="3"><span class="ex">101</span>: Switching Protocols</a>
|
||||||
<a class="sourceLine" id="cb10-4" title="4"><span class="ex">102</span>: Processing</a>
|
<a class="sourceLine" id="cb10-4" title="4"><span class="ex">102</span>: Processing</a>
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class UtilsTest {
|
||||||
@SuppressFBWarnings("CE_CLASS_ENVY")
|
@SuppressFBWarnings("CE_CLASS_ENVY")
|
||||||
@Test
|
@Test
|
||||||
public void testOutWrite() throws IOException {
|
public void testOutWrite() throws IOException {
|
||||||
try (final StringWriter sw = new StringWriter()) {
|
try (StringWriter sw = new StringWriter()) {
|
||||||
Utils.outWrite(sw, null, "default", false);
|
Utils.outWrite(sw, null, "default", false);
|
||||||
assertEquals(sw.toString(), "default", "outWrite(default)");
|
assertEquals(sw.toString(), "default", "outWrite(default)");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue