java answers
Yegor Bugayenko edited this page Apr 14, 2015
·
20 revisions
This a list of problems in the Java file, in order of importance (the biggest problems are on top):
- it's not really a class, but a collection of utility procedures (see)
- it is doing two many things at the same time: saving, loading, filtering
- the class is not thread-safe, despite the promise in JavaDoc
- there is an obvious code duplication in
getContent*
methods - unicode filtering is done wrong, will break the content instead of filtering it
- variable names are very short and non-informative
- string concatenation is very ineffective in terms of performance
-
while ((data = i.read()) > 0)
is a bad style, should bewhile (true)
and thenbreak
inside - input stream and output stream are not buffered
- both streams are not closed after use
- all non-modifiable variables should be
final
-
i += 1
is not the best method of variable increment -
file
is not prepended withthis.
If you miss all three problems listed at the top, we won't work with you.