* @throws java.io.IOException if there is a problem communicating with the local or remote repository.
*/
private InputStream getRepositoryStream(boolean fail) throws IOException {
// cache the repositories, since we do not want them to change while we're in this method.
CachedRepository cachedRepository = m_cachedRepository;
Repository repository = m_directRepository;
InputStream result;
if (cachedRepository != null) {
// we can use the cached repository
if (cachedRepository.isCurrent()) {
result = cachedRepository.getLocal(fail);
}
else {
result = cachedRepository.checkout(fail);
}
}
else {
RangeIterator ri = repository.getRange().iterator();
long resultVersion = 0;
while (ri.hasNext()) {
resultVersion = ri.next();
}
if (resultVersion != 0) {
result = repository.checkout(resultVersion);
}
else {
throw new IllegalArgumentException("There is no deployment information available.");
}
}