fixed the behaviour in case the repository doesn't exist.

This commit is contained in:
Kohsuke Kawaguchi
2011-12-19 17:07:20 -08:00
parent 7a3127ed65
commit 1e9a68a16b

View File

@@ -1,5 +1,6 @@
package org.kohsuke.github;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
@@ -31,8 +32,17 @@ public abstract class GHPerson {
return Collections.unmodifiableMap(repositories);
}
/**
*
* @return
* null if the repository was not found
*/
public GHRepository getRepository(String name) throws IOException {
return root.retrieve3("/repos/" + login + '/' + name, GHRepository.class).wrap(root);
try {
return root.retrieve3("/repos/" + login + '/' + name, GHRepository.class).wrap(root);
} catch (FileNotFoundException e) {
return null;
}
}
/**