comparison src/org/tmatesoft/hg/repo/HgRemoteRepository.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 bb278ccf9866
children 48f993aa2f41
comparison
equal deleted inserted replaced
422:5d1cc7366d04 423:9c9c442b5f2e
45 import javax.net.ssl.SSLContext; 45 import javax.net.ssl.SSLContext;
46 import javax.net.ssl.TrustManager; 46 import javax.net.ssl.TrustManager;
47 import javax.net.ssl.X509TrustManager; 47 import javax.net.ssl.X509TrustManager;
48 48
49 import org.tmatesoft.hg.core.HgBadArgumentException; 49 import org.tmatesoft.hg.core.HgBadArgumentException;
50 import org.tmatesoft.hg.core.HgBadStateException;
51 import org.tmatesoft.hg.core.HgInvalidFileException;
52 import org.tmatesoft.hg.core.HgRemoteConnectionException; 50 import org.tmatesoft.hg.core.HgRemoteConnectionException;
53 import org.tmatesoft.hg.core.Nodeid; 51 import org.tmatesoft.hg.core.Nodeid;
54 import org.tmatesoft.hg.core.SessionContext; 52 import org.tmatesoft.hg.core.SessionContext;
55 53
56 /** 54 /**
232 if (possiblyEmptyNextLine) { 230 if (possiblyEmptyNextLine) {
233 // newline follows newline; 231 // newline follows newline;
234 assert currRange == null; 232 assert currRange == null;
235 assert currRangeList == null; 233 assert currRangeList == null;
236 if (!rangeItr.hasNext()) { 234 if (!rangeItr.hasNext()) {
237 throw new HgBadStateException("Internal error"); 235 throw new HgInvalidStateException("Internal error"); // TODO revisit-1.1
238 } 236 }
239 rv.put(rangeItr.next(), Collections.<Nodeid>emptyList()); 237 rv.put(rangeItr.next(), Collections.<Nodeid>emptyList());
240 } else { 238 } else {
241 if (currRange == null || currRangeList == null) { 239 if (currRange == null || currRangeList == null) {
242 throw new HgBadStateException("Internal error"); 240 throw new HgInvalidStateException("Internal error"); // TODO revisit-1.1
243 } 241 }
244 // indicate next range value is needed 242 // indicate next range value is needed
245 currRange = null; 243 currRange = null;
246 currRangeList = null; 244 currRangeList = null;
247 possiblyEmptyNextLine = true; 245 possiblyEmptyNextLine = true;
248 } 246 }
249 } else { 247 } else {
250 possiblyEmptyNextLine = false; 248 possiblyEmptyNextLine = false;
251 if (currRange == null) { 249 if (currRange == null) {
252 if (!rangeItr.hasNext()) { 250 if (!rangeItr.hasNext()) {
253 throw new HgBadStateException("Internal error"); 251 throw new HgInvalidStateException("Internal error"); // TODO revisit-1.1
254 } 252 }
255 currRange = rangeItr.next(); 253 currRange = rangeItr.next();
256 currRangeList = new LinkedList<Nodeid>(); 254 currRangeList = new LinkedList<Nodeid>();
257 rv.put(currRange, currRangeList); 255 rv.put(currRange, currRangeList);
258 } 256 }