id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
39,801 | package org.jboss.as.patching;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.patching.runner.PatchingException;
import org.jboss.logging.Messages;
import org.jboss.logging.annotations.Message;
<BUG>import org.jboss.logging.annotations.MessageBundle;
import java.io.IOException;</BUG>
import java.util.List;
@MessageBundle(projectCode = "JBAS")
public interface PatchMessages {
| import org.jboss.logging.annotations.Cause;
import java.io.IOException;
|
39,802 | }
public QueryOperation() {
}
@Override
public void run() throws Exception {
<BUG>List<Integer> initialPartitions = mapService.getOwnedPartitions().get();
IndexService indexService = mapService.getMapContainer(name).getIndexService();</BUG>
Set<QueryableEntry> entries = null;
if (!getNodeEngine().getPartitionService().hasOnGoingMigration()) {
entries = indexService.query(predicate);
| List<Integer> initialPartitions = mapService.getOwnedPartitions();
IndexService indexService = mapService.getMapContainer(name).getIndexService();
|
39,803 | result.add(new QueryResultEntryImpl(entry.getKeyData(), entry.getKeyData(), entry.getValueData()));
}
} else {
runParallel(initialPartitions);
}
<BUG>List<Integer> finalPartitions = mapService.getOwnedPartitions().get();
if (initialPartitions.equals(finalPartitions)) {</BUG>
result.setPartitionIds(finalPartitions);
}
if (mapContainer.getMapConfig().isStatisticsEnabled()) {
| List<Integer> finalPartitions = mapService.getOwnedPartitions();
if (initialPartitions.equals(finalPartitions)) {
|
39,804 | import com.hazelcast.monitor.impl.LocalMapStatsImpl;
import com.hazelcast.nio.Address;
import com.hazelcast.nio.ClassLoaderUtil;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.nio.serialization.SerializationService;
<BUG>import com.hazelcast.partition.MigrationEndpoint;
import com.hazelcast.partition.PartitionView;
</BUG>
import com.hazelcast.query.Predicate;
| import com.hazelcast.partition.*;
import com.hazelcast.partition.PartitionService;
|
39,805 | public void commitMigration(PartitionMigrationEvent event) {
migrateIndex(event);
if (event.getMigrationEndpoint() == MigrationEndpoint.SOURCE) {
clearPartitionData(event.getPartitionId());
}
<BUG>ownedPartitions.set(nodeEngine.getPartitionService().getMemberPartitions(nodeEngine.getThisAddress()));
}</BUG>
private void migrateIndex(PartitionMigrationEvent event) {
final PartitionContainer container = partitionContainers[event.getPartitionId()];
for (RecordStore recordStore : container.getMaps().values()) {
| ownedPartitions.set(getMemberPartitions());
|
39,806 | import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
public class StatusBarUtil {
<BUG>public static final int DEFAULT_STATUS_BAR_ALPHA = 112;
public static void setColor(Activity activity, @ColorInt int color) {</BUG>
setColor(activity, color, DEFAULT_STATUS_BAR_ALPHA);
}
public static void setColor(Activity activity, @ColorInt int color, int statusBarAlpha) {
| public static final int FAKE_STATUS_BAR_VIEW_ID = R.id.statusbarutil_fake_status_bar_view;
public static final int FAKE_TRANSLUCENT_VIEW_ID = R.id.statusbarutil_translucent_view;
public static void setColor(Activity activity, @ColorInt int color) {
|
39,807 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
transparentStatusBar(activity);
ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);
<BUG>if (contentView.getChildCount() > 1) {
contentView.getChildAt(1).setBackgroundColor(color);
} else {</BUG>
contentView.addView(createStatusBarView(activity, color));
}
| View fakeStatusBarView = contentView.findViewById(FAKE_STATUS_BAR_VIEW_ID);
if (fakeStatusBarView != null) {
if (fakeStatusBarView.getVisibility() == View.GONE) {
fakeStatusBarView.setVisibility(View.VISIBLE);
fakeStatusBarView.setBackgroundColor(color);
} else {
|
39,808 | activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
} else {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
<BUG>if (contentLayout.getChildCount() > 0 && contentLayout.getChildAt(0) instanceof StatusBarView) {
contentLayout.getChildAt(0).setBackgroundColor(color);
} else {
StatusBarView statusBarView = createStatusBarView(activity, color);
contentLayout.addView(statusBarView, 0);
</BUG>
}
| View fakeStatusBarView = contentLayout.findViewById(FAKE_STATUS_BAR_VIEW_ID);
if (fakeStatusBarView != null) {
if (fakeStatusBarView.getVisibility() == View.GONE) {
fakeStatusBarView.setVisibility(View.VISIBLE);
fakeStatusBarView.setBackgroundColor(color);
contentLayout.addView(createStatusBarView(activity, color), 0);
|
39,809 | rootView.setPadding(0, 0, 0, 0);
}
}
private static void addTranslucentView(Activity activity, int statusBarAlpha) {
ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);
<BUG>if (contentView.getChildCount() > 1) {
contentView.getChildAt(1).setBackgroundColor(Color.argb(statusBarAlpha, 0, 0, 0));
</BUG>
} else {
contentView.addView(createTranslucentStatusBarView(activity, statusBarAlpha));
| View fakeTranslucentView = contentView.findViewById(FAKE_TRANSLUCENT_VIEW_ID);
if (fakeTranslucentView != null) {
if (fakeTranslucentView.getVisibility() == View.GONE) {
fakeTranslucentView.setVisibility(View.VISIBLE);
fakeTranslucentView.setBackgroundColor(Color.argb(statusBarAlpha, 0, 0, 0));
|
39,810 | private static StatusBarView createStatusBarView(Activity activity, @ColorInt int color, int alpha) {
StatusBarView statusBarView = new StatusBarView(activity);
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
statusBarView.setLayoutParams(params);
<BUG>statusBarView.setBackgroundColor(calculateStatusColor(color, alpha));
return statusBarView;</BUG>
}
private static void setRootView(Activity activity) {
ViewGroup parent = (ViewGroup) activity.findViewById(android.R.id.content);
| statusBarView.setId(FAKE_STATUS_BAR_VIEW_ID);
return statusBarView;
|
39,811 | private static StatusBarView createTranslucentStatusBarView(Activity activity, int alpha) {
StatusBarView statusBarView = new StatusBarView(activity);
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
statusBarView.setLayoutParams(params);
<BUG>statusBarView.setBackgroundColor(Color.argb(alpha, 0, 0, 0));
return statusBarView;</BUG>
}
private static int getStatusBarHeight(Context context) {
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
| statusBarView.setId(FAKE_TRANSLUCENT_VIEW_ID);
return statusBarView;
|
39,812 | return new PointerReader(segment, location, nestingLimit);
}
public boolean isNull() {
return this.segment.buffer.getLong(this.pointer) == 0;
}
<BUG>public StructReader getStruct() {
return WireHelpers.readStructPointer(this.segment,
this.pointer,</BUG>
null, 0,
| public <T> T getStruct(FromStructReader<T> factory) {
return WireHelpers.readStructPointer(factory,
this.pointer,
|
39,813 | public final PointerReader reader;
public Reader(PointerReader reader) {
this.reader = reader;
}
public final <T> T getAsStruct(FromStructReader<T> factory) {
<BUG>return factory.fromStructReader(this.reader.getStruct());
}</BUG>
public final <T> T getAsList(FromPointerReader<T> factory) {
return factory.fromPointerReader(this.reader, null, 0);
}
| return this.reader.getStruct(factory);
|
39,814 | public final PointerBuilder builder;
public Builder(PointerBuilder builder) {
this.builder = builder;
}
public final <T> T initAsStruct(FromStructBuilder<T> factory) {
<BUG>return factory.fromStructBuilder(this.builder.initStruct(factory.structSize()));
}</BUG>
public final void clear() {
this.builder.clear();
}
| return this.builder.initStruct(factory);
|
39,815 | public int idx = 0;
public Iterator(Reader<T> list) {
this.list = list;
}
public T next() {
<BUG>return list.factory.fromStructReader(list.reader.getStructElement(idx++));
}</BUG>
public boolean hasNext() {
return idx < list.size();
}
| return list.reader.getStructElement(factory, idx++);
|
39,816 | public int idx = 0;
public Iterator(Builder<T> list) {
this.list = list;
}
public T next() {
<BUG>return list.factory.fromStructBuilder(list.builder.getStructElement(idx++));
}</BUG>
public boolean hasNext() {
return idx < list.size();
}
| public Iterator(Reader<T> list) {
return list.reader.getStructElement(factory, idx++);
|
39,817 | package org.capnproto;
<BUG>public final class StructBuilder {
final SegmentBuilder segment;
final int data; // byte offset to data section
final int pointers; // word offset of pointer section
final int dataSize; // in bits
final short pointerCount;
final byte bit0Offset;
</BUG>
public StructBuilder(SegmentBuilder segment, int data,
| public class StructBuilder {
protected final SegmentBuilder segment;
protected final int data; // byte offset to data section
protected final int pointers; // word offset of pointer section
protected final int dataSize; // in bits
protected final short pointerCount;
protected final byte bit0Offset;
|
39,818 | this.pointers = pointers;
this.dataSize = dataSize;
this.pointerCount = pointerCount;
this.bit0Offset = bit0Offset;
}
<BUG>public final StructReader asReader() {
return new StructReader(this.segment,
this.data, this.pointers, this.dataSize,
this.pointerCount, this.bit0Offset,
0x7fffffff);
}
public final boolean getBooleanField(int offset) {
</BUG>
int bitOffset = (offset == 0 ? this.bit0Offset : offset);
| public final boolean _getBooleanField(int offset) {
|
39,819 | import ml.puredark.hviewer.ui.activities.BaseActivity;
import ml.puredark.hviewer.ui.dataproviders.ListDataProvider;
import ml.puredark.hviewer.ui.fragments.SettingFragment;
import ml.puredark.hviewer.ui.listeners.OnItemLongClickListener;
import ml.puredark.hviewer.utils.SharedPreferencesUtil;
<BUG>import static android.webkit.WebSettings.LOAD_CACHE_ELSE_NETWORK;
public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {</BUG>
private BaseActivity activity;
private Site site;
private ListDataProvider mProvider;
| import static ml.puredark.hviewer.R.id.container;
public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {
|
39,820 | final PictureViewHolder viewHolder = new PictureViewHolder(view);
if (pictures != null && position < pictures.size()) {
final Picture picture = pictures.get(getPicturePostion(position));
if (picture.pic != null) {
loadImage(container.getContext(), picture, viewHolder);
<BUG>} else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null && site.extraRule.pictureUrl != null) {
getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);</BUG>
} else if (site.picUrlSelector != null) {
getPictureUrl(container.getContext(), viewHolder, picture, site, site.picUrlSelector, null);
} else {
| } else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null) {
if(site.extraRule.pictureRule != null && site.extraRule.pictureRule.url != null)
getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureRule.url, site.extraRule.pictureRule.highRes);
else if(site.extraRule.pictureUrl != null)
getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);
|
39,821 | import java.util.regex.Pattern;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.puredark.hviewer.R;
import ml.puredark.hviewer.beans.Category;
<BUG>import ml.puredark.hviewer.beans.CommentRule;
import ml.puredark.hviewer.beans.Rule;</BUG>
import ml.puredark.hviewer.beans.Selector;
import ml.puredark.hviewer.beans.Site;
import ml.puredark.hviewer.ui.adapters.CategoryInputAdapter;
| import ml.puredark.hviewer.beans.PictureRule;
import ml.puredark.hviewer.beans.Rule;
|
39,822 | inputGalleryRulePictureUrlReplacement.setText(site.galleryRule.pictureUrl.replacement);
}
if (site.galleryRule.pictureHighRes != null) {
inputGalleryRulePictureHighResSelector.setText(joinSelector(site.galleryRule.pictureHighRes));
inputGalleryRulePictureHighResRegex.setText(site.galleryRule.pictureHighRes.regex);
<BUG>inputGalleryRulePictureHighResReplacement.setText(site.galleryRule.pictureHighRes.replacement);
}</BUG>
if (site.galleryRule.commentRule != null) {
if (site.galleryRule.commentRule.item != null) {
inputGalleryRuleCommentItemSelector.setText(joinSelector(site.galleryRule.commentRule.item));
| [DELETED] |
39,823 | inputExtraRuleCommentDatetimeReplacement.setText(site.extraRule.commentDatetime.replacement);
}
if (site.extraRule.commentContent != null) {
inputExtraRuleCommentContentSelector.setText(joinSelector(site.extraRule.commentContent));
inputExtraRuleCommentContentRegex.setText(site.extraRule.commentContent.regex);
<BUG>inputExtraRuleCommentContentReplacement.setText(site.extraRule.commentContent.replacement);
}</BUG>
}
}
}
| [DELETED] |
39,824 | lastSite.galleryRule.cover = loadSelector(inputGalleryRuleCoverSelector, inputGalleryRuleCoverRegex, inputGalleryRuleCoverReplacement);
lastSite.galleryRule.category = loadSelector(inputGalleryRuleCategorySelector, inputGalleryRuleCategoryRegex, inputGalleryRuleCategoryReplacement);
lastSite.galleryRule.datetime = loadSelector(inputGalleryRuleDatetimeSelector, inputGalleryRuleDatetimeRegex, inputGalleryRuleDatetimeReplacement);
lastSite.galleryRule.rating = loadSelector(inputGalleryRuleRatingSelector, inputGalleryRuleRatingRegex, inputGalleryRuleRatingReplacement);
lastSite.galleryRule.description = loadSelector(inputGalleryRuleDescriptionSelector, inputGalleryRuleDescriptionRegex, inputGalleryRuleDescriptionReplacement);
<BUG>lastSite.galleryRule.tags = loadSelector(inputGalleryRuleTagsSelector, inputGalleryRuleTagsRegex, inputGalleryRuleTagsReplacement);
lastSite.galleryRule.pictureThumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement);
lastSite.galleryRule.pictureUrl = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement);
lastSite.galleryRule.pictureHighRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement);
lastSite.galleryRule.commentRule = new CommentRule();
lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);</BUG>
lastSite.galleryRule.commentRule.avatar = loadSelector(inputGalleryRuleCommentAvatarSelector, inputGalleryRuleCommentAvatarRegex, inputGalleryRuleCommentAvatarReplacement);
| lastSite.galleryRule.pictureRule = (lastSite.galleryRule.pictureRule == null) ? new PictureRule() : lastSite.galleryRule.pictureRule;
lastSite.galleryRule.pictureRule.thumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement);
lastSite.galleryRule.pictureRule.url = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement);
lastSite.galleryRule.pictureRule.highRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement);
lastSite.galleryRule.commentRule = (lastSite.galleryRule.commentRule == null) ? new CommentRule() : lastSite.galleryRule.commentRule;
lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);
|
39,825 | lastSite.extraRule.cover = loadSelector(inputExtraRuleCoverSelector, inputExtraRuleCoverRegex, inputExtraRuleCoverReplacement);
lastSite.extraRule.category = loadSelector(inputExtraRuleCategorySelector, inputExtraRuleCategoryRegex, inputExtraRuleCategoryReplacement);
lastSite.extraRule.datetime = loadSelector(inputExtraRuleDatetimeSelector, inputExtraRuleDatetimeRegex, inputExtraRuleDatetimeReplacement);
lastSite.extraRule.rating = loadSelector(inputExtraRuleRatingSelector, inputExtraRuleRatingRegex, inputExtraRuleRatingReplacement);
lastSite.extraRule.description = loadSelector(inputExtraRuleDescriptionSelector, inputExtraRuleDescriptionRegex, inputExtraRuleDescriptionReplacement);
<BUG>lastSite.extraRule.tags = loadSelector(inputExtraRuleTagsSelector, inputExtraRuleTagsRegex, inputExtraRuleTagsReplacement);
lastSite.extraRule.pictureThumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement);
lastSite.extraRule.pictureUrl = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement);
lastSite.extraRule.pictureHighRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement);
lastSite.extraRule.commentRule = new CommentRule();
lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);</BUG>
lastSite.extraRule.commentRule.avatar = loadSelector(inputExtraRuleCommentAvatarSelector, inputExtraRuleCommentAvatarRegex, inputExtraRuleCommentAvatarReplacement);
| lastSite.extraRule.pictureRule = (lastSite.extraRule.pictureRule == null) ? new PictureRule() : lastSite.extraRule.pictureRule;
lastSite.extraRule.pictureRule.thumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement);
lastSite.extraRule.pictureRule.url = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement);
lastSite.extraRule.pictureRule.highRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement);
lastSite.extraRule.commentRule = (lastSite.extraRule.commentRule == null) ? new CommentRule() : lastSite.extraRule.commentRule;
lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);
|
39,826 | notifyItemChanged(position);
if (mItemClickListener != null)
mItemClickListener.onItemClick(v, position);
}
});
<BUG>if (tag.selected)
label.getChildAt(0).setBackgroundResource(R.color.colorPrimary);
else
label.getChildAt(0).setBackgroundResource(R.color.dimgray);</BUG>
}
| [DELETED] |
39,827 | loadPicture(picture, task, null, true);
} else if (!TextUtils.isEmpty(picture.pic) && !highRes) {
picture.retries = 0;
loadPicture(picture, task, null, false);
} else if (task.collection.site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE)
<BUG>&& task.collection.site.extraRule != null
&& task.collection.site.extraRule.pictureUrl != null) {
</BUG>
getPictureUrl(picture, task, task.collection.site.extraRule.pictureUrl, task.collection.site.extraRule.pictureHighRes);
| && task.collection.site.extraRule != null) {
if(task.collection.site.extraRule.pictureRule != null && task.collection.site.extraRule.pictureRule.url != null)
getPictureUrl(picture, task, task.collection.site.extraRule.pictureRule.url, task.collection.site.extraRule.pictureRule.highRes);
else if(task.collection.site.extraRule.pictureUrl != null)
|
39,828 | if (Picture.hasPicPosfix(picture.url)) {
picture.pic = picture.url;
loadPicture(picture, task, null, false);
} else
if (task.collection.site.hasFlag(Site.FLAG_JS_NEEDED_ALL)) {
<BUG>new Handler(Looper.getMainLooper()).post(()->{
</BUG>
WebView webView = new WebView(HViewerApplication.mContext);
WebSettings mWebSettings = webView.getSettings();
mWebSettings.setJavaScriptEnabled(true);
| new Handler(Looper.getMainLooper()).post(() -> {
|
39,829 | package com.ge.predix.acs.rest;
<BUG>import java.util.Set;
import org.apache.commons.lang.builder.EqualsBuilder;</BUG>
import org.apache.commons.lang.builder.HashCodeBuilder;
import com.ge.predix.acs.model.Attribute;
import io.swagger.annotations.ApiModel;
| import java.util.LinkedHashSet;
import org.apache.commons.lang.builder.EqualsBuilder;
|
39,830 | hashCodeBuilder.append(this.action).append(this.resourceIdentifier).append(this.subjectIdentifier);
if (null != this.subjectAttributes) {
for (Attribute attribute : this.subjectAttributes) {
hashCodeBuilder.append(attribute);
}
<BUG>}
return hashCodeBuilder.toHashCode();</BUG>
}
@Override
public boolean equals(final Object obj) {
| for (String policyID : this.policySetsEvaluationOrder) {
hashCodeBuilder.append(policyID);
return hashCodeBuilder.toHashCode();
|
39,831 | package com.ge.predix.acs.policy.evaluation.cache;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
<BUG>import java.util.HashSet;
import java.util.List;</BUG>
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
| import java.util.LinkedHashSet;
import java.util.List;
|
39,832 | keys.add(key.toRedisKey());
return keys;
}
private void logCacheGetDebugMessages(final PolicyEvaluationRequestCacheKey key, final String redisKey,
final List<String> keys, final List<String> values) {
<BUG>if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("Getting timestamp for policy set: '%s', key: '%s', timestamp:'%s'.",
key.getPolicySetId(), keys.get(0), values.get(0)));
</BUG>
LOGGER.debug(String.format("Getting timestamp for resource: '%s', key: '%s', timestamp:'%s'.",
| LinkedHashSet<String> policySetIds = key.getPolicySetIds();
policySetIds.forEach(policySetId -> LOGGER
policySetId, keys.get(0), values.get(0))));
|
39,833 | this.privilegeHelper.putResource(this.acsAdminRestTemplate, resource, endpoint, this.acsZone1Headers,
this.privilegeHelper.getDefaultOrgAttribute());
this.privilegeHelper.putSubject(this.acsAdminRestTemplate, subject, endpoint, this.acsZone1Headers,
this.privilegeHelper.getDefaultAttribute(), this.privilegeHelper.getDefaultOrgAttribute());
String policyFile = "src/test/resources/policies/single-org-based.json";
<BUG>this.policyHelper.setTestPolicy(this.acsAdminRestTemplate, this.acsZone1Headers, endpoint,
policyFile);</BUG>
ResponseEntity<PolicyEvaluationResult> postForEntity = this.acsAdminRestTemplate.postForEntity(
endpoint + PolicyHelper.ACS_POLICY_EVAL_API_PATH,
| this.policyHelper.setTestPolicy(this.acsAdminRestTemplate, this.acsZone1Headers, endpoint, policyFile);
|
39,834 | Assert.assertEquals(postForEntity.getStatusCode(), HttpStatus.OK);
responseBody = postForEntity.getBody();
Assert.assertEquals(responseBody.getEffect(), Effect.NOT_APPLICABLE);
}
@Test
<BUG>public void testPolicyEvalCacheWhenResourceDeleted() throws Exception {
BaseResource resource = new BaseResource("/secured-by-value/sites/sanramon");
BaseSubject subject = MARISSA_V1;</BUG>
PolicyEvaluationRequestV1 policyEvaluationRequest = this.policyHelper
| PolicyEvaluationResult responseBody = postForEntity.getBody();
Assert.assertEquals(responseBody.getEffect(), Effect.PERMIT);
this.privilegeHelper.putResource(this.acsAdminRestTemplate, resource, endpoint, this.acsZone1Headers,
this.privilegeHelper.getAlternateOrgAttribute());
postForEntity = this.acsAdminRestTemplate.postForEntity(endpoint + PolicyHelper.ACS_POLICY_EVAL_API_PATH,
new HttpEntity<>(policyEvaluationRequest, this.acsZone1Headers), PolicyEvaluationResult.class);
public void testPolicyEvalCacheWhenSubjectChanges() throws Exception {
|
39,835 | MARISSA_V1.getSubjectIdentifier(), "/v1/site/1/plant/asset/1", null);
String endpoint = this.acsUrl;
this.privilegeHelper.putSubject(this.acsAdminRestTemplate, subject, endpoint, this.acsZone1Headers,
this.privilegeHelper.getDefaultAttribute(), this.privilegeHelper.getDefaultOrgAttribute());
String policyFile = "src/test/resources/policies/multiple-attribute-uri-templates.json";
<BUG>this.policyHelper.setTestPolicy(this.acsAdminRestTemplate, this.acsZone1Headers, endpoint,
policyFile);</BUG>
ResponseEntity<PolicyEvaluationResult> postForEntity = this.acsAdminRestTemplate.postForEntity(
endpoint + PolicyHelper.ACS_POLICY_EVAL_API_PATH,
| this.policyHelper.setTestPolicy(this.acsAdminRestTemplate, this.acsZone1Headers, endpoint, policyFile);
|
39,836 | package com.ge.predix.test.utils;
import static com.ge.predix.test.utils.ACSTestUtil.ACS_VERSION;
import java.io.File;
import java.io.IOException;
import java.net.URI;
<BUG>import java.util.Collections;
import java.util.Random;</BUG>
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
| import java.util.LinkedHashSet;
import java.util.Random;
|
39,837 | public PolicyEvaluationRequestV1 createRandomEvalRequest() {
Random r = new Random(System.currentTimeMillis());
Set<Attribute> subjectAttributes = Collections.emptySet();
return this.createEvalRequest(ACTIONS[r.nextInt(4)], String.valueOf(r.nextLong()),
"/alarms/sites/" + String.valueOf(r.nextLong()), subjectAttributes);
<BUG>}
public PolicyEvaluationRequestV1 createEvalRequest(final String action, final String subjectIdentifier,</BUG>
final String resourceIdentifier, final Set<Attribute> subjectAttributes) {
PolicyEvaluationRequestV1 policyEvaluationRequest = new PolicyEvaluationRequestV1();
policyEvaluationRequest.setAction(action);
| public PolicyEvaluationRequestV1 createMultiplePolicySetsEvalRequest(final String action,
final String subjectIdentifier, final String resourceIdentifier, final Set<Attribute> subjectAttributes,
final LinkedHashSet<String> policySetIds) {
|
39,838 | b.setSubjectAttributes(
</BUG>
new HashSet<Attribute>(
Arrays.asList(
new Attribute[] {
<BUG>new Attribute("issuer", "role"),
new Attribute("issuer", "group")
})));
Assert.assertEquals(a, b);</BUG>
}
| b.setPolicySetsEvaluationOrder(EVALUATION_ORDER_P1_P2);
Assert.assertEquals(a, b);
|
39,839 | new Attribute("issuer", "role"),
new Attribute("issuer", "group")
})));
Assert.assertNotEquals(a, b);
}
<BUG>@Test
public void testHashCodeNoAttributes() {</BUG>
PolicyEvaluationRequestV1 a = new PolicyEvaluationRequestV1();
a.setSubjectIdentifier("subject");
a.setAction("GET");
| b.setPolicySetsEvaluationOrder(EVALUATION_ORDER_P1_P2);
Assert.assertEquals(a, b);
public void testEqualsThisHasNoAttributes() {
|
39,840 | b.setResourceIdentifier("/resource");
b.setSubjectAttributes(
new HashSet<Attribute>(
Arrays.asList(
new Attribute[] {
<BUG>new Attribute("issuer", "role"),
new Attribute("issuer", "group")
})));
Assert.assertEquals(a.hashCode(), b.hashCode());</BUG>
}
| Assert.assertNotEquals(a, b);
|
39,841 | new Attribute("issuer", "role"),
new Attribute("issuer", "group")
})));
Assert.assertNotEquals(a.hashCode(), b.hashCode());
}
<BUG>@Test
public void testHashCodeDifferentAttributes() {</BUG>
PolicyEvaluationRequestV1 a = new PolicyEvaluationRequestV1();
a.setSubjectIdentifier("subject");
a.setAction("GET");
| Assert.assertNotEquals(a, b);
public void testEqualsDifferentAttributes() {
|
39,842 | 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.*;
|
39,843 | .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);
|
39,844 | </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) {
|
39,845 | 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)
|
39,846 | .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))
|
39,847 | .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))
|
39,848 | @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;
|
39,849 | 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;
}
|
39,850 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
39,851 | 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.*;
|
39,852 | .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))
|
39,853 | 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) -> {
|
39,854 | 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);
|
39,855 | 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);
|
39,856 | 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() + "\"");
|
39,857 | 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() + "\"");
|
39,858 | 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
|
39,859 | .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")
|
39,860 | public DefaultGrailsCodecClass(Class<?> clazz) {
super(clazz, CODEC);
initializeCodec();</BUG>
}
<BUG>private void initializeCodec() {
Integer orderSetting = getPropertyOrStaticPropertyOrFieldValue("order", Integer.class);</BUG>
if (orderSetting != null) {
order = orderSetting;
}
if (Encoder.class.isAssignableFrom(getClazz())) {
| public void afterPropertiesSet() {
initializeCodec();
if (initialized) return;
initialized = true;
Integer orderSetting = getPropertyOrStaticPropertyOrFieldValue("order", Integer.class);
|
39,861 | if (orderSetting != null) {
order = orderSetting;
}
if (Encoder.class.isAssignableFrom(getClazz())) {
encoder = (Encoder)getReferenceInstance();
<BUG>autowireCodecBean(encoder);
if (encoder instanceof Ordered) {</BUG>
order = ((Ordered)encoder).getOrder();
}
}
| encoder = (Encoder)autowireCodecBean(encoder);
if (encoder instanceof Ordered) {
|
39,862 | order = ((Ordered)encoder).getOrder();
}
}
if (Decoder.class.isAssignableFrom(getClazz())) {
decoder = (Decoder)getReferenceInstance();
<BUG>autowireCodecBean(decoder);
if (decoder instanceof Ordered) {</BUG>
order = ((Ordered)decoder).getOrder();
}
}
| decoder = (Decoder)autowireCodecBean(decoder);
if (decoder instanceof Ordered) {
|
39,863 | return encoder;
}
public Decoder getDecoder() {
return decoder;
}
<BUG>public void setGrailsApplication(GrailsApplication grailsApplication) {
if (grailsApplication == null || grailsApplication.getFlatConfig() == null) {</BUG>
return;
}
Object htmlCodecSetting = grailsApplication.getFlatConfig().get(CONFIG_PROPERTY_GSP_HTMLCODEC);
| this.grailsApplication = grailsApplication;
public void afterPropertiesSet() {
if (grailsApplication == null || grailsApplication.getFlatConfig() == null) {
|
39,864 | vaction.setChecked(false);
form.getToolBarManager().add(haction);
form.getToolBarManager().add(vaction);
}
private static void writeRObj(String outputLoc, CorpusClass cls) throws Exception{
<BUG>String saveLocation = "\"" + outputLoc + File.separator + cls.getParent().getCorpusName() + "-" + cls.getClassName() + ".RData" + "\"";
</BUG>
String corpusLocation = cls.getTacitLocation();
File corpusDirectory = new File(corpusLocation);
String corpusClassLocation = "" ;
| String saveLocation = "\"" + outputLoc + File.separator + cls.getParent().getCorpusName().replace(" ", "_") + "-" + cls.getClassName().replace(" ", "_") + ".RData" + "\"";
|
39,865 | if(jsonFiles[i].endsWith(".json")){
corpusClassLocation = corpusLocation + File.separator + jsonFiles[i];
break;
}
}
<BUG>String corpusName = cls.getClassName();
ScriptEngineManager manager = new ScriptEngineManager();</BUG>
ScriptEngine engine = manager.getEngineByName("Renjin");
if(engine == null) {
throw new Exception("Renjin Script Engine not found on the classpath.");
| corpusName = corpusName.replace(" ", "_");
ScriptEngineManager manager = new ScriptEngineManager();
|
39,866 | JSONObject singleJsonObject = (JSONObject)arrayIterator.next();
keyIterator = keySet.iterator();
while(keyIterator.hasNext()){
key = keyIterator.next();
if(singleJsonObject.containsKey(key)){
<BUG>String data = singleJsonObject.get(key).toString();
data = data.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").trim();
</BUG>
engine.eval("data <- \"" +data.toString()+"\"");
engine.eval(key + " <- c("+key+",data)");
| data = data.toLowerCase()
.replaceAll("-", " ")
.replaceAll("[^a-z0-9. ]", "")
.replaceAll("\\s+", " ")
data = data.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").replaceAll("\\r", " ").trim();
|
39,867 | if(jsonFiles[i].endsWith(".json")){
corpusClassLocation = corpusLocation + File.separator + jsonFiles[i];
break;
}
}
<BUG>String corpusName = cls.getClassName();
</BUG>
try {
JSONParser jsonParser = new JSONParser();
JSONArray entireJsonArray = (JSONArray)jsonParser.parse(new FileReader(new File(corpusClassLocation)));
| String corpusName = cls.getClassName().replace(" ", "_");
|
39,868 | StringBuffer singleCsvEntry= new StringBuffer();
keyIterator = keySet.iterator();
while(keyIterator.hasNext()){
key = keyIterator.next();
if(singleJsonObject.containsKey(key)){
<BUG>String data = singleJsonObject.get(key).toString();
data = data.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").replaceAll(",", " ").trim();
</BUG>
singleCsvEntry.append(data + ",");
}else{
| data = data.toLowerCase()
.replaceAll("-", " ")
.replaceAll("[^a-z0-9. ]", "")
.replaceAll("\\s+", " ")
data = data.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").replaceAll(",", " ").replaceAll("\\r", " ").trim();
|
39,869 | ConsoleView.printlInConsoleln("CSV file saved at : " + saveLocation);
}
private static void writeCSVforReddit(String outputLoc, CorpusClass cls)throws Exception{
JSONParser jsonParser = new JSONParser();
RedditJsonHandler redditJsonHandler = new RedditJsonHandler();
<BUG>String saveLocation =outputLoc + File.separator + cls.getParent().getCorpusName() + "-" + cls.getClassName() + ".csv";
</BUG>
FileWriter fileWriter = new FileWriter(new File(saveLocation));
String corpusLocation = cls.getTacitLocation();
File corpusDirectory = new File(corpusLocation);
| String saveLocation =outputLoc + File.separator + cls.getParent().getCorpusName().replace(" ", "_") + "-" + cls.getClassName().replace(" ", "_") + ".csv";
|
39,870 | </BUG>
FileWriter fileWriter = new FileWriter(new File(saveLocation));
String corpusLocation = cls.getTacitLocation();
File corpusDirectory = new File(corpusLocation);
String[] jsonFiles = corpusDirectory.list();
<BUG>String corpusName = cls.getClassName();
</BUG>
try {
String singleRedditLocation = "" ;
JSONObject singleReddit = null;
| ConsoleView.printlInConsoleln("CSV file saved at : " + saveLocation);
}
private static void writeCSVforReddit(String outputLoc, CorpusClass cls)throws Exception{
JSONParser jsonParser = new JSONParser();
RedditJsonHandler redditJsonHandler = new RedditJsonHandler();
String saveLocation =outputLoc + File.separator + cls.getParent().getCorpusName().replace(" ", "_") + "-" + cls.getClassName().replace(" ", "_") + ".csv";
String corpusName = cls.getClassName().replace(" ", "_");
|
39,871 | JSONObject post = (JSONObject)singleReddit.get("post");
keyIterator = keySet.iterator();
while(keyIterator.hasNext()){
key = keyIterator.next();
if(post.containsKey(key)){
<BUG>String data = post.get(key).toString();
data = data.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").replaceAll(",", " ").trim();
</BUG>
singleCsvEntry.append(data + ",");
}else{
| data = data.toLowerCase()
.replaceAll("-", " ")
.replaceAll("[^a-z0-9. ]", "")
.replaceAll("\\s+", " ")
data = data.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").replaceAll(",", " ").replace("\\r", " ").trim();
|
39,872 | String[] redditPostComments = redditJsonHandler.getPostComments(singleReddit);
int remainingComments = maxComments;
if (redditPostComments != null){
remainingComments = maxComments - redditPostComments.length;
int commentCountStamp = 1;
<BUG>for(String redditPostComment : redditPostComments){
redditPostComment = redditPostComment.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").replaceAll(",", " ").trim();
</BUG>
singleCsvEntry.append(redditPostComment + ",");
commentCountStamp++;
| redditPostComment = redditPostComment.toLowerCase()
.replaceAll("-", " ")
.replaceAll("[^a-z0-9. ]", "")
.replaceAll("\\s+", " ")
redditPostComment = redditPostComment.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").replaceAll(",", " ").replace("\\r", " ").trim();
|
39,873 | </BUG>
String corpusLocation = cls.getTacitLocation();
File corpusDirectory = new File(corpusLocation);
String[] jsonFiles = corpusDirectory.list();
<BUG>String corpusName = cls.getClassName();
</BUG>
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("Renjin");
if(engine == null) {
throw new Exception("Renjin Script Engine not found on the classpath.");
| ConsoleView.printlInConsoleln("CSV file saved at : " + saveLocation);
}
private static void writeRObjforReddit(String outputLoc, CorpusClass cls)throws Exception{
JSONParser jsonParser = new JSONParser();
RedditJsonHandler redditJsonHandler = new RedditJsonHandler();
String saveLocation = "\"" + outputLoc + File.separator + cls.getParent().getCorpusName().replace(" ", "_") + "-" + cls.getClassName().replace(" ", "_") + ".RData" + "\"";
String corpusName = cls.getClassName().replaceAll(" ","_");
|
39,874 | JSONObject post = (JSONObject)singleReddit.get("post");
keyIterator = keySet.iterator();
while(keyIterator.hasNext()){
key = keyIterator.next();
if(post.containsKey(key)){
<BUG>String data = post.get(key).toString();
data = data.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").trim();
</BUG>
engine.eval("data <- \"" +data.toString()+"\"");
engine.eval(key + " <- c("+key+",data)");
| data = data.toLowerCase()
.replaceAll("-", " ")
.replaceAll("[^a-z0-9. ]", "")
.replaceAll("\\s+", " ")
data = data.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").replace("\\r", " ").trim();
|
39,875 | String[] redditPostComments = redditJsonHandler.getPostComments(singleReddit);
int remainingComments = maxComments;
if (redditPostComments != null){
remainingComments = maxComments - redditPostComments.length;
int commentCountStamp = 1;
<BUG>for(String redditPostComment : redditPostComments){
redditPostComment = redditPostComment.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").trim();
</BUG>
engine.eval("data <- \"" +redditPostComment+"\"");
engine.eval("comment" + commentCountStamp + " <- c(comment" + commentCountStamp + ",data)");
| redditPostComment = redditPostComment.toLowerCase()
.replaceAll("-", " ")
.replaceAll("[^a-z0-9. ]", "")
.replaceAll("\\s+", " ")
redditPostComment = redditPostComment.replaceAll("\"", " ").replaceAll("\'", " ").replaceAll("\\n", " ").replace("\\r", " ").trim();
|
39,876 | 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) {
|
39,877 | 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);
|
39,878 | processorTarget.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_EJB_INJECTION_ANNOTATION, new EjbResourceInjectionAnnotationProcessor());
processorTarget.addDeploymentProcessor(Phase.DEPENDENCIES, Phase.DEPENDENCIES_EJB, new EjbDependencyDeploymentUnitProcessor());
processorTarget.addDeploymentProcessor(Phase.POST_MODULE, Phase.POST_MODULE_EJB_HOME_MERGE, new HomeViewMergingProcessor(appclient));
processorTarget.addDeploymentProcessor(Phase.POST_MODULE, Phase.POST_MODULE_EJB_REF, new EjbRefProcessor());
processorTarget.addDeploymentProcessor(Phase.POST_MODULE, Phase.POST_MODULE_EJB_CLIENT_CONTEXT_SETUP, new EjbClientContextSetupProcessor());
<BUG>processorTarget.addDeploymentProcessor(Phase.POST_MODULE, Phase.POST_MODULE_EJB_BUSINESS_VIEW_ANNOTATION, new BusinessViewAnnotationProcessor(appclient));
processorTarget.addDeploymentProcessor(Phase.INSTALL, Phase.INSTALL_RESOLVE_EJB_INJECTIONS, new EjbInjectionResolutionProcessor());</BUG>
processorTarget.addDeploymentProcessor(Phase.CLEANUP, Phase.CLEANUP_EJB, new EjbCleanUpProcessor());
if (!appclient) {
processorTarget.addDeploymentProcessor(Phase.PARSE, Phase.PARSE_EJB_CONTEXT_BINDING, new EjbContextJndiBindingProcessor());
| processorTarget.addDeploymentProcessor(Phase.POST_MODULE, Phase.POST_MODULE_EJB_ORB_BIND, new ORBJndiBindingProcessor());
processorTarget.addDeploymentProcessor(Phase.INSTALL, Phase.INSTALL_RESOLVE_EJB_INJECTIONS, new EjbInjectionResolutionProcessor());
|
39,879 | import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
import org.jboss.as.server.deployment.DeploymentUnitProcessor;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
import org.omg.CORBA.ORB;
<BUG>public class ORBJndiBindingProcessor implements DeploymentUnitProcessor{
</BUG>
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
| public class ORBJndiBindingProcessor implements DeploymentUnitProcessor {
|
39,880 | return new CommentViewHolder(view, fragment.getActivity(), (ICommentableFragment) fragment);
} else if (viewType == GiveawayDetailsCard.VIEW_LAYOUT) {
return new GiveawayCardViewHolder(view, (GiveawayDetailFragment) fragment);
} else if (viewType == DiscussionDetailsCard.VIEW_LAYOUT) {
return new DiscussionCardViewHolder(view, (DiscussionDetailFragment) fragment, fragment.getContext());
<BUG>} else if (viewType == TradeDetailsCard.VIEW_LAYOUT) {
return new TradeCardViewHolder(view, (TradeDetailFragment) fragment, fragment.getContext());</BUG>
} else if (viewType == CommentContextViewHolder.VIEW_LAYOUT) {
return new CommentContextViewHolder(view, fragment.getActivity());
} else if (viewType == Poll.Header.VIEW_LAYOUT) {
| [DELETED] |
39,881 | GiveawayDetailsCard card = (GiveawayDetailsCard) getItem(position);
holder.setFrom(card);
} else if (h instanceof DiscussionCardViewHolder) {
DiscussionCardViewHolder holder = (DiscussionCardViewHolder) h;
DiscussionDetailsCard card = (DiscussionDetailsCard) getItem(position);
<BUG>holder.setFrom(card);
} else if (h instanceof TradeCardViewHolder) {
TradeCardViewHolder holder = (TradeCardViewHolder) h;
TradeDetailsCard card = (TradeDetailsCard) getItem(position);</BUG>
holder.setFrom(card);
| [DELETED] |
39,882 | setContentView(R.layout.activity_one_fragment);
if (savedInstanceState == null)
loadFragment(DiscussionDetailFragment.newInstance((BasicDiscussion) serializable, commentContext));
return;
}
<BUG>serializable = getIntent().getSerializableExtra(TradeDetailFragment.ARG_TRADE);
if (serializable != null) {
setContentView(R.layout.activity_one_fragment);
if (savedInstanceState == null)
loadFragment(TradeDetailFragment.newInstance((BasicTrade) serializable, commentContext));
return;
}</BUG>
String user = getIntent().getStringExtra(UserDetailFragment.ARG_USER);
| [DELETED] |
39,883 | params.width = commentMarker.getLayoutParams().width * Math.min(MAX_VISIBLE_DEPTH, comment.getDepth());
commentIndent.setLayoutParams(params);
Picasso.with(context).load(comment.getAvatar()).placeholder(R.drawable.default_avatar_mask).transform(new RoundedCornersTransformation(20, 0)).into(commentImage);
View.OnClickListener viewProfileListener = comment.isDeleted() ? null : new View.OnClickListener() {
@Override
<BUG>public void onClick(View v) {
fragment.showProfile(comment.getAuthor());</BUG>
}
};
commentImage.setOnClickListener(viewProfileListener);
| if(comment instanceof TradeComment)
fragment.showProfile(((TradeComment) comment).getSteamID64());
else
fragment.showProfile(comment.getAuthor());
|
39,884 | return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
<BUG>final CharSequence[] strings = new CharSequence[]{getString(R.string.go_to_giveaway), getString(R.string.go_to_discussion), getString(R.string.go_to_user), getString(R.string.go_to_trade)};
AlertDialog.Builder builder = new AlertDialog.Builder(this);</BUG>
builder.setTitle(R.string.go_to);
builder.setItems(strings, new DialogInterface.OnClickListener() {
@Override
| final CharSequence[] strings = new CharSequence[]{getString(R.string.go_to_giveaway), getString(R.string.go_to_discussion), getString(R.string.go_to_user)};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
39,885 | intent.putExtra(DiscussionDetailFragment.ARG_DISCUSSION, new BasicDiscussion(target));
break;
case 2:
intent.putExtra(UserDetailFragment.ARG_USER, target);
break;
<BUG>case 3:
intent.putExtra(TradeDetailFragment.ARG_TRADE, new BasicTrade(target));
break;</BUG>
}
startActivity(intent);
| [DELETED] |
39,886 | package org.apache.ambari.server.upgrade;
import com.google.inject.Guice;
<BUG>import com.google.inject.Injector;
import com.google.inject.Provider;
import com.google.inject.persist.PersistService;
import junit.framework.Assert;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.orm.DBAccessor;</BUG>
import org.apache.ambari.server.orm.GuiceJpaInitializer;
| import com.google.inject.Binder;
import com.google.inject.Module;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.orm.DBAccessor;
|
39,887 | public class UpgradeCatalog240Test {
private Injector injector;
</BUG>
private Provider<EntityManager> entityManagerProvider = createStrictMock(Provider.class);
private EntityManager entityManager = createNiceMock(EntityManager.class);
<BUG>private UpgradeCatalogHelper upgradeCatalogHelper;
private StackEntity desiredStackEntity;
@Before</BUG>
public void init() {
reset(entityManagerProvider);
| private static Injector injector;
@BeforeClass
public static void classSetUp() {
injector = Guice.createInjector(new InMemoryDefaultTestModule());
injector.getInstance(GuiceJpaInitializer.class);
}
@Before
|
39,888 | }
@Test
public void test_addParam_ParamsAvailableWithOneOFNeededItem() {
UpgradeCatalog240 upgradeCatalog240 = new UpgradeCatalog240(injector);
String inputSource = "{\"path\":\"test_path\",\"type\":\"SCRIPT\",\"parameters\":[{\"name\":\"connection.timeout\",\"display_name\":\"Connection Timeout\",\"value\":5.0,\"type\":\"NUMERIC\",\"description\":\"The maximum time before this alert is considered to be CRITICAL\",\"units\":\"seconds\",\"threshold\":\"CRITICAL\"}]}";
<BUG>List<String> params = new ArrayList<String>(Arrays.asList("connection.timeout", "checkpoint.time.warning.threshold", "checkpoint.time.critical.threshold"));
String expectedSource = "{\"path\":\"test_path\",\"type\":\"SCRIPT\",\"parameters\":[{\"name\":\"connection.timeout\",\"display_name\":\"Connection Timeout\",\"value\":5.0,\"type\":\"NUMERIC\",\"description\":\"The maximum time before this alert is considered to be CRITICAL\",\"units\":\"seconds\",\"threshold\":\"CRITICAL\"},{\"name\":\"checkpoint.time.warning.threshold\",\"display_name\":\"Checkpoint Warning\",\"value\":2.0,\"type\":\"PERCENT\",\"description\":\"The percentage of the last checkpoint time greater than the interval in order to trigger a warning alert.\",\"units\":\"%\",\"threshold\":\"WARNING\"},{\"name\":\"checkpoint.time.critical.threshold\",\"display_name\":\"Checkpoint Critical\",\"value\":2.0,\"type\":\"PERCENT\",\"description\":\"The percentage of the last checkpoint time greater than the interval in order to trigger a critical alert.\",\"units\":\"%\",\"threshold\":\"CRITICAL\"}]}";</BUG>
String result = upgradeCatalog240.addParam(inputSource, params);
Assert.assertEquals(result, expectedSource);
}
| public void test_addParam_ParamsNotAvailable() {
String inputSource = "{ \"path\" : \"test_path\", \"type\" : \"SCRIPT\"}";
List<String> params = Arrays.asList("connection.timeout", "checkpoint.time.warning.threshold", "checkpoint.time.critical.threshold");
String expectedSource = "{\"path\":\"test_path\",\"type\":\"SCRIPT\",\"parameters\":[{\"name\":\"connection.timeout\",\"display_name\":\"Connection Timeout\",\"value\":5.0,\"type\":\"NUMERIC\",\"description\":\"The maximum time before this alert is considered to be CRITICAL\",\"units\":\"seconds\",\"threshold\":\"CRITICAL\"},{\"name\":\"checkpoint.time.warning.threshold\",\"display_name\":\"Checkpoint Warning\",\"value\":2.0,\"type\":\"PERCENT\",\"description\":\"The percentage of the last checkpoint time greater than the interval in order to trigger a warning alert.\",\"units\":\"%\",\"threshold\":\"WARNING\"},{\"name\":\"checkpoint.time.critical.threshold\",\"display_name\":\"Checkpoint Critical\",\"value\":2.0,\"type\":\"PERCENT\",\"description\":\"The percentage of the last checkpoint time greater than the interval in order to trigger a critical alert.\",\"units\":\"%\",\"threshold\":\"CRITICAL\"}]}";
|
39,889 | import com.google.inject.Injector;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.AmbariManagementController;
import org.apache.ambari.server.orm.DBAccessor;
import org.apache.ambari.server.orm.dao.AlertDefinitionDAO;
<BUG>import org.apache.ambari.server.orm.dao.DaoUtils;
import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;</BUG>
import org.apache.ambari.server.orm.entities.PermissionEntity;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
| import org.apache.ambari.server.orm.dao.PermissionDAO;
import org.apache.ambari.server.orm.dao.ResourceTypeDAO;
import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
|
39,890 | private static final Logger LOG = LoggerFactory.getLogger(UpgradeCatalog240.class);
@Inject</BUG>
public UpgradeCatalog240(Injector injector) {
super(injector);
<BUG>this.injector = injector;
}</BUG>
@Override
public String getTargetVersion() {
return "2.4.0";
}
| private static final String ID = "id";
private static final String SETTING_TABLE = "setting";
@Inject
injector.injectMembers(this);
|
39,891 | public String getSourceVersion() {
return "2.3.0";
}
@Override
protected void executeDDLUpdates() throws AmbariException, SQLException {
<BUG>updateAdminPermissionTable();
}</BUG>
@Override
protected void executePreDMLUpdates() throws AmbariException, SQLException {
}
| createSettingTable();
|
39,892 | import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
<BUG>import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity;</BUG>
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.ContextMenu;
| import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
|
39,893 | import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
<BUG>import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity;</BUG>
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.ContextMenu;
| import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
|
39,894 | import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.preference.PreferenceManager;
<BUG>import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.Toolbar;</BUG>
import android.util.Log;
import android.view.ContextMenu;
import android.view.KeyEvent;
| import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.Toolbar;
|
39,895 | mAltitude.setOnCheckedChangeListener(mCheckedChangeListener);
mDistance.setOnCheckedChangeListener(mCheckedChangeListener);
mCompass.setOnCheckedChangeListener(mCheckedChangeListener);
mLocation.setOnCheckedChangeListener(mCheckedChangeListener);
builder.setTitle(R.string.dialog_layer_title).setIcon(android.R.drawable.ic_dialog_map).setPositiveButton
<BUG>(R.string.btn_okay, null).setView(view);
</BUG>
dialog = builder.create();
return dialog;
case DIALOG_NOTRACK:
| (android.R.string.ok, null).setView(view);
|
39,896 | 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.*;
|
39,897 | .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);
|
39,898 | </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) {
|
39,899 | 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)
|
39,900 | .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))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.