Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed stream has already been operated upon or closed exception #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
*/
public class CompositeX509KeyManager implements X509KeyManager {

private final Stream<X509KeyManager> children;
private final X509KeyManager[] children;

public CompositeX509KeyManager(X509KeyManager... children) {
this.children = stream(children);
this.children = children;
}

@Override
Expand All @@ -41,7 +41,8 @@ public PrivateKey getPrivateKey(String alias) {
}

private <TOut> TOut getFirstNonNull(Function<X509KeyManager, TOut> map) {
return children.map(map)
return stream(children)
.map(map)
.filter(x -> x != null)
.findFirst().orElse(null);
}
Expand All @@ -57,7 +58,7 @@ public String[] getServerAliases(String keyType, Principal[] issuers) {
}

private String[] merge(Function<X509KeyManager, String[]> map) {
return children
return stream(children)
.flatMap(x -> stream(map.apply(x)))
.toArray(size -> new String[size]);
}
Expand Down