nus-yam/ex-repair huggingface dataset:
Program: 8190
Project: 8190
Buggy source:
@Override public boolean shouldRetry(ConnectionState state){
  if (this.maxRetryCount != -1 && state.retryCount >= this.maxRetryCount) {
    return false;
  }
  if (state.msBeforeRetry == 0) {
    state.msBeforeRetry=this.startRetryTime;
  }
 else   if (maxDelay == -1) {
    state.msBeforeRetry*=2;
  }
 else   if (state.msBeforeRetry < maxDelay) {
    state.msBeforeRetry*=2;
    if (state.msBeforeRetry > maxDelay) {
      state.msBeforeRetry=maxDelay;
    }
  }
 else {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean shouldRetry(ConnectionState state){
  if (this.maxRetryCount > 0 && state.retryCount > this.maxRetryCount) {
    return false;
  }
  if (state.msBeforeRetry <= 0) {
    state.msBeforeRetry=startRetryTime;
  }
 else   if (state.msBeforeRetry < maxDelay) {
    state.msBeforeRetry*=2;
  }
  if (state.msBeforeRetry > maxDelay) {
    state.msBeforeRetry=maxDelay;
  }
  return true;
}
Program: 8191
Project: 8191
Buggy source:
@Override public boolean shouldRetry(ConnectionState connectionState){
  return (new Date().getTime() - connectionState.startTime) < timeoutInMs;
}

Fixed version (ground truth):
@Override public boolean shouldRetry(ConnectionState connectionState){
  return (System.currentTimeMillis() - connectionState.startTime) < timeoutInMs;
}
Program: 8192
Project: 8192
Buggy source:
/** 
 * Constructor
 * @param msBeforeRetry milliseconds before retrying
 * @param timeoutInMs   timeout in ms
 */
public RetryWithTimeout(int msBeforeRetry,int timeoutInMs){
  super(msBeforeRetry);
  this.timeoutInMs=timeoutInMs;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param msBeforeRetry milliseconds before retrying
 * @param timeoutInMs   timeout in ms
 */
public RetryWithTimeout(int msBeforeRetry,int timeoutInMs){
  super(msBeforeRetry);
  this.timeoutInMs=timeoutInMs;
  if (msBeforeRetry <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 8193
Project: 8193
Buggy source:
@Ignore @Test public void testCustomEtcdNettyClient() throws Exception {
  NioEventLoopGroup evl=new NioEventLoopGroup();
  URI uri=URI.create("String_Node_Str");
  EtcdNettyConfig config=new EtcdNettyConfig().setConnectTimeout(100).setSocketChannelClass(NioSocketChannel.class).setMaxFrameSize(1024 * 1024).setEventLoopGroup(evl).setHostName("String_Node_Str");
  EtcdNettyClient client=new EtcdNettyClient(config,uri);
  EtcdClient etcdClient=new EtcdClient(client);
  assertNotNull(etcdClient.version());
}

Fixed version (ground truth):
@Ignore @Test public void testCustomEtcdNettyClient() throws Exception {
  NioEventLoopGroup evl=new NioEventLoopGroup();
  URI uri=URI.create("String_Node_Str");
  EtcdNettyConfig config=new EtcdNettyConfig().setConnectTimeout(100).setSocketChannelClass(NioSocketChannel.class).setMaxFrameSize(1024 * 1024).setEventLoopGroup(evl).setHostName("String_Node_Str");
  EtcdNettyClient client=new EtcdNettyClient(config,uri);
  EtcdClient etcdClient=new EtcdClient(client);
  etcdClient.setRetryHandler(new RetryNTimes(0,0));
  assertNotNull(etcdClient.version());
}
Program: 8194
Project: 8194
Buggy source:
/** 
 * Constructor
 * @param startMsBeforeRetry milliseconds before retrying base time
 * @param maxRetryCount      max retry count, if maxRetryCount &lt;= 0, it will retry infinitely
 * @param maxDelay           max delay between retries
 */
public RetryWithExponentialBackOff(int startMsBeforeRetry,int maxRetryCount,int maxDelay){
  super(startMsBeforeRetry);
  this.maxRetryCount=maxRetryCount;
  this.maxDelay=maxDelay;
  if (startMsBeforeRetry <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (maxDelay <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param startMsBeforeRetry milliseconds before retrying base time
 * @param maxRetryCount      max retry count, if maxRetryCount &lt;= 0, it will retry infinitely
 * @param maxDelayInMs           max delay between retries
 */
public RetryWithExponentialBackOff(int startMsBeforeRetry,int maxRetryCount,int maxDelayInMs){
  super(startMsBeforeRetry);
  this.maxRetryCount=maxRetryCount;
  this.maxDelayInMs=maxDelayInMs;
  if (startMsBeforeRetry <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (maxDelayInMs <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 8195
Project: 8195
Buggy source:
@Override public boolean shouldRetry(ConnectionState state){
  if (this.maxRetryCount > 0 && state.retryCount > this.maxRetryCount) {
    return false;
  }
  if (state.msBeforeRetry <= 0) {
    state.msBeforeRetry=startRetryTime;
  }
 else   if (state.msBeforeRetry < maxDelay) {
    state.msBeforeRetry*=2;
  }
  if (state.msBeforeRetry > maxDelay) {
    state.msBeforeRetry=maxDelay;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean shouldRetry(ConnectionState state){
  if (this.maxRetryCount > 0 && state.retryCount > this.maxRetryCount) {
    return false;
  }
  if (state.msBeforeRetry <= 0) {
    state.msBeforeRetry=startRetryTime;
  }
 else   if (state.msBeforeRetry < maxDelayInMs) {
    state.msBeforeRetry*=2;
  }
  if (state.msBeforeRetry > maxDelayInMs) {
    state.msBeforeRetry=maxDelayInMs;
  }
  return true;
}
Program: 8196
Project: 8196
Buggy source:
@Test public void testIfCleanClose() throws IOException, EtcdException, EtcdAuthenticationException, TimeoutException {
  EtcdClient client=new EtcdClient();
  client.setRetryHandler(new RetryWithExponentialBackOff(20,4,-1));
  EtcdResponsePromise<EtcdKeysResponse> p=client.get("String_Node_Str").waitForChange().send();
  client.close();
  try {
    p.get();
    fail();
  }
 catch (  IOException e) {
    if (!(e.getCause() instanceof CancellationException)) {
      fail();
    }
  }
}

Fixed version (ground truth):
@Test public void testIfCleanClose() throws IOException, EtcdException, EtcdAuthenticationException, TimeoutException {
  EtcdClient client=new EtcdClient();
  client.setRetryHandler(new RetryWithExponentialBackOff(20,4,1000));
  EtcdResponsePromise<EtcdKeysResponse> p=client.get("String_Node_Str").waitForChange().send();
  client.close();
  try {
    p.get();
    fail();
  }
 catch (  IOException e) {
    if (!(e.getCause() instanceof CancellationException)) {
      fail();
    }
  }
}
Program: 8197
Project: 8197
Buggy source:
@Before public void setUp() throws Exception {
  this.etcd=new EtcdClient();
  this.etcd.setRetryHandler(new RetryWithExponentialBackOff(20,4,-1));
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  this.etcd=new EtcdClient();
  this.etcd.setRetryHandler(new RetryWithExponentialBackOff(20,4,10000));
}
Program: 8198
Project: 8198
Buggy source:
/** 
 * Constructor
 * @param startMsBeforeRetry milliseconds before retrying base time
 * @param maxRetryCount      max retry count, if maxRetryCount <= 0, it will retry infinitely
 * @param maxDelay           max delay between retries
 */
public RetryWithExponentialBackOff(int startMsBeforeRetry,int maxRetryCount,int maxDelay){
  super(startMsBeforeRetry);
  this.maxRetryCount=maxRetryCount;
  this.maxDelay=maxDelay;
  if (startMsBeforeRetry <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (maxDelay <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param startMsBeforeRetry milliseconds before retrying base time
 * @param maxRetryCount      max retry count, if maxRetryCount &lt;= 0, it will retry infinitely
 * @param maxDelay           max delay between retries
 */
public RetryWithExponentialBackOff(int startMsBeforeRetry,int maxRetryCount,int maxDelay){
  super(startMsBeforeRetry);
  this.maxRetryCount=maxRetryCount;
  this.maxDelay=maxDelay;
  if (startMsBeforeRetry <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (maxDelay <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 8199
Project: 8199
Buggy source:
@Override public Statement apply(Statement statement,Description description){
  return new Statement(){
    @Override public void evaluate() throws Throwable {
      try {
        client=new EtcdClient();
        EtcdVersionResponse response;
        long startMillis=System.currentTimeMillis();
        while (true) {
          try {
            response=client.version();
            break;
          }
 catch (          Throwable e) {
            if ((System.currentTimeMillis() - startMillis) + waitUnit.toMillis(wait) > maxWaitUnit.toMillis(maxWait)) {
              throw new IllegalStateException("String_Node_Str",e);
            }
            logger.info("String_Node_Str",wait,waitUnit);
            waitUnit.sleep(wait);
          }
        }
        logger.info("String_Node_Str",response.server,response.cluster);
        statement.evaluate();
      }
  finally {
        try {
          client.close();
        }
 catch (        Exception e) {
          e.printStackTrace(System.err);
        }
      }
    }
  }
;
}

Fixed version (ground truth):
@Override public Statement apply(final Statement statement,final Description description){
  return new Statement(){
    @Override public void evaluate() throws Throwable {
      try {
        client=new EtcdClient();
        EtcdVersionResponse response;
        long startMillis=System.currentTimeMillis();
        while (true) {
          try {
            response=client.version();
            break;
          }
 catch (          Throwable e) {
            if ((System.currentTimeMillis() - startMillis) + waitUnit.toMillis(wait) > maxWaitUnit.toMillis(maxWait)) {
              throw new IllegalStateException("String_Node_Str",e);
            }
            logger.info("String_Node_Str",wait,waitUnit);
            waitUnit.sleep(wait);
          }
        }
        logger.info("String_Node_Str",response.server,response.cluster);
        statement.evaluate();
      }
  finally {
        try {
          client.close();
        }
 catch (        Exception e) {
          e.printStackTrace(System.err);
        }
      }
    }
  }
;
}
Program: 8200
Project: 8200
Buggy source:
@Override protected void channelRead0(ChannelHandlerContext ctx,FullHttpResponse response) throws Exception {
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + response.status().code() + "String_Node_Str"+ this.request.getMethod().name()+ "String_Node_Str"+ this.request.getUri());
  }
  if (response.status().equals(HttpResponseStatus.MOVED_PERMANENTLY) || response.status().equals(HttpResponseStatus.TEMPORARY_REDIRECT)) {
    if (response.headers().contains("String_Node_Str")) {
      this.request.setUrl(response.headers().get("String_Node_Str"));
      this.client.connect(this.request);
      ctx.close();
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + this.request.getHttpRequest().uri() + "String_Node_Str"+ response.headers().get("String_Node_Str"));
      }
    }
 else {
      this.promise.setFailure(new Exception("String_Node_Str"));
    }
  }
 else {
    if (!response.content().isReadable()) {
      this.promise.setFailure(new IOException("String_Node_Str" + response.status()));
    }
    try {
      this.promise.setSuccess(decodeResponse(response));
    }
 catch (    Exception e) {
      this.promise.setFailure(e);
    }
  }
}

Fixed version (ground truth):
@Override protected void channelRead0(ChannelHandlerContext ctx,FullHttpResponse response) throws Exception {
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + response.status().code() + "String_Node_Str"+ this.request.getMethod().name()+ "String_Node_Str"+ this.request.getUri());
  }
  if (response.status().equals(HttpResponseStatus.MOVED_PERMANENTLY) || response.status().equals(HttpResponseStatus.TEMPORARY_REDIRECT)) {
    if (response.headers().contains("String_Node_Str")) {
      this.request.setUrl(response.headers().get("String_Node_Str"));
      this.client.connect(this.request);
      ctx.close();
      if (logger.isDebugEnabled()) {
        logger.debug("String_Node_Str" + this.request.getHttpRequest().uri() + "String_Node_Str"+ response.headers().get("String_Node_Str"));
      }
    }
 else {
      this.promise.setFailure(new Exception("String_Node_Str"));
    }
  }
 else {
    if (!response.content().isReadable()) {
      if (response.status().equals(HttpResponseStatus.OK) || response.status().equals(HttpResponseStatus.ACCEPTED) || response.status().equals(HttpResponseStatus.CREATED)) {
        this.client.connect(this.request);
        return;
      }
      this.promise.setFailure(new IOException("String_Node_Str" + response.status()));
    }
    try {
      this.promise.setSuccess(decodeResponse(response));
    }
 catch (    Exception e) {
      this.promise.setFailure(e);
    }
  }
}
Program: 8201
Project: 8201
Buggy source:
@Override public void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline p=ch.pipeline();
  if (sslContext != null) {
    p.addLast(sslContext.newHandler(ch.alloc()));
  }
  p.addLast("String_Node_Str",new HttpClientCodec());
  int maxFrameSize=Integer.parseInt(System.getProperty("String_Node_Str",Integer.toString(1024 * 100)));
  p.addLast("String_Node_Str",new HttpObjectAggregator(maxFrameSize));
}

Fixed version (ground truth):
@Override public void initChannel(SocketChannel ch) throws Exception {
  ChannelPipeline p=ch.pipeline();
  if (sslContext != null) {
    p.addLast(sslContext.newHandler(ch.alloc()));
  }
  p.addLast("String_Node_Str",new HttpClientCodec());
  p.addLast("String_Node_Str",new ChunkedWriteHandler());
  int maxFrameSize=Integer.parseInt(System.getProperty("String_Node_Str",Integer.toString(1024 * 100)));
  p.addLast("String_Node_Str",new HttpObjectAggregator(maxFrameSize));
}
Program: 8202
Project: 8202
Buggy source:
private Bootstrap initClient(final SslContext sslContext,final NioEventLoopGroup eventLoopGroup,int connectTimeout){
  return new Bootstrap().group(eventLoopGroup).channel(NioSocketChannel.class).option(ChannelOption.ALLOCATOR,PooledByteBufAllocator.DEFAULT).option(ChannelOption.TCP_NODELAY,true).option(ChannelOption.CONNECT_TIMEOUT_MILLIS,connectTimeout).handler(new ChannelInitializer<SocketChannel>(){
    @Override public void initChannel(    SocketChannel ch) throws Exception {
      ChannelPipeline p=ch.pipeline();
      if (sslContext != null) {
        p.addLast(sslContext.newHandler(ch.alloc()));
      }
      p.addLast("String_Node_Str",new HttpClientCodec());
      int maxFrameSize=Integer.parseInt(System.getProperty("String_Node_Str",Integer.toString(1024 * 100)));
      p.addLast("String_Node_Str",new HttpObjectAggregator(maxFrameSize));
    }
  }
);
}

Fixed version (ground truth):
private Bootstrap initClient(final SslContext sslContext,final NioEventLoopGroup eventLoopGroup,int connectTimeout){
  return new Bootstrap().group(eventLoopGroup).channel(NioSocketChannel.class).option(ChannelOption.ALLOCATOR,PooledByteBufAllocator.DEFAULT).option(ChannelOption.TCP_NODELAY,true).option(ChannelOption.CONNECT_TIMEOUT_MILLIS,connectTimeout).handler(new ChannelInitializer<SocketChannel>(){
    @Override public void initChannel(    SocketChannel ch) throws Exception {
      ChannelPipeline p=ch.pipeline();
      if (sslContext != null) {
        p.addLast(sslContext.newHandler(ch.alloc()));
      }
      p.addLast("String_Node_Str",new HttpClientCodec());
      p.addLast("String_Node_Str",new ChunkedWriteHandler());
      int maxFrameSize=Integer.parseInt(System.getProperty("String_Node_Str",Integer.toString(1024 * 100)));
      p.addLast("String_Node_Str",new HttpObjectAggregator(maxFrameSize));
    }
  }
);
}
Program: 8204
Project: 8204
Buggy source:
/** 
 * Modify the pipeline for the request
 * @param req      to process
 * @param pipeline to modify
 * @param < R >      Type of Response
 */
@SuppressWarnings("String_Node_Str") private <R>void modifyPipeLine(EtcdRequest<R> req,ChannelPipeline pipeline){
  if (req.getTimeout() != -1) {
    pipeline.addFirst(new ChannelHandlerAdapter(){
      @Override public void exceptionCaught(      ChannelHandlerContext ctx,      Throwable cause) throws Exception {
        req.getPromise().getNettyPromise().setFailure(cause);
      }
    }
);
    pipeline.addFirst(new ReadTimeoutHandler(req.getTimeout(),req.getTimeoutUnit()));
  }
  if (req instanceof EtcdKeyRequest) {
    pipeline.addLast(new EtcdKeyResponseHandler(this,(EtcdKeyRequest)req));
  }
 else   if (req instanceof EtcdVersionRequest) {
    pipeline.addLast(new SimpleChannelInboundHandler<FullHttpResponse>(){
      @Override protected void channelRead0(      ChannelHandlerContext ctx,      FullHttpResponse msg) throws Exception {
        ((Promise<String>)((EtcdVersionRequest)req).getPromise()).setSuccess(msg.content().toString(Charset.defaultCharset()));
      }
    }
);
  }
 else {
    throw new RuntimeException("String_Node_Str" + req.getClass().getName());
  }
}

Fixed version (ground truth):
/** 
 * Modify the pipeline for the request
 * @param req      to process
 * @param pipeline to modify
 * @param < R >      Type of Response
 */
@SuppressWarnings("String_Node_Str") private <R>void modifyPipeLine(EtcdRequest<R> req,ChannelPipeline pipeline){
  if (req.getTimeout() != -1) {
    pipeline.addFirst(new ChannelHandlerAdapter(){
      @Override public void exceptionCaught(      ChannelHandlerContext ctx,      Throwable cause) throws Exception {
        req.getPromise().getNettyPromise().setFailure(cause);
      }
    }
);
    pipeline.addFirst(new ReadTimeoutHandler(req.getTimeout(),req.getTimeoutUnit()));
  }
  if (req instanceof EtcdKeyRequest) {
    pipeline.addLast(new EtcdKeyResponseHandler(this,(EtcdKeyRequest)req));
  }
 else   if (req instanceof EtcdVersionRequest) {
    pipeline.addLast(new SimpleChannelInboundHandler<FullHttpResponse>(){
      @Override protected void channelRead0(      ChannelHandlerContext ctx,      FullHttpResponse msg) throws Exception {
        (((EtcdVersionRequest)req).getPromise()).getNettyPromise().setSuccess(msg.content().toString(Charset.defaultCharset()));
      }
    }
);
  }
 else {
    throw new RuntimeException("String_Node_Str" + req.getClass().getName());
  }
}
Program: 8205
Project: 8205
Buggy source:
@Override protected void channelRead0(ChannelHandlerContext ctx,FullHttpResponse msg) throws Exception {
  ((Promise<String>)((EtcdVersionRequest)req).getPromise()).setSuccess(msg.content().toString(Charset.defaultCharset()));
}

Fixed version (ground truth):
@Override protected void channelRead0(ChannelHandlerContext ctx,FullHttpResponse msg) throws Exception {
  (((EtcdVersionRequest)req).getPromise()).getNettyPromise().setSuccess(msg.content().toString(Charset.defaultCharset()));
}
Program: 8206
Project: 8206
Buggy source:
/** 
 * Gives you an all purpose thread-safe persisted Tracker object.
 * @return a shared Tracker
 */
public synchronized Tracker getTracker(){
  if (mPiwikTracker == null) {
    try {
      mPiwikTracker=getPiwik().newTracker(getTrackerUrl(),getSiteId(),"String_Node_Str");
    }
 catch (    MalformedURLException e) {
      e.printStackTrace();
      throw new RuntimeException("String_Node_Str");
    }
  }
  return mPiwikTracker;
}

Fixed version (ground truth):
/** 
 * Gives you an all purpose thread-safe persisted Tracker object.
 * @return a shared Tracker
 */
public synchronized Tracker getTracker(){
  if (mPiwikTracker == null)   mPiwikTracker=getPiwik().newTracker(getTrackerUrl(),getSiteId(),"String_Node_Str");
  return mPiwikTracker;
}
Program: 8207
Project: 8207
Buggy source:
/** 
 * Use this to disable Piwik, e.g. if the user opted out of tracking. Piwik will persist the choice and remain disable on next instance creation.</p> The choice is stored in   {@link #PREFERENCE_FILE_NAME} under the key {@link #PREFERENCE_KEY_OPTOUT}.
 * @param optOut true to disable reporting
 */
public void setOptOut(boolean optOut){
  mOptOut=optOut;
  getSharedPreferences().edit().putBoolean(PREFERENCE_KEY_OPTOUT,optOut).apply();
}

Fixed version (ground truth):
/** 
 * Use this to disable Piwik, e.g. if the user opted out of tracking. Piwik will persist the choice and remain disable on next instance creation.<p> The choice is stored in   {@link #PREFERENCE_FILE_NAME} under the key {@link #PREFERENCE_KEY_OPTOUT}.
 * @param optOut true to disable reporting
 */
public void setOptOut(boolean optOut){
  mOptOut=optOut;
  getSharedPreferences().edit().putBoolean(PREFERENCE_KEY_OPTOUT,optOut).apply();
}
Program: 8208
Project: 8208
Buggy source:
/** 
 * For testing purposes
 * @return query of the event ?r=1&sideId=1..
 */
@VisibleForTesting public String getLastEvent(){
  return mLastEvent;
}

Fixed version (ground truth):
/** 
 * For testing purposes
 * @return query of the event
 */
@VisibleForTesting public String getLastEvent(){
  return mLastEvent;
}
Program: 8209
Project: 8209
Buggy source:
/** 
 * Defines the User ID for this request. User ID is any non empty unique string identifying the user (such as an email address or a username). To access this value, users must be logged-in in your system so you can fetch this user ID from your system, and pass it to Piwik. <p/> When specified, the User ID will be "enforced". This means that if there is no recent visit with this User ID, a new one will be created. If a visit is found in the last 30 minutes with your specified User ID, then the new action will be recorded to this existing visit.
 * @param userId passing null will delete the current user-id.
 */
public Tracker setUserId(String userId){
  mDefaultTrackMe.set(QueryParams.USER_ID,userId);
  getSharedPreferences().edit().putString(PREF_KEY_TRACKER_USERID,userId).apply();
  return this;
}

Fixed version (ground truth):
/** 
 * Defines the User ID for this request. User ID is any non empty unique string identifying the user (such as an email address or a username). To access this value, users must be logged-in in your system so you can fetch this user ID from your system, and pass it to Piwik. <p> When specified, the User ID will be "enforced". This means that if there is no recent visit with this User ID, a new one will be created. If a visit is found in the last 30 minutes with your specified User ID, then the new action will be recorded to this existing visit.
 * @param userId passing null will delete the current user-id.
 */
public Tracker setUserId(String userId){
  mDefaultTrackMe.set(QueryParams.USER_ID,userId);
  getSharedPreferences().edit().putString(PREF_KEY_TRACKER_USERID,userId).apply();
  return this;
}
Program: 8210
Project: 8210
Buggy source:
@Override public String toString(){
  if (size() == 0) {
    return null;
  }
  return new JSONObject(this).toString();
}

Fixed version (ground truth):
public String toString(){
  JSONObject json=new JSONObject(mVars);
  return json.length() > 0 ? json.toString() : null;
}
Program: 8211
Project: 8211
Buggy source:
/** 
 * @param index  index accepts values from 1 to 5.
 * @param values packed key/value pair
 * @return super.put result or null if key is null or value length is not equals 2
 */
@Override public JSONArray put(String index,JSONArray values){
  if (values.length() == 2 && index != null) {
    return super.put(index,values);
  }
  Logy.d(LOGGER_TAG,"String_Node_Str");
  return null;
}

Fixed version (ground truth):
/** 
 * @param index  index accepts values from 1 to 5.
 * @param values packed key/value pair
 * @return super.put result or null if key is null or value length is not equals 2
 */
public JSONArray put(String index,JSONArray values){
  if (values.length() != 2 || index == null) {
    Logy.d(LOGGER_TAG,"String_Node_Str");
    return null;
  }
  return mVars.put(index,values);
}
Program: 8212
Project: 8212
Buggy source:
@Test public void testWrongValueSize() throws Exception {
  CustomVariables cv=new CustomVariables();
  assertNull(cv.put("String_Node_Str",new JSONArray(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"))));
  assertNull(cv.put("String_Node_Str",new JSONArray(Arrays.asList("String_Node_Str","String_Node_Str"))));
  assertEquals(cv.get("String_Node_Str"),cv.put("String_Node_Str",new JSONArray(Arrays.asList("String_Node_Str","String_Node_Str"))));
}

Fixed version (ground truth):
@Test public void testWrongValueSize() throws Exception {
  CustomVariables cv=new CustomVariables();
  assertNull(cv.put("String_Node_Str",new JSONArray(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str"))));
  assertEquals(null,cv.toString());
  assertNull(cv.put("String_Node_Str",new JSONArray(Arrays.asList("String_Node_Str","String_Node_Str"))));
  assertEquals("String_Node_Str",cv.toString());
}
Program: 8213
Project: 8213
Buggy source:
@Test public void testWrongIndex() throws Exception {
  CustomVariables cv=new CustomVariables();
  cv.put(1,"String_Node_Str","String_Node_Str");
  cv.put(10,"String_Node_Str","String_Node_Str");
  cv.put(-1,"String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",cv.toString());
}

Fixed version (ground truth):
@Test public void testWrongIndex() throws Exception {
  CustomVariables cv=new CustomVariables();
  cv.put(1,"String_Node_Str","String_Node_Str");
  cv.put(-1,"String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",cv.toString());
}
Program: 8214
Project: 8214
Buggy source:
/** 
 * A custom variable is a custom name-value pair that you can assign to your users or screen views, and then visualize the reports of how many visits, conversions, etc. for each custom variable. A custom variable is defined by a name — for example, "User status" — and a value – for example, "LoggedIn" or "Anonymous". You can track up to 5 custom variables for each user to your app.
 * @param index this Integer accepts values from 1 to 5.A given custom variable name must always be stored in the same "index" per session. For example, if you choose to store the variable name = "Gender" in index = 1 and you record another custom variable in index = 1, then the "Gender" variable will be deleted and replaced with the new custom variable stored in index 1.
 * @param name  String defines the name of a specific Custom Variable such as "User type".
 * @param value String defines the value of a specific Custom Variable such as "Customer".
 */
public synchronized TrackMe setScreenCustomVariable(int index,String name,String value){
  mScreenCustomVariable.put(index,name,value);
  return this;
}

Fixed version (ground truth):
/** 
 * Just like   {@link Tracker#setVisitCustomVariable(int,String,String)} but only valid per screen.Only takes effect when setting prior to tracking the screen view.
 */
public synchronized TrackMe setScreenCustomVariable(int index,String name,String value){
  mScreenCustomVariable.put(index,name,value);
  return this;
}
Program: 8215
Project: 8215
Buggy source:
/** 
 * Does exactly the same as setUserCustomVariable but use screen scope You can track up to 5 custom variables for each screen view.
 */
public Tracker setVisitCustomVariable(int index,String name,String value){
  mVisitCustomVariable.put(index,name,value);
  return this;
}

Fixed version (ground truth):
/** 
 * A custom variable is a custom name-value pair that you can assign to your users or screen views, and then visualize the reports of how many visits, conversions, etc. for each custom variable. A custom variable is defined by a name — for example, "User status" — and a value – for example, "LoggedIn" or "Anonymous". You can track up to 5 custom variables for each user to your app.
 * @param index this Integer accepts values from 1 to 5.A given custom variable name must always be stored in the same "index" per session. For example, if you choose to store the variable name = "Gender" in index = 1 and you record another custom variable in index = 1, then the "Gender" variable will be deleted and replaced with the new custom variable stored in index 1.
 * @param name  String defines the name of a specific Custom Variable such as "User type".
 * @param value String defines the value of a specific Custom Variable such as "Customer".
 */
public Tracker setVisitCustomVariable(int index,String name,String value){
  mVisitCustomVariable.put(index,name,value);
  return this;
}
Program: 8217
Project: 8217
Buggy source:
@Test public void testSetUserId() throws Exception {
  Tracker tracker=createTracker();
  tracker.setUserId("String_Node_Str");
  assertEquals(tracker.getUserId(),"String_Node_Str");
  tracker.setUserId("String_Node_Str");
  assertEquals(tracker.getUserId(),"String_Node_Str");
  tracker.setUserId(null);
  assertNull(tracker.getUserId());
  String uuid=UUID.randomUUID().toString();
  tracker.setUserId(uuid);
  assertEquals(uuid,tracker.getUserId());
  assertEquals(uuid,createTracker().getUserId());
}

Fixed version (ground truth):
@Test public void testSetUserId() throws Exception {
  Tracker tracker=createTracker();
  assertNotNull(tracker.getDefaultTrackMe().get(QueryParams.USER_ID));
  tracker.setUserId("String_Node_Str");
  assertEquals(tracker.getUserId(),"String_Node_Str");
  tracker.setUserId("String_Node_Str");
  assertEquals(tracker.getUserId(),"String_Node_Str");
  tracker.setUserId(null);
  assertNull(tracker.getUserId());
  String uuid=UUID.randomUUID().toString();
  tracker.setUserId(uuid);
  assertEquals(uuid,tracker.getUserId());
  assertEquals(uuid,createTracker().getUserId());
}
Program: 8218
Project: 8218
Buggy source:
private boolean doRequest(HttpRequestBase requestBase){
  HttpClient client=new DefaultHttpClient();
  HttpConnectionParams.setConnectionTimeout(client.getParams(),mTimeOut);
  HttpResponse response;
  if (mPiwik.isDryRun()) {
    Logy.d(LOGGER_TAG,"String_Node_Str" + mDryRunOutput.size());
    mDryRunOutput.add(requestBase);
  }
 else {
    if (!mDryRunOutput.isEmpty())     mDryRunOutput.clear();
    try {
      response=client.execute(requestBase);
      int statusCode=response.getStatusLine().getStatusCode();
      Logy.d(LOGGER_TAG,String.format("String_Node_Str",statusCode));
      return statusCode == HttpStatus.SC_NO_CONTENT || statusCode == HttpStatus.SC_OK;
    }
 catch (    IOException e) {
      Logy.w(LOGGER_TAG,"String_Node_Str",e);
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean doRequest(HttpRequestBase requestBase){
  HttpClient client=new DefaultHttpClient();
  HttpConnectionParams.setConnectionTimeout(client.getParams(),mTimeOut);
  HttpResponse response;
  if (mPiwik.isDryRun()) {
    Logy.d(LOGGER_TAG,"String_Node_Str" + mDryRunOutput.size());
    mDryRunOutput.add(requestBase);
  }
 else {
    if (!mDryRunOutput.isEmpty())     mDryRunOutput.clear();
    try {
      response=client.execute(requestBase);
      int statusCode=response.getStatusLine().getStatusCode();
      Logy.d(LOGGER_TAG,String.format("String_Node_Str",statusCode));
      return statusCode == HttpStatus.SC_NO_CONTENT || statusCode == HttpStatus.SC_OK;
    }
 catch (    Exception e) {
      Logy.w(LOGGER_TAG,"String_Node_Str",e);
    }
  }
  return false;
}
Program: 8219
Project: 8219
Buggy source:
public int getTimeOut(){
  return mTimeOut;
}

Fixed version (ground truth):
/** 
 * Connection timeout in miliseconds
 * @return
 */
public int getTimeOut(){
  return mTimeOut;
}
Program: 8220
Project: 8220
Buggy source:
public long getSessionTimeout(){
  return mSessionTimeout;
}

Fixed version (ground truth):
/** 
 * Default is 30min (30*60*1000).
 * @return session timeout value in miliseconds
 */
public long getSessionTimeout(){
  return mSessionTimeout;
}
Program: 8221
Project: 8221
Buggy source:
public Tracker track(TrackMe trackMe){
  doInjections(trackMe);
  String event=trackMe.build();
  if (mPiwik.isOptOut()) {
    mLastEvent=event;
    Logy.d(Tracker.LOGGER_TAG,String.format("String_Node_Str",event));
  }
 else {
    Logy.d(Tracker.LOGGER_TAG,String.format("String_Node_Str",event));
    mDispatcher.submit(event);
  }
  return this;
}

Fixed version (ground truth):
public Tracker track(TrackMe trackMe){
  boolean newSession;
synchronized (mSessionLock) {
    newSession=tryNewSession();
    if (newSession)     mSessionStartLatch=new CountDownLatch(1);
  }
  if (newSession) {
    injectInitialParams(trackMe);
  }
 else {
    try {
      mSessionStartLatch.await(mDispatcher.getTimeOut(),TimeUnit.MILLISECONDS);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  injectBaseParams(trackMe);
  String event=trackMe.build();
  if (mPiwik.isOptOut()) {
    mLastEvent=event;
    Logy.d(Tracker.LOGGER_TAG,String.format("String_Node_Str",event));
  }
 else {
    Logy.d(Tracker.LOGGER_TAG,String.format("String_Node_Str",event));
    mDispatcher.submit(event);
  }
  if (newSession)   mSessionStartLatch.countDown();
  return this;
}
Program: 8222
Project: 8222
Buggy source:
/** 
 * There parameters are only interesting for the very first query.
 */
private void injectInitialParams(TrackMe trackMe){
  trackMe.trySet(QueryParams.SESSION_START,mDefaultTrackMe.get(QueryParams.SESSION_START));
  trackMe.trySet(QueryParams.SCREEN_RESOLUTION,mDefaultTrackMe.get(QueryParams.SCREEN_RESOLUTION));
  trackMe.trySet(QueryParams.USER_AGENT,mDefaultTrackMe.get(QueryParams.USER_AGENT));
  trackMe.trySet(QueryParams.LANGUAGE,mDefaultTrackMe.get(QueryParams.LANGUAGE));
  trackMe.trySet(QueryParams.COUNTRY,mDefaultTrackMe.get(QueryParams.COUNTRY));
  trackMe.trySet(QueryParams.FIRST_VISIT_TIMESTAMP,mDefaultTrackMe.get(QueryParams.FIRST_VISIT_TIMESTAMP));
  trackMe.trySet(QueryParams.TOTAL_NUMBER_OF_VISITS,mDefaultTrackMe.get(QueryParams.TOTAL_NUMBER_OF_VISITS));
  trackMe.trySet(QueryParams.PREVIOUS_VISIT_TIMESTAMP,mDefaultTrackMe.get(QueryParams.PREVIOUS_VISIT_TIMESTAMP));
}

Fixed version (ground truth):
/** 
 * There parameters are only interesting for the very first query.
 */
private void injectInitialParams(TrackMe trackMe){
  long firstVisitTime;
  int visitCount;
  long previousVisit;
synchronized (getSharedPreferences()) {
    visitCount=1 + getSharedPreferences().getInt(PREF_KEY_TRACKER_VISITCOUNT,0);
    getSharedPreferences().edit().putInt(PREF_KEY_TRACKER_VISITCOUNT,visitCount).apply();
  }
synchronized (getSharedPreferences()) {
    firstVisitTime=getSharedPreferences().getLong(PREF_KEY_TRACKER_FIRSTVISIT,-1);
    if (firstVisitTime == -1) {
      firstVisitTime=System.currentTimeMillis() / 1000;
      getSharedPreferences().edit().putLong(PREF_KEY_TRACKER_FIRSTVISIT,firstVisitTime).apply();
    }
  }
synchronized (getSharedPreferences()) {
    previousVisit=getSharedPreferences().getLong(PREF_KEY_TRACKER_PREVIOUSVISIT,-1);
    getSharedPreferences().edit().putLong(PREF_KEY_TRACKER_PREVIOUSVISIT,System.currentTimeMillis() / 1000).apply();
  }
  mDefaultTrackMe.trySet(QueryParams.FIRST_VISIT_TIMESTAMP,firstVisitTime);
  mDefaultTrackMe.trySet(QueryParams.TOTAL_NUMBER_OF_VISITS,visitCount);
  if (previousVisit != -1)   mDefaultTrackMe.trySet(QueryParams.PREVIOUS_VISIT_TIMESTAMP,previousVisit);
  trackMe.trySet(QueryParams.SESSION_START,mDefaultTrackMe.get(QueryParams.SESSION_START));
  trackMe.trySet(QueryParams.SCREEN_RESOLUTION,mDefaultTrackMe.get(QueryParams.SCREEN_RESOLUTION));
  trackMe.trySet(QueryParams.USER_AGENT,mDefaultTrackMe.get(QueryParams.USER_AGENT));
  trackMe.trySet(QueryParams.LANGUAGE,mDefaultTrackMe.get(QueryParams.LANGUAGE));
  trackMe.trySet(QueryParams.COUNTRY,mDefaultTrackMe.get(QueryParams.COUNTRY));
  trackMe.trySet(QueryParams.FIRST_VISIT_TIMESTAMP,mDefaultTrackMe.get(QueryParams.FIRST_VISIT_TIMESTAMP));
  trackMe.trySet(QueryParams.TOTAL_NUMBER_OF_VISITS,mDefaultTrackMe.get(QueryParams.TOTAL_NUMBER_OF_VISITS));
  trackMe.trySet(QueryParams.PREVIOUS_VISIT_TIMESTAMP,mDefaultTrackMe.get(QueryParams.PREVIOUS_VISIT_TIMESTAMP));
}
Program: 8223
Project: 8223
Buggy source:
/** 
 * Returns real screen size if QueryParams.SCREEN_RESOLUTION is empty Note that the results also depend on the current device orientation. http://stackoverflow.com/a/9316553
 * @return formatted string: WxH
 */
public String getResolution(){
  int[] resolution=DeviceHelper.getResolution(mPiwik.getContext());
  if (resolution == null)   return DEFAULT_UNKNOWN_VALUE;
  return String.format("String_Node_Str",resolution[0],resolution[1]);
}

Fixed version (ground truth):
/** 
 * Returns real screen size if QueryParams.SCREEN_RESOLUTION is empty Note that the results also depend on the current device orientation. http://stackoverflow.com/a/9316553
 * @return formatted string: WxH
 */
public String getResolution(){
  if (mScreenResolution == null) {
    int[] resolution=DeviceHelper.getResolution(mPiwik.getContext());
    if (resolution == null)     mScreenResolution=DEFAULT_UNKNOWN_VALUE;
 else     mScreenResolution=String.format("String_Node_Str",resolution[0],resolution[1]);
  }
  return mScreenResolution;
}
Program: 8224
Project: 8224
Buggy source:
/** 
 * Returns user country
 * @return country
 */
public String getCountry(){
  if (userCountry == null) {
    userCountry=Locale.getDefault().getCountry();
  }
  return userCountry;
}

Fixed version (ground truth):
/** 
 * Returns user country
 * @return country
 */
public String getCountry(){
  if (mUserCountry == null) {
    mUserCountry=DeviceHelper.getUserCountry();
  }
  return mUserCountry;
}
Program: 8225
Project: 8225
Buggy source:
private void injectBaseParams(TrackMe trackMe){
  trackMe.trySet(QueryParams.API_VERSION,defaultAPIVersionValue);
  trackMe.trySet(QueryParams.RECORD,defaultRecordValue);
  trackMe.trySet(QueryParams.SITE_ID,mSiteId);
  trackMe.trySet(QueryParams.VISIT_SCOPE_CUSTOM_VARIABLES,mVisitCustomVariable.toString());
  trackMe.trySet(QueryParams.RANDOM_NUMBER,randomObject.nextInt(100000));
  trackMe.trySet(QueryParams.VISITOR_ID,getVisitorId());
  trackMe.trySet(QueryParams.USER_ID,getUserId());
  trackMe.trySet(QueryParams.DATETIME_OF_REQUEST,new SimpleDateFormat("String_Node_Str").format(new Date()));
  trackMe.trySet(QueryParams.SEND_IMAGE,"String_Node_Str");
  String urlPath=trackMe.get(QueryParams.URL_PATH);
  if (urlPath == null) {
    urlPath=getApplicationBaseURL() + "String_Node_Str";
  }
 else   if (urlPath.startsWith("String_Node_Str")) {
    urlPath=getApplicationBaseURL() + urlPath;
  }
 else   if (urlPath.startsWith("String_Node_Str") || urlPath.startsWith("String_Node_Str")) {
  }
 else   if (!urlPath.startsWith("String_Node_Str")) {
    urlPath=getApplicationBaseURL() + "String_Node_Str" + urlPath;
  }
  trackMe.set(QueryParams.URL_PATH,urlPath);
}

Fixed version (ground truth):
private void injectBaseParams(TrackMe trackMe){
  trackMe.trySet(QueryParams.API_VERSION,defaultAPIVersionValue);
  trackMe.trySet(QueryParams.RECORD,defaultRecordValue);
  trackMe.trySet(QueryParams.SITE_ID,mSiteId);
  trackMe.trySet(QueryParams.VISIT_SCOPE_CUSTOM_VARIABLES,mVisitCustomVariable.toString());
  trackMe.trySet(QueryParams.RANDOM_NUMBER,mRandomAntiCachingValue.nextInt(100000));
  trackMe.trySet(QueryParams.VISITOR_ID,getVisitorId());
  trackMe.trySet(QueryParams.USER_ID,getUserId());
  trackMe.trySet(QueryParams.DATETIME_OF_REQUEST,new SimpleDateFormat("String_Node_Str").format(new Date()));
  trackMe.trySet(QueryParams.SEND_IMAGE,"String_Node_Str");
  String urlPath=trackMe.get(QueryParams.URL_PATH);
  if (urlPath == null) {
    urlPath=getApplicationBaseURL() + "String_Node_Str";
  }
 else   if (urlPath.startsWith("String_Node_Str")) {
    urlPath=getApplicationBaseURL() + urlPath;
  }
 else   if (urlPath.startsWith("String_Node_Str") || urlPath.startsWith("String_Node_Str")) {
  }
 else   if (!urlPath.startsWith("String_Node_Str")) {
    urlPath=getApplicationBaseURL() + "String_Node_Str" + urlPath;
  }
  trackMe.set(QueryParams.URL_PATH,urlPath);
}
Program: 8226
Project: 8226
Buggy source:
/** 
 * Domain used to build required parameter url (http://developer.piwik.org/api-reference/tracking-api) If domain wasn't set `Application.getPackageName()` method will be used
 * @param domain your-domain.com
 */
public Tracker setApplicationDomain(String domain){
  applicationDomain=domain;
  return this;
}

Fixed version (ground truth):
/** 
 * Domain used to build required parameter url (http://developer.piwik.org/api-reference/tracking-api) If domain wasn't set `Application.getPackageName()` method will be used
 * @param domain your-domain.com
 */
public Tracker setApplicationDomain(String domain){
  mApplicationDomain=domain;
  return this;
}
Program: 8227
Project: 8227
Buggy source:
/** 
 * Returns user language
 * @return language
 */
public String getLanguage(){
  if (userLanguage == null) {
    userLanguage=Locale.getDefault().getLanguage();
  }
  return userLanguage;
}

Fixed version (ground truth):
/** 
 * Returns user language
 * @return language
 */
public String getLanguage(){
  if (mUserLanguage == null) {
    mUserLanguage=DeviceHelper.getUserLanguage();
  }
  return mUserLanguage;
}
Program: 8228
Project: 8228
Buggy source:
/** 
 * Sets custom UserAgent
 * @param userAgent your custom UserAgent String
 */
public void setUserAgent(String userAgent){
  this.userAgent=userAgent;
}

Fixed version (ground truth):
/** 
 * Sets custom UserAgent
 * @param userAgent your custom UserAgent String
 */
public void setUserAgent(String userAgent){
  mUserAgent=userAgent;
}
Program: 8229
Project: 8229
Buggy source:
protected String getApplicationDomain(){
  return applicationDomain != null ? applicationDomain : mPiwik.getApplicationDomain();
}

Fixed version (ground truth):
protected String getApplicationDomain(){
  return mApplicationDomain != null ? mApplicationDomain : mPiwik.getApplicationDomain();
}
Program: 8230
Project: 8230
Buggy source:
/** 
 * Returns android system user agent
 * @return well formatted user agent
 */
public String getUserAgent(){
  if (userAgent == null) {
    userAgent=System.getProperty("String_Node_Str");
  }
  return userAgent;
}

Fixed version (ground truth):
/** 
 * Returns android system user agent
 * @return well formatted user agent
 */
public String getUserAgent(){
  if (mUserAgent == null) {
    mUserAgent=DeviceHelper.getUserAgent();
  }
  return mUserAgent;
}
Program: 8231
Project: 8231
Buggy source:
/** 
 * Events are a useful way to collect data about a user's interaction with interactive components of your app, like button presses or the use of a particular item in a game.
 * @param category (required) – this String defines the event category.You might define event categories based on the class of user actions, like clicks or gestures or voice commands, or you might define them based upon the features available in your application (play, pause, fast forward, etc.).
 * @param action   (required) this String defines the specific event action within the category specified.In the example, we are basically saying that the category of the event is user clicks, and the action is a button click.
 * @param label    defines a label associated with the event. For example, if you have multiple Button controls on ascreen, you might use the label to specify the specific View control identifier that was clicked.
 * @param value    defines a numeric value associated with the event. For example, if you were tracking "Buy"button clicks, you might log the number of items being purchased, or their total cost.
 */
public Tracker trackEvent(String category,String action,String label,Integer value){
  return track(new TrackMe().set(QueryParams.EVENT_ACTION,action).set(QueryParams.EVENT_CATEGORY,category).set(QueryParams.EVENT_NAME,label).set(QueryParams.EVENT_VALUE,value));
}

Fixed version (ground truth):
/** 
 * Events are a useful way to collect data about a user's interaction with interactive components of your app, like button presses or the use of a particular item in a game.
 * @param category (required) – this String defines the event category.You might define event categories based on the class of user actions, like clicks or gestures or voice commands, or you might define them based upon the features available in your application (play, pause, fast forward, etc.).
 * @param action   (required) this String defines the specific event action within the category specified.In the example, we are basically saying that the category of the event is user clicks, and the action is a button click.
 * @param label    defines a label associated with the event. For example, if you have multiple Button controls on ascreen, you might use the label to specify the specific View control identifier that was clicked.
 * @param value    defines a numeric value associated with the event. For example, if you were tracking "Buy"button clicks, you might log the number of items being purchased, or their total cost.
 */
public Tracker trackEvent(String category,String action,String label,Integer value){
  return track(new TrackMe().set(QueryParams.EVENT_CATEGORY,category).set(QueryParams.EVENT_ACTION,action).set(QueryParams.EVENT_NAME,label).set(QueryParams.EVENT_VALUE,value));
}
Program: 8232
Project: 8232
Buggy source:
/** 
 * The current user-id, if none is set, one will be generated and persisted.
 * @return
 */
public String getUserId(){
  if (mUserId == null) {
    mUserId=UUID.randomUUID().toString();
    getSharedPreferences().edit().putString(PREF_KEY_TRACKER_USERID,mUserId).commit();
  }
  return mUserId;
}

Fixed version (ground truth):
/** 
 * @return a user-id string, either the one you set or the one Piwik generated for you.
 */
public String getUserId(){
  if (mUserId == null) {
    mUserId=UUID.randomUUID().toString();
    getSharedPreferences().edit().putString(PREF_KEY_TRACKER_USERID,mUserId).commit();
  }
  return mUserId;
}
Program: 8233
Project: 8233
Buggy source:
public void setDebug(boolean debug){
  mDebug=debug;
  Logy.sLoglevel=debug ? Logy.VERBOSE : Logy.NORMAL;
}

Fixed version (ground truth):
public void setDebug(boolean debug){
  mDebug=debug;
  Logy.sLoglevel=debug ? Logy.VERBOSE : Logy.QUIET;
}
Program: 8234
Project: 8234
Buggy source:
public static void e(String c,String s,Throwable tr){
  if (sLoglevel >= SILENT) {
    Log.e(c,s,tr);
  }
}

Fixed version (ground truth):
public static void e(String c,String s,Throwable tr){
  if (sLoglevel != SILENT) {
    Log.e(c,s,tr);
  }
}
Program: 8235
Project: 8235
Buggy source:
public static void w(String c,String s,Throwable tr){
  if (sLoglevel >= SILENT) {
    Log.w(c,s,tr);
  }
}

Fixed version (ground truth):
public static void w(String c,String s,Throwable tr){
  if (sLoglevel > QUIET) {
    Log.w(c,s,tr);
  }
}
Program: 8236
Project: 8236
Buggy source:
@Test public void testPiwikExceptionHandler() throws Exception {
  assertFalse(Thread.getDefaultUncaughtExceptionHandler() instanceof PiwikExceptionHandler);
  QuickTrack.trackUncaughtExceptions(dummyTracker);
  assertTrue(Thread.getDefaultUncaughtExceptionHandler() instanceof PiwikExceptionHandler);
  try {
    int i=1 / 0;
    assertNotEquals(i,0);
  }
 catch (  Exception e) {
    (Thread.getDefaultUncaughtExceptionHandler()).uncaughtException(Thread.currentThread(),e);
  }
  QueryHashMap<String,String> queryParams=parseEventUrl(dummyTracker.getLastEvent());
  validateDefaultQuery(queryParams);
  assertEquals(queryParams.get(QueryParams.EVENT_CATEGORY),"String_Node_Str");
  assertTrue(queryParams.get(QueryParams.EVENT_ACTION).startsWith("String_Node_Str"));
  assertEquals(queryParams.get(QueryParams.EVENT_NAME),"String_Node_Str");
  assertEquals(queryParams.get(QueryParams.EVENT_VALUE),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testPiwikExceptionHandler() throws Exception {
  Tracker tracker=createTracker();
  assertFalse(Thread.getDefaultUncaughtExceptionHandler() instanceof PiwikExceptionHandler);
  QuickTrack.trackUncaughtExceptions(tracker);
  assertTrue(Thread.getDefaultUncaughtExceptionHandler() instanceof PiwikExceptionHandler);
  try {
    int i=1 / 0;
    assertNotEquals(i,0);
  }
 catch (  Exception e) {
    (Thread.getDefaultUncaughtExceptionHandler()).uncaughtException(Thread.currentThread(),e);
  }
  QueryHashMap<String,String> queryParams=parseEventUrl(tracker.getLastEvent());
  validateDefaultQuery(queryParams);
  assertEquals(queryParams.get(QueryParams.EVENT_CATEGORY),"String_Node_Str");
  assertTrue(queryParams.get(QueryParams.EVENT_ACTION).startsWith("String_Node_Str"));
  assertEquals(queryParams.get(QueryParams.EVENT_NAME),"String_Node_Str");
  assertEquals(queryParams.get(QueryParams.EVENT_VALUE),"String_Node_Str");
}