nus-yam/ex-repair huggingface dataset:
Program: 85128
Project: 85128
Buggy source:
private long hash(byte[] digest,int number){
  return (((long)(digest[3 + number * 4] & 0xFF) << 24) | ((long)(digest[2 + number * 4] & 0xFF) << 16) | ((long)(digest[1 + number * 4] & 0xFF) << 8)| (digest[0 + number * 4] & 0xFF)) & 0xFFFFFFFFL;
}

Fixed version (ground truth):
private long hash(byte[] digest,int number){
  return (((long)(digest[3 + number * 4] & 0xFF) << 24) | ((long)(digest[2 + number * 4] & 0xFF) << 16) | ((long)(digest[1 + number * 4] & 0xFF) << 8)| (digest[number * 4] & 0xFF)) & 0xFFFFFFFFL;
}
Program: 85129
Project: 85129
Buggy source:
private byte[] md5(String value){
  MessageDigest md5;
  try {
    md5=MessageDigest.getInstance("String_Node_Str");
  }
 catch (  NoSuchAlgorithmException e) {
    throw new IllegalStateException(e.getMessage(),e);
  }
  md5.reset();
  byte[] bytes=null;
  try {
    bytes=value.getBytes("String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    throw new IllegalStateException(e.getMessage(),e);
  }
  md5.update(bytes);
  return md5.digest();
}

Fixed version (ground truth):
private byte[] md5(String value){
  MessageDigest md5;
  try {
    md5=MessageDigest.getInstance("String_Node_Str");
  }
 catch (  NoSuchAlgorithmException e) {
    throw new IllegalStateException(e.getMessage(),e);
  }
  md5.reset();
  byte[] bytes;
  try {
    bytes=value.getBytes("String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    throw new IllegalStateException(e.getMessage(),e);
  }
  md5.update(bytes);
  return md5.digest();
}
Program: 85130
Project: 85130
Buggy source:
/** 
 * 获取共享连接
 */
private ExchangeClient getSharedClient(URL url){
  String key=url.getAddress();
  ReferenceCountExchangeClient client=referenceClientMap.get(key);
  if (client != null) {
    if (!client.isClosed()) {
      client.incrementAndGetCount();
      return client;
    }
 else {
      referenceClientMap.remove(key);
    }
  }
  ExchangeClient exchagneclient=initClient(url);
  client=new ReferenceCountExchangeClient(exchagneclient,ghostClientMap);
  referenceClientMap.put(key,client);
  ghostClientMap.remove(key);
  return client;
}

Fixed version (ground truth):
/** 
 * 获取共享连接
 */
private ExchangeClient getSharedClient(URL url){
  String key=url.getAddress();
  ReferenceCountExchangeClient client=referenceClientMap.get(key);
  if (client != null) {
    if (!client.isClosed()) {
      client.incrementAndGetCount();
      return client;
    }
 else {
      referenceClientMap.remove(key);
    }
  }
synchronized (key.intern()) {
    ExchangeClient exchangeClient=initClient(url);
    client=new ReferenceCountExchangeClient(exchangeClient,ghostClientMap);
    referenceClientMap.put(key,client);
    ghostClientMap.remove(key);
    return client;
  }
}
Program: 85132
Project: 85132
Buggy source:
public URL configure(URL url){
  if (configuratorUrl == null || configuratorUrl.getHost() == null || url == null || url.getHost() == null) {
    return url;
  }
  if (Constants.ANYHOST_VALUE.equals(configuratorUrl.getHost()) || url.getHost().equals(configuratorUrl.getHost())) {
    String configApplication=configuratorUrl.getParameter(Constants.APPLICATION_KEY,configuratorUrl.getUsername());
    String currentApplication=url.getParameter(Constants.APPLICATION_KEY,url.getUsername());
    if (configApplication == null || Constants.ANY_VALUE.equals(configApplication) || configApplication.equals(currentApplication)) {
      if (configuratorUrl.getPort() == 0 || url.getPort() == configuratorUrl.getPort()) {
        Set<String> condtionKeys=new HashSet<String>();
        condtionKeys.add(Constants.CATEGORY_KEY);
        condtionKeys.add(Constants.CHECK_KEY);
        condtionKeys.add(Constants.DYNAMIC_KEY);
        condtionKeys.add(Constants.ENABLED_KEY);
        for (        Map.Entry<String,String> entry : configuratorUrl.getParameters().entrySet()) {
          String key=entry.getKey();
          String value=entry.getValue();
          if (key.startsWith("String_Node_Str") || Constants.APPLICATION_KEY.equals(key) || Constants.SIDE_KEY.equals(key)) {
            condtionKeys.add(key);
            if (value != null && !Constants.ANY_VALUE.equals(value) && !value.equals(url.getParameter(key.startsWith("String_Node_Str") ? key.substring(1) : key))) {
              return url;
            }
          }
        }
        return doConfigure(url,configuratorUrl.removeParameters(condtionKeys));
      }
    }
  }
  return url;
}

Fixed version (ground truth):
public URL configure(URL url){
  if (configuratorUrl == null || configuratorUrl.getHost() == null || url == null || url.getHost() == null) {
    return url;
  }
  if (configuratorUrl.getPort() != 0) {
    if (url.getPort() == configuratorUrl.getPort()) {
      return configureIfMatch(url.getHost(),url);
    }
  }
 else {
    if (url.getParameter(Constants.SIDE_KEY,Constants.PROVIDER).equals(Constants.CONSUMER)) {
      return configureIfMatch(NetUtils.getLocalHost(),url);
    }
 else     if (url.getParameter(Constants.SIDE_KEY,Constants.CONSUMER).equals(Constants.PROVIDER)) {
      return configureIfMatch(Constants.ANYHOST_VALUE,url);
    }
  }
  return url;
}
Program: 85133
Project: 85133
Buggy source:
public int compareTo(Configurator o){
  if (o == null) {
    return -1;
  }
  return getUrl().getHost().compareTo(o.getUrl().getHost());
}

Fixed version (ground truth):
/** 
 * 根据priority、host依次排序 priority值越大，优先级越高； priority相同，特定host优先级高于anyhost 0.0.0.0
 * @param o
 * @return
 */
public int compareTo(Configurator o){
  if (o == null) {
    return -1;
  }
  int ipCompare=getUrl().getHost().compareTo(o.getUrl().getHost());
  if (ipCompare == 0) {
    int i=getUrl().getParameter(Constants.PRIORITY_KEY,0), j=o.getUrl().getParameter(Constants.PRIORITY_KEY,0);
    if (i < j) {
      return -1;
    }
 else     if (i > j) {
      return 1;
    }
 else {
      return 0;
    }
  }
 else {
    return ipCompare;
  }
}
Program: 85134
Project: 85134
Buggy source:
public void notify(List<URL> urls){
  List<URL> result=null;
  for (  URL url : urls) {
    URL overrideUrl=url;
    if (url.getParameter(Constants.CATEGORY_KEY) == null && Constants.OVERRIDE_PROTOCOL.equals(url.getProtocol())) {
      overrideUrl=url.addParameter(Constants.CATEGORY_KEY,Constants.CONFIGURATORS_CATEGORY);
    }
    if (!UrlUtils.isMatch(subscribeUrl,overrideUrl)) {
      if (result == null) {
        result=new ArrayList<URL>(urls);
      }
      result.remove(url);
      logger.warn("String_Node_Str" + url);
    }
  }
  if (result != null) {
    urls=result;
  }
  this.configurators=RegistryDirectory.toConfigurators(urls);
  List<ExporterChangeableWrapper<?>> exporters=new ArrayList<ExporterChangeableWrapper<?>>(bounds.values());
  for (  ExporterChangeableWrapper<?> exporter : exporters) {
    Invoker<?> invoker=exporter.getOriginInvoker();
    final Invoker<?> originInvoker;
    if (invoker instanceof InvokerDelegete) {
      originInvoker=((InvokerDelegete<?>)invoker).getInvoker();
    }
 else {
      originInvoker=invoker;
    }
    URL originUrl=RegistryProtocol.this.getProviderUrl(originInvoker);
    URL newUrl=getNewInvokerUrl(originUrl,urls);
    if (!originUrl.equals(newUrl)) {
      RegistryProtocol.this.doChangeLocalExport(originInvoker,newUrl);
    }
  }
}

Fixed version (ground truth):
public void notify(List<URL> urls){
  List<URL> result=null;
  for (  URL url : urls) {
    URL overrideUrl=url;
    if (url.getParameter(Constants.CATEGORY_KEY) == null && Constants.OVERRIDE_PROTOCOL.equals(url.getProtocol())) {
      overrideUrl=url.addParameter(Constants.CATEGORY_KEY,Constants.CONFIGURATORS_CATEGORY);
    }
    if (!UrlUtils.isMatch(subscribeUrl,overrideUrl)) {
      if (result == null) {
        result=new ArrayList<URL>(urls);
      }
      result.remove(url);
      logger.warn("String_Node_Str" + url);
    }
  }
  if (result != null) {
    urls=result;
  }
  this.configurators=RegistryDirectory.toConfigurators(urls);
  List<ExporterChangeableWrapper<?>> exporters=new ArrayList<ExporterChangeableWrapper<?>>(bounds.values());
  for (  ExporterChangeableWrapper<?> exporter : exporters) {
    Invoker<?> invoker=exporter.getOriginInvoker();
    final Invoker<?> originInvoker;
    if (invoker instanceof InvokerDelegete) {
      originInvoker=((InvokerDelegete<?>)invoker).getInvoker();
    }
 else {
      originInvoker=invoker;
    }
    URL originUrl=RegistryProtocol.this.getProviderUrl(originInvoker);
    if (urls != null && urls.size() > 0 && originUrl.getServiceKey().equals(urls.get(0).getServiceKey())) {
      URL newUrl=getNewInvokerUrl(originUrl,urls);
      if (!originUrl.equals(newUrl) || (this.configurators == null || this.configurators.size() == 0)) {
        RegistryProtocol.this.doChangeLocalExport(originInvoker,newUrl);
      }
    }
  }
}
Program: 85135
Project: 85135
Buggy source:
public Result invoke(Invoker<?> invoker,Invocation invocation) throws RpcException {
  Map<String,String> attachments=invocation.getAttachments();
  if (attachments != null) {
    attachments=new HashMap<String,String>(attachments);
    attachments.remove(Constants.PATH_KEY);
    attachments.remove(Constants.GROUP_KEY);
    attachments.remove(Constants.VERSION_KEY);
    attachments.remove(Constants.DUBBO_VERSION_KEY);
    attachments.remove(Constants.TOKEN_KEY);
    attachments.remove(Constants.TIMEOUT_KEY);
  }
  RpcContext.getContext().setInvoker(invoker).setInvocation(invocation).setAttachments(attachments).setLocalAddress(invoker.getUrl().getHost(),invoker.getUrl().getPort());
  if (invocation instanceof RpcInvocation) {
    ((RpcInvocation)invocation).setInvoker(invoker);
  }
  try {
    return invoker.invoke(invocation);
  }
  finally {
    RpcContext.removeContext();
  }
}

Fixed version (ground truth):
public Result invoke(Invoker<?> invoker,Invocation invocation) throws RpcException {
  Map<String,String> attachments=invocation.getAttachments();
  if (attachments != null) {
    attachments=new HashMap<String,String>(attachments);
    attachments.remove(Constants.PATH_KEY);
    attachments.remove(Constants.GROUP_KEY);
    attachments.remove(Constants.VERSION_KEY);
    attachments.remove(Constants.DUBBO_VERSION_KEY);
    attachments.remove(Constants.TOKEN_KEY);
    attachments.remove(Constants.TIMEOUT_KEY);
    attachments.remove(Constants.ASYNC_KEY);
  }
  RpcContext.getContext().setInvoker(invoker).setInvocation(invocation).setAttachments(attachments).setLocalAddress(invoker.getUrl().getHost(),invoker.getUrl().getPort());
  if (invocation instanceof RpcInvocation) {
    ((RpcInvocation)invocation).setInvoker(invoker);
  }
  try {
    return invoker.invoke(invocation);
  }
  finally {
    RpcContext.removeContext();
  }
}
Program: 85137
Project: 85137
Buggy source:
public <T>List<Invoker<T>> route(List<Invoker<T>> invokers,URL url,Invocation invocation) throws RpcException {
  if (invokers == null || invokers.size() == 0) {
    return invokers;
  }
  try {
    if (!matchWhen(url)) {
      return invokers;
    }
    List<Invoker<T>> result=new ArrayList<Invoker<T>>();
    if (thenCondition == null) {
      logger.warn("String_Node_Str" + NetUtils.getLocalHost() + "String_Node_Str"+ url.getServiceKey());
      return result;
    }
    for (    Invoker<T> invoker : invokers) {
      if (matchThen(invoker.getUrl(),url)) {
        result.add(invoker);
      }
    }
    if (result.size() > 0) {
      return result;
    }
 else     if (force) {
      logger.warn("String_Node_Str" + NetUtils.getLocalHost() + "String_Node_Str"+ url.getServiceKey()+ "String_Node_Str"+ url.getParameterAndDecoded(Constants.RULE_KEY));
      return result;
    }
  }
 catch (  Throwable t) {
    logger.error("String_Node_Str" + getUrl() + "String_Node_Str"+ invokers+ "String_Node_Str"+ t.getMessage(),t);
  }
  return invokers;
}

Fixed version (ground truth):
public <T>List<Invoker<T>> route(List<Invoker<T>> invokers,URL url,Invocation invocation) throws RpcException {
  if (invokers == null || invokers.size() == 0) {
    return invokers;
  }
  try {
    if (!matchWhen(url,invocation)) {
      return invokers;
    }
    List<Invoker<T>> result=new ArrayList<Invoker<T>>();
    if (thenCondition == null) {
      logger.warn("String_Node_Str" + NetUtils.getLocalHost() + "String_Node_Str"+ url.getServiceKey());
      return result;
    }
    for (    Invoker<T> invoker : invokers) {
      if (matchThen(invoker.getUrl(),url)) {
        result.add(invoker);
      }
    }
    if (result.size() > 0) {
      return result;
    }
 else     if (force) {
      logger.warn("String_Node_Str" + NetUtils.getLocalHost() + "String_Node_Str"+ url.getServiceKey()+ "String_Node_Str"+ url.getParameterAndDecoded(Constants.RULE_KEY));
      return result;
    }
  }
 catch (  Throwable t) {
    logger.error("String_Node_Str" + getUrl() + "String_Node_Str"+ invokers+ "String_Node_Str"+ t.getMessage(),t);
  }
  return invokers;
}
Program: 85138
Project: 85138
Buggy source:
private boolean matchCondition(Map<String,MatchPair> condition,URL url,URL param){
  Map<String,String> sample=url.toMap();
  for (  Map.Entry<String,String> entry : sample.entrySet()) {
    String key=entry.getKey();
    MatchPair pair=condition.get(key);
    if (pair != null && !pair.isMatch(entry.getValue(),param)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean matchCondition(Map<String,MatchPair> condition,URL url,URL param,Invocation invocation){
  Map<String,String> sample=url.toMap();
  boolean result=false;
  for (  Map.Entry<String,MatchPair> matchPair : condition.entrySet()) {
    String key=matchPair.getKey();
    String sampleValue;
    if (invocation != null && (Constants.METHOD_KEY.equals(key) || Constants.METHODS_KEY.equals(key))) {
      sampleValue=invocation.getMethodName();
    }
 else {
      sampleValue=sample.get(key);
    }
    if (sampleValue != null) {
      if (!matchPair.getValue().isMatch(sampleValue,param)) {
        return false;
      }
 else {
        result=true;
      }
    }
 else {
      if (matchPair.getValue().matches.size() > 0) {
        return false;
      }
 else {
        result=true;
      }
    }
  }
  return result;
}
Program: 85139
Project: 85139
Buggy source:
public boolean matchWhen(URL url){
  return matchCondition(whenCondition,url,null);
}

Fixed version (ground truth):
boolean matchWhen(URL url,Invocation invocation){
  return whenCondition == null || whenCondition.isEmpty() || matchCondition(whenCondition,url,null,invocation);
}
Program: 85140
Project: 85140
Buggy source:
public boolean matchThen(URL url,URL param){
  return thenCondition != null && matchCondition(thenCondition,url,param);
}

Fixed version (ground truth):
private boolean matchThen(URL url,URL param){
  return !(thenCondition == null || thenCondition.isEmpty()) && matchCondition(thenCondition,url,param,null);
}
Program: 85141
Project: 85141
Buggy source:
public boolean isMatch(String value,URL param){
  for (  String match : matches) {
    if (!UrlUtils.isMatchGlobPattern(match,value,param)) {
      return false;
    }
  }
  for (  String mismatch : mismatches) {
    if (UrlUtils.isMatchGlobPattern(mismatch,value,param)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean isMatch(String value,URL param){
  if (matches.size() > 0 && mismatches.size() == 0) {
    for (    String match : matches) {
      if (UrlUtils.isMatchGlobPattern(match,value,param)) {
        return true;
      }
    }
    return false;
  }
  if (mismatches.size() > 0 && matches.size() == 0) {
    for (    String mismatch : mismatches) {
      if (UrlUtils.isMatchGlobPattern(mismatch,value,param)) {
        return false;
      }
    }
    return true;
  }
  if (matches.size() > 0 && mismatches.size() > 0) {
    for (    String mismatch : mismatches) {
      if (UrlUtils.isMatchGlobPattern(mismatch,value,param)) {
        return false;
      }
    }
    for (    String match : matches) {
      if (UrlUtils.isMatchGlobPattern(match,value,param)) {
        return true;
      }
    }
    return false;
  }
  return false;
}
Program: 85143
Project: 85143
Buggy source:
public Result invoke(Invoker<?> invoker,Invocation invocation) throws RpcException {
  URL url=invoker.getUrl();
  String methodName=invocation.getMethodName();
  int max=url.getMethodParameter(methodName,Constants.EXECUTES_KEY,0);
  if (max > 0) {
    RpcStatus count=RpcStatus.getStatus(url,invocation.getMethodName());
    if (count.getActive() >= max) {
      throw new RpcException("String_Node_Str" + invocation.getMethodName() + "String_Node_Str"+ url+ "String_Node_Str"+ max+ "String_Node_Str");
    }
  }
  long begin=System.currentTimeMillis();
  boolean isException=false;
  RpcStatus.beginCount(url,methodName);
  try {
    Result result=invoker.invoke(invocation);
    return result;
  }
 catch (  Throwable t) {
    isException=true;
    if (t instanceof RuntimeException) {
      throw (RuntimeException)t;
    }
 else {
      throw new RpcException("String_Node_Str",t);
    }
  }
 finally {
    RpcStatus.endCount(url,methodName,System.currentTimeMillis() - begin,isException);
  }
}

Fixed version (ground truth):
public Result invoke(Invoker<?> invoker,Invocation invocation) throws RpcException {
  URL url=invoker.getUrl();
  String methodName=invocation.getMethodName();
  Semaphore executesLimit=null;
  boolean acquireResult=false;
  int max=url.getMethodParameter(methodName,Constants.EXECUTES_KEY,0);
  if (max > 0) {
    RpcStatus count=RpcStatus.getStatus(url,invocation.getMethodName());
    executesLimit=count.getSemaphore(max);
    if (executesLimit != null && !(acquireResult=executesLimit.tryAcquire())) {
      throw new RpcException("String_Node_Str" + invocation.getMethodName() + "String_Node_Str"+ url+ "String_Node_Str"+ max+ "String_Node_Str");
    }
  }
  long begin=System.currentTimeMillis();
  boolean isException=false;
  RpcStatus.beginCount(url,methodName);
  try {
    Result result=invoker.invoke(invocation);
    return result;
  }
 catch (  Throwable t) {
    isException=true;
    if (t instanceof RuntimeException) {
      throw (RuntimeException)t;
    }
 else {
      throw new RpcException("String_Node_Str",t);
    }
  }
 finally {
    RpcStatus.endCount(url,methodName,System.currentTimeMillis() - begin,isException);
    if (acquireResult) {
      executesLimit.release();
    }
  }
}
Program: 85144
Project: 85144
Buggy source:
public Menu(Map<String,List<String>> menus){
  this.menus.putAll(menus);
}

Fixed version (ground truth):
public Menu(Map<String,List<String>> menus){
  for (  String key : menus.keySet()) {
    this.menus.put(key,new ArrayList<String>(menus.get(key)));
  }
}
Program: 85146
Project: 85146
Buggy source:
static void merge(Map<String,List<String>> first,Map<String,List<String>> second){
  for (  Map.Entry<String,List<String>> entry : second.entrySet()) {
    List<String> value=first.get(entry.getKey());
    if (value != null) {
      value.addAll(entry.getValue());
    }
 else {
      first.put(entry.getKey(),entry.getValue());
    }
  }
}

Fixed version (ground truth):
static void merge(Map<String,List<String>> first,Map<String,List<String>> second){
  for (  Map.Entry<String,List<String>> entry : second.entrySet()) {
    List<String> value=first.get(entry.getKey());
    if (value != null) {
      value.addAll(entry.getValue());
    }
 else {
      first.put(entry.getKey(),new ArrayList<String>(entry.getValue()));
    }
  }
}
Program: 85155
Project: 85155
Buggy source:
public ChannelHandler getHandler(){
  if (handler instanceof ChannelHandlerDelegate) {
    ((ChannelHandlerDelegate)handler).getHandler();
  }
  return handler;
}

Fixed version (ground truth):
public ChannelHandler getHandler(){
  if (handler instanceof ChannelHandlerDelegate) {
    return ((ChannelHandlerDelegate)handler).getHandler();
  }
  return handler;
}
Program: 85156
Project: 85156
Buggy source:
public boolean isRegistered(String key){
  return StringUtils.isNotEmpty(key) && exportMap.containsKey(key);
}

Fixed version (ground truth):
public boolean isRegistered(String key){
  return StringUtils.isNotEmpty(key) && protocol instanceof InjvmProtocol && ((InjvmProtocol)protocol).isExported(key);
}
Program: 85157
Project: 85157
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private void exportLocal(URL url){
  if (!Constants.LOCAL_PROTOCOL.equalsIgnoreCase(url.getProtocol())) {
    URL local=URL.valueOf(url.toFullString()).setProtocol(Constants.LOCAL_PROTOCOL).setHost(NetUtils.LOCALHOST).setPort(0);
    Exporter<?> exporter=protocol.export(proxyFactory.getInvoker(ref,(Class)interfaceClass,local));
    LocalServiceStore.getInstance().register(url,exporter);
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private void exportLocal(URL url){
  if (!Constants.LOCAL_PROTOCOL.equalsIgnoreCase(url.getProtocol())) {
    URL local=URL.valueOf(url.toFullString()).setProtocol(Constants.LOCAL_PROTOCOL).setHost(NetUtils.LOCALHOST).setPort(0);
    Exporter<?> exporter=protocol.export(proxyFactory.getInvoker(ref,(Class)interfaceClass,local));
  }
}
Program: 85158
Project: 85158
Buggy source:
public synchronized void unexport(){
  if (!exported) {
    return;
  }
  if (unexported) {
    return;
  }
  if (exporters != null && exporters.size() > 0) {
    for (    Exporter<?> exporter : exporters) {
      try {
        exporter.unexport();
        LocalServiceStore.getInstance().unregister(exporter.getInvoker().getUrl());
      }
 catch (      Throwable t) {
        logger.warn("String_Node_Str" + exporter,t);
      }
    }
    exporters.clear();
  }
  unexported=true;
}

Fixed version (ground truth):
public synchronized void unexport(){
  if (!exported) {
    return;
  }
  if (unexported) {
    return;
  }
  if (exporters != null && exporters.size() > 0) {
    for (    Exporter<?> exporter : exporters) {
      try {
        exporter.unexport();
      }
 catch (      Throwable t) {
        logger.warn("String_Node_Str" + exporter,t);
      }
    }
    exporters.clear();
  }
  unexported=true;
}
Program: 85160
Project: 85160
Buggy source:
public <T>Exporter<T> export(Invoker<T> invoker) throws RpcException {
  return new InjvmExporter<T>(invoker,serviceKey(invoker.getUrl()),exporterMap);
}

Fixed version (ground truth):
public <T>Exporter<T> export(Invoker<T> invoker) throws RpcException {
  return new InjvmExporter<T>(invoker,serviceKey(invoker.getUrl().setPort(DEFAULT_PORT)),exporterMap);
}
Program: 85161
Project: 85161
Buggy source:
protected static String convertMonitor(String monitor,URL registry){
  if (monitor == null || monitor.length() == 0) {
    return null;
  }
  if (GROUP_AND_VERION.matcher(monitor).matches()) {
    String group;
    String version;
    int i=monitor.indexOf(':');
    if (i > 0) {
      group=monitor.substring(0,i);
      version=monitor.substring(i + 1);
    }
 else {
      group=monitor;
      version="String_Node_Str";
    }
    monitor=registry.setProtocol("String_Node_Str").addParameter(Constants.MONITOR_KEY,registry.getProtocol()).addParameterAndEncoded(RpcConstants.REFER_KEY,"String_Node_Str" + group + "String_Node_Str"+ version+ "String_Node_Str"+ MonitorService.class.getName()).toFullString();
  }
  try {
    return URLEncoder.encode(monitor,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    throw new IllegalStateException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
protected static String convertMonitor(String monitor,URL registry){
  if (monitor == null || monitor.length() == 0) {
    return null;
  }
  if (GROUP_AND_VERION.matcher(monitor).matches()) {
    String group;
    String version;
    int i=monitor.indexOf(':');
    if (i > 0) {
      group=monitor.substring(0,i);
      version=monitor.substring(i + 1);
    }
 else {
      group=monitor;
      version=null;
    }
    monitor=registry.setProtocol("String_Node_Str").addParameter(Constants.MONITOR_KEY,registry.getProtocol()).addParameterAndEncoded(RpcConstants.REFER_KEY,"String_Node_Str" + group + (version == null || version.length() == 0 ? "String_Node_Str" : "String_Node_Str" + version)+ "String_Node_Str"+ MonitorService.class.getName()).toFullString();
  }
  try {
    return URLEncoder.encode(monitor,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    throw new IllegalStateException(e.getMessage(),e);
  }
}
Program: 85162
Project: 85162
Buggy source:
public static Exporter<RegistryService> export(int port){
  RegistryService registryService=new SimpleRegistryService();
  return protocol.export(proxyFactory.getInvoker(registryService,RegistryService.class,new URL("String_Node_Str",NetUtils.getLocalHost(),port,RegistryService.class.getName()).setPath(RegistryService.class.getName()).addParameter(Constants.INTERFACE_KEY,RegistryService.class.getName()).addParameter(Constants.VERSION_KEY,"String_Node_Str").addParameter(RpcConstants.CLUSTER_STICKY_KEY,"String_Node_Str").addParameter(RpcConstants.CALLBACK_INSTANCES_LIMIT_KEY,"String_Node_Str").addParameter("String_Node_Str","String_Node_Str").addParameter("String_Node_Str","String_Node_Str").addParameter("String_Node_Str","String_Node_Str")));
}

Fixed version (ground truth):
public static Exporter<RegistryService> export(int port){
  RegistryService registryService=new SimpleRegistryService();
  return protocol.export(proxyFactory.getInvoker(registryService,RegistryService.class,new URL("String_Node_Str",NetUtils.getLocalHost(),port,RegistryService.class.getName()).setPath(RegistryService.class.getName()).addParameter(Constants.INTERFACE_KEY,RegistryService.class.getName()).addParameter(RpcConstants.CLUSTER_STICKY_KEY,"String_Node_Str").addParameter(RpcConstants.CALLBACK_INSTANCES_LIMIT_KEY,"String_Node_Str").addParameter("String_Node_Str","String_Node_Str").addParameter("String_Node_Str","String_Node_Str").addParameter("String_Node_Str","String_Node_Str")));
}
Program: 85165
Project: 85165
Buggy source:
/** 
 * get image file path
 * @param imageUrl
 * @return
 */
public String getImagePath(String imageUrl){
  return secondaryCache.getImagePath(imageUrl);
}

Fixed version (ground truth):
/** 
 * get image file path
 * @param imageUrl
 * @return if not in cache return null, else return full path.
 */
public String getImagePath(String imageUrl){
  return secondaryCache.getImagePath(imageUrl);
}
Program: 85166
Project: 85166
Buggy source:
/** 
 * get image file path
 * @param imageUrl
 * @return
 */
public String getImagePath(String imageUrl){
  return new StringBuilder(cacheFolder).append(File.separator).append(fileNameRule.getFileName(imageUrl)).toString();
}

Fixed version (ground truth):
/** 
 * get image file path
 * @param imageUrl
 * @return if not in cache return null, else return full path.
 */
public String getImagePath(String imageUrl){
  return (this.containsKey(imageUrl)) ? new StringBuilder(cacheFolder).append(File.separator).append(fileNameRule.getFileName(imageUrl)).toString() : null;
}
Program: 85167
Project: 85167
Buggy source:
/** 
 * start thread to wait for image get
 * @param imageUrl
 * @param urlList url list, if is null, not preload, else preload forward by{@link PreloadDataCache#preloadDataForward(Object,List,int)}, preload backward by  {@link PreloadDataCache#preloadDataBackward(Object,List,int)}
 */
private void startGetImageThread(final String imageUrl,final List<String> urlList){
  threadPool.execute(new Runnable(){
    @Override public void run(){
      CacheObject<Bitmap> object=get(imageUrl,urlList);
      Bitmap bitmap=(object == null ? null : object.getData());
      if (bitmap == null) {
        remove(imageUrl);
        String failedException="String_Node_Str";
        FailedReason failedReason=new FailedReason(FailedType.ERROR_IO,failedException);
        handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_FAILED,new MessageObject(imageUrl,bitmap,failedReason)));
      }
 else {
        handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_SUCCESS,new MessageObject(imageUrl,bitmap)));
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * start thread to wait for image get
 * @param imageUrl
 * @param urlList url list, if is null, not preload, else preload forward by{@link PreloadDataCache#preloadDataForward(Object,List,int)}, preload backward by  {@link PreloadDataCache#preloadDataBackward(Object,List,int)}
 */
private void startGetImageThread(final String imageUrl,final List<String> urlList){
  threadPool.execute(new Runnable(){
    @Override public void run(){
      try {
        CacheObject<Bitmap> object=get(imageUrl,urlList);
        Bitmap bitmap=(object == null ? null : object.getData());
        if (bitmap == null) {
          remove(imageUrl);
          String failedException="String_Node_Str";
          FailedReason failedReason=new FailedReason(FailedType.ERROR_IO,failedException);
          handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_FAILED,new MessageObject(imageUrl,bitmap,failedReason)));
        }
 else {
          handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_SUCCESS,new MessageObject(imageUrl,bitmap)));
        }
      }
 catch (      OutOfMemoryError e) {
        MessageObject msg=new MessageObject(imageUrl,null,new FailedReason(FailedType.ERROR_OUT_OF_MEMORY,e));
        handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_FAILED,msg));
      }
    }
  }
);
}
Program: 85168
Project: 85168
Buggy source:
@Override public void run(){
  CacheObject<Bitmap> object=get(imageUrl,urlList);
  Bitmap bitmap=(object == null ? null : object.getData());
  if (bitmap == null) {
    remove(imageUrl);
    String failedException="String_Node_Str";
    FailedReason failedReason=new FailedReason(FailedType.ERROR_IO,failedException);
    handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_FAILED,new MessageObject(imageUrl,bitmap,failedReason)));
  }
 else {
    handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_SUCCESS,new MessageObject(imageUrl,bitmap)));
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    CacheObject<Bitmap> object=get(imageUrl,urlList);
    Bitmap bitmap=(object == null ? null : object.getData());
    if (bitmap == null) {
      remove(imageUrl);
      String failedException="String_Node_Str";
      FailedReason failedReason=new FailedReason(FailedType.ERROR_IO,failedException);
      handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_FAILED,new MessageObject(imageUrl,bitmap,failedReason)));
    }
 else {
      handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_SUCCESS,new MessageObject(imageUrl,bitmap)));
    }
  }
 catch (  OutOfMemoryError e) {
    MessageObject msg=new MessageObject(imageUrl,null,new FailedReason(FailedType.ERROR_OUT_OF_MEMORY,e));
    handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_FAILED,msg));
  }
}
Program: 85169
Project: 85169
Buggy source:
/** 
 * start thread to wait for image get
 * @param imageUrl
 * @param urlList url list, if is null, not preload, else preload forward by{@link PreloadDataCache#preloadDataForward(Object,List,int)}, preload backward by  {@link PreloadDataCache#preloadDataBackward(Object,List,int)}
 */
private void startGetImageThread(final String imageUrl,final List<String> urlList){
  threadPool.execute(new Runnable(){
    @Override public void run(){
      CacheObject<String> object=get(imageUrl,urlList);
      String imagePath=(object == null ? null : object.getData());
      if (StringUtils.isEmpty(imagePath) || !FileUtils.isFileExist(imagePath)) {
        remove(imageUrl);
        String failedException="String_Node_Str";
        FailedReason failedReason=new FailedReason(FailedType.ERROR_IO,failedException);
        handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_FAILED,new MessageObject(imageUrl,imagePath,failedReason)));
      }
 else {
        handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_SUCCESS,new MessageObject(imageUrl,imagePath)));
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * start thread to wait for image get
 * @param imageUrl
 * @param urlList url list, if is null, not preload, else preload forward by{@link PreloadDataCache#preloadDataForward(Object,List,int)}, preload backward by  {@link PreloadDataCache#preloadDataBackward(Object,List,int)}
 */
private void startGetImageThread(final String imageUrl,final List<String> urlList){
  threadPool.execute(new Runnable(){
    @Override public void run(){
      try {
        CacheObject<String> object=get(imageUrl,urlList);
        String imagePath=(object == null ? null : object.getData());
        if (StringUtils.isEmpty(imagePath) || !FileUtils.isFileExist(imagePath)) {
          remove(imageUrl);
          String failedException="String_Node_Str";
          FailedReason failedReason=new FailedReason(FailedType.ERROR_IO,failedException);
          handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_FAILED,new MessageObject(imageUrl,imagePath,failedReason)));
        }
 else {
          handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_SUCCESS,new MessageObject(imageUrl,imagePath)));
        }
      }
 catch (      OutOfMemoryError e) {
        MessageObject msg=new MessageObject(imageUrl,null,new FailedReason(FailedType.ERROR_OUT_OF_MEMORY,e));
        handler.sendMessage(handler.obtainMessage(WHAT_GET_IMAGE_FAILED,msg));
      }
    }
  }
);
}
Program: 85170
Project: 85170
Buggy source:
public void handleMessage(Message message){
switch (message.what) {
case WHAT_GET_IMAGE_SUCCESS:
case WHAT_GET_IMAGE_FAILED:
    MessageObject object=(MessageObject)message.obj;
  if (object == null) {
    break;
  }
String imageUrl=object.imageUrl;
Drawable drawable=object.drawable;
if (onImageCallbackListener != null) {
if (isOpenWaitingQueue) {
synchronized (viewSetMap) {
  HashSet<View> viewSet=viewSetMap.get(imageUrl);
  if (viewSet != null) {
    for (    View view : viewSet) {
      if (view != null) {
        onImageCallbackListener.onGetSuccess(imageUrl,drawable,view,false);
      }
      if (WHAT_GET_IMAGE_SUCCESS == message.what) {
        onImageCallbackListener.onGetSuccess(imageUrl,drawable,view,false);
      }
 else {
        onImageCallbackListener.onGetFailed(imageUrl,drawable,view,object.failedReason);
      }
    }
  }
}
}
 else {
View view=viewMap.get(imageUrl);
if (view != null) {
  if (WHAT_GET_IMAGE_SUCCESS == message.what) {
    onImageCallbackListener.onGetSuccess(imageUrl,drawable,view,false);
  }
 else {
    onImageCallbackListener.onGetFailed(imageUrl,drawable,view,object.failedReason);
  }
}
}
}
if (isOpenWaitingQueue) {
synchronized (viewSetMap) {
viewSetMap.remove(imageUrl);
}
}
 else {
viewMap.remove(imageUrl);
}
break;
}
}

Fixed version (ground truth):
public void handleMessage(Message message){
switch (message.what) {
case WHAT_GET_IMAGE_SUCCESS:
case WHAT_GET_IMAGE_FAILED:
    MessageObject object=(MessageObject)message.obj;
  if (object == null) {
    break;
  }
String imageUrl=object.imageUrl;
Drawable drawable=object.drawable;
if (drawable != null) {
drawable=drawable.getConstantState().newDrawable();
}
if (onImageCallbackListener != null) {
if (isOpenWaitingQueue) {
synchronized (viewSetMap) {
HashSet<View> viewSet=viewSetMap.get(imageUrl);
if (viewSet != null) {
  for (  View view : viewSet) {
    if (view != null) {
      onImageCallbackListener.onGetSuccess(imageUrl,drawable,view,false);
    }
    if (WHAT_GET_IMAGE_SUCCESS == message.what) {
      onImageCallbackListener.onGetSuccess(imageUrl,drawable,view,false);
    }
 else {
      onImageCallbackListener.onGetFailed(imageUrl,drawable,view,object.failedReason);
    }
  }
}
}
}
 else {
View view=viewMap.get(imageUrl);
if (view != null) {
if (WHAT_GET_IMAGE_SUCCESS == message.what) {
  onImageCallbackListener.onGetSuccess(imageUrl,drawable,view,false);
}
 else {
  onImageCallbackListener.onGetFailed(imageUrl,drawable,view,object.failedReason);
}
}
}
}
if (isOpenWaitingQueue) {
synchronized (viewSetMap) {
viewSetMap.remove(imageUrl);
}
}
 else {
viewMap.remove(imageUrl);
}
break;
}
}
Program: 85172
Project: 85172
Buggy source:
/** 
 * get download file name
 * @param downloadId
 * @return
 */
public String getFileName(long downloadId){
  return getString(downloadId,COLUMN_LOCAL_FILENAME);
}

Fixed version (ground truth):
/** 
 * get download file name
 * @param downloadId
 * @return
 */
public String getFileName(long downloadId){
  return getString(downloadId,(Build.VERSION.SDK_INT < 11 ? COLUMN_LOCAL_URI : COLUMN_LOCAL_FILENAME));
}
Program: 85173
Project: 85173
Buggy source:
/** 
 * join map
 * @param map
 * @return
 */
public static String toJson(Map<String,String> map){
  if (map == null || map.size() == 0) {
    return null;
  }
  StringBuilder paras=new StringBuilder();
  paras.append("String_Node_Str");
  Iterator<Map.Entry<String,String>> ite=map.entrySet().iterator();
  while (ite.hasNext()) {
    Map.Entry<String,String> entry=(Map.Entry<String,String>)ite.next();
    paras.append("String_Node_Str").append(entry.getKey()).append("String_Node_Str").append(entry.getValue());
    if (ite.hasNext()) {
      paras.append("String_Node_Str");
    }
  }
  paras.append("String_Node_Str");
  return paras.toString();
}

Fixed version (ground truth):
/** 
 * join map
 * @param map
 * @return
 */
public static String toJson(Map<String,String> map){
  if (map == null || map.size() == 0) {
    return null;
  }
  StringBuilder paras=new StringBuilder();
  paras.append("String_Node_Str");
  Iterator<Map.Entry<String,String>> ite=map.entrySet().iterator();
  while (ite.hasNext()) {
    Map.Entry<String,String> entry=(Map.Entry<String,String>)ite.next();
    paras.append("String_Node_Str").append(entry.getKey()).append("String_Node_Str").append(entry.getValue()).append("String_Node_Str");
    if (ite.hasNext()) {
      paras.append("String_Node_Str");
    }
  }
  paras.append("String_Node_Str");
  return paras.toString();
}
Program: 85174
Project: 85174
Buggy source:
@Override public String getFileName(String imageUrl){
  if (StringUtils.isEmpty(imageUrl)) {
    return DEFAULT_FILE_NAME;
  }
  String ext=(fileExtension == null ? FileUtils.getFileExtension(imageUrl) : fileExtension);
  String fileName=(imageUrl.length() >= MAX_FILE_NAME_LENGTH ? imageUrl.substring(imageUrl.length() - MAX_FILE_NAME_LENGTH,imageUrl.length()) : imageUrl).replaceAll("String_Node_Str","String_Node_Str");
  return StringUtils.isEmpty(ext) ? fileName : (new StringBuilder().append(fileName).append("String_Node_Str").append(ext).toString());
}

Fixed version (ground truth):
@Override public String getFileName(String imageUrl){
  if (StringUtils.isEmpty(imageUrl)) {
    return DEFAULT_FILE_NAME;
  }
  String ext=(fileExtension == null ? FileUtils.getFileExtension(imageUrl) : fileExtension);
  String fileName=(imageUrl.length() > MAX_FILE_NAME_LENGTH ? imageUrl.substring(imageUrl.length() - MAX_FILE_NAME_LENGTH,imageUrl.length()) : imageUrl).replaceAll("String_Node_Str","String_Node_Str");
  return StringUtils.isEmpty(ext) ? fileName : (new StringBuilder().append(fileName).append("String_Node_Str").append(ext.replaceAll("String_Node_Str","String_Node_Str")).toString());
}
Program: 85175
Project: 85175
Buggy source:
public static <V>int getSize(List<V> sourceList){
  return ListUtils.isEmpty(sourceList) ? 0 : sourceList.size();
}

Fixed version (ground truth):
public static <V>int getSize(List<V> sourceList){
  return sourceList == null ? 0 : sourceList.size();
}
Program: 85176
Project: 85176
Buggy source:
/** 
 * read file to string list, a element of list is a line
 * @param filePath
 * @return if file not exist, return null, else return content of file
 * @throws IOException if an error occurs while operator BufferedReader
 */
public static List<String> readFileToList(String filePath){
  File file=new File(filePath);
  List<String> fileContent=new ArrayList<String>();
  if (file == null || !file.isFile()) {
    return null;
  }
  BufferedReader reader=null;
  try {
    reader=new BufferedReader(new FileReader(file));
    String line=null;
    while ((line=reader.readLine()) != null) {
      fileContent.add(line);
    }
    reader.close();
    return fileContent;
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
 finally {
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      IOException e) {
        throw new RuntimeException("String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * read file to string list, a element of list is a line
 * @param filePath
 * @param charsetName The name of a supported {@link java.nio.charset.Charset </code>charset<code>}
 * @return if file not exist, return null, else return content of file
 * @throws IOException if an error occurs while operator BufferedReader
 */
public static List<String> readFileToList(String filePath,String charsetName){
  File file=new File(filePath);
  List<String> fileContent=new ArrayList<String>();
  if (file == null || !file.isFile()) {
    return null;
  }
  BufferedReader reader=null;
  try {
    InputStreamReader is=new InputStreamReader(new FileInputStream(file),charsetName);
    reader=new BufferedReader(is);
    String line=null;
    while ((line=reader.readLine()) != null) {
      fileContent.add(line);
    }
    reader.close();
    return fileContent;
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
 finally {
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      IOException e) {
        throw new RuntimeException("String_Node_Str",e);
      }
    }
  }
}
Program: 85177
Project: 85177
Buggy source:
/** 
 * read file
 * @param filePath
 * @return if file not exist, return null, else return content of file
 * @throws IOException if an error occurs while operator BufferedReader
 */
public static StringBuilder readFile(String filePath){
  File file=new File(filePath);
  StringBuilder fileContent=new StringBuilder("String_Node_Str");
  if (file == null || !file.isFile()) {
    return null;
  }
  BufferedReader reader=null;
  try {
    reader=new BufferedReader(new FileReader(file));
    String line=null;
    while ((line=reader.readLine()) != null) {
      if (!fileContent.toString().equals("String_Node_Str")) {
        fileContent.append("String_Node_Str");
      }
      fileContent.append(line);
    }
    reader.close();
    return fileContent;
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
 finally {
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      IOException e) {
        throw new RuntimeException("String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * read file
 * @param filePath
 * @param charsetName The name of a supported {@link java.nio.charset.Charset </code>charset<code>}
 * @return if file not exist, return null, else return content of file
 * @throws IOException if an error occurs while operator BufferedReader
 */
public static StringBuilder readFile(String filePath,String charsetName){
  File file=new File(filePath);
  StringBuilder fileContent=new StringBuilder("String_Node_Str");
  if (file == null || !file.isFile()) {
    return null;
  }
  BufferedReader reader=null;
  try {
    InputStreamReader is=new InputStreamReader(new FileInputStream(file),charsetName);
    reader=new BufferedReader(is);
    String line=null;
    while ((line=reader.readLine()) != null) {
      if (!fileContent.toString().equals("String_Node_Str")) {
        fileContent.append("String_Node_Str");
      }
      fileContent.append(line);
    }
    reader.close();
    return fileContent;
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
 finally {
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      IOException e) {
        throw new RuntimeException("String_Node_Str",e);
      }
    }
  }
}
Program: 85178
Project: 85178
Buggy source:
/** 
 * get expires
 * @return <ul><li>if max-age in cache-control is exists, return current time plus it</li> <li>else return expires</li> <li>if something error, return -1</li> </ul>
 */
public long getExpiresInMillis(){
  int maxAge=getCacheControlMaxAge();
  if (maxAge != -1) {
    return System.currentTimeMillis() + maxAge;
  }
 else {
    String expire=getExpiresHeader();
    if (!StringUtils.isEmpty(expire)) {
      return HttpUtils.parseGmtTime(getExpiresHeader());
    }
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * get expires
 * @return <ul><li>if max-age in cache-control is exists, return current time plus it</li> <li>else return expires</li> <li>if something error, return -1</li> </ul>
 */
public long getExpiresInMillis(){
  int maxAge=getCacheControlMaxAge();
  if (maxAge != -1) {
    return System.currentTimeMillis() + maxAge * 1000;
  }
 else {
    String expire=getExpiresHeader();
    if (!StringUtils.isEmpty(expire)) {
      return HttpUtils.parseGmtTime(getExpiresHeader());
    }
  }
  return -1;
}
Program: 85179
Project: 85179
Buggy source:
/** 
 * http cache-control in reponse header
 * @return -1 represents http error or no cache-control in response headers
 */
public int getCacheControlMaxAge(){
  try {
    String cacheControl=(String)responseHeaders.get(HttpConstants.CACHE_CONTROL);
    if (!StringUtils.isEmpty(cacheControl)) {
      int start=cacheControl.indexOf("String_Node_Str");
      if (start != -1) {
        int end=cacheControl.indexOf("String_Node_Str",start);
        String maxAge;
        if (end != -1) {
          maxAge=cacheControl.substring(start + "String_Node_Str".length(),end);
        }
 else {
          maxAge=cacheControl.substring(start + "String_Node_Str".length());
        }
        return Integer.parseInt(maxAge);
      }
    }
    return -1;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return -1;
  }
}

Fixed version (ground truth):
/** 
 * http cache-control in reponse header
 * @return -1 represents http error or no cache-control in response headers, or max-age in seconds
 */
public int getCacheControlMaxAge(){
  try {
    String cacheControl=(String)responseHeaders.get(HttpConstants.CACHE_CONTROL);
    if (!StringUtils.isEmpty(cacheControl)) {
      int start=cacheControl.indexOf("String_Node_Str");
      if (start != -1) {
        int end=cacheControl.indexOf("String_Node_Str",start);
        String maxAge;
        if (end != -1) {
          maxAge=cacheControl.substring(start + "String_Node_Str".length(),end);
        }
 else {
          maxAge=cacheControl.substring(start + "String_Node_Str".length());
        }
        return Integer.parseInt(maxAge);
      }
    }
    return -1;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return -1;
  }
}
Program: 85180
Project: 85180
Buggy source:
/** 
 * parse gmt time to long
 * @param gmtTime likes Thu, 11 Apr 2013 10:20:30 GMT
 * @return -1 represents exception
 */
public static long parseGmtTime(String gmtTime){
  try {
    return GMT_FORMAT.parse(gmtTime).getTime();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * parse gmt time to long
 * @param gmtTime likes Thu, 11 Apr 2013 10:20:30 GMT
 * @return -1 represents exception otherwise time in  milliseconds
 */
public static long parseGmtTime(String gmtTime){
  try {
    return GMT_FORMAT.parse(gmtTime).getTime();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return -1;
}
Program: 85181
Project: 85181
Buggy source:
protected float computeMinZoom(){
  final Drawable drawable=getDrawable();
  if (drawable == null) {
    return 1F;
  }
  float scale=getScale(mBaseMatrix);
  if (LOG_ENABLED) {
    Log.d(LOG_TAG,"String_Node_Str" + scale + "String_Node_Str"+ (1f / scale));
  }
  scale=Math.min(1f,1f / scale);
  if (LOG_ENABLED) {
    Log.i(LOG_TAG,"String_Node_Str" + scale);
  }
  return scale;
}

Fixed version (ground truth):
protected float computeMinZoom(){
  final Drawable drawable=getDrawable();
  if (drawable == null) {
    return 1F;
  }
  float scale=getScale(mBaseMatrix);
  scale=Math.min(1f,1f / scale);
  if (LOG_ENABLED) {
    Log.i(LOG_TAG,"String_Node_Str" + scale);
  }
  return scale;
}