id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
46,901 | String skinName = null;
String skinRepo = null;
String iconBase = null;
Placement placement = ToolManager.getCurrentPlacement();
String toolId = placement.getToolId();
<BUG>boolean inline = false;
if (httpServletRequest.getRequestURI().startsWith("/portal/site/")) {
inline = true;</BUG>
if (reseturl == null)
reseturl = "/portal/site/" + simplePageBean.getCurrentSiteId() + "/tool-reset/" + ((ToolConfiguration)placement).getPageId() + "?panel=Main";
| String portalTemplates = ServerConfigurationService.getString("portal.templates", "");
if ("morpheus".equals(portalTemplates))
inline = true;
|
46,902 | import com.path.android.jobqueue.log.JqLog;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
class CancelHandler {
<BUG>private Set<String> runningNonPersistent;
private Set<String> runningPersistent;
private final TagConstraint constraint;
</BUG>
private final String[] tags;
| private Set<String> running;
private final TagConstraint tagConstraint;
|
46,903 | private final String[] tags;
private final Collection<JobHolder> cancelled;
private final Collection<JobHolder> failedToCancel;
private final CancelResult.AsyncCancelCallback callback;
CancelHandler(TagConstraint constraint, String[] tags, CancelResult.AsyncCancelCallback callback) {
<BUG>this.constraint = constraint;
</BUG>
this.tags = tags;
cancelled = new ArrayList<>();
failedToCancel = new ArrayList<>();
| this.tagConstraint = constraint;
|
46,904 | jobManagerThread.callbackManager.notifyOnCancel(jobHolder.getJob(), true);
}
}
void onJobRun(JobHolder holder, int resultCode) {
final boolean exists;
<BUG>if (holder.getJob().isPersistent()) {
exists = runningPersistent.remove(holder.getId());
} else {
exists = runningNonPersistent.remove(holder.getId());
}</BUG>
if (exists) {
| exists = running.remove(holder.getId());
|
46,905 | panBriefing.add(scrollMissionView, gridBagConstraints);
scenarioModel = new ScenarioTableModel(getCampaign());
scenarioTable = new JTable(scenarioModel);
scenarioTable.setShowGrid(false);
scenarioTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
<BUG>scenarioTable.addMouseListener(new ScenarioTableMouseAdapter(getCampaignGui(), this));
scenarioTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);</BUG>
scenarioTable.setIntercellSpacing(new Dimension(0, 0));
scenarioTable.getSelectionModel().addListSelectionListener(ev -> refreshScenarioView());
JScrollPane scrollScenarioTable = new JScrollPane(scenarioTable);
| scenarioTable.addMouseListener(new ScenarioTableMouseAdapter(getCampaignGui(),
scenarioTable, scenarioModel));
scenarioTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
|
46,906 | splitBrief.setResizeWeight(0.5);
splitBrief.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, ev -> refreshScenarioView());
setLayout(new BorderLayout());
add(splitBrief, BorderLayout.CENTER);
}
<BUG>public Mission getSelectedMission() {
return getCampaign().getMission(selectedMission);
}
public JTable getScenarioTable() {
return scenarioTable;
}
public ScenarioTableModel getScenarioModel() {
return scenarioModel;
}</BUG>
private void addMission() {
| [DELETED] |
46,907 | import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
<BUG>import java.awt.event.KeyEvent;
import java.util.ArrayList;</BUG>
import java.util.ResourceBundle;
import java.util.UUID;
import javax.swing.AbstractAction;
| import java.awt.event.MouseEvent;
import java.util.ArrayList;
|
46,908 |
getUnitTable().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
</BUG>
XTableColumnModel unitColumnModel = new XTableColumnModel();
<BUG>getUnitTable().setColumnModel(unitColumnModel);
getUnitTable().createDefaultColumnsFromModel();
unitSorter = new TableRowSorter<UnitTableModel>(getUnitModel());
</BUG>
unitSorter.setComparator(UnitTableModel.COL_STATUS, new UnitStatusSorter());
| gridBagConstraints.weightx = 1.0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 0);
add(choiceUnitView, gridBagConstraints);
unitModel = new UnitTableModel(getCampaign());
unitTable = new JTable(unitModel);
unitTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
unitTable.setColumnModel(unitColumnModel);
unitTable.createDefaultColumnsFromModel();
unitSorter = new TableRowSorter<UnitTableModel>(unitModel);
|
46,909 | JPanel panAcquireUnit = new JPanel(new GridLayout(0, 1));
panAcquireUnit.setBorder(BorderFactory.createTitledBorder("Procurement List"));
panAcquireUnit.add(scrollAcquireUnitTable);
panAcquireUnit.setMinimumSize(new Dimension(200, 200));
panAcquireUnit.setPreferredSize(new Dimension(200, 200));
<BUG>JSplitPane splitLeftUnit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(getUnitTable()),
</BUG>
panAcquireUnit);
splitLeftUnit.setOneTouchExpandable(true);
splitLeftUnit.setResizeWeight(1.0);
| JSplitPane splitLeftUnit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(unitTable),
|
46,910 | scrollUnitView.setMinimumSize(new java.awt.Dimension(UNIT_VIEW_WIDTH, 600));
scrollUnitView.setPreferredSize(new java.awt.Dimension(UNIT_VIEW_WIDTH, 600));
scrollUnitView.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollUnitView.setViewportView(null);
splitUnit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitLeftUnit, scrollUnitView);
<BUG>getSplitUnit().setOneTouchExpandable(true);
getSplitUnit().setResizeWeight(1.0);
getSplitUnit().addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, pce -> refreshUnitView());
</BUG>
gridBagConstraints.gridx = 0;
| splitUnit.setOneTouchExpandable(true);
splitUnit.setResizeWeight(1.0);
splitUnit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, pce -> refreshUnitView());
|
46,911 | </BUG>
}
public JTable getUnitTable() {
return unitTable;
<BUG>}
public UnitTableModel getUnitModel() {
return unitModel;
}
public JSplitPane getSplitUnit() {
return splitUnit;</BUG>
}
| gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 6;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(splitUnit, gridBagConstraints);
|
46,912 | return "?";
}
}
public void changeUnitView() {
int view = choiceUnitView.getSelectedIndex();
<BUG>XTableColumnModel columnModel = (XTableColumnModel) getUnitTable().getColumnModel();
getUnitTable().setRowHeight(15);
</BUG>
TableColumn column = null;
| XTableColumnModel columnModel = (XTableColumnModel) unitTable.getColumnModel();
unitTable.setRowHeight(15);
|
46,913 | column.setHeaderValue("Weight Class");
}
}
}
if (view == UV_GRAPHIC) {
<BUG>getUnitTable().setRowHeight(80);
</BUG>
columnModel.setColumnVisible(columnModel.getColumnByModelIndex(UnitTableModel.COL_NAME), false);
columnModel.setColumnVisible(columnModel.getColumnByModelIndex(UnitTableModel.COL_TYPE), false);
columnModel.setColumnVisible(columnModel.getColumnByModelIndex(UnitTableModel.COL_WCLASS), true);
| unitTable.setRowHeight(80);
|
46,914 | GridBagConstraints gridBagConstraints;
setLayout(new GridBagLayout());
financeModel = new FinanceTableModel();
financeTable = new JTable(financeModel);
financeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
<BUG>financeTable.addMouseListener(new FinanceTableMouseAdapter(this));
financeTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);</BUG>
TableColumn column = null;
for (int i = 0; i < FinanceTableModel.N_COL; i++) {
| financeTable.addMouseListener(new FinanceTableMouseAdapter(getCampaignGui(),
financeTable, financeModel));
financeTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
|
46,915 | financeTable.setIntercellSpacing(new Dimension(0, 0));
financeTable.setShowGrid(false);
loanModel = new LoanTableModel();
loanTable = new JTable(loanModel);
loanTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
<BUG>loanTable.addMouseListener(new LoanTableMouseAdapter(this));
loanTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);</BUG>
column = null;
for (int i = 0; i < LoanTableModel.N_COL; i++) {
| loanTable.addMouseListener(new LoanTableMouseAdapter(getCampaignGui(),
loanTable, loanModel));
loanTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
|
46,916 | package mekhq.gui;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
<BUG>import java.awt.GridBagLayout;
import java.util.ArrayList;</BUG>
import java.util.ResourceBundle;
import java.util.UUID;
import javax.swing.DefaultComboBoxModel;
| import java.awt.event.MouseEvent;
import java.util.ArrayList;
|
46,917 | public JTable getPersonnelTable() {
return personnelTable;
}
public PersonnelTableModel getPersonModel() {
return personModel;
<BUG>}
public JSplitPane getSplitPersonnel() {
return splitPersonnel;</BUG>
}
@Override
| [DELETED] |
46,918 | public NodeFirstRelationshipStage( Configuration config, NodeStore nodeStore,
RelationshipGroupStore relationshipGroupStore, NodeRelationshipLink cache )
{
super( "Node --> Relationship", config, false );
add( new ReadNodeRecordsStep( control(), config.batchSize(), config.movingAverageSize(), nodeStore ) );
<BUG>add( new NodeFirstRelationshipStep( control(), config.workAheadSize(), config.movingAverageSize(),
nodeStore, relationshipGroupStore, cache ) );
add( new UpdateRecordsStep<>( control(), config.workAheadSize(), config.movingAverageSize(), nodeStore ) );</BUG>
}
| add( new RecordProcessorStep<>( control(), "LINK", config.workAheadSize(), config.movingAverageSize(),
new NodeFirstRelationshipProcessor( relationshipGroupStore, cache ), false ) );
add( new UpdateRecordsStep<>( control(), config.workAheadSize(), config.movingAverageSize(), nodeStore ) );
|
46,919 | import org.neo4j.kernel.impl.api.CountsAccessor;
import org.neo4j.kernel.impl.store.NodeLabelsField;
import org.neo4j.kernel.impl.store.NodeStore;
import org.neo4j.kernel.impl.store.record.NodeRecord;
import org.neo4j.unsafe.impl.batchimport.cache.NodeLabelsCache;
<BUG>public class NodeCountsProcessor implements StoreProcessor<NodeRecord>
</BUG>
{
private final NodeStore nodeStore;
private final long[] labelCounts;
| public class NodeCountsProcessor implements RecordProcessor<NodeRecord>
|
46,920 | super.addStatsProviders( providers );
providers.add( monitor );
}
@Override
protected void done()
<BUG>{
monitor.stop();</BUG>
}
@Override
public int numberOfProcessors()
| super.done();
monitor.stop();
|
46,921 | import org.neo4j.kernel.impl.store.RelationshipGroupStore;
import org.neo4j.kernel.impl.store.record.NodeRecord;
import org.neo4j.kernel.impl.store.record.RelationshipGroupRecord;
import org.neo4j.unsafe.impl.batchimport.cache.NodeRelationshipLink;
import org.neo4j.unsafe.impl.batchimport.cache.NodeRelationshipLink.GroupVisitor;
<BUG>public class NodeFirstRelationshipProcessor implements StoreProcessor<NodeRecord>, GroupVisitor
</BUG>
{
private final RelationshipGroupStore relGroupStore;
private final NodeRelationshipLink nodeRelationshipLink;
| public class NodeFirstRelationshipProcessor implements RecordProcessor<NodeRecord>, GroupVisitor
|
46,922 | package org.apache.camel.component.jpa;
import java.util.List;
<BUG>import javax.persistence.EntityManager;
import javax.persistence.PersistenceException;</BUG>
import org.apache.camel.Exchange;
import org.apache.camel.examples.Address;
import org.apache.camel.examples.Customer;
| [DELETED] |
46,923 | import org.apache.camel.Exchange;
import org.apache.camel.examples.Address;
import org.apache.camel.examples.Customer;
import org.apache.camel.impl.DefaultExchange;
import org.junit.Test;
<BUG>import org.springframework.orm.jpa.JpaCallback;
public class JpaUseMergeTest extends AbstractJpaMethodTest {</BUG>
public boolean usePersist() {
return false;
}
| import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
public class JpaUseMergeTest extends AbstractJpaMethodTest {
|
46,924 | }
@Test
public void produceExistingEntity() throws Exception {
setUp("jpa://" + Customer.class.getName() + "?usePersist=false");
final Customer customer = createDefaultCustomer();
<BUG>transactionStrategy.execute(new JpaCallback<Object>() {
public Object doInJpa(EntityManager entityManager) throws PersistenceException {
entityManager.persist(customer);</BUG>
entityManager.flush();
| transactionTemplate.execute(new TransactionCallback<Object>() {
public Object doInTransaction(TransactionStatus status) {
entityManager.joinTransaction();
entityManager.persist(customer);
|
46,925 | assertEquals(customer.getName(), receivedCustomer.getName());
assertNotNull(receivedCustomer.getId());
assertEquals(customer.getAddress().getAddressLine1(), receivedCustomer.getAddress().getAddressLine1());
assertEquals(customer.getAddress().getAddressLine2(), receivedCustomer.getAddress().getAddressLine2());
assertNotNull(receivedCustomer.getAddress().getId());
<BUG>List<?> results = jpaTemplate.find("select o from " + Customer.class.getName() + " o");
</BUG>
assertEquals(1, results.size());
Customer persistedCustomer = (Customer) results.get(0);
assertEquals(receivedCustomer.getName(), persistedCustomer.getName());
| List<?> results = entityManager.createQuery("select o from " + Customer.class.getName() + " o").getResultList();
|
46,926 | import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
<BUG>import org.slf4j.LoggerFactory;
import org.springframework.orm.jpa.JpaCallback;
import org.springframework.orm.jpa.JpaTemplate;
import static org.apache.camel.util.ServiceHelper.startServices;
import static org.apache.camel.util.ServiceHelper.stopServices;</BUG>
public class JpaTest extends Assert {
| import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
|
46,927 | protected CountDownLatch latch = new CountDownLatch(1);
protected String entityName = SendEmail.class.getName();
protected String queryText = "select o from " + entityName + " o";
@Test
public void testProducerInsertsIntoDatabaseThenConsumerFiresMessageExchange() throws Exception {
<BUG>transactionStrategy.execute(new JpaCallback<Object>() {
public Object doInJpa(EntityManager entityManager) throws PersistenceException {
entityManager.createQuery("delete from " + entityName).executeUpdate();</BUG>
return null;
| transactionTemplate.execute(new TransactionCallback<Object>() {
public Object doInTransaction(TransactionStatus status) {
entityManager.joinTransaction();
entityManager.createQuery("delete from " + entityName).executeUpdate();
|
46,928 | template.send(endpoint, new Processor() {
public void process(Exchange exchange) {
exchange.getIn().setBody(new SendEmail("foo@bar.com"));
}
});
<BUG>results = jpaTemplate.find(queryText);
assertEquals("Should have results: " + results, 1, results.size());</BUG>
SendEmail mail = (SendEmail) results.get(0);
assertEquals("address property", "foo@bar.com", mail.getAddress());
consumer = endpoint.createConsumer(new Processor() {
| results = entityManager.createQuery(queryText).getResultList();
assertEquals("Should have results: " + results, 1, results.size());
|
46,929 | assertEquals("address property", "foo@bar.com", mail.getAddress());
consumer = endpoint.createConsumer(new Processor() {
public void process(Exchange e) {
LOG.info("Received exchange: " + e.getIn());
receivedExchange = e;
<BUG>JpaTemplate template = e.getIn().getHeader(JpaConstants.JPA_TEMPLATE, JpaTemplate.class);
assertNotNull("Should have a JpaTemplate as header", template);
latch.countDown();</BUG>
}
});
| EntityManager entityManager = e.getIn().getHeader(JpaConstants.ENTITYMANAGER, EntityManager.class);
assertNotNull("Should have a EntityManager as header", entityManager);
latch.countDown();
|
46,930 | startServices(template, camelContext);
Endpoint value = camelContext.getEndpoint(getEndpointUri());
assertNotNull("Could not find endpoint!", value);
assertTrue("Should be a JPA endpoint but was: " + value, value instanceof JpaEndpoint);
endpoint = (JpaEndpoint) value;
<BUG>transactionStrategy = endpoint.createTransactionStrategy();
jpaTemplate = endpoint.getTemplate();
}</BUG>
protected String getEndpointUri() {
| transactionTemplate = endpoint.createTransactionTemplate();
entityManager = endpoint.createEntityManager();
}
|
46,931 | protected CountDownLatch latch = new CountDownLatch(1);
protected String entityName = MultiSteps.class.getName();
protected String queryText = "select o from " + entityName + " o where o.step = 1";
@Test
public void testProducerInsertsIntoDatabaseThenConsumerFiresMessageExchange() throws Exception {
<BUG>transactionStrategy.execute(new JpaCallback<Object>() {
public Object doInJpa(EntityManager entityManager) throws PersistenceException {
entityManager.createQuery("delete from " + entityName).executeUpdate();</BUG>
MultiSteps dummy = new MultiSteps("cheese");
| transactionTemplate.execute(new TransactionCallback<Object>() {
public Object doInTransaction(TransactionStatus status) {
entityManager.joinTransaction();
entityManager.createQuery("delete from " + entityName).executeUpdate();
|
46,932 | dummy.setStep(4);
entityManager.persist(dummy);
return null;
}
});
<BUG>List<?> results = jpaTemplate.find(queryText);
assertEquals("Should have no results: " + results, 0, results.size());</BUG>
template.send(endpoint, new Processor() {
public void process(Exchange exchange) {
exchange.getIn().setBody(new MultiSteps("foo@bar.com"));
| List<?> results = entityManager.createQuery(queryText).getResultList();
assertEquals("Should have no results: " + results, 0, results.size());
|
46,933 | template.send(endpoint, new Processor() {
public void process(Exchange exchange) {
exchange.getIn().setBody(new MultiSteps("foo@bar.com"));
}
});
<BUG>results = jpaTemplate.find(queryText);
assertEquals("Should have results: " + results, 1, results.size());</BUG>
MultiSteps mail = (MultiSteps)results.get(0);
assertEquals("address property", "foo@bar.com", mail.getAddress());
consumer = endpoint.createConsumer(new Processor() {
| results = entityManager.createQuery(queryText).getResultList();
assertEquals("Should have results: " + results, 1, results.size());
|
46,934 | ServiceHelper.startServices(template, camelContext);
Endpoint value = camelContext.getEndpoint(getEndpointUri());
assertNotNull("Could not find endpoint!", value);
assertTrue("Should be a JPA endpoint but was: " + value, value instanceof JpaEndpoint);
endpoint = (JpaEndpoint)value;
<BUG>transactionStrategy = endpoint.createTransactionStrategy();
jpaTemplate = endpoint.getTemplate();
}</BUG>
protected String getEndpointUri() {
| transactionTemplate = endpoint.createTransactionTemplate();
entityManager = endpoint.createEntityManager();
}
|
46,935 | <BUG>package org.apache.camel.component.jpa;
import java.util.ArrayList;</BUG>
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
| import static org.apache.camel.util.ServiceHelper.startServices;
import static org.apache.camel.util.ServiceHelper.stopServices;
import java.util.ArrayList;
|
46,936 | protected Consumer consumer;
protected Exchange receivedExchange;
abstract boolean usePersist();
@After
public void tearDown() throws Exception {
<BUG>stopServices(consumer, template, camelContext);
}</BUG>
@Test
public void produceNewEntity() throws Exception {
setUp("jpa://" + Customer.class.getName() + "?usePersist=" + (usePersist() ? "true" : "false"));
| entityManager.close();
}
|
46,937 | assertEquals(customer.getName(), receivedCustomer.getName());
assertNotNull(receivedCustomer.getId());
assertEquals(customer.getAddress().getAddressLine1(), receivedCustomer.getAddress().getAddressLine1());
assertEquals(customer.getAddress().getAddressLine2(), receivedCustomer.getAddress().getAddressLine2());
assertNotNull(receivedCustomer.getAddress().getId());
<BUG>List<?> results = jpaTemplate.find("select o from " + Customer.class.getName() + " o");
</BUG>
assertEquals(1, results.size());
Customer persistedCustomer = (Customer) results.get(0);
assertEquals(receivedCustomer.getName(), persistedCustomer.getName());
| List<?> results = entityManager.createQuery("select o from " + Customer.class.getName() + " o").getResultList();
|
46,938 | save(customer);
final CountDownLatch latch = new CountDownLatch(1);
consumer = endpoint.createConsumer(new Processor() {
public void process(Exchange e) {
receivedExchange = e;
<BUG>assertNotNull(e.getIn().getHeader(JpaConstants.JPA_TEMPLATE, JpaTemplate.class));
</BUG>
latch.countDown();
}
});
| assertNotNull(e.getIn().getHeader(JpaConstants.ENTITYMANAGER, EntityManager.class));
|
46,939 | if (specificAnnotationSettings == null || selectedIonTypes.keySet().contains(Ion.IonType.PEPTIDE_FRAGMENT_ION) && specificAnnotationSettings.getFragmentIonTypes().contains(PeptideFragmentIon.A_ION)) {
int subType = PeptideFragmentIon.A_ION;
ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
if (neutralLossesCombinations != null) {
<BUG>ions = new ArrayList<Ion>(neutralLossesCombinations.size());
</BUG>
} else {
ions = new ArrayList<Ion>(1);
}
| ions = new ArrayList<Ion>(neutralLossesCombinations.length);
|
46,940 | if (specificAnnotationSettings == null || selectedIonTypes.keySet().contains(Ion.IonType.PEPTIDE_FRAGMENT_ION) && specificAnnotationSettings.getFragmentIonTypes().contains(PeptideFragmentIon.B_ION)) {
int subType = PeptideFragmentIon.B_ION;
ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
if (neutralLossesCombinations != null) {
<BUG>ions = new ArrayList<Ion>(neutralLossesCombinations.size());
</BUG>
} else {
ions = new ArrayList<Ion>(1);
}
| ions = new ArrayList<Ion>(neutralLossesCombinations.length);
|
46,941 | ions = new ArrayList<Ion>(1);
}
ionsMap.put(subType, ions);
}
if (neutralLossesCombinations != null) {
<BUG>for (ArrayList<NeutralLoss> losses : neutralLossesCombinations) {
ions.add(new PeptideFragmentIon(subType, faa, forwardMass - getLossesMass(losses), losses));
</BUG>
}
| for (NeutralLossCombination losses : neutralLossesCombinations) {
ions.add(new PeptideFragmentIon(subType, faa, forwardMass - losses.getMass(), losses.getNeutralLossCombination()));
|
46,942 | if (specificAnnotationSettings == null || selectedIonTypes.keySet().contains(Ion.IonType.PEPTIDE_FRAGMENT_ION) && specificAnnotationSettings.getFragmentIonTypes().contains(PeptideFragmentIon.C_ION)) {
int subType = PeptideFragmentIon.C_ION;
ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
if (neutralLossesCombinations != null) {
<BUG>ions = new ArrayList<Ion>(neutralLossesCombinations.size());
</BUG>
} else {
ions = new ArrayList<Ion>(1);
}
| ions = new ArrayList<Ion>(neutralLossesCombinations.length);
|
46,943 | if (specificAnnotationSettings == null || selectedIonTypes.keySet().contains(Ion.IonType.PEPTIDE_FRAGMENT_ION) && specificAnnotationSettings.getFragmentIonTypes().contains(PeptideFragmentIon.X_ION)) {
int subType = PeptideFragmentIon.X_ION;
ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
if (neutralLossesCombinations != null) {
<BUG>ions = new ArrayList<Ion>(neutralLossesCombinations.size());
</BUG>
} else {
ions = new ArrayList<Ion>(1);
}
| ions = new ArrayList<Ion>(neutralLossesCombinations.length);
|
46,944 | if (specificAnnotationSettings == null || selectedIonTypes.keySet().contains(Ion.IonType.PEPTIDE_FRAGMENT_ION) && specificAnnotationSettings.getFragmentIonTypes().contains(PeptideFragmentIon.Y_ION)) {
int subType = PeptideFragmentIon.Y_ION;
ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
if (neutralLossesCombinations != null) {
<BUG>ions = new ArrayList<Ion>(neutralLossesCombinations.size());
</BUG>
} else {
ions = new ArrayList<Ion>(1);
}
| ions = new ArrayList<Ion>(neutralLossesCombinations.length);
|
46,945 |
ions.add(new PeptideFragmentIon(subType, faa, rewindMass + 2 * Atom.H.getMonoisotopicMass() - getLossesMass(losses), losses));
}</BUG>
} else {
<BUG>ions.add(new PeptideFragmentIon(subType, faa, rewindMass + 2 * Atom.H.getMonoisotopicMass(), null));
</BUG>
}
}
if (specificAnnotationSettings == null || selectedIonTypes.keySet().contains(Ion.IonType.PEPTIDE_FRAGMENT_ION) && specificAnnotationSettings.getFragmentIonTypes().contains(PeptideFragmentIon.Z_ION)) {
int subType = PeptideFragmentIon.Z_ION;
| ions = new ArrayList<Ion>(1);
ionsMap.put(subType, ions);
if (neutralLossesCombinations != null) {
for (NeutralLossCombination losses : neutralLossesCombinations) {
ions.add(new PeptideFragmentIon(subType, faa, rewindMass + h2 - losses.getMass(), losses.getNeutralLossCombination()));
ions.add(new PeptideFragmentIon(subType, faa, rewindMass + h2, null));
|
46,946 | if (specificAnnotationSettings == null || selectedIonTypes.keySet().contains(Ion.IonType.PEPTIDE_FRAGMENT_ION) && specificAnnotationSettings.getFragmentIonTypes().contains(PeptideFragmentIon.Z_ION)) {
int subType = PeptideFragmentIon.Z_ION;
ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
if (neutralLossesCombinations != null) {
<BUG>ions = new ArrayList<Ion>(neutralLossesCombinations.size());
</BUG>
} else {
ions = new ArrayList<Ion>(1);
}
| ions = new ArrayList<Ion>(neutralLossesCombinations.length);
|
46,947 | ions = new ArrayList<Ion>(1);
}
ionsMap.put(subType, ions);
}
if (neutralLossesCombinations != null) {
<BUG>for (ArrayList<NeutralLoss> losses : neutralLossesCombinations) {
ions.add(new PeptideFragmentIon(subType, faa, rewindMass - Atom.N.getMonoisotopicMass() - getLossesMass(losses), losses));
</BUG>
}
| for (NeutralLossCombination losses : neutralLossesCombinations) {
ions.add(new PeptideFragmentIon(subType, faa, rewindMass - Atom.N.getMonoisotopicMass() - losses.getMass(), losses.getNeutralLossCombination()));
|
46,948 | ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
ions = new ArrayList<Ion>();
ionsMap.put(subType, ions);
}
<BUG>for (ArrayList<NeutralLoss> losses : neutralLossesCombinations) {
ions.add(new TagFragmentIon(subType, aa, subaa, forwardMass - Atom.C.getMonoisotopicMass() - Atom.O.getMonoisotopicMass() - getLossesMass(losses), losses, massOffset));
}</BUG>
subType = TagFragmentIon.B_ION;
| for (NeutralLossCombination losses : neutralLossesCombinations) {
ions.add(new TagFragmentIon(subType, aa, subaa, forwardMass - co - losses.getMass(), losses.getNeutralLossCombination(), massOffset));
|
46,949 | ions = ionsMap.get(subType);
if (ions == null) {
ions = new ArrayList<Ion>();
ionsMap.put(subType, ions);
}
<BUG>for (ArrayList<NeutralLoss> losses : neutralLossesCombinations) {
ions.add(new TagFragmentIon(subType, aa, subaa, forwardMass + Atom.N.getMonoisotopicMass() + 3 * Atom.H.getMonoisotopicMass() - getLossesMass(losses), losses, massOffset));
}</BUG>
}
| [DELETED] |
46,950 | ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
ions = new ArrayList<Ion>();
ionsMap.put(subType, ions);
}
<BUG>for (ArrayList<NeutralLoss> losses : neutralLossesCombinations) {
ions.add(new TagFragmentIon(subType, aa, subaa, forwardMass - Atom.C.getMonoisotopicMass() - Atom.O.getMonoisotopicMass() - getLossesMass(losses), losses, massOffset));
}</BUG>
subType = TagFragmentIon.B_ION;
| for (NeutralLossCombination losses : neutralLossesCombinations) {
ions.add(new TagFragmentIon(subType, aa, subaa, forwardMass - co - losses.getMass(), losses.getNeutralLossCombination(), massOffset));
|
46,951 | ions = ionsMap.get(subType);
if (ions == null) {
ions = new ArrayList<Ion>();
ionsMap.put(subType, ions);
}
<BUG>for (ArrayList<NeutralLoss> losses : neutralLossesCombinations) {
ions.add(new TagFragmentIon(subType, aa, subaa, forwardMass - getLossesMass(losses), losses, massOffset));
</BUG>
}
| for (NeutralLossCombination losses : neutralLossesCombinations) {
ions.add(new TagFragmentIon(subType, aa, subaa, forwardMass - losses.getMass(), losses.getNeutralLossCombination(), massOffset));
|
46,952 | ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
ions = new ArrayList<Ion>();
ionsMap.put(subType, ions);
}
<BUG>for (ArrayList<NeutralLoss> losses : neutralLossesCombinations) {
ions.add(new TagFragmentIon(subType, aa, subaa, rewindMass + Atom.C.getMonoisotopicMass() + 2 * Atom.O.getMonoisotopicMass() - getLossesMass(losses), losses, gap));
}</BUG>
subType = TagFragmentIon.Y_ION;
| ions.add(immoniumIon);
ionsMap = result.get(Ion.IonType.RELATED_ION.index);
if (ionsMap == null) {
ionsMap = new HashMap<Integer, ArrayList<Ion>>();
result.put(Ion.IonType.RELATED_ION.index, ionsMap);
ArrayList<RelatedIon> relatedIons = RelatedIon.getRelatedIons(aminoAcid);
for (RelatedIon tempRelated : relatedIons) {
subType = tempRelated.getSubType();
|
46,953 | ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
ions = new ArrayList<Ion>();
ionsMap.put(subType, ions);
}
<BUG>for (ArrayList<NeutralLoss> losses : neutralLossesCombinations) {
ions.add(new TagFragmentIon(subType, aa, subaa, rewindMass + Atom.C.getMonoisotopicMass() + 2 * Atom.O.getMonoisotopicMass() - getLossesMass(losses), losses, gap));
}</BUG>
subType = TagFragmentIon.Y_ION;
| for (NeutralLossCombination losses : neutralLossesCombinations) {
ions.add(new TagFragmentIon(subType, aa, subaa, forwardMass - co - losses.getMass(), losses.getNeutralLossCombination(), massOffset));
subType = TagFragmentIon.B_ION;
|
46,954 | ions = ionsMap.get(subType);
if (ions == null) {
ions = new ArrayList<Ion>();
ionsMap.put(subType, ions);
}
<BUG>for (ArrayList<NeutralLoss> losses : neutralLossesCombinations) {
ions.add(new TagFragmentIon(subType, aa, subaa, rewindMass - Atom.N.getMonoisotopicMass() + Atom.O.getMonoisotopicMass() - getLossesMass(losses), losses, gap));
}</BUG>
}
| [DELETED] |
46,955 | package com.compomics.util.experiment.biology.ions;
import com.compomics.util.experiment.biology.NeutralLoss;
import com.compomics.util.experiment.biology.Ion;
import com.compomics.util.pride.CvTerm;
<BUG>import java.util.ArrayList;
public class PeptideFragmentIon extends Ion {</BUG>
static final long serialVersionUID = 8283809283803740651L;
public static final int A_ION = 0;
public static final int B_ION = 1;
| import java.util.Collections;
public class PeptideFragmentIon extends Ion {
|
46,956 | public static final int B_ION = 1;
public static final int C_ION = 2;
public static final int X_ION = 3;
public static final int Y_ION = 4;
public static final int Z_ION = 5;
<BUG>private ArrayList<NeutralLoss> neutralLosses;
</BUG>
private int number = -1;
private int subType;
private CvTerm cvTerm = null;
| private NeutralLoss[] neutralLosses;
|
46,957 | public String getNameWithNumber() {
return getSubTypeAsString() + getNumber() + getNeutralLossesAsString();
}
@Override
public CvTerm getPrideCvTerm() {
<BUG>if (cvTerm != null) {
return cvTerm;
}</BUG>
switch (subType) {
| if (cvTerm == null) {
|
46,958 | private Semaphore proteinsMutex;
private ArrayList<ModificationMatch> modifications = null;
private ArrayList<VariantMatch> variants = null;
private HashMap<String, HashMap<Integer, ArrayList<Variant>>> variantsMap = null;
public final static String MODIFICATION_LOCALIZATION_SEPARATOR = "-ATAA-";
<BUG>public final static String MODIFICATION_SEPARATOR = "_";
public Peptide() {</BUG>
}
public Peptide(String aSequence, ArrayList<ModificationMatch> modifications, boolean sanityCheck) {
this.sequence = aSequence;
| public final static char MODIFICATION_SEPARATOR_CHAR = '_';
public Peptide() {
|
46,959 | ArrayList<Integer> possibleTypes = new ArrayList<Integer>();
possibleTypes.add(PROTON);
return possibleTypes;
}
@Override
<BUG>public ArrayList<NeutralLoss> getNeutralLosses() {
switch (subType) {
case PROTON:
return new ArrayList<NeutralLoss>(); // If you see a neutral loss of a proton, call Gell-Mann and Zweig
default:
return new ArrayList<NeutralLoss>();
}</BUG>
}
| [DELETED] |
46,960 | return RelatedIon.getPossibleSubtypes();
default:
throw new UnsupportedOperationException("Not supported yet.");
}
}
<BUG>public abstract ArrayList<NeutralLoss> getNeutralLosses();
</BUG>
public boolean hasNeutralLosses() {
switch (type) {
case PEPTIDE_FRAGMENT_ION:
| public abstract NeutralLoss[] getNeutralLosses();
|
46,961 | public boolean hasNeutralLosses() {
switch (type) {
case PEPTIDE_FRAGMENT_ION:
case TAG_FRAGMENT_ION:
case PRECURSOR_ION:
<BUG>ArrayList<NeutralLoss> neutralLosses = getNeutralLosses();
return neutralLosses != null && !neutralLosses.isEmpty();
</BUG>
default:
| NeutralLoss[] neutralLosses = getNeutralLosses();
return neutralLosses != null && neutralLosses.length > 0;
|
46,962 | return "Unknown ion type";
default:
throw new UnsupportedOperationException("No name for ion type " + type + ".");
}
}
<BUG>public static Ion getGenericIon(IonType ionType, int subType, ArrayList<NeutralLoss> neutralLosses) {
</BUG>
switch (ionType) {
case ELEMENTARY_ION:
return new ElementaryIon("new ElementaryIon", 0.0, subType);
| public static Ion getGenericIon(IonType ionType, int subType, NeutralLoss[] neutralLosses) {
|
46,963 | possibleTypes.add(TRYPTOPHAN);
possibleTypes.add(TYROSINE);
return possibleTypes;
}
@Override
<BUG>public ArrayList<NeutralLoss> getNeutralLosses() {
return new ArrayList<NeutralLoss>(0);
</BUG>
}
| [DELETED] |
46,964 | package com.jetbrains.python.packaging;
import com.intellij.openapi.module.Module;
<BUG>import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModuleRootManager;</BUG>
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Ref;
| import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ModuleRootManager;
|
46,965 | import com.intellij.util.Function;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.resolve.PyResolveContext;
<BUG>import com.jetbrains.python.psi.resolve.QualifiedResolveResult;
import org.jetbrains.annotations.NotNull;</BUG>
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
| import com.jetbrains.python.sdk.PythonSdkType;
import org.jetbrains.annotations.NotNull;
|
46,966 | protected Set<String> getPackagesToPostpone() {
return Sets.newHashSet("pip", "distutils", "setuptools");
}
@Override
protected boolean canUninstallPackage(InstalledPackage pkg) {
<BUG>if (!myHasManagement) return false;
if (PythonSdkType.isDocker(getSelectedSdk())) {
return false;
}</BUG>
if (PythonSdkType.isVirtualEnv(getSelectedSdk()) && pkg instanceof PyPackage) {
| if (!PyPackageUtil.packageManagementEnabled(getSelectedSdk())) return false;
|
46,967 | @Override
protected boolean canInstallPackage(@NotNull final InstalledPackage pyPackage) {
return installEnabled();
}
@Override
<BUG>protected boolean installEnabled() {
if (PythonSdkType.isDocker(getSelectedSdk())) {
return false;
}</BUG>
return myHasManagement;
| protected Set<String> getPackagesToPostpone() {
return Sets.newHashSet("pip", "distutils", "setuptools");
|
46,968 | import com.jetbrains.python.console.PydevConsoleRunner;
import com.jetbrains.python.documentation.docstrings.DocStringParameterReference;
import com.jetbrains.python.documentation.docstrings.DocStringTypeReference;
import com.jetbrains.python.inspections.*;
import com.jetbrains.python.inspections.quickfix.*;
<BUG>import com.jetbrains.python.packaging.PyPIPackageUtil;
import com.jetbrains.python.packaging.PyRequirement;</BUG>
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.impl.PyBuiltinCache;
import com.jetbrains.python.psi.impl.PyImportStatementNavigator;
| import com.jetbrains.python.packaging.PyPackageUtil;
import com.jetbrains.python.packaging.PyRequirement;
|
46,969 | final List<String> components = qname.getComponents();
if (!components.isEmpty()) {
final String packageName = components.get(0);
final Module module = ModuleUtilCore.findModuleForPsiElement(node);
final Sdk sdk = PythonSdkType.findPythonSdk(module);
<BUG>if (module != null && sdk != null) {
if (PyPIPackageUtil.INSTANCE.isInPyPI(packageName)) {</BUG>
addInstallPackageAction(actions, packageName, module, sdk);
}
else {
| if (module != null && sdk != null && PyPackageUtil.packageManagementEnabled(sdk)) {
if (PyPIPackageUtil.INSTANCE.isInPyPI(packageName)) {
|
46,970 | <BUG>package io.vertx.proton.impl;
import io.vertx.proton.ProtonMessageHandler;</BUG>
import io.vertx.proton.ProtonReceiver;
import org.apache.qpid.proton.Proton;
import org.apache.qpid.proton.engine.Delivery;
| import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.proton.ProtonMessageHandler;
|
46,971 | import org.apache.qpid.proton.message.Message;
import static io.vertx.proton.ProtonHelper.accepted;
import java.io.ByteArrayOutputStream;
public class ProtonReceiverImpl extends ProtonLinkImpl<ProtonReceiver> implements ProtonReceiver {
private ProtonMessageHandler handler;
<BUG>private int prefetch = 1000;
ProtonReceiverImpl(Receiver receiver) {</BUG>
super(receiver);
}
@Override
| private Handler<AsyncResult<Void>> drainCompleteHandler;
private Long drainTimeoutTaskId = null;
ProtonReceiverImpl(Receiver receiver) {
|
46,972 | flow(credits, true);
return this;
}
private void flow(int credits, boolean checkPrefetch) throws IllegalStateException {
if (checkPrefetch && prefetch > 0) {
<BUG>throw new IllegalStateException("Manual credit management not available while prefetch is non-zero");
}</BUG>
getReceiver().flow(credits);
flushConnection();
}
| if (drainCompleteHandler != null) {
throw new IllegalStateException("A previous drain operation has not yet completed");
|
46,973 | handler.handle(delImpl, msg);
if (autoAccept && delivery.getLocalState() == null) {
accepted(delImpl, true);
}
if (prefetch > 0) {
<BUG>flow(1, false);
}</BUG>
}
}
@Override
| } else {
processForDrainCompletion();
|
46,974 | package io.vertx.proton;
<BUG>import io.vertx.core.AsyncResult;
import io.vertx.core.Vertx;</BUG>
import org.apache.qpid.proton.amqp.transport.AmqpError;
import org.apache.qpid.proton.amqp.messaging.AmqpValue;
import org.apache.qpid.proton.message.Message;
| import io.vertx.core.Handler;
import io.vertx.core.Vertx;
|
46,975 | private volatile int credits = 1000;
private int bindPort = 0;
private boolean reuseAddress = false;
enum Addresses {
command, drop, echo, // Echos message back to consumer at address "echo"
<BUG>two_messages, five_messages
</BUG>
}
enum Commands {
disconnect
| no_messages, two_messages, five_messages
|
46,976 | sender.setCondition(condition(AmqpError.ILLEGAL_STATE.toString(), "Already have echo recipient"));
sender.close();
}
break;
}
<BUG>case drop: {
sender.open();
}</BUG>
default:
sender.setCondition(condition(AmqpError.NOT_FOUND, "unknown address")).close();
| case drop: // fall through
case no_messages: {
|
46,977 | link.fireRemoteClose();
break;
}
case LINK_FLOW: {
ProtonLinkImpl<?> link = (ProtonLinkImpl<?>) protonEvent.getLink().getContext();
<BUG>link.fireLinkFlow();
</BUG>
break;
}
case DELIVERY: {
| link.handleLinkFlow();
|
46,978 | link.setSource(source);
return self();
}
public int getUnsettled() {
return link.getUnsettled();
<BUG>}
public int getQueued() {</BUG>
return link.getQueued();
}
public boolean advance() {
| @Override
public int getQueued() {
|
46,979 | return link.getQueued();
}
public boolean advance() {
return link.advance();
}
<BUG>public int drained() {
return link.drained();
}</BUG>
public boolean detached() {
return link.detached();
| int drained = link.drained();
getSession().getConnectionImpl().flush();
return drained;
|
46,980 | import org.apache.qpid.proton.message.impl.MessageImpl;
public class ProtonSenderImpl extends ProtonLinkImpl<ProtonSender> implements ProtonSender {
private Handler<ProtonSender> drainHandler;
private boolean anonymousSender;
private boolean autoSettle;
<BUG>private int tag = 1;
ProtonSenderImpl(Sender sender) {</BUG>
super(sender);
}
private Sender sender() {
| private boolean autoDrained = true;
ProtonSenderImpl(Sender sender) {
|
46,981 | package io.vertx.proton;
<BUG>import java.lang.IllegalStateException;
public interface ProtonReceiver extends ProtonLink<ProtonReceiver> {</BUG>
ProtonReceiver handler(ProtonMessageHandler handler);
ProtonReceiver setPrefetch(int messages);
int getPrefetch();
| import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
public interface ProtonReceiver extends ProtonLink<ProtonReceiver> {
|
46,982 | 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.*;
|
46,983 | .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);
|
46,984 | </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) {
|
46,985 | 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)
|
46,986 | .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))
|
46,987 | .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))
|
46,988 | @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;
|
46,989 | 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;
}
|
46,990 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
46,991 | 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.*;
|
46,992 | .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))
|
46,993 | 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) -> {
|
46,994 | 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);
|
46,995 | 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);
|
46,996 | 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() + "\"");
|
46,997 | 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() + "\"");
|
46,998 | 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
|
46,999 | .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")
|
47,000 | tagView.setTextSize(mTagTextSize);
tagView.setHorizontalPadding(mTagHorizontalPadding);
tagView.setVerticalPadding(mTagVerticalPadding);
<BUG>tagView.setTextDirection(mTagTextDirection);
tagView.setIsViewClickable(isTagViewClickable);
}</BUG>
private void onRemoveTag(int position){
if (position < 0 || position >= mChildViews.size()){
throw new RuntimeException("Illegal position!");
}
| tagView.setOnTagClickListener(mOnTagClickListener);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.