Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgDataFile.java @ 423:9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 23 Mar 2012 22:51:18 +0100 |
parents | 6c22bdc0bdfd |
children | 6437d261048a |
comparison
equal
deleted
inserted
replaced
422:5d1cc7366d04 | 423:9c9c442b5f2e |
---|---|
30 import java.util.Collection; | 30 import java.util.Collection; |
31 import java.util.Collections; | 31 import java.util.Collections; |
32 import java.util.List; | 32 import java.util.List; |
33 | 33 |
34 import org.tmatesoft.hg.core.HgException; | 34 import org.tmatesoft.hg.core.HgException; |
35 import org.tmatesoft.hg.core.HgInvalidControlFileException; | |
36 import org.tmatesoft.hg.core.HgInvalidFileException; | |
37 import org.tmatesoft.hg.core.HgInvalidRevisionException; | |
38 import org.tmatesoft.hg.core.HgLogCommand; | 35 import org.tmatesoft.hg.core.HgLogCommand; |
39 import org.tmatesoft.hg.core.Nodeid; | 36 import org.tmatesoft.hg.core.Nodeid; |
40 import org.tmatesoft.hg.internal.DataAccess; | 37 import org.tmatesoft.hg.internal.DataAccess; |
41 import org.tmatesoft.hg.internal.FilterByteChannel; | 38 import org.tmatesoft.hg.internal.FilterByteChannel; |
42 import org.tmatesoft.hg.internal.FilterDataAccess; | 39 import org.tmatesoft.hg.internal.FilterDataAccess; |
712 log = logFacility; | 709 log = logFacility; |
713 delegate = chain; | 710 delegate = chain; |
714 setCancelSupport(CancelSupport.Factory.get(chain)); | 711 setCancelSupport(CancelSupport.Factory.get(chain)); |
715 } | 712 } |
716 | 713 |
717 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) throws HgException { | 714 public void next(int revisionNumber, int actualLen, int baseRevision, int linkRevision, int parent1Revision, int parent2Revision, byte[] nodeid, DataAccess data) { |
718 try { | 715 try { |
719 final int daLength = data.length(); | 716 final int daLength = data.length(); |
720 if (daLength < 4 || data.readByte() != 1 || data.readByte() != 10) { | 717 if (daLength < 4 || data.readByte() != 1 || data.readByte() != 10) { |
721 metadata.recordNone(revisionNumber); | 718 metadata.recordNone(revisionNumber); |
722 data.reset(); | 719 data.reset(); |
734 delegate.next(revisionNumber, actualLen, baseRevision, linkRevision, parent1Revision, parent2Revision, nodeid, data); | 731 delegate.next(revisionNumber, actualLen, baseRevision, linkRevision, parent1Revision, parent2Revision, nodeid, data); |
735 } | 732 } |
736 } catch (IOException ex) { | 733 } catch (IOException ex) { |
737 recordFailure(ex); | 734 recordFailure(ex); |
738 } catch (HgInvalidControlFileException ex) { | 735 } catch (HgInvalidControlFileException ex) { |
736 // TODO RevlogStream, where this RevlogStream.Inspector goes, shall set File (as it's the only one having access to it) | |
739 recordFailure(ex.isRevisionIndexSet() ? ex : ex.setRevisionIndex(revisionNumber)); | 737 recordFailure(ex.isRevisionIndexSet() ? ex : ex.setRevisionIndex(revisionNumber)); |
740 } | 738 } |
741 } | 739 } |
742 | 740 |
743 private int parseMetadata(DataAccess data, final int daLength, ArrayList<MetadataEntry> _metadata) throws IOException, HgInvalidControlFileException { | 741 private int parseMetadata(DataAccess data, final int daLength, ArrayList<MetadataEntry> _metadata) throws IOException, HgInvalidControlFileException { |