Buggy code:
public class OperationRequestCompleter implements CommandLineCompleter { public static final OperationRequestCompleter INSTANCE = new OperationRequestCompleter ( ) ; public static final CommandLineCompleter ARG_VALUE_COMPLETER = new CommandLineCompleter ( ) { final DefaultCallbackHandler parsedOp = new DefaultCallbackHandler ( ) ; @ Override public int complete ( CommandContext ctx , String buffer , int cursor , List < String > candidates ) { } } ; public static final EscapeSelector ESCAPE_SELECTOR = new EscapeSelector ( ) { @ Override public boolean isEscape ( char ch ) { } } ; @ Override public int complete ( CommandContext ctx , final String buffer , int cursor , List < String > candidates ) { } public int complete ( CommandContext ctx , ParsedCommandLine parsedCmd , final String buffer , int cursor , List < String > candidates ) { } public int complete ( CommandContext ctx , ParsedCommandLine parsedCmd , OperationCandidatesProvider candidatesProvider , final String buffer , int cursor , List < String > candidates ) { if ( parsedCmd . isRequestComplete ( ) ) { return - 1 ; } if ( ( parsedCmd . hasProperties ( ) ) || ( parsedCmd . endsOnPropertyListStart ( ) ) ) { <START_BUG> final List < CommandArgument > allArgs = candidatesProvider . getProperties ( ctx , parsedCmd . getOperationName ( ) , parsedCmd . getAddress ( ) ) ; <END_BUG> if ( allArgs . isEmpty ( ) ) { final CommandLineFormat format = parsedCmd . getFormat ( ) ; if ( ( format != null ) && ( ( format . getPropertyListEnd ( ) ) != null ) ) { candidates . add ( format . getPropertyListEnd ( ) ) ; } return buffer . length ( ) ; } try { if ( ! ( parsedCmd . hasProperties ( ) ) ) { for ( CommandArgument arg : allArgs ) { if ( arg . canAppearNext ( ctx ) ) { if ( ( arg . getIndex ( ) ) >= 0 ) { final CommandLineCompleter valCompl = arg . getValueCompleter ( ) ; if ( valCompl != null ) { valCompl . complete ( ctx , "" , 0 , candidates ) ; } } else { String argName = arg . getFullName ( ) ; if ( arg . isValueRequired ( ) ) { argName += '=' ; } candidates . add ( argName ) ; } } } Collections . sort ( candidates ) ; return buffer . length ( ) ; } } catch ( CommandFormatException e ) { return - 1 ; } int result = buffer . length ( ) ; String chunk = null ; CommandLineCompleter valueCompleter = null ; if ( ! ( parsedCmd . endsOnPropertySeparator ( ) ) ) { final String argName = parsedCmd . getLastParsedPropertyName ( ) ; final String argValue = parsedCmd . getLastParsedPropertyValue ( ) ; if ( ( argValue != null ) || ( parsedCmd . endsOnPropertyValueSeparator ( ) ) ) { result = parsedCmd . getLastChunkIndex ( ) ; if ( parsedCmd . endsOnPropertyValueSeparator ( ) ) { ++ result ; } chunk = argValue ; if ( argName != null ) { valueCompleter = getValueCompleter ( ctx , allArgs , argName ) ; } else { valueCompleter = getValueCompleter ( ctx , allArgs , ( ( parsedCmd . getOtherProperties ( ) . size ( ) ) - 1 ) ) ; } if ( valueCompleter == null ) { if ( parsedCmd . endsOnSeparator ( ) ) { return - 1 ; } for ( CommandArgument arg : allArgs ) { try { if ( ( arg . canAppearNext ( ctx ) ) && ( ! ( arg . getFullName ( ) . equals ( argName ) ) ) ) { return - 1 ; } } catch ( CommandFormatException e ) { break ; } } final CommandLineFormat format = parsedCmd . getFormat ( ) ; if ( ( format != null ) && ( ( format . getPropertyListEnd ( ) ) != null ) ) { candidates . add ( format . getPropertyListEnd ( ) ) ; } return buffer . length ( ) ; } } else { chunk = argName ; result = parsedCmd . getLastChunkIndex ( ) ; } } else { chunk = null ; } if ( valueCompleter != null ) { int valueResult = valueCompleter . complete ( ctx , ( chunk == null ? "" : chunk ) , 0 , candidates ) ; if ( valueResult < 0 ) { return valueResult ; } else { return result + valueResult ; } } for ( CommandArgument arg : allArgs ) { try { if ( arg . canAppearNext ( ctx ) ) { if ( ( arg . getIndex ( ) ) >= 0 ) { CommandLineCompleter valCompl = arg . getValueCompleter ( ) ; if ( valCompl != null ) { final String value = ( chunk == null ) ? "" : chunk ; valCompl . complete ( ctx , value , value . length ( ) , candidates ) ; } } else { String argFullName = arg . getFullName ( ) ; if ( chunk == null ) { if ( arg . isValueRequired ( ) ) { argFullName += '=' ; } candidates . add ( argFullName ) ; } else if ( argFullName . startsWith ( chunk ) ) { if ( arg . isValueRequired ( ) ) { argFullName += '=' ; } candidates . add ( argFullName ) ; } } } } catch ( CommandFormatException e ) { e . printStackTrace ( ) ; return - 1 ; } } if ( candidates . isEmpty ( ) ) { if ( ( chunk == null ) && ( ! ( parsedCmd . endsOnSeparator ( ) ) ) ) { final CommandLineFormat format = parsedCmd . getFormat ( ) ;

Fix:
final List < CommandArgument > allArgs = candidatesProvider . getProperties ( ctx , parsedCmd . getOperationName ( ) , ctx . getPrefix ( ) ) ;