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

Commit

Permalink
Merge pull request #12 from futures/file-permissions-bugfix
Browse files Browse the repository at this point in the history
Adding logging for IOExceptions in FileSerializer
Resolves: https://www.pivotaltracker.com/story/show/58845340
  • Loading branch information
Andrew Woods committed Nov 13, 2013
2 parents fb27ec6 + b1ddd17 commit 136b46b
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 136b46b

Please sign in to comment.