NetRCCredentialsProvider should return false if any item is missing
Change-Id: I894d1621aaccd71dfe100fe83a1bd9d50a1e0808
This commit is contained in:
parent
5786cc3c0f
commit
afd167a1f2
|
@ -127,11 +127,4 @@ public boolean get(URIish uri, CredentialItem... items)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isAnyNull(CredentialItem... items) {
|
||||
for (CredentialItem i : items)
|
||||
if (i == null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,20 @@ public static void setDefault(CredentialsProvider p) {
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -105,12 +105,11 @@ public boolean get(URIish uri, CredentialItem... items)
|
|||
throw new UnsupportedCredentialItem(uri, i.getClass().getName()
|
||||
+ ":" + i.getPromptText()); //$NON-NLS-1$
|
||||
}
|
||||
return true;
|
||||
return !isAnyNull(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInteractive() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue