Clean up Java server code

Resolves a few problems found via [IntelliJ IDEA's analysis](http://www.jetbrains.com/idea/documentation/static_code_analysis.html) and [FindBugs](http://findbugs.sourceforge.net/).