id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
43,601 | }
@Test
public void testScopeAddedDependency() throws Exception {
makeCrossReference(resource2, resource1);
save(resourceSet);
<BUG>StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
assertEquals(2, traversal.getStorages().size());
assertTrue(traversal.getStorages().contains(iFile1));
assertTrue(traversal.getStorages().contains(iFile2));
traversal = resolver.resolveLocalModel(iFile2, monitor);
assertEquals(2, traversal.getStorages().size());
assertTrue(traversal.getStorages().contains(iFile1));
assertTrue(traversal.getStorages().contains(iFile2));</BUG>
}
| @Override
@After
public void tearDown() throws Exception {
resolver.dispose();
super.tearDown();
|
43,602 | public void testScopeRemovedDependency() throws Exception {
makeCrossReference(resource2, resource1);
save(resourceSet);
breakCrossReferences(resource2, resource1);
save(resourceSet);
<BUG>StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
assertEquals(1, traversal.getStorages().size());
assertTrue(traversal.getStorages().contains(iFile1));
traversal = resolver.resolveLocalModel(iFile2, monitor);
assertEquals(1, traversal.getStorages().size());
assertTrue(traversal.getStorages().contains(iFile2));</BUG>
}
| assertContainsExclusively(traversal, iFile1);
assertContainsExclusively(traversal, iFile2);
|
43,603 | @Test
public void testScopeUpdate() throws Exception {
makeCrossReference(resource2, resource1);
makeCrossReference(resource3, resource2);
save(resourceSet);
<BUG>StorageTraversal traversal = resolver.resolveLocalModel(iFile1, monitor);
assertEquals(3, traversal.getStorages().size());
assertTrue(traversal.getStorages().contains(iFile1));
assertTrue(traversal.getStorages().contains(iFile2));
assertTrue(traversal.getStorages().contains(iFile3));</BUG>
breakCrossReferences(resource2, resource1);
| public void testScopeRemovedDependency() throws Exception {
|
43,604 | package org.eclipse.emf.compare.ide.ui.tests.unit;
<BUG>import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;</BUG>
import java.io.File;
import java.net.URL;
| [DELETED] |
43,605 | package org.eclipse.emf.compare.ide.ui.tests;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterators.filter;
<BUG>import static org.eclipse.emf.ecore.util.EcoreUtil.getAllProperContents;
import static org.junit.Assert.assertTrue;</BUG>
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
| import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
|
43,606 | import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collections;
<BUG>import java.util.HashSet;
import org.eclipse.core.internal.resources.ResourceStatus;</BUG>
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
| import java.util.Set;
import org.eclipse.core.internal.resources.ResourceStatus;
|
43,607 | addModelFile(testProject, "invalidXMI.ecore");
IModelResolver resolver = EMFCompareIDEUIPlugin.getDefault().getModelResolverRegistry()
.getBestResolverFor(left);
SynchronizationModel synchronizationModel = resolver.resolveLocalModels(left, right, null,
new NullProgressMonitor());
<BUG>assertEquals(2, synchronizationModel.getLeftTraversal().getStorages().size());
assertTrue(synchronizationModel.getLeftTraversal().getStorages().contains(left));
assertTrue(synchronizationModel.getLeftTraversal().getStorages().contains(m2));
assertEquals(1, synchronizationModel.getRightTraversal().getStorages().size());
assertTrue(synchronizationModel.getRightTraversal().getStorages().contains(right));
Diagnostic diagnostic = synchronizationModel.getDiagnostic();</BUG>
assertEquals(Diagnostic.OK, synchronizationModel.getDiagnostic().getSeverity());
| Set<? extends IStorage> leftStorages = synchronizationModel.getLeftTraversal().getStorages();
assertEquals(2, leftStorages.size());
assertTrue(leftStorages.contains(left));
assertTrue(leftStorages.contains(m2));
Set<? extends IStorage> rightStorages = synchronizationModel.getRightTraversal().getStorages();
assertEquals(1, rightStorages.size());
assertTrue(rightStorages.contains(right));
Diagnostic diagnostic = synchronizationModel.getDiagnostic();
|
43,608 | IFile right = addModelFile(testProject, "invalidXMI.ecore");
IModelResolver resolver = EMFCompareIDEUIPlugin.getDefault().getModelResolverRegistry()
.getBestResolverFor(left);
SynchronizationModel synchronizationModel = resolver.resolveLocalModels(left, right, null,
new NullProgressMonitor());
<BUG>assertEquals(2, synchronizationModel.getLeftTraversal().getStorages().size());
assertTrue(synchronizationModel.getLeftTraversal().getStorages().contains(left));
assertTrue(synchronizationModel.getLeftTraversal().getStorages().contains(m2));
assertEquals(1, synchronizationModel.getRightTraversal().getStorages().size());
assertTrue(synchronizationModel.getRightTraversal().getStorages().contains(right));
Diagnostic diagnostic = synchronizationModel.getDiagnostic();</BUG>
assertEquals(Diagnostic.ERROR, synchronizationModel.getDiagnostic().getSeverity());
| Set<? extends IStorage> leftStorages = synchronizationModel.getLeftTraversal().getStorages();
assertEquals(2, leftStorages.size());
assertTrue(leftStorages.contains(left));
assertTrue(leftStorages.contains(m2));
Set<? extends IStorage> rightStorages = synchronizationModel.getRightTraversal().getStorages();
assertEquals(1, rightStorages.size());
assertTrue(rightStorages.contains(right));
Diagnostic diagnostic = synchronizationModel.getDiagnostic();
|
43,609 | IFile m3 = addModelFile(testProject, "model3.ecore");
IModelResolver resolver = EMFCompareIDEUIPlugin.getDefault().getModelResolverRegistry()
.getBestResolverFor(m1);
SynchronizationModel synchronizationModel = resolver.resolveLocalModels(m1, m3, null,
new NullProgressMonitor());
<BUG>assertEquals(2, synchronizationModel.getLeftTraversal().getStorages().size());
IStorage[] storages = Iterators
.toArray(synchronizationModel.getLeftTraversal().getStorages().iterator(), IStorage.class);
if (storages[0].equals(m1)) {</BUG>
assertTrue(storages[1].getFullPath().toString().contains("model2.ecore"));
| Set<? extends IStorage> leftStorages = synchronizationModel.getLeftTraversal().getStorages();
assertEquals(2, leftStorages.size());
IStorage[] storages = Iterators.toArray(leftStorages.iterator(), IStorage.class);
if (storages[0].equals(m1)) {
|
43,610 | assertTrue(storages[1].getFullPath().toString().contains("model2.ecore"));
} else {
assertTrue(storages[1].equals(m1));
assertTrue(storages[0].getFullPath().toString().contains("model2.ecore"));
}
<BUG>assertEquals(1, synchronizationModel.getRightTraversal().getStorages().size());
assertTrue(synchronizationModel.getRightTraversal().getStorages().contains(m3));
Diagnostic diagnostic = synchronizationModel.getDiagnostic();</BUG>
assertEquals(Diagnostic.ERROR, diagnostic.getSeverity());
assertEquals(1, diagnostic.getData().size());
| final Set<? extends IStorage> rightStorages = synchronizationModel.getRightTraversal().getStorages();
assertEquals(1, rightStorages.size());
assertTrue(rightStorages.contains(m3));
Diagnostic diagnostic = synchronizationModel.getDiagnostic();
|
43,611 | IFile m3 = addModelFile(testProject, "model3.ecore");
addModelFile(testProject, "dangling_ref.ecore");
IModelResolver resolver = EMFCompareIDEUIPlugin.getDefault().getModelResolverRegistry()
.getBestResolverFor(m1);
SynchronizationModel synchronizationModel = resolver.resolveLocalModels(m1, m3, null,
<BUG>new NullProgressMonitor());
assertEquals(2, synchronizationModel.getLeftTraversal().getStorages().size());
assertTrue(synchronizationModel.getLeftTraversal().getStorages().contains(m1));
assertTrue(synchronizationModel.getLeftTraversal().getStorages().contains(m2));
assertEquals(1, synchronizationModel.getRightTraversal().getStorages().size());
assertTrue(synchronizationModel.getRightTraversal().getStorages().contains(m3));</BUG>
Diagnostic diagnostic = synchronizationModel.getDiagnostic();
| assertContainsExclusively(synchronizationModel.getLeftTraversal(), m1, m2);
assertContainsExclusively(synchronizationModel.getRightTraversal(), m3);
|
43,612 | package org.gridgain.grid.kernal.processors.query.h2.sql;
import org.gridgain.grid.kernal.processors.cache.query.*;
import java.sql.*;
<BUG>import java.util.*;
public class GridSqlQuerySplitter {</BUG>
private static final String TABLE_PREFIX = "__T";
private static final String COLUMN_PREFIX = "__C";
private static String table(int idx) {
| import org.apache.ignite.*;
import static org.gridgain.grid.kernal.processors.query.h2.sql.GridSqlFunctionType.*;
public class GridSqlQuerySplitter {
|
43,613 | private static final String TABLE_PREFIX = "__T";
private static final String COLUMN_PREFIX = "__C";
private static String table(int idx) {
return TABLE_PREFIX + idx;
}
<BUG>private static String column(int idx) {
</BUG>
return COLUMN_PREFIX + idx;
}
public static GridCacheTwoStepQuery split(Connection conn, String query, Object[] params) {
| private static String columnAlias(int idx) {
|
43,614 | public GridSqlAggregateFunction(boolean distinct, GridSqlFunctionType type) {
super(type);
this.distinct = distinct;
}
public GridSqlAggregateFunction(boolean distinct, int typeId) {
<BUG>this(distinct, TYPE_INDEX[typeId]);
}</BUG>
@Override public String getSQL() {
String text;
switch (type) {
| public boolean distinct() {
return distinct;
|
43,615 | public Void run(Connection con) throws Exception {
dialect.resumeBrokenBusinessProcesses(con);
return null;
}
});
<BUG>}
public void insert(final Workflow<?> wf, final Acknowledge ack) throws Exception {</BUG>
logger.trace("insert({})", wf);
try {
run(new DatabaseTransaction<Void>() {
| @Override
public void insert(final Workflow<?> wf, final Acknowledge ack) throws Exception {
|
43,616 | ack.onSuccess();
} catch (Exception e) {
ack.onException(e);
throw e;
}
<BUG>}
public void insert(final List<Workflow<?>> wfs, final Acknowledge ack) throws Exception {</BUG>
logger.trace("insert(wfs.size={})", wfs.size());
try {
run(new DatabaseTransaction<Void>() {
| @Override
public void insert(final List<Workflow<?>> wfs, final Acknowledge ack) throws Exception {
|
43,617 | public Integer run(Connection con) throws Exception {
return dialect.deleteStaleResponse(con, MAX_ROWS);
}
});
} while (n == MAX_ROWS);
<BUG>}
public synchronized void shutdown() {</BUG>
if (shutdown)
return;
shutdown = true;
| @Override
public synchronized void shutdown() {
|
43,618 | public void insert(List<Workflow<?>> wfs, Connection con) throws Exception {
if (con == null)
insert(wfs, new Acknowledge.BestEffortAcknowledge());
else
dialect.insert(wfs, con);
<BUG>}
public void restart(final String workflowInstanceId) throws Exception {</BUG>
run(new DatabaseTransaction<Void>() {
@Override
public Void run(Connection con) throws Exception {
| public void restart(final String workflowInstanceId) throws Exception {
|
43,619 | if (batcher != null) {
batcher.submitBatchCommand(cmd);
} else {
runSingleBatchCommand(cmd);
}
<BUG>}
public void registerCallback(final RegisterCall rc, final Acknowledge callback) throws Exception {</BUG>
if (logger.isTraceEnabled())
logger.trace("registerCallback(" + rc + ")");
if (rc == null)
| @Override
public void registerCallback(final RegisterCall rc, final Acknowledge callback) throws Exception {
|
43,620 | if (logger.isTraceEnabled())
logger.trace("registerCallback(" + rc + ")");
if (rc == null)
throw new NullPointerException();
executeBatchCommand(dialect.createBatchCommand4registerCallback(rc, this, callback));
<BUG>}
public void notify(final Response<?> response, final Acknowledge callback) throws Exception {</BUG>
if (logger.isTraceEnabled())
logger.trace("notify(" + response + ")");
if (response == null)
| @Override
public void notify(final Response<?> response, final Acknowledge callback) throws Exception {
|
43,621 | public void onException(Throwable t) {
callback.onException(t);
}
};
executeBatchCommand(dialect.createBatchCommand4Notify(response, notify));
<BUG>}
public void finish(final Workflow<?> w, final Acknowledge callback) {</BUG>
if (logger.isTraceEnabled())
logger.trace("finish(" + w.getId() + ")");
try {
| @Override
public void finish(final Workflow<?> w, final Acknowledge callback) {
|
43,622 | @Override
public Workflow<?> run(Connection con) throws Exception {
return dialect.read(workflowInstanceId, con);
}
});
<BUG>}
}
</BUG>
| public void onSuccess() {
signalQueueState();
callback.onSuccess();
|
43,623 | import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.copperengine.core.Acknowledge;
<BUG>import org.copperengine.core.DuplicateIdException;
import org.copperengine.core.Response;</BUG>
import org.copperengine.core.Workflow;
import org.copperengine.core.batcher.BatchCommand;
import org.copperengine.core.common.WorkflowRepository;
| import org.copperengine.core.ProcessingState;
import org.copperengine.core.Response;
|
43,624 | boolean isTimeout = timeoutTS != null ? timeoutTS.getTime() <= System.currentTimeMillis() : false;
String response = rsResponses.getString(4);
PersistentWorkflow<?> wf = (PersistentWorkflow<?>) map.get(bpId);
Response<?> r = null;
if (response != null) {
<BUG>r = (Response<?>) serializer.deserializeResponse(response);
wf.addResponseId(r.getResponseId());</BUG>
} else if (isTimeout) {
r = new Response<Object>(cid);
}
| r = serializer.deserializeResponse(response);
wf.addResponseId(r.getResponseId());
|
43,625 | final Timestamp timeoutTS = rsResponses.getTimestamp(3);
boolean isTimeout = timeoutTS != null ? timeoutTS.getTime() <= System.currentTimeMillis() : false;
String response = rsResponses.getString(4);
Response<?> r = null;
if (response != null) {
<BUG>r = (Response<?>) serializer.deserializeResponse(response);
wf.addResponseId(r.getResponseId());</BUG>
} else if (isTimeout) {
r = new Response<Object>(cid);
}
| r = serializer.deserializeResponse(response);
wf.addResponseId(r.getResponseId());
|
43,626 | import org.copperengine.core.Acknowledge;
import org.copperengine.core.DuplicateIdException;
import org.copperengine.core.Response;
import org.copperengine.core.Workflow;
import org.copperengine.core.batcher.BatchCommand;
<BUG>public class PostgreSQLDialect extends AbstractSqlDialect {
protected PreparedStatement createUpdateStateStmt(final Connection c, final int max) throws SQLException {</BUG>
final Timestamp NOW = new Timestamp(System.currentTimeMillis());
PreparedStatement pstmt = c.prepareStatement(queryUpdateQueueState + " LIMIT " + max);
pstmt.setTimestamp(1, NOW);
| @Override
protected PreparedStatement createUpdateStateStmt(final Connection c, final int max) throws SQLException {
|
43,627 | import java.util.List;
import java.util.Map;
import org.copperengine.core.Acknowledge;
import org.copperengine.core.CopperRuntimeException;
import org.copperengine.core.DuplicateIdException;
<BUG>import org.copperengine.core.EngineIdProvider;
import org.copperengine.core.Response;</BUG>
import org.copperengine.core.Workflow;
import org.copperengine.core.batcher.BatchCommand;
import org.copperengine.core.common.WorkflowRepository;
| import org.copperengine.core.ProcessingState;
import org.copperengine.core.Response;
|
43,628 | private boolean removeWhenFinished = true;
private long defaultStaleResponseRemovalTimeout = 60 * 60 * 1000;
private int dbBatchingLatencyMSec = 0;
public OracleDialect() {
initStmtStats();
<BUG>}
public void startup() {</BUG>
if (engineIdProvider == null || engineIdProvider.getEngineId() == null)
throw new NullPointerException("EngineId is NULL! Change your " + getClass().getSimpleName() + " configuration.");
}
| @Override
public void startup() {
|
43,629 | public void setWfRepository(WorkflowRepository wfRepository) {
this.wfRepository = wfRepository;
}
public RuntimeStatisticsCollector getRuntimeStatisticsCollector() {
return runtimeStatisticsCollector;
<BUG>}
public boolean isRemoveWhenFinished() {</BUG>
return removeWhenFinished;
}
public Serializer getSerializer() {
| @Override
public boolean isRemoveWhenFinished() {
|
43,630 | String response = rsResponses.getString(3);
if (response == null)
response = rsResponses.getString(4);
Response<?> r = null;
if (response != null) {
<BUG>r = (Response<?>) serializer.deserializeResponse(response);
wf.addResponseId(r.getResponseId());</BUG>
} else if (isTimeout) {
r = new Response<Object>(cid);
}
| r = serializer.deserializeResponse(response);
wf.addResponseId(r.getResponseId());
|
43,631 | this.dependencyInjector = dependencyInjector;
}
@Override
public String getDependencyInjectorType() {
return (dependencyInjector != null) ? dependencyInjector.getType() : "UNKNOWN";
<BUG>}
public EngineState getEngineState() {</BUG>
return engineState;
}
public void setEngineIdProvider(EngineIdProvider engineIdProvider) {
| public EngineState getEngineState() {
|
43,632 | try {
startupBlocker.pass();
} catch (InterruptedException e) {
}
return wfRepository.createWorkflowFactory(classname);
<BUG>}
public synchronized void addShutdownObserver(Runnable observer) {</BUG>
shutdownObserver.add(observer);
}
@Override
| public synchronized void addShutdownObserver(Runnable observer) {
|
43,633 | assert existingWF != null;
if (existingWF != null && existingWF.getProcessingState() == ProcessingState.FINISHED) {
statisticsCollector.submit(getEngineId() + "." + wf.getClass().getSimpleName() + ".ExecutionTime", 1, System.currentTimeMillis() - wf.getCreationTS().getTime(), TimeUnit.MILLISECONDS);
}
getAndRemoveWaitHooks(wf); // Clean up...
<BUG>}
public int getNumberOfWorkflowInstances() {</BUG>
return workflowMap.size();
}
@Override
| public int getNumberOfWorkflowInstances() {
|
43,634 | Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_movies_search, container, false);
unbinder = ButterKnife.bind(this, v);
swipeRefreshLayout.setSwipeableChildren(R.id.scrollViewMoviesSearch,
R.id.recyclerViewMoviesSearch);
<BUG>swipeRefreshLayout.setOnRefreshListener(onRefreshListener);
AutoGridLayoutManager layoutManager = new AutoGridLayoutManager(getContext(),</BUG>
R.dimen.movie_grid_columnWidth, 1, 1);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(layoutManager);
| Utils.setSwipeRefreshLayoutColors(getActivity().getTheme(), swipeRefreshLayout);
AutoGridLayoutManager layoutManager = new AutoGridLayoutManager(getContext(),
|
43,635 | import android.support.annotation.StringRes;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.ActivityOptionsCompat;
import android.support.v4.app.Fragment;
<BUG>import android.support.v4.content.ContextCompat;
import android.text.TextUtils;</BUG>
import android.text.format.DateUtils;
import android.util.Base64;
import android.util.TypedValue;
| import android.support.v4.widget.SwipeRefreshLayout;
import android.text.TextUtils;
|
43,636 | recyclerView.setHasFixedSize(true);
return v;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
<BUG>super.onActivityCreated(savedInstanceState);
int accentColorResId = Utils.resolveAttributeToResourceId(getActivity().getTheme(),
R.attr.colorAccent);
swipeRefreshLayout.setColorSchemeResources(accentColorResId, R.color.teal_500);</BUG>
adapter = new NowAdapter(getActivity(), itemClickListener);
| Utils.setSwipeRefreshLayoutColors(getActivity().getTheme(), swipeRefreshLayout);
|
43,637 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_movies_discover, container, false);
unbinder = ButterKnife.bind(this, view);
swipeRefreshLayout.setOnRefreshListener(onRefreshListener);
<BUG>swipeRefreshLayout.setRefreshing(false);
adapter = new MoviesDiscoverAdapter(getContext(),</BUG>
new MovieItemClickListener(getActivity()));
layoutManager = new AutoGridLayoutManager(getContext(),
R.dimen.movie_grid_columnWidth, 2, 6);
| Utils.setSwipeRefreshLayoutColors(getActivity().getTheme(), swipeRefreshLayout);
adapter = new MoviesDiscoverAdapter(getContext(),
|
43,638 | showProgressBar(true);
return v;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
<BUG>super.onActivityCreated(savedInstanceState);
int accentColorResId = Utils.resolveAttributeToResourceId(getActivity().getTheme(),
R.attr.colorAccent);
contentContainer.setColorSchemeResources(accentColorResId, R.color.teal_500);</BUG>
if (adapter == null) {
| Utils.setSwipeRefreshLayoutColors(getActivity().getTheme(), contentContainer);
|
43,639 | recyclerView.setHasFixedSize(true);
return v;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
<BUG>super.onActivityCreated(savedInstanceState);
int accentColorResId = Utils.resolveAttributeToResourceId(getActivity().getTheme(),
R.attr.colorAccent);
swipeRefreshLayout.setColorSchemeResources(accentColorResId, R.color.teal_500);</BUG>
adapter = new MoviesNowAdapter(getContext(), itemClickListener);
| Utils.setSwipeRefreshLayoutColors(getActivity().getTheme(), swipeRefreshLayout);
|
43,640 | super(host);
}
String uri(String uri) {
return super.configureUri(uri);
}
<BUG>}
@Test(expected = IllegalArgumentException.class)
public void constructorNullArgument() {
new GitHubClient((HttpHost) null);</BUG>
}
| [DELETED] |
43,641 | Map<String, Object> _revisions = ClientTestUtils.getRevisionHistory(revision3, revision2, revision1);
doc1.put(CouchConstants._rev, revision3);
doc1.put(CouchConstants._revisions, _revisions);
List<Response> responses = client.bulkCreateDocs(doc1);
Assert.assertEquals(0, responses.size());
<BUG>Map<String, Object> allRevs = client.getDocRevisions(res1.getId(), revision3, JSONUtils.mapStringToObject());
</BUG>
int revisionStart = (Integer) ((Map<String, Object>) allRevs.get(CouchConstants._revisions)).get
(CouchConstants.start);
Assert.assertEquals(3, revisionStart);
| Map<String, Object> allRevs = client.getDocRevisions(res1.getId(), revision3, JSONUtils.STRING_MAP_TYPE_DEF);
|
43,642 | Assert.assertEquals("world", doc.get("hello"));
Assert.assertTrue(doc.containsKey(CouchConstants._id));
Assert.assertEquals(res.getId(), doc.get(CouchConstants._id));
Assert.assertTrue(doc.containsKey(CouchConstants._rev));
Assert.assertEquals(res.getRev(), doc.get(CouchConstants._rev));
<BUG>}
@Test(expected = NoResourceException.class)
public void getDocumentInputStream_idNotExist_exception() {
client.getDocumentStream("id_not_exist", "1-no_such_rev");</BUG>
}
| [DELETED] |
43,643 | import com.cloudant.sync.internal.mazha.DocumentRevs;
import com.cloudant.sync.internal.mazha.Response;
<BUG>import com.cloudant.sync.internal.documentstore.InternalDocumentRevision;
import com.cloudant.sync.internal.documentstore.DocumentRevsList;
import com.cloudant.sync.internal.documentstore.MultipartAttachmentWriter;
import com.cloudant.sync.documentstore.UnsavedStreamAttachment;</BUG>
import com.cloudant.sync.replication.PullFilter;
import java.util.Collection;
import java.util.List;
import java.util.Map;
| [DELETED] |
43,644 | return executeResult;
} finally {
IOUtils.closeQuietly(errorStream);
}
}
<BUG>private InputStream executeToInputStreamWithRetry(final Callable<ExecuteResult> task) throws CouchException {
int attempts = 10;
CouchException lastException= null;
</BUG>
while (attempts-- > 0) {
| private <T> T executeWithRetry(final Callable<ExecuteResult> task,
InputStreamProcessor<T> processor) throws
CouchException lastException = null;
|
43,645 | public boolean contains(String id) {
Misc.checkNotNullOrEmpty(id, "id");
URI doc = this.uriHelper.documentUri(id);
try {
HttpConnection connection = Http.HEAD(doc);
<BUG>this.executeToInputStreamWithRetry(connection);
return true;</BUG>
} catch (Exception e) {
return false;
}
| this.executeWithRetry(connection, new NoOpInputStreamProcessor());
return true;
|
43,646 | final URI doc = this.uriHelper.attachmentUri(id, queries, attachmentName);
HttpConnection connection = Http.GET(doc);
if (acceptGzip) {
connection.requestProperties.put("Accept-Encoding", "gzip");
}
<BUG>return executeToInputStreamWithRetry(connection);
</BUG>
}
public void putAttachmentStream(String id, String rev, String attachmentName, String contentType, byte[] attachmentData) {
Misc.checkNotNullOrEmpty(id, "id");
| return executeWithRetry(connection, processor);
|
43,647 | } else {
options.put("attachments", false);
options.put("att_encoding_info", true);
}
options.put("open_revs", JSONUtils.toJson(revisions));
<BUG>return this.getDocument(id, options, JSONUtils.openRevisionList());
}</BUG>
public Iterable<DocumentRevsList> bulkReadDocsWithOpenRevisions(List<BulkGetRequest> request,
boolean pullAttachmentsInline) {
Map<String, Object> options = new HashMap<String, Object>();
| return this.getDocument(id, options, JSONUtils.OPEN_REVS_LIST_TYPE_DEF);
|
43,648 | Misc.checkNotNull(rev, "Revision ID");
Map<String, Object> queries = new HashMap<String, Object>();
queries.put("revs", "true");
queries.put("rev", rev);
URI findRevs = this.uriHelper.documentUri(id, queries);
<BUG>InputStream is = null;
try {
HttpConnection connection = Http.GET(findRevs);
is = this.executeToInputStreamWithRetry(connection);
return JSONUtils.fromJson(new InputStreamReader(is, Charset.forName("UTF-8")), type);
} finally {
closeQuietly(is);
}</BUG>
}
| return executeToJsonObjectWithRetry(connection, type);
|
43,649 | package com.cloudant.sync.internal.replication;
import com.cloudant.http.HttpConnectionRequestInterceptor;
import com.cloudant.http.HttpConnectionResponseInterceptor;
<BUG>import com.cloudant.sync.internal.mazha.ChangesResult;
import com.cloudant.sync.internal.mazha.CouchClient;
import com.cloudant.sync.internal.mazha.DocumentRevs;</BUG>
import com.cloudant.sync.documentstore.Attachment;
import com.cloudant.sync.documentstore.Database;
| [DELETED] |
43,650 | attachmentName);
if (a != null) {
continue;
}
}
<BUG>UnsavedStreamAttachment usa = this.sourceDb
.getAttachmentStream(documentRevs.getId(),
documentRevs.getRev(), attachmentName,
contentType, encoding);
preparedAtts.put(attachmentName, this.targetDb.prepareAttachment(usa, length,
encodedLength));
}</BUG>
}
| preparedAtts.put(attachmentName, this.sourceDb.pullAttachmentWithRetry
(documentRevs.getId(), documentRevs.getRev(), entry
.getKey(), new AttachmentPullProcessor(this
.targetDb, entry.getKey(), contentType,
encoding, length, encodedLength)));
|
43,651 | System.out.println(change);
}
}
};
@Override
<BUG>protected Callback<VChild, Void> copyChildCallback()
</BUG>
{
return (child) ->
{
| protected Callback<VChild, Void> copyIntoCallback()
|
43,652 | package jfxtras.labs.icalendarfx.components;
import jfxtras.labs.icalendarfx.properties.component.descriptive.Comment;
<BUG>import jfxtras.labs.icalendarfx.properties.component.misc.IANAProperty;
import jfxtras.labs.icalendarfx.properties.component.misc.UnknownProperty;</BUG>
import jfxtras.labs.icalendarfx.properties.component.recurrence.RecurrenceDates;
import jfxtras.labs.icalendarfx.properties.component.recurrence.RecurrenceRule;
| import jfxtras.labs.icalendarfx.properties.component.misc.NonStandardProperty;
|
43,653 | VEVENT ("VEVENT",
Arrays.asList(PropertyType.ATTACHMENT, PropertyType.ATTENDEE, PropertyType.CATEGORIES,
PropertyType.CLASSIFICATION, PropertyType.COMMENT, PropertyType.CONTACT, PropertyType.DATE_TIME_CREATED,
PropertyType.DATE_TIME_END, PropertyType.DATE_TIME_STAMP, PropertyType.DATE_TIME_START,
PropertyType.DESCRIPTION, PropertyType.DURATION, PropertyType.EXCEPTION_DATE_TIMES,
<BUG>PropertyType.GEOGRAPHIC_POSITION, PropertyType.IANA_PROPERTY, PropertyType.LAST_MODIFIED,
PropertyType.LOCATION, PropertyType.NON_STANDARD, PropertyType.ORGANIZER, PropertyType.PRIORITY,</BUG>
PropertyType.RECURRENCE_DATE_TIMES, PropertyType.RECURRENCE_IDENTIFIER, PropertyType.RELATED_TO,
PropertyType.RECURRENCE_RULE, PropertyType.REQUEST_STATUS, PropertyType.RESOURCES, PropertyType.SEQUENCE,
PropertyType.STATUS, PropertyType.SUMMARY, PropertyType.TIME_TRANSPARENCY, PropertyType.UNIQUE_IDENTIFIER,
| PropertyType.GEOGRAPHIC_POSITION, PropertyType.LAST_MODIFIED,
PropertyType.LOCATION, PropertyType.NON_STANDARD, PropertyType.ORGANIZER, PropertyType.PRIORITY,
|
43,654 | VTODO ("VTODO",
Arrays.asList(PropertyType.ATTACHMENT, PropertyType.ATTENDEE, PropertyType.CATEGORIES,
PropertyType.CLASSIFICATION, PropertyType.COMMENT, PropertyType.CONTACT, PropertyType.DATE_TIME_COMPLETED,
PropertyType.DATE_TIME_CREATED, PropertyType.DATE_TIME_DUE, PropertyType.DATE_TIME_STAMP,
PropertyType.DATE_TIME_START, PropertyType.DESCRIPTION, PropertyType.DURATION,
<BUG>PropertyType.EXCEPTION_DATE_TIMES, PropertyType.GEOGRAPHIC_POSITION, PropertyType.IANA_PROPERTY,
PropertyType.LAST_MODIFIED, PropertyType.LOCATION, PropertyType.NON_STANDARD, PropertyType.ORGANIZER,</BUG>
PropertyType.PERCENT_COMPLETE, PropertyType.PRIORITY, PropertyType.RECURRENCE_DATE_TIMES,
PropertyType.RECURRENCE_IDENTIFIER, PropertyType.RELATED_TO, PropertyType.RECURRENCE_RULE,
PropertyType.REQUEST_STATUS, PropertyType.RESOURCES, PropertyType.SEQUENCE, PropertyType.STATUS,
| PropertyType.EXCEPTION_DATE_TIMES, PropertyType.GEOGRAPHIC_POSITION,
PropertyType.LAST_MODIFIED, PropertyType.LOCATION, PropertyType.NON_STANDARD, PropertyType.ORGANIZER,
|
43,655 | throw new RuntimeException("not implemented");
}
},
DAYLIGHT_SAVING_TIME ("DAYLIGHT",
Arrays.asList(PropertyType.COMMENT, PropertyType.DATE_TIME_START,
<BUG>PropertyType.IANA_PROPERTY, PropertyType.NON_STANDARD, PropertyType.RECURRENCE_DATE_TIMES,
PropertyType.RECURRENCE_RULE, PropertyType.TIME_ZONE_NAME, PropertyType.TIME_ZONE_OFFSET_FROM,</BUG>
PropertyType.TIME_ZONE_OFFSET_TO),
DaylightSavingTime.class)
{
| PropertyType.RECURRENCE_RULE, PropertyType.TIME_ZONE_NAME, PropertyType.TIME_ZONE_OFFSET_FROM,
|
43,656 | throw new RuntimeException("not implemented");
}
},
VALARM ("VALARM",
Arrays.asList(PropertyType.ACTION, PropertyType.ATTACHMENT, PropertyType.ATTENDEE, PropertyType.DESCRIPTION,
<BUG>PropertyType.DURATION, PropertyType.IANA_PROPERTY, PropertyType.NON_STANDARD, PropertyType.REPEAT_COUNT,
PropertyType.SUMMARY, PropertyType.TRIGGER),</BUG>
VAlarm.class)
{
@Override
| DAYLIGHT_SAVING_TIME ("DAYLIGHT",
Arrays.asList(PropertyType.COMMENT, PropertyType.DATE_TIME_START,
PropertyType.NON_STANDARD, PropertyType.RECURRENCE_DATE_TIMES,
PropertyType.RECURRENCE_RULE, PropertyType.TIME_ZONE_NAME, PropertyType.TIME_ZONE_OFFSET_FROM,
PropertyType.TIME_ZONE_OFFSET_TO),
DaylightSavingTime.class)
|
43,657 | private ContentLineStrategy contentLineGenerator;
protected void setContentLineGenerator(ContentLineStrategy contentLineGenerator)
{
this.contentLineGenerator = contentLineGenerator;
}
<BUG>protected Callback<VChild, Void> copyChildCallback()
</BUG>
{
throw new RuntimeException("Can't copy children. copyChildCallback isn't overridden in subclass." + this.getClass());
};
| protected Callback<VChild, Void> copyIntoCallback()
|
43,658 | import jfxtras.labs.icalendarfx.properties.calendar.Version;
import jfxtras.labs.icalendarfx.properties.component.misc.NonStandardProperty;
public enum CalendarProperty
{
CALENDAR_SCALE ("CALSCALE",
<BUG>Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD, ParameterType.IANA_PARAMETER),
CalendarScale.class)</BUG>
{
@Override
public VChild parse(VCalendar vCalendar, String contentLine)
| Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD),
CalendarScale.class)
|
43,659 | CalendarScale calendarScale = (CalendarScale) child;
destination.setCalendarScale(calendarScale);
}
},
METHOD ("METHOD",
<BUG>Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD, ParameterType.IANA_PARAMETER),
Method.class)</BUG>
{
@Override
public VChild parse(VCalendar vCalendar, String contentLine)
| Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD),
Method.class)
|
43,660 | }
list.add(new NonStandardProperty((NonStandardProperty) child));
}
},
PRODUCT_IDENTIFIER ("PRODID",
<BUG>Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD, ParameterType.IANA_PARAMETER),
ProductIdentifier.class)</BUG>
{
@Override
public VChild parse(VCalendar vCalendar, String contentLine)
| public void copyChild(VChild child, VCalendar destination)
CalendarScale calendarScale = (CalendarScale) child;
destination.setCalendarScale(calendarScale);
METHOD ("METHOD",
Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD),
Method.class)
|
43,661 | ProductIdentifier productIdentifier = (ProductIdentifier) child;
destination.setProductIdentifier(productIdentifier);
}
},
VERSION ("VERSION",
<BUG>Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD, ParameterType.IANA_PARAMETER),
Version.class)</BUG>
{
@Override
public VChild parse(VCalendar vCalendar, String contentLine)
| Arrays.asList(ParameterType.VALUE_DATA_TYPES, ParameterType.NON_STANDARD),
Version.class)
|
43,662 | package jfxtras.labs.icalendarfx.components;
import jfxtras.labs.icalendarfx.properties.component.descriptive.Comment;
<BUG>import jfxtras.labs.icalendarfx.properties.component.misc.IANAProperty;
import jfxtras.labs.icalendarfx.properties.component.misc.UnknownProperty;</BUG>
import jfxtras.labs.icalendarfx.properties.component.recurrence.RecurrenceDates;
import jfxtras.labs.icalendarfx.properties.component.recurrence.RecurrenceRule;
| import jfxtras.labs.icalendarfx.properties.component.misc.NonStandardProperty;
|
43,663 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
43,664 | }
@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);
|
43,665 | 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);
|
43,666 | 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(
|
43,667 | 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 {
|
43,668 | 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;
|
43,669 | 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) {
|
43,670 | 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;
|
43,671 | Env<ByteBuffer> env;
Dbi<ByteBuffer> db;
LinkedList<Integer> list = new LinkedList<>();
private Env<ByteBuffer> makeEnv() {
try {
<BUG>env = create(PROXY_OPTIMAL);
final File path = tmp.newFile();
env.setMapSize(1_024 * 1_024);
env.setMaxDbs(1);
env.setMaxReaders(1);
env.open(path, POSIX_MODE, MDB_NOSUBDIR);
db = env.openDbi(DB_1, MDB_CREATE);</BUG>
list.addAll(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8));
| env = create(PROXY_OPTIMAL)
.setMapSize(1_024 * 1_024)
.setMaxDbs(1)
.setMaxReaders(1)
db = env.openDbi(DB_1, MDB_CREATE);
|
43,672 | import org.lmdbjava.Txn.ReadWriteRequiredException;
import static org.lmdbjava.TxnFlags.MDB_RDONLY;
public final class Env<T> implements AutoCloseable {
public static final String DISABLE_CHECKS_PROP = "lmdbjava.disable.checks";
public static final boolean SHOULD_CHECK = !getBoolean(DISABLE_CHECKS_PROP);
<BUG>public static Env<ByteBuffer> create() {
return new Env<>(PROXY_OPTIMAL);
}
public static <T> Env<T> create(final BufferProxy<T> proxy) {
return new Env<>(proxy);
</BUG>
}
| public static Builder<ByteBuffer> create() {
Env<ByteBuffer> env = new Env<>(PROXY_OPTIMAL);
return new Builder<>(env);
public static <T> Builder<T> create(final BufferProxy<T> proxy) {
return new Builder<>(new Env<>(proxy));
|
43,673 | import de.vanita5.twittnuker.receiver.NotificationReceiver;
import de.vanita5.twittnuker.service.LengthyOperationsService;
import de.vanita5.twittnuker.util.ActivityTracker;
import de.vanita5.twittnuker.util.AsyncTwitterWrapper;
import de.vanita5.twittnuker.util.DataStoreFunctionsKt;
<BUG>import de.vanita5.twittnuker.util.DataStoreUtils;
import de.vanita5.twittnuker.util.ImagePreloader;</BUG>
import de.vanita5.twittnuker.util.InternalTwitterContentUtils;
import de.vanita5.twittnuker.util.JsonSerializer;
import de.vanita5.twittnuker.util.NotificationManagerWrapper;
| import de.vanita5.twittnuker.util.DebugLog;
import de.vanita5.twittnuker.util.ImagePreloader;
|
43,674 | final List<InetAddress> addresses = mDns.lookup(host);
for (InetAddress address : addresses) {
c.addRow(new String[]{host, address.getHostAddress()});
}
} catch (final IOException ignore) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, ignore);
}</BUG>
}
| DebugLog.w(LOGTAG, null, ignore);
|
43,675 | @Override
public void afterExecute(Bus handler, SingleResponse<Relationship> result) {
if (result.hasData()) {
handler.post(new FriendshipUpdatedEvent(accountKey, userKey, result.getData()));
} else if (result.hasException()) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, "Unable to update friendship", result.getException());
}</BUG>
}
| public UserKey[] getAccountKeys() {
return DataStoreUtils.getActivatedAccountKeys(context);
|
43,676 | MicroBlog microBlog = MicroBlogAPIFactory.getInstance(context, accountId);
if (!Utils.isOfficialCredentials(context, accountId)) continue;
try {
microBlog.setActivitiesAboutMeUnread(cursor);
} catch (MicroBlogException e) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, e);
}</BUG>
}
| DebugLog.w(LOGTAG, null, e);
|
43,677 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
twitter.updateProfileBannerImage(fileBody);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
43,678 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
twitter.updateProfileBackgroundImage(fileBody, tile);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| twitter.updateProfileBannerImage(fileBody);
if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
43,679 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
return twitter.updateProfileImage(fileBody);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| twitter.updateProfileBannerImage(fileBody);
if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
43,680 | import de.vanita5.twittnuker.annotation.CustomTabType;
import de.vanita5.twittnuker.library.MicroBlog;
import de.vanita5.twittnuker.library.MicroBlogException;
import de.vanita5.twittnuker.library.twitter.model.RateLimitStatus;
import de.vanita5.twittnuker.library.twitter.model.Status;
<BUG>import de.vanita5.twittnuker.fragment.AbsStatusesFragment;
import org.mariotaku.sqliteqb.library.AllColumns;</BUG>
import org.mariotaku.sqliteqb.library.Columns;
import org.mariotaku.sqliteqb.library.Columns.Column;
import org.mariotaku.sqliteqb.library.Expression;
| import org.mariotaku.pickncrop.library.PNCUtils;
import org.mariotaku.sqliteqb.library.AllColumns;
|
43,681 | context.getApplicationContext().sendBroadcast(intent);
}
}
@Nullable
public static Location getCachedLocation(Context context) {
<BUG>if (BuildConfig.DEBUG) {
Log.v(LOGTAG, "Fetching cached location", new Exception());
}</BUG>
Location location = null;
| DebugLog.v(LOGTAG, "Fetching cached location", new Exception());
|
43,682 | import java.util.List;
import java.util.Map.Entry;
import javax.inject.Singleton;
import okhttp3.Dns;
@Singleton
<BUG>public class TwidereDns implements Constants, Dns {
</BUG>
private static final String RESOLVER_LOGTAG = "TwittnukerDns";
private final SharedPreferences mHostMapping;
private final SharedPreferencesWrapper mPreferences;
| public class TwidereDns implements Dns, Constants {
|
43,683 | for (Location location : twitter.getAvailableTrends()) {
map.put(location);
}
return map.pack();
} catch (final MicroBlogException e) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, e);
}</BUG>
}
| DebugLog.w(LOGTAG, null, e);
|
43,684 | HttpURLConnection conn = connectionFactory.create(servletUrl);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestProperty(CONTENT_TYPE_HEADER, JSON_MIME_TYPE);
conn.setRequestProperty(ACCEPT_HEADER, JSON_MIME_TYPE);
<BUG>conn.setRequestMethod(POST_METHOD);
conn.setRequestProperty(PlatformConstants.CLIENT_ID_HTTP_HEADER_NAME, clientId);
setRequestCookies(conn);</BUG>
String content = codec.encode(commands);
OutputStream w = conn.getOutputStream();
| if(clientId != null) {
}
setRequestCookies(conn);
|
43,685 | private File writeTestFile()
throws Exception
{
File output = new File( "target/DependenciesScannerTest-tests.jar" );
output.delete();
<BUG>ZipOutputStream out = new ZipOutputStream( new FileOutputStream( output ) );
try
{
out.putNextEntry( new ZipEntry( "org/test/TestA.class" ) );</BUG>
out.closeEntry();
| ZipOutputStream out = null;
out.putNextEntry( new ZipEntry( "org/test/TestA.class" ) );
|
43,686 | package org.apache.maven.plugin.surefire.runorder;
import java.io.File;
<BUG>import java.io.FileNotFoundException;
</BUG>
import org.apache.maven.surefire.report.ReportEntry;
import static org.apache.maven.plugin.surefire.runorder.RunEntryStatisticsMap.fromFile;
public class StatisticsReporter
| import java.io.IOException;
|
43,687 | import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
<BUG>import java.io.PrintWriter;
import java.util.List;
import static org.apache.maven.plugin.surefire.report.FileReporterUtils.stripIllegalFilenameChars;</BUG>
import static org.apache.maven.surefire.util.internal.StringUtils.isNotBlank;
public class FileReporter
{
private final File reportsDirectory;
| import org.apache.maven.surefire.report.ReportEntry;
import org.apache.maven.surefire.report.ReporterException;
import static org.apache.maven.plugin.surefire.report.FileReporterUtils.stripIllegalFilenameChars;
|
43,688 | Assert.assertEquals(msg, result2);
}
@Test
public void testAsciiConverter() {
HttpResponse response = createOkResponse();
<BUG>byte[] payload = parser.marshalToBytes(response);
</BUG>
ConvertAscii converter = new ConvertAscii();
String readableForm = converter.convertToReadableForm(payload);
Assert.assertEquals(
| byte[] payload = unwrap(parser.marshalToByteBuffer(response));
|
43,689 | Assert.assertEquals(response, httpMessage);
}
@Test
public void test2AndHalfHttpMessages() {
HttpResponse response = createOkResponse();
<BUG>byte[] payload = parser.marshalToBytes(response);
</BUG>
byte[] first = new byte[2*payload.length + 20];
byte[] second = new byte[payload.length - 20];
System.arraycopy(payload, 0, first, 0, payload.length);
| byte[] payload = unwrap(parser.marshalToByteBuffer(response));
|
43,690 | DataWrapper payload1 = dataGen.wrapByteArray("0123456789".getBytes());
HttpChunk chunk = new HttpChunk();
chunk.addExtension(new HttpChunkExtension("asdf", "value"));
chunk.addExtension(new HttpChunkExtension("something"));
chunk.setBody(payload1);
<BUG>byte[] payload = parser.marshalToBytes(chunk);
</BUG>
String str = new String(payload);
Assert.assertEquals("a;asdf=value;something\r\n0123456789\r\n", str);
HttpLastChunk lastChunk = new HttpLastChunk();
| byte[] payload = unwrap(parser.marshalToByteBuffer(chunk));
|
43,691 | HttpLastChunk lastChunk = new HttpLastChunk();
lastChunk.addExtension(new HttpChunkExtension("this", "that"));
lastChunk.addHeader(new Header("customer", "value"));
String lastPayload = parser.marshalToString(lastChunk);
Assert.assertEquals("0;this=that\r\ncustomer: value\r\n\r\n", lastPayload);
<BUG>byte[] lastBytes = parser.marshalToBytes(lastChunk);
</BUG>
String lastPayloadFromBytes = new String(lastBytes, HttpParserFactory.iso8859_1);
Assert.assertEquals("0;this=that\r\ncustomer: value\r\n\r\n", lastPayloadFromBytes);
}
| byte[] lastBytes = unwrap(parser.marshalToByteBuffer(lastChunk));
|
43,692 | import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
<BUG>import org.slf4j.Logger;
import org.slf4j.LoggerFactory;</BUG>
import org.webpieces.data.api.BufferPool;
import org.webpieces.data.api.DataWrapper;
import org.webpieces.data.api.DataWrapperGenerator;
| [DELETED] |
43,693 | import java.nio.ByteBuffer;
import org.webpieces.data.api.DataWrapper;
import org.webpieces.httpparser.api.dto.HttpPayload;
public interface HttpParser {
ByteBuffer marshalToByteBuffer(HttpPayload request);
<BUG>byte[] marshalToBytes(HttpPayload request);</BUG>
String marshalToString(HttpPayload request);
Memento prepareToParse();
Memento parse(Memento state, DataWrapper moreData);
HttpPayload unmarshal(byte[] msg);
}
| [DELETED] |
43,694 | HttpRequestLine requestLine = new HttpRequestLine();
requestLine.setMethod(KnownHttpMethod.GET);
requestLine.setUri(new HttpUri("http://www.deano.com"));
HttpRequest req = new HttpRequest();
req.setRequestLine(requestLine);
<BUG>byte[] array = parser.marshalToBytes(req);
</BUG>
ByteBuffer buffer = ByteBuffer.wrap(array);
dataListener.incomingData(mockTcpChannel, ByteBuffer.allocate(0));
dataListener.incomingData(mockTcpChannel, buffer);
| byte[] array = unwrap(parser.marshalToByteBuffer(req));
|
43,695 | Assert.assertEquals(msg, result2);
}
@Test
public void testAsciiConverter() {
HttpRequest request = createPostRequest();
<BUG>byte[] payload = parser.marshalToBytes(request);
</BUG>
ConvertAscii converter = new ConvertAscii();
String readableForm = converter.convertToReadableForm(payload);
String expected = "POST\\s http://myhost.com\\s HTTP/1.1\\r\\n\r\n"
| byte[] payload = unwrap(parser.marshalToByteBuffer(request));
|
43,696 | Assert.assertEquals(request, httpMessage);
}
@Test
public void test2AndHalfHttpMessages() {
HttpRequest request = createPostRequest();
<BUG>byte[] payload = parser.marshalToBytes(request);
</BUG>
byte[] first = new byte[2*payload.length + 20];
byte[] second = new byte[payload.length - 20];
System.arraycopy(payload, 0, first, 0, payload.length);
| byte[] payload = unwrap(parser.marshalToByteBuffer(request));
|
43,697 | import org.spacehq.mc.protocol.ProtocolConstants;
import org.spacehq.mc.protocol.data.game.values.PlayerListEntry;
import org.spacehq.mc.protocol.data.game.values.entity.player.GameMode;
import org.spacehq.mc.protocol.packet.ingame.server.ServerChatPacket;
import org.spacehq.mc.protocol.packet.ingame.server.ServerRespawnPacket;
<BUG>import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerDestroyEntitiesPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityTeleportPacket;</BUG>
import org.spacehq.mc.protocol.packet.ingame.server.entity.player.ServerPlayerPositionRotationPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.spawn.ServerSpawnPlayerPacket;
import org.spacehq.mc.protocol.packet.ingame.server.window.ServerSetSlotPacket;
| import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityPositionPacket;
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityTeleportPacket;
|
43,698 | if (MCThunder.getRankManager().getCommandLevelFromRank(playerRank) >= CommandRegistry.getCommand(command,"net.mcthunder.commands.").getRankPoints()){
Command cmd = CommandRegistry.getCommand(command, "net.mcthunder.commands.");
if (!cmd.execute(player, packet.getMessage().contains(" ") ? packet.getMessage().trim().substring(packet.getMessage().trim().indexOf(" ")).trim().split(" ") : new String[0]))</BUG>
player.sendMessage("&4" + cmd.getArguments());
<BUG>} else {
MCThunder.getRankManager().deny(player,CommandRegistry.getCommand(command, "net.mcthunder.commands."));
}
} catch (NullPointerException e) {
player.sendMessage("&4Unknown Command!");</BUG>
}
| @Override
public boolean removeDefaultListener() {
return true;
|
43,699 | for (Command c : commands.values())
if (c.getAliases().contains(name))
return c;
return null;
}
<BUG>public static Command getCommand(String node) {
for (Command c : commands.values())
if (c.getPermissionNode().equalsIgnoreCase(node))
return c;
return null;</BUG>
}
| public static Command loadCommand(String name, String pkg) {
try {
String header = commands.containsKey(name.toLowerCase()) ? pkg.replace("net.mcthunder.", "").replace(".commands.", "").replace("commands.", "") + ":" : "";
commands.put((header + name.toLowerCase()).trim(), (Command) Command.class.getClassLoader().loadClass(pkg + StringUtils.capitalize(name)).newInstance());
return commands.get((header + name.toLowerCase()).trim());
} catch (Exception ignored) { }
|
43,700 | List<String> paths = Arrays.asList("net.mcthunder.commands", "net.mcthunder.rankmanager.commands");
for (String path : paths) {
Reflections reflections = new Reflections(path);
Set<Class<? extends Command>> subTypes = reflections.getSubTypesOf(Command.class);
for (Class c : subTypes)
<BUG>if (CommandRegistry.getCommand(c.getSimpleName(), path + ".") != null)
</BUG>
commands++;
}
tellConsole(LoggingLevel.INFO, commands + " command" + (commands != 1 ? "s " : "") + "were loaded.");
| if (CommandRegistry.loadCommand(c.getSimpleName(), path + ".") != null)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.