Program: 167494
Project: 167494
Buggy source:
public Diagram(){
  setPrimaryStyleName("String_Node_Str");
  setId("String_Node_Str");
  addFunction("String_Node_Str",new JavaScriptFunction(){
    private static final long serialVersionUID=1L;
    @Override public void call(    JsonArray arguments){
      if (arguments.length() > 0) {
        Object obj=arguments.get(0);
        if (obj instanceof JsonObject) {
          JsonObject json=arguments.getObject(0);
          String sourceNodeId=json.getString("String_Node_Str");
          String targetNodeId=json.getString("String_Node_Str");
          fireEvent(new LinkSelectedEvent(Diagram.this,sourceNodeId,targetNodeId));
        }
      }
    }
  }
);
  addFunction("String_Node_Str",new JavaScriptFunction(){
    private static final long serialVersionUID=1L;
    @Override public void call(    JsonArray arguments){
      if (arguments.length() > 0) {
        Object obj=arguments.get(0);
        if (obj instanceof JsonObject) {
          JsonObject json=arguments.getObject(0);
          String id=json.getString("String_Node_Str");
          DiagramState state=getState();
          for (          Node node : state.nodes) {
            if (node.getId().equals(id)) {
              state.selectedNodeId=id;
              fireEvent(new NodeSelectedEvent(Diagram.this,node));
              break;
            }
          }
        }
      }
    }
  }
);
  addFunction("String_Node_Str",new JavaScriptFunction(){
    private static final long serialVersionUID=1L;
    @Override public void call(    JsonArray arguments){
      if (arguments.length() > 0) {
        Object obj=arguments.get(0);
        if (obj instanceof JsonObject) {
          JsonObject json=arguments.getObject(0);
          String id=json.getString("String_Node_Str");
          DiagramState state=getState();
          for (          Node node : state.nodes) {
            if (node.getId().equals(id)) {
              fireEvent(new NodeDoubleClickedEvent(Diagram.this,node));
              break;
            }
          }
        }
      }
    }
  }
);
  addFunction("String_Node_Str",new JavaScriptFunction(){
    private static final long serialVersionUID=1L;
    @Override public void call(    JsonArray arguments){
      if (arguments.length() > 0) {
        Object obj=arguments.get(0);
        if (obj instanceof JsonObject) {
          JsonObject json=arguments.getObject(0);
          String id=json.getString("String_Node_Str");
          double x=json.getNumber("String_Node_Str");
          double y=json.getNumber("String_Node_Str");
          DiagramState state=getState();
          for (          Node node : state.nodes) {
            if (node.getId().equals(id)) {
              node.setX((int)x);
              node.setY((int)y);
              fireEvent(new NodeMovedEvent(Diagram.this,node));
              break;
            }
          }
        }
      }
    }
  }
);
  addFunction("String_Node_Str",new JavaScriptFunction(){
    private static final long serialVersionUID=1L;
    @Override public void call(    JsonArray arguments){
      if (arguments.length() > 0) {
        Object obj=arguments.get(0);
        if (obj instanceof JsonObject) {
          JsonObject json=arguments.getObject(0);
          String sourceNodeId=json.getString("String_Node_Str");
          String targetNodeId=json.getString("String_Node_Str");
          boolean removed=json.getBoolean("String_Node_Str");
          DiagramState state=getState();
          for (          Node node : state.nodes) {
            if (node.getId().equals(sourceNodeId)) {
              if (!removed && !node.getTargetNodeIds().contains(targetNodeId)) {
                node.getTargetNodeIds().add(targetNodeId);
              }
 else               if (removed) {
                node.getTargetNodeIds().remove(targetNodeId);
              }
              fireEvent(new LinkEvent(Diagram.this,sourceNodeId,targetNodeId,removed));
              break;
            }
          }
        }
      }
    }
  }
);
}

Fixed version (ground truth):
public Diagram(){
  setPrimaryStyleName("String_Node_Str");
  setId("String_Node_Str");
  addFunction("String_Node_Str",new JavaScriptFunction(){
    private static final long serialVersionUID=1L;
    @Override public void call(    JsonArray arguments){
      if (arguments.length() > 0) {
        Object obj=arguments.get(0);
        if (obj instanceof JsonObject) {
          JsonObject json=arguments.getObject(0);
          String sourceNodeId=json.getString("String_Node_Str");
          String targetNodeId=json.getString("String_Node_Str");
          fireEvent(new LinkSelectedEvent(Diagram.this,sourceNodeId,targetNodeId));
        }
      }
    }
  }
);
  addFunction("String_Node_Str",new JavaScriptFunction(){
    private static final long serialVersionUID=1L;
    @Override public void call(    JsonArray arguments){
      if (arguments.length() > 0) {
        Object obj=arguments.get(0);
        if (obj instanceof JsonObject) {
          JsonObject json=arguments.getObject(0);
          String id=json.getString("String_Node_Str");
          DiagramState state=getState();
          for (          Node node : state.nodes) {
            if (node.getId().equals(id)) {
              state.selectedNodeId=id;
              fireEvent(new NodeSelectedEvent(Diagram.this,node));
              break;
            }
          }
        }
      }
    }
  }
);
  addFunction("String_Node_Str",new JavaScriptFunction(){
    private static final long serialVersionUID=1L;
    @Override public void call(    JsonArray arguments){
      if (arguments.length() > 0) {
        Object obj=arguments.get(0);
        if (obj instanceof JsonObject) {
          JsonObject json=arguments.getObject(0);
          String id=json.getString("String_Node_Str");
          DiagramState state=getState();
          for (          Node node : state.nodes) {
            if (node.getId().equals(id)) {
              fireEvent(new NodeDoubleClickedEvent(Diagram.this,node));
              break;
            }
          }
        }
      }
    }
  }
);
  addFunction("String_Node_Str",new JavaScriptFunction(){
    private static final long serialVersionUID=1L;
    @Override public void call(    JsonArray arguments){
      if (arguments.length() > 0) {
        Object obj=arguments.get(0);
        if (obj instanceof JsonObject) {
          JsonObject json=arguments.getObject(0);
          String id=json.getString("String_Node_Str");
          double x=json.getNumber("String_Node_Str");
          double y=json.getNumber("String_Node_Str");
          DiagramState state=getState();
          for (          Node node : state.nodes) {
            if (node.getId().equals(id)) {
              node.setX((int)x);
              node.setY((int)y);
              fireEvent(new NodeMovedEvent(Diagram.this,node));
              break;
            }
          }
        }
      }
    }
  }
);
  addFunction("String_Node_Str",new JavaScriptFunction(){
    private static final long serialVersionUID=1L;
    @Override public void call(    JsonArray arguments){
      if (arguments.length() > 0) {
        Object obj=arguments.get(0);
        if (obj instanceof JsonObject) {
          JsonObject json=arguments.getObject(0);
          String sourceNodeId=json.getString("String_Node_Str");
          String targetNodeId=json.getString("String_Node_Str");
          boolean removed=json.getBoolean("String_Node_Str");
          DiagramState state=getState();
          for (          Node node : state.nodes) {
            if (node.getId().equals(sourceNodeId)) {
              if (!removed && !node.getTargetNodeIds().contains(targetNodeId)) {
                node.getTargetNodeIds().add(targetNodeId);
              }
 else               if (removed) {
                node.getTargetNodeIds().remove(targetNodeId);
              }
              fireEvent(new LinkEvent(Diagram.this,sourceNodeId,targetNodeId,removed));
              break;
            }
          }
        }
      }
    }
  }
);
  addFunction("String_Node_Str",new JavaScriptFunction(){
    private static final long serialVersionUID=1L;
    @Override public void call(    JsonArray arguments){
      if (arguments.length() > 0) {
        Object obj=arguments.get(0);
        if (obj instanceof JsonObject) {
          JsonObject json=arguments.getObject(0);
          String sourceNodeId=json.getString("String_Node_Str");
          String targetNodeId=json.getString("String_Node_Str");
          String origSourceNodeId=json.getString("String_Node_Str");
          String origTargetNodeId=json.getString("String_Node_Str");
          DiagramState state=getState();
          for (          Node node : state.nodes) {
            if (node.getId().equals(sourceNodeId)) {
              if (!node.getTargetNodeIds().contains(targetNodeId)) {
                node.getTargetNodeIds().add(targetNodeId);
              }
              fireEvent(new LinkEvent(Diagram.this,sourceNodeId,targetNodeId,false));
              break;
            }
          }
          for (          Node node : state.nodes) {
            if (node.getId().equals(origSourceNodeId)) {
              node.getTargetNodeIds().remove(origTargetNodeId);
              fireEvent(new LinkEvent(Diagram.this,origSourceNodeId,origTargetNodeId,true));
              break;
            }
          }
        }
      }
    }
  }
);
}