nus-yam/ex-repair huggingface dataset:
Program: 8177
Project: 8177
Buggy source:
@Test public void testGetNotFound() throws Exception {
  final String topic="String_Node_Str";
  final int maxSize=1024;
  final Partition partition=new Partition("String_Node_Str");
  final long offset=12;
  final String url="String_Node_Str";
  this.producerZooKeeper.publishTopic(topic);
  EasyMock.expectLastCall();
  EasyMock.expect(this.producerZooKeeper.selectBroker(topic,partition)).andReturn(url);
  EasyMock.expect(this.remotingClient.invokeToGroup(url,new GetCommand(topic,this.consumerConfig.getGroup(),partition.getPartition(),offset,maxSize,Integer.MIN_VALUE),10000,TimeUnit.MILLISECONDS)).andReturn(new BooleanCommand(Integer.MIN_VALUE,404,"String_Node_Str"));
  this.mocksControl.replay();
  OpaqueGenerator.resetOpaque();
  assertNull(this.consumer.get(topic,partition,offset,maxSize));
  this.mocksControl.verify();
}

Fixed version (ground truth):
@Test public void testGetNotFound() throws Exception {
  final String topic="String_Node_Str";
  final int maxSize=1024;
  final Partition partition=new Partition("String_Node_Str");
  final long offset=12;
  final String url="String_Node_Str";
  this.producerZooKeeper.publishTopic(topic,this.consumer);
  EasyMock.expectLastCall();
  EasyMock.expect(this.producerZooKeeper.selectBroker(topic,partition)).andReturn(url);
  EasyMock.expect(this.remotingClient.invokeToGroup(url,new GetCommand(topic,this.consumerConfig.getGroup(),partition.getPartition(),offset,maxSize,Integer.MIN_VALUE),10000,TimeUnit.MILLISECONDS)).andReturn(new BooleanCommand(Integer.MIN_VALUE,404,"String_Node_Str"));
  this.mocksControl.replay();
  OpaqueGenerator.resetOpaque();
  assertNull(this.consumer.get(topic,partition,offset,maxSize));
  this.mocksControl.verify();
}
Program: 8178
Project: 8178
Buggy source:
@Test public void testGetFailed() throws Exception {
  final String topic="String_Node_Str";
  final int maxSize=1024;
  final Partition partition=new Partition("String_Node_Str");
  final long offset=12;
  final byte[] data="String_Node_Str".getBytes();
  final String url="String_Node_Str";
  final MessageIterator messageIterator=new MessageIterator(topic,data);
  this.producerZooKeeper.publishTopic(topic);
  EasyMock.expectLastCall();
  EasyMock.expect(this.producerZooKeeper.selectBroker(topic,partition)).andReturn(url);
  EasyMock.expect(this.remotingClient.invokeToGroup(url,new GetCommand(topic,this.consumerConfig.getGroup(),partition.getPartition(),offset,maxSize,Integer.MIN_VALUE),10000,TimeUnit.MILLISECONDS)).andReturn(new BooleanCommand(Integer.MIN_VALUE,500,"String_Node_Str"));
  this.mocksControl.replay();
  try {
    OpaqueGenerator.resetOpaque();
    assertEquals(messageIterator,this.consumer.get(topic,partition,offset,maxSize));
    fail();
  }
 catch (  final MetaClientException e) {
  }
  this.mocksControl.verify();
}

Fixed version (ground truth):
@Test public void testGetFailed() throws Exception {
  final String topic="String_Node_Str";
  final int maxSize=1024;
  final Partition partition=new Partition("String_Node_Str");
  final long offset=12;
  final byte[] data="String_Node_Str".getBytes();
  final String url="String_Node_Str";
  final MessageIterator messageIterator=new MessageIterator(topic,data);
  this.producerZooKeeper.publishTopic(topic,this.consumer);
  EasyMock.expectLastCall();
  EasyMock.expect(this.producerZooKeeper.selectBroker(topic,partition)).andReturn(url);
  EasyMock.expect(this.remotingClient.invokeToGroup(url,new GetCommand(topic,this.consumerConfig.getGroup(),partition.getPartition(),offset,maxSize,Integer.MIN_VALUE),10000,TimeUnit.MILLISECONDS)).andReturn(new BooleanCommand(Integer.MIN_VALUE,500,"String_Node_Str"));
  this.mocksControl.replay();
  try {
    OpaqueGenerator.resetOpaque();
    assertEquals(messageIterator,this.consumer.get(topic,partition,offset,maxSize));
    fail();
  }
 catch (  final MetaClientException e) {
  }
  this.mocksControl.verify();
}
Program: 8179
Project: 8179
Buggy source:
private Map<InetSocketAddress,StatsResult> getStats0(InetSocketAddress target,String item) throws InterruptedException {
  Set<String> groups=remotingClient.getGroupSet();
  if (groups == null || groups.size() <= 1) {
    return Collections.emptyMap();
  }
  Map<InetSocketAddress,StatsResult> rt=new HashMap<InetSocketAddress,StatsResult>();
  try {
    for (    String group : groups) {
      if (!group.equals(Constants.DEFAULT_GROUP)) {
        URI uri=new URI(group);
        InetSocketAddress sockAddr=new InetSocketAddress(uri.getHost(),uri.getPort());
        if (target == null || target.equals(sockAddr)) {
          BooleanCommand resp=(BooleanCommand)remotingClient.invokeToGroup(group,new StatsCommand(OpaqueGenerator.getNextOpaque(),item),STATS_OPTIMEOUT,TimeUnit.MILLISECONDS);
          if (resp.getResponseStatus() == ResponseStatus.NO_ERROR) {
            String body=resp.getErrorMsg();
            if (body != null) {
              parseStatsValues(sockAddr,rt,group,body);
            }
          }
        }
      }
    }
    return rt;
  }
 catch (  InterruptedException e) {
    throw e;
  }
catch (  Exception e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private Map<InetSocketAddress,StatsResult> getStats0(InetSocketAddress target,String item) throws InterruptedException {
  Set<String> groups=this.remotingClient.getGroupSet();
  if (groups == null || groups.size() <= 1) {
    return Collections.emptyMap();
  }
  Map<InetSocketAddress,StatsResult> rt=new HashMap<InetSocketAddress,StatsResult>();
  try {
    for (    String group : groups) {
      if (!group.equals(Constants.DEFAULT_GROUP)) {
        URI uri=new URI(group);
        InetSocketAddress sockAddr=new InetSocketAddress(uri.getHost(),uri.getPort());
        if (target == null || target.equals(sockAddr)) {
          BooleanCommand resp=(BooleanCommand)this.remotingClient.invokeToGroup(group,new StatsCommand(OpaqueGenerator.getNextOpaque(),item),STATS_OPTIMEOUT,TimeUnit.MILLISECONDS);
          if (resp.getResponseStatus() == ResponseStatus.NO_ERROR) {
            String body=resp.getErrorMsg();
            if (body != null) {
              this.parseStatsValues(sockAddr,rt,group,body);
            }
          }
        }
      }
    }
    return rt;
  }
 catch (  InterruptedException e) {
    throw e;
  }
catch (  Exception e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
}
Program: 8180
Project: 8180
Buggy source:
/** 
 * ���������ߺ�zk����������
 * @return
 */
public ProducerZooKeeper getProducerZooKeeper(){
  return producerZooKeeper;
}

Fixed version (ground truth):
/** 
 * ���������ߺ�zk����������
 * @return
 */
public ProducerZooKeeper getProducerZooKeeper(){
  return this.producerZooKeeper;
}
Program: 8181
Project: 8181
Buggy source:
@Override @Deprecated public MessageProducer createProducer(final PartitionSelector partitionSelector,final boolean ordered){
  if (partitionSelector == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return this.addChild(new SimpleMessageProducer(this,remotingClient,partitionSelector,producerZooKeeper,sessionIdGenerator.generateId()));
}

Fixed version (ground truth):
@Override @Deprecated public MessageProducer createProducer(final PartitionSelector partitionSelector,final boolean ordered){
  if (partitionSelector == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return this.addChild(new SimpleMessageProducer(this,this.remotingClient,partitionSelector,this.producerZooKeeper,this.sessionIdGenerator.generateId()));
}
Program: 8182
Project: 8182
Buggy source:
/** 
 * ɾ���ӻỰ
 * @param < T >
 * @param child
 */
public <T extends Shutdownable>void removeChild(final T child){
  children.remove(child);
}

Fixed version (ground truth):
/** 
 * ɾ���ӻỰ
 * @param < T >
 * @param child
 */
public <T extends Shutdownable>void removeChild(final T child){
  this.children.remove(child);
}
Program: 8183
Project: 8183
Buggy source:
@Override public void run(){
  try {
    isHutdownHookCalled=true;
    MetaMessageSessionFactory.this.shutdown();
  }
 catch (  final MetaClientException e) {
    log.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    MetaMessageSessionFactory.this.isHutdownHookCalled=true;
    MetaMessageSessionFactory.this.shutdown();
  }
 catch (  final MetaClientException e) {
    log.error("String_Node_Str",e);
  }
}
Program: 8184
Project: 8184
Buggy source:
private synchronized MessageConsumer createConsumer0(final ConsumerConfig consumerConfig,final OffsetStorage offsetStorage,final RecoverManager recoverManager0){
  if (consumerConfig.getServerUrl() == null) {
    consumerConfig.setServerUrl(metaClientConfig.getServerUrl());
  }
  if (offsetStorage == null) {
    throw new InvalidOffsetStorageException("String_Node_Str");
  }
  if (!recoverManager0.isStarted()) {
    recoverManager0.start(metaClientConfig);
  }
  checkConsumerConfig(consumerConfig);
  return this.addChild(new SimpleMessageConsumer(this,remotingClient,consumerConfig,consumerZooKeeper,producerZooKeeper,subscribeInfoManager,recoverManager0,offsetStorage,createLoadBalanceStrategy(consumerConfig)));
}

Fixed version (ground truth):
private synchronized MessageConsumer createConsumer0(final ConsumerConfig consumerConfig,final OffsetStorage offsetStorage,final RecoverManager recoverManager0){
  if (consumerConfig.getServerUrl() == null) {
    consumerConfig.setServerUrl(this.metaClientConfig.getServerUrl());
  }
  if (offsetStorage == null) {
    throw new InvalidOffsetStorageException("String_Node_Str");
  }
  if (!recoverManager0.isStarted()) {
    recoverManager0.start(this.metaClientConfig);
  }
  this.checkConsumerConfig(consumerConfig);
  return this.addChild(new SimpleMessageConsumer(this,this.remotingClient,consumerConfig,this.consumerZooKeeper,this.producerZooKeeper,this.subscribeInfoManager,recoverManager0,offsetStorage,this.createLoadBalanceStrategy(consumerConfig)));
}
Program: 8185
Project: 8185
Buggy source:
private void initZooKeeper() throws MetaClientException {
  zkConfig=null;
  if (metaClientConfig.getZkConfig() != null) {
    zkConfig=metaClientConfig.getZkConfig();
  }
 else {
    zkConfig=loadZkConfigFromDiamond();
  }
  if (zkConfig != null) {
    zkClient=new ZkClient(zkConfig.zkConnect,zkConfig.zkSessionTimeoutMs,zkConfig.zkConnectionTimeoutMs,new ZkUtils.StringSerializer());
    metaZookeeper=new MetaZookeeper(zkClient,zkConfig.zkRoot);
  }
 else {
    throw new MetaClientException("String_Node_Str");
  }
}

Fixed version (ground truth):
private void initZooKeeper() throws MetaClientException {
  this.zkConfig=null;
  if (this.metaClientConfig.getZkConfig() != null) {
    this.zkConfig=this.metaClientConfig.getZkConfig();
  }
 else {
    this.zkConfig=this.loadZkConfigFromDiamond();
  }
  if (this.zkConfig != null) {
    this.zkClient=new ZkClient(this.zkConfig.zkConnect,this.zkConfig.zkSessionTimeoutMs,this.zkConfig.zkConnectionTimeoutMs,new ZkUtils.StringSerializer());
    this.metaZookeeper=new MetaZookeeper(this.zkClient,this.zkConfig.zkRoot);
  }
 else {
    throw new MetaClientException("String_Node_Str");
  }
}
Program: 8186
Project: 8186
Buggy source:
private void connectServer(final MetaClientConfig metaClientConfig) throws NetworkException {
  try {
    remotingClient.connect(metaClientConfig.getServerUrl());
    remotingClient.awaitReadyInterrupt(metaClientConfig.getServerUrl());
  }
 catch (  final NotifyRemotingException e) {
    throw new NetworkException("String_Node_Str" + metaClientConfig.getServerUrl() + "String_Node_Str",e);
  }
catch (  final InterruptedException e) {
    Thread.currentThread().interrupt();
  }
}

Fixed version (ground truth):
private void connectServer(final MetaClientConfig metaClientConfig) throws NetworkException {
  try {
    this.remotingClient.connect(metaClientConfig.getServerUrl());
    this.remotingClient.awaitReadyInterrupt(metaClientConfig.getServerUrl());
  }
 catch (  final NotifyRemotingException e) {
    throw new NetworkException("String_Node_Str" + metaClientConfig.getServerUrl() + "String_Node_Str",e);
  }
catch (  final InterruptedException e) {
    Thread.currentThread().interrupt();
  }
}
Program: 8187
Project: 8187
Buggy source:
/** 
 * ���������ߺ�zk����������
 * @return
 */
public ConsumerZooKeeper getConsumerZooKeeper(){
  return consumerZooKeeper;
}

Fixed version (ground truth):
/** 
 * ���������ߺ�zk����������
 * @return
 */
public ConsumerZooKeeper getConsumerZooKeeper(){
  return this.consumerZooKeeper;
}
Program: 8188
Project: 8188
Buggy source:
/** 
 * ����ͨѶ�ͻ���
 * @return
 */
public RemotingClientWrapper getRemotingClient(){
  return remotingClient;
}

Fixed version (ground truth):
/** 
 * ����ͨѶ�ͻ���
 * @return
 */
public RemotingClientWrapper getRemotingClient(){
  return this.remotingClient;
}
Program: 8189
Project: 8189
Buggy source:
/** 
 * ���ض��Ĺ�ϵ������
 * @return
 */
public SubscribeInfoManager getSubscribeInfoManager(){
  return subscribeInfoManager;
}

Fixed version (ground truth):
/** 
 * ���ض��Ĺ�ϵ������
 * @return
 */
public SubscribeInfoManager getSubscribeInfoManager(){
  return this.subscribeInfoManager;
}
Program: 8190
Project: 8190
Buggy source:
/** 
 * ���ر��ػָ���Ϣ������
 * @return
 */
public RecoverManager getRecoverStorageManager(){
  return recoverManager;
}

Fixed version (ground truth):
/** 
 * ���ر��ػָ���Ϣ������
 * @return
 */
public RecoverManager getRecoverStorageManager(){
  return this.recoverManager;
}
Program: 8191
Project: 8191
Buggy source:
/** 
 * ���ش˹��������������Ӷ����������ߡ������ߵ�
 * @return
 */
public CopyOnWriteArrayList<Shutdownable> getChildren(){
  return children;
}

Fixed version (ground truth):
/** 
 * ���ش˹��������������Ӷ����������ߡ������ߵ�
 * @return
 */
public CopyOnWriteArrayList<Shutdownable> getChildren(){
  return this.children;
}
Program: 8192
Project: 8192
Buggy source:
protected ConsumerZooKeeper initConsumerZooKeeper(final RemotingClientWrapper remotingClientWrapper,final ZkClient zkClient2,final ZKConfig config){
  return new ConsumerZooKeeper(metaZookeeper,remotingClient,zkClient,zkConfig);
}

Fixed version (ground truth):
protected ConsumerZooKeeper initConsumerZooKeeper(final RemotingClientWrapper remotingClientWrapper,final ZkClient zkClient2,final ZKConfig config){
  return new ConsumerZooKeeper(this.metaZookeeper,this.remotingClient,this.zkClient,this.zkConfig);
}
Program: 8193
Project: 8193
Buggy source:
/** 
 * ���ؿͻ�������
 * @return
 */
public MetaClientConfig getMetaClientConfig(){
  return metaClientConfig;
}

Fixed version (ground truth):
/** 
 * ���ؿͻ�������
 * @return
 */
public MetaClientConfig getMetaClientConfig(){
  return this.metaClientConfig;
}
Program: 8195
Project: 8195
Buggy source:
protected <T extends Shutdownable>T addChild(final T child){
  children.add(child);
  return child;
}

Fixed version (ground truth):
protected <T extends Shutdownable>T addChild(final T child){
  this.children.add(child);
  return child;
}
Program: 8196
Project: 8196
Buggy source:
@Override public void shutdown() throws MetaClientException {
  if (shutdown) {
    return;
  }
  shutdown=true;
  recoverManager.shutdown();
  for (  final Shutdownable child : children) {
    child.shutdown();
  }
  try {
    remotingClient.stop();
  }
 catch (  final NotifyRemotingException e) {
    throw new NetworkException("String_Node_Str",e);
  }
  if (zkClient != null) {
    zkClient.close();
  }
  if (!isHutdownHookCalled) {
    Runtime.getRuntime().removeShutdownHook(shutdownHook);
  }
}

Fixed version (ground truth):
@Override public void shutdown() throws MetaClientException {
  if (this.shutdown) {
    return;
  }
  this.shutdown=true;
  this.recoverManager.shutdown();
  for (  final Shutdownable child : this.children) {
    child.shutdown();
  }
  try {
    this.remotingClient.stop();
  }
 catch (  final NotifyRemotingException e) {
    throw new NetworkException("String_Node_Str",e);
  }
  if (this.zkClient != null) {
    this.zkClient.close();
  }
  if (!this.isHutdownHookCalled) {
    Runtime.getRuntime().removeShutdownHook(this.shutdownHook);
  }
}
Program: 8197
Project: 8197
Buggy source:
@Override public StatsResult getStats(InetSocketAddress target) throws InterruptedException {
  return this.getStats(null,null);
}

Fixed version (ground truth):
@Override public StatsResult getStats(InetSocketAddress target) throws InterruptedException {
  return this.getStats(target,null);
}
Program: 8198
Project: 8198
Buggy source:
private Map<InetSocketAddress,StatsResult> getStats0(InetSocketAddress target,String item) throws InterruptedException {
  Set<String> groups=remotingClient.getGroupSet();
  if (groups == null || groups.size() <= 1) {
    return Collections.emptyMap();
  }
  Map<InetSocketAddress,StatsResult> rt=new HashMap<InetSocketAddress,StatsResult>();
  try {
    for (    String group : groups) {
      if (!group.equals(Constants.DEFAULT_GROUP)) {
        URI uri=new URI(group);
        InetSocketAddress sockAddr=new InetSocketAddress(uri.getHost(),uri.getPort());
        if (target == null || target.equals(sockAddr)) {
          BooleanCommand resp=(BooleanCommand)remotingClient.invokeToGroup(group,new StatsCommand(OpaqueGenerator.getNextOpaque(),item));
          if (resp.getResponseStatus() == ResponseStatus.NO_ERROR) {
            String body=resp.getErrorMsg();
            if (body != null) {
              parseStatsValues(sockAddr,rt,group,body);
            }
          }
        }
      }
    }
    return rt;
  }
 catch (  InterruptedException e) {
    throw e;
  }
catch (  Exception e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private Map<InetSocketAddress,StatsResult> getStats0(InetSocketAddress target,String item) throws InterruptedException {
  Set<String> groups=remotingClient.getGroupSet();
  if (groups == null || groups.size() <= 1) {
    return Collections.emptyMap();
  }
  Map<InetSocketAddress,StatsResult> rt=new HashMap<InetSocketAddress,StatsResult>();
  try {
    for (    String group : groups) {
      if (!group.equals(Constants.DEFAULT_GROUP)) {
        URI uri=new URI(group);
        InetSocketAddress sockAddr=new InetSocketAddress(uri.getHost(),uri.getPort());
        if (target == null || target.equals(sockAddr)) {
          BooleanCommand resp=(BooleanCommand)remotingClient.invokeToGroup(group,new StatsCommand(OpaqueGenerator.getNextOpaque(),item),STATS_OPTIMEOUT,TimeUnit.MILLISECONDS);
          if (resp.getResponseStatus() == ResponseStatus.NO_ERROR) {
            String body=resp.getErrorMsg();
            if (body != null) {
              parseStatsValues(sockAddr,rt,group,body);
            }
          }
        }
      }
    }
    return rt;
  }
 catch (  InterruptedException e) {
    throw e;
  }
catch (  Exception e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
}
Program: 8199
Project: 8199
Buggy source:
@Test(expected=InvalidConsumerConfigException.class) public void testCreateConsumer_NoGroup() throws Exception {
  final ConsumerConfig consumerConfig=new ConsumerConfig();
  final MessageConsumer messageConsumer=this.messageSessionFactory.createConsumer(consumerConfig);
}

Fixed version (ground truth):
@Test(expected=InvalidConsumerConfigException.class) public void testCreateConsumer_NoGroup() throws Exception {
  final ConsumerConfig consumerConfig=new ConsumerConfig();
  final MessageConsumer messageConsumer=messageSessionFactory.createConsumer(consumerConfig);
}
Program: 8200
Project: 8200
Buggy source:
@Test public void testCreateProducer() throws Exception {
  final MessageProducer producer=this.messageSessionFactory.createProducer();
  assertNotNull(producer);
  assertTrue(producer.getPartitionSelector() instanceof RoundRobinPartitionSelector);
  assertFalse(producer.isOrdered());
  assertTrue(this.messageSessionFactory.getChildren().contains(producer));
  producer.shutdown();
  assertFalse(this.messageSessionFactory.getChildren().contains(producer));
}

Fixed version (ground truth):
@Test public void testCreateProducer() throws Exception {
  final MessageProducer producer=messageSessionFactory.createProducer();
  assertNotNull(producer);
  assertTrue(producer.getPartitionSelector() instanceof RoundRobinPartitionSelector);
  assertFalse(producer.isOrdered());
  assertTrue(messageSessionFactory.getChildren().contains(producer));
  producer.shutdown();
  assertFalse(messageSessionFactory.getChildren().contains(producer));
}
Program: 8201
Project: 8201
Buggy source:
@Test(expected=InvalidConsumerConfigException.class) public void testCreateConsumer_InvalidThreadCount() throws Exception {
  final ConsumerConfig consumerConfig=new ConsumerConfig();
  consumerConfig.setGroup("String_Node_Str");
  consumerConfig.setFetchRunnerCount(0);
  final MessageConsumer messageConsumer=this.messageSessionFactory.createConsumer(consumerConfig);
}

Fixed version (ground truth):
@Test(expected=InvalidConsumerConfigException.class) public void testCreateConsumer_InvalidThreadCount() throws Exception {
  final ConsumerConfig consumerConfig=new ConsumerConfig();
  consumerConfig.setGroup("String_Node_Str");
  consumerConfig.setFetchRunnerCount(0);
  final MessageConsumer messageConsumer=messageSessionFactory.createConsumer(consumerConfig);
}
Program: 8202
Project: 8202
Buggy source:
@Test(expected=IllegalArgumentException.class) public void testCreateConsumer_InvalidFetchTimeout() throws Exception {
  final ConsumerConfig consumerConfig=new ConsumerConfig();
  consumerConfig.setGroup("String_Node_Str");
  consumerConfig.setFetchTimeoutInMills(0);
  final MessageConsumer messageConsumer=this.messageSessionFactory.createConsumer(consumerConfig);
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void testCreateConsumer_InvalidFetchTimeout() throws Exception {
  final ConsumerConfig consumerConfig=new ConsumerConfig();
  consumerConfig.setGroup("String_Node_Str");
  consumerConfig.setFetchTimeoutInMills(0);
  final MessageConsumer messageConsumer=messageSessionFactory.createConsumer(consumerConfig);
}
Program: 8203
Project: 8203
Buggy source:
@Ignore public void testCreateProducerOrdered() throws Exception {
  final MessageProducer producer=this.messageSessionFactory.createProducer(true);
  assertNotNull(producer);
  assertTrue(producer.getPartitionSelector() instanceof RoundRobinPartitionSelector);
  assertTrue(producer.isOrdered());
  assertTrue(this.messageSessionFactory.getChildren().contains(producer));
  producer.shutdown();
  assertFalse(this.messageSessionFactory.getChildren().contains(producer));
}

Fixed version (ground truth):
@Ignore public void testCreateProducerOrdered() throws Exception {
  final MessageProducer producer=messageSessionFactory.createProducer(true);
  assertNotNull(producer);
  assertTrue(producer.getPartitionSelector() instanceof RoundRobinPartitionSelector);
  assertTrue(producer.isOrdered());
  assertTrue(messageSessionFactory.getChildren().contains(producer));
  producer.shutdown();
  assertFalse(messageSessionFactory.getChildren().contains(producer));
}
Program: 8204
Project: 8204
Buggy source:
@Before public void setUp() throws Exception {
  final MetaClientConfig metaClientConfig=new MetaClientConfig();
  metaClientConfig.setDiamondZKDataId("String_Node_Str");
  this.messageSessionFactory=new MetaMessageSessionFactory(metaClientConfig);
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  final MetaClientConfig metaClientConfig=new MetaClientConfig();
  metaClientConfig.setDiamondZKDataId("String_Node_Str");
  messageSessionFactory=new MetaMessageSessionFactory(metaClientConfig);
}
Program: 8205
Project: 8205
Buggy source:
@Test public void testCreateConsumer() throws Exception {
  final ConsumerConfig consumerConfig=new ConsumerConfig();
  consumerConfig.setGroup("String_Node_Str");
  final MessageConsumer messageConsumer=this.messageSessionFactory.createConsumer(consumerConfig);
  assertNotNull(messageConsumer);
  assertTrue(this.messageSessionFactory.getChildren().contains(messageConsumer));
  messageConsumer.shutdown();
  assertFalse(this.messageSessionFactory.getChildren().contains(messageConsumer));
}

Fixed version (ground truth):
@Test public void testCreateConsumer() throws Exception {
  final ConsumerConfig consumerConfig=new ConsumerConfig();
  consumerConfig.setGroup("String_Node_Str");
  final MessageConsumer messageConsumer=messageSessionFactory.createConsumer(consumerConfig);
  assertNotNull(messageConsumer);
  assertTrue(messageSessionFactory.getChildren().contains(messageConsumer));
  messageConsumer.shutdown();
  assertFalse(messageSessionFactory.getChildren().contains(messageConsumer));
}
Program: 8206
Project: 8206
Buggy source:
@Test(expected=IllegalArgumentException.class) public void testCreateConsumer_InvalidCommitOffsetsInterval() throws Exception {
  final ConsumerConfig consumerConfig=new ConsumerConfig();
  consumerConfig.setGroup("String_Node_Str");
  consumerConfig.setCommitOffsetPeriodInMills(-1);
  final MessageConsumer messageConsumer=this.messageSessionFactory.createConsumer(consumerConfig);
}

Fixed version (ground truth):
@Test(expected=IllegalArgumentException.class) public void testCreateConsumer_InvalidCommitOffsetsInterval() throws Exception {
  final ConsumerConfig consumerConfig=new ConsumerConfig();
  consumerConfig.setGroup("String_Node_Str");
  consumerConfig.setCommitOffsetPeriodInMills(-1);
  final MessageConsumer messageConsumer=messageSessionFactory.createConsumer(consumerConfig);
}
Program: 8207
Project: 8207
Buggy source:
@After public void tearDown() throws Exception {
  this.messageSessionFactory.shutdown();
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  messageSessionFactory.shutdown();
}
Program: 8209
Project: 8209
Buggy source:
private List<AutocryptPeer> getAutocryptPeers(String packageName,String... autocryptId){
  ArrayList<AutocryptPeer> result=new ArrayList<>(autocryptId.length);
  SqlDelightQuery query=AutocryptPeer.FACTORY.selectByIdentifiers(packageName,autocryptId);
  try (Cursor cursor=getReadableDb().query(query)){
    if (cursor.moveToNext()) {
      AutocryptPeer autocryptPeer=AutocryptPeer.PEER_MAPPER.map(cursor);
      result.add(autocryptPeer);
    }
  }
   return result;
}

Fixed version (ground truth):
private List<AutocryptPeer> getAutocryptPeers(String packageName,String... autocryptId){
  SqlDelightQuery query=AutocryptPeer.FACTORY.selectByIdentifiers(packageName,autocryptId);
  return mapAllRows(query,AutocryptPeer.PEER_MAPPER);
}
Program: 8210
Project: 8210
Buggy source:
public List<AutocryptKeyStatus> getAutocryptKeyStatus(String packageName,String[] autocryptIds){
  ArrayList<AutocryptKeyStatus> result=new ArrayList<>(autocryptIds.length);
  SqlDelightQuery query=AutocryptPeer.FACTORY.selectAutocryptKeyStatus(packageName,autocryptIds,System.currentTimeMillis());
  try (Cursor cursor=getReadableDb().query(query)){
    if (cursor.moveToNext()) {
      AutocryptKeyStatus autocryptPeer=AutocryptPeer.KEY_STATUS_MAPPER.map(cursor);
      result.add(autocryptPeer);
    }
  }
   return result;
}

Fixed version (ground truth):
public List<AutocryptKeyStatus> getAutocryptKeyStatus(String packageName,String[] autocryptIds){
  SqlDelightQuery query=AutocryptPeer.FACTORY.selectAutocryptKeyStatus(packageName,autocryptIds);
  return mapAllRows(query,AutocryptPeer.KEY_STATUS_MAPPER);
}
Program: 8212
Project: 8212
Buggy source:
private Intent getAuthenticationPublicKey(Intent data,boolean asSshKey){
  long masterKeyId=getKeyId(data);
  if (masterKeyId != Constants.key.none) {
    try {
      if (asSshKey) {
        return getSSHPublicKey(masterKeyId);
      }
 else {
        return getX509PublicKey(masterKeyId);
      }
    }
 catch (    KeyRepository.NotFoundException e) {
      return createExceptionErrorResult(SshAuthenticationApiError.NO_SUCH_KEY,"String_Node_Str",e);
    }
catch (    PgpKeyNotFoundException e) {
      return createExceptionErrorResult(SshAuthenticationApiError.NO_AUTH_KEY,"String_Node_Str",e);
    }
catch (    NoSuchAlgorithmException e) {
      return createExceptionErrorResult(SshAuthenticationApi.RESULT_CODE_ERROR,"String_Node_Str",e);
    }
  }
 else {
    return createErrorResult(SshAuthenticationApiError.NO_KEY_ID,"String_Node_Str");
  }
}

Fixed version (ground truth):
private Intent getAuthenticationPublicKey(Intent data,boolean asSshKey){
  long masterKeyId=getKeyId(data);
  if (masterKeyId != Constants.key.none) {
    try {
      if (asSshKey) {
        return getSSHPublicKey(masterKeyId);
      }
 else {
        return getX509PublicKey(masterKeyId);
      }
    }
 catch (    KeyRepository.NotFoundException e) {
      return createExceptionErrorResult(SshAuthenticationApiError.NO_SUCH_KEY,"String_Node_Str",e);
    }
catch (    PgpKeyNotFoundException e) {
      return createExceptionErrorResult(SshAuthenticationApiError.NO_AUTH_KEY,"String_Node_Str",e);
    }
catch (    NoSuchAlgorithmException e) {
      return createExceptionErrorResult(SshAuthenticationApiError.INVALID_ALGORITHM,"String_Node_Str",e);
    }
  }
 else {
    return createErrorResult(SshAuthenticationApiError.NO_KEY_ID,"String_Node_Str");
  }
}
Program: 8213
Project: 8213
Buggy source:
private Intent getAuthenticationPublicKey(Intent data,boolean asSshKey){
  long masterKeyId=getKeyId(data);
  if (masterKeyId != Constants.key.none) {
    try {
      if (asSshKey) {
        return getSSHPublicKey(masterKeyId);
      }
 else {
        return getX509PublicKey(masterKeyId);
      }
    }
 catch (    KeyRepository.NotFoundException e) {
      return createExceptionErrorResult(SshAuthenticationApiError.NO_SUCH_KEY,"String_Node_Str",e);
    }
catch (    PgpKeyNotFoundException e) {
      return createExceptionErrorResult(SshAuthenticationApiError.NO_AUTH_KEY,"String_Node_Str",e);
    }
catch (    NoSuchAlgorithmException e) {
      return createExceptionErrorResult(SshAuthenticationApi.RESULT_CODE_ERROR,"String_Node_Str",e);
    }
  }
 else {
    return createErrorResult(SshAuthenticationApiError.NO_KEY_ID,"String_Node_Str");
  }
}

Fixed version (ground truth):
private Intent getAuthenticationPublicKey(Intent data,boolean asSshKey){
  long masterKeyId=getKeyId(data);
  if (masterKeyId != Constants.key.none) {
    try {
      if (asSshKey) {
        return getSSHPublicKey(masterKeyId);
      }
 else {
        return getX509PublicKey(masterKeyId);
      }
    }
 catch (    KeyRepository.NotFoundException e) {
      return createExceptionErrorResult(SshAuthenticationApiError.NO_SUCH_KEY,"String_Node_Str",e);
    }
catch (    PgpKeyNotFoundException e) {
      return createExceptionErrorResult(SshAuthenticationApiError.NO_AUTH_KEY,"String_Node_Str",e);
    }
catch (    NoSuchAlgorithmException e) {
      return createExceptionErrorResult(SshAuthenticationApiError.INVALID_ALGORITHM,"String_Node_Str",e);
    }
  }
 else {
    return createErrorResult(SshAuthenticationApiError.NO_KEY_ID,"String_Node_Str");
  }
}
Program: 8214
Project: 8214
Buggy source:
public static IteratorWithIOThrow<UncachedKeyRing> fromStream(final InputStream stream){
  return new IteratorWithIOThrow<UncachedKeyRing>(){
    UncachedKeyRing mNext=null;
    PGPObjectFactory mObjectFactory=null;
    private void cacheNext() throws IOException {
      if (mNext != null) {
        return;
      }
      try {
        while (stream.available() > 0) {
          if (mObjectFactory == null) {
            InputStream in=PGPUtil.getDecoderStream(stream);
            mObjectFactory=new PGPObjectFactory(in,new JcaKeyFingerprintCalculator());
          }
          Object obj;
          while ((obj=mObjectFactory.nextObject()) != null) {
            Log.d(Constants.TAG,"String_Node_Str" + obj.getClass());
            if (!(obj instanceof PGPKeyRing)) {
              Log.i(Constants.TAG,"String_Node_Str" + obj.getClass().getName() + "String_Node_Str");
              continue;
            }
            mNext=new UncachedKeyRing((PGPKeyRing)obj);
            return;
          }
          mObjectFactory=null;
        }
      }
 catch (      ArrayIndexOutOfBoundsException e) {
        throw new IOException(e);
      }
    }
    @Override public boolean hasNext() throws IOException {
      cacheNext();
      return mNext != null;
    }
    @Override public UncachedKeyRing next() throws IOException {
      try {
        cacheNext();
        return mNext;
      }
  finally {
        mNext=null;
      }
    }
  }
;
}

Fixed version (ground truth):
public static IteratorWithIOThrow<UncachedKeyRing> fromStream(InputStream rawStream){
  final InputStream stream=rawStream.markSupported() ? rawStream : new BufferedInputStream(rawStream);
  return new IteratorWithIOThrow<UncachedKeyRing>(){
    UncachedKeyRing mNext=null;
    PGPObjectFactory mObjectFactory=null;
    private void cacheNext() throws IOException {
      if (mNext != null) {
        return;
      }
      try {
        while (true) {
          if (mObjectFactory == null) {
            stream.mark(1);
            if (stream.read() == -1) {
              break;
            }
            stream.reset();
            InputStream in=PGPUtil.getDecoderStream(stream);
            mObjectFactory=new PGPObjectFactory(in,new JcaKeyFingerprintCalculator());
          }
          Object obj;
          while ((obj=mObjectFactory.nextObject()) != null) {
            Log.d(Constants.TAG,"String_Node_Str" + obj.getClass());
            if (!(obj instanceof PGPKeyRing)) {
              Log.i(Constants.TAG,"String_Node_Str" + obj.getClass().getName() + "String_Node_Str");
              continue;
            }
            mNext=new UncachedKeyRing((PGPKeyRing)obj);
            return;
          }
          mObjectFactory=null;
        }
      }
 catch (      ArrayIndexOutOfBoundsException e) {
        throw new IOException(e);
      }
    }
    @Override public boolean hasNext() throws IOException {
      cacheNext();
      return mNext != null;
    }
    @Override public UncachedKeyRing next() throws IOException {
      try {
        cacheNext();
        return mNext;
      }
  finally {
        mNext=null;
      }
    }
  }
;
}
Program: 8215
Project: 8215
Buggy source:
private void cacheNext() throws IOException {
  if (mNext != null) {
    return;
  }
  try {
    while (stream.available() > 0) {
      if (mObjectFactory == null) {
        InputStream in=PGPUtil.getDecoderStream(stream);
        mObjectFactory=new PGPObjectFactory(in,new JcaKeyFingerprintCalculator());
      }
      Object obj;
      while ((obj=mObjectFactory.nextObject()) != null) {
        Log.d(Constants.TAG,"String_Node_Str" + obj.getClass());
        if (!(obj instanceof PGPKeyRing)) {
          Log.i(Constants.TAG,"String_Node_Str" + obj.getClass().getName() + "String_Node_Str");
          continue;
        }
        mNext=new UncachedKeyRing((PGPKeyRing)obj);
        return;
      }
      mObjectFactory=null;
    }
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw new IOException(e);
  }
}

Fixed version (ground truth):
private void cacheNext() throws IOException {
  if (mNext != null) {
    return;
  }
  try {
    while (true) {
      if (mObjectFactory == null) {
        stream.mark(1);
        if (stream.read() == -1) {
          break;
        }
        stream.reset();
        InputStream in=PGPUtil.getDecoderStream(stream);
        mObjectFactory=new PGPObjectFactory(in,new JcaKeyFingerprintCalculator());
      }
      Object obj;
      while ((obj=mObjectFactory.nextObject()) != null) {
        Log.d(Constants.TAG,"String_Node_Str" + obj.getClass());
        if (!(obj instanceof PGPKeyRing)) {
          Log.i(Constants.TAG,"String_Node_Str" + obj.getClass().getName() + "String_Node_Str");
          continue;
        }
        mNext=new UncachedKeyRing((PGPKeyRing)obj);
        return;
      }
      mObjectFactory=null;
    }
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw new IOException(e);
  }
}
Program: 8216
Project: 8216
Buggy source:
@Override protected void onActivityResult(@RequestType int requestCode,int resultCode,Intent data){
  if (mImportOpHelper.handleActivityResult(requestCode,resultCode,data)) {
    return;
  }
  if (mEditOpHelper != null) {
    mEditOpHelper.handleActivityResult(requestCode,resultCode,data);
  }
  if (resultCode != Activity.RESULT_OK) {
    super.onActivityResult(requestCode,resultCode,data);
    return;
  }
switch (requestCode) {
case REQUEST_QR_FINGERPRINT:
{
      if (data.hasExtra(OperationResult.EXTRA_RESULT)) {
        OperationResult result=data.getParcelableExtra(OperationResult.EXTRA_RESULT);
        result.createNotify(this).show();
        return;
      }
      String fp=data.getStringExtra(ImportKeysProxyActivity.EXTRA_FINGERPRINT);
      if (fp == null) {
        Notify.create(this,R.string.error_scan_fp,Notify.LENGTH_LONG,Style.ERROR).show();
        return;
      }
      if (mFingerprintString.equalsIgnoreCase(fp)) {
        certifyImmediate();
      }
 else {
        Notify.create(this,R.string.error_scan_match,Notify.LENGTH_LONG,Style.ERROR).show();
      }
      return;
    }
case REQUEST_BACKUP:
{
    startBackupActivity();
    return;
  }
case REQUEST_DELETE:
{
  setResult(RESULT_OK,data);
  finish();
  return;
}
case REQUEST_CERTIFY:
{
if (data.hasExtra(OperationResult.EXTRA_RESULT)) {
  OperationResult result=data.getParcelableExtra(OperationResult.EXTRA_RESULT);
  result.createNotify(this).show();
}
return;
}
}
super.onActivityResult(requestCode,resultCode,data);
}

Fixed version (ground truth):
@Override protected void onActivityResult(@RequestType int requestCode,int resultCode,Intent data){
  if (mImportOpHelper.handleActivityResult(requestCode,resultCode,data)) {
    return;
  }
  if (mEditOpHelper != null) {
    mEditOpHelper.handleActivityResult(requestCode,resultCode,data);
  }
  if (resultCode != Activity.RESULT_OK) {
    super.onActivityResult(requestCode,resultCode,data);
    return;
  }
switch (requestCode) {
case REQUEST_QR_FINGERPRINT:
{
      if (data.hasExtra(OperationResult.EXTRA_RESULT)) {
        OperationResult result=data.getParcelableExtra(OperationResult.EXTRA_RESULT);
        result.createNotify(this).show();
        return;
      }
      byte[] fingerprint=data.getByteArrayExtra(ImportKeysProxyActivity.EXTRA_FINGERPRINT);
      if (fingerprint == null) {
        Notify.create(this,R.string.error_scan_fp,Notify.LENGTH_LONG,Style.ERROR).show();
        return;
      }
      if (Arrays.equals(mFingerprint,fingerprint)) {
        certifyImmediate();
      }
 else {
        Notify.create(this,R.string.error_scan_match,Notify.LENGTH_LONG,Style.ERROR).show();
      }
      return;
    }
case REQUEST_BACKUP:
{
    startBackupActivity();
    return;
  }
case REQUEST_DELETE:
{
  setResult(RESULT_OK,data);
  finish();
  return;
}
case REQUEST_CERTIFY:
{
if (data.hasExtra(OperationResult.EXTRA_RESULT)) {
  OperationResult result=data.getParcelableExtra(OperationResult.EXTRA_RESULT);
  result.createNotify(this).show();
}
return;
}
}
super.onActivityResult(requestCode,resultCode,data);
}
Program: 8219
Project: 8219
Buggy source:
/** 
 * Load QR Code asynchronously and with a fade in animation
 */
private void loadQrCode(final String fingerprint){
  AsyncTask<Void,Void,Bitmap> loadTask=new AsyncTask<Void,Void,Bitmap>(){
    protected Bitmap doInBackground(    Void... unused){
      Uri uri=new Uri.Builder().scheme(Constants.FINGERPRINT_SCHEME).opaquePart(fingerprint).build();
      return QrCodeUtils.getQRCodeBitmap(uri,0);
    }
    protected void onPostExecute(    Bitmap qrCode){
      mQrCodeLoaded=fingerprint;
      Bitmap scaled=Bitmap.createScaledBitmap(qrCode,mQrCode.getHeight(),mQrCode.getHeight(),false);
      mQrCode.setImageBitmap(scaled);
      AlphaAnimation anim=new AlphaAnimation(0.0f,1.0f);
      anim.setDuration(200);
      mQrCode.startAnimation(anim);
    }
  }
;
  loadTask.execute();
}

Fixed version (ground truth):
/** 
 * Load QR Code asynchronously and with a fade in animation
 */
private void loadQrCode(final byte[] fingerprint){
  AsyncTask<Void,Void,Bitmap> loadTask=new AsyncTask<Void,Void,Bitmap>(){
    protected Bitmap doInBackground(    Void... unused){
      String fingerprintStr=KeyFormattingUtils.convertFingerprintToHex(fingerprint);
      Uri uri=new Uri.Builder().scheme(Constants.FINGERPRINT_SCHEME).opaquePart(fingerprintStr).build();
      return QrCodeUtils.getQRCodeBitmap(uri,0);
    }
    protected void onPostExecute(    Bitmap qrCode){
      mQrCodeLoaded=fingerprint;
      Bitmap scaled=Bitmap.createScaledBitmap(qrCode,mQrCode.getHeight(),mQrCode.getHeight(),false);
      mQrCode.setImageBitmap(scaled);
      AlphaAnimation anim=new AlphaAnimation(0.0f,1.0f);
      anim.setDuration(200);
      mQrCode.startAnimation(anim);
    }
  }
;
  loadTask.execute();
}
Program: 8220
Project: 8220
Buggy source:
@Override public void onGlobalLayout(){
  Bitmap scaled=Bitmap.createScaledBitmap(qrCode,vQrCodeImage.getWidth(),vQrCodeImage.getWidth(),false);
  vQrCodeImage.setImageBitmap(scaled);
}

Fixed version (ground truth):
@Override public void onGlobalLayout(){
  int viewSize=vQrCodeImage.getWidth();
  if (viewSize == 0) {
    return;
  }
  Bitmap scaled=Bitmap.createScaledBitmap(qrCode,viewSize,viewSize,false);
  vQrCodeImage.setImageBitmap(scaled);
}
Program: 8221
Project: 8221
Buggy source:
@Override public void setQrImage(final Bitmap qrCode){
  vQrCodeImage.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      Bitmap scaled=Bitmap.createScaledBitmap(qrCode,vQrCodeImage.getWidth(),vQrCodeImage.getWidth(),false);
      vQrCodeImage.setImageBitmap(scaled);
    }
  }
);
  vQrCodeImage.requestLayout();
}

Fixed version (ground truth):
@Override public void setQrImage(final Bitmap qrCode){
  vQrCodeImage.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      int viewSize=vQrCodeImage.getWidth();
      if (viewSize == 0) {
        return;
      }
      Bitmap scaled=Bitmap.createScaledBitmap(qrCode,viewSize,viewSize,false);
      vQrCodeImage.setImageBitmap(scaled);
    }
  }
);
  vQrCodeImage.requestLayout();
}
Program: 8222
Project: 8222
Buggy source:
private void parseExtendedCaps(byte[] v){
  mHasSM=(v[0] & MASK_SM) != 0;
  mHasKeyImport=(v[0] & MASK_KEY_IMPORT) != 0;
  mAttriburesChangable=(v[0] & MASK_ATTRIBUTES_CHANGABLE) != 0;
  mSMAESKeySize=(v[1] == 1) ? 16 : 32;
  mMaxCmdLen=(v[6] << 8) + v[7];
  mMaxRspLen=(v[8] << 8) + v[9];
}

Fixed version (ground truth):
private void parseExtendedCaps(byte[] v){
  mHasSM=(v[0] & MASK_SM) != 0;
  mHasKeyImport=(v[0] & MASK_KEY_IMPORT) != 0;
  mAttriburesChangable=(v[0] & MASK_ATTRIBUTES_CHANGABLE) != 0;
  mSMAESKeySize=0;
switch (v[1]) {
case 1:
    mSMAESKeySize=16;
  break;
case 2:
mSMAESKeySize=32;
break;
}
mMaxCmdLen=(v[6] << 8) + v[7];
mMaxRspLen=(v[8] << 8) + v[9];
}
Program: 8223
Project: 8223
Buggy source:
/** 
 * Connect to device and select pgp applet
 * @throws IOException
 */
public void connectToDevice(final Context ctx) throws IOException {
  mCardCapabilities=new CardCapabilities();
  mTransport.connect();
  CommandAPDU select=new CommandAPDU(0x00,0xA4,0x04,0x00,Hex.decode("String_Node_Str"));
  ResponseAPDU response=communicate(select);
  if (response.getSW() != APDU_SW_SUCCESS) {
    throw new CardException("String_Node_Str",response.getSW());
  }
  mOpenPgpCapabilities=new OpenPgpCapabilities(getData(0x00,0x6E));
  mCardCapabilities=new CardCapabilities(mOpenPgpCapabilities.getHistoricalBytes());
  mPw1ValidatedForSignature=false;
  mPw1ValidatedForDecrypt=false;
  mPw3Validated=false;
  if (mOpenPgpCapabilities.isHasSM()) {
    try {
      SCP11bSecureMessaging.establish(this,ctx);
    }
 catch (    SecureMessagingException e) {
      mSecureMessaging=null;
      Log.e(Constants.TAG,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Connect to device and select pgp applet
 * @throws IOException
 */
public void connectToDevice(final Context ctx) throws IOException {
  mCardCapabilities=new CardCapabilities();
  mTransport.connect();
  CommandAPDU select=new CommandAPDU(0x00,0xA4,0x04,0x00,Hex.decode("String_Node_Str"));
  ResponseAPDU response=communicate(select);
  if (response.getSW() != APDU_SW_SUCCESS) {
    throw new CardException("String_Node_Str",response.getSW());
  }
  mOpenPgpCapabilities=new OpenPgpCapabilities(getData(0x00,0x6E));
  mCardCapabilities=new CardCapabilities(mOpenPgpCapabilities.getHistoricalBytes());
  mPw1ValidatedForSignature=false;
  mPw1ValidatedForDecrypt=false;
  mPw3Validated=false;
  if (mOpenPgpCapabilities.isHasAESSM()) {
    try {
      SCP11bSecureMessaging.establish(this,ctx);
    }
 catch (    SecureMessagingException e) {
      mSecureMessaging=null;
      Log.e(Constants.TAG,"String_Node_Str",e);
    }
  }
}
Program: 8225
Project: 8225
Buggy source:
@Override public ImportKeyResult call(){
  if (checkCancelled()) {
    return null;
  }
  ArrayList<ParcelableKeyRing> list=new ArrayList<>();
  list.add(keyListIterator.next());
  ProgressScaler ignoreProgressable=new ProgressScaler();
  return serialKeyRingImport(list.iterator(),1,keyServer,ignoreProgressable,proxy,skipSave);
}

Fixed version (ground truth):
@Override public ImportKeyResult call(){
  if (checkCancelled()) {
    return null;
  }
  ArrayList<ParcelableKeyRing> list=new ArrayList<>();
  list.add(pkRing);
  ProgressScaler ignoreProgressable=new ProgressScaler();
  return serialKeyRingImport(list.iterator(),1,keyServer,ignoreProgressable,proxy,skipSave);
}
Program: 8230
Project: 8230
Buggy source:
@Override public boolean onActionItemClicked(ActionMode mode,MenuItem item){
switch (item.getItemId()) {
case R.id.menu_key_list_multi_encrypt:
{
      long[] keyIds=getAdapter().getSelectedMasterKeyIds();
      Intent intent=new Intent(getActivity(),EncryptFilesActivity.class);
      intent.setAction(EncryptFilesActivity.ACTION_ENCRYPT_DATA);
      intent.putExtra(EncryptFilesActivity.EXTRA_ENCRYPTION_KEY_IDS,keyIds);
      startActivityForResult(intent,REQUEST_ACTION);
      mode.finish();
      break;
    }
case R.id.menu_key_list_multi_delete:
{
    long[] keyIds=getAdapter().getSelectedMasterKeyIds();
    boolean hasSecret=getAdapter().isAnySecretKeySelected();
    System.out.println(Arrays.toString(keyIds));
    System.out.println(hasSecret);
    Intent intent=new Intent(getActivity(),DeleteKeyDialogActivity.class);
    intent.putExtra(DeleteKeyDialogActivity.EXTRA_DELETE_MASTER_KEY_IDS,keyIds);
    intent.putExtra(DeleteKeyDialogActivity.EXTRA_HAS_SECRET,hasSecret);
    if (hasSecret) {
      intent.putExtra(DeleteKeyDialogActivity.EXTRA_KEYSERVER,Preferences.getPreferences(getActivity()).getPreferredKeyserver());
    }
    startActivityForResult(intent,REQUEST_DELETE);
    break;
  }
}
return false;
}

Fixed version (ground truth):
@Override public boolean onActionItemClicked(ActionMode mode,MenuItem item){
switch (item.getItemId()) {
case R.id.menu_key_list_multi_encrypt:
{
      long[] keyIds=getAdapter().getSelectedMasterKeyIds();
      Intent intent=new Intent(getActivity(),EncryptFilesActivity.class);
      intent.setAction(EncryptFilesActivity.ACTION_ENCRYPT_DATA);
      intent.putExtra(EncryptFilesActivity.EXTRA_ENCRYPTION_KEY_IDS,keyIds);
      startActivityForResult(intent,REQUEST_ACTION);
      mode.finish();
      break;
    }
case R.id.menu_key_list_multi_delete:
{
    long[] keyIds=getAdapter().getSelectedMasterKeyIds();
    boolean hasSecret=getAdapter().isAnySecretKeySelected();
    Intent intent=new Intent(getActivity(),DeleteKeyDialogActivity.class);
    intent.putExtra(DeleteKeyDialogActivity.EXTRA_DELETE_MASTER_KEY_IDS,keyIds);
    intent.putExtra(DeleteKeyDialogActivity.EXTRA_HAS_SECRET,hasSecret);
    if (hasSecret) {
      intent.putExtra(DeleteKeyDialogActivity.EXTRA_KEYSERVER,Preferences.getPreferences(getActivity()).getPreferredKeyserver());
    }
    startActivityForResult(intent,REQUEST_DELETE);
    break;
  }
}
return false;
}
Program: 8231
Project: 8231
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mTextColor=FormattingUtils.getColorFromAttr(getActivity(),R.attr.colorText);
  setHasOptionsMenu(true);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
}