11// ------------------------------------------------------------------------------
22// Copyright (c) 2017 Microsoft Corporation
3- //
3+ //
44// Permission is hereby granted, free of charge, to any person obtaining a copy
55// of this software and associated documentation files (the "Software"), to deal
66// in the Software without restriction, including without limitation the rights
77// to use, copy, modify, merge, publish, distribute, sub-license, and/or sell
88// copies of the Software, and to permit persons to whom the Software is
99// furnished to do so, subject to the following conditions:
10- //
10+ //
1111// The above copyright notice and this permission notice shall be included in
1212// all copies or substantial portions of the Software.
13- //
13+ //
1414// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1515// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1616// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -41,18 +41,24 @@ public class Option {
4141
4242 /**
4343 * Creates an option object
44- *
44+ *
4545 * @param name the name of the option
4646 * @param value the value of the option
4747 */
4848 protected Option (@ Nonnull final String name , @ Nonnull final Object value ) {
49+ if (name == null || name == "" ) {
50+ throw new IllegalArgumentException ("name should not be null or empty" );
51+ }
52+ if (value == null ) {
53+ throw new IllegalArgumentException ("value should not be null" );
54+ }
4955 this .name = name ;
5056 this .value = value ;
5157 }
5258
5359 /**
5460 * Gets the name of the option
55- *
61+ *
5662 * @return the name of the option
5763 */
5864 @ Nonnull
@@ -62,7 +68,7 @@ public String getName() {
6268
6369 /**
6470 * Gets the value of the option
65- *
71+ *
6672 * @return the value of the option
6773 */
6874 @ Nonnull
0 commit comments