id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
2,401
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;
2,402
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()
2,403
import ml.puredark.hviewer.ui.activities.BaseActivity; import ml.puredark.hviewer.ui.dataproviders.ListDataProvider; import ml.puredark.hviewer.ui.fragments.SettingFragment; import ml.puredark.hviewer.ui.listeners.OnItemLongClickListener; import ml.puredark.hviewer.utils.SharedPreferencesUtil; <BUG>import static android.webkit.WebSettings.LOAD_CACHE_ELSE_NETWORK; public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {</BUG> private BaseActivity activity; private Site site; private ListDataProvider mProvider;
import static ml.puredark.hviewer.R.id.container; public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {
2,404
final PictureViewHolder viewHolder = new PictureViewHolder(view); if (pictures != null && position < pictures.size()) { final Picture picture = pictures.get(getPicturePostion(position)); if (picture.pic != null) { loadImage(container.getContext(), picture, viewHolder); <BUG>} else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null && site.extraRule.pictureUrl != null) { getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);</BUG> } else if (site.picUrlSelector != null) { getPictureUrl(container.getContext(), viewHolder, picture, site, site.picUrlSelector, null); } else {
} else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null) { if(site.extraRule.pictureRule != null && site.extraRule.pictureRule.url != null) getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureRule.url, site.extraRule.pictureRule.highRes); else if(site.extraRule.pictureUrl != null) getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);
2,405
import java.util.regex.Pattern; import butterknife.BindView; import butterknife.ButterKnife; import ml.puredark.hviewer.R; import ml.puredark.hviewer.beans.Category; <BUG>import ml.puredark.hviewer.beans.CommentRule; import ml.puredark.hviewer.beans.Rule;</BUG> import ml.puredark.hviewer.beans.Selector; import ml.puredark.hviewer.beans.Site; import ml.puredark.hviewer.ui.adapters.CategoryInputAdapter;
import ml.puredark.hviewer.beans.PictureRule; import ml.puredark.hviewer.beans.Rule;
2,406
inputGalleryRulePictureUrlReplacement.setText(site.galleryRule.pictureUrl.replacement); } if (site.galleryRule.pictureHighRes != null) { inputGalleryRulePictureHighResSelector.setText(joinSelector(site.galleryRule.pictureHighRes)); inputGalleryRulePictureHighResRegex.setText(site.galleryRule.pictureHighRes.regex); <BUG>inputGalleryRulePictureHighResReplacement.setText(site.galleryRule.pictureHighRes.replacement); }</BUG> if (site.galleryRule.commentRule != null) { if (site.galleryRule.commentRule.item != null) { inputGalleryRuleCommentItemSelector.setText(joinSelector(site.galleryRule.commentRule.item));
[DELETED]
2,407
inputExtraRuleCommentDatetimeReplacement.setText(site.extraRule.commentDatetime.replacement); } if (site.extraRule.commentContent != null) { inputExtraRuleCommentContentSelector.setText(joinSelector(site.extraRule.commentContent)); inputExtraRuleCommentContentRegex.setText(site.extraRule.commentContent.regex); <BUG>inputExtraRuleCommentContentReplacement.setText(site.extraRule.commentContent.replacement); }</BUG> } } }
[DELETED]
2,408
lastSite.galleryRule.cover = loadSelector(inputGalleryRuleCoverSelector, inputGalleryRuleCoverRegex, inputGalleryRuleCoverReplacement); lastSite.galleryRule.category = loadSelector(inputGalleryRuleCategorySelector, inputGalleryRuleCategoryRegex, inputGalleryRuleCategoryReplacement); lastSite.galleryRule.datetime = loadSelector(inputGalleryRuleDatetimeSelector, inputGalleryRuleDatetimeRegex, inputGalleryRuleDatetimeReplacement); lastSite.galleryRule.rating = loadSelector(inputGalleryRuleRatingSelector, inputGalleryRuleRatingRegex, inputGalleryRuleRatingReplacement); lastSite.galleryRule.description = loadSelector(inputGalleryRuleDescriptionSelector, inputGalleryRuleDescriptionRegex, inputGalleryRuleDescriptionReplacement); <BUG>lastSite.galleryRule.tags = loadSelector(inputGalleryRuleTagsSelector, inputGalleryRuleTagsRegex, inputGalleryRuleTagsReplacement); lastSite.galleryRule.pictureThumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement); lastSite.galleryRule.pictureUrl = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement); lastSite.galleryRule.pictureHighRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement); lastSite.galleryRule.commentRule = new CommentRule(); lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);</BUG> lastSite.galleryRule.commentRule.avatar = loadSelector(inputGalleryRuleCommentAvatarSelector, inputGalleryRuleCommentAvatarRegex, inputGalleryRuleCommentAvatarReplacement);
lastSite.galleryRule.pictureRule = (lastSite.galleryRule.pictureRule == null) ? new PictureRule() : lastSite.galleryRule.pictureRule; lastSite.galleryRule.pictureRule.thumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement); lastSite.galleryRule.pictureRule.url = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement); lastSite.galleryRule.pictureRule.highRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement); lastSite.galleryRule.commentRule = (lastSite.galleryRule.commentRule == null) ? new CommentRule() : lastSite.galleryRule.commentRule; lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);
2,409
lastSite.extraRule.cover = loadSelector(inputExtraRuleCoverSelector, inputExtraRuleCoverRegex, inputExtraRuleCoverReplacement); lastSite.extraRule.category = loadSelector(inputExtraRuleCategorySelector, inputExtraRuleCategoryRegex, inputExtraRuleCategoryReplacement); lastSite.extraRule.datetime = loadSelector(inputExtraRuleDatetimeSelector, inputExtraRuleDatetimeRegex, inputExtraRuleDatetimeReplacement); lastSite.extraRule.rating = loadSelector(inputExtraRuleRatingSelector, inputExtraRuleRatingRegex, inputExtraRuleRatingReplacement); lastSite.extraRule.description = loadSelector(inputExtraRuleDescriptionSelector, inputExtraRuleDescriptionRegex, inputExtraRuleDescriptionReplacement); <BUG>lastSite.extraRule.tags = loadSelector(inputExtraRuleTagsSelector, inputExtraRuleTagsRegex, inputExtraRuleTagsReplacement); lastSite.extraRule.pictureThumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement); lastSite.extraRule.pictureUrl = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement); lastSite.extraRule.pictureHighRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement); lastSite.extraRule.commentRule = new CommentRule(); lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);</BUG> lastSite.extraRule.commentRule.avatar = loadSelector(inputExtraRuleCommentAvatarSelector, inputExtraRuleCommentAvatarRegex, inputExtraRuleCommentAvatarReplacement);
lastSite.extraRule.pictureRule = (lastSite.extraRule.pictureRule == null) ? new PictureRule() : lastSite.extraRule.pictureRule; lastSite.extraRule.pictureRule.thumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement); lastSite.extraRule.pictureRule.url = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement); lastSite.extraRule.pictureRule.highRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement); lastSite.extraRule.commentRule = (lastSite.extraRule.commentRule == null) ? new CommentRule() : lastSite.extraRule.commentRule; lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);
2,410
notifyItemChanged(position); if (mItemClickListener != null) mItemClickListener.onItemClick(v, position); } }); <BUG>if (tag.selected) label.getChildAt(0).setBackgroundResource(R.color.colorPrimary); else label.getChildAt(0).setBackgroundResource(R.color.dimgray);</BUG> }
[DELETED]
2,411
loadPicture(picture, task, null, true); } else if (!TextUtils.isEmpty(picture.pic) && !highRes) { picture.retries = 0; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) <BUG>&& task.collection.site.extraRule != null && task.collection.site.extraRule.pictureUrl != null) { </BUG> getPictureUrl(picture, task, task.collection.site.extraRule.pictureUrl, task.collection.site.extraRule.pictureHighRes);
&& task.collection.site.extraRule != null) { if(task.collection.site.extraRule.pictureRule != null && task.collection.site.extraRule.pictureRule.url != null) getPictureUrl(picture, task, task.collection.site.extraRule.pictureRule.url, task.collection.site.extraRule.pictureRule.highRes); else if(task.collection.site.extraRule.pictureUrl != null)
2,412
if (Picture.hasPicPosfix(picture.url)) { picture.pic = picture.url; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_JS_NEEDED_ALL)) { <BUG>new Handler(Looper.getMainLooper()).post(()->{ </BUG> WebView webView = new WebView(HViewerApplication.mContext); WebSettings mWebSettings = webView.getSettings(); mWebSettings.setJavaScriptEnabled(true);
new Handler(Looper.getMainLooper()).post(() -> {
2,413
public ClassConfigurator() { } protected static void init() throws ChannelException { try { Util.loadClass("javax.xml.parsers.DocumentBuilderFactory", ClassConfigurator.class); <BUG>MagicNumberReader reader=new MagicNumberReader(); try { String mnfile=Util.getProperty(new String[]{Global.MAGIC_NUMBER_FILE, "org.jgroups.conf.magicNumberFile"}, null, null, false, null); if(mnfile != null) {</BUG> if(log.isDebugEnabled()) log.debug("Using " + mnfile + " as magic number file");
String mnfile=null; try { // PropertyPermission not granted if running in an untrusted environment with JNLP null, null, false, MAGIC_NUMBER_FILE);
2,414
propA.addAttribute("", SchemaNames.ATTR_LAST_CHANGE, //$NON-NLS-1$ SchemaNames.ATTR_LAST_CHANGE, "string", sd.format(rwco //$NON-NLS-1$ .getVersion())); ch.startElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_CHANGE, SchemaNames.EL_NSCHANGE, propA); <BUG>renderToXML(rwco, ch,true); </BUG> ch.endElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_CHANGE, SchemaNames.EL_NSCHANGE); }
renderToXML(rwco, ch, true, true);
2,415
propA.addAttribute("", SchemaNames.ATTR_LAST_CHANGE, //$NON-NLS-1$ SchemaNames.ATTR_LAST_CHANGE, "string", sd.format(rwco //$NON-NLS-1$ .getVersion())); ch.startElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_CHANGE, SchemaNames.EL_NSCHANGE, propA); <BUG>renderToXML(rwco, ch, true); </BUG> ch.endElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_CHANGE, SchemaNames.EL_NSCHANGE); }
renderToXML(rwco, ch, true, true);
2,416
private String standardLinkFormat = null; private String hrefTagFormat = null; private String xalan270ContentHandler = null; private RenderService renderService = null; private String authZPrefix = ""; //$NON-NLS-1$ <BUG>private String xslt = null; private String defaultStackTrace;</BUG> private String errorFormat; private ThreadLocal transformerHolder = new ThreadLocal(); private Map responseHeaders;
private boolean escaped = true; private String defaultStackTrace;
2,417
sbrwo.getName(), sbrwo.getRealm())); ch.endElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_XMLPROPERTIES, SchemaNames.EL_NSXMLPROPERTIES); ch.startElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_RENDEREDCONTENT, SchemaNames.EL_NSRENDEREDCONTENT, dummyAttributes); <BUG>renderToXML(sbrwo, ch, withBreadcrumbs); </BUG> ch.endElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_RENDEREDCONTENT, SchemaNames.EL_NSRENDEREDCONTENT); ch.endElement(SchemaNames.NS_CONTAINER, SchemaNames.EL_SIDEBAR,
renderToXML(sbrwo, ch, withBreadcrumbs, this.escaped);
2,418
contentDigest = Messages.getString("XSLTEntityHandler.36"); //$NON-NLS-1$ } String cdataEscapedRendered = renderedPage .replaceAll("]]>", "]]>]]&gt;<![CDATA["); //$NON-NLS-1$ //$NON-NLS-2$ String cdataContentDigest = contentDigest.replaceAll("]]>", "]]>]]&gt;<![CDATA["); //$NON-NLS-1$ //$NON-NLS-2$ <BUG>renderedPage = "<content><rendered>" + StringEscapeUtils.escapeXml(renderedPage) //$NON-NLS-1$ </BUG> + "</rendered><rendered-cdata><![CDATA[" + cdataEscapedRendered + "]]></rendered-cdata><contentdigest><![CDATA[" + cdataContentDigest //$NON-NLS-1$ //$NON-NLS-2$ + "]]></contentdigest></content>"; //$NON-NLS-1$ try
renderedPage = "<content><rendered>" + (escapeXML ? StringEscapeUtils.escapeXml(renderedPage) : renderedPage) //$NON-NLS-1$
2,419
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
2,420
} @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);
2,421
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);
2,422
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(
2,423
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 {
2,424
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;
2,425
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) {
2,426
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;
2,427
package board.algo; <BUG>import java.util.Collection; import board.RoutingBoard;</BUG> import board.items.BrdItem; import board.items.BrdTracep; import board.varie.BrdKeepPoint;
import java.util.TreeSet; import board.RoutingBoard;
2,428
{ other_trace_corner_approx = curr_other_trace_corner_approx; other_trace_line = curr_other_trace_line; prev_corner_side = curr_prev_corner_side; other_prev_trace_line = curr_other_prev_trace_line; <BUG>} } } else { return null;</BUG> }
if (trace_polyline.corner_count() < 3) return null; curr_prev_end_corner = trace_polyline.corner(trace_polyline.corner_count() - 3); --end_line_no;
2,429
if (p_trace.is_shove_fixed()) return false; Set<BrdAbitPin> saved_contact_pins = contact_pins; contact_pins = null; boolean result = false; boolean connection_to_trace_improved = true; <BUG>BrdTracep curr_trace = p_trace; while (connection_to_trace_improved) </BUG> { connection_to_trace_improved = false;
int loop_counter=0; while (connection_to_trace_improved && loop_counter++ < 100)
2,430
ScopedTransactionBuilder scopedTransactionBuilder, Logger logger, @Named(STACKTRACE) boolean stacktrace) { TransactionProcessorPool<Provider<ASTType>, Provider<ASTType>> externalParcelRepositoryProcessor = new TransactionProcessorPool<Provider<ASTType>, Provider<ASTType>>(); <BUG>TransactionProcessorPool<Provider<ASTType>, Map<Provider<ASTType>, ParcelImplementations>> externalParcelProcessor = new TransactionProcessorPool<Provider<ASTType>, Map<Provider<ASTType>, ParcelImplementations>>(); TransactionProcessorPool<Provider<ASTType>, ParcelImplementations> parcelProcessor = new TransactionProcessorPool<Provider<ASTType>, ParcelImplementations>(); </BUG> TransactionProcessor processor = new TransactionProcessorComposite(ImmutableSet.of(externalParcelRepositoryProcessor,
TransactionProcessorPool<Provider<ASTType>, Void> externalParcelProcessor = new TransactionProcessorPool<Provider<ASTType>, Void>(); TransactionProcessorPool<Provider<ASTType>, Void> parcelProcessor = new TransactionProcessorPool<Provider<ASTType>, Void>();
2,431
private final ScopedTransactionBuilder scopedTransactionBuilder; private final Logger logger; private final boolean stacktrace; public ParcelProcessor(TransactionProcessor processor, TransactionProcessorPool<Provider<ASTType>, Provider<ASTType>> externalParcelRepositoryProcessor, <BUG>TransactionProcessorPool<Provider<ASTType>, Map<Provider<ASTType>, ParcelImplementations>> externalParcelProcessor, TransactionProcessorPool<Provider<ASTType>, ParcelImplementations> parcelProcessor, </BUG> Provider<ExternalParcelRepositoryTransactionWorker> externalParcelRepositoryTransactionWorkerProvider,
TransactionProcessorPool<Provider<ASTType>, Void> externalParcelProcessor, TransactionProcessorPool<Provider<ASTType>, Void> parcelProcessor,
2,432
Bootstraps.inject(this); ASTType mockParcelASTType = astClassFactory.getType(ParcelTarget.class); ASTType mockParcelTwoASTType = astClassFactory.getType(ParcelSecondTarget.class); ParcelableDescriptor parcelableDescriptor = parcelableAnalysis.analyze(mockParcelASTType); ParcelableDescriptor parcelableTwoDescriptor = parcelableAnalysis.analyze(mockParcelTwoASTType); <BUG>JDefinedClass parcelableDefinedClass = parcelableGenerator.generateParcelable(mockParcelASTType, parcelableDescriptor); JDefinedClass parcelableTwoDefinedClass = parcelableGenerator.generateParcelable(mockParcelTwoASTType, parcelableTwoDescriptor); Map<Provider<ASTType>, ParcelImplementations> generated = new HashMap<Provider<ASTType>, ParcelImplementations>(); generated.put(Providers.of(mockParcelASTType), new ParcelImplementations(parcelableDefinedClass)); generated.put(Providers.of(mockParcelTwoASTType), new ParcelImplementations(parcelableTwoDefinedClass));</BUG> ClassLoader classLoader = codeGenerationUtil.build();
[DELETED]
2,433
Map<Provider<ASTType>, ParcelImplementations> generated = new HashMap<Provider<ASTType>, ParcelImplementations>(); generated.put(Providers.of(mockParcelASTType), new ParcelImplementations(parcelableDefinedClass)); generated.put(Providers.of(mockParcelTwoASTType), new ParcelImplementations(parcelableTwoDefinedClass));</BUG> ClassLoader classLoader = codeGenerationUtil.build(); <BUG>parcelableClass = (Class<Parcelable>) classLoader.loadClass(parcelableDefinedClass.fullName()); parcel = Parcel.obtain();</BUG> } @Test public void testGeneratedParcelable() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchFieldException { ParcelTarget parcelTarget = new ParcelTarget();
Bootstraps.inject(this); ASTType mockParcelASTType = astClassFactory.getType(ParcelTarget.class); ASTType mockParcelTwoASTType = astClassFactory.getType(ParcelSecondTarget.class); ParcelableDescriptor parcelableDescriptor = parcelableAnalysis.analyze(mockParcelASTType); ParcelableDescriptor parcelableTwoDescriptor = parcelableAnalysis.analyze(mockParcelTwoASTType); parcelableGenerator.generateParcelable(mockParcelASTType, parcelableDescriptor); parcelableGenerator.generateParcelable(mockParcelTwoASTType, parcelableTwoDescriptor); parcelableClass = (Class<Parcelable>) classLoader.loadClass(ClassNamer.className(mockParcelASTType).append(Parcels.IMPL_EXT).build().toString()); parcel = Parcel.obtain();
2,434
public ParcelTransactionWorker(ParcelableAnalysis parcelableAnalysis, ParcelableGenerator parcelableGenerator) { this.parcelableAnalysis = parcelableAnalysis; this.parcelableGenerator = parcelableGenerator; } @Override <BUG>public ParcelImplementations innerRun(Provider<ASTType> valueProvider) { </BUG> ASTType value = valueProvider.get(); ASTAnnotation parcelASTAnnotation = value.getASTAnnotation(Parcel.class); ParcelableDescriptor analysis = parcelableAnalysis.analyze(value, parcelASTAnnotation);
public Void innerRun(Provider<ASTType> valueProvider) {
2,435
</BUG> ASTType value = valueProvider.get(); ASTAnnotation parcelASTAnnotation = value.getASTAnnotation(Parcel.class); ParcelableDescriptor analysis = parcelableAnalysis.analyze(value, parcelASTAnnotation); if(analysis != null) { <BUG>JDefinedClass definedClass = parcelableGenerator.generateParcelable(value, analysis); return new ParcelImplementations(definedClass, analysis.getExtraImplementations());</BUG> } return null; }
public ParcelTransactionWorker(ParcelableAnalysis parcelableAnalysis, ParcelableGenerator parcelableGenerator) { this.parcelableAnalysis = parcelableAnalysis; this.parcelableGenerator = parcelableGenerator; @Override public Void innerRun(Provider<ASTType> valueProvider) {
2,436
import org.parceler.Parcel; import org.parceler.ParcelClass; import org.parceler.ParcelClasses; import javax.inject.Inject; import javax.inject.Provider; <BUG>import java.util.HashMap; import java.util.Map; public class ExternalParcelTransactionWorker extends AbstractCompletionTransactionWorker<Provider<ASTType>, Map<Provider<ASTType>, ParcelImplementations>> { </BUG> private final ParcelableAnalysis parcelableAnalysis;
public class ExternalParcelTransactionWorker extends AbstractCompletionTransactionWorker<Provider<ASTType>, Void> {
2,437
public ExternalParcelTransactionWorker(ParcelableAnalysis parcelableAnalysis, ParcelableGenerator parcelableGenerator) { this.parcelableAnalysis = parcelableAnalysis; this.parcelableGenerator = parcelableGenerator; } @Override <BUG>public Map<Provider<ASTType>, ParcelImplementations> innerRun(Provider<ASTType> valueProvider) { ASTType value = valueProvider.get(); Map<Provider<ASTType>, ParcelImplementations> generatedSource = new HashMap<Provider<ASTType>, ParcelImplementations>();</BUG> ASTAnnotation parcelClassesAnnotation = value.getASTAnnotation(ParcelClasses.class); if(parcelClassesAnnotation != null){
public Void innerRun(Provider<ASTType> valueProvider) {
2,438
if(parcelASTAnnotation == null){ parcelASTAnnotation = parcelType.getASTAnnotation(Parcel.class); } ParcelableDescriptor analysis = parcelableAnalysis.analyze(parcelType, parcelASTAnnotation); if(analysis != null) { <BUG>generatedSource.put(new ASTTypeProvider(parcelType), new ParcelImplementations(parcelableGenerator.generateParcelable(parcelType, analysis))); }</BUG> } private static final class ASTTypeProvider implements Provider<ASTType>{ private ASTType parcelType;
parcelableGenerator.generateParcelable(parcelType, analysis);
2,439
this.invocationBuilder = invocationBuilder; this.generators = generators; this.enumReadWriteGenerator = enumReadWriteGenerator; this.parcelReadWriteGenerator = parcelReadWriteGenerator; } <BUG>public JDefinedClass generateParcelable(final ASTType type, ParcelableDescriptor parcelableDescriptor) { </BUG> try { JType inputType = generationUtil.ref(type); JDefinedClass parcelableClass = generationUtil.defineClass(ClassNamer.className(type).append(Parcels.IMPL_EXT).build());
public void generateParcelable(final ASTType type, ParcelableDescriptor parcelableDescriptor) {
2,440
import java.net.URI; import java.util.Calendar; import java.util.Date; import java.util.Formatter; import java.util.List; <BUG>import javax.ws.rs.core.UriBuilder; import org.apache.commons.httpclient.URIException; import org.apache.commons.httpclient.util.URIUtil;</BUG> import org.suigeneris.jrcs.rcs.Version; import org.xwiki.rest.Relations;
[DELETED]
2,441
if (home != null) { space.setHome(home.getPrefixedFullName()); space.setXwikiRelativeUrl(home.getURL("view")); space.setXwikiAbsoluteUrl(home.getExternalURL("view")); } <BUG>String pagesUri = UriBuilder.fromUri(baseUri).path(PagesResource.class).build(wikiName, spaceName).toString(); </BUG> Link pagesLink = objectFactory.createLink(); pagesLink.setHref(pagesUri); pagesLink.setRel(Relations.PAGES);
String pagesUri = uri(baseUri, PagesResource.class, wikiName, spaceName);
2,442
Link pagesLink = objectFactory.createLink(); pagesLink.setHref(pagesUri); pagesLink.setRel(Relations.PAGES); space.getLinks().add(pagesLink); if (home != null) { <BUG>String homeUri = UriBuilder.fromUri(baseUri).path(PageResource.class).build(wikiName, spaceName, home.getName()) .toString();</BUG> Link homeLink = objectFactory.createLink();
String homeUri = uri(baseUri, PageResource.class, wikiName, spaceName, home.getName());
2,443
.toString();</BUG> Link homeLink = objectFactory.createLink(); homeLink.setHref(homeUri); homeLink.setRel(Relations.HOME); space.getLinks().add(homeLink); <BUG>} String searchUri = UriBuilder.fromUri(baseUri).path(SpaceSearchResource.class).build(wikiName, spaceName).toString();</BUG> Link searchLink = objectFactory.createLink(); searchLink.setHref(searchUri);
Link pagesLink = objectFactory.createLink(); pagesLink.setHref(pagesUri); pagesLink.setRel(Relations.PAGES); space.getLinks().add(pagesLink); if (home != null) { String homeUri = uri(baseUri, PageResource.class, wikiName, spaceName, home.getName()); String searchUri = uri(baseUri, SpaceSearchResource.class, wikiName, spaceName);
2,444
if (!languages.isEmpty()) { if (!doc.getDefaultLanguage().equals("")) { translations.setDefault(doc.getDefaultLanguage()); Translation translation = objectFactory.createTranslation(); translation.setLanguage(doc.getDefaultLanguage()); <BUG>String pageTranslationUri = UriBuilder.fromUri(baseUri).path(PageResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG> Link pageTranslationLink = objectFactory.createLink(); pageTranslationLink.setHref(pageTranslationUri);
uri(baseUri, PageResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
2,445
} } for (String language : languages) { Translation translation = objectFactory.createTranslation(); translation.setLanguage(language); <BUG>String pageTranslationUri = UriBuilder.fromUri(baseUri).path(PageTranslationResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), language).toString();</BUG> Link pageTranslationLink = objectFactory.createLink(); pageTranslationLink.setHref(pageTranslationUri);
uri(baseUri, PageTranslationResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), language);
2,446
Link pageTranslationLink = objectFactory.createLink(); pageTranslationLink.setHref(pageTranslationUri); pageTranslationLink.setRel(Relations.PAGE); translation.getLinks().add(pageTranslationLink); String historyUri = <BUG>UriBuilder.fromUri(baseUri).path(PageTranslationHistoryResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), language).toString(); Link historyLink = objectFactory.createLink();</BUG> historyLink.setHref(historyUri); historyLink.setRel(Relations.HISTORY);
uri(baseUri, PageTranslationHistoryResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), language); Link historyLink = objectFactory.createLink();
2,447
pageSummary.setParent(doc.getParent()); if (parent != null && !parent.isNew()) { pageSummary.setParentId(parent.getPrefixedFullName()); } else { pageSummary.setParentId(""); <BUG>} String spaceUri = UriBuilder.fromUri(baseUri).path(SpaceResource.class).build(doc.getWiki(), doc.getSpace()).toString();</BUG> Link spaceLink = objectFactory.createLink(); spaceLink.setHref(spaceUri);
String spaceUri = uri(baseUri, SpaceResource.class, doc.getWiki(), doc.getSpace());
2,448
UriBuilder.fromUri(baseUri).path(SpaceResource.class).build(doc.getWiki(), doc.getSpace()).toString();</BUG> Link spaceLink = objectFactory.createLink(); spaceLink.setHref(spaceUri); spaceLink.setRel(Relations.SPACE); pageSummary.getLinks().add(spaceLink); <BUG>if (parent != null) { String parentUri = UriBuilder.fromUri(baseUri).path(PageResource.class) .build(parent.getWiki(), parent.getSpace(), parent.getName()).toString();</BUG> Link parentLink = objectFactory.createLink();
pageSummary.setParent(doc.getParent()); if (parent != null && !parent.isNew()) { pageSummary.setParentId(parent.getPrefixedFullName()); } else { pageSummary.setParentId(""); } String spaceUri = uri(baseUri, SpaceResource.class, doc.getWiki(), doc.getSpace()); String parentUri = uri(baseUri, PageResource.class, parent.getWiki(), parent.getSpace(), parent.getName());
2,449
Link historyLink = objectFactory.createLink(); historyLink.setHref(historyUri); historyLink.setRel(Relations.HISTORY); pageSummary.getLinks().add(historyLink); if (!doc.getChildren().isEmpty()) { <BUG>String pageChildrenUri = UriBuilder.fromUri(baseUri).path(PageChildrenResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG> Link pageChildrenLink = objectFactory.createLink(); pageChildrenLink.setHref(pageChildrenUri);
uri(baseUri, PageChildrenResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
2,450
objectsLink.setRel(Relations.OBJECTS); pageSummary.getLinks().add(objectsLink); } com.xpn.xwiki.api.Object tagsObject = doc.getObject("XWiki.TagClass", 0); if (tagsObject != null) { <BUG>if (tagsObject.getProperty("tags") != null) { String tagsUri = UriBuilder.fromUri(baseUri).path(PageTagsResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG> Link tagsLink = objectFactory.createLink();
String tagsUri = uri(baseUri, PageTagsResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
2,451
tagsLink.setHref(tagsUri); tagsLink.setRel(Relations.TAGS); pageSummary.getLinks().add(tagsLink); } } <BUG>String syntaxesUri = UriBuilder.fromUri(baseUri).path(SyntaxesResource.class).build().toString(); Link syntaxesLink = objectFactory.createLink();</BUG> syntaxesLink.setHref(syntaxesUri); syntaxesLink.setRel(Relations.SYNTAXES); pageSummary.getLinks().add(syntaxesLink);
String syntaxesUri = uri(baseUri, SyntaxesResource.class); Link syntaxesLink = objectFactory.createLink();
2,452
} return historySummary; } private static void fillAttachment(Attachment attachment, ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Document doc = xwikiAttachment.getDocument(); attachment.setId(String.format("%s@%s", doc.getPrefixedFullName(), xwikiAttachment.getFilename()));
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
2,453
Calendar calendar = Calendar.getInstance(); calendar.setTime(xwikiAttachment.getDate()); attachment.setDate(calendar); attachment.setXwikiRelativeUrl(xwikiRelativeUrl); attachment.setXwikiAbsoluteUrl(xwikiAbsoluteUrl); <BUG>String pageUri = UriBuilder.fromUri(baseUri).path(PageResource.class).build(doc.getWiki(), doc.getSpace(), doc.getName()) .toString();</BUG> Link pageLink = objectFactory.createLink();
String pageUri = uri(baseUri, PageResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
2,454
} return attachmentUri; }</BUG> public static Attachment createAttachment(ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Attachment attachment = objectFactory.createAttachment(); fillAttachment(attachment, objectFactory, baseUri, xwikiAttachment, xwikiRelativeUrl, xwikiAbsoluteUrl,
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
2,455
attachmentLink.setRel(Relations.ATTACHMENT_DATA); attachment.getLinks().add(attachmentLink); return attachment; } public static Attachment createAttachmentAtVersion(ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Attachment attachment = new Attachment();
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
2,456
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> } else { <BUG>propertiesUri = UriBuilder .fromUri(baseUri) .path(ObjectPropertiesResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> }
fillObjectSummary(objectSummary, objectFactory, baseUri, doc, xwikiObject, xwikiApi, withPrettyNames); Link objectLink = getObjectLink(objectFactory, baseUri, doc, xwikiObject, useVersion, Relations.OBJECT); objectSummary.getLinks().add(objectLink); String propertiesUri; if (useVersion) { uri(baseUri, ObjectPropertiesAtPageVersionResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()); uri(baseUri, ObjectPropertiesResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
2,457
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber(), propertyClass.getName()) .toString();</BUG> } else { <BUG>propertyUri = UriBuilder .fromUri(baseUri) .path(ObjectPropertyResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber(), propertyClass.getName()).toString();</BUG> }
propertiesUri = uri(baseUri, ObjectPropertiesResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
2,458
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> } else { <BUG>objectUri = UriBuilder .fromUri(baseUri) .path(ObjectResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> }
private static Link getObjectLink(ObjectFactory objectFactory, URI baseUri, Document doc, BaseObject xwikiObject, boolean useVersion, String relation) String objectUri; if (useVersion) { uri(baseUri, ObjectAtPageVersionResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()); uri(baseUri, ObjectResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
2,459
Link propertyLink = objectFactory.createLink(); propertyLink.setHref(propertyUri); propertyLink.setRel(Relations.SELF); property.getLinks().add(propertyLink); clazz.getProperties().add(property); <BUG>} String classUri = UriBuilder.fromUri(baseUri).path(ClassResource.class).build(wikiName, xwikiClass.getName()).toString();</BUG> Link classLink = objectFactory.createLink(); classLink.setHref(classUri);
String classUri = uri(baseUri, ClassResource.class, wikiName, xwikiClass.getName());
2,460
String classUri = UriBuilder.fromUri(baseUri).path(ClassResource.class).build(wikiName, xwikiClass.getName()).toString();</BUG> Link classLink = objectFactory.createLink(); classLink.setHref(classUri); classLink.setRel(Relations.SELF); <BUG>clazz.getLinks().add(classLink); String propertiesUri = UriBuilder.fromUri(baseUri).path(ClassPropertiesResource.class).build(wikiName, xwikiClass.getName()) .toString();</BUG> Link propertyLink = objectFactory.createLink();
propertyLink.setHref(propertyUri); propertyLink.setRel(Relations.SELF); property.getLinks().add(propertyLink); clazz.getProperties().add(property); } String classUri = uri(baseUri, ClassResource.class, wikiName, xwikiClass.getName()); String propertiesUri = uri(baseUri, ClassPropertiesResource.class, wikiName, xwikiClass.getName());
2,461
<BUG>package org.xwiki.rest.internal; import org.apache.commons.lang3.StringUtils;</BUG> import org.xwiki.component.manager.ComponentManager; import org.xwiki.context.Execution; import org.xwiki.model.reference.EntityReferenceSerializer;
import java.net.URI; import javax.ws.rs.core.UriBuilder; import org.apache.commons.httpclient.URIException; import org.apache.commons.httpclient.util.URIUtil; import org.apache.commons.lang3.StringUtils;
2,462
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 {
2,463
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]
2,464
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;
2,465
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 {
2,466
package net.percederberg.mibble.browser; <BUG>import javax.swing.tree.DefaultMutableTreeNode; import net.percederberg.mibble.MibType;</BUG> import net.percederberg.mibble.MibValueSymbol; import net.percederberg.mibble.snmp.SnmpObjectType; import net.percederberg.mibble.snmp.SnmpType;
import net.percederberg.mibble.Mib; import net.percederberg.mibble.MibType;
2,467
import net.percederberg.mibble.MibValueSymbol; import net.percederberg.mibble.snmp.SnmpObjectType; import net.percederberg.mibble.snmp.SnmpType; import net.percederberg.mibble.value.ObjectIdentifierValue; public class MibNode extends DefaultMutableTreeNode { <BUG>private String name; private ObjectIdentifierValue value; public MibNode(String name, ObjectIdentifierValue value) { super(name);</BUG> this.name = name;
private Object value; private Mib mib; private ObjectIdentifierValue oid; public MibNode(String name, Object value) { super(name);
2,468
while (iter.hasNext()) { MibSymbol symbol = iter.next(); addSymbol(valueTree.getModel(), symbol); } MibNode root = (MibNode) mibTree.getModel().getRoot(); <BUG>node = new MibNode(mib.getName(), null); </BUG> node.add((MibNode) valueTree.getModel().getRoot()); root.add(node); }
node = new MibNode(mib.getName(), mib);
2,469
DefaultTreeModel model = (DefaultTreeModel) mibTree.getModel(); MibNode root = (MibNode) model.getRoot(); Enumeration<MibNode> e = root.preorderEnumeration(); while (e.hasMoreElements()) { MibNode tmp = e.nextElement(); <BUG>if (tmp.getValue() == null && tmp.getName().equals(mibName)) { removeNodes(tmp);</BUG> model.removeNodeFromParent(tmp); return true; }
if (tmp.getName().equals(mibName)) { removeNodes(tmp);
2,470
import org.squiddev.cobalt.lib.platform.FileResourceManipulator; import java.io.*; import java.util.ArrayList; import java.util.List; import static org.squiddev.cobalt.Constants.NONE; <BUG>import static org.squiddev.cobalt.Factory.tableOf; import static org.squiddev.cobalt.Factory.valueOf; </BUG> public class lua {
import static org.squiddev.cobalt.ValueFactory.tableOf; import static org.squiddev.cobalt.ValueFactory.valueOf;
2,471
package org.squiddev.cobalt; import org.squiddev.cobalt.lib.DebugLib; <BUG>import static org.squiddev.cobalt.Factory.valueOf; </BUG> public final class LuaError extends RuntimeException { private static final long serialVersionUID = 3065540200206862088L; public LuaValue value;
import static org.squiddev.cobalt.ValueFactory.valueOf;
2,472
private final boolean calculateLevel; public LuaError(Throwable cause) { super(cause); level = 1; calculateLevel = true; <BUG>value = Factory.valueOf("vm error: " + cause.toString()); </BUG> } public LuaError(String message) { super(message);
value = ValueFactory.valueOf("vm error: " + cause.toString());
2,473
} public LuaError(String message) { super(message); level = 1; calculateLevel = true; <BUG>value = Factory.valueOf(message); </BUG> } public LuaError(String message, int level) { super(message);
value = ValueFactory.valueOf(message);
2,474
if (calculateLevel) { fileLine = DebugLib.fileline(thread); } else { fileLine = DebugLib.fileline(thread, level - 1); } <BUG>if (fileLine != null) value = Factory.valueOf(fileLine + ": " + value.toString()); </BUG> } traceback = getMessage() + "\n" + DebugLib.traceback(thread, level); if (thread.err != null) {
if (fileLine != null) value = ValueFactory.valueOf(fileLine + ": " + value.toString());
2,475
LuaValue errfunc = thread.err; thread.err = null; try { value = errfunc.call(state, value); } catch (Throwable t) { <BUG>value = Factory.valueOf("error in error handling"); </BUG> } finally { thread.err = errfunc; }
value = ValueFactory.valueOf("error in error handling");
2,476
package org.squiddev.cobalt; <BUG>import static org.squiddev.cobalt.Factory.valueOf; </BUG> public class Constants { public static final int TINT = (-2); public static final int TNONE = (-1);
import static org.squiddev.cobalt.ValueFactory.valueOf;
2,477
public static final LuaString LT = valueOf("__lt"); public static final LuaString LE = valueOf("__le"); public static final LuaString TOSTRING = valueOf("__tostring"); public static final LuaString CONCAT = valueOf("__concat"); public static final LuaString EMPTYSTRING = valueOf(""); <BUG>static final int MAXTAGLOOP = 100; static int MAXSTACK = 250; </BUG> public static final LuaValue[] NILS = new LuaValue[MAXSTACK];
public static final int MAXTAGLOOP = 100; public static final int MAXSTACK = 250;
2,478
import org.squiddev.cobalt.compiler.LuaC; import org.squiddev.cobalt.lib.jse.JsePlatform; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; <BUG>import static org.squiddev.cobalt.Factory.valueOf; </BUG> public class LoadState { public static final int NUMBER_FORMAT_FLOATS_OR_DOUBLES = 0; public static final int NUMBER_FORMAT_INTS_ONLY = 1;
import static org.squiddev.cobalt.ValueFactory.valueOf;
2,479
if ((f & intPrecMask) == 0) { int intValue = (int) (f >> shift) | (1 << e); return LuaInteger.valueOf(((bits >> 63) != 0) ? -intValue : intValue); } } <BUG>return Factory.valueOf(Double.longBitsToDouble(bits)); </BUG> } LuaValue loadNumber() throws IOException { if (luacNumberFormat == NUMBER_FORMAT_INTS_ONLY) {
return ValueFactory.valueOf(Double.longBitsToDouble(bits));
2,480
return new TailcallVarargs(stack[a], v); } b = i >>> 23; switch (b) { case 0: <BUG>return Factory.varargsOf(stack, a, top - v.narg() - a, v); </BUG> case 1: return Constants.NONE; case 2:
return ValueFactory.varargsOf(stack, a, top - v.narg() - a, v);
2,481
case 1: return Constants.NONE; case 2: return stack[a]; default: <BUG>return Factory.varargsOf(stack, a, b - 1); </BUG> } case Lua.OP_FORLOOP: /* A sBx R(A)+=R(A+2): if R(A) <?= R(A+1) then { pc+=sBx: R(A+3)=R(A) }*/ { LuaValue limit = stack[a + 1];
return ValueFactory.varargsOf(stack, a, b - 1);
2,482
stack[a + 2] = step; pc += (i >>> 14) - 0x1ffff; } continue; case Lua.OP_TFORLOOP: /* <BUG>v = stack[a].invoke(state, Factory.varargsOf(stack[a + 1], stack[a + 2])); </BUG> if ((o = v.arg1()).isnil()) { ++pc; } else {
v = stack[a].invoke(state, ValueFactory.varargsOf(stack[a + 1], stack[a + 2]));
2,483
public boolean raweq(int val) { return v == val; } @Override public int strcmp(LuaString rhs) { <BUG>typeError("attempt to compare number with string"); return 0;</BUG> } @Override
throw ErrorFactory.typeError(this, "attempt to compare number with string");
2,484
public boolean raweq(int val) { return v == val; } @Override public int strcmp(LuaString rhs) { <BUG>typeError("attempt to compare number with string"); return 0;</BUG> } @Override
throw ErrorFactory.typeError(this, "attempt to compare number with string");
2,485
public String checkjstring() { return String.valueOf(v); } @Override public LuaString checkstring() { <BUG>return Factory.valueOf(String.valueOf(v)); </BUG> } @Override public double checkarith() {
return ValueFactory.valueOf(String.valueOf(v));
2,486
import android.view.MotionEvent; import android.view.Surface; import android.view.View; import android.view.WindowManager; import android.widget.FrameLayout; <BUG>import java.io.File; import java.io.FileOutputStream;</BUG> import java.io.IOException; import java.nio.ByteBuffer; import java.text.SimpleDateFormat;
import java.io.FileNotFoundException; import java.io.FileOutputStream;
2,487
private int maxTotalConnections; @Value("${ngsi.http.maxConnectionsPerRoute:2}") private int maxConnectionsPerRoute; @Value("${ngsi.http.requestTimeout:2000}") private int requestTimeout; <BUG>@Bean public AsyncRestTemplate asyncRestTemplate(AsyncClientHttpRequestFactory asyncClientHttpRequestFactory,</BUG> MappingJackson2HttpMessageConverter jsonConverter) { AsyncRestTemplate restTemplate = new AsyncRestTemplate(asyncClientHttpRequestFactory); for(HttpMessageConverter httpMessageConverter : restTemplate.getMessageConverters()) {
@Resource(name = "jsonV1Converter") public AsyncRestTemplate asyncRestTemplate(AsyncClientHttpRequestFactory asyncClientHttpRequestFactory,
2,488
@Autowired private NgsiValidation ngsiValidation; @Autowired private Dispatcher dispatcher; @RequestMapping(value = "/notifyContext", method = RequestMethod.POST, consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE}) <BUG>final public ResponseEntity<NotifyContextResponse> notifyContextRequest(@RequestBody final NotifyContext notify, @RequestHeader("Host") final String host, @RequestHeader("Accept") final String accept) throws Exception { dispatcher.addJsonHost(host, accept, true); ngsiValidation.checkNotifyContext(notify); return new ResponseEntity<>(notifyContext(notify), HttpStatus.OK);</BUG> }
final public ResponseEntity<NotifyContextResponse> notifyContextRequest(@RequestBody final NotifyContext notify, HttpServletRequest httpServletRequest) throws Exception { registerIntoDispatcher(httpServletRequest); return new ResponseEntity<>(notifyContext(notify), HttpStatus.OK);
2,489
package com.orange.ngsi; <BUG>import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonUnwrapped;</BUG> import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializer;
[DELETED]
2,490
builder.modulesToInstall(booleanAsString); builder.mixIn(ContextElement.class, ContextElementMixIn.class); return builder.build(); } @Bean <BUG>@Primary public MappingJackson2HttpMessageConverter jsonConverter(ObjectMapper objectMapper) { </BUG> return new MappingJackson2HttpMessageConverter(objectMapper); }
[DELETED]
2,491
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
2,492
} @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);
2,493
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);
2,494
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(
2,495
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 {
2,496
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;
2,497
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) {
2,498
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;
2,499
else if (t == ANY_CYPHER_OPTION) { r = AnyCypherOption(b, 0); } else if (t == ANY_FUNCTION_INVOCATION) { r = AnyFunctionInvocation(b, 0); <BUG>} else if (t == BULK_IMPORT_QUERY) {</BUG> r = BulkImportQuery(b, 0); } else if (t == CALL) {
else if (t == ARRAY) { r = Array(b, 0); else if (t == BULK_IMPORT_QUERY) {
2,500
if (!r) r = MapLiteral(b, l + 1); if (!r) r = MapProjection(b, l + 1); if (!r) r = CountStar(b, l + 1); if (!r) r = ListComprehension(b, l + 1); if (!r) r = PatternComprehension(b, l + 1); <BUG>if (!r) r = Expression1_12(b, l + 1); if (!r) r = FilterFunctionInvocation(b, l + 1);</BUG> if (!r) r = ExtractFunctionInvocation(b, l + 1); if (!r) r = ReduceFunctionInvocation(b, l + 1); if (!r) r = AllFunctionInvocation(b, l + 1);
if (!r) r = Array(b, l + 1); if (!r) r = FilterFunctionInvocation(b, l + 1);