@@ -306,7 +306,7 @@ private Appendable renderWrappedTextBlock(StringBuffer sb, int width, int nextLi
306
306
*
307
307
* @return the StringBuffer with the rendered Options contents.
308
308
*/
309
- protected StringBuffer renderWrappedText (StringBuffer sb , int width , final int nextLineTabStop , String text ) {
309
+ protected StringBuffer renderWrappedText (final StringBuffer sb , final int width , final int nextLineTabStop , final String text ) {
310
310
int pos = findWrapPos (text , width , 0 );
311
311
312
312
if (pos == -1 ) {
@@ -328,21 +328,22 @@ protected StringBuffer renderWrappedText(StringBuffer sb, int width, final int n
328
328
// characters
329
329
final String padding = createPadding (currentNextLineTabStop );
330
330
331
+ String newText = text ;
331
332
while (true ) {
332
- text = padding + text .substring (pos ).trim ();
333
- pos = findWrapPos (text , width , 0 );
333
+ newText = padding + newText .substring (pos ).trim ();
334
+ pos = findWrapPos (newText , width , 0 );
334
335
335
336
if (pos == -1 ) {
336
- sb .append (text );
337
+ sb .append (newText );
337
338
338
339
return sb ;
339
340
}
340
341
341
- if (text .length () > width && pos == currentNextLineTabStop - 1 ) {
342
+ if (newText .length () > width && pos == currentNextLineTabStop - 1 ) {
342
343
pos = width ;
343
344
}
344
345
345
- sb .append (rtrim (text .substring (0 , pos ))).append (getNewLine ());
346
+ sb .append (rtrim (newText .substring (0 , pos ))).append (getNewLine ());
346
347
}
347
348
}
348
349
@@ -529,9 +530,10 @@ protected StringBuffer renderCommands(StringBuffer sb, int width, ApiCommands[]
529
530
int max = 0 ;
530
531
531
532
List <StringBuffer > prefixList = new ArrayList <StringBuffer >();
533
+ StringBuffer optBuf ;
532
534
for (ApiCommands cmds : commands ) {
533
535
ApiCommand command = cmds .getCommand ();
534
- StringBuffer optBuf = new StringBuffer ();
536
+ optBuf = new StringBuffer ();
535
537
536
538
optBuf .append (lpad ).append (command .getConsoleShortCommand ());
537
539
optBuf .append (", " ).append (command .getConsoleCommand ());
@@ -546,9 +548,10 @@ protected StringBuffer renderCommands(StringBuffer sb, int width, ApiCommands[]
546
548
547
549
int x = 0 ;
548
550
551
+ StringBuilder opt2Buf ;
549
552
for (Iterator <ApiCommands > it = Arrays .asList (commands ).iterator (); it .hasNext ();) {
550
553
ApiCommands option = it .next ();
551
- StringBuilder opt2Buf = new StringBuilder (prefixList .get (x ++).toString ());
554
+ opt2Buf = new StringBuilder (prefixList .get (x ++).toString ());
552
555
553
556
if (opt2Buf .length () < max ) {
554
557
opt2Buf .append (createPadding (max - opt2Buf .length ()));
0 commit comments