id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
3,301 | table.batch(batch, results);
} catch (Exception e) {
System.err.println("Error: " + e);
}
for (int i = 0; i < results.length; i++) {
<BUG>System.out.println("Result[" + i + "]: " + results[i]);
}
table.close();
System.out.println("After batch call...");
helper.dump("testtable", new String[]{"row1"}, null, null);
}</BUG>
}
| System.out.println("Result[" + i + "]: type = " +
results[i].getClass().getSimpleName() + "; " + results[i]);
connection.close();
|
3,302 | import org.jboss.arquillian.core.api.Instance;</BUG>
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.arquillian.test.spi.enricher.resource.ResourceProvider;
import java.lang.annotation.Annotation;
<BUG>import java.util.ArrayList;
import java.util.List;</BUG>
public class ServiceListResourceProvider implements ResourceProvider {
@Inject
private Instance<KubernetesClient> clientInstance;
| package io.fabric8.arquillian.kubernetes.enricher;
import io.fabric8.arquillian.kubernetes.Session;
import io.fabric8.kubernetes.api.model.ServiceList;
import io.fabric8.kubernetes.client.KubernetesClient;
import org.jboss.arquillian.core.api.Instance;
|
3,303 | package io.fabric8.arquillian.kubernetes.enricher;
import io.fabric8.annotations.ServiceName;
import io.fabric8.arquillian.kubernetes.Session;
<BUG>import io.fabric8.kubernetes.api.KubernetesClient;
import io.fabric8.kubernetes.api.model.Service;
import org.jboss.arquillian.core.api.Instance;</BUG>
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.test.api.ArquillianResource;
| import io.fabric8.kubernetes.client.KubernetesClient;
import org.jboss.arquillian.core.api.Instance;
|
3,304 | }
@Override
public Object lookup(ArquillianResource resource, Annotation... qualifiers) {
KubernetesClient client = this.clientInstance.get();
Session session = sessionInstance.get();
<BUG>for (Service service : client.getServices(session.getNamespace()).getItems()) {
</BUG>
if ( qualifies(service, qualifiers) ) {
return service;
}
| for (Service service : client.services().inNamespace(session.getNamespace()).list().getItems()) {
|
3,305 | package io.fabric8.arquillian.kubernetes.enricher;
<BUG>import io.fabric8.kubernetes.api.KubernetesClient;
</BUG>
import org.jboss.arquillian.core.api.Instance;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.test.api.ArquillianResource;
| import io.fabric8.kubernetes.client.KubernetesClient;
|
3,306 | import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
<BUG>import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;</BUG>
public class Session {
private final String id;
| [DELETED] |
3,307 | package io.fabric8.arquillian.kubernetes.enricher;
import io.fabric8.annotations.ReplicationControllerName;
import io.fabric8.arquillian.kubernetes.Session;
<BUG>import io.fabric8.kubernetes.api.KubernetesClient;
import io.fabric8.kubernetes.api.model.ReplicationController;
import org.jboss.arquillian.core.api.Instance;</BUG>
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.test.api.ArquillianResource;
| import io.fabric8.kubernetes.client.KubernetesClient;
import org.jboss.arquillian.core.api.Instance;
|
3,308 | }
@Override
public Object lookup(ArquillianResource resource, Annotation... qualifiers) {
KubernetesClient client = this.clientInstance.get();
Session session = sessionInstance.get();
<BUG>for (ReplicationController replicationController : client.getReplicationControllers(session.getNamespace()).getItems()) {
</BUG>
if (qualifies(replicationController, qualifiers)) {
return replicationController;
}
| for (ReplicationController replicationController : client.replicationControllers().inNamespace(session.getNamespace()).list().getItems()) {
|
3,309 | this.configuration = configuration;
}
@Override
public Boolean call() throws Exception {
boolean result = true;
<BUG>List<Service> services = kubernetesClient.getServices(session.getNamespace()).getItems();
</BUG>
if (services.isEmpty()) {
result = false;
session.getLogger().warn("No services are available yet, waiting...");
| List<Service> services = kubernetesClient.services().inNamespace(session.getNamespace()).list().getItems();
|
3,310 | package io.fabric8.arquillian.kubernetes;
<BUG>import io.fabric8.kubernetes.api.KubernetesClient;
</BUG>
import io.fabric8.utils.Strings;
import org.jboss.arquillian.core.api.InstanceProducer;
import org.jboss.arquillian.core.api.annotation.ApplicationScoped;
| import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
|
3,311 | public class ClientCreator {
@Inject
@ApplicationScoped
private InstanceProducer<KubernetesClient> kubernetesProducer;
public void createClient(@Observes Configuration config) {
<BUG>KubernetesClient client;
String masterUrl = config.getMasterUrl();
if (Strings.isNotBlank(masterUrl)) {
client = new KubernetesClient(masterUrl);
} else {
client = new KubernetesClient();
}
kubernetesProducer.set(client);</BUG>
}
| if (!Strings.isNullOrBlank(config.getMasterUrl())) {
kubernetesProducer.set(new DefaultKubernetesClient(new DefaultKubernetesClient.ConfigBuilder().masterUrl(config.getMasterUrl()).build()));
|
3,312 | import org.jboss.arquillian.core.api.Instance;</BUG>
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.arquillian.test.spi.enricher.resource.ResourceProvider;
import java.lang.annotation.Annotation;
<BUG>import java.util.ArrayList;
import java.util.List;</BUG>
public class PodListResourceProvider implements ResourceProvider {
@Inject
private Instance<KubernetesClient> clientInstance;
| package io.fabric8.arquillian.kubernetes.enricher;
import io.fabric8.arquillian.kubernetes.Session;
import io.fabric8.kubernetes.api.model.PodList;
import io.fabric8.kubernetes.client.KubernetesClient;
import org.jboss.arquillian.core.api.Instance;
|
3,313 | package io.fabric8.arquillian.kubernetes;
import io.fabric8.kubernetes.api.Controller;
<BUG>import io.fabric8.kubernetes.api.KubernetesClient;
import org.jboss.arquillian.core.api.InstanceProducer;</BUG>
import org.jboss.arquillian.core.api.annotation.ApplicationScoped;
import org.jboss.arquillian.core.api.annotation.Inject;
| import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.OpenShiftClient;
import org.jboss.arquillian.core.api.InstanceProducer;
|
3,314 | package io.fabric8.arquillian.kubernetes;
<BUG>import io.fabric8.kubernetes.api.KubernetesClient;
</BUG>
import io.fabric8.utils.MultiException;
import static io.fabric8.arquillian.utils.Util.cleanupSession;
public class ShutdownHook extends Thread {
| import io.fabric8.kubernetes.client.KubernetesClient;
|
3,315 | package io.fabric8.arquillian.kubernetes.enricher;
import io.fabric8.arquillian.kubernetes.Session;
<BUG>import io.fabric8.kubernetes.api.KubernetesClient;
</BUG>
import io.fabric8.kubernetes.jolokia.JolokiaClients;
import org.jboss.arquillian.core.api.Instance;
import org.jboss.arquillian.core.api.annotation.Inject;
| import io.fabric8.kubernetes.client.KubernetesClient;
|
3,316 | import org.jboss.arquillian.core.api.Instance;</BUG>
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.arquillian.test.spi.enricher.resource.ResourceProvider;
import java.lang.annotation.Annotation;
<BUG>import java.util.ArrayList;
import java.util.List;</BUG>
public class ReplicationControllerListResourceProvider implements ResourceProvider {
@Inject
private Instance<KubernetesClient> clientInstance;
| package io.fabric8.arquillian.kubernetes.enricher;
import io.fabric8.arquillian.kubernetes.Session;
import io.fabric8.kubernetes.api.model.ReplicationControllerList;
import io.fabric8.kubernetes.client.KubernetesClient;
import org.jboss.arquillian.core.api.Instance;
|
3,317 | package org.glowroot.agent.config;
import com.google.common.collect.ImmutableList;
<BUG>import org.immutables.value.Value;
import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;</BUG>
@Value.Immutable
public abstract class UiConfig {
@Value.Default
| import org.glowroot.common.config.ConfigDefaults;
import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
|
3,318 | class RepoAdminImpl implements RepoAdmin {
private final DataSource dataSource;
private final List<CappedDatabase> rollupCappedDatabases;
private final CappedDatabase traceCappedDatabase;
private final ConfigRepository configRepository;
<BUG>private final AgentDao agentDao;
</BUG>
private final GaugeValueDao gaugeValueDao;
private final GaugeNameDao gaugeNameDao;
private final TransactionTypeDao transactionTypeDao;
| private final EnvironmentDao agentDao;
|
3,319 | private final TransactionTypeDao transactionTypeDao;
private final FullQueryTextDao fullQueryTextDao;
private final TraceAttributeNameDao traceAttributeNameDao;
RepoAdminImpl(DataSource dataSource, List<CappedDatabase> rollupCappedDatabases,
CappedDatabase traceCappedDatabase, ConfigRepository configRepository,
<BUG>AgentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao,
</BUG>
TransactionTypeDao transactionTypeDao, FullQueryTextDao fullQueryTextDao,
TraceAttributeNameDao traceAttributeNameDao) {
this.dataSource = dataSource;
| EnvironmentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao,
|
3,320 | this.fullQueryTextDao = fullQueryTextDao;
this.traceAttributeNameDao = traceAttributeNameDao;
}
@Override
public void deleteAllData() throws Exception {
<BUG>Environment environment = agentDao.readEnvironment("");
dataSource.deleteAll();</BUG>
agentDao.reinitAfterDeletingDatabase();
gaugeValueDao.reinitAfterDeletingDatabase();
gaugeNameDao.invalidateCache();
| Environment environment = agentDao.read("");
dataSource.deleteAll();
|
3,321 | public class SimpleRepoModule {
private static final long SNAPSHOT_REAPER_PERIOD_MINUTES = 5;
private final DataSource dataSource;
private final ImmutableList<CappedDatabase> rollupCappedDatabases;
private final CappedDatabase traceCappedDatabase;
<BUG>private final AgentDao agentDao;
private final TransactionTypeDao transactionTypeDao;</BUG>
private final AggregateDao aggregateDao;
private final TraceAttributeNameDao traceAttributeNameDao;
private final TraceDao traceDao;
| private final EnvironmentDao environmentDao;
private final TransactionTypeDao transactionTypeDao;
|
3,322 | rollupCappedDatabases.add(new CappedDatabase(file, sizeKb, ticker));
}
this.rollupCappedDatabases = ImmutableList.copyOf(rollupCappedDatabases);
traceCappedDatabase = new CappedDatabase(new File(dataDir, "trace-detail.capped.db"),
storageConfig.traceCappedDatabaseSizeMb() * 1024, ticker);
<BUG>agentDao = new AgentDao(dataSource);
</BUG>
transactionTypeDao = new TransactionTypeDao(dataSource);
rollupLevelService = new RollupLevelService(configRepository, clock);
FullQueryTextDao fullQueryTextDao = new FullQueryTextDao(dataSource);
| environmentDao = new EnvironmentDao(dataSource);
|
3,323 | traceDao = new TraceDao(dataSource, traceCappedDatabase, transactionTypeDao,
fullQueryTextDao, traceAttributeNameDao);
GaugeNameDao gaugeNameDao = new GaugeNameDao(dataSource);
gaugeValueDao = new GaugeValueDao(dataSource, gaugeNameDao, clock);
repoAdmin = new RepoAdminImpl(dataSource, rollupCappedDatabases, traceCappedDatabase,
<BUG>configRepository, agentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao,
</BUG>
fullQueryTextDao, traceAttributeNameDao);
if (backgroundExecutor == null) {
reaperRunnable = null;
| configRepository, environmentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao,
|
3,324 | new TraceCappedDatabaseStats(traceCappedDatabase),
"org.glowroot:type=TraceCappedDatabase");
platformMBeanServerLifecycle.lazyRegisterMBean(new H2DatabaseStats(dataSource),
"org.glowroot:type=H2Database");
}
<BUG>public AgentDao getAgentDao() {
return agentDao;
</BUG>
}
public TransactionTypeRepository getTransactionTypeRepository() {
| public EnvironmentDao getEnvironmentDao() {
return environmentDao;
|
3,325 | package org.glowroot.agent.embedded.init;
import java.io.Closeable;
import java.io.File;
<BUG>import java.lang.instrument.Instrumentation;
import java.util.Map;</BUG>
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
| import java.util.List;
import java.util.Map;
|
3,326 | import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nullable;
import com.google.common.base.MoreObjects;
import com.google.common.base.Stopwatch;
import com.google.common.base.Supplier;
<BUG>import com.google.common.base.Ticker;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;</BUG>
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.glowroot.agent.collector.Collector.AgentConfigUpdater;
| import com.google.common.collect.ImmutableList;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
3,327 | import org.glowroot.agent.init.EnvironmentCreator;
import org.glowroot.agent.init.GlowrootThinAgentInit;
import org.glowroot.agent.init.JRebelWorkaround;
import org.glowroot.agent.util.LazyPlatformMBeanServer;
import org.glowroot.common.live.LiveAggregateRepository.LiveAggregateRepositoryNop;
<BUG>import org.glowroot.common.live.LiveTraceRepository.LiveTraceRepositoryNop;
import org.glowroot.common.repo.ConfigRepository;
import org.glowroot.common.util.Clock;</BUG>
import org.glowroot.common.util.OnlyUsedByTests;
import org.glowroot.ui.CreateUiModuleBuilder;
| import org.glowroot.common.repo.AgentRepository;
import org.glowroot.common.repo.ImmutableAgentRollup;
import org.glowroot.common.util.Clock;
|
3,328 | SimpleRepoModule simpleRepoModule = new SimpleRepoModule(dataSource,
dataDir, clock, ticker, configRepository, backgroundExecutor);
simpleRepoModule.registerMBeans(new PlatformMBeanServerLifecycleImpl(
agentModule.getLazyPlatformMBeanServer()));
CollectorImpl collectorImpl = new CollectorImpl(
<BUG>simpleRepoModule.getAgentDao(), simpleRepoModule.getAggregateDao(),
simpleRepoModule.getTraceDao(),</BUG>
simpleRepoModule.getGaugeValueDao());
collectorProxy.setInstance(collectorImpl);
collectorImpl.init(baseDir, EnvironmentCreator.create(glowrootVersion),
| simpleRepoModule.getEnvironmentDao(),
simpleRepoModule.getTraceDao(),
|
3,329 | .baseDir(baseDir)
.glowrootDir(glowrootDir)
.ticker(ticker)
.clock(clock)
.liveJvmService(agentModule.getLiveJvmService())
<BUG>.configRepository(simpleRepoModule.getConfigRepository())
.agentRepository(simpleRepoModule.getAgentDao())
</BUG>
.transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository())
.traceAttributeNameRepository(
| .agentRepository(new AgentRepositoryImpl())
.environmentRepository(simpleRepoModule.getEnvironmentDao())
|
3,330 | .baseDir(baseDir)
.glowrootDir(glowrootDir)
.ticker(ticker)
.clock(clock)
.liveJvmService(null)
<BUG>.configRepository(simpleRepoModule.getConfigRepository())
.agentRepository(simpleRepoModule.getAgentDao())
</BUG>
.transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository())
.traceAttributeNameRepository(
| .liveJvmService(agentModule.getLiveJvmService())
.agentRepository(new AgentRepositoryImpl())
.environmentRepository(simpleRepoModule.getEnvironmentDao())
|
3,331 | }
@Override
public void lazyRegisterMBean(Object object, String name) {
lazyPlatformMBeanServer.lazyRegisterMBean(object, name);
}
<BUG>}
}
</BUG>
| void initEmbeddedServer() throws Exception {
if (simpleRepoModule == null) {
return;
|
3,332 | List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs());
for (GaugeConfig loopConfig : configs) {
if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) {
throw new DuplicateMBeanObjectNameException();
}
<BUG>}
String version = Versions.getVersion(gaugeConfig);
for (GaugeConfig loopConfig : configs) {
if (Versions.getVersion(loopConfig.toProto()).equals(version)) {
throw new IllegalStateException("This exact gauge already exists");
}
}
configs.add(GaugeConfig.create(gaugeConfig));</BUG>
configService.updateGaugeConfigs(configs);
| [DELETED] |
3,333 | configService.updateGaugeConfigs(configs);
}
}
@Override
public void updateGaugeConfig(String agentId, AgentConfig.GaugeConfig gaugeConfig,
<BUG>String priorVersion) throws Exception {
synchronized (writeLock) {</BUG>
List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs());
boolean found = false;
for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
| GaugeConfig config = GaugeConfig.create(gaugeConfig);
synchronized (writeLock) {
|
3,334 | boolean found = false;
for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
GaugeConfig loopConfig = i.next();
String loopVersion = Versions.getVersion(loopConfig.toProto());
if (loopVersion.equals(priorVersion)) {
<BUG>i.set(GaugeConfig.create(gaugeConfig));
found = true;
break;</BUG>
} else if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) {
throw new DuplicateMBeanObjectNameException();
| i.set(config);
|
3,335 | boolean found = false;
for (ListIterator<PluginConfig> i = configs.listIterator(); i.hasNext();) {
PluginConfig loopPluginConfig = i.next();
if (pluginId.equals(loopPluginConfig.id())) {
String loopVersion = Versions.getVersion(loopPluginConfig.toProto());
<BUG>checkVersionsEqual(loopVersion, priorVersion);
PluginDescriptor pluginDescriptor = getPluginDescriptor(pluginId);
i.set(PluginConfig.create(pluginDescriptor, properties));</BUG>
found = true;
break;
| for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
GaugeConfig loopConfig = i.next();
String loopVersion = Versions.getVersion(loopConfig.toProto());
if (loopVersion.equals(version)) {
i.remove();
|
3,336 | boolean found = false;
for (ListIterator<InstrumentationConfig> i = configs.listIterator(); i.hasNext();) {
InstrumentationConfig loopConfig = i.next();
String loopVersion = Versions.getVersion(loopConfig.toProto());
if (loopVersion.equals(priorVersion)) {
<BUG>i.set(InstrumentationConfig.create(instrumentationConfig));
found = true;
break;
}</BUG>
}
| i.set(config);
} else if (loopConfig.equals(config)) {
throw new IllegalStateException("This exact instrumentation already exists");
|
3,337 | package org.glowroot.agent.embedded.init;
import java.io.File;
import java.util.List;
import org.glowroot.agent.collector.Collector;
<BUG>import org.glowroot.agent.embedded.repo.AgentDao;
import org.glowroot.agent.embedded.repo.AggregateDao;
import org.glowroot.agent.embedded.repo.GaugeValueDao;</BUG>
import org.glowroot.agent.embedded.repo.TraceDao;
import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
| import org.glowroot.agent.embedded.repo.EnvironmentDao;
import org.glowroot.agent.embedded.repo.GaugeValueDao;
|
3,338 | </BUG>
private final AggregateDao aggregateDao;
private final TraceDao traceDao;
private final GaugeValueDao gaugeValueDao;
<BUG>CollectorImpl(AgentDao agentDao, AggregateDao aggregateRepository, TraceDao traceRepository,
GaugeValueDao gaugeValueRepository) {
this.agentDao = agentDao;</BUG>
this.aggregateDao = aggregateRepository;
this.traceDao = traceRepository;
| import org.glowroot.wire.api.model.CollectorServiceOuterClass.Environment;
import org.glowroot.wire.api.model.CollectorServiceOuterClass.GaugeValue;
import org.glowroot.wire.api.model.CollectorServiceOuterClass.LogEvent;
import org.glowroot.wire.api.model.TraceOuterClass.Trace;
class CollectorImpl implements Collector {
private final EnvironmentDao agentDao;
CollectorImpl(EnvironmentDao agentDao, AggregateDao aggregateRepository,
TraceDao traceRepository, GaugeValueDao gaugeValueRepository) {
this.agentDao = agentDao;
|
3,339 | public void weCanFilterFilesOutside() {
State s = a1.addFiles("dir_1/file_1", "dir_1/file_2", "dir_2/file_1", "dir_2/file_2");
State filteredState = s.filterDirectory(Paths.get("."), Paths.get("dir_1"), false);
assertThat(toFileNames(filteredState.getFileStates())).isEqualTo(Arrays.asList("dir_2/file_1", "dir_2/file_2", "file_1", "file_2"));
}
<BUG>private void fixTimeStamps(BuildableState s) throws ParseException {
long timestamp = MODIFICATION_TIMESTAMP;</BUG>
s.setTimestamp(timestamp);
for (FileState fileState : s.getFileStates()) {
fileState.getFileTime().reset(timestamp);
| private void fixTimeStamps(BuildableState s) {
long timestamp = MODIFICATION_TIMESTAMP;
|
3,340 | builder.append(ex.getClass().getSimpleName()).append(": ").append(ex.getMessage());
}
error(builder.toString());
}
public static void error(String message) {
<BUG>writeLogMessage(new StringBuilder().append(getCurrentDate()).append(" - Error - ").append(message).toString());
}</BUG>
private static String exceptionStackTraceToString(Exception ex) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
PrintStream ps = new PrintStream(baos);
| writeLogMessage(getCurrentDate() + " - Error - " + message);
|
3,341 | package org.fim.util;
import org.apache.commons.lang3.SystemUtils;
import org.fim.model.Context;
import java.nio.file.Path;
<BUG>import java.util.Arrays;
import java.util.List;</BUG>
public class SELinux {
public static final boolean ENABLED = isEnabled();
private static boolean isEnabled() {
| import java.util.Collections;
import java.util.List;
|
3,342 | private static boolean isEnabled() {
if (SystemUtils.IS_OS_WINDOWS) {
return false;
}
try {
<BUG>List<String> lines = CommandUtil.executeCommandAndGetLines(Arrays.asList("sestatus"));
</BUG>
for (String line : lines) {
if (line.contains("SELinux status")) {
if (line.contains("enabled")) {
| List<String> lines = CommandUtil.executeCommandAndGetLines(Collections.singletonList("sestatus"));
|
3,343 | public void setPurgeStates(boolean purgeStates) {
this.purgeStates = purgeStates;
}
public boolean isPurgeStates() {
return purgeStates;
<BUG>}
public Context clone() {</BUG>
return CLONER.deepClone(this);
}
private boolean checkLogDebugEnabled() {
| @Override
public Context clone() {
|
3,344 | private long globalSequenceCount = 0;
private HashProgress hashProgress;
private BuildableContext context;
private FileHasher cut;
@BeforeClass
<BUG>public static void setupOnce() throws NoSuchAlgorithmException, IOException {
if (!Files.exists(rootDir)) {</BUG>
Files.createDirectories(rootDir);
}
}
| public static void setupOnce() throws IOException {
if (!Files.exists(rootDir)) {
|
3,345 | public class StateComparatorPerformanceTest {
private static Comparator<FileState> fileNameComparator = new FileState.FileNameComparator();
private static final String characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
private static SecureRandom random = new SecureRandom();
@Test
<BUG>public void weCanCompareQuicklyTwoBigStates() throws Exception {
TimeElapsed te = new TimeElapsed();</BUG>
Context context = new Context();
int count = 1_000_000;
State lastState = createState(count);
| public void weCanCompareQuicklyTwoBigStates() {
TimeElapsed te = new TimeElapsed();
|
3,346 | String smallBlockHash = generateBlockHash(fullContent, smallRanges);
String mediumBlockHash = generateBlockHash(fullContent, mediumRanges);
String fullHash = generateFullHash(fullContent);
return new FileHash(smallBlockHash, mediumBlockHash, fullHash);
}
<BUG>private String generateBlockHash(byte[] fullContent, Range[] ranges) throws IOException {
HashFunction hashFunction = Hashing.sha512();</BUG>
com.google.common.hash.Hasher hasher = hashFunction.newHasher(_100_MB);
for (Range range : ranges) {
byte[] content = extractBlock(fullContent, range);
| private String generateBlockHash(byte[] fullContent, Range[] ranges) {
HashFunction hashFunction = Hashing.sha512();
|
3,347 | @Before
public void setup() {
context = new BuildableContext();
}
@Test
<BUG>public void weConfirmAnAction() throws Exception {
assertThat(confirmAction("y")).isEqualTo(true);</BUG>
assertThat(context.isAlwaysYes()).isEqualTo(false);
assertThat(confirmAction("Y")).isEqualTo(true);
assertThat(context.isAlwaysYes()).isEqualTo(false);
| public void weConfirmAnAction() {
assertThat(confirmAction("y")).isEqualTo(true);
|
3,348 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
3,349 | }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_memo);
<BUG>ChinaPhoneHelper.setStatusBar(this,true);
</BUG>
topicId = getIntent().getLongExtra("topicId", -1);
if (topicId == -1) {
finish();
| ChinaPhoneHelper.setStatusBar(this, true);
|
3,350 | MemoEntry.COLUMN_REF_TOPIC__ID + " = ?"
, new String[]{String.valueOf(topicId)});
}
public Cursor selectMemo(long topicId) {
Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null,
<BUG>MemoEntry._ID + " DESC", null);
</BUG>
if (c != null) {
c.moveToFirst();
}
| MemoEntry.COLUMN_ORDER + " ASC", null);
|
3,351 | MemoEntry._ID + " = ?",
new String[]{String.valueOf(memoId)});
}
public long updateMemoContent(long memoId, String memoContent) {
ContentValues values = new ContentValues();
<BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent);
return db.update(</BUG>
MemoEntry.TABLE_NAME,
values,
MemoEntry._ID + " = ?",
| return db.update(
|
3,352 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
3,353 | }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_memo);
<BUG>ChinaPhoneHelper.setStatusBar(this,true);
</BUG>
topicId = getIntent().getLongExtra("topicId", -1);
if (topicId == -1) {
finish();
| ChinaPhoneHelper.setStatusBar(this, true);
|
3,354 | MemoEntry.COLUMN_REF_TOPIC__ID + " = ?"
, new String[]{String.valueOf(topicId)});
}
public Cursor selectMemo(long topicId) {
Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null,
<BUG>MemoEntry._ID + " DESC", null);
</BUG>
if (c != null) {
c.moveToFirst();
}
| MemoEntry.COLUMN_ORDER + " ASC", null);
|
3,355 | MemoEntry._ID + " = ?",
new String[]{String.valueOf(memoId)});
}
public long updateMemoContent(long memoId, String memoContent) {
ContentValues values = new ContentValues();
<BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent);
return db.update(</BUG>
MemoEntry.TABLE_NAME,
values,
MemoEntry._ID + " = ?",
| return db.update(
|
3,356 | import android.widget.RelativeLayout;
import android.widget.TextView;
import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.db.DBManager;
import com.kiminonawa.mydiary.shared.EditMode;
<BUG>import com.kiminonawa.mydiary.shared.ThemeManager;
import java.util.List;
public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode {
</BUG>
private List<MemoEntity> memoList;
| import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter;
public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
|
3,357 | private DBManager dbManager;
private boolean isEditMode = false;
private EditMemoDialogFragment.MemoCallback callback;
private static final int TYPE_HEADER = 0;
private static final int TYPE_ITEM = 1;
<BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) {
this.mActivity = activity;</BUG>
this.topicId = topicId;
this.memoList = memoList;
| public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) {
super(recyclerView);
this.mActivity = activity;
|
3,358 | this.memoList = memoList;
this.dbManager = dbManager;
this.callback = callback;
}
@Override
<BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
</BUG>
View view;
if (isEditMode) {
if (viewType == TYPE_HEADER) {
| public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
3,359 | editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment");
}
});
}
}
<BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private View rootView;
private TextView TV_memo_item_content;</BUG>
private ImageView IV_memo_item_delete;
| protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private ImageView IV_memo_item_dot;
private TextView TV_memo_item_content;
|
3,360 | public int getSpaces() {
return mySpaces;
}
public int getIndentSpaces() {
return myIndentSpaces;
<BUG>}
public String generateNewWhiteSpace(CommonCodeStyleSettings.IndentOptions options) {
</BUG>
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < myLineFeeds; i ++) {
| @NotNull
public String generateNewWhiteSpace(@NotNull CommonCodeStyleSettings.IndentOptions options) {
|
3,361 | public void setCurrentSourceLine(int currentSourceLine) {
this.currentSourceLine = currentSourceLine;
}
public void setLineNumberTable(StructLineNumberTableAttribute lineNumberTable) {
this.lineNumberTable = lineNumberTable;
<BUG>}
public Map<Integer, Integer> getOriginalLinesMapping() {</BUG>
if (lineNumberTable == null) {
return Collections.emptyMap();
}
| private final Set<Integer> unmappedLines = new HashSet<Integer>();
public Set<Integer> getUnmappedLines() {
return unmappedLines;
public Map<Integer, Integer> getOriginalLinesMapping() {
|
3,362 | import java.util.*;
import java.util.Map.Entry;
public class BytecodeSourceMapper {
private int offset_total;
private final Map<String, Map<String, Map<Integer, Integer>>> mapping = new LinkedHashMap<String, Map<String, Map<Integer, Integer>>>();
<BUG>private final Map<Integer, Integer> linesMapping = new HashMap<Integer, Integer>();
public void addMapping(String className, String methodName, int bytecodeOffset, int sourceLine) {</BUG>
Map<String, Map<Integer, Integer>> class_mapping = mapping.get(className);
if (class_mapping == null) {
mapping.put(className, class_mapping = new LinkedHashMap<String, Map<Integer, Integer>>()); // need to preserve order
| private final Set<Integer> unmappedLines = new TreeSet<Integer>();
public void addMapping(String className, String methodName, int bytecodeOffset, int sourceLine) {
|
3,363 | for (BasicBlock block : blocks) {
stats.addWithKey(new BasicBlockStatement(block), block.id);
}
BasicBlock firstblock = graph.getFirst();
Statement firstst = stats.getWithKey(firstblock.id);
<BUG>Statement dummyexit = new Statement();
dummyexit.type = Statement.TYPE_DUMMYEXIT;</BUG>
Statement general;
if (stats.size() > 1 || firstblock.isSuccessor(firstblock)) { // multiple basic blocks or an infinite loop of one block
| DummyExitStatement dummyexit = new DummyExitStatement();
|
3,364 | List<Exprent> lstExpr = source.getExprents();
if (lstExpr != null && !lstExpr.isEmpty()) {
Exprent expr = lstExpr.get(lstExpr.size() - 1);
if (expr.type == Exprent.EXPRENT_EXIT) {
ExitExprent ex = (ExitExprent)expr;
<BUG>if (ex.getExitType() == ExitExprent.EXIT_RETURN && ex.getValue() == null) {
lstExpr.remove(lstExpr.size() - 1);</BUG>
res = true;
}
}
| dummyExit.addBytecodeOffsets(ex.bytecode);
lstExpr.remove(lstExpr.size() - 1);
|
3,365 | package org.jetbrains.java.decompiler.modules.decompiler.stats;
import org.jetbrains.java.decompiler.main.TextBuffer;
import org.jetbrains.java.decompiler.main.collectors.BytecodeMappingTracer;
import org.jetbrains.java.decompiler.modules.decompiler.ExprProcessor;
public class RootStatement extends Statement {
<BUG>private Statement dummyExit;
public RootStatement(Statement head, Statement dummyExit) {
</BUG>
type = Statement.TYPE_ROOT;
| private DummyExitStatement dummyExit;
public RootStatement(Statement head, DummyExitStatement dummyExit) {
|
3,366 | customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString());
customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName);
customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString());
customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName);
customTokens.put("%%mlTraceForestsPerHost%%", hubConfig.traceForestsPerHost.toString());
<BUG>customTokens.put("%%mlModulesDbName%%", hubConfig.modulesDbName);
}</BUG>
public void init() {
try {
LOGGER.error("PLUGINS DIR: " + pluginsDir.toString());
| customTokens.put("%%mlTriggersDbName%%", hubConfig.triggersDbName);
customTokens.put("%%mlSchemasDbName%%", hubConfig.schemasDbName);
}
|
3,367 | }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
<BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh")
.in(() -> task1)</BUG>
.in(() -> task2)
.process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\"")));
}
| return Task.named("exec", "/bin/sh").ofType(Exec.Result.class)
.in(() -> task1)
|
3,368 | return args;
}
static class MyTask {
static final int PLUS = 10;
static Task<String> create(String parameter) {
<BUG>return Task.ofType(String.class).named("MyTask", parameter)
.in(() -> Adder.create(parameter.length(), PLUS))</BUG>
.in(() -> Fib.create(parameter.length()))
.process((sum, fib) -> something(parameter, sum, fib));
}
| return Task.named("MyTask", parameter).ofType(String.class)
.in(() -> Adder.create(parameter.length(), PLUS))
|
3,369 | final String instanceField = "from instance";
final TaskContext context = TaskContext.inmem();
final AwaitingConsumer<String> val = new AwaitingConsumer<>();
@Test
public void shouldJavaUtilSerialize() throws Exception {
<BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39)
.process(() -> 9999L);
Task<String> task2 = Task.ofType(String.class).named("Baz", 40)
.in(() -> task1)</BUG>
.ins(() -> singletonList(task1))
| Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class)
Task<String> task2 = Task.named("Baz", 40).ofType(String.class)
.in(() -> task1)
|
3,370 | assertEquals(des.id().name(), "Baz");
assertEquals(val.awaitAndGet(), "[9999] hello 10004");
}
@Test(expected = NotSerializableException.class)
public void shouldNotSerializeWithInstanceFieldReference() throws Exception {
<BUG>Task<String> task = Task.ofType(String.class).named("WithRef")
.process(() -> instanceField + " causes an outer reference");</BUG>
serialize(task);
}
@Test
| Task<String> task = Task.named("WithRef").ofType(String.class)
.process(() -> instanceField + " causes an outer reference");
|
3,371 | serialize(task);
}
@Test
public void shouldSerializeWithLocalReference() throws Exception {
String local = instanceField;
<BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef")
.process(() -> local + " won't cause an outer reference");</BUG>
serialize(task);
Task<String> des = deserialize();
context.evaluate(des).consume(val);
| Task<String> task = Task.named("WithLocalRef").ofType(String.class)
.process(() -> local + " won't cause an outer reference");
|
3,372 | }
@RootTask
public static Task<String> standardArgs(int first, String second) {
firstInt = first;
secondString = second;
<BUG>return Task.ofType(String.class).named("StandardArgs", first, second)
.process(() -> second + " " + first * 100);</BUG>
}
@Test
public void shouldParseFlags() throws Exception {
| return Task.named("StandardArgs", first, second).ofType(String.class)
.process(() -> second + " " + first * 100);
|
3,373 | assertThat(parsedEnum, is(CustomEnum.BAR));
}
@RootTask
public static Task<String> enums(CustomEnum enm) {
parsedEnum = enm;
<BUG>return Task.ofType(String.class).named("Enums", enm)
.process(enm::toString);</BUG>
}
@Test
public void shouldParseCustomTypes() throws Exception {
| return Task.named("Enums", enm).ofType(String.class)
.process(enm::toString);
|
3,374 | assertThat(parsedType.content, is("blarg parsed for you!"));
}
@RootTask
public static Task<String> customType(CustomType myType) {
parsedType = myType;
<BUG>return Task.ofType(String.class).named("Types", myType.content)
.process(() -> myType.content);</BUG>
}
public enum CustomEnum {
BAR
| return Task.named("Types", myType.content).ofType(String.class)
.process(() -> myType.content);
|
3,375 | TaskContext taskContext = TaskContext.inmem();
TaskContext.Value<Long> value = taskContext.evaluate(fib92);
value.consume(f92 -> System.out.println("fib(92) = " + f92));
}
static Task<Long> create(long n) {
<BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n);
</BUG>
if (n < 2) {
return fib
.process(() -> n);
| TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
|
3,376 | package mage.sets.zendikar;
import java.util.UUID;
<BUG>import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;</BUG>
import mage.abilities.TriggeredAbilityImpl;
| [DELETED] |
3,377 | return new ValakutTheMoltenPinnacle(this);
}
}
class ValakutTheMoltenPinnacleTriggeredAbility extends TriggeredAbilityImpl<ValakutTheMoltenPinnacleTriggeredAbility> {
ValakutTheMoltenPinnacleTriggeredAbility () {
<BUG>super(Zone.BATTLEFIELD, new DamageTargetEffect(3));
this.addTarget(new TargetCreatureOrPlayer());
</BUG>
}
| super(Zone.BATTLEFIELD, new DamageTargetEffect(3), true);
this.addTarget(new TargetCreatureOrPlayer(true));
|
3,378 | Player player = game.getPlayer(source.getControllerId());
if (player == null){
return false;
}
int amount = 0;
<BUG>TargetControlledPermanent sacrificeLand = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterControlledLandPermanent(), true);
</BUG>
if(player.chooseTarget(Outcome.Sacrifice, sacrificeLand, source, game)){
for(Object uuid : sacrificeLand.getTargets()){
Permanent land = game.getPermanent((UUID)uuid);
| TargetControlledPermanent sacrificeLand = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterControlledLandPermanent("lands you control"), true);
|
3,379 | </BUG>
if(player.chooseTarget(Outcome.Sacrifice, sacrificeLand, source, game)){
for(Object uuid : sacrificeLand.getTargets()){
Permanent land = game.getPermanent((UUID)uuid);
if(land != null){
<BUG>land.sacrifice(source.getId(), game);
</BUG>
amount++;
}
}
| Player player = game.getPlayer(source.getControllerId());
if (player == null){
return false;
int amount = 0;
TargetControlledPermanent sacrificeLand = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterControlledLandPermanent("lands you control"), true);
land.sacrifice(source.getSourceId(), game);
|
3,380 | package com.orientechnologies.common.directmemory;
import com.orientechnologies.common.serialization.types.*;
<BUG>public class ODirectMemoryPointer {
private final ODirectMemory directMemory = ODirectMemoryFactory.INSTANCE.directMemory();</BUG>
private final long pageSize;
private final long dataPointer;
public ODirectMemoryPointer(long pageSize) {
| private final boolean SAFE_MODE = Boolean.valueOf(System.getProperty("memory.directMemory.safeMode"));
private final ODirectMemory directMemory = ODirectMemoryFactory.INSTANCE.directMemory();
|
3,381 | acl.setIpProto(rule.getProtocol());
String cidr = null;
Integer port = rule.getSourcePortStart();
fwCidrList = _fwCidrsDao.listByFirewallRuleId(rule.getId());
if(fwCidrList != null){
<BUG>if(fwCidrList.size()>1 || rule.getSourcePortEnd()!=port){
</BUG>
continue;
} else {
cidr = fwCidrList.get(0).getCidr();
| if (fwCidrList.size() > 1 || !rule.getSourcePortEnd().equals(port)) {
|
3,382 | acl.setIpProto(item.getProtocol());
String cidr = null; // currently BCF supports single cidr policy
Integer port = item.getSourcePortStart(); // currently BCF supports single port policy
aclCidrList = _aclItemCidrsDao.listByNetworkACLItemId(item.getId());
if(aclCidrList != null){
<BUG>if(aclCidrList.size()>1 || item.getSourcePortEnd()!=port){
</BUG>
continue;
} else {
cidr = aclCidrList.get(0).getCidr();
| if (aclCidrList.size() > 1 || !item.getSourcePortEnd().equals(port)) {
|
3,383 | return myLineStatusTrackers.get(document);
}
}
private void resetTrackersForOpenFiles() {
myApplication.assertReadAccessAllowed();
<BUG>if (isDisabled()) return;
log("resetTrackersForOpenFiles");
final VirtualFile[] openFiles = myFileEditorManager.getOpenFiles();</BUG>
for (final VirtualFile openFile : openFiles) {
| if (LOG.isDebugEnabled()) {
LOG.debug("resetTrackersForOpenFiles");
final VirtualFile[] openFiles = myFileEditorManager.getOpenFiles();
|
3,384 | if (virtualFile == null || virtualFile instanceof LightVirtualFile) return false;
if (!virtualFile.isInLocalFileSystem()) return false;
final FileStatusManager statusManager = FileStatusManager.getInstance(myProject);
if (statusManager == null) return false;
final AbstractVcs activeVcs = myVcsManager.getVcsFor(virtualFile);
<BUG>if (activeVcs == null) {
log("shouldBeInstalled: for file " + virtualFile.getPath() + " failed: no active VCS");
return false;</BUG>
}
| if (LOG.isDebugEnabled()) {
LOG.debug("shouldBeInstalled: for file " + virtualFile.getPath() + " failed: no active VCS");
|
3,385 | final LineStatusTracker.RevisionPack revisionPack = new LineStatusTracker.RevisionPack(myLoadCounter, baseRevision.first);
myLoadCounter++;
final String converted = StringUtil.convertLineSeparators(baseRevision.second);
final Runnable runnable = new Runnable() {
public void run() {
<BUG>synchronized (myLock) {
log("BaseRevisionLoader: initializing tracker for file " + myVirtualFile.getPath());
final LineStatusTracker tracker = myLineStatusTrackers.get(myDocument);</BUG>
if (tracker != null) {
| if (LOG.isDebugEnabled()) {
LOG.debug("BaseRevisionLoader: initializing tracker for file " + myVirtualFile.getPath());
}
final LineStatusTracker tracker = myLineStatusTrackers.get(myDocument);
|
3,386 | customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString());
customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName);
customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString());
customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName);
customTokens.put("%%mlTraceForestsPerHost%%", hubConfig.traceForestsPerHost.toString());
<BUG>customTokens.put("%%mlModulesDbName%%", hubConfig.modulesDbName);
}</BUG>
public void init() {
try {
LOGGER.error("PLUGINS DIR: " + pluginsDir.toString());
| customTokens.put("%%mlTriggersDbName%%", hubConfig.triggersDbName);
customTokens.put("%%mlSchemasDbName%%", hubConfig.schemasDbName);
}
|
3,387 | return new StaticReference(role, sourceNode, targetNode.getModel().getUID(), targetNode.getSNodeId(), targetNode.getName());
}
return new StaticReference(role, sourceNode, targetNode);
}
public static SReference create(String role, SNode sourceNode, SModelUID targetModelUID, SNodeId targetNodeId) {
<BUG>return create(role, sourceNode, targetModelUID, targetNodeId, null);
}
public static SReference create(String role, SNode sourceNode, SModelUID targetModelUID, SNodeId targetNodeId, String resolveInfo) {
return new StaticReference(role, sourceNode, targetModelUID, targetNodeId, resolveInfo);
</BUG>
}
| return new StaticReference(role, sourceNode, targetModelUID, targetNodeId, null);
|
3,388 | newReference = SReference.create(sourceReference.getRole(), newSourceNode, newTargetNode);
} else {//otherwise it points out of our node's subtree
if (oldTargetNode != null) {
newReference = SReference.create(sourceReference.getRole(), newSourceNode, oldTargetNode);
} else if (sourceReference.getResolveInfo() != null) {
<BUG>newReference = SReference.create(sourceReference.getRole(), newSourceNode, null, null, sourceReference.getResolveInfo());
</BUG>
} else {
continue;
}
| newReference = new StaticReference(sourceReference.getRole(), newSourceNode, null, null, sourceReference.getResolveInfo());
|
3,389 | if (BaseAdapter.isInstance(newSourceNode, BaseMethodCall.class) && oldTargetNode != null) {
newReference = SReference.create(sourceReference.getRole(), newSourceNode, oldTargetNode);
} else {
String resolveInfo = oldTargetNode == null ? sourceReference.getResolveInfo() : oldTargetNode.getName(); // todo: getRefName()
if (resolveInfo != null) {
<BUG>newReference = SReference.create(sourceReference.getRole(), newSourceNode, null, null, resolveInfo);
</BUG>
referencesRequireResolve.add(newReference);
} else if (oldTargetNode != null) {
newReference = SReference.create(sourceReference.getRole(), newSourceNode, oldTargetNode);
| newReference = new StaticReference(sourceReference.getRole(), newSourceNode, null, null, resolveInfo);
|
3,390 | package com.dmcapps.navigationfragmentexample.SingleStackExample;
<BUG>import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;</BUG>
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.dmcapps.navigationfragment.manager.NavigationManagerFragment;
| import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
|
3,391 | public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(STATE_NAV_TAG, mSingleStackNavigationManagerFragmentTag);
}
private void addFragment(SingleStackNavigationManagerFragment fragment) {
<BUG>mSingleStackNavigationManagerFragmentTag = UUID.randomUUID().toString();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
</BUG>
ft.add(android.R.id.content, fragment, mSingleStackNavigationManagerFragmentTag);
ft.commit();
| FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
|
3,392 | package com.dmcapps.navigationfragmentexample.MasterDetailExample;
<BUG>import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;</BUG>
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
| import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
|
3,393 | import android.view.MenuItem;
import com.dmcapps.navigationfragment.manager.MasterDetailNavigationManagerFragment;
import com.dmcapps.navigationfragment.manager.NavigationManagerFragment;
import com.dmcapps.navigationfragmentexample.SingleStackExample.SampleFragment;
import java.util.UUID;
<BUG>public class MasterDetailNavigationExampleActivity extends AppCompatActivity {
private static final String STATE_NAV_TAG = "NAV_TAG";</BUG>
private String mNavigationManagerFragmentTag;
@Override
protected void onCreate(Bundle savedInstanceState) {
| public class MasterDetailNavigationExampleActivity extends AppCompatActivity implements NavigationManagerFragment.NavigationManagerFragmentListener {
private static final String STATE_NAV_TAG = "NAV_TAG";
|
3,394 | SampleFragment detailFrag = SampleFragment.newInstance("Detail Fragment in the Stack", 0);
addFragment(MasterDetailNavigationManagerFragment.newInstance(masterFrag, detailFrag));
}
else {
showFragment(mNavigationManagerFragmentTag);
<BUG>}
ActionBar ab = getSupportActionBar();
ab.setHomeButtonEnabled(true);
ab.setDisplayHomeAsUpEnabled(true);</BUG>
}
| MasterDetailNavigationManagerFragment manager = (MasterDetailNavigationManagerFragment)getSupportFragmentManager().findFragmentByTag(mNavigationManagerFragmentTag);
manageHomeUpEnabled(manager);
|
3,395 | private void showFragment(String tag) {
Fragment fragment = getSupportFragmentManager().findFragmentByTag(tag);
if (fragment != null && fragment.isDetached()) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.attach(fragment);
<BUG>ft.commit();
}</BUG>
}
@Override
public void onBackPressed() {
| getSupportFragmentManager().executePendingTransactions();
|
3,396 | public ReportElement getBase() {
return base;
}
@Override
public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException {
<BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo);
PDPageContentStream pageStream = new PDPageContentStream(document, currPage, true, false);
</BUG>
base.print(document, pageStream, pageNo, x, y, width);
pageStream.close();
| PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo);
PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
|
3,397 | public PdfTextStyle(String config) {
Assert.hasText(config);
String[] split = config.split(",");
Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000");
fontSize = Integer.parseInt(split[0]);
<BUG>font = resolveStandard14Name(split[1]);
color = new Color(Integer.valueOf(split[2].substring(1), 16));</BUG>
}
public int getFontSize() {
return fontSize;
| font = getFont(split[1]);
color = new Color(Integer.valueOf(split[2].substring(1), 16));
|
3,398 | package cc.catalysts.boot.report.pdf.elements;
import cc.catalysts.boot.report.pdf.config.PdfTextStyle;
import cc.catalysts.boot.report.pdf.utils.ReportAlignType;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
<BUG>import org.apache.pdfbox.pdmodel.font.PDFont;
import org.slf4j.Logger;</BUG>
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.io.IOException;
| import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.apache.pdfbox.util.Matrix;
import org.slf4j.Logger;
|
3,399 | addTextSimple(stream, textConfig, textX, nextLineY, "");
return nextLineY;
}
try {
<BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText);
</BUG>
float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]);
if (!underline) {
addTextSimple(stream, textConfig, x, nextLineY, split[0]);
} else {
| String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
|
3,400 | public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
try {
stream.setFont(textConfig.getFont(), textConfig.getFontSize());
stream.setNonStrokingColor(textConfig.getColor());
stream.beginText();
<BUG>stream.newLineAtOffset(textX, textY);
stream.showText(text);</BUG>
} catch (Exception e) {
LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage());
}
| stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY));
stream.showText(text);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.