提交 1ef6b198 编写于 作者: X xuelei

7029848: KeyStoreBuilderParameters((Builder)null) does not throw NullPointerException

Summary: throws NPE for null Builder
Reviewed-by: weijun
上级 163f875e
/*
* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -51,7 +51,7 @@ public class KeyStoreBuilderParameters implements ManagerFactoryParameters {
* @exception NullPointerException if builder is null
*/
public KeyStoreBuilderParameters(Builder builder) {
parameters = Collections.singletonList(builder);
parameters = Collections.singletonList(Objects.requireNonNull(builder));
}
/**
......@@ -64,11 +64,12 @@ public class KeyStoreBuilderParameters implements ManagerFactoryParameters {
* @exception IllegalArgumentException if parameters is an empty list
*/
public KeyStoreBuilderParameters(List<Builder> parameters) {
this.parameters = Collections.unmodifiableList(
new ArrayList<Builder>(parameters));
if (this.parameters.isEmpty()) {
throw new IllegalArgumentException();
}
this.parameters = Collections.unmodifiableList(
new ArrayList<Builder>(parameters));
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册