id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
4,101
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);
4,102
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(
4,103
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 {
4,104
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;
4,105
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) {
4,106
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;
4,107
handleMockFieldsForWholeTestClass(testInstance); } finally { TestRun.exitNoMockingZone(); } <BUG>TestRun.setRunningIndividualTest(testInstance, true); }</BUG> @Override public void beforeEach(TestExtensionContext context) {
TestRun.setRunningIndividualTest(testInstance);
4,108
createInstancesForTestedFields(testInstance, false); } finally { TestRun.exitNoMockingZone(); } <BUG>TestRun.setRunningIndividualTest(testInstance, false); }</BUG> @Override public boolean supports(ParameterContext parameterContext, ExtensionContext extensionContext) {
TestRun.setRunningIndividualTest(testInstance);
4,109
if (verification != null) { return verification; } return replay; } <BUG>public boolean isStrictOrDynamic() { return isStrict() || dynamicPartialMocking != null; } public boolean isStrict() { return recordPhase != null && recordPhase.strict; }</BUG> @Nonnull public BaseVerificationPhase startVerifications(boolean inOrder) {
[DELETED]
4,110
Expectation replayExpectation = expectationsInReplayOrder.get(i); Object replayInstance = invocationInstancesInReplayOrder.get(i); Object[] replayArgs = invocationArgumentsInReplayOrder.get(i); if (matches(mock, mockClassDesc, mockNameAndDesc, args, replayExpectation, replayInstance, replayArgs)) { Expectation verification = expectationBeingVerified(); <BUG>if (replayExpectation.isRedundantRecordedExpectation(verification)) { throw replayExpectation.invocation.exceptionForRedundantExpectation(); }</BUG> replayIndex = i; verification.constraints.invocationCount++;
[DELETED]
4,111
handleMockingOutsideTestMethods(target); if (it.getAnnotation(Test.class) == null) { if (shouldPrepareForNextTest && it.getAnnotation(Before.class) != null) { prepareToExecuteSetupMethod(target); } <BUG>TestRun.setRunningIndividualTest(target, true); try {</BUG> invocation.prepareToProceedFromNonRecursiveMock(); return it.invokeExplosively(target, params); }
TestRun.setRunningIndividualTest(target); try {
4,112
private static void executeTestMethod( @Nonnull MockInvocation invocation, @Nonnull Object target, @Nullable Object... parameters) throws Throwable { SavePoint savePoint = new SavePoint(); <BUG>TestRun.setRunningIndividualTest(target, false); FrameworkMethod it = invocation.getInvokedInstance();</BUG> Method testMethod = it.getMethod(); Throwable testFailure = null; boolean testFailureExpected = false;
TestRun.setRunningIndividualTest(target); FrameworkMethod it = invocation.getInvokedInstance();
4,113
import mockit.internal.expectations.*; import mockit.internal.expectations.argumentMatching.*; import mockit.internal.startup.*; import mockit.internal.util.*; import org.hamcrest.Matcher; <BUG>@SuppressWarnings({"ConstantConditions", "ClassWithTooManyFields"}) abstract class Invocations</BUG> { static { Startup.verifyInitialization(); } protected final Object any = null;
@SuppressWarnings("ClassWithTooManyFields") abstract class Invocations
4,114
protected final Double anyDouble = 0.0; protected final Float anyFloat = 0.0F; protected int times; protected int minTimes; protected int maxTimes; <BUG>@Nonnull abstract TestOnlyPhase getCurrentPhase(); </BUG> protected final <T> T withArgThat(Matcher<? super T> argumentMatcher) { HamcrestAdapter matcher = new HamcrestAdapter(argumentMatcher);
@Nullable abstract TestOnlyPhase getCurrentPhase();
4,115
String resolvedReturnType = invocation.getSignatureWithResolvedReturnType(); return TypeDescriptor.getReturnType(resolvedReturnType); } void addSequenceOfReturnValues(@Nonnull Object[] values) { <BUG>if (invocation.isConstructor()) { throw new IllegalArgumentException("Invalid recording for a constructor"); } if (invocation.getMethodNameAndDescription().endsWith(")V")) { throw new IllegalArgumentException("Invalid recording for a void method"); }</BUG> int n = values.length - 1;
[DELETED]
4,116
.put("undefined", Tristate.UNDEFINED) .put("true", Tristate.TRUE) .build())), optional(GenericArguments.onlyOne(GenericArguments.string(Text.of("context"))))), GenericArguments.seq( <BUG>GenericArguments.onlyOne(choices(Text.of("target"), catalogChoices)), onlyOne(GenericArguments.choices(Text.of("value"), ImmutableMap.<String, Tristate>builder()</BUG> .put("-1", Tristate.FALSE) .put("0", Tristate.UNDEFINED)
onlyOne(choices(Text.of("source"), catalogChoices)), choices(Text.of("target"), catalogChoices), onlyOne(GenericArguments.choices(Text.of("value"), ImmutableMap.<String, Tristate>builder()
4,117
GenericArguments.firstParsing( GenericArguments.seq( choices(Text.of("flag"), flagChoices), GenericArguments.firstParsing( GenericArguments.seq( <BUG>GenericArguments.onlyOne(choices(Text.of("source"), catalogChoices)), GenericArguments.onlyOne(choices(Text.of("target"), catalogChoices)), onlyOne(GenericArguments.choices(Text.of("value"), ImmutableMap.<String, Tristate>builder()</BUG> .put("-1", Tristate.FALSE) .put("0", Tristate.UNDEFINED)
choices(Text.of("target"), catalogChoices), onlyOne(GenericArguments.choices(Text.of("value"), ImmutableMap.<String, Tristate>builder()
4,118
.put("false", Tristate.FALSE) .put("undefined", Tristate.UNDEFINED) .put("true", Tristate.TRUE) .build()))), GenericArguments.seq( <BUG>GenericArguments.onlyOne(choices(Text.of("target"), catalogChoices)), onlyOne(GenericArguments.choices(Text.of("value"), ImmutableMap.<String, Tristate>builder()</BUG> .put("-1", Tristate.FALSE) .put("0", Tristate.UNDEFINED)
onlyOne(choices(Text.of("source"), catalogChoices)), choices(Text.of("target"), catalogChoices), onlyOne(GenericArguments.choices(Text.of("value"), ImmutableMap.<String, Tristate>builder()
4,119
GenericArguments.firstParsing( GenericArguments.seq( choices(Text.of("flag"), flagChoices), GenericArguments.firstParsing( GenericArguments.seq( <BUG>GenericArguments.onlyOne(choices(Text.of("source"), catalogChoices)), GenericArguments.onlyOne(choices(Text.of("target"), catalogChoices)), onlyOne(GenericArguments.choices(Text.of("value"), ImmutableMap.<String, Tristate>builder()</BUG> .put("-1", Tristate.FALSE) .put("0", Tristate.UNDEFINED)
choices(Text.of("target"), catalogChoices), onlyOne(GenericArguments.choices(Text.of("value"), ImmutableMap.<String, Tristate>builder()
4,120
.put("false", Tristate.FALSE) .put("undefined", Tristate.UNDEFINED) .put("true", Tristate.TRUE) .build()))), GenericArguments.seq( <BUG>GenericArguments.onlyOne(choices(Text.of("target"), catalogChoices)), onlyOne(GenericArguments.choices(Text.of("value"), ImmutableMap.<String, Tristate>builder()</BUG> .put("-1", Tristate.FALSE) .put("0", Tristate.UNDEFINED)
onlyOne(choices(Text.of("source"), catalogChoices)), choices(Text.of("target"), catalogChoices), onlyOne(GenericArguments.choices(Text.of("value"), ImmutableMap.<String, Tristate>builder()
4,121
doIndexTask(new IndexTask<Object>() { public Object doTask() throws Exception { MavenId id = myData.addArtifact(artifactFile); String groupId = id.getGroupId(); String artifactId = id.getArtifactId(); <BUG>String version = id.getVersion(); addToCache(myData.groupToArtifactMap, groupId, artifactId); addToCache(myData.groupWithArtifactToVersionMap, groupId + ":" + artifactId, version); </BUG> myData.flush();
myData.hasGroupCache.put(groupId, true); String groupWithArtifact = groupId + ":" + artifactId; myData.hasArtifactCache.put(groupWithArtifact, true); myData.hasVersionCache.put(groupWithArtifact + ':' + version, true); addToCache(myData.groupWithArtifactToVersionMap, groupWithArtifact, version);
4,122
private interface IndexTask<T> { T doTask() throws Exception; } private class IndexData { final PersistentHashMap<String, Set<String>> groupToArtifactMap; <BUG>final PersistentHashMap<String, Set<String>> groupWithArtifactToVersionMap; private final int indexId;</BUG> public IndexData(File dir) throws MavenIndexException { try { groupToArtifactMap = createPersistentMap(new File(dir, ARTIFACT_IDS_MAP_FILE));
final Map<String, Boolean> hasGroupCache = new THashMap<String, Boolean>(); final Map<String, Boolean> hasArtifactCache = new THashMap<String, Boolean>(); final Map<String, Boolean> hasVersionCache = new THashMap<String, Boolean>(); private final int indexId;
4,123
package com.cronutils.model.time.generator; import java.util.Collections; <BUG>import java.util.List; import org.apache.commons.lang3.Validate;</BUG> import com.cronutils.model.field.CronField; import com.cronutils.model.field.expression.FieldExpression; public abstract class FieldValueGenerator {
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
4,124
import java.util.ResourceBundle; import java.util.function.Function;</BUG> class DescriptionStrategyFactory { private DescriptionStrategyFactory() {} public static DescriptionStrategy daysOfWeekInstance(final ResourceBundle bundle, final FieldExpression expression) { <BUG>final Function<Integer, String> nominal = integer -> new DateTime().withDayOfWeek(integer).dayOfWeek().getAsText(bundle.getLocale()); </BUG> NominalDescriptionStrategy dow = new NominalDescriptionStrategy(bundle, nominal, expression); dow.addDescription(fieldExpression -> { if (fieldExpression instanceof On) {
import java.util.function.Function; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.model.field.expression.On; final Function<Integer, String> nominal = integer -> DayOfWeek.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale());
4,125
return dom; } public static DescriptionStrategy monthsInstance(final ResourceBundle bundle, final FieldExpression expression) { return new NominalDescriptionStrategy( bundle, <BUG>integer -> new DateTime().withMonthOfYear(integer).monthOfYear().getAsText(bundle.getLocale()), expression</BUG> ); } public static DescriptionStrategy plainInstance(ResourceBundle bundle, final FieldExpression expression) {
integer -> Month.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale()), expression
4,126
<BUG>package com.cronutils.model.time.generator; import com.cronutils.mapper.WeekDay;</BUG> import com.cronutils.model.field.CronField; import com.cronutils.model.field.CronFieldName; import com.cronutils.model.field.constraint.FieldConstraintsBuilder;
import java.time.LocalDate; import java.util.Collections; import java.util.List; import java.util.Set; import org.apache.commons.lang3.Validate; import com.cronutils.mapper.WeekDay;
4,127
import com.cronutils.model.field.expression.Between; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.parser.CronParserField; import com.google.common.collect.Lists; import com.google.common.collect.Sets; <BUG>import org.apache.commons.lang3.Validate; import org.joda.time.DateTime; import java.util.Collections; import java.util.List; import java.util.Set;</BUG> class BetweenDayOfWeekValueGenerator extends FieldValueGenerator {
[DELETED]
4,128
<BUG>package com.cronutils.model.time.generator; import com.cronutils.model.field.CronField;</BUG> import com.cronutils.model.field.CronFieldName; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.model.field.expression.On;
import java.time.DayOfWeek; import java.time.LocalDate; import java.util.List; import org.apache.commons.lang3.Validate; import com.cronutils.model.field.CronField;
4,129
import com.cronutils.model.field.CronField;</BUG> import com.cronutils.model.field.CronFieldName; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.model.field.expression.On; import com.google.common.collect.Lists; <BUG>import org.apache.commons.lang3.Validate; import org.joda.time.DateTime; import java.util.List;</BUG> class OnDayOfMonthValueGenerator extends FieldValueGenerator { private int year;
package com.cronutils.model.time.generator; import java.time.DayOfWeek; import java.time.LocalDate; import java.util.List; import com.cronutils.model.field.CronField;
4,130
class OnDayOfMonthValueGenerator extends FieldValueGenerator { private int year; private int month; public OnDayOfMonthValueGenerator(CronField cronField, int year, int month) { super(cronField); <BUG>Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of month"); this.year = year;</BUG> this.month = month; }
Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of" + " month"); this.year = year;
4,131
package com.cronutils.mapper; public class ConstantsMapper { private ConstantsMapper() {} public static final WeekDay QUARTZ_WEEK_DAY = new WeekDay(2, false); <BUG>public static final WeekDay JODATIME_WEEK_DAY = new WeekDay(1, false); </BUG> public static final WeekDay CRONTAB_WEEK_DAY = new WeekDay(1, true); public static int weekDayMapping(WeekDay source, WeekDay target, int weekday){ return source.mapTo(weekday, target);
public static final WeekDay JAVA8 = new WeekDay(1, false);
4,132
return nextMatch; } catch (NoSuchValueException e) { throw new IllegalArgumentException(e); } } <BUG>DateTime nextClosestMatch(DateTime date) throws NoSuchValueException { </BUG> List<Integer> year = yearsValueGenerator.generateCandidates(date.getYear(), date.getYear()); TimeNode days = null; int lowestMonth = months.getValues().get(0);
ZonedDateTime nextClosestMatch(ZonedDateTime date) throws NoSuchValueException {
4,133
boolean questionMarkSupported = cronDefinition.getFieldDefinition(DAY_OF_WEEK).getConstraints().getSpecialChars().contains(QUESTION_MARK); if(questionMarkSupported){ return new TimeNode( generateDayCandidatesQuestionMarkSupported( <BUG>date.getYear(), date.getMonthOfYear(), </BUG> ((DayOfWeekFieldDefinition) cronDefinition.getFieldDefinition(DAY_OF_WEEK) ).getMondayDoWValue()
date.getYear(), date.getMonthValue(),
4,134
) ); }else{ return new TimeNode( generateDayCandidatesQuestionMarkNotSupported( <BUG>date.getYear(), date.getMonthOfYear(), </BUG> ((DayOfWeekFieldDefinition) cronDefinition.getFieldDefinition(DAY_OF_WEEK) ).getMondayDoWValue()
date.getYear(), date.getMonthValue(),
4,135
} public DateTime lastExecution(DateTime date){ </BUG> Validate.notNull(date); try { <BUG>DateTime previousMatch = previousClosestMatch(date); </BUG> if(previousMatch.equals(date)){ previousMatch = previousClosestMatch(date.minusSeconds(1)); }
public java.time.Duration timeToNextExecution(ZonedDateTime date){ return java.time.Duration.between(date, nextExecution(date)); public ZonedDateTime lastExecution(ZonedDateTime date){ ZonedDateTime previousMatch = previousClosestMatch(date);
4,136
return previousMatch; } catch (NoSuchValueException e) { throw new IllegalArgumentException(e); } } <BUG>public Duration timeFromLastExecution(DateTime date){ return new Interval(lastExecution(date), date).toDuration(); } public boolean isMatch(DateTime date){ </BUG> return nextExecution(lastExecution(date)).equals(date);
[DELETED]
4,137
<BUG>package com.cronutils.model.time.generator; import com.cronutils.model.field.CronField;</BUG> import com.cronutils.model.field.expression.Every; import com.cronutils.model.field.expression.FieldExpression; import com.google.common.annotations.VisibleForTesting;
import java.time.ZonedDateTime; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.cronutils.model.field.CronField;
4,138
import com.cronutils.model.field.CronField;</BUG> import com.cronutils.model.field.expression.Every; import com.cronutils.model.field.expression.FieldExpression; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; <BUG>import org.joda.time.DateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List;</BUG> class EveryFieldValueGenerator extends FieldValueGenerator {
package com.cronutils.model.time.generator; import java.time.ZonedDateTime; import java.util.List; import com.cronutils.model.field.CronField;
4,139
private static final Logger log = LoggerFactory.getLogger(EveryFieldValueGenerator.class); public EveryFieldValueGenerator(CronField cronField) { super(cronField); log.trace(String.format( "processing \"%s\" at %s", <BUG>cronField.getExpression().asString(), DateTime.now() </BUG> )); } @Override
cronField.getExpression().asString(), ZonedDateTime.now()
4,140
package org.apache.cassandra.db; import static junit.framework.Assert.assertEquals; <BUG>import static org.apache.cassandra.Util.addMutation; import java.io.IOException;</BUG> import java.nio.ByteBuffer; import java.util.Collection; import java.util.concurrent.ExecutionException;
import static org.apache.cassandra.Util.column; import java.io.IOException;
4,141
for (int j = 0; j < 8; ++j) { ByteBuffer bytes = ByteBuffer.wrap(j % 2 == 0 ? "a".getBytes() : "b".getBytes()); rm = new RowMutation("Keyspace1", key); rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap(("Column-" + j).getBytes())), bytes, j); <BUG>rm.apply(); </BUG> } for (int j = 0; j < 8; ++j) {
[DELETED]
4,142
for (int k = 0; k < 4; ++k) { String value = (j + k) % 2 == 0 ? "a" : "b"; addMutation(rm, "Super1", "SuperColumn-" + j, k, value, k); } <BUG>rm.apply(); </BUG> } } validateNameSort(table, N);
rm.applyUnsafe();
4,143
ColumnFamily cf; cf = Util.getColumnFamily(table, key, "Standard1"); Collection<IColumn> columns = cf.getSortedColumns(); for (IColumn column : columns) { <BUG>int j = Integer.valueOf(new String(column.name().array(),column.name().position(),column.name().remaining()).split("-")[1]); byte[] bytes = j % 2 == 0 ? "a".getBytes() : "b".getBytes(); assertEquals(new String(bytes), new String(column.value().array(), column.value().position(), column .value().remaining()));</BUG> }
String name = ByteBufferUtil.string(column.name()); int j = Integer.valueOf(name.substring(name.length() - 1)); assertEquals(new String(bytes), ByteBufferUtil.string(column.value()));
4,144
assert cf != null : "key " + key + " is missing!"; Collection<IColumn> superColumns = cf.getSortedColumns(); assert superColumns.size() == 8 : cf; for (IColumn superColumn : superColumns) { <BUG>int j = Integer.valueOf(new String(superColumn.name().array(),superColumn.name().position(),superColumn.name().remaining()).split("-")[1]); Collection<IColumn> subColumns = superColumn.getSubColumns();</BUG> assert subColumns.size() == 4; for (IColumn subColumn : subColumns) {
int j = Integer.valueOf(ByteBufferUtil.string(superColumn.name()).split("-")[1]); Collection<IColumn> subColumns = superColumn.getSubColumns();
4,145
Collection<IColumn> subColumns = superColumn.getSubColumns();</BUG> assert subColumns.size() == 4; for (IColumn subColumn : subColumns) { long k = subColumn.name().getLong(subColumn.name().position() + subColumn.name().arrayOffset()); <BUG>byte[] bytes = (j + k) % 2 == 0 ? "a".getBytes() : "b".getBytes(); assertEquals(new String(bytes), new String(subColumn.value().array(), subColumn.value().position(), subColumn.value().remaining()));</BUG> } }
assert cf != null : "key " + key + " is missing!"; Collection<IColumn> superColumns = cf.getSortedColumns(); assert superColumns.size() == 8 : cf; for (IColumn superColumn : superColumns) int j = Integer.valueOf(ByteBufferUtil.string(superColumn.name()).split("-")[1]); Collection<IColumn> subColumns = superColumn.getSubColumns(); assertEquals(new String(bytes), ByteBufferUtil.string(subColumn.value()));
4,146
e.printStackTrace(); } filePlayback=null; } @Override <BUG>public void stop() { if ( filePlayback!=null ) filePlayback.stop(); } void initFiles() throws FileNotFoundException {</BUG> if ((dataDir.length() != 0) && !dataDir.endsWith("/")) { dataDir = dataDir + "/"; } // guard path if needed String samples_str = dataDir + "samples"; String events_str = dataDir + "events";
@Override public boolean isrunning(){ if ( filePlayback!=null ) return filePlayback.isrunning(); return false; } void initFiles() throws FileNotFoundException {
4,147
public class BufferMonitor extends Thread implements FieldtripBufferMonitor { public static final String TAG = BufferMonitor.class.toString(); private final Context context; private final SparseArray<BufferConnectionInfo> clients = new SparseArray<BufferConnectionInfo>(); private final BufferInfo info; <BUG>private final BroadcastReceiver mMessageReceiver = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) { if (intent.getIntExtra(C.MESSAGE_TYPE, -1) == C.UPDATE_REQUEST) { Log.i(TAG, "Received update request."); sendAllInfo(); } } };</BUG> private boolean run = true;
[DELETED]
4,148
public static final String CLIENT_INFO_TIME = "c_time"; public static final String CLIENT_INFO_WAITTIMEOUT = "c_waitTimeout"; public static final String CLIENT_INFO_CONNECTED = "c_connected"; public static final String CLIENT_INFO_CHANGED = "c_changed"; public static final String CLIENT_INFO_DIFF = "c_diff"; <BUG>public static final int UPDATE_REQUEST = 0; </BUG> public static final int UPDATE = 1; public static final int REQUEST_PUT_HEADER = 2; public static final int REQUEST_FLUSH_HEADER = 3;
public static final int THREAD_INFO_TYPE = 0;
4,149
package nl.dcc.buffer_bci.bufferclientsservice; import android.os.Parcel; import android.os.Parcelable; <BUG>import nl.dcc.buffer_bci.bufferservicecontroller.C; public class ThreadInfo implements Parcelable {</BUG> public static final Creator<ThreadInfo> CREATOR = new Creator<ThreadInfo>() { @Override public ThreadInfo createFromParcel(final Parcel in) {
import nl.dcc.buffer_bci.C; public class ThreadInfo implements Parcelable {
4,150
rest("/cart/").description("Personal Shopping Cart Service") .produces(MediaType.APPLICATION_JSON_VALUE) .options("/{cartId}") .route().id("getCartOptionsRoute").end().endRest() .options("/checkout/{cartId}") <BUG>.route().id("checkoutCartOptionsRoute").end().endRest() .options("/{cartId}/{itemId}/{quantity}")</BUG> .route().id("cartAddDeleteOptionsRoute").end().endRest() .post("/checkout/{cartId}").description("Finalize shopping cart and process payment") .param().name("cartId").type(RestParamType.path).description("The ID of the cart to process").dataType("string").endParam()
.options("/{cartId}/{tmpId}") .route().id("cartSetOptionsRoute").end().endRest() .options("/{cartId}/{itemId}/{quantity}")
4,151
private final TemplateWeavingRule myRule; @NotNull private final TemplateExecutionEnvironment myEnv; @NotNull private final SNode myApplicableNode; <BUG>public ArmedWeavingRule(TemplateWeavingRule rule, TemplateExecutionEnvironment env, SNode applicableNode) { </BUG> myRule = rule; myEnv = env; myApplicableNode = applicableNode;
public ArmedWeavingRule(@NotNull TemplateWeavingRule rule, @NotNull TemplateExecutionEnvironment env, @NotNull SNode applicableNode) {
4,152
tracer.pushInputNode(GenerationTracerUtil.getSNodePointer(myApplicableNode)); tracer.pushRule(myRule.getRuleNode()); try { someOutputGenerated = myRule.apply(myEnv, context, outputContextNode); } catch (DismissTopMappingRuleException e) { <BUG>myEnv.getGenerator().showErrorMessage(context.getInput(), null, myRule.getRuleNode().resolve(MPSModuleRepository.getInstance()), "wrong template: dismiss in weaving rule is not supported"); } catch (TemplateProcessingFailureException e) {</BUG> myEnv.getGenerator().showErrorMessage(context.getInput(), null, myRule.getRuleNode().resolve(MPSModuleRepository.getInstance()), "weaving rule: error processing template fragment"); } finally { if (someOutputGenerated) {
myEnv.getLogger().error(myRule.getRuleNode(), "wrong template: dismiss in weaving rule is not supported", GeneratorUtil.describeIfExists(context.getInput(), "input node")); } catch (TemplateProcessingFailureException e) {
4,153
import java.net.NetworkInterface;</BUG> public class App { public static void main(String[] args) throws Exception { Integer serverPort = Integer.parseInt(System.getProperty("port", "8080")); <BUG>String host = System.getProperty("host", "localhost"); InetAddress address = InetAddress.getByName(host);</BUG> String scribeHost = System.getProperty("scribeHost"); RatpackServer.start(server -> server .serverConfig(config -> config.port(serverPort)) .registry(Guice.registry(binding -> binding
import com.github.kristofa.brave.scribe.ScribeSpanCollector; import com.google.common.collect.Lists; import ratpack.guice.Guice; import ratpack.server.RatpackServer; import ratpack.zipkin.ServerTracingModule;
4,154
String scribeHost = System.getProperty("scribeHost"); RatpackServer.start(server -> server .serverConfig(config -> config.port(serverPort)) .registry(Guice.registry(binding -> binding .module(ServerTracingModule.class, config -> config <BUG>.port(serverPort) .address(address)</BUG> .serviceName("ratpack-demo") .sampler(Sampler.create(1f)) .spanCollector(scribeHost != null ? new ScribeSpanCollector(scribeHost, 9410) : new LoggingSpanCollector())
[DELETED]
4,155
import ratpack.zipkin.internal.DefaultServerTracingHandler; import ratpack.zipkin.internal.RatpackServerClientLocalSpanState; import ratpack.zipkin.internal.ServerRequestAdapterFactory; import ratpack.zipkin.internal.ServerResponseAdapterFactory; import java.net.InetAddress; <BUG>import java.net.UnknownHostException; import static com.google.inject.Scopes.SINGLETON;</BUG> public class ServerTracingModule extends ConfigurableModule<ServerTracingModule.Config> { @Override protected void configure() {
import java.nio.ByteBuffer; import static com.google.inject.Scopes.SINGLETON;
4,156
private SpanCollector spanCollector; private Sampler sampler; private SpanNameProvider spanNameProvider = new DefaultSpanNameProvider(); private RequestAnnotationExtractor requestAnnotationFunc = RequestAnnotationExtractor.DEFAULT; private ResponseAnnotationExtractor responseAnnotationFunc = ResponseAnnotationExtractor.DEFAULT; <BUG>private int port; private InetAddress address = InetAddress.getLoopbackAddress(); public Config() { }</BUG> public Config serviceName(final String serviceName) {
[DELETED]
4,157
if ( instruction.indexOf( MAVEN_DEPENDENCIES ) >= 0 ) { if ( mavenDependencies.length() == 0 ) { String cleanInstruction = BundlePlugin.removeTagFromInstruction( instruction, MAVEN_DEPENDENCIES ); <BUG>properties.setProperty( directiveName, cleanInstruction ); </BUG> } else {
analyzer.setProperty( directiveName, cleanInstruction );
4,158
</BUG> } else { String mergedInstruction = StringUtils.replace( instruction, MAVEN_DEPENDENCIES, mavenDependencies ); <BUG>properties.setProperty( directiveName, mergedInstruction ); </BUG> } } else if ( mavenDependencies.length() > 0 )
if ( instruction.indexOf( MAVEN_DEPENDENCIES ) >= 0 ) if ( mavenDependencies.length() == 0 ) String cleanInstruction = BundlePlugin.removeTagFromInstruction( instruction, MAVEN_DEPENDENCIES ); analyzer.setProperty( directiveName, cleanInstruction ); analyzer.setProperty( directiveName, mergedInstruction );
4,159
</BUG> } else { <BUG>properties.setProperty( directiveName, instruction + ',' + mavenDependencies ); </BUG> } } } else if ( mavenDependencies.length() > 0 )
String mergedInstruction = StringUtils.replace( instruction, MAVEN_DEPENDENCIES, mavenDependencies ); analyzer.setProperty( directiveName, mergedInstruction );
4,160
String msg = ( String ) e.next(); getLog().error( "Error building bundle " + currentProject.getArtifact() + " : " + msg ); } if ( errors.size() > 0 ) { <BUG>String failok = properties.getProperty( "-failok" ); </BUG> if ( null == failok || "false".equalsIgnoreCase( failok ) ) { jarFile.delete();
String failok = builder.getProperty( "-failok" );
4,161
properties.putAll( transformDirectives( originalInstructions ) ); Builder builder = new Builder(); builder.setBase( currentProject.getBasedir() ); builder.setProperties( properties ); builder.setClasspath( classpath ); <BUG>includeMavenResources( currentProject, properties, getLog() ); if ( !properties.containsKey( Analyzer.EXPORT_PACKAGE ) && !properties.containsKey( Analyzer.PRIVATE_PACKAGE ) ) { if ( properties.containsKey( Analyzer.EXPORT_CONTENTS ) ) { properties.put( Analyzer.PRIVATE_PACKAGE, "!*" ); </BUG> }
includeMavenResources( currentProject, builder, getLog() ); if ( builder.getProperty( Analyzer.EXPORT_PACKAGE ) == null && builder.getProperty( Analyzer.PRIVATE_PACKAGE ) == null ) if ( builder.getProperty( Analyzer.EXPORT_CONTENTS ) != null ) builder.setProperty( Analyzer.PRIVATE_PACKAGE, "!*" );
4,162
} else { String combinedResource = StringUtils .replace( includeResource, MAVEN_RESOURCES, mavenResourcePaths ); <BUG>properties.put( Analyzer.INCLUDE_RESOURCE, combinedResource ); </BUG> } } else if ( mavenResourcePaths.length() > 0 )
analyzer.unsetProperty( Analyzer.INCLUDE_RESOURCE ); analyzer.setProperty( Analyzer.INCLUDE_RESOURCE, combinedResource );
4,163
+ " (add " + MAVEN_RESOURCES + " if you want to include the maven resources)" ); } } else if ( mavenResourcePaths.length() > 0 ) { <BUG>properties.put( Analyzer.INCLUDE_RESOURCE, mavenResourcePaths ); </BUG> } } protected static void mergeMavenManifest( MavenProject currentProject, Jar jar, String[] removeHeaders, Log log )
analyzer.setProperty( Analyzer.INCLUDE_RESOURCE, mavenResourcePaths );
4,164
String msg = ( String ) e.next(); getLog().error( "Error in manifest for " + project.getArtifact() + " : " + msg ); } if ( errors.size() > 0 ) { <BUG>String failok = properties.getProperty( "-failok" ); </BUG> if ( null == failok || "false".equalsIgnoreCase( failok ) ) { throw new MojoFailureException( "Error(s) found in manifest configuration" );
String failok = analyzer.getProperty( "-failok" );
4,165
analyzer.setBase( project.getBasedir() ); analyzer.setProperties( properties ); if ( classpath != null ) analyzer.setClasspath( classpath ); analyzer.setJar( file ); <BUG>if ( !properties.containsKey( Analyzer.EXPORT_PACKAGE ) && !properties.containsKey( Analyzer.EXPORT_CONTENTS ) && !properties.containsKey( Analyzer.PRIVATE_PACKAGE ) ) {</BUG> String export = analyzer.calculateExportsFromContents( analyzer.getJar() ); analyzer.setProperty( Analyzer.EXPORT_PACKAGE, export );
if ( analyzer.getProperty( Analyzer.EXPORT_PACKAGE ) == null && analyzer.getProperty( Analyzer.EXPORT_CONTENTS ) == null && analyzer.getProperty( Analyzer.PRIVATE_PACKAGE ) == null ) {
4,166
import static java.util.Objects.requireNonNull; import java.io.Closeable; import java.sql.Connection; import java.sql.SQLException; import java.util.Collections; <BUG>import java.util.List; import java.util.Map;</BUG> import org.jdbi.v3.core.exception.TransactionException; import org.jdbi.v3.core.exception.UnableToCloseResourceException; import org.jdbi.v3.core.exception.UnableToManipulateTransactionIsolationLevelException;
[DELETED]
4,167
statementBuilder, sql, new StatementContext(callConfig, extensionMethod.get()), Collections.<StatementCustomizer>emptyList()); } <BUG>public Query<Map<String, Object>> createQuery(String sql) { ConfigRegistry queryConfig = getConfig().createCopy(); return new Query<>(queryConfig, new Binding(), new DefaultMapper(),</BUG> this,
new StatementContext(batchConfig, extensionMethod.get())); public PreparedBatch prepareBatch(String sql) { ConfigRegistry batchConfig = getConfig().createCopy(); return new PreparedBatch(batchConfig,
4,168
import org.jdbi.v3.core.array.SqlArrayType; import org.jdbi.v3.core.array.SqlArrayTypes; import org.jdbi.v3.core.mapper.ColumnMapper; import org.jdbi.v3.core.mapper.ColumnMappers; import org.jdbi.v3.core.mapper.RowMapper; <BUG>import org.jdbi.v3.core.mapper.RowMappers; public class ConfigRegistry {</BUG> private final Map<Class<? extends JdbiConfig>, JdbiConfig<?>> cache = synchronizedMap(new WeakHashMap<>()); public ConfigRegistry() { }
import org.jdbi.v3.core.util.GenericType; public class ConfigRegistry {
4,169
package com.easytoolsoft.easyreport.web.controller.common; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping(value = "/error") <BUG>public class ErrorController extends AbstractController { @RequestMapping(value = {"/404"})</BUG> public String error404() { return "/error/404"; }
public class ErrorController { @RequestMapping(value = {"/404"})
4,170
if (parameters.length == 0) return; final String qualifier = parameters[0].getText(); final PyDecoratorList decoratorList = function.getDecoratorList(); boolean isClassmethod = false; if (decoratorList != null) { <BUG>for (PyDecorator decorator : decoratorList.getDecorators()) { if (PyNames.CLASSMETHOD.equals(decorator.getCallee().getText())) </BUG> isClassmethod = true; }
final PyExpression callee = decorator.getCallee(); if (callee != null && PyNames.CLASSMETHOD.equals(callee.getText()))
4,171
private LocalBroadcastManager mLocalBroadcastManager; private String mActiveDownloadUrlString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); <BUG>setContentView(R.layout.activity_app_details2); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);</BUG> toolbar.setTitle(""); // Nice and clean toolbar setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.app_details2); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
4,172
.inflate(R.layout.app_details2_screenshots, parent, false); return new ScreenShotsViewHolder(view); } else if (viewType == VIEWTYPE_WHATS_NEW) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.app_details2_whatsnew, parent, false); <BUG>return new WhatsNewViewHolder(view); } else if (viewType == VIEWTYPE_LINKS) {</BUG> View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.app_details2_links, parent, false); return new ExpandableLinearLayoutViewHolder(view);
} else if (viewType == VIEWTYPE_DONATE) { .inflate(R.layout.app_details2_donate, parent, false); return new DonateViewHolder(view); } else if (viewType == VIEWTYPE_LINKS) {
4,173
String ddl = "CREATE TABLE " + test + " (id VARCHAR not null primary key, num FLOAT)"; conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + test + "(id,num) VALUES ('testid', 1.2E3)"; conn.createStatement().execute(dml); conn.commit(); <BUG>ResultSet rs = conn.createStatement().executeQuery("SELECT 1.2E3 FROM SYSTEM.CATALOG LIMIT 1"); </BUG> assertTrue(rs.next()); assertTrue(rs.getObject(1) instanceof Double); }
ResultSet rs = conn.createStatement().executeQuery("SELECT 1.2E3 FROM \"SYSTEM\".\"CATALOG\" LIMIT 1");
4,174
+ "(TABLE_SCHEM, TABLE_NAME) = ('" + schemaName + "','"+ dataTableName + "') AND\n" + "COLUMN_FAMILY IS NULL AND COLUMN_NAME IS NULL"); assertTrue(rs.next()); assertEquals(4,rs.getInt(1)); assertFalse(rs.next()); <BUG>rs = conn1.createStatement().executeQuery("SELECT COLUMN_COUNT FROM SYSTEM.CATALOG\n" </BUG> + "WHERE TENANT_ID IS NULL AND\n" + "(TABLE_SCHEM, TABLE_NAME) = ('" + schemaName + "','"+ indexTableName + "') AND\n" + "COLUMN_FAMILY IS NULL AND COLUMN_NAME IS NULL");
rs = conn1.createStatement().executeQuery("SELECT COLUMN_COUNT FROM \"SYSTEM\".\"CATALOG\"\n"
4,175
assertTrue(rs.next()); assertEquals("COL1",rs.getString(4)); assertTrue(rs.next()); assertEquals("COL4",rs.getString(4)); assertFalse(rs.next()); <BUG>rs = conn1.createStatement().executeQuery("SELECT COLUMN_COUNT FROM SYSTEM.CATALOG\n" </BUG> + "WHERE TENANT_ID IS NULL AND\n" + "(TABLE_SCHEM, TABLE_NAME) = ('" + schemaName + "','"+ dataTableName + "') AND\n" + "COLUMN_FAMILY IS NULL AND COLUMN_NAME IS NULL");
assertEquals("COL2",rs.getString(4)); assertEquals("COL3",rs.getString(4)); rs = conn1.createStatement().executeQuery("SELECT COLUMN_COUNT FROM \"SYSTEM\".\"CATALOG\"\n"
4,176
+ "(TABLE_SCHEM, TABLE_NAME) = ('" + schemaName + "','"+ dataTableName + "') AND\n" + "COLUMN_FAMILY IS NULL AND COLUMN_NAME IS NULL"); assertTrue(rs.next()); assertEquals(3,rs.getInt(1)); assertFalse(rs.next()); <BUG>rs = conn1.createStatement().executeQuery("SELECT COLUMN_COUNT FROM SYSTEM.CATALOG\n" </BUG> + "WHERE TENANT_ID IS NULL AND\n" + "(TABLE_SCHEM, TABLE_NAME) = ('" + schemaName + "','"+ indexTableName + "') AND\n" + "COLUMN_FAMILY IS NULL AND COLUMN_NAME IS NULL");
assertEquals(4,rs.getInt(1)); rs = conn1.createStatement().executeQuery("SELECT COLUMN_COUNT FROM \"SYSTEM\".\"CATALOG\"\n"
4,177
public void testAlterStoreNulls() throws SQLException { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); Statement stmt = conn.createStatement(); stmt.execute("CREATE TABLE " + dataTableFullName + " (id SMALLINT PRIMARY KEY, name VARCHAR)"); <BUG>ResultSet rs = stmt.executeQuery("SELECT STORE_NULLS FROM SYSTEM.CATALOG " + </BUG> "WHERE table_name = '" + dataTableFullName + "' AND STORE_NULLS IS NOT NULL"); assertTrue(rs.next());
ResultSet rs = stmt.executeQuery("SELECT STORE_NULLS FROM \"SYSTEM\".\"CATALOG\" " +
4,178
assertTrue(rs.next()); assertFalse(rs.getBoolean(1)); assertFalse(rs.next()); rs.close(); stmt.execute("ALTER TABLE " + dataTableFullName + " SET STORE_NULLS = true"); <BUG>rs = stmt.executeQuery("SELECT STORE_NULLS FROM SYSTEM.CATALOG " + </BUG> "WHERE table_name = '" + dataTableFullName + "' AND STORE_NULLS IS NOT NULL"); assertTrue(rs.next());
rs = stmt.executeQuery("SELECT STORE_NULLS FROM \"SYSTEM\".\"CATALOG\" " +
4,179
assertNotNull(view.getPKColumn("PK2")); assertTrue(view.getPKColumn("PK2").isRowTimestamp()); } } private void assertIsRowTimestampSet(String schemaName, String tableName, String columnName) throws SQLException { <BUG>String sql = "SELECT IS_ROW_TIMESTAMP FROM SYSTEM.CATALOG WHERE " </BUG> + "(TABLE_SCHEM, TABLE_NAME) = ('" + schemaName + "','"+ tableName + "') AND\n" + "COLUMN_FAMILY IS NULL AND COLUMN_NAME = ?"; try(Connection conn = DriverManager.getConnection(getUrl())) {
String sql = "SELECT IS_ROW_TIMESTAMP FROM \"SYSTEM\".\"CATALOG\" WHERE "
4,180
baseColumnCount==QueryConstants.BASE_TABLE_BASE_COLUMN_COUNT ? baseColumnCount : baseColumnCount +delta, cols); } public static String getSystemCatalogEntriesForTable(Connection conn, String tableName, String message) throws Exception { StringBuilder sb = new StringBuilder(message); sb.append("\n\n\n"); <BUG>ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM SYSTEM.CATALOG WHERE TABLE_NAME='"+ tableName +"'"); </BUG> ResultSetMetaData metaData = rs.getMetaData(); int rowNum = 0; while (rs.next()) {
ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM \"SYSTEM\".\"CATALOG\" WHERE TABLE_NAME='"+ tableName +"'");
4,181
@Test public void testArrayFillFunctionVarchar() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); ResultSet rs; rs = conn.createStatement().executeQuery( <BUG>"SELECT ARRAY_FILL(varchar,5) FROM " + tableName + " WHERE region_name = 'SF Bay Area'"); </BUG> assertTrue(rs.next()); String[] strings = new String[]{"foo", "foo", "foo", "foo", "foo"}; Array array = conn.createArrayOf("VARCHAR", strings);
"SELECT ARRAY_FILL(\"varchar\",5) FROM " + tableName + " WHERE region_name = 'SF Bay Area'");
4,182
@Test(expected = IllegalArgumentException.class) public void testArrayFillFunctionInvalidLength1() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); ResultSet rs; rs = conn.createStatement().executeQuery( <BUG>"SELECT ARRAY_FILL(timestamp,length2) FROM " + tableName </BUG> + " WHERE region_name = 'SF Bay Area'"); assertTrue(rs.next()); Object[] objects = new Object[]{new Timestamp(1432102334184l), new Timestamp(1432102334184l), new Timestamp(1432102334184l)};
"SELECT ARRAY_FILL(\"timestamp\",length2) FROM " + tableName
4,183
@Test(expected = IllegalArgumentException.class) public void testArrayFillFunctionInvalidLength2() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); ResultSet rs; rs = conn.createStatement().executeQuery( <BUG>"SELECT ARRAY_FILL(timestamp,length1) FROM " + tableName </BUG> + " WHERE region_name = 'SF Bay Area'"); assertTrue(rs.next()); Object[] objects = new Object[]{new Timestamp(1432102334184l), new Timestamp(1432102334184l), new Timestamp(1432102334184l)};
public void testArrayFillFunctionInvalidLength1() throws Exception { "SELECT ARRAY_FILL(\"timestamp\",length2) FROM " + tableName
4,184
PARENT_TABLE_NAME = "P_" + BaseTest.generateUniqueName(); TENANT_TABLE_NAME = "V_" + BaseTest.generateUniqueName(); PARENT_TABLE_NAME_NO_TENANT_TYPE_ID = "P_" + BaseTest.generateUniqueName(); TENANT_TABLE_NAME_NO_TENANT_TYPE_ID = "V_" + BaseTest.generateUniqueName(); PARENT_TABLE_DDL = "CREATE TABLE " + PARENT_TABLE_NAME + " ( \n" + <BUG>" user VARCHAR ,\n" + " tenant_id VARCHAR NOT NULL,\n" +</BUG> " tenant_type_id VARCHAR(3) NOT NULL, \n" + " id INTEGER NOT NULL\n" + " CONSTRAINT pk PRIMARY KEY (tenant_id, tenant_type_id, id)) MULTI_TENANT=true, IMMUTABLE_ROWS=true";
" \"user\" VARCHAR ,\n" + " tenant_id VARCHAR NOT NULL,\n" +
4,185
" CONSTRAINT pk PRIMARY KEY (tenant_id, tenant_type_id, id)) MULTI_TENANT=true, IMMUTABLE_ROWS=true"; TENANT_TABLE_DDL = "CREATE VIEW " + TENANT_TABLE_NAME + " ( \n" + " tenant_col VARCHAR) AS SELECT *\n" + " FROM " + PARENT_TABLE_NAME + " WHERE tenant_type_id= '" + TENANT_TYPE_ID + "'"; PARENT_TABLE_DDL_NO_TENANT_TYPE_ID = "CREATE TABLE " + PARENT_TABLE_NAME_NO_TENANT_TYPE_ID + " ( \n" + <BUG>" user VARCHAR ,\n" + " tenant_id VARCHAR NOT NULL,\n" +</BUG> " id INTEGER NOT NULL,\n" + " CONSTRAINT pk PRIMARY KEY (tenant_id, id)) MULTI_TENANT=true, IMMUTABLE_ROWS=true"; TENANT_TABLE_DDL_NO_TENANT_TYPE_ID = "CREATE VIEW " + TENANT_TABLE_NAME_NO_TENANT_TYPE_ID + " ( \n" +
" \"user\" VARCHAR ,\n" + " tenant_id VARCHAR NOT NULL,\n" +
4,186
import mousio.etcd4j.responses.EtcdKeysResponse; import mousio.etcd4j.transport.EtcdClientImpl; import java.io.IOException; import java.util.HashMap; import java.util.Map; <BUG>public class EtcdKeyRequest extends EtcdRequest<EtcdKeysResponse> { </BUG> protected final String key; protected final Map<String, String> requestParams; public EtcdKeyRequest(EtcdClientImpl clientImpl, HttpMethod method, RetryPolicy retryHandler) {
public class EtcdKeyRequest extends AbstractEtcdRequest<EtcdKeysResponse> {
4,187
protected final Map<String, String> requestParams; public EtcdKeyRequest(EtcdClientImpl clientImpl, HttpMethod method, RetryPolicy retryHandler) { this(clientImpl, method, retryHandler, null); } public EtcdKeyRequest(EtcdClientImpl clientImpl, HttpMethod method, RetryPolicy retryHandler, String key) { <BUG>super(clientImpl, method, retryHandler, EtcdKeysResponse.DECODER); </BUG> if (key.startsWith("/")){ key = key.substring(1); }
super(null, clientImpl, method, retryHandler, EtcdKeysResponse.DECODER);
4,188
if (key.startsWith("/")){ key = key.substring(1); } this.key = key; this.requestParams = new HashMap<>(); <BUG>} @Override public EtcdKeyRequest setRetryPolicy(RetryPolicy retryPolicy) { super.setRetryPolicy(retryPolicy); return this;</BUG> }
[DELETED]
4,189
import mousio.etcd4j.transport.EtcdClientImpl; import java.io.IOException; public class AbstractEtcdRequest<R> extends EtcdRequest<R> { private final String uri; protected AbstractEtcdRequest( <BUG>String uri,EtcdClientImpl clientImpl, HttpMethod method, RetryPolicy retryPolicy, EtcdResponseDecoder<R> decoder) { </BUG> super(clientImpl, method, retryPolicy, decoder); this.uri = uri; }
String uri, EtcdClientImpl clientImpl, HttpMethod method, RetryPolicy retryPolicy, EtcdResponseDecoder<R> decoder) {
4,190
import mousio.client.ConnectionState; import mousio.client.retry.ConnectionFailHandler; import mousio.client.retry.RetryHandler; import mousio.client.retry.RetryPolicy; import java.io.IOException; <BUG>import java.util.Collections; import java.util.List;</BUG> import java.util.concurrent.TimeoutException; public class ResponsePromise<T> { private final RetryPolicy retryPolicy;
import java.util.LinkedList; import java.util.List;
4,191
private final ConnectionState connectionState; private final RetryHandler retryHandler; protected Promise<T> promise; protected T response; protected Throwable exception; <BUG>List<IsSimplePromiseResponseHandler<T>> handlers; private final GenericFutureListener<Promise<T>> promiseHandler; public ResponsePromise(RetryPolicy retryPolicy, ConnectionState connectionState, RetryHandler retryHandler) {</BUG> this.connectionState = connectionState;
private List<IsSimplePromiseResponseHandler<T>> handlers; private final ConnectionFailHandler connectionFailHandler; public ResponsePromise(RetryPolicy retryPolicy, ConnectionState connectionState, RetryHandler retryHandler) {
4,192
oldPromise.cancel(true); } } public void addListener(IsSimplePromiseResponseHandler<T> listener) { if (handlers == null) { <BUG>handlers = Collections.singletonList(listener); } else { handlers.add(listener); }</BUG> if (response != null || exception != null) {
handlers = new LinkedList<>();
4,193
public Promise<T> getNettyPromise() { return promise; } public void handleRetry(Throwable cause) { try { <BUG>this.retryPolicy.retry(connectionState, retryHandler, new ConnectionFailHandler() { @Override public void catchException(IOException exception) { handleRetry(exception); } });</BUG> } catch (RetryPolicy.RetryCancelled retryCancelled) {
this.retryPolicy.retry(connectionState, retryHandler, connectionFailHandler);
4,194
return method; } public abstract String getUri(); public Map<String, String> getRequestParams() { return null; <BUG>} public void setPromise(EtcdResponsePromise<R> promise) {</BUG> this.promise = promise; } public EtcdResponsePromise<R> getPromise() {
public boolean hasRequestParams() { return false; public void setPromise(EtcdResponsePromise<R> promise) {
4,195
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
4,196
} @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);
4,197
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);
4,198
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(
4,199
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 {
4,200
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;