Handles repo manifest file without default remote.

Change-Id: Ic45919a0b695e8a6f4ed47cc060e0c41f1d7e7ea
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
This commit is contained in:
Yuxuan 'fishy' Wang 2014-08-27 16:28:43 -07:00
parent 49305cde19
commit 684a2a058a
1 changed files with 12 additions and 8 deletions

View File

@ -473,14 +473,8 @@ public void endDocument() throws SAXException {
xmlInRead--;
if (xmlInRead != 0)
return;
// Only do the following after we finished reading everything.
if (defaultRemote == null) {
if (filename != null)
throw new SAXException(MessageFormat.format(
RepoText.get().errorNoDefaultFilename, filename));
else
throw new SAXException(RepoText.get().errorNoDefault);
}
removeNotInGroup();
removeOverlaps();
@ -493,8 +487,18 @@ public void endDocument() throws SAXException {
}
for (Project proj : projects) {
String remote = proj.remote;
if (remote == null)
if (remote == null) {
if (defaultRemote == null) {
if (filename != null)
throw new SAXException(MessageFormat.format(
RepoText.get().errorNoDefaultFilename,
filename));
else
throw new SAXException(
RepoText.get().errorNoDefault);
}
remote = defaultRemote;
}
String remoteUrl = remoteUrls.get(remote);
if (remoteUrl == null) {
remoteUrl = baseUri.resolve(remotes.get(remote)).toString();