Program: 62631
Project: 62631
Buggy source:
/** 
 * Connects to the Max! Cube Lan gateway and send a command to Cube and process the message
 * @param {@link CubeCommand}
 * @return boolean success
 */
private boolean sendCubeCommand(CubeCommand command){
synchronized (MaxCubeBridgeHandler.class) {
    boolean sendSuccess=false;
    try {
      if (socket == null) {
        this.socketConnect();
      }
 else {
        if (maxRequestsPerConnection > 0 && requestCount >= maxRequestsPerConnection) {
          logger.debug("String_Node_Str");
          socket.close();
          this.socketConnect();
        }
 else {
          if (requestCount == 0) {
            logger.debug("String_Node_Str");
            readliness("String_Node_Str");
          }
          if (!(requestCount == 0 && command instanceof L_Command)) {
            logger.debug("String_Node_Str",this.requestCount);
            if (writer == null) {
              logger.warn("String_Node_Str");
              this.socketConnect();
            }
            writer.write(command.getCommandString());
            writer.flush();
            readliness(command.getReturnStrings());
          }
        }
      }
      requestCount++;
      sendSuccess=true;
      if (!exclusive) {
        socketClose();
      }
    }
 catch (    ConnectException e) {
      logger.debug("String_Node_Str",ipAddress,port);
      sendSuccess=false;
      socketClose();
    }
catch (    UnknownHostException e) {
      logger.debug("String_Node_Str",e.getMessage());
      sendSuccess=false;
      socketClose();
    }
catch (    IOException e) {
      logger.debug("String_Node_Str",e.getMessage());
      sendSuccess=false;
      socketClose();
    }
catch (    Exception e) {
      logger.debug("String_Node_Str",e.getMessage(),e);
      sendSuccess=false;
      socketClose();
    }
    return sendSuccess;
  }
}

Fixed version (ground truth):
/** 
 * Connects to the Max! Cube Lan gateway and send a command to Cube and process the message
 * @param {@link CubeCommand}
 * @return boolean success
 */
private boolean sendCubeCommand(CubeCommand command){
synchronized (MaxCubeBridgeHandler.class) {
    boolean sendSuccess=false;
    try {
      if (socket == null) {
        this.socketConnect();
      }
 else {
        if (maxRequestsPerConnection > 0 && requestCount >= maxRequestsPerConnection) {
          logger.debug("String_Node_Str");
          socket.close();
          this.socketConnect();
        }
 else {
          if (requestCount == 0) {
            logger.debug("String_Node_Str");
            readliness("String_Node_Str");
          }
          if (!(requestCount == 0 && command instanceof L_Command)) {
            logger.debug("String_Node_Str",this.requestCount);
            if (writer == null) {
              logger.warn("String_Node_Str");
              this.socketConnect();
            }
            writer.write(command.getCommandString());
            logger.trace("String_Node_Str",ipAddress,command.getCommandString());
            writer.flush();
            readliness(command.getReturnStrings());
          }
        }
      }
      requestCount++;
      sendSuccess=true;
      if (!exclusive) {
        socketClose();
      }
    }
 catch (    ConnectException e) {
      logger.debug("String_Node_Str",ipAddress,port);
      sendSuccess=false;
      socketClose();
    }
catch (    UnknownHostException e) {
      logger.debug("String_Node_Str",e.getMessage());
      sendSuccess=false;
      socketClose();
    }
catch (    IOException e) {
      logger.debug("String_Node_Str",e.getMessage());
      sendSuccess=false;
      socketClose();
    }
catch (    Exception e) {
      logger.debug("String_Node_Str",e.getMessage(),e);
      sendSuccess=false;
      socketClose();
    }
    return sendSuccess;
  }
}