id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
6,001 | protected final TracingPrefsConfig tracingPrefs;
private final ScheduledExecutorService scheduledExecutor;
public AbstractKeyValueService(ExecutorService executor) {
this.executor = executor;
this.tracingPrefs = new TracingPrefsConfig();
<BUG>this.scheduledExecutor = PTExecutors.newSingleThreadScheduledExecutor(
new NamedThreadFactory(getClass().getSimpleName() + "-tracing-prefs", true));
</BUG>
this.scheduledExecutor.scheduleWithFixedDelay(this.tracingPrefs, 0, 1, TimeUnit.MINUTES); // reload every minute
| this.scheduledExecutor = Tracers.wrap(PTExecutors.newSingleThreadScheduledExecutor(
new NamedThreadFactory(getClass().getSimpleName() + "-tracing-prefs", true)));
|
6,002 | import com.palantir.atlasdb.transaction.api.Transaction;
import com.palantir.atlasdb.transaction.api.TransactionManager;
import com.palantir.atlasdb.transaction.api.TransactionTask;
import com.palantir.common.base.BatchingVisitableView;
import com.palantir.common.base.Throwables;
<BUG>import com.palantir.common.concurrent.PTExecutors;
public class KeyValueServiceValidator {</BUG>
private final TransactionManager validationFromTransactionManager;
private final TransactionManager validationToTransactionManager;
private final KeyValueService validationFromKvs;
| import com.palantir.remoting1.tracing.Tracers;
public class KeyValueServiceValidator {
|
6,003 | Throwables.throwUncheckedException(t);
}
}
}
private void validateTables(Set<TableReference> tables) {
<BUG>ExecutorService executor = PTExecutors.newFixedThreadPool(threads);
</BUG>
List<Future<Void>> futures = Lists.newArrayList();
for (final TableReference table : tables) {
Future<Void> future = executor.submit(new Callable<Void>() {
| ExecutorService executor = Tracers.wrap(PTExecutors.newFixedThreadPool(threads));
|
6,004 | import java.util.concurrent.atomic.AtomicLong;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Supplier;
import com.palantir.common.concurrent.NamedThreadFactory;
<BUG>import com.palantir.common.concurrent.PTExecutors;
public final class AsyncPuncher implements Puncher {</BUG>
private static final Logger log = LoggerFactory.getLogger(AsyncPuncher.class);
private static final long INVALID_TIMESTAMP = -1L;
public static AsyncPuncher create(Puncher delegate, long interval) {
| import com.palantir.remoting1.tracing.Tracers;
public final class AsyncPuncher implements Puncher {
|
6,005 | public static AsyncPuncher create(Puncher delegate, long interval) {
AsyncPuncher asyncPuncher = new AsyncPuncher(delegate, interval);
asyncPuncher.start();
return asyncPuncher;
}
<BUG>private final ScheduledExecutorService service = PTExecutors.newSingleThreadScheduledExecutor(
new NamedThreadFactory("puncher", true /* daemon */));
</BUG>
private final Puncher delegate;
| private final ScheduledExecutorService service = Tracers.wrap(PTExecutors.newSingleThreadScheduledExecutor(
new NamedThreadFactory("puncher", true /* daemon */)));
|
6,006 | import com.palantir.atlasdb.keyvalue.api.TableReference;
import com.palantir.atlasdb.table.description.RowNamePartitioner;
import com.palantir.atlasdb.table.description.TableMetadata;
import com.palantir.atlasdb.transaction.api.TransactionManager;
import com.palantir.common.base.Throwables;
<BUG>import com.palantir.common.concurrent.PTExecutors;
public class KeyValueServiceMigrator {</BUG>
private final TableReference checkpointTable;
private static final String CHECKPOINT_TABLE_NAME = "tmp_migrate_progress";
private static final int PARTITIONS = 256;
| import com.palantir.remoting1.tracing.Tracers;
public class KeyValueServiceMigrator {
|
6,007 | Set<TableReference> tables = KeyValueServiceMigrators.getMigratableTableNames(fromKvs, unmigratableTables);
TransactionManager txManager = toTransactionManager;
TransactionManager readTxManager = fromTransactionManager;
GeneralTaskCheckpointer checkpointer =
new GeneralTaskCheckpointer(checkpointTable, toKvs, txManager);
<BUG>ExecutorService executor = PTExecutors.newFixedThreadPool(threads);
</BUG>
try {
migrateTables(
tables,
| ExecutorService executor = Tracers.wrap(PTExecutors.newFixedThreadPool(threads));
|
6,008 | import com.palantir.common.base.BatchingVisitableView;
import com.palantir.common.base.Throwables;
import com.palantir.common.collect.Maps2;
import com.palantir.common.concurrent.ExecutorInheritableThreadLocal;
import com.palantir.common.concurrent.NamedThreadFactory;
<BUG>import com.palantir.common.concurrent.PTExecutors;
public final class Scrubber {</BUG>
private static final Logger log = LoggerFactory.getLogger(Scrubber.class);
private static final int MAX_RETRY_ATTEMPTS = 100;
private static final int RETRY_SLEEP_INTERVAL_IN_MILLIS = 1000;
| import com.palantir.remoting1.tracing.Tracers;
public final class Scrubber {
|
6,009 | this.batchSizeSupplier = batchSizeSupplier;
this.threadCount = threadCount;
this.readThreadCount = readThreadCount;
this.followers = followers;
NamedThreadFactory threadFactory = new NamedThreadFactory(SCRUBBER_THREAD_PREFIX, true);
<BUG>this.readerExec = PTExecutors.newFixedThreadPool(readThreadCount, threadFactory);
this.exec = PTExecutors.newFixedThreadPool(threadCount, threadFactory);
</BUG>
}
| this.readerExec = Tracers.wrap(PTExecutors.newFixedThreadPool(readThreadCount, threadFactory));
this.exec = Tracers.wrap(PTExecutors.newFixedThreadPool(threadCount, threadFactory));
|
6,010 | package com.easytoolsoft.easyreport.web.controller.common;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value = "/error")
<BUG>public class ErrorController extends AbstractController {
@RequestMapping(value = {"/404"})</BUG>
public String error404() {
return "/error/404";
}
| public class ErrorController {
@RequestMapping(value = {"/404"})
|
6,011 | public Product get(String string) {
return productMapper.selectByPrimaryKey(string);
}
@Override
public CustomResult delete(String string) {
<BUG>productMapper.deleteByPrimaryKey(string);
return CustomResult.ok();
}</BUG>
@Override
| int i = productMapper.deleteByPrimaryKey(string);
if(i>=0){
}else{
return null;
|
6,012 | package org.hqu.production_ms.controller;
import java.util.List;
<BUG>import org.hqu.production_ms.domain.Custom;
</BUG>
import org.hqu.production_ms.domain.Product;
import org.hqu.production_ms.domain.CustomResult;
import org.hqu.production_ms.service.ProductService;
| import org.hqu.production_ms.domain.EUDataGridResult;
|
6,013 | @Component
public class AdapterTest
{</BUG>
@ServiceDependency
Sequencer m_sequencer;
<BUG>private Map<String, String> m_serviceProperties;
@ServiceDependency
void bind(Map<String, String> serviceProperties, ServiceInterface3 service)
</BUG>
{
| public static class S3Consumer
private volatile S3 m_s3;
void bind(Map<String, String> serviceProperties, S3 s3)
|
6,014 | package org.camunda.bpm.extension.example.reactor;
<BUG>import org.camunda.bpm.engine.delegate.DelegateTask;
import org.camunda.bpm.engine.delegate.TaskListener;</BUG>
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.task.Task;
import org.camunda.bpm.engine.test.Deployment;
| [DELETED] |
6,015 | import org.camunda.bpm.extension.reactor.bus.CamundaSelector;
import org.camunda.bpm.extension.reactor.listener.SubscriberTaskListener;</BUG>
import reactor.bus.EventBus;
@CamundaSelector(type = "userTask", event = TaskListener.EVENTNAME_CREATE)
<BUG>public class TaskCreateListener extends SubscriberTaskListener {
public TaskCreateListener(EventBus eventBus) {
register(eventBus);
}</BUG>
@Override
| public class TaskCreateListener implements TaskListener {
public TaskCreateListener(CamundaEventBus eventBus) {
eventBus.register(this);
}
|
6,016 | package org.camunda.bpm.extension.example.reactor;
import org.camunda.bpm.engine.ProcessEngineConfiguration;
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration;
<BUG>import org.camunda.bpm.extension.reactor.CamundaReactor;
import org.camunda.bpm.extension.reactor.plugin.ReactorProcessEnginePlugin;</BUG>
import org.joda.time.DateTime;
import reactor.bus.EventBus;
import java.util.Date;
| import org.camunda.bpm.extension.reactor.bus.CamundaEventBus;
import org.camunda.bpm.extension.reactor.plugin.ReactorProcessEnginePlugin;
|
6,017 | </BUG>
this.jobExecutorActivate = false;
}
};
<BUG>private final EventBus eventBus = CamundaReactor.eventBus();
</BUG>
public void init() {
new TaskCreateListener(eventBus);
new TaskAssignListener();
}
| public static final String GROUP_2 = "group2";
public static final String GROUP_3 = "group3";
public static ProcessEngineConfiguration CONFIGURATION = new StandaloneInMemProcessEngineConfiguration() {
this.databaseSchemaUpdate = DB_SCHEMA_UPDATE_TRUE;
this.getProcessEnginePlugins().add(CamundaReactor.plugin());
private final CamundaEventBus eventBus = CamundaReactor.eventBus();
|
6,018 | package edu.wpi.first.wpilib.plugins.core.actions;
<BUG>import java.io.File;
import org.eclipse.core.runtime.CoreException;</BUG>
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
| import java.io.FilenameFilter;
import org.eclipse.core.runtime.CoreException;
|
6,019 | import edu.wpi.first.wpilib.plugins.core.WPILibCore;
public class RunRobotBuilderAction implements IWorkbenchWindowActionDelegate {
public RunRobotBuilderAction() {
}
public void run(IAction action) {
<BUG>File dir = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"tools"+File.separator
+WPILibCore.getDefault().getCurrentVersion());</BUG>
File[] files = dir.listFiles(new FilenameFilter() {
@Override public boolean accept(File dir, String name) {
| File dir = new File(WPILibCore.getDefault().getWPILibBaseDir()+File.separator+"tools");
|
6,020 | File[] files = dir.listFiles(new FilenameFilter() {
@Override public boolean accept(File dir, String name) {
return name.startsWith("RobotBuilder") && name.endsWith(".jar");
}
});
<BUG>if (files.length < 1) return;
</BUG>
String[] cmd = {"java", "-jar", files[0].getAbsolutePath()};
try {
DebugPlugin.exec(cmd, new File(System.getProperty("user.home")));
| if (files == null || files.length < 1) return;
|
6,021 | package edu.wpi.first.wpilib.plugins.core.actions;
<BUG>import java.io.File;
import org.eclipse.core.runtime.CoreException;</BUG>
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
| import java.io.FilenameFilter;
import org.eclipse.core.runtime.CoreException;
|
6,022 | package edu.wpi.first.wpilib.plugins.core.actions;
<BUG>import java.io.File;
import org.eclipse.core.runtime.CoreException;</BUG>
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
| import java.io.FilenameFilter;
import org.eclipse.core.runtime.CoreException;
|
6,023 | package com.jetbrains.python.psi.types;
<BUG>import com.intellij.psi.PsiElement;
import com.jetbrains.python.psi.PyReferenceExpression;
import org.jetbrains.annotations.Nullable;
public interface PyType {</BUG>
@Nullable
| import com.intellij.openapi.util.Key;
import com.intellij.util.ProcessingContext;
import java.util.Set;
public interface PyType {
|
6,024 | import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.Comparator;
<BUG>import java.util.List;
public class PyUtil {</BUG>
private PyUtil() {
}
public static void ensureWritable(PsiElement element) {
| import java.util.regex.Pattern;
public class PyUtil {
|
6,025 | import com.intellij.psi.*;
import com.intellij.psi.impl.PsiManagerImpl;
import com.intellij.psi.impl.source.resolve.ResolveCache;
import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.util.PsiTreeUtil;
<BUG>import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.SortedList;</BUG>
import com.jetbrains.python.PyElementTypes;
import com.jetbrains.python.PyIcons;
import com.jetbrains.python.PyNames;
| import com.intellij.util.ProcessingContext;
import com.intellij.util.containers.SortedList;
|
6,026 | package com.jetbrains.python.psi.types;
import com.intellij.psi.PsiElement;
<BUG>import com.intellij.util.ArrayUtil;
import com.jetbrains.python.psi.PyReferenceExpression;</BUG>
public class PyNoneType implements PyType { // TODO must extend ClassType. It's an honest instance.
public static final PyNoneType INSTANCE = new PyNoneType();
private PyNoneType() {
| import com.intellij.util.ProcessingContext;
import com.jetbrains.python.psi.PyReferenceExpression;
|
6,027 | private PyNoneType() {
}
public PsiElement resolveMember(final String name) {
return null;
}
<BUG>public Object[] getCompletionVariants(final PyReferenceExpression referenceExpression) {
</BUG>
return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
public String getName() {
| public Object[] getCompletionVariants(final PyReferenceExpression referenceExpression, ProcessingContext context) {
|
6,028 | package com.jetbrains.python.psi.types;
import com.intellij.codeInsight.lookup.LookupElementFactory;
import com.intellij.codeInsight.lookup.LookupItem;
import com.intellij.psi.*;
<BUG>import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.psi.PyFile;
import com.jetbrains.python.psi.PyReferenceExpression;
import com.jetbrains.python.psi.PyImportElement;
</BUG>
import com.jetbrains.python.psi.resolve.ResolveImportUtil;
| import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.util.ProcessingContext;
import com.jetbrains.python.psi.PyUtil;
|
6,029 | import com.jetbrains.python.psi.PyImportElement;
</BUG>
import com.jetbrains.python.psi.resolve.ResolveImportUtil;
import com.jetbrains.python.psi.resolve.VariantsProcessor;
import org.jetbrains.annotations.NotNull;
<BUG>import java.util.*;
public class PyModuleType implements PyType { // Maybe make it a PyClassType referring to builtins.___module or suchlike.</BUG>
private final PsiFile myModule;
protected static Set<String> ourPossibleFields;
static {
| import com.jetbrains.python.psi.PyReferenceExpression;
import com.jetbrains.python.psi.PyUtil;
import java.util.regex.Pattern;
public class PyModuleType implements PyType { // Maybe make it a PyClassType referring to builtins.___module or suchlike.
|
6,030 | if (dir.findFile(PyNames.INIT_DOT_PY) instanceof PyFile) result.add(dir);
}
}
}
return result;
<BUG>}
public Object[] getCompletionVariants(final PyReferenceExpression referenceExpression) {
List<Object> result = new ArrayList<Object>();</BUG>
if (PsiTreeUtil.getParentOfType(referenceExpression, PyImportElement.class) == null) { // we're not in an import
| private static Pattern IDENTIFIER_PATTERN = Pattern.compile("\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*");
public Object[] getCompletionVariants(final PyReferenceExpression referenceExpression, ProcessingContext context) {
Set<String> names_already = context.get(PyType.CTX_NAMES);
List<Object> result = new ArrayList<Object>();
|
6,031 | }
@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)
|
6,032 | 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))
|
6,033 | }
@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);
|
6,034 | 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);
|
6,035 | 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);
|
6,036 | 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);
|
6,037 | import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
<BUG>import java.util.Map.Entry;
import java.util.WeakHashMap;</BUG>
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
| import java.util.UUID;
import java.util.WeakHashMap;
|
6,038 | return false;
}
if (args.length != 1) {
Jobs.getCommandManager().sendUsage(sender, "toggle");
return true;
<BUG>}
String PlayerName = sender.getName();
</BUG>
if (PlayerName == null || !args[0].equalsIgnoreCase("bossbar") && !args[0].equalsIgnoreCase("actionbar")) {
Jobs.getCommandManager().sendUsage(sender, "toggle");
| [DELETED] |
6,039 | if (args[0].equalsIgnoreCase("bossbar"))
if (Jobs.getBossBarToggleList().containsKey(PlayerName))
if (Jobs.getBossBarToggleList().get(PlayerName)) {
Jobs.getBossBarToggleList().put(PlayerName, false);
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.toggle.output.off"));
<BUG>JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(PlayerName);
</BUG>
if (jPlayer != null)
jPlayer.hideBossBars();
} else {
| JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player.getUniqueId());
|
6,040 | continue;
if (one.getValue().getID() == id)
return one;</BUG>
}
<BUG>return null;
}</BUG>
public void playerJoin(Player player) {
JobsPlayer jPlayer = this.playersCache.get(player.getName().toLowerCase());
if (jPlayer == null || Jobs.getGCManager().MultiServerCompatability()) {
jPlayer = Jobs.getJobsDAO().loadFromDao(player);
| Job job = Jobs.getJob(jobdata.getJobName());
if (job == null)
JobProgression jobProgression = new JobProgression(job, jPlayer, jobdata.getLevel(), jobdata.getExperience());
jPlayer.progression.add(jobProgression);
jPlayer.reloadMaxExperience();
jPlayer.reloadLimits();
Jobs.getJobsDAO().loadPoints(jPlayer);
|
6,041 | private Long seen;
public PlayerInfo(String name, int id, Long seen) {
</BUG>
this.name = name;
<BUG>this.id = id;
this.seen = seen;</BUG>
}
public String getName() {
return name;
}
| private UUID uuid;
public PlayerInfo(String name, int id, UUID uuid, Long seen) {
this.uuid = uuid;
this.seen = seen;
|
6,042 | import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocalFileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.util.Progressable;
<BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*;
public class S3AFileSystem extends FileSystem {</BUG>
private URI uri;
private Path workingDir;
private AmazonS3Client s3;
| import static org.apache.hadoop.fs.s3a.Constants.*;
public class S3AFileSystem extends FileSystem {
|
6,043 | public void initialize(URI name, Configuration conf) throws IOException {
super.initialize(name, conf);
uri = URI.create(name.getScheme() + "://" + name.getAuthority());
workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri,
this.getWorkingDirectory());
<BUG>String accessKey = conf.get(ACCESS_KEY, null);
String secretKey = conf.get(SECRET_KEY, null);
</BUG>
String userInfo = name.getUserInfo();
| String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null));
String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
|
6,044 | } else {
accessKey = userInfo;
}
}
AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain(
<BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey),
new InstanceProfileCredentialsProvider(),
new S3AAnonymousAWSCredentialsProvider()
);</BUG>
bucket = name.getHost();
| new BasicAWSCredentialsProvider(accessKey, secretKey),
new AnonymousAWSCredentialsProvider()
|
6,045 |
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT));
</BUG>
s3 = new AmazonS3Client(credentials, awsConf);
<BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS);
partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
</BUG>
if (partSize < 5 * 1024 * 1024) {
| new InstanceProfileCredentialsProvider(),
new AnonymousAWSCredentialsProvider()
bucket = name.getHost();
ClientConfiguration awsConf = new ClientConfiguration();
awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS)));
awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP);
awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES)));
awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)));
maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS));
partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE));
partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
|
6,046 | cannedACL = null;
}
if (!s3.doesBucketExist(bucket)) {
throw new IOException("Bucket " + bucket + " does not exist");
}
<BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART);
long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE);
</BUG>
if (purgeExistingMultipart) {
| boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART));
long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
|
6,047 | import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
<BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*;
public class S3AOutputStream extends OutputStream {</BUG>
private OutputStream backupStream;
private File backupFile;
private boolean closed;
| import static org.apache.hadoop.fs.s3a.Constants.*;
public class S3AOutputStream extends OutputStream {
|
6,048 | this.client = client;
this.progress = progress;
this.fs = fs;
this.cannedACL = cannedACL;
this.statistics = statistics;
<BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
</BUG>
if (conf.get(BUFFER_DIR, null) != null) {
| partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
|
6,049 | 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);
|
6,050 | 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));
|
6,051 | 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;
|
6,052 | 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);
|
6,053 | 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);
|
6,054 | public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
addTextSimple(stream, textConfig, textX, textY, text);
try {
float lineOffset = textConfig.getFontSize() / 8F;
stream.setStrokingColor(textConfig.getColor());
<BUG>stream.setLineWidth(0.5F);
stream.drawLine(textX, textY - lineOffset, textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
</BUG>
stream.stroke();
} catch (IOException e) {
| stream.moveTo(textX, textY - lineOffset);
stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
|
6,055 | list.add(text.length());
return list;
}
public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) {
String endPart = "";
<BUG>String shortenedText = text;
List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
if (breakSplitted.size() > 1) {</BUG>
String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0));
StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
| List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
if (breakSplitted.size() > 1) {
|
6,056 | package cc.catalysts.boot.report.pdf.elements;
import org.apache.pdfbox.pdmodel.PDDocument;
<BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import java.io.IOException;</BUG>
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
| import org.apache.pdfbox.pdmodel.PDPageContentStream;
import java.io.IOException;
|
6,057 | import org.opentravel.schemacompiler.validate.ValidationFindings;
import org.opentravel.schemacompiler.validate.compile.TLModelCompileValidator;
import org.opentravel.schemas.node.Node;
import org.opentravel.schemas.node.interfaces.ResourceMemberInterface;
import org.opentravel.schemas.node.listeners.INodeListener;
<BUG>import org.opentravel.schemas.node.listeners.ListenerFactory;
import org.slf4j.Logger;</BUG>
import org.slf4j.LoggerFactory;
public abstract class ResourceBase<TL> extends Node implements ResourceMemberInterface {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceBase.class);
| import org.opentravel.schemas.node.listeners.ResourceDependencyListener;
import org.slf4j.Logger;
|
6,058 | super(tlActionFacet);
parent = this.getNode(((LibraryMember) tlObj.getOwningResource()).getListeners());
assert parent instanceof ResourceNode;
getParent().addChild(this);
this.setLibrary(parent.getLibrary());
<BUG>if (tlObj.getReferenceType() != null) {
LOGGER.debug("TODO: add dependency to " + tlObj.getReferenceFacetName());
}</BUG>
}
| if (tlObj.getReferenceType() == null)
setReferenceType(getDefaultReferenceType());
|
6,059 | public List<ResourceField> getFields() {
List<ResourceField> fields = new ArrayList<ResourceField>();
new ResourceField(fields, getBasePayloadName(), MSGKEY + ".fields.basePayload", ResourceFieldType.ObjectSelect,
new BasePayloadListener(), this);
new ResourceField(fields, getReferenceType(), MSGKEY + ".fields.referenceType",
<BUG>ResourceField.ResourceFieldType.Enum, new ReferenceTypeListener(), getReferenceTypeStrings());
new ResourceField(fields, getReferenceFacetName(), MSGKEY + ".fields.referenceFacetName",
ResourceFieldType.Enum, new ReferenceNameListener(), getOwningComponent().getSubjectFacets(true));
new ResourceField(fields, Integer.toString(tlObj.getReferenceRepeat()), MSGKEY + ".fields.referenceRepeat",
ResourceFieldType.Int, new ReferenceRepeatListener());
</BUG>
return fields;
| ResourceField.ResourceFieldType.Enum, !getOwningComponent().isAbstract(), new ReferenceTypeListener(),
ResourceFieldType.Enum, !getOwningComponent().isAbstract(), new ReferenceNameListener(),
ResourceFieldType.Int, !getOwningComponent().isAbstract(), new ReferenceRepeatListener());
|
6,060 | if (n.getName().equals(actionObject) && n.getTLModelObject() instanceof NamedEntity)
basePayload = (NamedEntity) n.getTLModelObject();
tlObj.setBasePayload(basePayload);
return true;
}
<BUG>public boolean setBasePayload(Node actionObject) {
if (actionObject.getTLModelObject() instanceof NamedEntity) {
</BUG>
tlObj.setBasePayload((NamedEntity) actionObject.getTLModelObject());
return true;
| [DELETED] |
6,061 | parent.getRequest().delete();
((TLAction) parent.getTLModelObject()).setRequest(tlObj);
}
@Override
public void addListeners() {
<BUG>if (tlObj.getParamGroup() != null) {
tlObj.getParamGroup().addListener(new ResourceDependencyListener(this));
((ParamGroup) getNode(tlObj.getParamGroup().getListeners())).addPathListeners(this);
}</BUG>
if (tlObj.getPayloadType() != null)
| if (tlObj != null && tlObj.getParamGroup() != null)
((ParamGroup) getNode(tlObj.getParamGroup().getListeners())).addListeners(this);
|
6,062 | path += getParamGroup().getPathTemplate();
setPathTemplate(getInheritedPath() + path);
LOGGER.debug("Created and set path template: " + tlObj.getPathTemplate());
}
public String getInheritedPath() {
<BUG>String template = "";
return template;</BUG>
}
@Override
public void delete() {
| template += getOwningComponent().getPathContribution(getParamGroup());
return template;
|
6,063 | setParameterGroup(node);
createPathTemplate();
LOGGER.debug("Set parameter group to " + groupName + " : " + tlObj.getParamGroupName());
return true;
}
<BUG>protected boolean setParameterGroup(ParamGroup group) {
if (group != null) {
tlObj.setParamGroup(group.tlObj);
if (group.tlObj != null)
group.tlObj.addListener(new ResourceDependencyListener(this));</BUG>
} else
| if (tlObj != null && tlObj.getParamGroup() != null)
((ParamGroup) getNode(tlObj.getParamGroup().getListeners())).removeListeners(this);
group.addListeners(this);
|
6,064 | package org.opentravel.schemas.node.listeners;
import org.opentravel.schemacompiler.event.OwnershipEvent;
import org.opentravel.schemacompiler.event.ValueChangeEvent;
<BUG>import org.opentravel.schemacompiler.model.TLActionRequest;
import org.opentravel.schemas.node.Node;</BUG>
import org.opentravel.schemas.node.resources.ActionRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
| import org.opentravel.schemacompiler.model.TLParameter;
import org.opentravel.schemas.node.Node;
|
6,065 | protected Node getSelectedNode(ExecutionEvent exEvent) {
return mc.getGloballySelectNode();
}
public void execute(Event event) {
if (event.data instanceof CommandType) {
<BUG>getSelected();
</BUG>
runCommand((CommandType) event.data);
}
return;
| setSelected();
|
6,066 | @Override
public Object execute(ExecutionEvent exEvent) throws ExecutionException {
String filePathParam = exEvent.getParameter("org.opentravel.schemas.stl2Developer.newAction");
LOGGER.debug(filePathParam);
view = OtmRegistry.getResourceView();
<BUG>if (!getSelected())
return null; // Nothing to act on
runCommand(getCmdType(exEvent.getCommand().getId()));
view.activate();</BUG>
return null;
| setSelected();
if (selectedNode == null)
if (view != null)
view.activate();
|
6,067 | cmdType = CommandType.PARENTREF;
else if (cmdId.endsWith(CommandType.DELETE.toString()))
cmdType = CommandType.DELETE;
return cmdType;
}
<BUG>private boolean getSelected() {
selectedNode = (Node) view.getCurrentNode();
if (selectedNode == null)
selectedNode = mc.getCurrentNode_NavigatorView();
return selectedNode != null;</BUG>
}
| private void setSelected() {
if (view != null)
|
6,068 | case RESOURCE:
if (selectedNode != null && selectedNode.getLibrary() != null) {
ResourceNode newR = new ResourceNode(selectedNode); // create named empty resource
BusinessObjectNode bo = getBusinessObject(newR);
if (bo == null) {
<BUG>newR.delete();
} else {</BUG>
new ResourceBuilder().build(newR, bo);
view.refresh(newR);
mc.refresh(); // update the navigator view
| newR.setAbstract(true);
} else {
|
6,069 | package com.projecttango.examples.java.augmentedreality;
import com.google.atap.tangoservice.Tango;
import com.google.atap.tangoservice.Tango.OnTangoUpdateListener;
import com.google.atap.tangoservice.TangoCameraIntrinsics;
import com.google.atap.tangoservice.TangoConfig;
<BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoEvent;</BUG>
import com.google.atap.tangoservice.TangoOutOfDateException;
import com.google.atap.tangoservice.TangoPoseData;
import com.google.atap.tangoservice.TangoXyzIjData;
| import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
|
6,070 | super.onResume();
if (!mIsConnected) {
mTango = new Tango(AugmentedRealityActivity.this, new Runnable() {
@Override
public void run() {
<BUG>try {
connectTango();</BUG>
setupRenderer();
mIsConnected = true;
} catch (TangoOutOfDateException e) {
| TangoSupport.initialize();
connectTango();
|
6,071 | if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) {
mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics);
mCameraPoseTimestamp = lastFramePose.timestamp;</BUG>
} else {
<BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread);
}</BUG>
}
}
}
@Override
| mRenderer.updateRenderCameraPose(lastFramePose);
mCameraPoseTimestamp = lastFramePose.timestamp;
Log.w(TAG, "Can't get device pose at time: " +
|
6,072 | import org.rajawali3d.materials.Material;
import org.rajawali3d.materials.methods.DiffuseMethod;
import org.rajawali3d.materials.textures.ATexture;
import org.rajawali3d.materials.textures.StreamingTexture;
import org.rajawali3d.materials.textures.Texture;
<BUG>import org.rajawali3d.math.Matrix4;
import org.rajawali3d.math.vector.Vector3;</BUG>
import org.rajawali3d.primitives.ScreenQuad;
import org.rajawali3d.primitives.Sphere;
import org.rajawali3d.renderer.RajawaliRenderer;
| import org.rajawali3d.math.Quaternion;
import org.rajawali3d.math.vector.Vector3;
|
6,073 | translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE);
translationMoon.setTransformable3D(moon);
getCurrentScene().registerAnimation(translationMoon);
translationMoon.play();
}
<BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) {
Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics);
getCurrentCamera().setRotation(cameraPose.getOrientation());
getCurrentCamera().setPosition(cameraPose.getPosition());
}</BUG>
public int getTextureId() {
| public void updateRenderCameraPose(TangoPoseData cameraPose) {
float[] rotation = cameraPose.getRotationAsFloats();
float[] translation = cameraPose.getTranslationAsFloats();
Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]);
getCurrentCamera().setRotation(quaternion.conjugate());
getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
|
6,074 | package com.projecttango.examples.java.helloareadescription;
import com.google.atap.tangoservice.Tango;
<BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener;
import com.google.atap.tangoservice.TangoConfig;</BUG>
import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
| import com.google.atap.tangoservice.TangoAreaDescriptionMetaData;
import com.google.atap.tangoservice.TangoConfig;
|
6,075 | List<JavaCommand> commands = new ArrayList<JavaCommand>();
File homeDir = props.nonNullValueAsFile("sonar.path.home");
File tempDir = props.nonNullValueAsFile("sonar.path.temp");
JavaCommand elasticsearch = new JavaCommand("search");
elasticsearch
<BUG>.setWorkDir(homeDir)
.addJavaOptions(props.nonNullValue(DefaultSettings.SEARCH_JAVA_OPTS))</BUG>
.addJavaOptions(props.nonNullValue(DefaultSettings.SEARCH_JAVA_ADDITIONAL_OPTS))
.setTempDir(tempDir.getAbsoluteFile())
.setClassName("org.sonar.search.SearchServer")
| .addJavaOptions("-Djava.awt.headless=true")
.addJavaOptions(props.nonNullValue(DefaultSettings.SEARCH_JAVA_OPTS))
|
6,076 | .addClasspath("./lib/common/*")
.addClasspath("./lib/search/*");
commands.add(elasticsearch);
if (StringUtils.isEmpty(props.value(DefaultSettings.CLUSTER_MASTER))) {
JavaCommand webServer = new JavaCommand("web")
<BUG>.setWorkDir(homeDir)
.addJavaOptions(props.nonNullValue(DefaultSettings.WEB_JAVA_OPTS))</BUG>
.addJavaOptions(props.nonNullValue(DefaultSettings.WEB_JAVA_ADDITIONAL_OPTS))
.setTempDir(tempDir.getAbsoluteFile())
.setEnvVariable("sonar.path.logs", props.nonNullValue("sonar.path.logs"))
| .addJavaOptions("-Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false")
.addJavaOptions(props.nonNullValue(DefaultSettings.WEB_JAVA_OPTS))
|
6,077 | if (null != content && solrHasContent(content.getId())) {
QueryResults hits = nodeLookup.lookup(QueryResults.class);
BlackboardArtifact artifact = nodeLookup.lookup(BlackboardArtifact.class);
if (hits != null) {
highlightedHitText = new HighlightedText(content.getId(), hits);
<BUG>} else {
if (artifact != null && artifact.getArtifactTypeID()
</BUG>
== BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) {
highlightedHitText = getAccountsText(content, nodeLookup);
| } else if (artifact != null && artifact.getArtifactTypeID()
|
6,078 | return true;
}</BUG>
Collection<? extends BlackboardArtifact> artifacts = node.getLookup().lookupAll(BlackboardArtifact.class);
if (artifacts != null) {
for (BlackboardArtifact art : artifacts) {
<BUG>if (art.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) {
return true;</BUG>
}
}
}
| [DELETED] |
6,079 | import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentVisitor;
import org.sleuthkit.datamodel.DerivedFile;
import org.sleuthkit.datamodel.File;
class KeywordSearchFilterNode extends FilterNode {
<BUG>KeywordSearchFilterNode(HighlightedText highlights, Node original) {
</BUG>
super(original, null, new ProxyLookup(Lookups.singleton(highlights), original.getLookup()));
}
@Override
| KeywordSearchFilterNode(QueryResults highlights, Node original) {
|
6,080 | private final HashMap<Integer, Integer> currentHitPerPage = new HashMap<>();
private final List<Integer> pages = new ArrayList<>();
private QueryResults hits = null; //original hits that may get passed in
private boolean isPageInfoLoaded = false;
private static final boolean DEBUG = (Version.getBuildType() == Version.Type.DEVELOPMENT);
<BUG>private BlackboardArtifact artifact;
HighlightedText(long objectId, QueryResults hits) {</BUG>
this.objectId = objectId;
this.hits = hits;
}
| private KeywordSearch.QueryType qt;
HighlightedText(long objectId, QueryResults hits) {
|
6,081 | text = StringEscapeUtils.escapeHtml(text);
StringBuilder highlightedText = new StringBuilder("");
for (String unquotedKeyword : keywords) {
int textOffset = 0;
int hitOffset;
<BUG>while ((hitOffset = text.indexOf(unquotedKeyword, textOffset)) != -1) {
</BUG>
highlightedText.append(text.substring(textOffset, hitOffset));
highlightedText.append(HIGHLIGHT_PRE);
highlightedText.append(unquotedKeyword);
| while ((hitOffset = StringUtils.indexOfIgnoreCase(text, unquotedKeyword, textOffset)) != -1) {
|
6,082 | import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.File;
public class CreatePatchConfigurationPanel {
private JPanel myPanel;
<BUG>private TextFieldWithBrowseButton myFileNameField;
public CreatePatchConfigurationPanel() {</BUG>
myFileNameField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
| private JCheckBox myReversePatchCheckbox;
public CreatePatchConfigurationPanel() {
|
6,083 | import com.intellij.openapi.diff.impl.util.TextDiffType;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.BinaryContentRevision;
import com.intellij.openapi.vcs.changes.Change;
<BUG>import com.intellij.openapi.vcs.changes.ContentRevision;
import java.io.File;
import java.util.ArrayList;</BUG>
import java.util.Collection;
import java.util.Date;
| import org.jetbrains.annotations.NonNls;
import java.text.MessageFormat;
import java.util.ArrayList;
|
6,084 | return FileUtil.getRelativePath(new File(basePath), ioFile).replace(File.separatorChar, '/');
}
private static String getRevisionName(final ContentRevision revision, final File ioFile) {
String revisionName = revision.getRevisionNumber().asString();
if (revisionName.length() > 0) {
<BUG>return "(revision " + revisionName + ")";
}</BUG>
return new Date(ioFile.lastModified()).toString();
}
private static FilePatch buildPatchHeading(final String basePath, final ContentRevision beforeRevision, final ContentRevision afterRevision) {
| return MessageFormat.format(REVISION_NAME_TEMPLATE, revisionName);
|
6,085 | catch(IOException ex) {
patchPath = getPatchPath("shelved_change");
writer = new OutputStreamWriter(new FileOutputStream(patchPath));
}
try {
<BUG>List<FilePatch> patches = PatchBuilder.buildPatch(textChanges, myProject.getBaseDir().getPresentableUrl(), true);
</BUG>
UnifiedDiffWriter.write(patches, writer);
}
finally {
| List<FilePatch> patches = PatchBuilder.buildPatch(textChanges, myProject.getBaseDir().getPresentableUrl(), true, false);
|
6,086 | import java.util.List;
public class CreatePatchCommitExecutor implements CommitExecutor, ProjectComponent, JDOMExternalizable {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.patch.CreatePatchCommitExecutor");
private Project myProject;
private ChangeListManager myChangeListManager;
<BUG>public String PATCH_PATH = "";
public static CreatePatchCommitExecutor getInstance(Project project) {</BUG>
return project.getComponent(CreatePatchCommitExecutor.class);
}
public CreatePatchCommitExecutor(final Project project, final ChangeListManager changeListManager) {
| public boolean REVERSE_PATCH = false;
public static CreatePatchCommitExecutor getInstance(Project project) {
|
6,087 | public boolean canExecute(Collection<Change> changes, String commitMessage) {
if (!myFileNameInitialized) {
if (PATCH_PATH == "") {
PATCH_PATH = myProject.getBaseDir().getPresentableUrl();
}
<BUG>myPanel.setFileName(ShelveChangesManager.suggestPatchName(commitMessage, new File(PATCH_PATH)));
myFileNameInitialized = true;</BUG>
}
return true;
}
| myPanel.setReversePatch(REVERSE_PATCH);
myFileNameInitialized = true;
|
6,088 | import org.roaringbitmap.buffer.MutableRoaringBitmap;
import java.io.*;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
<BUG>import java.util.HashSet;
import java.util.List;</BUG>
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
| import java.util.Iterator;
import java.util.List;
|
6,089 | throw new UnsupportedOperationException("Remove not supported");
}
};
return bitmapsIterator;
}
<BUG>private static MutableRoaringBitmap selectRangeWithoutCopy(ImmutableRoaringBitmap rb,
final int rangeStart, final int rangeEnd) {</BUG>
final int hbStart = BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeStart));
final int lbStart = BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeStart));
final int hbLast = BufferUtil.toIntUnsigned(BufferUtil.highbits(rangeEnd - 1));
| final int rangeStart, final int rangeEnd) {
|
6,090 | final int lbLast = BufferUtil.toIntUnsigned(BufferUtil.lowbits(rangeEnd - 1));
MutableRoaringBitmap answer = new MutableRoaringBitmap();
if (hbStart == hbLast) {
final int i = rb.highLowContainer.getIndex((short) hbStart);
if (i >= 0) {
<BUG>final MappeableContainer c = rb.highLowContainer.getContainerAtIndex(i).remove(0, lbStart)
.remove(lbLast + 1, BufferUtil.maxLowBitAsInteger() + 1);
if (c.getCardinality() > 0) {
((MutableRoaringArray) answer.highLowContainer).append((short) hbStart, c);
</BUG>
}
| MappeableContainer newContainer = rb.highLowContainer.getContainerAtIndex(i);
if (lbStart != 0) {
newContainer = newContainer.remove(0, lbStart);
|
6,091 | final MappeableContainer c = rb.highLowContainer.getContainerAtIndex(i);
answer.getMappeableRoaringArray().insertNewKeyValueAt(-j - 1, hb, c);
}
}
if (ilast >= 0) {
<BUG>final MappeableContainer c = rb.highLowContainer.getContainerAtIndex(ilast).remove(lbLast + 1,
BufferUtil.maxLowBitAsInteger() + 1);
if (c.getCardinality() > 0) {</BUG>
((MutableRoaringArray) answer.highLowContainer).append((short) hbLast, c);
| MappeableContainer c = rb.highLowContainer.getContainerAtIndex(ilast);
if (lbLast != BufferUtil.maxLowBitAsInteger()) {
c = c.remove(lbLast + 1, BufferUtil.maxLowBitAsInteger() + 1);
if (c.getCardinality() > 0) {
|
6,092 | if(temp) {
File working = Globals.getInstance().preferences.workingFolder;
File[] images = working.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
<BUG>return FileUtils.getFileExtension(pathname).equals("png");
}</BUG>
});
for(File image : images) {
| String ext = FileUtils.getFileExtension(pathname);
if(ext == null || ext.equals("")) return false;
return ext.equals("png");
}
|
6,093 | import java.nio.file.Files;
import java.util.ArrayList;
public class FileSelector extends JPanel {
private JLabel label;
private JLabel status;
<BUG>private JButton selectButton;
private File file;</BUG>
private int maxKilobytes;
private String allowedType;
private ChangeListener changeListener;
| private JButton cancelButton;
private File file;
|
6,094 | public void setFile(File fileIn) {
if(fileIn == null || !fileIn.exists()) {
clearSelection();
return;
<BUG>}
file = fileIn;</BUG>
int i = file.getName().lastIndexOf('.');
String ext = "file";
if(i >= 0) {
ext = file.getName().substring(i+1);
| cancelButton.setEnabled(true);
file = fileIn;
|
6,095 | public void addAll(ArrayList<T> array) {
for(T element : array) {
fullList.add(element);
}
if(isFiltered()) updateFilter();
<BUG>else if(!blockUpdates) fireIntervalAdded(this, 0, fullList.size() - 1);
</BUG>
}
public void setElement(T element, int index) {
fullList.set(index, element);
| else if(!blockUpdates) fireIntervalAdded(this, 0, (fullList.size() - 1 < 0) ? 0 : fullList.size() - 1);
|
6,096 | package git4idea.checkin;
import com.intellij.CommonBundle;
<BUG>import com.intellij.dvcs.DvcsCommitAdditionalComponent;
</BUG>
import com.intellij.dvcs.DvcsUtil;
import com.intellij.dvcs.push.ui.VcsPushDialog;
import com.intellij.openapi.application.ModalityState;
| import com.intellij.dvcs.AmendComponent;
|
6,097 | import com.intellij.openapi.vcs.checkin.CheckinChangeListSpecificComponent;
import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
import com.intellij.openapi.vcs.ui.RefreshableOnComponent;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.EditorTextField;
<BUG>import com.intellij.ui.GuiUtils;
import com.intellij.util.Function;</BUG>
import com.intellij.util.FunctionUtil;
import com.intellij.util.NullableFunction;
import com.intellij.util.PairConsumer;
| import com.intellij.ui.components.JBLabel;
import com.intellij.util.Function;
|
6,098 | import com.intellij.util.NullableFunction;
import com.intellij.util.PairConsumer;
import com.intellij.util.textCompletion.DefaultTextCompletionValueDescriptor;
import com.intellij.util.textCompletion.TextCompletionProvider;
import com.intellij.util.textCompletion.TextFieldWithCompletion;
<BUG>import com.intellij.util.textCompletion.ValuesCompletionProvider.ValuesCompletionProviderDumbAware;
import com.intellij.util.ui.JBUI;</BUG>
import com.intellij.vcs.log.VcsFullCommitDetails;
import com.intellij.vcs.log.VcsUser;
import com.intellij.vcs.log.VcsUserRegistry;
| import com.intellij.util.ui.GridBag;
import com.intellij.util.ui.JBUI;
|
6,099 | import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;
import static com.intellij.dvcs.DvcsUtil.getShortRepositoryName;
import static com.intellij.openapi.vcs.changes.ChangesUtil.getAfterPath;
<BUG>import static com.intellij.openapi.vcs.changes.ChangesUtil.getBeforePath;
import static com.intellij.util.containers.ContainerUtil.*;</BUG>
import static git4idea.GitUtil.getLogString;
public class GitCheckinEnvironment implements CheckinEnvironment {
private static final Logger LOG = Logger.getInstance(GitCheckinEnvironment.class);
| import static com.intellij.util.ObjectUtils.assertNotNull;
import static com.intellij.util.containers.ContainerUtil.*;
|
6,100 | private EditorTextField createTextField(@NotNull Project project, @NotNull List<String> list) {
TextCompletionProvider completionProvider =
new ValuesCompletionProviderDumbAware<>(new DefaultTextCompletionValueDescriptor.StringValueDescriptor(), list);
return new TextFieldWithCompletion(project, completionProvider, "", true, true, true);
}
<BUG>@Override
@NotNull
protected Set<VirtualFile> getVcsRoots(@NotNull Collection<FilePath> filePaths) {
return GitUtil.gitRoots(filePaths);
}</BUG>
@Nullable
| private class MyAmendComponent extends AmendComponent {
public MyAmendComponent(Project project, CheckinProjectPanel panel) {
super(project, panel);
protected Set<VirtualFile> getVcsRoots(@NotNull Collection<FilePath> files) {
return GitUtil.gitRoots(files);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.