nus-yam/ex-repair huggingface dataset:
Program: 62612
Project: 62612
Buggy source:
public String getActiveChannelListAsString(){
  String channelList="String_Node_Str";
  for (  Channel channel : getThing().getChannels()) {
    if (channel.isLinked()) {
      if (channelList.length() > 0)       channelList=channelList + "String_Node_Str" + channel.getUID().getId();
 else       channelList=channel.getUID().getId();
    }
  }
  return channelList;
}

Fixed version (ground truth):
public String getActiveChannelListAsString(){
  String channelList="String_Node_Str";
  for (  Channel channel : getThing().getChannels()) {
    if (isLinked(channel.getUID().getId())) {
      if (channelList.length() > 0) {
        channelList=channelList + "String_Node_Str" + channel.getUID().getId();
      }
 else {
        channelList=channel.getUID().getId();
      }
    }
  }
  return channelList;
}
Program: 62613
Project: 62613
Buggy source:
public void updateStatus(ThingStatus status){
  super.updateStatus(status);
}

Fixed version (ground truth):
@Override public void updateStatus(ThingStatus status){
  super.updateStatus(status);
}
Program: 62614
Project: 62614
Buggy source:
public void bridgeHandlerInitialized(ThingHandler thingHandler,Bridge bridge){
  logger.debug("String_Node_Str",getThing().getUID().getId());
  if (thingHandler instanceof VitotronicBridgeHandler) {
    this.bridgeHandler=(VitotronicBridgeHandler)thingHandler;
  }
 else {
    logger.debug("String_Node_Str",thingHandler.toString());
    this.bridgeHandler=null;
  }
  registerVitotronicThingListener(this.bridgeHandler);
}

Fixed version (ground truth):
@Override public void bridgeHandlerInitialized(ThingHandler thingHandler,Bridge bridge){
  logger.debug("String_Node_Str",getThing().getUID().getId());
  if (thingHandler instanceof VitotronicBridgeHandler) {
    this.bridgeHandler=(VitotronicBridgeHandler)thingHandler;
  }
 else {
    logger.debug("String_Node_Str",thingHandler.toString());
    this.bridgeHandler=null;
  }
  registerVitotronicThingListener(this.bridgeHandler);
}
Program: 62615
Project: 62615
Buggy source:
private void unregisterVitotronicThingListener(VitotronicBridgeHandler bridgeHandler){
  if (bridgeHandler != null)   bridgeHandler.unregisterThingListener(this);
 else   logger.debug("String_Node_Str",this.getThing().getUID());
}

Fixed version (ground truth):
private void unregisterVitotronicThingListener(VitotronicBridgeHandler bridgeHandler){
  if (bridgeHandler != null) {
    bridgeHandler.unregisterThingListener(this);
  }
 else {
    logger.debug("String_Node_Str",this.getThing().getUID());
  }
}
Program: 62616
Project: 62616
Buggy source:
private void registerVitotronicThingListener(VitotronicBridgeHandler bridgeHandler){
  if (bridgeHandler != null)   bridgeHandler.registerVitotronicThingListener(this);
 else   logger.debug("String_Node_Str",this.getThing().getUID());
}

Fixed version (ground truth):
private void registerVitotronicThingListener(VitotronicBridgeHandler bridgeHandler){
  if (bridgeHandler != null) {
    bridgeHandler.registerVitotronicThingListener(this);
  }
 else {
    logger.debug("String_Node_Str",this.getThing().getUID());
  }
}
Program: 62618
Project: 62618
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public List<SerialMessage> executeRefresh(ZWaveThingChannel channel,ZWaveNode node){
  ZWaveThermostatFanStateCommandClass commandClass=(ZWaveThermostatFanStateCommandClass)node.resolveCommandClass(ZWaveCommandClass.CommandClass.THERMOSTAT_FAN_MODE,channel.getEndpoint());
  if (commandClass == null) {
    return null;
  }
  logger.debug("String_Node_Str",node.getNodeId(),commandClass.getCommandClass().getLabel(),channel.getEndpoint());
  SerialMessage serialMessage=node.encapsulate(commandClass.getValueMessage(),commandClass,channel.getEndpoint());
  List<SerialMessage> response=new ArrayList<SerialMessage>(1);
  response.add(serialMessage);
  return response;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public List<SerialMessage> executeRefresh(ZWaveThingChannel channel,ZWaveNode node){
  ZWaveThermostatFanStateCommandClass commandClass=(ZWaveThermostatFanStateCommandClass)node.resolveCommandClass(ZWaveCommandClass.CommandClass.THERMOSTAT_FAN_STATE,channel.getEndpoint());
  if (commandClass == null) {
    return null;
  }
  logger.debug("String_Node_Str",node.getNodeId(),commandClass.getCommandClass().getLabel(),channel.getEndpoint());
  SerialMessage serialMessage=node.encapsulate(commandClass.getValueMessage(),commandClass,channel.getEndpoint());
  List<SerialMessage> response=new ArrayList<SerialMessage>(1);
  response.add(serialMessage);
  return response;
}
Program: 62619
Project: 62619
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public List<SerialMessage> executeRefresh(ZWaveThingChannel channel,ZWaveNode node){
  ZWaveThermostatSetpointCommandClass commandClass=(ZWaveThermostatSetpointCommandClass)node.resolveCommandClass(ZWaveCommandClass.CommandClass.THERMOSTAT_SETPOINT,channel.getEndpoint());
  if (commandClass == null) {
    return null;
  }
  logger.debug("String_Node_Str",node.getNodeId(),commandClass.getCommandClass().getLabel(),channel.getEndpoint());
  String setpointType=channel.getArguments().get("String_Node_Str");
  SerialMessage serialMessage;
  if (setpointType != null) {
    serialMessage=node.encapsulate(commandClass.getMessage(SetpointType.getSetpointType(Integer.parseInt(setpointType))),commandClass,channel.getEndpoint());
  }
 else {
    serialMessage=node.encapsulate(commandClass.getValueMessage(),commandClass,channel.getEndpoint());
  }
  List<SerialMessage> response=new ArrayList<SerialMessage>(1);
  response.add(serialMessage);
  return response;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public List<SerialMessage> executeRefresh(ZWaveThingChannel channel,ZWaveNode node){
  ZWaveThermostatSetpointCommandClass commandClass=(ZWaveThermostatSetpointCommandClass)node.resolveCommandClass(ZWaveCommandClass.CommandClass.THERMOSTAT_SETPOINT,channel.getEndpoint());
  if (commandClass == null) {
    return null;
  }
  logger.debug("String_Node_Str",node.getNodeId(),commandClass.getCommandClass().getLabel(),channel.getEndpoint());
  String setpointType=channel.getArguments().get("String_Node_Str");
  SerialMessage serialMessage;
  if (setpointType != null) {
    serialMessage=node.encapsulate(commandClass.getMessage(SetpointType.getSetpointType(setpointType)),commandClass,channel.getEndpoint());
  }
 else {
    serialMessage=node.encapsulate(commandClass.getValueMessage(),commandClass,channel.getEndpoint());
  }
  List<SerialMessage> response=new ArrayList<SerialMessage>(1);
  response.add(serialMessage);
  return response;
}
Program: 62620
Project: 62620
Buggy source:
private static void initMapping(){
  codeToSetpointTypeMapping=new HashMap<Integer,SetpointType>();
  for (  SetpointType s : values()) {
    codeToSetpointTypeMapping.put(s.key,s);
  }
}

Fixed version (ground truth):
private static void initMapping(){
  codeToSetpointTypeMapping=new HashMap<Integer,SetpointType>();
  nameToSetpointTypeMapping=new HashMap<>();
  for (  SetpointType s : values()) {
    codeToSetpointTypeMapping.put(s.key,s);
    nameToSetpointTypeMapping.put(s.name().toLowerCase(),s);
  }
}
Program: 62622
Project: 62622
Buggy source:
/** 
 * Returns the Base64 encoded command string to be sent via the MAX! protocol.
 * @return the string representing the command
 */
@Override public String getCommandString(){
  String commandString=baseString + rfAddress + Utils.toHex(roomId)+ Utils.toHex(bits);
  String encodedString=Base64.encodeBase64String(Utils.hexStringToByteArray(commandString));
  return "String_Node_Str" + encodedString;
}

Fixed version (ground truth):
/** 
 * Returns the Base64 encoded command string to be sent via the MAX! protocol.
 * @return the string representing the command
 */
@Override public String getCommandString(){
  String baseString="String_Node_Str";
  if (roomId == 0) {
    baseString=baseStringS;
  }
 else {
    baseString=baseStringG;
  }
  String commandString=baseString + rfAddress + Utils.toHex(roomId)+ Utils.toHex(bits);
  String encodedString=Base64.encodeBase64String(Utils.hexStringToByteArray(commandString));
  return "String_Node_Str" + encodedString;
}
Program: 62624
Project: 62624
Buggy source:
private void setValues(String rfAddress,DeviceType deviceType,String serialNumber){
  this.rfAddress=rfAddress;
  this.deviceType=deviceType;
  this.serialNumber=serialNumber;
}

Fixed version (ground truth):
private void setValues(String rfAddress,DeviceType deviceType,String serialNumber,int roomId){
  this.rfAddress=rfAddress;
  this.deviceType=deviceType;
  this.serialNumber=serialNumber;
  this.roomId=roomId;
}
Program: 62625
Project: 62625
Buggy source:
public static DeviceConfiguration create(DeviceInformation di){
  DeviceConfiguration configuration=new DeviceConfiguration();
  configuration.setValues(di.getRFAddress(),di.getDeviceType(),di.getSerialNumber(),di.getName());
  return configuration;
}

Fixed version (ground truth):
public static DeviceConfiguration create(DeviceInformation di){
  DeviceConfiguration configuration=new DeviceConfiguration();
  configuration.setValues(di.getRFAddress(),di.getDeviceType(),di.getSerialNumber(),di.getRoomId(),di.getName());
  return configuration;
}
Program: 62628
Project: 62628
Buggy source:
/** 
 * Read line from the Cube and process the message.
 * @param terminator String with ending messagetype e.g. L:
 * @throws IOException
 */
private void readliness(String terminator) throws IOException {
  boolean cont=true;
  while (cont) {
    String raw=reader.readLine();
    if (raw != null) {
      logger.trace("String_Node_Str",raw);
      try {
        this.messageProcessor.addReceivedLine(raw);
        if (this.messageProcessor.isMessageAvailable()) {
          Message message=this.messageProcessor.pull();
          message.debug(logger);
          processMessage(message);
        }
      }
 catch (      Exception e) {
        logger.info("String_Node_Str",e.getMessage(),e);
        this.messageProcessor.reset();
      }
      if (terminator == null || raw.startsWith(terminator)) {
        cont=false;
      }
    }
 else {
      cont=false;
    }
  }
}

Fixed version (ground truth):
/** 
 * Read line from the Cube and process the message.
 * @param terminator String with ending messagetype e.g. L:
 * @throws IOException
 */
private void readliness(String terminator) throws IOException {
  boolean cont=true;
  while (cont) {
    String raw=reader.readLine();
    if (raw != null) {
      logger.trace("String_Node_Str",raw);
      try {
        this.messageProcessor.addReceivedLine(raw);
        if (this.messageProcessor.isMessageAvailable()) {
          Message message=this.messageProcessor.pull();
          processMessage(message);
        }
      }
 catch (      UnprocessableMessageException e) {
        if (raw.contentEquals("String_Node_Str")) {
          logger.info("String_Node_Str",ipAddress);
          this.messageProcessor.reset();
        }
 else {
          logger.info("String_Node_Str",raw,ipAddress);
          this.messageProcessor.reset();
        }
      }
catch (      Exception e) {
        logger.info("String_Node_Str",raw,ipAddress,e.getMessage(),e);
        this.messageProcessor.reset();
      }
      if (terminator == null || raw.startsWith(terminator)) {
        cont=false;
      }
    }
 else {
      cont=false;
    }
  }
}
Program: 62629
Project: 62629
Buggy source:
/** 
 * Takes a command from the command queue and send it to  {@link executeCommand} for execution.
 */
private synchronized void sendCommands(){
  SendCommand sendCommand=commandQueue.poll();
  if (sendCommand != null) {
    CubeCommand cmd=getCommand(sendCommand);
    if (sendCubeCommand(cmd)) {
      logger.debug("String_Node_Str",sendCommand.getId(),sendCommand.getKey(),sendCommand.getCommand().toString(),ipAddress);
    }
 else {
      logger.warn("String_Node_Str",sendCommand.getId(),sendCommand.getKey(),sendCommand.getCommand().toString(),ipAddress);
    }
  }
}

Fixed version (ground truth):
/** 
 * Takes a command from the command queue and send it to  {@link executeCommand} for execution.
 */
private synchronized void sendCommands(){
  SendCommand sendCommand=commandQueue.poll();
  if (sendCommand != null) {
    CubeCommand cmd=getCommand(sendCommand);
    if (cmd != null) {
      if (sendCubeCommand(cmd)) {
        logger.debug("String_Node_Str",sendCommand.getId(),sendCommand.getKey(),sendCommand.getCommand().toString(),ipAddress);
      }
 else {
        logger.warn("String_Node_Str",sendCommand.getId(),sendCommand.getKey(),sendCommand.getCommand().toString(),ipAddress);
      }
    }
  }
}
Program: 62630
Project: 62630
Buggy source:
@Override public void initialize(){
  logger.debug("String_Node_Str");
  MaxCubeBridgeConfiguration configuration=getConfigAs(MaxCubeBridgeConfiguration.class);
  port=configuration.port;
  ipAddress=configuration.ipAddress;
  refreshInterval=configuration.refreshInterval;
  exclusive=configuration.exclusive;
  maxRequestsPerConnection=configuration.maxRequestsPerConnection;
  logger.debug("String_Node_Str",ipAddress);
  logger.debug("String_Node_Str",port);
  logger.debug("String_Node_Str",refreshInterval);
  logger.debug("String_Node_Str",exclusive);
  logger.debug("String_Node_Str",maxRequestsPerConnection);
  initializeMaxDevices();
  startAutomaticRefresh();
}

Fixed version (ground truth):
@Override public void initialize(){
  logger.debug("String_Node_Str");
  MaxCubeBridgeConfiguration configuration=getConfigAs(MaxCubeBridgeConfiguration.class);
  port=configuration.port;
  ipAddress=configuration.ipAddress;
  refreshInterval=configuration.refreshInterval;
  exclusive=configuration.exclusive;
  maxRequestsPerConnection=configuration.maxRequestsPerConnection;
  logger.debug("String_Node_Str",ipAddress);
  logger.debug("String_Node_Str",port);
  logger.debug("String_Node_Str",refreshInterval);
  logger.debug("String_Node_Str",exclusive);
  logger.debug("String_Node_Str",maxRequestsPerConnection);
  updateStatus(ThingStatus.OFFLINE);
  initializeMaxDevices();
  startAutomaticRefresh();
}
Program: 62632
Project: 62632
Buggy source:
@Override public void debug(Logger logger){
  logger.trace("String_Node_Str");
  logger.trace("String_Node_Str",this.getPayload());
  logger.trace("String_Node_Str",cal.getTime());
  for (  String key : properties.keySet()) {
    logger.trace("String_Node_Str",key,Strings.repeat("String_Node_Str",25 - key.length()),properties.get(key));
  }
}

Fixed version (ground truth):
@Override public void debug(Logger logger){
  logger.debug("String_Node_Str");
  logger.trace("String_Node_Str",this.getPayload());
  logger.trace("String_Node_Str",cal.getTime());
  for (  String key : properties.keySet()) {
    logger.debug("String_Node_Str",key,Strings.repeat("String_Node_Str",25 - key.length()),properties.get(key));
  }
}
Program: 62633
Project: 62633
Buggy source:
private void startPolling(){
  startPolling(pollingPeriod);
}

Fixed version (ground truth):
private void startPolling(){
  startPolling(pollingPeriod * 1000);
}
Program: 62634
Project: 62634
Buggy source:
@Override public void run(){
  pollNode();
}

Fixed version (ground truth):
@Override public void run(){
  logger.debug("String_Node_Str",nodeId);
  ZWaveNode node=controllerHandler.getNode(nodeId);
  if (node == null || node.isInitializationComplete() == false) {
    logger.debug("String_Node_Str",nodeId);
    return;
  }
  List<SerialMessage> messages=new ArrayList<SerialMessage>();
  for (  ZWaveThingChannel channel : thingChannelsPoll) {
    logger.debug("String_Node_Str",nodeId,channel.getUID());
    if (channel.converter == null) {
      logger.debug("String_Node_Str",nodeId,channel.getUID());
    }
 else {
      messages.addAll(channel.converter.executeRefresh(channel,node));
    }
  }
  for (  SerialMessage message : messages) {
    controllerHandler.sendData(message);
  }
}
Program: 62637
Project: 62637
Buggy source:
/** 
 * Clears our state if it is time
 */
private void clearState(){
  if (System.currentTimeMillis() >= clearTime) {
    stateMap.clear();
    scheduleClearTime(NORMAL_CLEARTIME);
  }
}

Fixed version (ground truth):
/** 
 * Clears our state if it is time
 */
private void clearState(boolean force){
  if (force || System.currentTimeMillis() >= clearTime) {
    stateMap.clear();
    scheduleClearTime(NORMAL_CLEARTIME);
  }
}
Program: 62638
Project: 62638
Buggy source:
@Override public void dispose(){
  logger.debug("String_Node_Str");
  if (pollingJob != null && !pollingJob.isCancelled()) {
    pollingJob.cancel(true);
    pollingJob=null;
  }
}

Fixed version (ground truth):
@Override public void dispose(){
  logger.debug("String_Node_Str");
  if (pollingJob != null && !pollingJob.isCancelled()) {
    pollingJob.cancel(true);
    pollingJob=null;
  }
  this.discoveryServiceRegistry.removeDiscoveryListener(this);
  removeSubscription();
}
Program: 62639
Project: 62639
Buggy source:
protected SwaggerResources createResourceListingFor(String baseURL,String rootPath,Object[] instances){
  List<SwaggerResource> rs=new ArrayList<SwaggerResource>();
  for (  Object instance : instances) {
    Class<?> clazz=instance.getClass();
    String path=getPath(clazz.getAnnotation(Path.class));
    String doc=getDescription(clazz.getAnnotation(Description.class));
    rs.add(new SwaggerResource(rootPath.concat(path),doc));
  }
  return new SwaggerResources(baseURL,rs);
}

Fixed version (ground truth):
protected SwaggerResources createResourceListingFor(String baseURL,String rootPath,Map<String,Class<?>> services){
  List<SwaggerResource> rs=new ArrayList<SwaggerResource>();
  for (  Entry<String,Class<?>> entry : services.entrySet()) {
    Class<?> serviceType=entry.getValue();
    String path=getPath(entry.getKey());
    String doc=getDescription(serviceType.getAnnotation(Description.class));
    rs.add(new SwaggerResource(rootPath.concat(path),doc));
  }
  return new SwaggerResources(baseURL,rs);
}
Program: 62640
Project: 62640
Buggy source:
protected SwaggerAPI createDocumentationFor(String baseURL,Object instance){
  Class<?> clazz=instance.getClass();
  String rootPath=getPath(clazz.getAnnotation(Path.class));
  Method[] methods=clazz.getMethods();
  Arrays.sort(methods,COMPARATOR);
  SwaggerModel models=new SwaggerModel();
  List<SwaggerAPIPath> apis=new ArrayList<SwaggerAPIPath>();
  for (  Method method : methods) {
    if (method.isAnnotationPresent(NoDocumentation.class)) {
      continue;
    }
    List<SwaggerOperation> ops=documentOperations(models,method);
    if (ops.isEmpty()) {
      continue;
    }
    String path=getPath(method.getAnnotation(Path.class));
    String doc=getDescription(method.getAnnotation(Description.class));
    apis.add(new SwaggerAPIPath(rootPath.concat(path),doc,ops));
  }
  return new SwaggerAPI(baseURL.concat(m_restEndpoint),rootPath,apis,models);
}

Fixed version (ground truth):
protected SwaggerAPI createDocumentationFor(String baseURL,Class<?> clazz){
  String rootPath=getPath(clazz.getAnnotation(Path.class));
  Method[] methods=clazz.getMethods();
  Arrays.sort(methods,COMPARATOR);
  SwaggerModel models=new SwaggerModel();
  List<SwaggerAPIPath> apis=new ArrayList<SwaggerAPIPath>();
  for (  Method method : methods) {
    if (method.isAnnotationPresent(NoDocumentation.class)) {
      continue;
    }
    List<SwaggerOperation> ops=documentOperations(models,method);
    if (ops.isEmpty()) {
      continue;
    }
    String path=getPath(method.getAnnotation(Path.class));
    String doc=getDescription(method.getAnnotation(Description.class));
    apis.add(new SwaggerAPIPath(rootPath.concat(path),doc,ops));
  }
  return new SwaggerAPI(baseURL.concat(m_restEndpoint),rootPath,apis,models);
}
Program: 62641
Project: 62641
Buggy source:
@Override protected void doGet(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException {
  String baseURL=getBaseURL(req);
  String requestPath=req.getPathInfo();
  Object[] services=m_restServices.toArray();
  if (requestPath == null || "String_Node_Str".equals(requestPath) || "String_Node_Str".equals(requestPath)) {
    SwaggerResources resources=createResourceListingFor(baseURL,req.getServletPath(),services);
    writeAsJSON(resp,resources);
  }
 else {
    boolean responseWritten=false;
    for (    Object s : services) {
      Class<?> clazz=s.getClass();
      String rootPathValue=getPath(clazz.getAnnotation(Path.class));
      if (requestPath.startsWith(rootPathValue)) {
        SwaggerAPI apiDocs=createDocumentationFor(baseURL,s);
        writeAsJSON(resp,apiDocs);
        responseWritten=true;
      }
    }
    if (!responseWritten) {
      writeAsJSON(resp,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override protected void doGet(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException {
  String baseURL=getBaseURL(req);
  String requestPath=getPath(req.getPathInfo());
  SortedMap<String,Class<?>> services=getServices();
  if ("String_Node_Str".equals(requestPath) || "String_Node_Str".equals(requestPath)) {
    SwaggerResources resources=createResourceListingFor(baseURL,req.getServletPath(),services);
    writeAsJSON(resp,resources);
  }
 else {
    Class<?> serviceType=services.get(requestPath);
    if (serviceType != null) {
      SwaggerAPI apiDocs=createDocumentationFor(baseURL,serviceType);
      writeAsJSON(resp,apiDocs);
    }
 else {
      writeAsJSON(resp,"String_Node_Str");
    }
  }
}
Program: 62642
Project: 62642
Buggy source:
public static String getPath(Path ann){
  if (ann == null) {
    return "String_Node_Str";
  }
  String value=ann.value();
  if (!value.startsWith("String_Node_Str") && value.length() > 1) {
    return "String_Node_Str".concat(value);
  }
  return value;
}

Fixed version (ground truth):
public static String getPath(String path){
  if (path == null) {
    return "String_Node_Str";
  }
  String value=path.trim();
  if (!value.startsWith("String_Node_Str") && value.length() > 1) {
    return "String_Node_Str".concat(value);
  }
  return value;
}
Program: 62645
Project: 62645
Buggy source:
@Override public void thingDiscovered(DiscoveryService source,DiscoveryResult result){
  if (getThing().getConfiguration().get(UDN).equals(result.getProperties().get(UDN))) {
    logger.debug("String_Node_Str",result.getProperties().get(UDN),getThing().getUID());
    getThing().setStatus(ThingStatus.ONLINE);
    onSubscription();
    onUpdate();
  }
}

Fixed version (ground truth):
@Override public void thingDiscovered(DiscoveryService source,DiscoveryResult result){
  if (result.getThingUID().equals(this.getThing().getUID())) {
    if (getThing().getConfiguration().get(UDN).equals(result.getProperties().get(UDN))) {
      logger.debug("String_Node_Str",result.getProperties().get(UDN),getThing().getUID());
      getThing().setStatus(ThingStatus.ONLINE);
      onSubscription();
      onUpdate();
    }
  }
}
Program: 62646
Project: 62646
Buggy source:
@Override public void thingRemoved(DiscoveryService source,ThingUID thingUID){
  logger.debug("String_Node_Str",getThing().getUID());
  getThing().setStatus(ThingStatus.OFFLINE);
}

Fixed version (ground truth):
@Override public void thingRemoved(DiscoveryService source,ThingUID thingUID){
  if (thingUID.equals(this.getThing().getUID())) {
    logger.debug("String_Node_Str",getThing().getUID());
    getThing().setStatus(ThingStatus.OFFLINE);
  }
}
Program: 62648
Project: 62648
Buggy source:
protected void updateTrackMetaData(){
  SonosMetaData currentTrack=getTrackMetadata();
  if (currentTrack != null) {
    String artist="String_Node_Str";
    if (currentTrack.getAlbumArtist().equals("String_Node_Str")) {
      artist=currentTrack.getCreator();
    }
 else {
      artist=currentTrack.getAlbumArtist();
    }
    String album=currentTrack.getAlbum();
    String title="String_Node_Str";
    if (!currentTrack.getTitle().contains("String_Node_Str")) {
      title=currentTrack.getTitle();
    }
    this.onValueReceived("String_Node_Str",(artist != null) ? artist : "String_Node_Str","String_Node_Str");
    this.onValueReceived("String_Node_Str",(title != null) ? title : "String_Node_Str","String_Node_Str");
    this.onValueReceived("String_Node_Str",(album != null) ? album : "String_Node_Str","String_Node_Str");
    if (currentTrack.getTitle().contains("String_Node_Str")) {
      updateMediaInfo();
    }
  }
}

Fixed version (ground truth):
protected void updateTrackMetaData(){
  SonosMetaData currentTrack=getTrackMetadata();
  if (currentTrack != null) {
    String artist=null;
    if (currentTrack.getAlbumArtist().equals("String_Node_Str")) {
      artist=currentTrack.getCreator();
    }
 else {
      artist=currentTrack.getAlbumArtist();
    }
    String album=currentTrack.getAlbum();
    String title=null;
    if (!currentTrack.getTitle().contains("String_Node_Str")) {
      title=currentTrack.getTitle();
    }
    this.onValueReceived("String_Node_Str",(artist != null) ? artist : "String_Node_Str","String_Node_Str");
    if (title != null) {
      this.onValueReceived("String_Node_Str",(title != null) ? title : "String_Node_Str","String_Node_Str");
    }
    this.onValueReceived("String_Node_Str",(album != null) ? album : "String_Node_Str","String_Node_Str");
    if (currentTrack.getTitle().contains("String_Node_Str")) {
      updateMediaInfo();
    }
  }
}
Program: 62650
Project: 62650
Buggy source:
/** 
 * Play music from the line-in of the given Player referenced by the given UDN or name
 * @param udn or name
 */
public void playLineIn(Command command){
  if (command != null && command instanceof StringType) {
    String remotePlayerName=command.toString();
    Thing coordinatorThing=thingRegistry.get(new ThingUID(ZONEPLAYER_THING_TYPE_UID,getCoordinator()));
    ZonePlayerHandler coordinatorHandler=(ZonePlayerHandler)coordinatorThing.getHandler();
    ZonePlayerHandler remoteHandler=getHandlerByName(remotePlayerName);
    coordinatorHandler.stop();
    coordinatorHandler.setCurrentURI("String_Node_Str" + remoteHandler.getConfig().get(UDN),"String_Node_Str");
    coordinatorHandler.setMute(OnOffType.OFF);
    coordinatorHandler.play();
  }
}

Fixed version (ground truth):
/** 
 * Play music from the line-in of the given Player referenced by the given UDN or name
 * @param udn or name
 */
public void playLineIn(Command command){
  if (command != null && command instanceof StringType) {
    String remotePlayerName=command.toString();
    String coordinatorUDN=getCoordinator();
    ZonePlayerHandler coordinatorHandler=getHandlerByName(coordinatorUDN);
    ZonePlayerHandler remoteHandler=getHandlerByName(remotePlayerName);
    coordinatorHandler.stop();
    coordinatorHandler.setCurrentURI("String_Node_Str" + remoteHandler.getConfig().get(UDN),"String_Node_Str");
    coordinatorHandler.setMute(OnOffType.OFF);
    coordinatorHandler.play();
  }
}
Program: 62651
Project: 62651
Buggy source:
/** 
 * Restore the state (track, position etc) of the Sonos Zone player.
 * @return true if no error occurred.
 */
protected void restoreState(){
synchronized (this) {
    if (savedState != null) {
      setVolume(DecimalType.valueOf(savedState.volume));
      if (isCoordinator()) {
        if (savedState.entry != null) {
          if (savedState.entry.getUpnpClass().contains("String_Node_Str")) {
            addURIToQueue(savedState.entry.getRes(),SonosXMLParser.compileMetadataString(savedState.entry),0,true);
            SonosEntry entry=new SonosEntry("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + getUDN() + "String_Node_Str");
            setCurrentURI(entry);
            setPositionTrack(savedState.track);
          }
 else {
            setCurrentURI(savedState.entry);
            setPosition(savedState.relTime);
          }
          if (savedState.transportState.equals("String_Node_Str")) {
            play();
          }
 else           if (savedState.transportState.equals("String_Node_Str")) {
            stop();
          }
 else           if (savedState.transportState.equals("String_Node_Str")) {
            pause();
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Restore the state (track, position etc) of the Sonos Zone player.
 * @return true if no error occurred.
 */
protected void restoreState(){
synchronized (this) {
    if (savedState != null) {
      if (savedState.volume != null) {
        setVolume(DecimalType.valueOf(savedState.volume));
      }
      if (isCoordinator()) {
        if (savedState.entry != null) {
          if (savedState.entry.getUpnpClass().contains("String_Node_Str")) {
            addURIToQueue(savedState.entry.getRes(),SonosXMLParser.compileMetadataString(savedState.entry),0,true);
            SonosEntry entry=new SonosEntry("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + getUDN() + "String_Node_Str");
            setCurrentURI(entry);
            setPositionTrack(savedState.track);
          }
 else {
            setCurrentURI(savedState.entry);
            setPosition(savedState.relTime);
          }
        }
        if (savedState.transportState != null) {
          if (savedState.transportState.equals("String_Node_Str")) {
            play();
          }
 else           if (savedState.transportState.equals("String_Node_Str")) {
            stop();
          }
 else           if (savedState.transportState.equals("String_Node_Str")) {
            pause();
          }
        }
      }
    }
  }
}
Program: 62653
Project: 62653
Buggy source:
protected ZonePlayerHandler getHandlerByName(String remotePlayerName){
  Thing thing=thingRegistry.getByUID(new ThingUID(ZONEPLAYER_THING_TYPE_UID,remotePlayerName));
  if (thing == null) {
    Collection<Thing> allThings=thingRegistry.getAll();
    for (    Thing aThing : allThings) {
      if (aThing.getThingTypeUID().equals(this.getThing().getThingTypeUID())) {
        if (aThing.getConfiguration().get(UDN).equals(remotePlayerName)) {
          thing=aThing;
          break;
        }
      }
    }
  }
  return (ZonePlayerHandler)thing.getHandler();
}

Fixed version (ground truth):
protected ZonePlayerHandler getHandlerByName(String remotePlayerName){
  Thing thing=thingRegistry.getByUID(new ThingUID(ZONEPLAYER_THING_TYPE_UID,remotePlayerName));
  if (thing == null) {
    Collection<Thing> allThings=thingRegistry.getAll();
    for (    Thing aThing : allThings) {
      if (aThing.getThingTypeUID().equals(this.getThing().getThingTypeUID())) {
        if (aThing.getConfiguration().get(UDN).equals(remotePlayerName)) {
          thing=aThing;
          break;
        }
      }
    }
  }
  if (thing != null) {
    return (ZonePlayerHandler)thing.getHandler();
  }
 else {
    return null;
  }
}
Program: 62655
Project: 62655
Buggy source:
@Override public void dispose(){
  logger.debug("String_Node_Str");
  if (pollingJob != null && !pollingJob.isCancelled()) {
    pollingJob.cancel(true);
    pollingJob=null;
  }
}

Fixed version (ground truth):
@Override public void dispose(){
  logger.debug("String_Node_Str");
  if (pollingJob != null && !pollingJob.isCancelled()) {
    pollingJob.cancel(true);
    pollingJob=null;
  }
  if (getThing().getStatus() == ThingStatus.ONLINE) {
    logger.debug("String_Node_Str",getThing().getUID());
    getThing().setStatus(ThingStatus.OFFLINE);
  }
}
Program: 62656
Project: 62656
Buggy source:
public ZonePlayerHandler(Thing thing,UpnpIOService upnpIOService,DiscoveryServiceRegistry discoveryServiceRegistry,String opmlPartnerID){
  super(thing);
  this.opmlPartnerID=opmlPartnerID;
  logger.debug("String_Node_Str",getThing().getUID());
  if (upnpIOService != null) {
    this.service=upnpIOService;
  }
  if (discoveryServiceRegistry != null) {
    this.discoveryServiceRegistry=discoveryServiceRegistry;
    this.discoveryServiceRegistry.addDiscoveryListener(this);
  }
  if (!service.isRegistered(this)) {
    logger.debug("String_Node_Str",getThing().getUID());
    getThing().setStatus(ThingStatus.OFFLINE);
  }
}

Fixed version (ground truth):
public ZonePlayerHandler(Thing thing,UpnpIOService upnpIOService,DiscoveryServiceRegistry discoveryServiceRegistry,String opmlPartnerID){
  super(thing);
  this.opmlPartnerID=opmlPartnerID;
  logger.debug("String_Node_Str",getThing().getUID());
  if (upnpIOService != null) {
    this.service=upnpIOService;
  }
  if (discoveryServiceRegistry != null) {
    this.discoveryServiceRegistry=discoveryServiceRegistry;
    this.discoveryServiceRegistry.addDiscoveryListener(this);
  }
}
Program: 62657
Project: 62657
Buggy source:
@Override public void initialize(){
  ZonePlayerConfiguration configuration=getConfigAs(ZonePlayerConfiguration.class);
  if (configuration.udn != null) {
    onSubscription();
    onUpdate();
  }
 else {
    logger.warn("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void initialize(){
  ZonePlayerConfiguration configuration=getConfigAs(ZonePlayerConfiguration.class);
  if (configuration.udn != null) {
    onSubscription();
    onUpdate();
  }
 else {
    logger.warn("String_Node_Str");
  }
  if (getThing().getStatus() == ThingStatus.OFFLINE) {
    logger.debug("String_Node_Str",getThing().getUID());
    getThing().setStatus(ThingStatus.ONLINE);
  }
}
Program: 62658
Project: 62658
Buggy source:
public void onPost(final PipelineHook hook){
  if (pipelineTriggerHandler == null) {
    initializeTriggerHandler();
  }
  pipelineTriggerHandler.handle(job,hook,ciSkip,branchFilter,mergeRequestLabelFilter);
}

Fixed version (ground truth):
public void onPost(final PipelineHook hook){
  if (branchFilter == null) {
    initializeBranchFilter();
  }
  if (pipelineTriggerHandler == null) {
    initializeTriggerHandler();
  }
  pipelineTriggerHandler.handle(job,hook,ciSkip,branchFilter,mergeRequestLabelFilter);
}
Program: 62659
Project: 62659
Buggy source:
@DataBoundConstructor public GitLabCommitStatusStep(String name){
  this.name=StringUtils.isEmpty(name) ? null : name;
}

Fixed version (ground truth):
@DataBoundConstructor public GitLabCommitStatusStep(){
}
Program: 62660
Project: 62660
Buggy source:
public static BranchFilter newBranchFilter(BranchFilterConfig config){
switch (config.getType()) {
case NameBasedFilter:
    return new NameBasedFilter(config.getIncludeBranchesSpec(),config.getExcludeBranchesSpec());
case RegexBasedFilter:
  return new RegexBasedFilter(config.getTargetBranchRegex());
default :
return new AllBranchesFilter();
}
}

Fixed version (ground truth):
public static BranchFilter newBranchFilter(BranchFilterConfig config){
  if (config == null)   return new AllBranchesFilter();
switch (config.getType()) {
case NameBasedFilter:
    return new NameBasedFilter(config.getIncludeBranchesSpec(),config.getExcludeBranchesSpec());
case RegexBasedFilter:
  return new RegexBasedFilter(config.getTargetBranchRegex());
default :
return new AllBranchesFilter();
}
}
Program: 62661
Project: 62661
Buggy source:
@Test public void test(){
  CommitStatusUpdater.updateCommitStatus(build,taskListener,BuildState.success,STAGE);
  verify(client).changeBuildStatus(Integer.toString(PROJECT_ID),REVISION,BuildState.success,null,STAGE,Jenkins.getInstance().getRootUrl() + BUILD_URL + BUILD_URL_REDIRECT,null);
}

Fixed version (ground truth):
@Test public void test(){
  CommitStatusUpdater.updateCommitStatus(build,taskListener,BuildState.success,STAGE);
  verify(client).changeBuildStatus(Integer.toString(PROJECT_ID),REVISION,BuildState.success,null,STAGE,DisplayURLProvider.get().getRunURL(build),null);
}
Program: 62662
Project: 62662
Buggy source:
void setUseAuthenticatedEndpoint(Boolean useAuthenticatedEndpoint){
  this.useAuthenticatedEndpoint=useAuthenticatedEndpoint;
}

Fixed version (ground truth):
void setUseAuthenticatedEndpoint(boolean useAuthenticatedEndpoint){
  this.useAuthenticatedEndpoint=useAuthenticatedEndpoint;
}
Program: 62663
Project: 62663
Buggy source:
private void checkPermission(Permission permission){
  if (((GitLabConnectionConfig)Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class)).getUseAuthenticatedEndpoint()) {
    if (!Jenkins.getActiveInstance().getACL().hasPermission(authentication,permission)) {
      String message=Messages.AccessDeniedException2_MissingPermission(authentication.getName(),permission.group.title + "String_Node_Str" + permission.name);
      LOGGER.finest("String_Node_Str");
      throw HttpResponses.errorWithoutStack(403,message);
    }
  }
}

Fixed version (ground truth):
private void checkPermission(Permission permission){
  if (((GitLabConnectionConfig)Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class)).isUseAuthenticatedEndpoint()) {
    if (!Jenkins.getActiveInstance().getACL().hasPermission(authentication,permission)) {
      String message=Messages.AccessDeniedException2_MissingPermission(authentication.getName(),permission.group.title + "String_Node_Str" + permission.name);
      LOGGER.finest("String_Node_Str");
      throw HttpResponses.errorWithoutStack(403,message);
    }
  }
}
Program: 62664
Project: 62664
Buggy source:
@Test public void buildClientWithProxy() throws Exception {
  jenkins.getInstance().proxy=new ProxyConfiguration("String_Node_Str",8080,"String_Node_Str","String_Node_Str","String_Node_Str");
  GitLabClientBuilder clientBuilder=new ResteasyGitLabClientBuilder("String_Node_Str",V3GitLabApiProxy.class);
  assertNotNull(buildClientWithDefaults(clientBuilder,"String_Node_Str"));
}

Fixed version (ground truth):
@Test public void buildClientWithProxy() throws Exception {
  jenkins.getInstance().proxy=new ProxyConfiguration("String_Node_Str",8080,"String_Node_Str","String_Node_Str","String_Node_Str");
  GitLabClientBuilder clientBuilder=new ResteasyGitLabClientBuilder("String_Node_Str",0,V3GitLabApiProxy.class);
  assertNotNull(buildClientWithDefaults(clientBuilder,"String_Node_Str"));
}
Program: 62665
Project: 62665
Buggy source:
private GitLabClient buildClient(String url,String apiToken,Class<? extends GitLabApi> proxyClass,ProxyConfiguration httpProxyConfig,boolean ignoreCertificateErrors,int connectionTimeout,int readTimeout){
  ResteasyClientBuilder builder=new ResteasyClientBuilder();
  if (ignoreCertificateErrors) {
    builder.hostnameVerification(ResteasyClientBuilder.HostnameVerificationPolicy.ANY);
    builder.disableTrustManager();
  }
  if (httpProxyConfig != null) {
    InetSocketAddress address=(InetSocketAddress)httpProxyConfig.createProxy(getHost(url)).address();
    builder.defaultProxy(address.getHostName().replaceFirst("String_Node_Str","String_Node_Str"),address.getPort(),address.getHostName().startsWith("String_Node_Str") ? "String_Node_Str" : "String_Node_Str",httpProxyConfig.getUserName(),httpProxyConfig.getPassword());
  }
  GitLabApi apiProxy=builder.connectionPoolSize(60).maxPooledPerRoute(30).establishConnectionTimeout(connectionTimeout,TimeUnit.SECONDS).socketTimeout(readTimeout,TimeUnit.SECONDS).register(new JacksonJsonProvider()).register(new JacksonConfig()).register(new ApiHeaderTokenFilter(apiToken)).register(new LoggingFilter()).register(new RemoveAcceptEncodingFilter()).register(new JaxrsFormProvider()).build().target(url).proxyBuilder(proxyClass).classloader(proxyClass.getClassLoader()).build();
  return new GitLabClient(url,apiProxy);
}

Fixed version (ground truth):
private GitLabClient buildClient(String url,String apiToken,Class<? extends GitLabApi> proxyClass,ProxyConfiguration httpProxyConfig,boolean ignoreCertificateErrors,int connectionTimeout,int readTimeout){
  ResteasyClientBuilder builder=new ResteasyClientBuilder();
  if (ignoreCertificateErrors) {
    builder.hostnameVerification(ResteasyClientBuilder.HostnameVerificationPolicy.ANY);
    builder.disableTrustManager();
  }
  Proxy proxy=httpProxyConfig != null ? httpProxyConfig.createProxy(getHost(url)) : NO_PROXY;
  if (proxy != NO_PROXY) {
    InetSocketAddress address=(InetSocketAddress)proxy.address();
    builder.defaultProxy(address.getHostName().replaceFirst("String_Node_Str","String_Node_Str"),address.getPort(),address.getHostName().startsWith("String_Node_Str") ? "String_Node_Str" : "String_Node_Str",httpProxyConfig.getUserName(),httpProxyConfig.getPassword());
  }
  GitLabApi apiProxy=builder.connectionPoolSize(60).maxPooledPerRoute(30).establishConnectionTimeout(connectionTimeout,TimeUnit.SECONDS).socketTimeout(readTimeout,TimeUnit.SECONDS).register(new JacksonJsonProvider()).register(new JacksonConfig()).register(new ApiHeaderTokenFilter(apiToken)).register(new LoggingFilter()).register(new RemoveAcceptEncodingFilter()).register(new JaxrsFormProvider()).build().target(url).proxyBuilder(proxyClass).classloader(proxyClass.getClassLoader()).build();
  return new GitLabClient(url,apiProxy);
}
Program: 62667
Project: 62667
Buggy source:
public static void updateCommitStatus(Run<?,?> build,TaskListener listener,BuildState state,String name){
  GitLabApi client=getClient(build);
  if (client == null) {
    println(listener,"String_Node_Str");
    return;
  }
  try {
    String commitHash=getBuildRevision(build);
    String buildUrl=getBuildUrl(build);
    for (    String gitlabProjectId : retrieveGitlabProjectIds(build,build.getEnvironment(listener))) {
      try {
        if (existsCommit(client,gitlabProjectId,commitHash)) {
          client.changeBuildStatus(gitlabProjectId,commitHash,state,getBuildBranch(build),name,buildUrl,null);
        }
      }
 catch (      WebApplicationException|ProcessingException e) {
        printf(listener,"String_Node_Str",gitlabProjectId,e.getMessage());
        LOGGER.log(Level.SEVERE,String.format("String_Node_Str",gitlabProjectId),e);
      }
    }
  }
 catch (  IOException|InterruptedException|IllegalStateException e) {
    printf(listener,"String_Node_Str",e.getMessage());
  }
}

Fixed version (ground truth):
public static void updateCommitStatus(Run<?,?> build,TaskListener listener,BuildState state,String name){
  GitLabApi client=getClient(build);
  if (client == null) {
    println(listener,"String_Node_Str");
    return;
  }
  try {
    final String buildUrl=getBuildUrl(build);
    for (    final GitLabBranchBuild gitLabBranchBuild : retrieveGitlabProjectIds(build,build.getEnvironment(listener))) {
      try {
        if (existsCommit(client,gitLabBranchBuild.getProjectId(),gitLabBranchBuild.getRevisionHash())) {
          client.changeBuildStatus(gitLabBranchBuild.getProjectId(),gitLabBranchBuild.getRevisionHash(),state,getBuildBranch(build),name,buildUrl,null);
        }
      }
 catch (      WebApplicationException|ProcessingException e) {
        printf(listener,"String_Node_Str",gitLabBranchBuild.getProjectId(),e.getMessage());
        LOGGER.log(Level.SEVERE,String.format("String_Node_Str",gitLabBranchBuild.getProjectId()),e);
      }
    }
  }
 catch (  IOException|InterruptedException|IllegalStateException e) {
    printf(listener,"String_Node_Str",e.getMessage());
  }
}
Program: 62668
Project: 62668
Buggy source:
void setUseAuthenticatedEndpoint(boolean useAuthenticatedEndpoint){
  this.useAuthenticatedEndpoint=useAuthenticatedEndpoint;
}

Fixed version (ground truth):
void setUseAuthenticatedEndpoint(Boolean useAuthenticatedEndpoint){
  this.useAuthenticatedEndpoint=useAuthenticatedEndpoint;
}
Program: 62669
Project: 62669
Buggy source:
private void checkPermission(Permission permission){
  if (((GitLabConnectionConfig)Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class)).isUseAuthenticatedEndpoint()) {
    if (!Jenkins.getActiveInstance().getACL().hasPermission(authentication,permission)) {
      String message=Messages.AccessDeniedException2_MissingPermission(authentication.getName(),permission.group.title + "String_Node_Str" + permission.name);
      LOGGER.finest("String_Node_Str");
      throw HttpResponses.errorWithoutStack(403,message);
    }
  }
}

Fixed version (ground truth):
private void checkPermission(Permission permission){
  if (((GitLabConnectionConfig)Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class)).getUseAuthenticatedEndpoint()) {
    if (!Jenkins.getActiveInstance().getACL().hasPermission(authentication,permission)) {
      String message=Messages.AccessDeniedException2_MissingPermission(authentication.getName(),permission.group.title + "String_Node_Str" + permission.name);
      LOGGER.finest("String_Node_Str");
      throw HttpResponses.errorWithoutStack(403,message);
    }
  }
}
Program: 62670
Project: 62670
Buggy source:
@Test public void authenticationEnabled_anonymous_forbidden() throws IOException, URISyntaxException {
  jenkins.get(GitLabConnectionConfig.class).setUseAuthenticatedEndpoint(true);
  jenkins.getInstance().setAuthorizationStrategy(new GlobalMatrixAuthorizationStrategy());
  URL jenkinsURL=jenkins.getURL();
  FreeStyleProject project=jenkins.createFreeStyleProject("String_Node_Str");
  GitLabPushTrigger trigger=mock(GitLabPushTrigger.class);
  project.addTrigger(trigger);
  CloseableHttpClient client=HttpClientBuilder.create().build();
  HttpPost request=new HttpPost(jenkinsURL.toExternalForm() + "String_Node_Str");
  request.addHeader("String_Node_Str","String_Node_Str");
  request.setEntity(new StringEntity("String_Node_Str"));
  CloseableHttpResponse response=client.execute(request);
  assertThat(response.getStatusLine().getStatusCode(),is(403));
}

Fixed version (ground truth):
@Test public void authenticationEnabled_anonymous_forbidden() throws IOException, URISyntaxException {
  Boolean defaultValue=jenkins.get(GitLabConnectionConfig.class).getUseAuthenticatedEndpoint();
  assertTrue(defaultValue);
  jenkins.getInstance().setAuthorizationStrategy(new GlobalMatrixAuthorizationStrategy());
  URL jenkinsURL=jenkins.getURL();
  FreeStyleProject project=jenkins.createFreeStyleProject("String_Node_Str");
  GitLabPushTrigger trigger=mock(GitLabPushTrigger.class);
  project.addTrigger(trigger);
  CloseableHttpClient client=HttpClientBuilder.create().build();
  HttpPost request=new HttpPost(jenkinsURL.toExternalForm() + "String_Node_Str");
  request.addHeader("String_Node_Str","String_Node_Str");
  request.setEntity(new StringEntity("String_Node_Str"));
  CloseableHttpResponse response=client.execute(request);
  assertThat(response.getStatusLine().getStatusCode(),is(403));
}
Program: 62671
Project: 62671
Buggy source:
@Test public void authenticationEnabled_registered_success() throws Exception {
  String username="String_Node_Str";
  jenkins.get(GitLabConnectionConfig.class).setUseAuthenticatedEndpoint(true);
  jenkins.getInstance().setSecurityRealm(jenkins.createDummySecurityRealm());
  GlobalMatrixAuthorizationStrategy authorizationStrategy=new GlobalMatrixAuthorizationStrategy();
  authorizationStrategy.add(Item.BUILD,username);
  jenkins.getInstance().setAuthorizationStrategy(authorizationStrategy);
  URL jenkinsURL=jenkins.getURL();
  jenkins.createFreeStyleProject("String_Node_Str");
  CloseableHttpClient client=HttpClientBuilder.create().build();
  HttpPost request=new HttpPost(jenkinsURL.toExternalForm() + "String_Node_Str");
  request.addHeader("String_Node_Str","String_Node_Str");
  String auth=username + "String_Node_Str" + username;
  request.addHeader(HttpHeaders.AUTHORIZATION,"String_Node_Str" + new String(Base64.encodeBase64(auth.getBytes(Charset.forName("String_Node_Str")))));
  request.setEntity(new StringEntity("String_Node_Str"));
  CloseableHttpResponse response=client.execute(request);
  assertThat(response.getStatusLine().getStatusCode(),is(200));
}

Fixed version (ground truth):
@Test public void authenticationEnabled_registered_success() throws Exception {
  String username="String_Node_Str";
  jenkins.getInstance().setSecurityRealm(jenkins.createDummySecurityRealm());
  GlobalMatrixAuthorizationStrategy authorizationStrategy=new GlobalMatrixAuthorizationStrategy();
  authorizationStrategy.add(Item.BUILD,username);
  jenkins.getInstance().setAuthorizationStrategy(authorizationStrategy);
  URL jenkinsURL=jenkins.getURL();
  jenkins.createFreeStyleProject("String_Node_Str");
  CloseableHttpClient client=HttpClientBuilder.create().build();
  HttpPost request=new HttpPost(jenkinsURL.toExternalForm() + "String_Node_Str");
  request.addHeader("String_Node_Str","String_Node_Str");
  String auth=username + "String_Node_Str" + username;
  request.addHeader(HttpHeaders.AUTHORIZATION,"String_Node_Str" + new String(Base64.encodeBase64(auth.getBytes(Charset.forName("String_Node_Str")))));
  request.setEntity(new StringEntity("String_Node_Str"));
  CloseableHttpResponse response=client.execute(request);
  assertThat(response.getStatusLine().getStatusCode(),is(200));
}