src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/MultipleArgumentsForOptionException.java
changeset 50428 8c88df2e8a78
parent 47216 71c04702a3d5
equal deleted inserted replaced
50427:b06f330492cd 50428:8c88df2e8a78
    29  * However, the following notice accompanied the original version of this
    29  * However, the following notice accompanied the original version of this
    30  * file:
    30  * file:
    31  *
    31  *
    32  * The MIT License
    32  * The MIT License
    33  *
    33  *
    34  * Copyright (c) 2004-2014 Paul R. Holser, Jr.
    34  * Copyright (c) 2004-2015 Paul R. Holser, Jr.
    35  *
    35  *
    36  * Permission is hereby granted, free of charge, to any person obtaining
    36  * Permission is hereby granted, free of charge, to any person obtaining
    37  * a copy of this software and associated documentation files (the
    37  * a copy of this software and associated documentation files (the
    38  * "Software"), to deal in the Software without restriction, including
    38  * "Software"), to deal in the Software without restriction, including
    39  * without limitation the rights to use, copy, modify, merge, publish,
    39  * without limitation the rights to use, copy, modify, merge, publish,
    53  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    53  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    54  */
    54  */
    55 
    55 
    56 package jdk.internal.joptsimple;
    56 package jdk.internal.joptsimple;
    57 
    57 
    58 import java.util.Collection;
    58 import static java.util.Collections.*;
    59 
    59 
    60 /**
    60 /**
    61  * Thrown when asking an {@link OptionSet} for a single argument of an option when many have been specified.
    61  * Thrown when asking an {@link OptionSet} for a single argument of an option when many have been specified.
    62  *
    62  *
    63  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
    63  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
    64  */
    64  */
    65 class MultipleArgumentsForOptionException extends OptionException {
    65 class MultipleArgumentsForOptionException extends OptionException {
    66     private static final long serialVersionUID = -1L;
    66     private static final long serialVersionUID = -1L;
    67 
    67 
    68     MultipleArgumentsForOptionException( Collection<String> options ) {
    68     MultipleArgumentsForOptionException( OptionSpec<?> options ) {
    69         super( options );
    69         super( singleton( options ) );
    70     }
    70     }
    71 
    71 
    72     @Override
    72     @Override
    73     public String getMessage() {
    73     Object[] messageArguments() {
    74         return "Found multiple arguments for option " + multipleOptionMessage() + ", but you asked for only one";
    74         return new Object[] { singleOptionString() };
    75     }
    75     }
    76 }
    76 }