Browse Source

NetRCCredentialsProvider should return false if any item is missing

Change-Id: I894d1621aaccd71dfe100fe83a1bd9d50a1e0808
stable-4.3
Matthias Sohn 9 years ago
parent
commit
afd167a1f2
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java
  2. 14
      org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProvider.java
  3. 3
      org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRCCredentialsProvider.java

7
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;
}
}

14
org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProvider.java

@ -80,6 +80,20 @@ public abstract class CredentialsProvider {
defaultProvider = p;
}
/**
* @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.
*

3
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;
}
}

Loading…
Cancel
Save