Skip to content

Commit fe4b545

Browse files
committed
Applying patch 17864 to remove the unnecessary try/catch blocks for IOException. Thanks James.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@384971 13f79535-47bb-0310-9956-ffa450edef68
1 parent 279e5a9 commit fe4b545

2 files changed

Lines changed: 12 additions & 18 deletions

File tree

src/java/org/apache/commons/cli2/commandline/Parser.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ public CommandLine parse(final String[] arguments)
117117
* @return a valid CommandLine or null if the parse was unsuccessful
118118
* @throws IOException if an error occurs while formatting help
119119
*/
120-
public CommandLine parseAndHelp(final String[] arguments)
121-
throws IOException {
120+
public CommandLine parseAndHelp(final String[] arguments) {
122121
helpFormatter.setGroup(group);
123122

124123
try {

src/test/org/apache/commons/cli2/DocumentationTest.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -183,26 +183,21 @@ public void testManualIntroduction() {
183183

184184
///////////////////////////////////////////////////
185185

186-
try {
187-
Group options = outputChildren;
188-
HelpFormatter hf = new HelpFormatter();
189-
190-
Parser p = new Parser();
191-
p.setGroup(options);
192-
p.setHelpFormatter(hf);
193-
p.setHelpTrigger("--help");
194-
CommandLine cl = p.parseAndHelp(new String[]{});
195-
if(cl==null) {
196-
System.exit(-1);
197-
}
198-
} catch (IOException e) {
199-
// TODO Auto-generated catch block
200-
e.printStackTrace();
186+
Group options = outputChildren;
187+
HelpFormatter hf = new HelpFormatter();
188+
189+
Parser p = new Parser();
190+
p.setGroup(options);
191+
p.setHelpFormatter(hf);
192+
p.setHelpTrigger("--help");
193+
CommandLine cl = p.parseAndHelp(new String[]{});
194+
if(cl==null) {
195+
System.exit(-1);
201196
}
202197

203198
//////////////////////////////////////////////////
204199

205-
CommandLine cl = new WriteableCommandLineImpl(outputChildren,new ArrayList());
200+
cl = new WriteableCommandLineImpl(outputChildren,new ArrayList());
206201

207202
// if we have --output option
208203
if(cl.hasOption("--output")) {

0 commit comments

Comments
 (0)