id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
10,401 | import java.util.ResourceBundle;
import java.util.function.Function;</BUG>
class DescriptionStrategyFactory {
private DescriptionStrategyFactory() {}
public static DescriptionStrategy daysOfWeekInstance(final ResourceBundle bundle, final FieldExpression expression) {
<BUG>final Function<Integer, String> nominal = integer -> new DateTime().withDayOfWeek(integer).dayOfWeek().getAsText(bundle.getLocale());
</BUG>
NominalDescriptionStrategy dow = new NominalDescriptionStrategy(bundle, nominal, expression);
dow.addDescription(fieldExpression -> {
if (fieldExpression instanceof On) {
| import java.util.function.Function;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.model.field.expression.On;
final Function<Integer, String> nominal = integer -> DayOfWeek.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale());
|
10,402 | return dom;
}
public static DescriptionStrategy monthsInstance(final ResourceBundle bundle, final FieldExpression expression) {
return new NominalDescriptionStrategy(
bundle,
<BUG>integer -> new DateTime().withMonthOfYear(integer).monthOfYear().getAsText(bundle.getLocale()),
expression</BUG>
);
}
public static DescriptionStrategy plainInstance(ResourceBundle bundle, final FieldExpression expression) {
| integer -> Month.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale()),
expression
|
10,403 | <BUG>package com.cronutils.model.time.generator;
import com.cronutils.mapper.WeekDay;</BUG>
import com.cronutils.model.field.CronField;
import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.constraint.FieldConstraintsBuilder;
| import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.Validate;
import com.cronutils.mapper.WeekDay;
|
10,404 | import com.cronutils.model.field.expression.Between;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.parser.CronParserField;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
<BUG>import org.apache.commons.lang3.Validate;
import org.joda.time.DateTime;
import java.util.Collections;
import java.util.List;
import java.util.Set;</BUG>
class BetweenDayOfWeekValueGenerator extends FieldValueGenerator {
| [DELETED] |
10,405 | <BUG>package com.cronutils.model.time.generator;
import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.model.field.expression.On;
| import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.List;
import org.apache.commons.lang3.Validate;
import com.cronutils.model.field.CronField;
|
10,406 | import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.CronFieldName;
import com.cronutils.model.field.expression.FieldExpression;
import com.cronutils.model.field.expression.On;
import com.google.common.collect.Lists;
<BUG>import org.apache.commons.lang3.Validate;
import org.joda.time.DateTime;
import java.util.List;</BUG>
class OnDayOfMonthValueGenerator extends FieldValueGenerator {
private int year;
| package com.cronutils.model.time.generator;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.List;
import com.cronutils.model.field.CronField;
|
10,407 | class OnDayOfMonthValueGenerator extends FieldValueGenerator {
private int year;
private int month;
public OnDayOfMonthValueGenerator(CronField cronField, int year, int month) {
super(cronField);
<BUG>Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of month");
this.year = year;</BUG>
this.month = month;
}
| Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of" +
" month");
this.year = year;
|
10,408 | package com.cronutils.mapper;
public class ConstantsMapper {
private ConstantsMapper() {}
public static final WeekDay QUARTZ_WEEK_DAY = new WeekDay(2, false);
<BUG>public static final WeekDay JODATIME_WEEK_DAY = new WeekDay(1, false);
</BUG>
public static final WeekDay CRONTAB_WEEK_DAY = new WeekDay(1, true);
public static int weekDayMapping(WeekDay source, WeekDay target, int weekday){
return source.mapTo(weekday, target);
| public static final WeekDay JAVA8 = new WeekDay(1, false);
|
10,409 | return nextMatch;
} catch (NoSuchValueException e) {
throw new IllegalArgumentException(e);
}
}
<BUG>DateTime nextClosestMatch(DateTime date) throws NoSuchValueException {
</BUG>
List<Integer> year = yearsValueGenerator.generateCandidates(date.getYear(), date.getYear());
TimeNode days = null;
int lowestMonth = months.getValues().get(0);
| ZonedDateTime nextClosestMatch(ZonedDateTime date) throws NoSuchValueException {
|
10,410 | boolean questionMarkSupported =
cronDefinition.getFieldDefinition(DAY_OF_WEEK).getConstraints().getSpecialChars().contains(QUESTION_MARK);
if(questionMarkSupported){
return new TimeNode(
generateDayCandidatesQuestionMarkSupported(
<BUG>date.getYear(), date.getMonthOfYear(),
</BUG>
((DayOfWeekFieldDefinition)
cronDefinition.getFieldDefinition(DAY_OF_WEEK)
).getMondayDoWValue()
| date.getYear(), date.getMonthValue(),
|
10,411 | )
);
}else{
return new TimeNode(
generateDayCandidatesQuestionMarkNotSupported(
<BUG>date.getYear(), date.getMonthOfYear(),
</BUG>
((DayOfWeekFieldDefinition)
cronDefinition.getFieldDefinition(DAY_OF_WEEK)
).getMondayDoWValue()
| date.getYear(), date.getMonthValue(),
|
10,412 | }
public DateTime lastExecution(DateTime date){
</BUG>
Validate.notNull(date);
try {
<BUG>DateTime previousMatch = previousClosestMatch(date);
</BUG>
if(previousMatch.equals(date)){
previousMatch = previousClosestMatch(date.minusSeconds(1));
}
| public java.time.Duration timeToNextExecution(ZonedDateTime date){
return java.time.Duration.between(date, nextExecution(date));
public ZonedDateTime lastExecution(ZonedDateTime date){
ZonedDateTime previousMatch = previousClosestMatch(date);
|
10,413 | return previousMatch;
} catch (NoSuchValueException e) {
throw new IllegalArgumentException(e);
}
}
<BUG>public Duration timeFromLastExecution(DateTime date){
return new Interval(lastExecution(date), date).toDuration();
}
public boolean isMatch(DateTime date){
</BUG>
return nextExecution(lastExecution(date)).equals(date);
| [DELETED] |
10,414 | <BUG>package com.cronutils.model.time.generator;
import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.expression.Every;
import com.cronutils.model.field.expression.FieldExpression;
import com.google.common.annotations.VisibleForTesting;
| import java.time.ZonedDateTime;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cronutils.model.field.CronField;
|
10,415 | import com.cronutils.model.field.CronField;</BUG>
import com.cronutils.model.field.expression.Every;
import com.cronutils.model.field.expression.FieldExpression;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
<BUG>import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;</BUG>
class EveryFieldValueGenerator extends FieldValueGenerator {
| package com.cronutils.model.time.generator;
import java.time.ZonedDateTime;
import java.util.List;
import com.cronutils.model.field.CronField;
|
10,416 | private static final Logger log = LoggerFactory.getLogger(EveryFieldValueGenerator.class);
public EveryFieldValueGenerator(CronField cronField) {
super(cronField);
log.trace(String.format(
"processing \"%s\" at %s",
<BUG>cronField.getExpression().asString(), DateTime.now()
</BUG>
));
}
@Override
| cronField.getExpression().asString(), ZonedDateTime.now()
|
10,417 | import org.jboss.as.server.deployment.DeploymentUnit;
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
import org.jboss.as.server.deployment.DeploymentUnitProcessor;
import org.jboss.as.server.deployment.Attachments.BundleState;
import org.jboss.osgi.deployment.deployer.Deployment;
<BUG>import org.jboss.osgi.resolver.XBundle;
import org.osgi.framework.BundleException;</BUG>
public class BundleActivateProcessor implements DeploymentUnitProcessor {
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
| import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
|
10,418 | DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
Deployment deployment = depUnit.getAttachment(OSGiConstants.DEPLOYMENT_KEY);
XBundle bundle = depUnit.getAttachment(OSGiConstants.INSTALLED_BUNDLE_KEY);
if (bundle != null && deployment.isAutoStart() && bundle.isResolved()) {
try {
<BUG>bundle.start();
depUnit.putAttachment(Attachments.BUNDLE_STATE_KEY, BundleState.ACTIVE);</BUG>
} catch (BundleException ex) {
LOGGER.errorCannotStartBundle(ex, bundle);
}
| bundle.start(Bundle.START_TRANSIENT | Bundle.START_ACTIVATION_POLICY);
depUnit.putAttachment(Attachments.BUNDLE_STATE_KEY, BundleState.ACTIVE);
|
10,419 | public void undeploy(final DeploymentUnit depUnit) {
Deployment deployment = depUnit.getAttachment(OSGiConstants.DEPLOYMENT_KEY);
XBundle bundle = depUnit.getAttachment(OSGiConstants.INSTALLED_BUNDLE_KEY);
if (bundle != null && deployment.isAutoStart()) {
try {
<BUG>bundle.stop();
depUnit.putAttachment(Attachments.BUNDLE_STATE_KEY, BundleState.RESOLVED);</BUG>
} catch (BundleException ex) {
LOGGER.debugf(ex, "Cannot stop bundle: %s", bundle);
}
| bundle.stop(Bundle.STOP_TRANSIENT);
depUnit.putAttachment(Attachments.BUNDLE_STATE_KEY, BundleState.RESOLVED);
|
10,420 | package org.jboss.as.osgi.deployment;
import static org.jboss.as.osgi.OSGiLogger.LOGGER;
import java.util.Collections;
<BUG>import java.util.Map;
import org.jboss.as.osgi.OSGiConstants;
import org.jboss.as.server.deployment.Attachments;</BUG>
import org.jboss.as.server.deployment.Attachments.BundleState;
import org.jboss.as.server.deployment.DeploymentPhaseContext;
| import org.jboss.as.osgi.service.PersistentBundlesIntegration.InitialDeploymentTracker;
import org.jboss.as.server.deployment.Attachments;
|
10,421 | import org.jboss.osgi.framework.Services;
import org.jboss.osgi.framework.StorageState;
import org.jboss.osgi.framework.StorageStatePlugin;
import org.osgi.framework.BundleException;
public class BundleInstallProcessor implements DeploymentUnitProcessor {
<BUG>private AttachmentKey<ServiceName> BUNDLE_INSTALL_SERVICE = AttachmentKey.create(ServiceName.class);
</BUG>
private final InitialDeploymentTracker deploymentTracker;
public BundleInstallProcessor(InitialDeploymentTracker deploymentTracker) {
this.deploymentTracker = deploymentTracker;
| private final AttachmentKey<ServiceName> BUNDLE_INSTALL_SERVICE = AttachmentKey.create(ServiceName.class);
|
10,422 | final Deployment deployment = depUnit.getAttachment(OSGiConstants.DEPLOYMENT_KEY);
if (deployment != null) {
ServiceName serviceName;
try {
final BundleManager bundleManager = depUnit.getAttachment(OSGiConstants.BUNDLE_MANAGER_KEY);
<BUG>if (!deploymentTracker.isClosed() && deploymentTracker.hasDeploymentName(depUnit.getName())) {
</BUG>
restoreStorageState(phaseContext, deployment);
serviceName = bundleManager.installBundle(deployment, deploymentTracker.getBundleInstallListener());
deploymentTracker.registerBundleInstallService(serviceName);
| if (!deploymentTracker.isComplete() && deploymentTracker.hasDeploymentName(depUnit.getName())) {
|
10,423 | import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
import org.jboss.as.server.deployment.DeploymentUnitProcessor;
import org.jboss.msc.service.ServiceController.Mode;
import org.jboss.osgi.framework.IntegrationServices;
import org.jboss.osgi.framework.Services;
<BUG>public class SubsystemActivateProcessor implements DeploymentUnitProcessor {
@Override</BUG>
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
phaseContext.addDeploymentDependency(Services.SYSTEM_CONTEXT, OSGiConstants.SYSTEM_CONTEXT_KEY);
phaseContext.addDeploymentDependency(Services.ENVIRONMENT, OSGiConstants.ENVIRONMENT_KEY);
| public SubsystemActivateProcessor() {
}
@Override
|
10,424 | phaseContext.addDeploymentDependency(Services.SYSTEM_CONTEXT, OSGiConstants.SYSTEM_CONTEXT_KEY);
phaseContext.addDeploymentDependency(Services.ENVIRONMENT, OSGiConstants.ENVIRONMENT_KEY);
DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
if (depUnit.hasAttachment(OSGiConstants.DEPLOYMENT_KEY)) {
phaseContext.getServiceRegistry().getRequiredService(Services.FRAMEWORK_ACTIVE).setMode(Mode.ACTIVE);
<BUG>phaseContext.addDependency(IntegrationServices.AUTOINSTALL_COMPLETE, AttachmentKey.create(Object.class));
</BUG>
phaseContext.addDeploymentDependency(Services.BUNDLE_MANAGER, OSGiConstants.BUNDLE_MANAGER_KEY);
phaseContext.addDeploymentDependency(Services.RESOLVER, OSGiConstants.RESOLVER_KEY);
}
| phaseContext.addDependency(IntegrationServices.BOOTSTRAP_BUNDLES_COMPLETE, AttachmentKey.create(Object.class));
|
10,425 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
10,426 | }
@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);
|
10,427 | 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);
|
10,428 | 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(
|
10,429 | 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 {
|
10,430 | 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;
|
10,431 | 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) {
|
10,432 | 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;
|
10,433 | import static com.intellij.tasks.trello.model.TrelloLabel.LabelColor;
public class TrelloUtil {
public static final Pattern TRELLO_ID_PATTERN = Pattern.compile("[a-z0-9]{24}");
public static final Gson GSON = buildGson();
public static final String TRELLO_API_BASE_URL = "https://api.trello.com/1";
<BUG>public static final Type LIST_OF_CARDS_TYPE = new TypeToken<List<TrelloCard>>() { /* empty */ }.getType();
public static final Type LIST_OF_BOARDS_TYPE = new TypeToken<List<TrelloBoard>>() { /* empty */ }.getType();
public static final Type LIST_OF_LISTS_TYPE = new TypeToken<List<TrelloList>>() { /* empty */ }.getType();
public static final Type LIST_OF_COMMENTS_TYPE = new TypeToken<List<TrelloCommentAction>>() { /* empty */ }.getType();
</BUG>
private static Gson buildGson() {
| public static final TypeToken<List<TrelloCard>> LIST_OF_CARDS_TYPE = new TypeToken<List<TrelloCard>>() { /* empty */ };
public static final TypeToken<List<TrelloBoard>> LIST_OF_BOARDS_TYPE = new TypeToken<List<TrelloBoard>>() { /* empty */ };
public static final TypeToken<List<TrelloList>> LIST_OF_LISTS_TYPE = new TypeToken<List<TrelloList>>() { /* empty */ };
public static final TypeToken<List<TrelloCommentAction>> LIST_OF_COMMENTS_TYPE = new TypeToken<List<TrelloCommentAction>>() { /* empty */ };
|
10,434 | package com.intellij.tasks.trello;
<BUG>import com.google.gson.JsonParseException;
import com.intellij.openapi.diagnostic.Logger;</BUG>
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.text.StringUtil;
| import com.google.gson.reflect.TypeToken;
import com.intellij.openapi.diagnostic.Logger;
|
10,435 | import com.intellij.openapi.util.text.StringUtil;
import com.intellij.tasks.Task;
import com.intellij.tasks.TaskBundle;
import com.intellij.tasks.TaskRepositoryType;
import com.intellij.tasks.impl.BaseRepository;
<BUG>import com.intellij.tasks.impl.BaseRepositoryImpl;
import com.intellij.tasks.impl.httpclient.ResponseUtil;
import com.intellij.tasks.trello.model.TrelloBoard;</BUG>
import com.intellij.tasks.trello.model.TrelloCard;
| import com.intellij.tasks.impl.httpclient.NewBaseRepositoryImpl;
import com.intellij.tasks.impl.httpclient.ResponseUtil.GsonMultipleObjectsDeserializer;
import com.intellij.tasks.impl.httpclient.ResponseUtil.GsonSingleObjectDeserializer;
import com.intellij.tasks.trello.model.TrelloBoard;
|
10,436 | 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 {
|
10,437 | 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));
|
10,438 | } 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()
|
10,439 |
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));
|
10,440 | 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));
|
10,441 | 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 {
|
10,442 | 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);
|
10,443 | import de.vanita5.twittnuker.receiver.NotificationReceiver;
import de.vanita5.twittnuker.service.LengthyOperationsService;
import de.vanita5.twittnuker.util.ActivityTracker;
import de.vanita5.twittnuker.util.AsyncTwitterWrapper;
import de.vanita5.twittnuker.util.DataStoreFunctionsKt;
<BUG>import de.vanita5.twittnuker.util.DataStoreUtils;
import de.vanita5.twittnuker.util.ImagePreloader;</BUG>
import de.vanita5.twittnuker.util.InternalTwitterContentUtils;
import de.vanita5.twittnuker.util.JsonSerializer;
import de.vanita5.twittnuker.util.NotificationManagerWrapper;
| import de.vanita5.twittnuker.util.DebugLog;
import de.vanita5.twittnuker.util.ImagePreloader;
|
10,444 | final List<InetAddress> addresses = mDns.lookup(host);
for (InetAddress address : addresses) {
c.addRow(new String[]{host, address.getHostAddress()});
}
} catch (final IOException ignore) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, ignore);
}</BUG>
}
| DebugLog.w(LOGTAG, null, ignore);
|
10,445 | @Override
public void afterExecute(Bus handler, SingleResponse<Relationship> result) {
if (result.hasData()) {
handler.post(new FriendshipUpdatedEvent(accountKey, userKey, result.getData()));
} else if (result.hasException()) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, "Unable to update friendship", result.getException());
}</BUG>
}
| public UserKey[] getAccountKeys() {
return DataStoreUtils.getActivatedAccountKeys(context);
|
10,446 | MicroBlog microBlog = MicroBlogAPIFactory.getInstance(context, accountId);
if (!Utils.isOfficialCredentials(context, accountId)) continue;
try {
microBlog.setActivitiesAboutMeUnread(cursor);
} catch (MicroBlogException e) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, e);
}</BUG>
}
| DebugLog.w(LOGTAG, null, e);
|
10,447 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
twitter.updateProfileBannerImage(fileBody);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
10,448 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
twitter.updateProfileBackgroundImage(fileBody, tile);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| twitter.updateProfileBannerImage(fileBody);
if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
10,449 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
return twitter.updateProfileImage(fileBody);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| twitter.updateProfileBannerImage(fileBody);
if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
10,450 | import de.vanita5.twittnuker.annotation.CustomTabType;
import de.vanita5.twittnuker.library.MicroBlog;
import de.vanita5.twittnuker.library.MicroBlogException;
import de.vanita5.twittnuker.library.twitter.model.RateLimitStatus;
import de.vanita5.twittnuker.library.twitter.model.Status;
<BUG>import de.vanita5.twittnuker.fragment.AbsStatusesFragment;
import org.mariotaku.sqliteqb.library.AllColumns;</BUG>
import org.mariotaku.sqliteqb.library.Columns;
import org.mariotaku.sqliteqb.library.Columns.Column;
import org.mariotaku.sqliteqb.library.Expression;
| import org.mariotaku.pickncrop.library.PNCUtils;
import org.mariotaku.sqliteqb.library.AllColumns;
|
10,451 | context.getApplicationContext().sendBroadcast(intent);
}
}
@Nullable
public static Location getCachedLocation(Context context) {
<BUG>if (BuildConfig.DEBUG) {
Log.v(LOGTAG, "Fetching cached location", new Exception());
}</BUG>
Location location = null;
| DebugLog.v(LOGTAG, "Fetching cached location", new Exception());
|
10,452 | import java.util.List;
import java.util.Map.Entry;
import javax.inject.Singleton;
import okhttp3.Dns;
@Singleton
<BUG>public class TwidereDns implements Constants, Dns {
</BUG>
private static final String RESOLVER_LOGTAG = "TwittnukerDns";
private final SharedPreferences mHostMapping;
private final SharedPreferencesWrapper mPreferences;
| public class TwidereDns implements Dns, Constants {
|
10,453 | for (Location location : twitter.getAvailableTrends()) {
map.put(location);
}
return map.pack();
} catch (final MicroBlogException e) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, e);
}</BUG>
}
| DebugLog.w(LOGTAG, null, e);
|
10,454 | result_ = variableAssignmentExpression(builder_, level_ + 1);
}
else if (root_ == VARIABLE_EXPRESSION) {
result_ = variableExpression(builder_, level_ + 1);
}
<BUG>else {
Marker marker_ = builder_.mark();
enterErrorRecordingSection(builder_, level_, _SECTION_RECOVER_, null);
result_ = parse_root_(root_, builder_, level_);
exitErrorRecordingSection(builder_, level_, result_, true, _SECTION_RECOVER_, TOKEN_ADVANCER);
marker_.done(root_);</BUG>
}
| Marker marker_ = enter_section_(builder_, level_, _NONE_, null);
exit_section_(builder_, level_, marker_, root_, result_, true, TOKEN_ADVANCER);
|
10,455 | return builder_.getTreeBuilt();
}
protected boolean parse_root_(final IElementType root_, final PsiBuilder builder_, final int level_) {
return root(builder_, level_ + 1);
}
<BUG>private static final TokenSet[] EXTENDS_SETS_ = new TokenSet[] {
</BUG>
create_token_set_(BINARY_EXPRESSION, CONDITIONAL_EXPRESSION, EXPRESSION, INDEXED_EXPRESSION,
LITERAL_EXPRESSION, METHOD_CALL_EXPRESSION, NEW_EXPRESSION, PARENTHESIZED_EXPRESSION,
REFERENCE_EXPRESSION, SEQUENCE_EXPRESSION, UNARY_EXPRESSION, VARIABLE_ASSIGNMENT_EXPRESSION,
| public static final TokenSet[] EXTENDS_SETS_ = new TokenSet[] {
|
10,456 | create_token_set_(BINARY_EXPRESSION, CONDITIONAL_EXPRESSION, EXPRESSION, INDEXED_EXPRESSION,
LITERAL_EXPRESSION, METHOD_CALL_EXPRESSION, NEW_EXPRESSION, PARENTHESIZED_EXPRESSION,
REFERENCE_EXPRESSION, SEQUENCE_EXPRESSION, UNARY_EXPRESSION, VARIABLE_ASSIGNMENT_EXPRESSION,
VARIABLE_EXPRESSION),
};
<BUG>public static boolean type_extends_(IElementType child_, IElementType parent_) {
return type_extends_impl_(EXTENDS_SETS_, child_, parent_);
}</BUG>
static boolean arrayConstructorExpression(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "arrayConstructorExpression")) return false;
| [DELETED] |
10,457 | sequenceExpression(builder_, level_ + 1);
return true;
}
static boolean binaryOperations(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "binaryOperations")) return false;
<BUG>boolean result_ = false;
Marker marker_ = builder_.mark();
enterErrorRecordingSection(builder_, level_, _SECTION_GENERAL_, "<operator>");</BUG>
result_ = plusMinusOperations(builder_, level_ + 1);
if (!result_) result_ = divideMultiplyOperations(builder_, level_ + 1);
| Marker marker_ = enter_section_(builder_, level_, _NONE_, "<operator>");
|
10,458 | return result_;
}
static boolean bitwiseBooleanOperations(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "bitwiseBooleanOperations")) return false;
boolean result_ = false;
<BUG>Marker marker_ = builder_.mark();
result_ = consumeToken(builder_, OR);</BUG>
if (!result_) result_ = consumeToken(builder_, XOR);
if (!result_) result_ = consumeToken(builder_, AND);
if (!result_) result_ = consumeToken(builder_, BAND_KEYWORD);
| Marker marker_ = enter_section_(builder_);
result_ = consumeToken(builder_, OR);
|
10,459 | if (offset_ == next_offset_) {
empty_element_parsed_guard_(builder_, offset_, "expressionSequenceRequired_1");
break;
}
offset_ = next_offset_;
<BUG>}
if (!result_) {
marker_.rollbackTo();
}
else {
marker_.drop();
}</BUG>
return result_;
| empty_element_parsed_guard_(builder_, offset_, "referenceExpression_2");
|
10,460 | return consumeToken(builder_, INSTANCEOF_KEYWORD);
}
static boolean methodCallParameters(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "methodCallParameters")) return false;
boolean result_ = false;
<BUG>Marker marker_ = builder_.mark();
result_ = methodCallParameters_0(builder_, level_ + 1);
result_ = result_ && methodCallParameters_1(builder_, level_ + 1);
if (!result_) {
marker_.rollbackTo();
}
else {
marker_.drop();
}</BUG>
return result_;
| if (offset_ == next_offset_) {
empty_element_parsed_guard_(builder_, offset_, "referenceExpression_2");
break;
|
10,461 | Marker marker_ = builder_.mark();
enterErrorRecordingSection(builder_, level_, _SECTION_RECOVER_, null);
result_ = consumeToken(builder_, EXPRESSION_START);</BUG>
pinned_ = result_; // pin = 1
result_ = result_ && report_error_(builder_, rootElement(builder_, level_ + 1));
<BUG>result_ = pinned_ && consumeToken(builder_, EXPRESSION_END) && result_;
if (!result_ && !pinned_) {
marker_.rollbackTo();
}
else {
marker_.drop();
}
result_ = exitErrorRecordingSection(builder_, level_, result_, pinned_, _SECTION_RECOVER_, rootRecover_parser_);</BUG>
return result_ || pinned_;
| boolean result_ = false;
Marker marker_ = enter_section_(builder_);
result_ = consumeToken(builder_, DOT);
result_ = result_ && consumeToken(builder_, IDENTIFIER);
exit_section_(builder_, marker_, null, result_);
return result_;
|
10,462 | return expression(builder_, level_ + 1, -1);
}</BUG>
static boolean rootRecover(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "rootRecover")) return false;
<BUG>boolean result_ = false;
Marker marker_ = builder_.mark();
enterErrorRecordingSection(builder_, level_, _SECTION_NOT_, null);
result_ = !consumeToken(builder_, EXPRESSION_END);
marker_.rollbackTo();
result_ = exitErrorRecordingSection(builder_, level_, result_, false, _SECTION_NOT_, null);</BUG>
return result_;
| Marker marker_ = enter_section_(builder_);
result_ = consumeToken(builder_, DOT);
result_ = result_ && consumeToken(builder_, IDENTIFIER);
exit_section_(builder_, marker_, null, result_);
|
10,463 | enterErrorRecordingSection(builder_, level_, _SECTION_GENERAL_, "<method call expression>");</BUG>
result_ = referenceExpression(builder_, level_ + 1);
result_ = result_ && consumeToken(builder_, LPARENTH);
pinned_ = result_; // pin = 2
result_ = result_ && report_error_(builder_, methodCallParameters(builder_, level_ + 1));
<BUG>result_ = pinned_ && consumeToken(builder_, RPARENTH) && result_;
if (result_ || pinned_) {
marker_.done(METHOD_CALL_EXPRESSION);
}
else {
marker_.rollbackTo();
}
result_ = exitErrorRecordingSection(builder_, level_, result_, pinned_, _SECTION_GENERAL_, null);</BUG>
return result_ || pinned_;
| boolean result_ = false;
Marker marker_ = enter_section_(builder_);
result_ = consumeToken(builder_, DOT);
result_ = result_ && consumeToken(builder_, IDENTIFIER);
exit_section_(builder_, marker_, null, result_);
return result_;
|
10,464 | 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);
}
|
10,465 | catch (SessionTimeoutException sessionTimeoutException)
{
_log.error("nextAsset() session timeout: " + sessionTimeoutException);
throw new MetasearchException(MetasearchException.SESSION_TIMED_OUT);
}
<BUG>catch (SearchException searchException)
{
_log.error("nextAsset() search exception: " + searchException);</BUG>
throw new MetasearchException(MetasearchException.METASEARCH_ERROR);
}
| { /*
if (searchException.getMessage().equals(SearchException.ASSET_NOT_READY))
throw new MetasearchException(MetasearchException.ASSET_NOT_FETCHED);
_log.error("nextAsset() search exception: " + searchException);
|
10,466 | _log.error("nextAsset() general: ", throwable);
throw new org.osid.repository.RepositoryException(org.osid.OsidException.OPERATION_FAILED);
}
}
asset = getAsset();
<BUG>_log.debug("AssetIterator.nextAsset() returns asset = " + asset + ", index = " + index + ", vector size = " + assetVectorSize());
return asset;
}</BUG>
private Integer getIntegerProperty(org.osid.shared.Properties searchProperties,
String name)
| _log.debug("AssetIterator.nextAsset() returns asset at index " + index + ", vector size = " + assetVectorSize());
private int getMaximumRecords()
{
return sessionContext.getInt("maxRecords");
|
10,467 | MatchItem.PartPair partPair = (MatchItem.PartPair) partPairIterator.next();
record.createPart(partPair.getId(), partPair.getValue());
}
addAsset(asset);
assetsAdded++;
<BUG>if (populated >= maximumRecords)
</BUG>
{
break;
}
| if (populated >= getMaximumRecords())
|
10,468 | import org.spongepowered.api.world.Locatable;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;
import javax.annotation.Nullable;
import java.util.List;
<BUG>import java.util.Optional;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG>
public class CommandDelete extends FCCommandBase {
private static final FlagMapper MAPPER = map -> key -> value -> {
map.put(key, value);
| import java.util.stream.Stream;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
|
10,469 | .append(Text.of(TextColors.GREEN, "Usage: "))
.append(getUsage(source))
.build());
return CommandResult.empty();
} else if (isIn(REGIONS_ALIASES, parse.args[0])) {
<BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!"));
IRegion region = FGManager.getInstance().getRegion(parse.args[1]);
</BUG>
boolean isWorldRegion = false;
if (region == null) {
| String regionName = parse.args[1];
IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
|
10,470 | </BUG>
isWorldRegion = true;
}
if (region == null)
<BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!"));
if (region instanceof GlobalWorldRegion) {
</BUG>
throw new CommandException(Text.of("You may not delete the global region!"));
}
| if (world == null)
throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!"));
if (world == null) throw new CommandException(Text.of("Must specify a world!"));
region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null);
throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!"));
if (region instanceof IGlobal) {
|
10,471 | source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region"
);
return CommandResult.success();
} else if (isIn(HANDLERS_ALIASES, parse.args[0])) {
if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!"));
<BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]);
if (handler == null)
throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1);
if (handler instanceof GlobalHandler)</BUG>
throw new CommandException(Text.of("You may not delete the global handler!"));
| Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]);
if (!handlerOpt.isPresent())
IHandler handler = handlerOpt.get();
if (handler instanceof GlobalHandler)
|
10,472 | .excludeCurrent(true)
.autoCloseQuotes(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
<BUG>return ImmutableList.of("region", "handler").stream()
.filter(new StartsWithPredicate(parse.current.token))</BUG>
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index == 1) {
| return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
|
10,473 | .excludeCurrent(true)
.autoCloseQuotes(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
<BUG>return ImmutableList.of("region", "handler").stream()
.filter(new StartsWithPredicate(parse.current.token))</BUG>
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index == 1) {
| return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
|
10,474 | @Dependency(id = "foxcore")
},
description = "A world protection plugin built for SpongeAPI. Requires FoxCore.",
authors = {"gravityfox"},
url = "https://github.com/FoxDenStudio/FoxGuard")
<BUG>public final class FoxGuardMain {
public final Cause pluginCause = Cause.builder().named("plugin", this).build();
private static FoxGuardMain instanceField;</BUG>
@Inject
private Logger logger;
| private static FoxGuardMain instanceField;
|
10,475 | private UserStorageService userStorage;
private EconomyService economyService = null;
private boolean loaded = false;
private FCCommandDispatcher fgDispatcher;
public static FoxGuardMain instance() {
<BUG>return instanceField;
}</BUG>
@Listener
public void construct(GameConstructionEvent event) {
instanceField = this;
| }
public static Cause getCause() {
return instance().pluginCause;
}
|
10,476 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
10,477 | import org.spongepowered.api.world.Locatable;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;
import javax.annotation.Nullable;
import java.util.*;
<BUG>import java.util.stream.Collectors;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG>
public class CommandHere extends FCCommandBase {
private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"};
private static final FlagMapper MAPPER = map -> key -> value -> {
| import java.util.stream.Stream;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
|
10,478 | .excludeCurrent(true)
.autoCloseQuotes(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
<BUG>return ImmutableList.of("region", "handler").stream()
.filter(new StartsWithPredicate(parse.current.token))</BUG>
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index > 0) {
| return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
|
10,479 | private static FGStorageManager instance;
private final Logger logger = FoxGuardMain.instance().getLogger();</BUG>
private final Set<LoadEntry> loaded = new HashSet<>();
private final Path directory = getDirectory();
private final Map<String, Path> worldDirectories;
<BUG>private FGStorageManager() {
defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG>
if (k instanceof IFGObject) {
m.put((IFGObject) k, true);
return true;
| public final HashMap<IFGObject, Boolean> defaultModifiedMap;
private final UserStorageService userStorageService;
private final Logger logger = FoxGuardMain.instance().getLogger();
userStorageService = FoxGuardMain.instance().getUserStorage();
defaultModifiedMap = new CacheMap<>((k, m) -> {
|
10,480 | String name = fgObject.getName();
Path singleDir = dir.resolve(name.toLowerCase());
</BUG>
boolean shouldSave = fgObject.shouldSave();
if (force || shouldSave) {
<BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir);
</BUG>
constructDirectory(singleDir);
try {
fgObject.save(singleDir);
| UUID owner = fgObject.getOwner();
boolean isOwned = !owner.equals(SERVER_UUID);
Optional<User> userOwner = userStorageService.get(owner);
String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name;
if (fgObject.autoSave()) {
Path singleDir = serverDir.resolve(name.toLowerCase());
logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
|
10,481 | if (fgObject.autoSave()) {
Path singleDir = dir.resolve(name.toLowerCase());
</BUG>
boolean shouldSave = fgObject.shouldSave();
if (force || shouldSave) {
<BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir);
</BUG>
constructDirectory(singleDir);
try {
fgObject.save(singleDir);
| Path singleDir = serverDir.resolve(name.toLowerCase());
logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
|
10,482 | public synchronized void loadRegionLinks() {
logger.info("Loading region links");
try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) {
Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen();
linksMap.entrySet().forEach(entry -> {
<BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey());
if (region != null) {
logger.info("Loading links for region \"" + region.getName() + "\"");</BUG>
String handlersString = entry.getValue();
| Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey());
if (regionOpt.isPresent()) {
IRegion region = regionOpt.get();
logger.info("Loading links for region \"" + region.getName() + "\"");
|
10,483 | public synchronized void loadWorldRegionLinks(World world) {
logger.info("Loading world region links for world \"" + world.getName() + "\"");
try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) {
Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen();
linksMap.entrySet().forEach(entry -> {
<BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey());
if (region != null) {
logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG>
String handlersString = entry.getValue();
| Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey());
if (regionOpt.isPresent()) {
IWorldRegion region = regionOpt.get();
logger.info("Loading links for world region \"" + region.getName() + "\"");
|
10,484 | StringBuilder builder = new StringBuilder();
for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) {
builder.append(it.next().getName());
if (it.hasNext()) builder.append(",");
}
<BUG>return builder.toString();
}</BUG>
private final class LoadEntry {
public final String name;
public final Type type;
| public enum Type {
REGION, WREGION, HANDLER
|
10,485 | .autoCloseQuotes(true)
.leaveFinalAsIs(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
<BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream()
</BUG>
.filter(new StartsWithPredicate(parse.current.token))
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index == 1) {
| return Stream.of("region", "worldregion", "handler", "controller")
|
10,486 | if(!attribute.getAccess().equals("private")) {
if(system.getSystemObject().containsFieldInstruction(attribute.getFieldObject().generateFieldInstruction(), sourceClass.getClassObject()))
return false;
}
}
<BUG>}
if(extractedEntities.size() == 1 || methodCounter == 0) {</BUG>
return false;
}
else {
| if(containsReadObjectMethodAssigningExtractedField()) {
if(extractedEntities.size() == 1 || methodCounter == 0) {
|
10,487 | import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.IVariableBinding;
<BUG>import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.Name;</BUG>
import org.eclipse.jdt.core.dom.ParameterizedType;
import org.eclipse.jdt.core.dom.PrimitiveType;
import org.eclipse.jdt.core.dom.QualifiedName;
| import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jdt.core.dom.Name;
|
10,488 | return accessorMethodName;
}
public void apply() {
for(MethodDeclaration method : extractedMethods) {
int modifiers = method.getModifiers();
<BUG>if((modifiers & Modifier.PRIVATE) == 0)
delegateMethods.add(method);</BUG>
}
removeFieldFragmentsInSourceClass(extractedFieldFragments);
Set<VariableDeclaration> modifiedFieldsInNonExtractedMethods = new LinkedHashSet<VariableDeclaration>();
| if((modifiers & Modifier.PRIVATE) == 0 || isReadObject(method) || isWriteObject(method))
delegateMethods.add(method);
|
10,489 | if(blockNode != null && nonMappedNodes.contains(blockNode) && mappedNodes.contains(pdgNode)) {
mappedNodes.remove(pdgNode);
nonMappedNodes.add(pdgNode);
}
PDGNode controlParent = pdgNode.getControlDependenceParent();
<BUG>if(controlParent != null && nonMappedNodes.contains(controlParent) && mappedNodes.contains(pdgNode)) {
mappedNodes.remove(pdgNode);</BUG>
nonMappedNodes.add(pdgNode);
}
}
| [DELETED] |
10,490 | PreconditionViolationType.UNMATCHED_STATEMENT_CANNOT_BE_MOVED_BEFORE_OR_AFTER_THE_EXTRACTED_CODE);
nodeMapping.addPreconditionViolation(violation);
preconditionViolations.add(violation);
}
else if(movableNonMappedNodeBeforeFirstMappedNode && movableNonMappedNodeAfterLastMappedNode) {
<BUG>if(controlParentExaminesVariableUsedInNonMappedNode(node, removableNodes)) {
PreconditionViolation violation = new StatementPreconditionViolation(node.getStatement(),</BUG>
PreconditionViolationType.UNMATCHED_STATEMENT_CANNOT_BE_MOVED_BEFORE_THE_EXTRACTED_CODE_DUE_TO_CONTROL_DEPENDENCE);
nodeMapping.addPreconditionViolation(violation);
preconditionViolations.add(violation);
| [DELETED] |
10,491 | else {
movableBeforeAndAfter.add(node);
}
}
else if(movableNonMappedNodeBeforeFirstMappedNode) {
<BUG>if(controlParentExaminesVariableUsedInNonMappedNode(node, removableNodes)) {
</BUG>
PreconditionViolation violation = new StatementPreconditionViolation(node.getStatement(),
PreconditionViolationType.UNMATCHED_STATEMENT_CANNOT_BE_MOVED_BEFORE_THE_EXTRACTED_CODE_DUE_TO_CONTROL_DEPENDENCE);
nodeMapping.addPreconditionViolation(violation);
| if(controlParentExaminesVariableUsedInNonMappedNode(node, removableNodes) && !isFirstNonMappedNode(removableNodes, node)) {
|
10,492 | else {
movableBefore.add(node);
}
}
else if(movableNonMappedNodeAfterLastMappedNode) {
<BUG>if(controlParentExaminesVariableUsedInNonMappedNode(node, removableNodes)) {
</BUG>
PreconditionViolation violation = new StatementPreconditionViolation(node.getStatement(),
PreconditionViolationType.UNMATCHED_STATEMENT_CANNOT_BE_MOVED_BEFORE_THE_EXTRACTED_CODE_DUE_TO_CONTROL_DEPENDENCE);
nodeMapping.addPreconditionViolation(violation);
| movableBeforeAndAfter.add(node);
else if(movableNonMappedNodeBeforeFirstMappedNode) {
if(controlParentExaminesVariableUsedInNonMappedNode(node, removableNodes) && !isFirstNonMappedNode(removableNodes, node)) {
|
10,493 | for(VariableDeclaration localFieldG2 : allFieldsG2) {
FieldDeclaration originalFieldDeclarationG2 = (FieldDeclaration)localFieldG2.getParent();
if(localFieldG1.getName().getIdentifier().equals(localFieldG2.getName().getIdentifier()) &&
!fieldDeclarationsToBePulledUp.get(0).contains(localFieldG1) && !fieldDeclarationsToBePulledUp.get(1).contains(localFieldG2)) {
if(originalFieldDeclarationG1.getType().resolveBinding().isEqualTo(originalFieldDeclarationG2.getType().resolveBinding())) {
<BUG>boolean avoidPullUpDueToSerialization1 = avoidPullUpFieldDueToSerialization(sourceTypeDeclarations.get(0), localFieldG1);
boolean avoidPullUpDueToSerialization2 = avoidPullUpFieldDueToSerialization(sourceTypeDeclarations.get(1), localFieldG2);
</BUG>
if(!avoidPullUpDueToSerialization1 && !avoidPullUpDueToSerialization2 && sameInitializers(localFieldG1, localFieldG2)) {
| boolean avoidPullUpDueToSerialization1 = RefactoringUtility.isSerializedField(sourceTypeDeclarations.get(0), localFieldG1);
boolean avoidPullUpDueToSerialization2 = RefactoringUtility.isSerializedField(sourceTypeDeclarations.get(1), localFieldG2);
|
10,494 | }</BUG>
private boolean avoidPullUpMethodDueToSerialization(TypeDeclaration typeDeclaration, Set<VariableDeclaration> fieldsAccessedInMethod, Set<VariableDeclaration> fieldModifiedInMethod) {
Set<VariableDeclaration> allFields = new LinkedHashSet<VariableDeclaration>(fieldsAccessedInMethod);
allFields.addAll(fieldModifiedInMethod);
for(VariableDeclaration localField : allFields) {
<BUG>if(avoidPullUpFieldDueToSerialization(typeDeclaration, localField)) {
return true;</BUG>
}
}
return false;
| private boolean sameInitializers(VariableDeclaration localFieldG1, VariableDeclaration localFieldG2) {
return (localFieldG1.getInitializer() == null && localFieldG2.getInitializer() == null) ||
(localFieldG1.getInitializer() != null && localFieldG2.getInitializer() != null &&
localFieldG1.getInitializer().subtreeMatch(new ASTMatcher(), localFieldG2.getInitializer()));
if(RefactoringUtility.isSerializedField(typeDeclaration, localField)) {
return true;
|
10,495 | package org.neo4j.server.rest;
import static org.junit.Assert.assertEquals;
<BUG>import java.io.IOException;
import org.junit.After;</BUG>
import org.junit.Before;
import org.junit.Test;
import org.neo4j.server.NeoServer;
| import javax.ws.rs.core.MediaType;
import org.junit.After;
|
10,496 | package org.neo4j.server.rest;
<BUG>import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import org.junit.After;</BUG>
import org.junit.Before;
import org.junit.Test;
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import javax.ws.rs.core.MediaType;
import org.junit.After;
|
10,497 | server = null;
}
@Test
public void shouldRespondWithTheWebAdminClientSettings() throws Exception {
String url = functionalTestHelper.mangementUri() + "properties/neo4j-servers";
<BUG>ClientResponse response = Client.create().resource(url).get(ClientResponse.class);
String json = response.getEntity(String.class);</BUG>
assertEquals(200, response.getStatus());
assertThat(json, containsString("\"url\" : \"" + server.baseUri() + "db/data/\""));
| ClientResponse response = Client.create().resource( url ).accept(
MediaType.APPLICATION_JSON_TYPE ).get( ClientResponse.class );
String json = response.getEntity(String.class);
|
10,498 | else if (t == ANY_CYPHER_OPTION) {
r = AnyCypherOption(b, 0);
}
else if (t == ANY_FUNCTION_INVOCATION) {
r = AnyFunctionInvocation(b, 0);
<BUG>}
else if (t == BULK_IMPORT_QUERY) {</BUG>
r = BulkImportQuery(b, 0);
}
else if (t == CALL) {
| else if (t == ARRAY) {
r = Array(b, 0);
else if (t == BULK_IMPORT_QUERY) {
|
10,499 | if (!r) r = MapLiteral(b, l + 1);
if (!r) r = MapProjection(b, l + 1);
if (!r) r = CountStar(b, l + 1);
if (!r) r = ListComprehension(b, l + 1);
if (!r) r = PatternComprehension(b, l + 1);
<BUG>if (!r) r = Expression1_12(b, l + 1);
if (!r) r = FilterFunctionInvocation(b, l + 1);</BUG>
if (!r) r = ExtractFunctionInvocation(b, l + 1);
if (!r) r = ReduceFunctionInvocation(b, l + 1);
if (!r) r = AllFunctionInvocation(b, l + 1);
| if (!r) r = Array(b, l + 1);
if (!r) r = FilterFunctionInvocation(b, l + 1);
|
10,500 | composite.pack();
}
private void fillLayers(IMap map, Combo combo, VectorLayerType layerType) {
combo.removeAll();
for (ILayer layer : map.getMapLayers()) {
<BUG>if (layer.hasResource(FeatureSource.class)) {
</BUG>
GeometryDescriptor descriptor = layer.getSchema().getGeometryDescriptor();
Class<?> geometryBinding = descriptor.getType().getBinding();
switch (layerType) {
| if (layer.getName() != null && layer.hasResource(FeatureSource.class)) {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.