NetRCCredentialsProvider should return false if any item is missing

Change-Id: I894d1621aaccd71dfe100fe83a1bd9d50a1e0808
This commit is contained in:
Matthias Sohn 2015-12-08 14:11:43 +01:00
parent 5786cc3c0f
commit afd167a1f2
3 changed files with 15 additions and 9 deletions

View File

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

View File

@ -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.
*

View File

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