Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
Adding logging for IOExceptions in FileSerializer
Browse files Browse the repository at this point in the history
  • Loading branch information
escowles committed Nov 13, 2013
1 parent fb27ec6 commit b1ddd17
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -25,6 +25,9 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Basic Indexer implementation that writes object content to timestamped files
* on disk.
Expand All @@ -34,6 +37,8 @@
**/
public class FileSerializer implements Indexer {

private final Logger logger = LoggerFactory.getLogger(FileSerializer.class);

private static SimpleDateFormat fmt
= new SimpleDateFormat("yyyyMMddHHmmss");
private File path;
Expand Down Expand Up @@ -69,6 +74,8 @@ public void update(String pid, String content) throws IOException {
try {
fw = new FileWriter( new File(path,fn) );
IOUtils.write( content, fw );
} catch (IOException ex) {
logger.warn("Error writing file", ex);
} finally {
fw.close();
}
Expand Down

0 comments on commit b1ddd17

Please sign in to comment.