summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2015-12-15 06:44:07 -0500
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2015-12-15 06:44:08 -0500
commit5c66ad56841f8841b8aeb60c61cc4c2ec064a6f4 (patch)
treeff4d7575c8aded950ecc1d48c5e5fac3f60b8065
parent2f0b675a719b8278727cb4f05db053c6debf7d7c (diff)
parentafd167a1f26d140b7023972ddf85d12f3c9f9d8d (diff)
downloadjgit-5c66ad56841f8841b8aeb60c61cc4c2ec064a6f4.tar.gz
jgit-5c66ad56841f8841b8aeb60c61cc4c2ec064a6f4.zip
Merge "NetRCCredentialsProvider should return false if any item is missing"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProvider.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRCCredentialsProvider.java3
3 files changed, 15 insertions, 9 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java
index 5e1eb3c493..3941d3c552 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java
@@ -127,11 +127,4 @@ public class ChainingCredentialsProvider extends CredentialsProvider {
}
return false;
}
-
- private boolean isAnyNull(CredentialItem... items) {
- for (CredentialItem i : items)
- if (i == null)
- return true;
- return false;
- }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProvider.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProvider.java
index 464d0f9ee5..4800f6826f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProvider.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProvider.java
@@ -81,6 +81,20 @@ public abstract class CredentialsProvider {
}
/**
+ * @param items
+ * credential items to check
+ * @return {@code true} if any of the passed items is null, {@code false}
+ * otherwise
+ * @since 4.2
+ */
+ protected static boolean isAnyNull(CredentialItem... items) {
+ for (CredentialItem i : items)
+ if (i == null)
+ return true;
+ return false;
+ }
+
+ /**
* Check if the provider is interactive with the end-user.
*
* An interactive provider may try to open a dialog box, or prompt for input
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRCCredentialsProvider.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRCCredentialsProvider.java
index 74909998ce..4037545e9d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRCCredentialsProvider.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRCCredentialsProvider.java
@@ -105,12 +105,11 @@ public class NetRCCredentialsProvider extends CredentialsProvider {
throw new UnsupportedCredentialItem(uri, i.getClass().getName()
+ ":" + i.getPromptText()); //$NON-NLS-1$
}
- return true;
+ return !isAnyNull(items);
}
@Override
public boolean isInteractive() {
return false;
}
-
}