Program: 151625
Project: 151625
Buggy source:
@Override public void complete(final CommandCompleterState st){
  PluginCommandCompleterState state=((PluginCommandCompleterState)st);
  OptionMetadata option=state.getOption();
  if ((option != null) && (state.getCommandContext() != null)) {
    CommandParserContext commandContext=state.getCommandContext();
    Map<OptionMetadata,Object> valueMap=commandContext.getValueMap();
    if (valueMap.isEmpty() || valueMap.containsKey(option)) {
      if (option.hasCustomCompleter()) {
        CommandCompleter completer=BeanManagerUtils.getContextualInstance(manager,option.getCompleterType());
        completer.complete(state);
      }
      if (option.isEnum()) {
        @SuppressWarnings("String_Node_Str") EnumCompleter completer=new EnumCompleter((Class<Enum<?>>)option.getType());
        completer.complete(state);
      }
 else       if (isResourceAssignable(option)) {
        ArrayList<String> results=new ArrayList<String>();
        String[] values;
        if (valueMap.isEmpty()) {
          values=new String[]{"String_Node_Str"};
        }
 else         if (valueMap.get(option) instanceof String[]) {
          values=(String[])valueMap.get(option);
        }
 else         if (valueMap.get(option) == null) {
          values=new String[]{"String_Node_Str"};
        }
 else {
          values=new String[]{String.valueOf(valueMap.get(option))};
        }
        String val=values[values.length - 1];
        for (        Resource<?> r : new PathspecParser(resourceFactory,shell.getCurrentResource(),val + "String_Node_Str").resolve()) {
          String name=("String_Node_Str".equals(val) ? "String_Node_Str" : "String_Node_Str") + r.getName() + (r.isFlagSet(ResourceFlag.Node) ? "String_Node_Str" : "String_Node_Str");
          results.add(name);
        }
        int lastNest=val.lastIndexOf(File.separatorChar);
        state.setIndex(state.getIndex() - val.length() + (lastNest != -1 ? lastNest + 1 : 0));
        state.getCandidates().addAll(results);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void complete(final CommandCompleterState st){
  PluginCommandCompleterState state=((PluginCommandCompleterState)st);
  OptionMetadata option=state.getOption();
  if ((option != null) && (state.getCommandContext() != null)) {
    CommandParserContext commandContext=state.getCommandContext();
    Map<OptionMetadata,Object> valueMap=commandContext.getValueMap();
    if (valueMap.isEmpty() || valueMap.containsKey(option)) {
      if (option.hasCustomCompleter()) {
        CommandCompleter completer=BeanManagerUtils.getContextualInstance(manager,option.getCompleterType());
        completer.complete(state);
      }
 else       if (option.isEnum()) {
        @SuppressWarnings("String_Node_Str") EnumCompleter completer=new EnumCompleter((Class<Enum<?>>)option.getType());
        completer.complete(state);
      }
 else       if (isResourceAssignable(option)) {
        ArrayList<String> results=new ArrayList<String>();
        String[] values;
        if (valueMap.isEmpty()) {
          values=new String[]{"String_Node_Str"};
        }
 else         if (valueMap.get(option) instanceof String[]) {
          values=(String[])valueMap.get(option);
        }
 else         if (valueMap.get(option) == null) {
          values=new String[]{"String_Node_Str"};
        }
 else {
          values=new String[]{String.valueOf(valueMap.get(option))};
        }
        String val=values[values.length - 1];
        for (        Resource<?> r : new PathspecParser(resourceFactory,shell.getCurrentResource(),val + "String_Node_Str").resolve()) {
          String name=("String_Node_Str".equals(val) ? "String_Node_Str" : "String_Node_Str") + r.getName() + (r.isFlagSet(ResourceFlag.Node) ? "String_Node_Str" : "String_Node_Str");
          results.add(name);
        }
        int lastNest=val.lastIndexOf(File.separatorChar);
        state.setIndex(state.getIndex() - val.length() + (lastNest != -1 ? lastNest + 1 : 0));
        state.getCandidates().addAll(results);
      }
    }
  }
}