Buggy code:
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 ( ) ; if ( ( format != null ) && ( ( format . getPropertyListEnd ( ) ) != null ) ) { candidates . add ( format . getPropertyListEnd ( ) ) ; } } } else { Collections . sort ( candidates ) ; } return result ; } if ( ( parsedCmd . hasOperationName ( ) ) || ( parsedCmd . endsOnAddressOperationNameSeparator ( ) ) ) { if ( parsedCmd . getAddress ( ) . endsOnType ( ) ) { return - 1 ; } final Collection < String > names = candidatesProvider . getOperationNames ( ctx , parsedCmd . getAddress ( ) ) ; if ( names . isEmpty ( ) ) { return - 1 ; } final String chunk = parsedCmd . getOperationName ( ) ; if ( chunk == null ) { candidates . addAll ( names ) ; } else { for ( String name : names ) { if ( ( chunk == null ) || ( name . startsWith ( chunk ) ) ) { candidates . add ( name ) ; } } } Collections . sort ( candidates ) ; if ( parsedCmd . endsOnSeparator ( ) ) { <START_BUG> return ( parsedCmd . getLastSeparatorIndex ( ) ) + 1 ; <END_BUG> } else { return parsedCmd . getLastChunkIndex ( ) ; } } final OperationRequestAddress address = parsedCmd . getAddress ( ) ; if ( buffer . endsWith ( ".." ) ) { return - 1 ; } final String chunk ; if ( ( ( ( address . isEmpty ( ) ) || ( parsedCmd . endsOnNodeSeparator ( ) ) ) || ( parsedCmd . endsOnNodeTypeNameSeparator ( ) ) ) || ( address . equals ( ctx . getCurrentNodePath ( ) ) ) ) { chunk = null ; } else if ( address . endsOnType ( ) ) { chunk = address . getNodeType ( ) ; address . toParentNode ( ) ; } else { chunk = address . toNodeType ( ) ; } final Collection < String > names ; if ( address . endsOnType ( ) ) { names = candidatesProvider . getNodeNames ( ctx , address ) ; } else { names = candidatesProvider . getNodeTypes ( ctx , address ) ; } if ( names . isEmpty ( ) ) { return - 1 ; } if ( chunk == null ) { candidates . addAll ( names ) ; } else { for ( String name : names ) { if ( ( chunk == null ) || ( name . startsWith ( chunk ) ) ) { candidates . add ( name ) ; } } } if ( ( candidates . size ( ) ) == 1 ) { if ( address . endsOnType ( ) ) { candidates . set ( 0 , Util . escapeString ( candidates . get ( 0 ) , OperationRequestCompleter . ESCAPE_SELECTOR ) ) ; } else { candidates . set ( 0 , ( ( Util . escapeString ( candidates . get ( 0 ) , OperationRequestCompleter . ESCAPE_SELECTOR ) ) + '=' ) ) ; } } else { Util . sortAndEscape ( candidates , OperationRequestCompleter . ESCAPE_SELECTOR ) ; }

Fix:
return buffer . length ( ) ;