id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
17,801
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);
17,802
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);
17,803
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);
17,804
import org.mariotaku.twidere.receiver.NotificationReceiver; import org.mariotaku.twidere.service.LengthyOperationsService; import org.mariotaku.twidere.util.ActivityTracker; import org.mariotaku.twidere.util.AsyncTwitterWrapper; import org.mariotaku.twidere.util.DataStoreFunctionsKt; <BUG>import org.mariotaku.twidere.util.DataStoreUtils; import org.mariotaku.twidere.util.ImagePreloader;</BUG> import org.mariotaku.twidere.util.InternalTwitterContentUtils; import org.mariotaku.twidere.util.JsonSerializer; import org.mariotaku.twidere.util.NotificationManagerWrapper;
import org.mariotaku.twidere.util.DebugLog; import org.mariotaku.twidere.util.ImagePreloader;
17,805
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);
17,806
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);
17,807
import android.content.Context; import android.content.SharedPreferences; import android.location.Location; import android.os.AsyncTask; import android.support.annotation.NonNull; <BUG>import android.util.Log; import org.mariotaku.twidere.BuildConfig; import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.util.JsonSerializer;</BUG> import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.util.DebugLog; import org.mariotaku.twidere.util.JsonSerializer;
17,808
} public static LatLng getCachedLatLng(@NonNull final Context context) { final Context appContext = context.getApplicationContext(); final SharedPreferences prefs = DependencyHolder.Companion.get(context).getPreferences(); if (!prefs.getBoolean(KEY_USAGE_STATISTICS, false)) return null; <BUG>if (BuildConfig.DEBUG) { Log.d(HotMobiLogger.LOGTAG, "getting cached location"); }</BUG> final Location location = Utils.getCachedLocation(appContext);
DebugLog.d(HotMobiLogger.LOGTAG, "getting cached location", null);
17,809
public int destroySavedSearchAsync(final UserKey accountKey, final long searchId) { final DestroySavedSearchTask task = new DestroySavedSearchTask(accountKey, searchId); return asyncTaskManager.add(task, true); } public int destroyStatusAsync(final UserKey accountKey, final String statusId) { <BUG>final DestroyStatusTask task = new DestroyStatusTask(context,accountKey, statusId); </BUG> return asyncTaskManager.add(task, true); } public int destroyUserListAsync(final UserKey accountKey, final String listId) {
final DestroyStatusTask task = new DestroyStatusTask(context, accountKey, statusId);
17,810
@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);
17,811
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);
17,812
package org.elasticsearch.repositories.hdfs; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; <BUG>import java.util.Collection; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;</BUG> import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.client.Client;
import java.util.Collections; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
17,813
client.prepareDelete("test-idx-2", "doc", Integer.toString(i)).get(); } for (int i = 0; i < 100; i += 2) { client.prepareDelete("test-idx-3", "doc", Integer.toString(i)).get(); } <BUG>refresh(); assertThat(count(client, "test-idx-1"), equalTo(50L));</BUG> assertThat(count(client, "test-idx-2"), equalTo(50L)); assertThat(count(client, "test-idx-3"), equalTo(50L)); logger.info("--> close indices");
client().admin().indices().prepareRefresh().get(); assertThat(count(client, "test-idx-1"), equalTo(50L));
17,814
ensureGreen(); assertThat(count(client, "test-idx-1"), equalTo(100L)); assertThat(count(client, "test-idx-2"), equalTo(100L)); assertThat(count(client, "test-idx-3"), equalTo(50L)); logger.info("--> delete indices"); <BUG>cluster().wipeIndices("test-idx-1", "test-idx-2"); logger.info("--> restore one index after deletion");</BUG> restoreSnapshotResponse = client.admin().cluster().prepareRestoreSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test-idx-*", "-test-idx-2").execute().actionGet(); assertThat(restoreSnapshotResponse.getRestoreInfo().totalShards(), greaterThan(0)); ensureGreen();
client().admin().indices().prepareDelete("test-idx-1", "test-idx-2").get(); logger.info("--> restore one index after deletion");
17,815
.put("path", "a@b$c#11:22") .put("chunk_size", randomIntBetween(100, 1000) + "k") .put("compress", randomBoolean())) .get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); <BUG>createIndex("test-idx-1", "test-idx-2", "test-idx-3"); ensureGreen();</BUG> fail("Path name is invalid"); } catch (RepositoryException re) { }
createIndex("test-idx-1"); createIndex("test-idx-2"); createIndex("test-idx-3"); ensureGreen();
17,816
.put("path", "should-fail") .put("chunk_size", randomIntBetween(100, 1000) + "k") .put("compress", randomBoolean())) .get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); <BUG>createIndex("test-idx-1", "test-idx-2", "test-idx-3"); ensureGreen();</BUG> fail("Path name is invalid"); } catch (RepositoryException re) { }
createIndex("test-idx-1"); createIndex("test-idx-2"); createIndex("test-idx-3"); ensureGreen();
17,817
.put("path", "should-fail") .put("chunk_size", randomIntBetween(100, 1000) + "k") .put("compress", randomBoolean())) .get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); <BUG>createIndex("test-idx-1", "test-idx-2", "test-idx-3"); ensureGreen();</BUG> fail("Path name is invalid"); } catch (RepositoryException re) { }
createIndex("test-idx-1"); createIndex("test-idx-2"); createIndex("test-idx-3"); ensureGreen();
17,818
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.IndexService; <BUG>import org.elasticsearch.indices.IndicesService; import org.elasticsearch.node.Node; import org.elasticsearch.node.internal.InternalSettingsPreparer; import org.elasticsearch.script.ScriptService;</BUG> import org.elasticsearch.search.internal.SearchContext;
import org.elasticsearch.node.MockNode; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.script.ScriptService;
17,819
private static void stopNode() { Node node = NODE; NODE = null; Releasables.close(node); } <BUG>static void cleanup(boolean resetNode) { </BUG> assertAcked(client().admin().indices().prepareDelete("*").get()); if (resetNode) { reset();
private void cleanup(boolean resetNode) {
17,820
.put(EsExecutors.PROCESSORS, 1) // limit the number of threads created .put("http.enabled", false) .put("node.local", true) .put("node.data", true) .put(InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING, true) // make sure we get what we set :) <BUG>.build() ); build.start();</BUG> assertThat(DiscoveryNode.localNode(build.settings()), is(true));
.build(); Node build = new MockNode(settings, getVersion(), getPlugins()); build.start();
17,821
addColumn("indrelid", DataTypeManager.DefaultDataTypes.INTEGER, t); //$NON-NLS-1$ addColumn("indnatts", DataTypeManager.DefaultDataTypes.SHORT, t); //$NON-NLS-1$ addColumn("indisclustered", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$ addColumn("indisunique", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$ addColumn("indisprimary", DataTypeManager.DefaultDataTypes.BOOLEAN, t); //$NON-NLS-1$ <BUG>Column c = addColumn("indkey", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$ c.setRuntimeType(DataTypeManager.getDataTypeName(DataTypeManager.getArrayType(DataTypeManager.DefaultDataClasses.SHORT))); </BUG> c.setProperty("pg_type:oid", String.valueOf(PG_TYPE_INT2VECTOR)); //$NON-NLS-1$ addColumn("indexprs", DataTypeManager.DefaultDataTypes.STRING, t); //$NON-NLS-1$
Column c = addColumn("indkey", DataTypeManager.getDataTypeName(DataTypeManager.getArrayType(DataTypeManager.DefaultDataClasses.SHORT)), t); //$NON-NLS-1$
17,822
import org.openqa.selenium.StaleElementReferenceException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public abstract class WebDriverTest { protected WebDriver webDriver = new FirefoxDriver(); <BUG>private NeoServer server; </BUG> private static final File targetHtmlDir = new File("target/classes/webadmin-html"); private static final File srcHtmlDir = new File("src/main/resources/webadmin-html"); @BeforeClass
protected NeoServer server;
17,823
result_ = variableAssignmentExpression(builder_, level_ + 1); } else if (root_ == VARIABLE_EXPRESSION) { result_ = variableExpression(builder_, level_ + 1); } <BUG>else { Marker marker_ = builder_.mark(); enterErrorRecordingSection(builder_, level_, _SECTION_RECOVER_, null); result_ = parse_root_(root_, builder_, level_); exitErrorRecordingSection(builder_, level_, result_, true, _SECTION_RECOVER_, TOKEN_ADVANCER); marker_.done(root_);</BUG> }
Marker marker_ = enter_section_(builder_, level_, _NONE_, null); exit_section_(builder_, level_, marker_, root_, result_, true, TOKEN_ADVANCER);
17,824
return builder_.getTreeBuilt(); } protected boolean parse_root_(final IElementType root_, final PsiBuilder builder_, final int level_) { return root(builder_, level_ + 1); } <BUG>private static final TokenSet[] EXTENDS_SETS_ = new TokenSet[] { </BUG> create_token_set_(BINARY_EXPRESSION, CONDITIONAL_EXPRESSION, EXPRESSION, INDEXED_EXPRESSION, LITERAL_EXPRESSION, METHOD_CALL_EXPRESSION, NEW_EXPRESSION, PARENTHESIZED_EXPRESSION, REFERENCE_EXPRESSION, SEQUENCE_EXPRESSION, UNARY_EXPRESSION, VARIABLE_ASSIGNMENT_EXPRESSION,
public static final TokenSet[] EXTENDS_SETS_ = new TokenSet[] {
17,825
create_token_set_(BINARY_EXPRESSION, CONDITIONAL_EXPRESSION, EXPRESSION, INDEXED_EXPRESSION, LITERAL_EXPRESSION, METHOD_CALL_EXPRESSION, NEW_EXPRESSION, PARENTHESIZED_EXPRESSION, REFERENCE_EXPRESSION, SEQUENCE_EXPRESSION, UNARY_EXPRESSION, VARIABLE_ASSIGNMENT_EXPRESSION, VARIABLE_EXPRESSION), }; <BUG>public static boolean type_extends_(IElementType child_, IElementType parent_) { return type_extends_impl_(EXTENDS_SETS_, child_, parent_); }</BUG> static boolean arrayConstructorExpression(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "arrayConstructorExpression")) return false;
[DELETED]
17,826
sequenceExpression(builder_, level_ + 1); return true; } static boolean binaryOperations(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "binaryOperations")) return false; <BUG>boolean result_ = false; Marker marker_ = builder_.mark(); enterErrorRecordingSection(builder_, level_, _SECTION_GENERAL_, "<operator>");</BUG> result_ = plusMinusOperations(builder_, level_ + 1); if (!result_) result_ = divideMultiplyOperations(builder_, level_ + 1);
Marker marker_ = enter_section_(builder_, level_, _NONE_, "<operator>");
17,827
return result_; } static boolean bitwiseBooleanOperations(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "bitwiseBooleanOperations")) return false; boolean result_ = false; <BUG>Marker marker_ = builder_.mark(); result_ = consumeToken(builder_, OR);</BUG> if (!result_) result_ = consumeToken(builder_, XOR); if (!result_) result_ = consumeToken(builder_, AND); if (!result_) result_ = consumeToken(builder_, BAND_KEYWORD);
Marker marker_ = enter_section_(builder_); result_ = consumeToken(builder_, OR);
17,828
if (offset_ == next_offset_) { empty_element_parsed_guard_(builder_, offset_, "expressionSequenceRequired_1"); break; } offset_ = next_offset_; <BUG>} if (!result_) { marker_.rollbackTo(); } else { marker_.drop(); }</BUG> return result_;
empty_element_parsed_guard_(builder_, offset_, "referenceExpression_2");
17,829
return consumeToken(builder_, INSTANCEOF_KEYWORD); } static boolean methodCallParameters(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "methodCallParameters")) return false; boolean result_ = false; <BUG>Marker marker_ = builder_.mark(); result_ = methodCallParameters_0(builder_, level_ + 1); result_ = result_ && methodCallParameters_1(builder_, level_ + 1); if (!result_) { marker_.rollbackTo(); } else { marker_.drop(); }</BUG> return result_;
if (offset_ == next_offset_) { empty_element_parsed_guard_(builder_, offset_, "referenceExpression_2"); break;
17,830
Marker marker_ = builder_.mark(); enterErrorRecordingSection(builder_, level_, _SECTION_RECOVER_, null); result_ = consumeToken(builder_, EXPRESSION_START);</BUG> pinned_ = result_; // pin = 1 result_ = result_ && report_error_(builder_, rootElement(builder_, level_ + 1)); <BUG>result_ = pinned_ && consumeToken(builder_, EXPRESSION_END) && result_; if (!result_ && !pinned_) { marker_.rollbackTo(); } else { marker_.drop(); } result_ = exitErrorRecordingSection(builder_, level_, result_, pinned_, _SECTION_RECOVER_, rootRecover_parser_);</BUG> return result_ || pinned_;
boolean result_ = false; Marker marker_ = enter_section_(builder_); result_ = consumeToken(builder_, DOT); result_ = result_ && consumeToken(builder_, IDENTIFIER); exit_section_(builder_, marker_, null, result_); return result_;
17,831
return expression(builder_, level_ + 1, -1); }</BUG> static boolean rootRecover(PsiBuilder builder_, int level_) { if (!recursion_guard_(builder_, level_, "rootRecover")) return false; <BUG>boolean result_ = false; Marker marker_ = builder_.mark(); enterErrorRecordingSection(builder_, level_, _SECTION_NOT_, null); result_ = !consumeToken(builder_, EXPRESSION_END); marker_.rollbackTo(); result_ = exitErrorRecordingSection(builder_, level_, result_, false, _SECTION_NOT_, null);</BUG> return result_;
Marker marker_ = enter_section_(builder_); result_ = consumeToken(builder_, DOT); result_ = result_ && consumeToken(builder_, IDENTIFIER); exit_section_(builder_, marker_, null, result_);
17,832
enterErrorRecordingSection(builder_, level_, _SECTION_GENERAL_, "<method call expression>");</BUG> result_ = referenceExpression(builder_, level_ + 1); result_ = result_ && consumeToken(builder_, LPARENTH); pinned_ = result_; // pin = 2 result_ = result_ && report_error_(builder_, methodCallParameters(builder_, level_ + 1)); <BUG>result_ = pinned_ && consumeToken(builder_, RPARENTH) && result_; if (result_ || pinned_) { marker_.done(METHOD_CALL_EXPRESSION); } else { marker_.rollbackTo(); } result_ = exitErrorRecordingSection(builder_, level_, result_, pinned_, _SECTION_GENERAL_, null);</BUG> return result_ || pinned_;
boolean result_ = false; Marker marker_ = enter_section_(builder_); result_ = consumeToken(builder_, DOT); result_ = result_ && consumeToken(builder_, IDENTIFIER); exit_section_(builder_, marker_, null, result_); return result_;
17,833
public IndexedEntityAccessor getIndexedEntityAccessor() { if (this.iea == null) { this.iea = new IndexedEntityAccessor(this.mb); } return this.iea; <BUG>} public SessionCreations getSessionCreations() {</BUG> if (this.sc == null) { this.sc = new SessionCreations(); }
public void clearIndexedEntityAccessor() { this.iea = null; public SessionCreations getSessionCreations() {
17,834
String trimmedText = depluralise(decText); if (trimmedText != null) { specificCheckForInstanceByExpressedBy(pAc, pPossInst, trimmedText, decText); } } <BUG>private String depluralise(String pRawText) { </BUG> String result = null; if (pRawText.endsWith("'s")) { result = pRawText.substring(0, pRawText.length() - 2);
public String depluralise(String pRawText) {
17,835
if (!alreadyRefersToExactRelation(tgtProp)) { if (testForFullRelationReferenceWithLaterWords(pAc, decText, lcExpList, 1)) { this.partialStartWord = true; reportMicroDebug("Found multiple word relation reference at: " + decText, pAc); <BUG>addReferredExactRelation(pAc, tgtProp.formattedFullPropertyName(), tgtProp); }</BUG> } } } else {
addReferredExactRelation(pAc, expVal, tgtProp);
17,836
public void markWordAsValue() { this.isValueWord = true; } private void checkForReferringInstances(ActionContext pAc, WordCheckerCache pWcc) { checkForPluralMatchingInstance(pAc, getDeclutteredText(), pWcc); <BUG>for (CeInstance thisInst : pWcc.getLingThingInstances(pAc)) { checkForInstanceByExpressedBy(pAc, thisInst); }</BUG> } private void addReferredExactConcept(ActionContext pAc, String pConName, CeConcept pTgtCon) {
if (!thisInst.isMetaModelInstance()) {
17,837
this.referredExactRelations = new TreeMap<String, CeProperty>(); } this.referredExactRelations.put(pPropFullName, pTgtProp); } else { reportError("Unable to add exact relation '" + pPropFullName + "' as it could not be located", pAc); <BUG>} }</BUG> public Collection<CeProperty> listReferredExactRelations() { Collection<CeProperty> result = null; if (this.referredExactRelations != null) {
public void removeReferredRelation(String pKey) { this.referredExactRelations.remove(pKey);
17,838
if (isPost()) { if (command.equals(REST_HELPER)) { result = processHelperRequest(qt, debug, st); } else if (command.equals(REST_EXECUTOR)) { result = processExecutorRequest(qt, debug, st); <BUG>} else if (command.equals(REST_ANALYSER)) { result = processAnalyserRequest(qt, debug, st);</BUG> } else if (command.equals(REST_INTERPRETER)) { result = processInterpreterRequest(qt, debug, st); } else if (command.equals(REST_ANSWERER)) {
[DELETED]
17,839
ServletStateManager.getHudsonManager(this.wc).logQuestionText(this.wc, pQuestionText); QuestionExecutionHandler qe = new QuestionExecutionHandler(this.wc, pDebug, pQuestionText, pStartTime); result = qe.handleQuestion(); return result; } <BUG>private CeStoreJsonObject processAnalyserRequest(String pQuestionText, boolean pDebug, long pStartTime) { CeStoreJsonObject result = new CeStoreJsonObject(); QuestionAnalysisHandler qh = new QuestionAnalysisHandler(this.wc, pDebug, pQuestionText, pStartTime); result = qh.handleQuestion(); return result; }</BUG> private CeStoreJsonObject processInterpreterRequest(String pQuestionText, boolean pDebug, long pStartTime) {
[DELETED]
17,840
ModuleSpec depModule = new ModuleSpec(dep.getName(), dep.getVersion()); copyModule(depModule); } } } else { <BUG>errorMsg("module.not.found", module, getRepositoryManager().getRepositoriesDisplayString()); }</BUG> } } private void copyArtifact(ArtifactContext ac, File archive) throws RepositoryException, IOException {
String err = getModuleNotFoundErrorMessage(getRepositoryManager(), module.getName(), module.getVersion()); errorAppend(err); errorNewline();
17,841
for (ModuleSpec module : modules) { String name = module.getName(); if (!module.isVersioned() && (name.startsWith("*") || name.endsWith("*"))) { Collection<ModuleDetails> modules = getModules(name, queryType, binaryMajor, binaryMinor); if (modules.isEmpty()) { <BUG>errorMsg("module.not.found", module, getRepositoryManager().getRepositoriesDisplayString()); continue;</BUG> } outputModules(module, modules); } else {
String err = getModuleNotFoundErrorMessage(getRepositoryManager(), module.getName(), module.getVersion()); errorAppend(err); errorNewline(); continue;
17,842
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
17,843
} @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);
17,844
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);
17,845
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(
17,846
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 {
17,847
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;
17,848
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) {
17,849
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;
17,850
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.DigestOutputStream; import java.security.MessageDigest; <BUG>import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.List;</BUG> public final class PatchUtils {
import java.text.DateFormat; import java.util.Date; import java.util.List;
17,851
package org.jboss.as.patching.runner; <BUG>import org.jboss.as.boot.DirectoryStructure; import org.jboss.as.patching.LocalPatchInfo;</BUG> import org.jboss.as.patching.PatchInfo; import org.jboss.as.patching.PatchLogger; import org.jboss.as.patching.PatchMessages;
import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp; import org.jboss.as.patching.CommonAttributes; import org.jboss.as.patching.LocalPatchInfo;
17,852
private static final String PATH_DELIMITER = "/"; public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT; enum Element { ADDED_BUNDLE("added-bundle"), ADDED_MISC_CONTENT("added-misc-content"), <BUG>ADDED_MODULE("added-module"), BUNDLES("bundles"),</BUG> CUMULATIVE("cumulative"), DESCRIPTION("description"), MISC_FILES("misc-files"),
APPLIES_TO_VERSION("applies-to-version"), BUNDLES("bundles"),
17,853
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { <BUG>case APPLIES_TO_VERSION: builder.addAppliesTo(value); break;</BUG> case RESULTING_VERSION: if(type == Patch.PatchType.CUMULATIVE) {
[DELETED]
17,854
final StringBuilder path = new StringBuilder(); for(final String p : item.getPath()) { path.append(p).append(PATH_DELIMITER); } path.append(item.getName()); <BUG>writer.writeAttribute(Attribute.PATH.name, path.toString()); if(type != ModificationType.REMOVE) {</BUG> writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash())); } if(type != ModificationType.ADD) {
if (item.isDirectory()) { writer.writeAttribute(Attribute.DIRECTORY.name, "true"); if(type != ModificationType.REMOVE) {
17,855
package org.jboss.as.patching; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.patching.runner.PatchingException; import org.jboss.logging.Messages; import org.jboss.logging.annotations.Message; <BUG>import org.jboss.logging.annotations.MessageBundle; import java.io.IOException;</BUG> import java.util.List; @MessageBundle(projectCode = "JBAS") public interface PatchMessages {
import org.jboss.logging.annotations.Cause; import java.io.IOException;
17,856
import com.intellij.ide.passwordSafe.PasswordSafeException; import com.intellij.lang.javascript.flex.FlexBundle; import com.intellij.lang.javascript.flex.FlexUtils; import com.intellij.lang.javascript.flex.actions.ExternalTask; import com.intellij.lang.javascript.flex.actions.FilesToPackageForm; <BUG>import com.intellij.lang.javascript.flex.actions.SigningOptionsForm; import com.intellij.lang.javascript.flex.build.FlexBuildConfiguration;</BUG> import com.intellij.lang.javascript.flex.sdk.FlexSdkComboBoxWithBrowseButton; import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.lang.javascript.flex.actions.airdescriptor.CreateAirDescriptorAction; import com.intellij.lang.javascript.flex.build.FlexBuildConfiguration;
17,857
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; <BUG>import com.intellij.openapi.wm.ToolWindowId; import com.intellij.openapi.wm.ToolWindowManager;</BUG> import com.intellij.ui.ComboboxWithBrowseButton; import org.jetbrains.annotations.Nullable; import javax.swing.*;
[DELETED]
17,858
final boolean ok = ExternalTask.runWithProgress(createAirInstallerTask(myProject, parameters), "Packaging AIR installer", TITLE); if (ok) { final String message = parameters.DO_NOT_SIGN ? MessageFormat.format("Unsigned AIR package created: {0}", parameters.INSTALLER_FILE_NAME) : MessageFormat.format("AIR installation file created: {0}", parameters.INSTALLER_FILE_NAME); <BUG>ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.PROJECT_VIEW, MessageType.INFO, message); }</BUG> return ok; } private void saveAsDefaultParameters(final AirInstallerParameters parameters) {
CreateAirDescriptorAction.NOTIFICATION_GROUP.createNotification(message, MessageType.INFO).notify(myProject);
17,859
import com.intellij.ide.passwordSafe.PasswordSafeException; import com.intellij.lang.javascript.flex.FlexBundle; import com.intellij.lang.javascript.flex.FlexUtils; import com.intellij.lang.javascript.flex.actions.ExternalTask; import com.intellij.lang.javascript.flex.actions.FilesToPackageForm; <BUG>import com.intellij.lang.javascript.flex.actions.SigningOptionsForm; import com.intellij.lang.javascript.flex.actions.airinstaller.AirInstallerParametersBase;</BUG> import com.intellij.lang.javascript.flex.build.FlexBuildConfiguration; import com.intellij.lang.javascript.flex.sdk.FlexSdkComboBoxWithBrowseButton; import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.lang.javascript.flex.actions.airdescriptor.CreateAirDescriptorAction; import com.intellij.lang.javascript.flex.actions.airinstaller.AirInstallerParametersBase;
17,860
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; <BUG>import com.intellij.openapi.wm.ToolWindowId; import com.intellij.openapi.wm.ToolWindowManager;</BUG> import com.intellij.ui.ComboboxWithBrowseButton; import org.jetbrains.annotations.Nullable; import javax.swing.*;
[DELETED]
17,861
final boolean ok = MobileAirUtil.checkAdtVersionForPackaging(myProject, adtVersion, parameters) && ExternalTask.runWithProgress(MobileAirUtil.createMobileAirPackageTask(myProject, parameters), FlexBundle.message("packaging.application", parameters.MOBILE_PLATFORM), TITLE); if (ok) { final String message = FlexBundle.message("application.created", parameters.MOBILE_PLATFORM, parameters.INSTALLER_FILE_NAME); <BUG>ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.PROJECT_VIEW, MessageType.INFO, message); }</BUG> return ok; } private void saveAsDefaultParameters(final MobileAirPackageParameters parameters) {
CreateAirDescriptorAction.NOTIFICATION_GROUP.createNotification(message, MessageType.INFO).notify(myProject);
17,862
package com.intellij.lang.javascript.flex.actions.airdescriptor; import com.intellij.ide.fileTemplates.FileTemplateUtil; import com.intellij.lang.javascript.flex.FlexBundle; <BUG>import com.intellij.lang.javascript.flex.FlexUtils; import com.intellij.openapi.actionSystem.AnActionEvent;</BUG> import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.notification.*; import com.intellij.openapi.actionSystem.AnActionEvent;
17,863
import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.ToolWindowId; <BUG>import com.intellij.openapi.wm.ToolWindowManager; import javax.swing.event.HyperlinkEvent;</BUG> import javax.swing.event.HyperlinkListener; import java.io.IOException; import java.io.InputStream;
import org.jetbrains.annotations.NotNull; import javax.swing.event.HyperlinkEvent;
17,864
import javax.swing.event.HyperlinkListener; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Properties; <BUG>public class CreateAirDescriptorAction extends DumbAwareAction { public void actionPerformed(AnActionEvent e) {</BUG> final Project project = e.getData(PlatformDataKeys.PROJECT); final CreateAirDescriptorDialog dialog = new CreateAirDescriptorDialog(project); dialog.show();
public static final NotificationGroup NOTIFICATION_GROUP = NotificationGroup.toolWindowGroup("Flex messages", ToolWindowId.PROJECT_VIEW, false); public void actionPerformed(AnActionEvent e) {
17,865
final Project project = e.getData(PlatformDataKeys.PROJECT); final CreateAirDescriptorDialog dialog = new CreateAirDescriptorDialog(project); dialog.show(); if (dialog.isOK()) { try { <BUG>final VirtualFile descriptorFile = createAirDescriptor(dialog.getAirDescriptorParameters()); final ToolWindowManager manager = ToolWindowManager.getInstance(project); manager.notifyByBalloon(ToolWindowId.PROJECT_VIEW, MessageType.INFO, FlexBundle.message("file.created", descriptorFile.getName()), null, new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) {</BUG> if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED && descriptorFile.isValid()) {
NOTIFICATION_GROUP.createNotification("", FlexBundle.message("file.created", descriptorFile.getName()), NotificationType.INFORMATION, new NotificationListener() { @Override public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
17,866
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED && descriptorFile.isValid()) { FileEditorManager.getInstance(project) .openTextEditor(new OpenFileDescriptor(project, descriptorFile), true); } } <BUG>}); }</BUG> catch (IOException ex) { Messages.showErrorDialog(project, FlexBundle.message("air.descriptor.creation.failed", ex.getMessage()), FlexBundle.message("error.title"));
}).notify(project);
17,867
package com.intellij.lang.javascript.flex.actions.htmlwrapper; import com.intellij.ide.fileTemplates.FileTemplateUtil; import com.intellij.lang.javascript.flex.FlexBundle; import com.intellij.lang.javascript.flex.FlexModuleBuilder; <BUG>import com.intellij.lang.javascript.flex.FlexUtils; import com.intellij.openapi.actionSystem.AnActionEvent;</BUG> import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.lang.javascript.flex.actions.airdescriptor.CreateAirDescriptorAction; import com.intellij.notification.Notification; import com.intellij.notification.NotificationListener; import com.intellij.notification.NotificationType; import com.intellij.openapi.actionSystem.AnActionEvent;
17,868
import com.intellij.openapi.util.NullableComputable; import com.intellij.openapi.util.Ref; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.ToolWindowId; <BUG>import com.intellij.openapi.wm.ToolWindowManager; import javax.swing.event.HyperlinkEvent;</BUG> import javax.swing.event.HyperlinkListener; import java.io.IOException; import java.util.Properties;
import com.sun.tools.internal.xjc.model.CAdapter; import org.jetbrains.annotations.NotNull; import javax.swing.event.HyperlinkEvent;
17,869
final HTMLWrapperParameters htmlWrapperParameters = dialog.getHTMLWrapperParameters(); final VirtualFile htmlFile = createHtmlWrapper(htmlWrapperParameters); if (htmlFile != null) { if (dialog.isCreateRunConfigurationSelected() && project != null) { FlexModuleBuilder.createFlexRunConfiguration(project, htmlFile); <BUG>} final ToolWindowManager manager = ToolWindowManager.getInstance(project); manager.notifyByBalloon(ToolWindowId.PROJECT_VIEW, MessageType.INFO, FlexBundle.message("file.created", htmlFile.getName()), null, new HyperlinkListener() { public void hyperlinkUpdate(final HyperlinkEvent e) {</BUG> if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED && htmlFile.isValid()) {
CreateAirDescriptorAction.NOTIFICATION_GROUP.createNotification("", FlexBundle.message("file.created", htmlFile.getName()), NotificationType.INFORMATION, new NotificationListener() { @Override public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
17,870
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED && htmlFile.isValid()) { FileEditorManager.getInstance(project) .openTextEditor(new OpenFileDescriptor(project, htmlFile), true); } } <BUG>}); }</BUG> else { Messages.showErrorDialog(project, FlexBundle.message("html.wrapper.creation.failed", ""), FlexBundle.message("error.title")); }
}).notify(project);
17,871
import com.liferay.portal.kernel.search.BooleanClause; import com.liferay.portal.kernel.search.BooleanClauseOccur; import com.liferay.portal.kernel.search.BooleanClauseOccurImpl; import com.liferay.portal.kernel.search.ParseException; import com.liferay.portal.kernel.search.Query; <BUG>import java.util.ArrayList; import java.util.List;</BUG> public class BooleanQueryImpl extends BaseBooleanQueryImpl { public BooleanQueryImpl( LuceneQueryHelper luceneQueryHelper,
import java.util.Collection; import java.util.Collections; import java.util.List;
17,872
package org.flywaydb.core.internal.info; import org.flywaydb.core.api.MigrationType; <BUG>import org.flywaydb.core.api.MigrationVersion; import org.flywaydb.core.internal.metadatatable.AppliedMigration;</BUG> import org.flywaydb.core.internal.resolver.ResolvedMigrationImpl; import org.junit.Test; import java.util.Date;
import org.flywaydb.core.api.resolver.ResolvedMigration; import org.flywaydb.core.internal.metadatatable.AppliedMigration;
17,873
public class MigrationInfoServiceImplSmallTest { @Test public void onlyPending() { MigrationInfoServiceImpl migrationInfoService = new MigrationInfoServiceImpl( <BUG>createMigrationResolver(createAvailableMigration(1), createAvailableMigration(2)), </BUG> createMetaDataTable(), MigrationVersion.LATEST, false, true, true); migrationInfoService.refresh(); assertNull(migrationInfoService.current());
createMigrationResolver(createResolvedMigration(1), createResolvedMigration(2)),
17,874
} @Test public void allApplied() { MigrationInfoServiceImpl migrationInfoService = new MigrationInfoServiceImpl( <BUG>createMigrationResolver(createAvailableMigration(1), createAvailableMigration(2)), </BUG> createMetaDataTable(createAppliedMigration(1), createAppliedMigration(2)), MigrationVersion.LATEST, false, true, true); migrationInfoService.refresh();
createMigrationResolver(createResolvedMigration(1), createResolvedMigration(2)),
17,875
} @Test public void oneAppliedOneSkipped() { MigrationInfoServiceImpl migrationInfoService = new MigrationInfoServiceImpl( <BUG>createMigrationResolver(createAvailableMigration(1), createAvailableMigration(2)), </BUG> createMetaDataTable(createAppliedMigration(2)), MigrationVersion.LATEST, false, true, true); migrationInfoService.refresh();
public void allApplied() { createMigrationResolver(createResolvedMigration(1), createResolvedMigration(2)), createMetaDataTable(createAppliedMigration(1), createAppliedMigration(2)),
17,876
</BUG> createMetaDataTable(createAppliedMigration(2)), MigrationVersion.LATEST, false, true, true); migrationInfoService.refresh(); assertEquals("2", migrationInfoService.current().getVersion().toString()); <BUG>final MigrationInfo[] all = migrationInfoService.all(); assertEquals(2, all.length); assertEquals(MigrationState.SUCCESS, all[0].getState()); assertEquals(MigrationState.IGNORED, all[1].getState()); assertEquals(0, migrationInfoService.pending().length);</BUG> }
@Test public void allApplied() { MigrationInfoServiceImpl migrationInfoService = new MigrationInfoServiceImpl( createMigrationResolver(createResolvedMigration(1), createResolvedMigration(2)), createMetaDataTable(createAppliedMigration(1), createAppliedMigration(2)), assertEquals(2, migrationInfoService.all().length); assertEquals(0, migrationInfoService.pending().length);
17,877
} @Test public void twoAppliedOneFuture() { MigrationInfoServiceImpl migrationInfoService = new MigrationInfoServiceImpl( <BUG>createMigrationResolver(createAvailableMigration(1)), </BUG> createMetaDataTable(createAppliedMigration(1), createAppliedMigration(2)), MigrationVersion.LATEST, false, true, true); migrationInfoService.refresh();
public void allApplied() { createMigrationResolver(createResolvedMigration(1), createResolvedMigration(2)),
17,878
} @Test public void belowBaseline() { MigrationInfoServiceImpl migrationInfoService = new MigrationInfoServiceImpl( <BUG>createMigrationResolver(createAvailableMigration(1)), </BUG> createMetaDataTable(createAppliedBaselineMigration(2)), MigrationVersion.LATEST, false, true, true); migrationInfoService.refresh();
public void allApplied() { createMigrationResolver(createResolvedMigration(1), createResolvedMigration(2)), createMetaDataTable(createAppliedMigration(1), createAppliedMigration(2)),
17,879
</BUG> createMetaDataTable(createAppliedBaselineMigration(2)), MigrationVersion.LATEST, false, true, true); migrationInfoService.refresh(); assertEquals("2", migrationInfoService.current().getVersion().toString()); <BUG>final MigrationInfo[] all = migrationInfoService.all(); assertEquals(2, all.length); assertEquals(MigrationState.BASELINE, all[0].getState()); assertEquals(MigrationState.BELOW_BASELINE, all[1].getState()); assertEquals(0, migrationInfoService.pending().length);</BUG> }
@Test public void allApplied() { MigrationInfoServiceImpl migrationInfoService = new MigrationInfoServiceImpl( createMigrationResolver(createResolvedMigration(1), createResolvedMigration(2)), createMetaDataTable(createAppliedMigration(1), createAppliedMigration(2)), assertEquals(2, migrationInfoService.all().length); assertEquals(0, migrationInfoService.pending().length);
17,880
} @Test public void missing() { MigrationInfoServiceImpl migrationInfoService = new MigrationInfoServiceImpl( <BUG>createMigrationResolver(createAvailableMigration(2)), </BUG> createMetaDataTable(createAppliedMigration(1), createAppliedMigration(2)), MigrationVersion.LATEST, false, true, true); migrationInfoService.refresh();
public void allApplied() { createMigrationResolver(createResolvedMigration(1), createResolvedMigration(2)),
17,881
assertEquals(MigrationState.SUCCESS, migrationInfoService.all()[0].getState()); assertEquals(MigrationState.SUCCESS, migrationInfoService.all()[1].getState()); assertEquals(2, migrationInfoService.all().length); assertEquals(0, migrationInfoService.pending().length); } <BUG>private ResolvedMigration createAvailableMigration(int version) { </BUG> ResolvedMigrationImpl migration = new ResolvedMigrationImpl(); migration.setVersion(MigrationVersion.fromVersion(Integer.toString(version))); migration.setDescription("abc");
private ResolvedMigration createResolvedMigration(int version) {
17,882
} @RootTask static Task<Exec.Result> exec(String parameter, int number) { Task<String> task1 = MyTask.create(parameter); Task<Integer> task2 = Adder.create(number, number + 2); <BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh") .in(() -> task1)</BUG> .in(() -> task2) .process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\""))); }
return Task.named("exec", "/bin/sh").ofType(Exec.Result.class) .in(() -> task1)
17,883
return args; } static class MyTask { static final int PLUS = 10; static Task<String> create(String parameter) { <BUG>return Task.ofType(String.class).named("MyTask", parameter) .in(() -> Adder.create(parameter.length(), PLUS))</BUG> .in(() -> Fib.create(parameter.length())) .process((sum, fib) -> something(parameter, sum, fib)); }
return Task.named("MyTask", parameter).ofType(String.class) .in(() -> Adder.create(parameter.length(), PLUS))
17,884
final String instanceField = "from instance"; final TaskContext context = TaskContext.inmem(); final AwaitingConsumer<String> val = new AwaitingConsumer<>(); @Test public void shouldJavaUtilSerialize() throws Exception { <BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39) .process(() -> 9999L); Task<String> task2 = Task.ofType(String.class).named("Baz", 40) .in(() -> task1)</BUG> .ins(() -> singletonList(task1))
Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class) Task<String> task2 = Task.named("Baz", 40).ofType(String.class) .in(() -> task1)
17,885
assertEquals(des.id().name(), "Baz"); assertEquals(val.awaitAndGet(), "[9999] hello 10004"); } @Test(expected = NotSerializableException.class) public void shouldNotSerializeWithInstanceFieldReference() throws Exception { <BUG>Task<String> task = Task.ofType(String.class).named("WithRef") .process(() -> instanceField + " causes an outer reference");</BUG> serialize(task); } @Test
Task<String> task = Task.named("WithRef").ofType(String.class) .process(() -> instanceField + " causes an outer reference");
17,886
serialize(task); } @Test public void shouldSerializeWithLocalReference() throws Exception { String local = instanceField; <BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef") .process(() -> local + " won't cause an outer reference");</BUG> serialize(task); Task<String> des = deserialize(); context.evaluate(des).consume(val);
Task<String> task = Task.named("WithLocalRef").ofType(String.class) .process(() -> local + " won't cause an outer reference");
17,887
} @RootTask public static Task<String> standardArgs(int first, String second) { firstInt = first; secondString = second; <BUG>return Task.ofType(String.class).named("StandardArgs", first, second) .process(() -> second + " " + first * 100);</BUG> } @Test public void shouldParseFlags() throws Exception {
return Task.named("StandardArgs", first, second).ofType(String.class) .process(() -> second + " " + first * 100);
17,888
assertThat(parsedEnum, is(CustomEnum.BAR)); } @RootTask public static Task<String> enums(CustomEnum enm) { parsedEnum = enm; <BUG>return Task.ofType(String.class).named("Enums", enm) .process(enm::toString);</BUG> } @Test public void shouldParseCustomTypes() throws Exception {
return Task.named("Enums", enm).ofType(String.class) .process(enm::toString);
17,889
assertThat(parsedType.content, is("blarg parsed for you!")); } @RootTask public static Task<String> customType(CustomType myType) { parsedType = myType; <BUG>return Task.ofType(String.class).named("Types", myType.content) .process(() -> myType.content);</BUG> } public enum CustomEnum { BAR
return Task.named("Types", myType.content).ofType(String.class) .process(() -> myType.content);
17,890
TaskContext taskContext = TaskContext.inmem(); TaskContext.Value<Long> value = taskContext.evaluate(fib92); value.consume(f92 -> System.out.println("fib(92) = " + f92)); } static Task<Long> create(long n) { <BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n); </BUG> if (n < 2) { return fib .process(() -> n);
TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
17,891
import com.liferay.portal.kernel.search.BooleanClause; import com.liferay.portal.kernel.search.BooleanClauseOccur; import com.liferay.portal.kernel.search.BooleanClauseOccurImpl; import com.liferay.portal.kernel.search.ParseException; import com.liferay.portal.kernel.search.Query; <BUG>import java.util.ArrayList; import java.util.List;</BUG> public class BooleanQueryImpl extends BaseBooleanQueryImpl { public BooleanQueryImpl( LuceneQueryHelper luceneQueryHelper,
import java.util.Collection; import java.util.Collections; import java.util.List;
17,892
package org.ethereum.util.blockchain; <BUG>import org.apache.commons.lang3.tuple.Pair; import org.ethereum.config.SystemProperties; import org.ethereum.core.*;</BUG> import org.ethereum.core.genesis.GenesisLoader; import org.ethereum.crypto.ECKey;
import org.ethereum.config.BlockchainNetConfig; import org.ethereum.config.blockchain.FrontierConfig; import org.ethereum.core.*;
17,893
long gasPrice; long gasLimit; boolean autoBlock; long dbDelay = 0; long totalDbHits = 0; <BUG>List<Pair<byte[], BigInteger>> initialBallances = new ArrayList<>(); int blockGasIncreasePercent = 0;</BUG> long time = 0; long timeIncrement = 13; private HashMapDB<byte[]> stateDS;
BlockchainNetConfig netConfig; int blockGasIncreasePercent = 0;
17,894
return this; } public StandaloneBlockchain withMinerCoinbase(byte[] coinbase) { this.coinbase = coinbase; return this; <BUG>} public StandaloneBlockchain withAccountBalance(byte[] address, BigInteger weis) {</BUG> AccountState state = new AccountState(BigInteger.ZERO, weis); genesis.addPremine(wrap(address), state); genesis.setStateRoot(GenesisLoader.generateRootHash(genesis.getPremine()));
public StandaloneBlockchain withNetConfig(BlockchainNetConfig netConfig) { this.netConfig = netConfig; public StandaloneBlockchain withAccountBalance(byte[] address, BigInteger weis) {
17,895
return pruningStateDS; } public long getTotalDbHits() { return totalDbHits; } <BUG>private BlockchainImpl createBlockchain(Genesis genesis) { IndexedBlockStore blockStore = new IndexedBlockStore();</BUG> blockStore.init(new HashMapDB<byte[]>(), new HashMapDB<byte[]>()); stateDS = new HashMapDB<>(); pruningStateDS = new JournalSource<>(new CountingBytesSource(stateDS));
SystemProperties.getDefault().setBlockchainConfig(netConfig != null ? netConfig : getEasyMiningConfig()); IndexedBlockStore blockStore = new IndexedBlockStore();
17,896
import static org.ethereum.crypto.HashUtil.sha3; import static org.ethereum.util.ByteUtil.*; import static org.junit.Assert.assertArrayEquals; public class EthashTest { @BeforeClass <BUG>public static void setup() { SystemProperties.getDefault().setBlockchainConfig(new FrontierConfig(new FrontierConfig.FrontierConstants() { @Override public BigInteger getMINIMUM_DIFFICULTY() { return BigInteger.ONE; } }));</BUG> }
SystemProperties.getDefault().setBlockchainConfig(StandaloneBlockchain.getEasyMiningConfig());
17,897
import org.junit.BeforeClass; import org.junit.Test; import java.math.BigInteger; import java.util.Arrays; public class TransactionStoreTest { <BUG>@BeforeClass public static void setup() { SystemProperties.getDefault().setBlockchainConfig(new FrontierConfig(new FrontierConfig.FrontierConstants() { @Override public BigInteger getMINIMUM_DIFFICULTY() { return BigInteger.ONE; } })); }</BUG> @AfterClass
[DELETED]
17,898
import org.ethereum.net.eth.handler.EthHandler; import org.ethereum.net.eth.message.*; import org.ethereum.net.message.Message; import org.ethereum.net.p2p.DisconnectMessage; import org.ethereum.net.rlpx.Node; <BUG>import org.ethereum.net.server.Channel; import org.junit.*;</BUG> import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope;
import org.ethereum.util.blockchain.StandaloneBlockchain; import org.junit.*;
17,899
SysPropConfigA.props.overrideParams( "peer.listen.port", "30334", "peer.privateKey", "3ec771c31cac8c0dba77a69e503765701d3c2bb62435888d4ffa38fed60c445c", "genesis", "genesis-light-old.json" ); <BUG>SysPropConfigA.props.setBlockchainConfig(easyMineConfig); </BUG> SysPropConfigB.props.overrideParams( "peer.listen.port", "30335", "peer.privateKey", "6ef8da380c27cea8fdf7448340ea99e8e2268fc2950d79ed47cbf6f85dc977ec",
SysPropConfigA.props.setBlockchainConfig(StandaloneBlockchain.getEasyMiningConfig());
17,900
"genesis", "genesis-light-old.json", "sync.enabled", "true", "sync.max.hashes.ask", "3", "sync.max.blocks.ask", "2" ); <BUG>SysPropConfigB.props.setBlockchainConfig(easyMineConfig); </BUG> mainB1B10 = loadBlocks("sync/main-b1-b10.dmp"); b10 = mainB1B10.get(mainB1B10.size() - 1); }
SysPropConfigB.props.setBlockchainConfig(StandaloneBlockchain.getEasyMiningConfig());