Skip to content

Commit 6b87d29

Browse files
committed
PMD: Useless parenthesis
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@1677402 13f79535-47bb-0310-9956-ffa450edef68
1 parent 3382d16 commit 6b87d29

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ protected void handleConcatenatedOptions(String token) throws ParseException
675675
{
676676
handleOption(options.getOption(ch));
677677

678-
if (currentOption != null && (token.length() != (i + 1)))
678+
if (currentOption != null && token.length() != i + 1)
679679
{
680680
// add the trail as an argument of the option
681681
currentOption.addValueForProcessing(token.substring(i + 1));

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ public void printHelp(PrintWriter pw, int width, String cmdLineSyntax,
537537
String header, Options options, int leftPad,
538538
int descPad, String footer, boolean autoUsage)
539539
{
540-
if ((cmdLineSyntax == null) || (cmdLineSyntax.length() == 0))
540+
if (cmdLineSyntax == null || cmdLineSyntax.length() == 0)
541541
{
542542
throw new IllegalArgumentException("cmdLineSyntax not provided");
543543
}
@@ -551,14 +551,14 @@ public void printHelp(PrintWriter pw, int width, String cmdLineSyntax,
551551
printUsage(pw, width, cmdLineSyntax);
552552
}
553553

554-
if ((header != null) && (header.trim().length() > 0))
554+
if (header != null && header.trim().length() > 0)
555555
{
556556
printWrapped(pw, width, header);
557557
}
558558

559559
printOptions(pw, width, options, leftPad, descPad);
560560

561-
if ((footer != null) && (footer.trim().length() > 0))
561+
if (footer != null && footer.trim().length() > 0)
562562
{
563563
printWrapped(pw, width, footer);
564564
}
@@ -837,7 +837,7 @@ protected StringBuffer renderOptions(StringBuffer sb, int width, Options options
837837
}
838838

839839
prefixList.add(optBuf);
840-
max = (optBuf.length() > max) ? optBuf.length() : max;
840+
max = optBuf.length() > max ? optBuf.length() : max;
841841
}
842842

843843
int x = 0;
@@ -917,7 +917,7 @@ protected StringBuffer renderWrappedText(StringBuffer sb, int width,
917917
return sb;
918918
}
919919

920-
if ((text.length() > width) && (pos == nextLineTabStop - 1))
920+
if (text.length() > width && pos == nextLineTabStop - 1)
921921
{
922922
pos = width;
923923
}
@@ -1043,14 +1043,14 @@ protected String createPadding(int len)
10431043
*/
10441044
protected String rtrim(String s)
10451045
{
1046-
if ((s == null) || (s.length() == 0))
1046+
if (s == null || s.length() == 0)
10471047
{
10481048
return s;
10491049
}
10501050

10511051
int pos = s.length();
10521052

1053-
while ((pos > 0) && Character.isWhitespace(s.charAt(pos - 1)))
1053+
while (pos > 0 && Character.isWhitespace(s.charAt(pos - 1)))
10541054
{
10551055
--pos;
10561056
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ private void processValue(String value)
463463
while (index != -1)
464464
{
465465
// next value to be added
466-
if (values.size() == (numberOfArgs - 1))
466+
if (values.size() == numberOfArgs - 1)
467467
{
468468
break;
469469
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ protected void burstToken(String token, boolean stopAtNonOption)
276276
tokens.add("-" + ch);
277277
currentOption = options.getOption(ch);
278278

279-
if (currentOption.hasArg() && (token.length() != (i + 1)))
279+
if (currentOption.hasArg() && token.length() != i + 1)
280280
{
281281
tokens.add(token.substring(i + 1));
282282

0 commit comments

Comments
 (0)