id
int64 1
49k
| buggy
stringlengths 34
37.5k
| fixed
stringlengths 2
37k
|
---|---|---|
601 | new TraceCappedDatabaseStats(traceCappedDatabase),
"org.glowroot:type=TraceCappedDatabase");
platformMBeanServerLifecycle.lazyRegisterMBean(new H2DatabaseStats(dataSource),
"org.glowroot:type=H2Database");
}
<BUG>public AgentDao getAgentDao() {
return agentDao;
</BUG>
}
public TransactionTypeRepository getTransactionTypeRepository() {
| public EnvironmentDao getEnvironmentDao() {
return environmentDao;
|
602 | package org.glowroot.agent.embedded.init;
import java.io.Closeable;
import java.io.File;
<BUG>import java.lang.instrument.Instrumentation;
import java.util.Map;</BUG>
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
| import java.util.List;
import java.util.Map;
|
603 | import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nullable;
import com.google.common.base.MoreObjects;
import com.google.common.base.Stopwatch;
import com.google.common.base.Supplier;
<BUG>import com.google.common.base.Ticker;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;</BUG>
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.glowroot.agent.collector.Collector.AgentConfigUpdater;
| import com.google.common.collect.ImmutableList;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
604 | import org.glowroot.agent.init.EnvironmentCreator;
import org.glowroot.agent.init.GlowrootThinAgentInit;
import org.glowroot.agent.init.JRebelWorkaround;
import org.glowroot.agent.util.LazyPlatformMBeanServer;
import org.glowroot.common.live.LiveAggregateRepository.LiveAggregateRepositoryNop;
<BUG>import org.glowroot.common.live.LiveTraceRepository.LiveTraceRepositoryNop;
import org.glowroot.common.repo.ConfigRepository;
import org.glowroot.common.util.Clock;</BUG>
import org.glowroot.common.util.OnlyUsedByTests;
import org.glowroot.ui.CreateUiModuleBuilder;
| import org.glowroot.common.repo.AgentRepository;
import org.glowroot.common.repo.ImmutableAgentRollup;
import org.glowroot.common.util.Clock;
|
605 | SimpleRepoModule simpleRepoModule = new SimpleRepoModule(dataSource,
dataDir, clock, ticker, configRepository, backgroundExecutor);
simpleRepoModule.registerMBeans(new PlatformMBeanServerLifecycleImpl(
agentModule.getLazyPlatformMBeanServer()));
CollectorImpl collectorImpl = new CollectorImpl(
<BUG>simpleRepoModule.getAgentDao(), simpleRepoModule.getAggregateDao(),
simpleRepoModule.getTraceDao(),</BUG>
simpleRepoModule.getGaugeValueDao());
collectorProxy.setInstance(collectorImpl);
collectorImpl.init(baseDir, EnvironmentCreator.create(glowrootVersion),
| simpleRepoModule.getEnvironmentDao(),
simpleRepoModule.getTraceDao(),
|
606 | .baseDir(baseDir)
.glowrootDir(glowrootDir)
.ticker(ticker)
.clock(clock)
.liveJvmService(agentModule.getLiveJvmService())
<BUG>.configRepository(simpleRepoModule.getConfigRepository())
.agentRepository(simpleRepoModule.getAgentDao())
</BUG>
.transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository())
.traceAttributeNameRepository(
| .agentRepository(new AgentRepositoryImpl())
.environmentRepository(simpleRepoModule.getEnvironmentDao())
|
607 | .baseDir(baseDir)
.glowrootDir(glowrootDir)
.ticker(ticker)
.clock(clock)
.liveJvmService(null)
<BUG>.configRepository(simpleRepoModule.getConfigRepository())
.agentRepository(simpleRepoModule.getAgentDao())
</BUG>
.transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository())
.traceAttributeNameRepository(
| .liveJvmService(agentModule.getLiveJvmService())
.agentRepository(new AgentRepositoryImpl())
.environmentRepository(simpleRepoModule.getEnvironmentDao())
|
608 | }
@Override
public void lazyRegisterMBean(Object object, String name) {
lazyPlatformMBeanServer.lazyRegisterMBean(object, name);
}
<BUG>}
}
</BUG>
| void initEmbeddedServer() throws Exception {
if (simpleRepoModule == null) {
return;
|
609 | List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs());
for (GaugeConfig loopConfig : configs) {
if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) {
throw new DuplicateMBeanObjectNameException();
}
<BUG>}
String version = Versions.getVersion(gaugeConfig);
for (GaugeConfig loopConfig : configs) {
if (Versions.getVersion(loopConfig.toProto()).equals(version)) {
throw new IllegalStateException("This exact gauge already exists");
}
}
configs.add(GaugeConfig.create(gaugeConfig));</BUG>
configService.updateGaugeConfigs(configs);
| [DELETED] |
610 | configService.updateGaugeConfigs(configs);
}
}
@Override
public void updateGaugeConfig(String agentId, AgentConfig.GaugeConfig gaugeConfig,
<BUG>String priorVersion) throws Exception {
synchronized (writeLock) {</BUG>
List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs());
boolean found = false;
for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
| GaugeConfig config = GaugeConfig.create(gaugeConfig);
synchronized (writeLock) {
|
611 | boolean found = false;
for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
GaugeConfig loopConfig = i.next();
String loopVersion = Versions.getVersion(loopConfig.toProto());
if (loopVersion.equals(priorVersion)) {
<BUG>i.set(GaugeConfig.create(gaugeConfig));
found = true;
break;</BUG>
} else if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) {
throw new DuplicateMBeanObjectNameException();
| i.set(config);
|
612 | boolean found = false;
for (ListIterator<PluginConfig> i = configs.listIterator(); i.hasNext();) {
PluginConfig loopPluginConfig = i.next();
if (pluginId.equals(loopPluginConfig.id())) {
String loopVersion = Versions.getVersion(loopPluginConfig.toProto());
<BUG>checkVersionsEqual(loopVersion, priorVersion);
PluginDescriptor pluginDescriptor = getPluginDescriptor(pluginId);
i.set(PluginConfig.create(pluginDescriptor, properties));</BUG>
found = true;
break;
| for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
GaugeConfig loopConfig = i.next();
String loopVersion = Versions.getVersion(loopConfig.toProto());
if (loopVersion.equals(version)) {
i.remove();
|
613 | boolean found = false;
for (ListIterator<InstrumentationConfig> i = configs.listIterator(); i.hasNext();) {
InstrumentationConfig loopConfig = i.next();
String loopVersion = Versions.getVersion(loopConfig.toProto());
if (loopVersion.equals(priorVersion)) {
<BUG>i.set(InstrumentationConfig.create(instrumentationConfig));
found = true;
break;
}</BUG>
}
| i.set(config);
} else if (loopConfig.equals(config)) {
throw new IllegalStateException("This exact instrumentation already exists");
|
614 | package org.glowroot.agent.embedded.init;
import java.io.File;
import java.util.List;
import org.glowroot.agent.collector.Collector;
<BUG>import org.glowroot.agent.embedded.repo.AgentDao;
import org.glowroot.agent.embedded.repo.AggregateDao;
import org.glowroot.agent.embedded.repo.GaugeValueDao;</BUG>
import org.glowroot.agent.embedded.repo.TraceDao;
import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
| import org.glowroot.agent.embedded.repo.EnvironmentDao;
import org.glowroot.agent.embedded.repo.GaugeValueDao;
|
615 | </BUG>
private final AggregateDao aggregateDao;
private final TraceDao traceDao;
private final GaugeValueDao gaugeValueDao;
<BUG>CollectorImpl(AgentDao agentDao, AggregateDao aggregateRepository, TraceDao traceRepository,
GaugeValueDao gaugeValueRepository) {
this.agentDao = agentDao;</BUG>
this.aggregateDao = aggregateRepository;
this.traceDao = traceRepository;
| import org.glowroot.wire.api.model.CollectorServiceOuterClass.Environment;
import org.glowroot.wire.api.model.CollectorServiceOuterClass.GaugeValue;
import org.glowroot.wire.api.model.CollectorServiceOuterClass.LogEvent;
import org.glowroot.wire.api.model.TraceOuterClass.Trace;
class CollectorImpl implements Collector {
private final EnvironmentDao agentDao;
CollectorImpl(EnvironmentDao agentDao, AggregateDao aggregateRepository,
TraceDao traceRepository, GaugeValueDao gaugeValueRepository) {
this.agentDao = agentDao;
|
616 | public Map getControlInfoMap() {
return controlInfoMap;
}
public Map getRepeatControlInfoMap() {
return (Map) controlTypes.get("repeat");
<BUG>}
public Element getLabelElement(String prefixeId) {</BUG>
return (Element) labelsMap.get(prefixeId);
}
public Element getHelpElement(String prefixeId) {
| public Element getControlElement(String prefixeId) {
return ((XFormsStaticState.ControlInfo) controlInfoMap.get(prefixeId)).getElement();
public Element getLabelElement(String prefixeId) {
|
617 | package org.orbeon.oxf.xforms.processor.handlers;
import org.apache.commons.lang.StringUtils;
import org.dom4j.QName;
import org.dom4j.Element;
<BUG>import org.orbeon.oxf.xforms.XFormsConstants;
import org.orbeon.oxf.xforms.control.XFormsControl;</BUG>
import org.orbeon.oxf.xforms.control.XFormsSingleNodeControl;
import org.orbeon.oxf.xml.ContentHandlerHelper;
import org.orbeon.oxf.xml.XMLConstants;
| import org.orbeon.oxf.xforms.XFormsStaticState;
import org.orbeon.oxf.xforms.control.XFormsControl;
|
618 | package com.projecttango.examples.java.augmentedreality;
import com.google.atap.tangoservice.Tango;
import com.google.atap.tangoservice.Tango.OnTangoUpdateListener;
import com.google.atap.tangoservice.TangoCameraIntrinsics;
import com.google.atap.tangoservice.TangoConfig;
<BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoEvent;</BUG>
import com.google.atap.tangoservice.TangoOutOfDateException;
import com.google.atap.tangoservice.TangoPoseData;
import com.google.atap.tangoservice.TangoXyzIjData;
| import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
|
619 | super.onResume();
if (!mIsConnected) {
mTango = new Tango(AugmentedRealityActivity.this, new Runnable() {
@Override
public void run() {
<BUG>try {
connectTango();</BUG>
setupRenderer();
mIsConnected = true;
} catch (TangoOutOfDateException e) {
| TangoSupport.initialize();
connectTango();
|
620 | if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) {
mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics);
mCameraPoseTimestamp = lastFramePose.timestamp;</BUG>
} else {
<BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread);
}</BUG>
}
}
}
@Override
| mRenderer.updateRenderCameraPose(lastFramePose);
mCameraPoseTimestamp = lastFramePose.timestamp;
Log.w(TAG, "Can't get device pose at time: " +
|
621 | import org.rajawali3d.materials.Material;
import org.rajawali3d.materials.methods.DiffuseMethod;
import org.rajawali3d.materials.textures.ATexture;
import org.rajawali3d.materials.textures.StreamingTexture;
import org.rajawali3d.materials.textures.Texture;
<BUG>import org.rajawali3d.math.Matrix4;
import org.rajawali3d.math.vector.Vector3;</BUG>
import org.rajawali3d.primitives.ScreenQuad;
import org.rajawali3d.primitives.Sphere;
import org.rajawali3d.renderer.RajawaliRenderer;
| import org.rajawali3d.math.Quaternion;
import org.rajawali3d.math.vector.Vector3;
|
622 | translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE);
translationMoon.setTransformable3D(moon);
getCurrentScene().registerAnimation(translationMoon);
translationMoon.play();
}
<BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) {
Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics);
getCurrentCamera().setRotation(cameraPose.getOrientation());
getCurrentCamera().setPosition(cameraPose.getPosition());
}</BUG>
public int getTextureId() {
| public void updateRenderCameraPose(TangoPoseData cameraPose) {
float[] rotation = cameraPose.getRotationAsFloats();
float[] translation = cameraPose.getTranslationAsFloats();
Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]);
getCurrentCamera().setRotation(quaternion.conjugate());
getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
|
623 | package com.projecttango.examples.java.helloareadescription;
import com.google.atap.tangoservice.Tango;
<BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener;
import com.google.atap.tangoservice.TangoConfig;</BUG>
import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
| import com.google.atap.tangoservice.TangoAreaDescriptionMetaData;
import com.google.atap.tangoservice.TangoConfig;
|
624 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
625 | }
@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);
|
626 | 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);
|
627 | 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(
|
628 | 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 {
|
629 | 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;
|
630 | 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) {
|
631 | 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;
|
632 | import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.mps.openapi.module.ModelAccess;
import org.jetbrains.mps.openapi.module.SRepositoryContentAdapter;
import org.jetbrains.mps.openapi.module.SRepositoryListener;
import javax.swing.tree.DefaultTreeModel;
<BUG>import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;</BUG>
public class SModelNodeListeners {
| import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
|
633 | public class SModelNodeListeners {
private final ModelChangeListener myModelChangeListener;
private final SRepositoryListener myRepositoryListener;
private final MyGenerationStatusListener myGenStatusListener;
private EventsCollector myEventsListener;
<BUG>private final ConcurrentHashMap<SModelReference, SModelTreeNode> myTreeNodes = new ConcurrentHashMap<SModelReference, SModelTreeNode>();
private final TreeUpdateVisitor[] myUpdates; // shall be CompositeVisitor, but I'm lazy for that</BUG>
public SModelNodeListeners(TreeUpdateVisitor genStatusUpdate, TreeUpdateVisitor errorVisitor, TreeUpdateVisitor modifiedMarker) {
myUpdates = new TreeUpdateVisitor[3];
myUpdates[0] = genStatusUpdate;
| private final Map<SModelReference, Collection<SModelTreeNode>> myTreeNodes = new HashMap<SModelReference, Collection<SModelTreeNode>>();
private final TreeUpdateVisitor[] myUpdates; // shall be CompositeVisitor, but I'm lazy for that
|
634 | ((SModelInternal) model).removeModelListener(myModelChangeListener);
myTreeNodes.remove(model.getReference());
}</BUG>
}
void refreshAffectedTreeNodes(SModel changed) {
<BUG>final SModelTreeNode treeNode = findTreeNode(changed);
if (treeNode != null) {</BUG>
refreshTreeNodes(treeNode);
}
| for (SModelTreeNode treeNode : findTreeNode(changed)) {
|
635 | }
MySNodeTreeUpdater treeUpdater = new MySNodeTreeUpdater(treeNode.getOperationContext().getProject(), treeNode);
</BUG>
treeUpdater.setDependencyRecorder(treeNode.getDependencyRecorder());
<BUG>treeUpdater.eventsHappenedInCommand(new ArrayList<SModelEvent>(byModel.get(m)));
}</BUG>
}
}
private static class SRepositoryListenerPlug implements Runnable {
private final boolean myIsAttach;
| for (SModel m : byModel.keySet()) {
for (SModelTreeNode treeNode : findTreeNode(m)) {
TreeStructureUpdate treeUpdater = new TreeStructureUpdate(treeNode.getOperationContext().getProject(), treeNode);
|
636 | import com.intellij.openapi.project.DumbService;
import jetbrains.mps.extapi.model.GeneratableSModel;
import jetbrains.mps.generator.ModelGenerationStatusManager;
import jetbrains.mps.ide.project.ProjectHelper;
import jetbrains.mps.ide.projectPane.ProjectPane;
<BUG>import jetbrains.mps.ide.projectPane.logicalview.highlighting.visitor.updates.GenStatusNodeUpdate;
</BUG>
import jetbrains.mps.ide.ui.tree.module.ProjectModuleTreeNode;
import jetbrains.mps.ide.ui.tree.smodel.SModelTreeNode;
import jetbrains.mps.make.IMakeService;
| import jetbrains.mps.ide.projectPane.logicalview.highlighting.visitor.updates.AdditionalTextNodeUpdate;
|
637 | if (!(md instanceof GeneratableSModel) || !(((GeneratableSModel) md).isGeneratable())) return;
if (md.getModule() == null) return;
final ProjectModuleTreeNode moduleNode = getContainingModuleNode(modelNode);
boolean wasChanged = ((EditableSModel) md).isChanged();
if (moduleNode.getModule().isReadOnly()) {
<BUG>addUpdate(modelNode, new GenStatusNodeUpdate(GenerationStatus.READONLY.getMessage()));
addUpdate(moduleNode, new GenStatusNodeUpdate(GenerationStatus.READONLY.getMessage()));
</BUG>
return;
| addUpdate(modelNode, new AdditionalTextNodeUpdate(GenerationStatus.READONLY.getMessage()));
addUpdate(moduleNode, new AdditionalTextNodeUpdate(GenerationStatus.READONLY.getMessage()));
|
638 | });
updateModuleStatus(moduleNode);
if (moduleNode.getModule() instanceof Generator) {
updateModuleStatus(getContainingModuleNode(moduleNode));
}
<BUG>addUpdate(modelNode, new GenStatusNodeUpdate(modelStatus.getMessage()));
</BUG>
}
private void updateModuleStatus(final ProjectModuleTreeNode moduleNode) {
if (moduleNode == null) return;
| addUpdate(modelNode, new AdditionalTextNodeUpdate(modelStatus.getMessage()));
|
639 | @Override
public GenerationStatus compute() {
return generationRequired(moduleNode);
}
});
<BUG>addUpdate(moduleNode, new GenStatusNodeUpdate(moduleStatus.getMessage()));
</BUG>
}
private boolean generationRequired(SModule module) {
if (!(module instanceof AbstractModule)) return false;
| addUpdate(moduleNode, new AdditionalTextNodeUpdate(moduleStatus.getMessage()));
|
640 | package ntut.csie.ezScrum.web.action.retrospective;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<BUG>import ntut.csie.ezScrum.issue.core.IIssue;
import ntut.csie.ezScrum.pic.core.IUserSession;
import ntut.csie.ezScrum.web.action.PermissionAction;
import ntut.csie.ezScrum.web.dataObject.ProjectObject;
import ntut.csie.ezScrum.web.helper.RetrospectiveHelper;</BUG>
import ntut.csie.ezScrum.web.support.SessionManager;
| import ntut.csie.ezScrum.web.dataInfo.RetrospectiveInfo;
import ntut.csie.ezScrum.web.dataObject.RetrospectiveObject;
import ntut.csie.ezScrum.web.helper.RetrospectiveHelper;
|
641 | import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class GetAddNewRetrospectiveInfoAction extends Action {
<BUG>private static Log log = LogFactory
.getLog(GetAddNewRetrospectiveInfoAction.class);</BUG>
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ProjectObject project = SessionManager.getProjectObject(request);
| [DELETED] |
642 | Date today = new Date();
sb.append("<Sprints>");
for (SprintObject sprint : sprints) {
sb.append("<Sprint>");
sb.append("<Id>" + String.valueOf(sprint.getId()) + "</Id>");
<BUG>sb.append("<Name>Sprint #" + String.valueOf(sprint.getId())
+ "</Name>");</BUG>
String startDateString = sprint.getStartDateString();
Date startDate = DateUtil.dayFilter(startDateString);
| sb.append("<Name>Sprint #" + String.valueOf(sprint.getId()) + "</Name>");
|
643 | package ntut.csie.ezScrum.web.action.retrospective;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<BUG>import ntut.csie.ezScrum.issue.core.IIssue;
import ntut.csie.ezScrum.pic.core.IUserSession;
import ntut.csie.ezScrum.web.action.PermissionAction;
import ntut.csie.ezScrum.web.dataObject.ProjectObject;
import ntut.csie.ezScrum.web.helper.RetrospectiveHelper;</BUG>
import ntut.csie.ezScrum.web.support.SessionManager;
| import ntut.csie.ezScrum.web.dataInfo.RetrospectiveInfo;
import ntut.csie.ezScrum.web.dataObject.RetrospectiveObject;
import ntut.csie.ezScrum.web.helper.RetrospectiveHelper;
|
644 | import ntut.csie.ezScrum.web.dataObject.SprintObject;
import ntut.csie.ezScrum.web.helper.SprintPlanHelper;
import ntut.csie.ezScrum.web.support.SessionManager;
import ntut.csie.ezScrum.web.support.TranslateSpecialChar;
import ntut.csie.jcis.core.util.DateUtil;
<BUG>import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;</BUG>
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
| [DELETED] |
645 | import org.apache.commons.logging.LogFactory;</BUG>
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
<BUG>public class GetPastRetrospectiveInfoAction extends Action {
private static Log log = LogFactory
.getLog(GetAddNewRetrospectiveInfoAction.class);
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {</BUG>
ProjectObject project = SessionManager.getProjectObject(request);
| import ntut.csie.ezScrum.web.dataObject.SprintObject;
import ntut.csie.ezScrum.web.helper.SprintPlanHelper;
import ntut.csie.ezScrum.web.support.SessionManager;
import ntut.csie.ezScrum.web.support.TranslateSpecialChar;
import ntut.csie.jcis.core.util.DateUtil;
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
|
646 | boolean start = startDate.after(today);
if (start == true) {
continue;
}
stringBuilder.append("<Sprint>");
<BUG>stringBuilder.append("<Id>" + String.valueOf(sprint.getId())
+ "</Id>");
stringBuilder.append("<Name>Sprint #"
+ String.valueOf(sprint.getId()) + "</Name>");</BUG>
stringBuilder.append("<Start>");
| stringBuilder.append("<Id>" + String.valueOf(sprint.getId()) + "</Id>");
stringBuilder.append("<Name>Sprint #" + String.valueOf(sprint.getId()) + "</Name>");
|
647 | Date transToday_Date = DateUtil.dayFilter(transToday_String); // 將今日轉成與
stringBuilder.append("<Edit>");
boolean end = transToday_Date.after(endDate); // 今日 (before &&
stringBuilder.append((!end ? "1" : "0")); // 因為是用 after 所以要多加
stringBuilder.append("</Edit>");
<BUG>stringBuilder.append("<Goal>");
stringBuilder.append(translateSpecialChar
.TranslateXMLChar(sprint.getGoal()));</BUG>
stringBuilder.append("</Goal>");
stringBuilder.append("</Sprint>");
| stringBuilder.append(translateSpecialChar.TranslateXMLChar(sprint.getGoal()));
|
648 | package ntut.csie.ezScrum.web.action.retrospective;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
<BUG>import ntut.csie.ezScrum.pic.core.ScrumRole;
import ntut.csie.jcis.resource.core.IProject;</BUG>
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
| import ntut.csie.ezScrum.web.dataObject.ProjectObject;
import ntut.csie.jcis.resource.core.IProject;
|
649 | if (sprintId == null || sprintId.isEmpty()) {
if (currentSprint != null) {
sprintId = Long.toString(currentSprint.getId());
}
}
<BUG>try {
return (new RetrospectiveHelper(project, session))
.getListXML(sprintId);</BUG>
} catch (SQLException e) {
return new StringBuilder("error");
| return (new RetrospectiveHelper(project)).getListXML(sprintId);
|
650 | }else{
classBuilder.constructorModifiers(PRIVATE);
classBuilder.annotations(makeAtAlias(model.getExtendedType()));
}
}
<BUG>if (def instanceof Tree.AnyInterface) {
ProducedType type = model.getType().getQualifyingType();</BUG>
while (type != null) {
java.util.List<TypeParameter> typeArguments = type.getDeclaration().getTypeParameters();
if (typeArguments == null) {
| if(def instanceof Tree.InterfaceDefinition){
ProducedType type = model.getType().getQualifyingType();
|
651 | classBuilder.typeParameter(typeArgument);
}
type = type.getQualifyingType();
}
classBuilder.defs(makeCompanionAccessor((Interface)model, model.getType(), false));
<BUG>buildCompanion(def, (Interface)model, classBuilder);
}</BUG>
CeylonVisitor visitor = gen().visitor;
final ListBuffer<JCTree> prevDefs = visitor.defs;
final boolean prevInInitializer = visitor.inInitializer;
| }else{
classBuilder.annotations(makeAtAlias(model.getExtendedType()));
|
652 | private int transformClassDeclFlags(ClassOrInterface cdecl) {
int result = 0;
result |= Decl.isShared(cdecl) ? PUBLIC : 0;
result |= cdecl.isAbstract() && (cdecl instanceof Class) ? ABSTRACT : 0;
result |= (cdecl instanceof Interface) ? INTERFACE : 0;
<BUG>result |= cdecl.isAlias() ? FINAL : 0;
return result;</BUG>
}
private int transformClassDeclFlags(Tree.ClassOrInterface cdecl) {
return transformClassDeclFlags(cdecl.getDeclarationModel());
| result |= cdecl.isAlias() && (cdecl instanceof Class) ? FINAL : 0;
return result;
|
653 | context.setAuthCache(authCache);
ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpclient, context);
ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build();
client.register(JacksonJaxbJsonProvider.class);
client.register(JacksonObjectMapperProvider.class);
<BUG>client.register(RequestLogger.class);
client.register(ResponseLogger.class);
</BUG>
ProxyBuilder<T> proxyBuilder = client.target(uri).proxyBuilder(apiClassType);
| client.register(RestRequestFilter.class);
client.register(RestResponseFilter.class);
|
654 | import org.hawkular.alerts.api.model.condition.Condition;
import org.hawkular.inventory.api.model.CanonicalPath;
import org.hawkular.inventory.api.model.Tenant;
import org.hawkular.inventory.json.DetypedPathDeserializer;
import org.hawkular.inventory.json.InventoryJacksonConfig;
<BUG>import org.hawkular.inventory.json.mixins.CanonicalPathMixin;
</BUG>
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonParseException;
| import org.hawkular.inventory.json.mixins.model.CanonicalPathMixin;
|
655 | 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);
}
|
656 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
657 | }
@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);
|
658 | 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);
|
659 | 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(
|
660 | 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 {
|
661 | 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;
|
662 | 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) {
|
663 | 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;
|
664 | private final Set<ConfigListener> pluginConfigListeners = Sets.newCopyOnWriteArraySet();
private volatile TransactionConfig transactionConfig;
private volatile UiConfig uiConfig;
private volatile UserRecordingConfig userRecordingConfig;
private volatile AdvancedConfig advancedConfig;
<BUG>private volatile ImmutableList<GaugeConfig> gaugeConfigs;
private volatile ImmutableList<AlertConfig> alertConfigs;</BUG>
private volatile ImmutableList<PluginConfig> pluginConfigs;
private volatile ImmutableList<InstrumentationConfig> instrumentationConfigs;
private volatile boolean memoryBarrier;
| private volatile ImmutableList<SyntheticMonitorConfig> syntheticMonitorConfigs;
private volatile ImmutableList<AlertConfig> alertConfigs;
|
665 | return advancedConfig;
}
public List<GaugeConfig> getGaugeConfigs() {
return gaugeConfigs;
}
<BUG>public List<AlertConfig> getAlertConfigs() {
return alertConfigs;
}</BUG>
public ImmutableList<PluginConfig> getPluginConfigs() {
return pluginConfigs;
| [DELETED] |
666 | public AgentConfig getAgentConfig() {
AgentConfig.Builder builder = AgentConfig.newBuilder()
.setTransactionConfig(transactionConfig.toProto());
for (GaugeConfig gaugeConfig : gaugeConfigs) {
builder.addGaugeConfig(gaugeConfig.toProto());
<BUG>}
for (AlertConfig alertConfig : alertConfigs) {</BUG>
builder.addAlertConfig(alertConfig.toProto());
}
builder.setUiConfig(uiConfig.toProto());
| for (SyntheticMonitorConfig syntheticMonitorConfig : syntheticMonitorConfigs) {
builder.addSyntheticMonitorConfig(syntheticMonitorConfig.toProto());
for (AlertConfig alertConfig : alertConfigs) {
|
667 | .slowThresholdMillis(0)
.build();
uiConfig = ImmutableUiConfig.builder().build();
userRecordingConfig = ImmutableUserRecordingConfig.builder().build();
advancedConfig = ImmutableAdvancedConfig.builder().build();
<BUG>gaugeConfigs = getDefaultGaugeConfigs();
alertConfigs = ImmutableList.of();</BUG>
pluginConfigs =
fixPluginConfigs(ImmutableList.<ImmutablePluginConfigTemp>of(), pluginDescriptors);
instrumentationConfigs = ImmutableList.of();
| syntheticMonitorConfigs = ImmutableList.of();
alertConfigs = ImmutableList.of();
|
668 | Map<String, Object> configs = Maps.newLinkedHashMap();
configs.put("transactions", transactionConfig);
configs.put("ui", uiConfig);
configs.put("userRecording", userRecordingConfig);
configs.put("advanced", advancedConfig);
<BUG>configs.put("gauges", gaugeConfigs);
configs.put("alerts", alertConfigs);</BUG>
configs.put("plugins", pluginConfigs);
configs.put("instrumentation", instrumentationConfigs);
configFile.writeConfig(configs, mapper);
| configs.put("syntheticMonitors", syntheticMonitorConfigs);
configs.put("alerts", alertConfigs);
|
669 | builder.transactionPercentile(config.getTransactionPercentile().getValue());
}
if (config.hasMinTransactionCount()) {
builder.minTransactionCount(config.getMinTransactionCount().getValue());
}
<BUG>String gaugeName = config.getGaugeName();
if (!gaugeName.isEmpty()) {
builder.gaugeName(gaugeName);
}</BUG>
if (config.hasGaugeThreshold()) {
| builder.gaugeName(config.getGaugeName());
|
670 | builder.gaugeName(gaugeName);
}</BUG>
if (config.hasGaugeThreshold()) {
builder.gaugeThreshold(config.getGaugeThreshold().getValue());
<BUG>}
String pingUrl = config.getPingUrl();
if (!pingUrl.isEmpty()) {
builder.pingUrl(pingUrl);
}
String syntheticUserTest = config.getSyntheticUserTest();
if (!syntheticUserTest.isEmpty()) {
builder.syntheticUserTest(syntheticUserTest);
}</BUG>
if (config.hasThresholdMillis()) {
| builder.transactionPercentile(config.getTransactionPercentile().getValue());
if (config.hasMinTransactionCount()) {
builder.minTransactionCount(config.getMinTransactionCount().getValue());
builder.gaugeName(config.getGaugeName());
builder.syntheticMonitorId(config.getSyntheticMonitorId());
|
671 | return builder.addAllEmailAddresses(config.getEmailAddressList())
.build();
}
public AgentConfig.AlertConfig toProto() {
AgentConfig.AlertConfig.Builder builder = AgentConfig.AlertConfig.newBuilder()
<BUG>.setKind(kind());
String transactionType = transactionType();
if (transactionType != null) {
builder.setTransactionType(transactionType);
}</BUG>
Double transactionPercentile = transactionPercentile();
| .setKind(kind())
.setTransactionType(transactionType());
|
672 | Integer minTransactionCount = minTransactionCount();
if (minTransactionCount != null) {
builder.setMinTransactionCount(OptionalInt32.newBuilder()
.setValue(minTransactionCount));
}
<BUG>String gaugeName = gaugeName();
if (gaugeName != null) {
builder.setGaugeName(gaugeName);
}</BUG>
Double gaugeThreshold = gaugeThreshold();
| builder.setGaugeName(gaugeName());
|
673 | }</BUG>
Double gaugeThreshold = gaugeThreshold();
if (gaugeThreshold != null) {
builder.setGaugeThreshold(OptionalDouble.newBuilder()
.setValue(gaugeThreshold));
<BUG>}
String pingUrl = pingUrl();
if (pingUrl != null) {
builder.setPingUrl(pingUrl);
}
String syntheticUserTest = syntheticUserTest();
if (syntheticUserTest != null) {
builder.setSyntheticUserTest(syntheticUserTest);
}</BUG>
Integer thresholdMillis = thresholdMillis();
| Integer minTransactionCount = minTransactionCount();
if (minTransactionCount != null) {
builder.setMinTransactionCount(OptionalInt32.newBuilder()
.setValue(minTransactionCount));
builder.setGaugeName(gaugeName());
builder.setSyntheticMonitorId(syntheticMonitorId());
|
674 | import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
<BUG>import static io.sniffy.servlet.SnifferFilter.SNIFFER_URI_PREFIX;
class SnifferServlet extends HttpServlet {</BUG>
public static final String JAVASCRIPT_MIME_TYPE = "application/javascript";
public static final String SOCKET_REGISTRY_URI_PREFIX = SNIFFER_URI_PREFIX + "/socketregistry/";
protected final Map<String, RequestStats> cache;
| import static io.sniffy.socket.SocketsRegistry.SocketAddressStatus.CLOSED;
import static io.sniffy.socket.SocketsRegistry.SocketAddressStatus.OPEN;
class SnifferServlet extends HttpServlet {
|
675 | this.cache = cache;
}
@Override
public void init(ServletConfig config) throws ServletException {
try {
<BUG>javascript = loadResource("/META-INF/resources/webjars/sniffy/3.1.0-RC1/dist/sniffy.min.js");
map = loadResource("/META-INF/resources/webjars/sniffy/3.1.0-RC1/dist/sniffy.map");
</BUG>
} catch (IOException e) {
| javascript = loadResource("/META-INF/resources/webjars/sniffy/3.1.0-RC3-SNAPSHOT/dist/sniffy.min.js");
map = loadResource("/META-INF/resources/webjars/sniffy/3.1.0-RC3-SNAPSHOT/dist/sniffy.map");
|
676 | Iterable<jetbrains.mps.openapi.editor.cells.EditorCell> cells) {
if (editorComponent.isReadOnly()) {
return true;
}
for (jetbrains.mps.openapi.editor.cells.EditorCell cell : cells) {
<BUG>if (isCellOrSelectionReadOnlyInEditor(editorComponent, cell)) {
return true;</BUG>
}
}
return false;
| if (cell == null || isCellReadOnly(cell)) {
|
677 | 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);
|
678 | 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(
|
679 | 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.*;
|
680 | .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);
|
681 | </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) {
|
682 | 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)
|
683 | .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))
|
684 | .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))
|
685 | @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;
|
686 | 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;
}
|
687 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
688 | 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.*;
|
689 | .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))
|
690 | 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) -> {
|
691 | 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);
|
692 | 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);
|
693 | 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() + "\"");
|
694 | 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() + "\"");
|
695 | 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
|
696 | .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")
|
697 | package org.fourthline.cling.model;
<BUG>import java.net.URI;
import java.util.ArrayList;</BUG>
import java.util.HashSet;
import java.util.List;
import java.util.Set;
| import java.net.URISyntaxException;
import java.util.ArrayList;
|
698 | public static final String SERVICE = "/svc";
public static final String CONTROL = "/action";
public static final String EVENTS = "/event";
public static final String DESCRIPTOR_FILE = "/desc";
public static final String CALLBACK_FILE = "/cb";
<BUG>final protected URI basePath;
public Namespace() {
this.basePath = URI.create("");
}</BUG>
public Namespace(String basePath) {
| final protected String decodedPath;
this("");
}
|
699 | package org.fourthline.cling.model.message;
import java.net.InetAddress;
public abstract class OutgoingDatagramMessage<O extends UpnpOperation> extends UpnpMessage<O> {
private InetAddress destinationAddress;
<BUG>private int destinationPort;
protected OutgoingDatagramMessage(O operation, InetAddress destinationAddress, int destinationPort) {</BUG>
super(operation);
this.destinationAddress = destinationAddress;
this.destinationPort = destinationPort;
| private UpnpHeaders headers = new UpnpHeaders(false);
protected OutgoingDatagramMessage(O operation, InetAddress destinationAddress, int destinationPort) {
|
700 | import org.fourthline.cling.transport.RouterException;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import java.net.URI;
import java.net.URL;
<BUG>import java.util.List;
import java.util.logging.Logger;</BUG>
@ApplicationScoped
public class ProtocolFactoryImpl implements ProtocolFactory {
final private static Logger log = Logger.getLogger(ProtocolFactory.class.getName());
| import java.util.logging.Level;
import java.util.logging.Logger;
|