9.
ER-098 (
3)
No need to provide (public, abstract, ) modifiers for interface methods
10.
ER-107 (
3)
Instance variables and method names shouldn't have same name
11.
ER-200 (
3)
Instance variables and the declaring type shouldn't have same name
12.
ER-201 (
3)
Discourage usage of instance variables like a, j by enforcing minimal variable name length.
Coding standards
13.
ER-211 (
2)
Dot chain (e.g. a().b.c.d().e().g().toString()) is too long.
14.
ER-114 (
3)
Use object.equals(anotherObject) instead of
object.compareTo(anotherObject)==0
15.
ER-210 (
3)
StringTokenizer is deprecated, use String.split() instead.
Database Connection Pool
16.
ER-207 (
1)
SQL Resource Management - Create Statement Without Close Rule: You have to close each created SQL Statement on method level. Use the finally block, but check for null value. If you use a operation in the finally block for closing your SQL resource, please define the operation name in the inspector.xml. Hammurapi will search for this method call and check the parameter list. This rule is only applicable in a connection-pooled environment.
17.
ER-208 (
1)
SQL Resource Management - Create Statement Within a Loop: Never create Statements inside loops. This rule is only applicable in a connection-pooled environment.
18.
ER-206 (
2)
Wrong declaration of SQL Resources Management: Do not declare Statements and ResultSets on Instance Level but use local variables on method level only. You may run in leakage problems if you do not close these resources in a connection-pooled environment.
EJB
19.
ER-055 (
1)
Declare bean classes "public", but not "final"
20.
ER-056 (
1)
Declare 'ejbCreate ()' methods "public", but neither "static" nor "final"
21.
ER-057 (
1)
Declare finder methods "public" and neither "final" nor "static"
22.
ER-058 (
1)
Implement one or more 'ejbCreate ()' methods in bean classes
23.
ER-059 (
1)
Implement matching 'ejbPostCreate ()' methods for every 'ejbCreate()' in EntityBean classes
24.
ER-061 (
1)
Do not define 'finalize ()' method in bean classes
25.
ER-063 (
1)
Declare 'ejbPostCreate ()' "public" and neither "static" nor "final"
26.
ER-064 (
1)
Make the return type "void" for SessionBeans' 'ejbCreate ()' methods
27.
ER-065 (
1)
Make the return type "void" for the 'ejbPostCreate ()' method
28.
ER-066 (
1)
Avoid passing the "this" reference as an argument
30.
ER-068 (
1)
Avoid starting, stopping, or managing threads in any way
31.
ER-060 (
2)
Avoid loading native libraries in a Bean class
32.
ER-062 (
2)
Declare all "static" fields in the EJB component "final"
EJB, Clustring, or Load Balancing Architecture
33.
ER-212 (
2)
Statefull Singleton could cause problems in an environment of EJB, Clustering, or Load Balancing Architecture. Make sure that all you class and instance variables are final. This inspector found non-final variable(s), beside the variable referenzing the singleton.
Exception handling
34.
ER-039 (
2)
Catching too general exception type.
35.
ER-045 (
2)
Throw too general exception type (Exception, Throwable, RuntimeException)
36.
ER-046 (
2)
Method declares too general exception types (Exception, Throwable) in throws clause
37.
ER-047 (
2)
Operation (method or constructor) declares subclasses of RuntimeException in throws clause
38.
ER-095 (
2)
Too many exceptions listed in throws clause
40.
ER-070 (
2)
Avoid "static" collections; they can grow without bounds
General
41.
ER-214 (
1)
Heterogenous Collection detected: The code adds objects of different types in a collection. This can cause serious mainteance issues.
The creator and consumer of the collection have to have implicit knowledge about the index of a specific object inside of the collection.
Go with a dedicated parameter or Data Transfer Object instead.
There is only one exception for using Heterogenous Collection: If all objects in the collection implement a specific interface, this is acceptable.
JavaDoc
42.
ER-105 (
3)
Document all Interfaces and public methods. Use a Class header. Provide Javadoc
Logging
43.
ER-052 (
1)
Do not use printStackTrace(), use logger(, ) instead.
44.
ER-049 (
2)
Unify logging strategy - define individual logger for class
45.
ER-103 (
2)
Catch-blocks should log the exeption with Log4J.error("Context String" , exception )
78.
ER-202 (
2)
Disallows to use a particular type or package in a particular context.
79.
ER-000 (
3)
No need to import classes from java.lang
80.
ER-001 (
3)
Imports should be ordered according to the configuartion parameters and further for each parameter, imports should be arrange alphabetically
81.
ER-003 (
3)
do, while, if, and for statements need a brace enclosed block
82.
ER-005 (
3)
Classes, interfaces, methods, and variables should be named according to Sun's naming conventions.
83.
ER-007 (
3)
Use upper case 'L' rather that lower case 'l' to qualify long literals
89.
ER-109 (
3)
It is good practice to call in any case super() in a constructor. (see also: UnnecessaryConstructorRule )
90.
ER-110 (
3)
Unnecessary constructor detects when a constructor is not necessary; i.e., when there's only one constructor, it's public, has an empty body, and takes no arguments.
92.
ER-077 (
2)
Avoid more than two levels of nested inner classes
Performance
93.
ER-116 (
3)
Use StringBuffer for excessive String concatenation. This inspector skips
static fields initializers, single concatenations (one +) and concatenations of constants like
"a"+"b"+"c" because they are calculated at compile time.
Possible bugs
94.
ER-035 (
1)
Switch statement case without 'break'
95.
ER-048 (
1)
Use BigDecimal instead of Float or Double for monetary values
96.
ER-080 (
1)
Avoid "for", "do", "while", "if" and "if ... else" statements with empty bodies
97.
ER-084 (
1)
Avoid using text labels in "switch" statements
98.
ER-079 (
2)
Avoid casting primitive data types to lower precision
99.
ER-081 (
2)
Do not assign loop control variables in the body of a "for" loop
100.
ER-102 (
2)
String Arrays are deprecated and are ONLY allowed for final variables
101.
ER-106 (
2)
If you have to compare with a string do not use degree.equals("1")) but "1".equals(degree)
102.
ER-028 (
3)
Avoid hardwired character literals
114.
ER-091 (
2)
Give subclasses of Thread a 'run ()' method
115.
ER-093 (
2)
Call 'wait ()' only inside a "while" loop
116.
ER-094 (
2)
Use 'wait ()' and 'notifyAll ()' instead of polling loops
117.
ER-099 (
2)
Use the "synchronized" modifier on methods that implement 'Runnable.run ()'
118.
ER-087 (
3)
Do not use 'notify ()'; use 'notifyAll ()' instead
Work prioritization
119.
Prioritizer (
5)
Generates priority metric. This metric is calculated
as 100/((ln(clients+1)+1)*violationLevel+1) where clients is a number
of classes which depend on classes in this file and violationLevel is a weighed sum
of violations in the file. In a nutshell the worse the code in the file the lower
priority metric value and as such the higher its position in the list.