RemoteConfig may have empty URIs list. It would be nicer to throw documented exception than ArrayIndexOutOfBoundsException in this case. Signed-off-by: Marek Zawirski <marek.zawirski@xxxxxxxxx> --- .../src/org/spearce/jgit/transport/Transport.java | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/Transport.java b/org.spearce.jgit/src/org/spearce/jgit/transport/Transport.java index 5bec4d2..30175e3 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/Transport.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/Transport.java @@ -103,9 +103,16 @@ public abstract class Transport { * @return the new transport instance. Never null. * @throws NotSupportedException * the protocol specified is not supported. + * @throws IllegalArgumentException + * if provided remote configuration doesn't have any URI + * associated. */ public static Transport open(final Repository local, final RemoteConfig cfg) throws NotSupportedException { + if (cfg.getURIs().isEmpty()) + throw new IllegalArgumentException( + "Remote config \"" + + cfg.getName() + "\" has no URIs associated"); final Transport tn = open(local, cfg.getURIs().get(0)); tn.setOptionUploadPack(cfg.getUploadPack()); tn.fetch = cfg.getFetchRefSpecs(); -- 1.5.6.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html