Mercurial > hg4j
diff src/org/tmatesoft/hg/internal/DataAccessProvider.java @ 295:981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 16 Sep 2011 05:35:32 +0200 |
parents | b413b16d10a5 |
children | 3cfa4d908fc9 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/DataAccessProvider.java Wed Sep 14 04:41:57 2011 +0200 +++ b/src/org/tmatesoft/hg/internal/DataAccessProvider.java Fri Sep 16 05:35:32 2011 +0200 @@ -24,6 +24,7 @@ import java.nio.channels.FileChannel; import org.tmatesoft.hg.core.HgBadStateException; +import org.tmatesoft.hg.core.SessionContext; /** * @@ -34,12 +35,14 @@ private final int mapioMagicBoundary; private final int bufferSize; + private final SessionContext context; - public DataAccessProvider() { - this(100 * 1024, 8 * 1024); + public DataAccessProvider(SessionContext ctx) { + this(ctx, 100 * 1024, 8 * 1024); } - public DataAccessProvider(int mapioBoundary, int regularBufferSize) { + public DataAccessProvider(SessionContext ctx, int mapioBoundary, int regularBufferSize) { + context = ctx; mapioMagicBoundary = mapioBoundary; bufferSize = regularBufferSize; } @@ -67,7 +70,7 @@ } } catch (IOException ex) { // unlikely to happen, we've made sure file exists. - ex.printStackTrace(); // FIXME log error + context.getLog().error(getClass(), ex, null); } return new DataAccess(); // non-null, empty. } @@ -177,7 +180,7 @@ try { fileChannel.close(); } catch (IOException ex) { - ex.printStackTrace(); // log debug + StreamLogFacility.newDefault().debug(getClass(), ex, null); } fileChannel = null; } @@ -298,7 +301,7 @@ try { fileChannel.close(); } catch (IOException ex) { - ex.printStackTrace(); // log debug + StreamLogFacility.newDefault().debug(getClass(), ex, null); } fileChannel = null; }