Mercurial > hg4j
comparison src/org/tmatesoft/hg/util/RegularFileInfo.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 | ed6b74a58c66 | 
| children | 7f27122011c3 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 294:32890bab7209 | 295:981f9f50bb6c | 
|---|---|
| 20 import java.io.FileInputStream; | 20 import java.io.FileInputStream; | 
| 21 import java.io.FileNotFoundException; | 21 import java.io.FileNotFoundException; | 
| 22 import java.io.IOException; | 22 import java.io.IOException; | 
| 23 import java.nio.ByteBuffer; | 23 import java.nio.ByteBuffer; | 
| 24 import java.nio.channels.ReadableByteChannel; | 24 import java.nio.channels.ReadableByteChannel; | 
| 25 | |
| 26 import org.tmatesoft.hg.internal.StreamLogFacility; | |
| 25 | 27 | 
| 26 /** | 28 /** | 
| 27 * | 29 * | 
| 28 * @author Artem Tikhomirov | 30 * @author Artem Tikhomirov | 
| 29 * @author TMate Software Ltd. | 31 * @author TMate Software Ltd. | 
| 52 | 54 | 
| 53 public ReadableByteChannel newInputChannel() { | 55 public ReadableByteChannel newInputChannel() { | 
| 54 try { | 56 try { | 
| 55 return new FileInputStream(file).getChannel(); | 57 return new FileInputStream(file).getChannel(); | 
| 56 } catch (FileNotFoundException ex) { | 58 } catch (FileNotFoundException ex) { | 
| 57 ex.printStackTrace(); // FIXME log debug. | 59 StreamLogFacility.newDefault().debug(getClass(), ex, null); | 
| 58 // shall not happen, provided this class is used correctly | 60 // shall not happen, provided this class is used correctly | 
| 59 return new ReadableByteChannel() { | 61 return new ReadableByteChannel() { | 
| 60 | 62 | 
| 61 public boolean isOpen() { | 63 public boolean isOpen() { | 
| 62 return true; | 64 return true; | 
