@Test(expected = NullPointerException.class) public void testNullAliasOnGetValue() { HadoopCredentialProvider.getValue(new Configuration(false), null); }
public static char[] getValue(Configuration conf, String alias) { requireNonNull(alias); List<CredentialProvider> providerList = getProviders(requireNonNull(conf)); return providerList == null ? null : providerList.stream().map(provider -> { try { return provider.getCredentialEntry(alias); } catch (IOException e) { log.warn("Failed to call getCredentialEntry(alias) for provider {}", provider, e); return null; } }).filter(Objects::nonNull).map(CredentialProvider.CredentialEntry::getCredential).findFirst() .orElseGet(() -> { log.trace("Could not extract credential for {} from providers", alias); return null; }); }
HadoopCredentialProvider { public static char[] getValue(Configuration conf, String alias) { requireNonNull(alias); List<CredentialProvider> providerList = getProviders(requireNonNull(conf)); return providerList == null ? null : providerList.stream().map(provider -> { try { return provider.getCredentialEntry(alias); } catch (IOException e) { log.warn("Failed to call getCredentialEntry(alias) for provider {}", provider, e); return null; } }).filter(Objects::nonNull).map(CredentialProvider.CredentialEntry::getCredential).findFirst() .orElseGet(() -> { log.trace("Could not extract credential for {} from providers", alias); return null; }); } }
HadoopCredentialProvider { public static char[] getValue(Configuration conf, String alias) { requireNonNull(alias); List<CredentialProvider> providerList = getProviders(requireNonNull(conf)); return providerList == null ? null : providerList.stream().map(provider -> { try { return provider.getCredentialEntry(alias); } catch (IOException e) { log.warn("Failed to call getCredentialEntry(alias) for provider {}", provider, e); return null; } }).filter(Objects::nonNull).map(CredentialProvider.CredentialEntry::getCredential).findFirst() .orElseGet(() -> { log.trace("Could not extract credential for {} from providers", alias); return null; }); }  }
HadoopCredentialProvider { public static char[] getValue(Configuration conf, String alias) { requireNonNull(alias); List<CredentialProvider> providerList = getProviders(requireNonNull(conf)); return providerList == null ? null : providerList.stream().map(provider -> { try { return provider.getCredentialEntry(alias); } catch (IOException e) { log.warn("Failed to call getCredentialEntry(alias) for provider {}", provider, e); return null; } }).filter(Objects::nonNull).map(CredentialProvider.CredentialEntry::getCredential).findFirst() .orElseGet(() -> { log.trace("Could not extract credential for {} from providers", alias); return null; }); }  static void setPath(Configuration conf, String path); static char[] getValue(Configuration conf, String alias); static List<String> getKeys(Configuration conf); static void createEntry(Configuration conf, String name, char[] credential); }
HadoopCredentialProvider { public static char[] getValue(Configuration conf, String alias) { requireNonNull(alias); List<CredentialProvider> providerList = getProviders(requireNonNull(conf)); return providerList == null ? null : providerList.stream().map(provider -> { try { return provider.getCredentialEntry(alias); } catch (IOException e) { log.warn("Failed to call getCredentialEntry(alias) for provider {}", provider, e); return null; } }).filter(Objects::nonNull).map(CredentialProvider.CredentialEntry::getCredential).findFirst() .orElseGet(() -> { log.trace("Could not extract credential for {} from providers", alias); return null; }); }  static void setPath(Configuration conf, String path); static char[] getValue(Configuration conf, String alias); static List<String> getKeys(Configuration conf); static void createEntry(Configuration conf, String name, char[] credential);  }