src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionArgumentConversionException.java
equal
deleted
inserted
replaced
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 a problem occurs converting an argument of an option from {@link String} to another type. |
61 * Thrown when a problem occurs converting an argument of an option from {@link String} to another type. |
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> |
65 class OptionArgumentConversionException extends OptionException { |
65 class OptionArgumentConversionException extends OptionException { |
66 private static final long serialVersionUID = -1L; |
66 private static final long serialVersionUID = -1L; |
67 |
67 |
68 private final String argument; |
68 private final String argument; |
69 |
69 |
70 OptionArgumentConversionException( Collection<String> options, String argument, Throwable cause ) { |
70 OptionArgumentConversionException( OptionSpec<?> options, String argument, Throwable cause ) { |
71 super( options, cause ); |
71 super( singleton( options ), cause ); |
72 |
72 |
73 this.argument = argument; |
73 this.argument = argument; |
74 } |
74 } |
75 |
75 |
76 @Override |
76 @Override |
77 public String getMessage() { |
77 Object[] messageArguments() { |
78 return "Cannot parse argument '" + argument + "' of option " + multipleOptionMessage(); |
78 return new Object[] { argument, singleOptionString() }; |
79 } |
79 } |
80 } |
80 } |