File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
src/main/java/org/apache/commons/cli Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -191,9 +191,6 @@ public Builder desc(final String description) {
191191 * @throws IllegalStateException if neither {@code opt} or {@code longOpt} has been set.
192192 */
193193 public Option get () {
194- if (option == null && longOption == null ) {
195- throw new IllegalStateException ("Either opt or longOpt must be specified" );
196- }
197194 return new Option (this );
198195 }
199196
@@ -436,8 +433,12 @@ public static Builder builder(final String option) {
436433 * Private constructor used by the nested Builder class.
437434 *
438435 * @param builder builder used to create this option.
436+ * @throws IllegalStateException if neither {@code opt} or {@code longOpt} has been set.
439437 */
440438 private Option (final Builder builder ) {
439+ if (builder .option == null && builder .longOption == null ) {
440+ throw new IllegalStateException ("Either opt or longOpt must be specified" );
441+ }
441442 this .argName = builder .argName ;
442443 this .description = builder .description ;
443444 this .longOption = builder .longOption ;
You can’t perform that action at this time.
0 commit comments