Skip to content

Commit

Permalink
Fix Findbugs issues in LogConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
josegar74 committed Jul 2, 2015
1 parent d26704a commit 41899ec
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -12,6 +12,7 @@
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.IOUtils;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Logger;
import org.fao.geonet.constants.Geonet;
Expand All @@ -31,8 +32,8 @@
public class LogConfig {
private FileAppender fileAppender = null;

private final String fileAppenderName = "fileAppender";
private final int maxLines = 20000;
private static final String fileAppenderName = "fileAppender";
private static final int maxLines = 20000;

@PostConstruct
public void init() throws Exception {
Expand Down Expand Up @@ -107,9 +108,9 @@ public void getLog(HttpServletResponse response) throws IOException {
zos.write(bytes, 0, read);
}
} finally {
in.close();
zos.flush();
zos.close();
IOUtils.closeQuietly(in);
if (zos != null) zos.flush();
IOUtils.closeQuietly(zos);
}
} else {
throw new RuntimeException("No log file found for download. Check logger configuration.");
Expand Down

0 comments on commit 41899ec

Please sign in to comment.