Skip to content

Commit 3d83402

Browse files
committed
Use try-with-resources.
- Fix Javadoc warning. - Checkstyle.
1 parent b805e90 commit 3d83402

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/main/java/org/apache/commons/cli/Option.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ private void add(final String value) {
412412
* @param value the value to add
413413
* @return always throws an {@link UnsupportedOperationException}
414414
* @throws UnsupportedOperationException always
415-
* @deprecated
415+
* @deprecated Unused.
416416
*/
417417
@Deprecated
418418
public boolean addValue(final String value) {

src/test/java/org/apache/commons/cli/HelpFormatterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public void testPrintUsage() {
458458
opts.addOption(optionC);
459459
final HelpFormatter helpFormatter = new HelpFormatter();
460460
final ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
461-
try (final PrintWriter printWriter = new PrintWriter(bytesOut)) {
461+
try (PrintWriter printWriter = new PrintWriter(bytesOut)) {
462462
helpFormatter.printUsage(printWriter, 80, "app", opts);
463463
}
464464
assertEquals("usage: app [-a] [-b] [-c]" + EOL, bytesOut.toString());

src/test/java/org/apache/commons/cli/TypeHandlerTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ public void testCreateValueDate() throws Exception {
5555

5656
@Test
5757
public void testCreateValueExistingFile() throws Exception {
58-
final FileInputStream result = TypeHandler.createValue("src/test/resources/org/apache/commons/cli/existing-readable.file",
59-
PatternOptionBuilder.EXISTING_FILE_VALUE);
60-
assertNotNull(result);
58+
try (FileInputStream result = TypeHandler.createValue("src/test/resources/org/apache/commons/cli/existing-readable.file",
59+
PatternOptionBuilder.EXISTING_FILE_VALUE)) {
60+
assertNotNull(result);
61+
}
6162
}
6263

6364
@Test(expected = ParseException.class)

0 commit comments

Comments
 (0)