generics should match those of superclass, use non-deprecated method call
remove unnecessary casts and imports
prevent autoboxing
add missing serialVersionUID
close resource after use
replace deprecated elements
remove unnecessary checks
javadocs and some whitespaces