id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
8,601 | int rowStyle = 0;
writer.startElement("div", data);
writer.writeAttribute("id", "contents", null);
writer.startElement("div", data);
writer.writeAttribute("id", "q3", null);
<BUG>writer.startElement("div", data);
writer.writeAttribute("style", "height:" + (initHeight - 15) + "px;",null);
writer.startElement("table", data);</BUG>
writer.writeAttribute("cellpadding", "0", null);
writer.writeAttribute("cellspacing", "0", null);
| if(totalCount <= columnLock){
writer.writeAttribute("style", "overflow:auto;height:" + (initHeight - 15) + "px;",null);
} else {
}
writer.startElement("table", data);
|
8,602 | writer.endElement("table");
writer.writeText("\n", null);
writer.endElement("div");
writer.writeText("\n", null);
writer.endElement("div"); //end <div id="q3">
<BUG>writer.writeText("\n", null);
writer.startElement("div", data);</BUG>
writer.writeAttribute("id", "q4", null);
writer.startElement("div", data);
writer.writeAttribute("style", "height:" + initHeight + "px;", null);
| if(totalCount > columnLock)
{
|
8,603 | 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;
|
8,604 | 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());
|
8,605 | 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
|
8,606 | <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;
|
8,607 | 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] |
8,608 | <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;
|
8,609 | 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;
|
8,610 | 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;
|
8,611 | 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);
|
8,612 | 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 {
|
8,613 | 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(),
|
8,614 | )
);
}else{
return new TimeNode(
generateDayCandidatesQuestionMarkNotSupported(
<BUG>date.getYear(), date.getMonthOfYear(),
</BUG>
((DayOfWeekFieldDefinition)
cronDefinition.getFieldDefinition(DAY_OF_WEEK)
).getMondayDoWValue()
| date.getYear(), date.getMonthValue(),
|
8,615 | }
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);
|
8,616 | 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] |
8,617 | <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;
|
8,618 | 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;
|
8,619 | 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()
|
8,620 | assertResponseCode(200, response);
response = getNamespace(NAME);
JsonObject namespace = readGetResponse(response);
Assert.assertNotNull(namespace);
Assert.assertEquals(NAME, namespace.get(NAME_FIELD).getAsString());
<BUG>Assert.assertEquals(EMPTY, namespace.get(DESCRIPTION_FIELD).getAsString());
NamespaceMeta meta = new NamespaceMeta.Builder().setName(NAME).setSchedulerQueueName("prod").build();
setProperties(NAME, meta);
response = getNamespace(NAME);</BUG>
namespace = readGetResponse(response);
| Assert.assertEquals(DESCRIPTION, namespace.get(DESCRIPTION_FIELD).getAsString());
response = createNamespace(METADATA_EMPTY_FIELDS, NAME);
|
8,621 | import co.cask.cdap.proto.NamespaceConfig;
import co.cask.cdap.proto.NamespaceMeta;
import co.cask.cdap.proto.ProgramType;
import co.cask.cdap.templates.AdapterDefinition;
import com.google.common.base.Preconditions;
<BUG>import com.google.common.base.Predicate;
import com.google.common.base.Throwables;</BUG>
import com.google.common.collect.Maps;
import com.google.inject.Inject;
import org.slf4j.Logger;
| import com.google.common.base.Strings;
import com.google.common.base.Throwables;
|
8,622 | import org.spongepowered.api.world.Locatable;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;
import javax.annotation.Nullable;
import java.util.List;
<BUG>import java.util.Optional;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG>
public class CommandDelete extends FCCommandBase {
private static final FlagMapper MAPPER = map -> key -> value -> {
map.put(key, value);
| import java.util.stream.Stream;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
|
8,623 | .append(Text.of(TextColors.GREEN, "Usage: "))
.append(getUsage(source))
.build());
return CommandResult.empty();
} else if (isIn(REGIONS_ALIASES, parse.args[0])) {
<BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!"));
IRegion region = FGManager.getInstance().getRegion(parse.args[1]);
</BUG>
boolean isWorldRegion = false;
if (region == null) {
| String regionName = parse.args[1];
IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
|
8,624 | </BUG>
isWorldRegion = true;
}
if (region == null)
<BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!"));
if (region instanceof GlobalWorldRegion) {
</BUG>
throw new CommandException(Text.of("You may not delete the global region!"));
}
| if (world == null)
throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!"));
if (world == null) throw new CommandException(Text.of("Must specify a world!"));
region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null);
throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!"));
if (region instanceof IGlobal) {
|
8,625 | source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region"
);
return CommandResult.success();
} else if (isIn(HANDLERS_ALIASES, parse.args[0])) {
if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!"));
<BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]);
if (handler == null)
throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1);
if (handler instanceof GlobalHandler)</BUG>
throw new CommandException(Text.of("You may not delete the global handler!"));
| Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]);
if (!handlerOpt.isPresent())
IHandler handler = handlerOpt.get();
if (handler instanceof GlobalHandler)
|
8,626 | .excludeCurrent(true)
.autoCloseQuotes(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
<BUG>return ImmutableList.of("region", "handler").stream()
.filter(new StartsWithPredicate(parse.current.token))</BUG>
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index == 1) {
| return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
|
8,627 | .excludeCurrent(true)
.autoCloseQuotes(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
<BUG>return ImmutableList.of("region", "handler").stream()
.filter(new StartsWithPredicate(parse.current.token))</BUG>
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index == 1) {
| return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
|
8,628 | @Dependency(id = "foxcore")
},
description = "A world protection plugin built for SpongeAPI. Requires FoxCore.",
authors = {"gravityfox"},
url = "https://github.com/FoxDenStudio/FoxGuard")
<BUG>public final class FoxGuardMain {
public final Cause pluginCause = Cause.builder().named("plugin", this).build();
private static FoxGuardMain instanceField;</BUG>
@Inject
private Logger logger;
| private static FoxGuardMain instanceField;
|
8,629 | private UserStorageService userStorage;
private EconomyService economyService = null;
private boolean loaded = false;
private FCCommandDispatcher fgDispatcher;
public static FoxGuardMain instance() {
<BUG>return instanceField;
}</BUG>
@Listener
public void construct(GameConstructionEvent event) {
instanceField = this;
| }
public static Cause getCause() {
return instance().pluginCause;
}
|
8,630 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
8,631 | import org.spongepowered.api.world.Locatable;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;
import javax.annotation.Nullable;
import java.util.*;
<BUG>import java.util.stream.Collectors;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG>
public class CommandHere extends FCCommandBase {
private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"};
private static final FlagMapper MAPPER = map -> key -> value -> {
| import java.util.stream.Stream;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
|
8,632 | .excludeCurrent(true)
.autoCloseQuotes(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
<BUG>return ImmutableList.of("region", "handler").stream()
.filter(new StartsWithPredicate(parse.current.token))</BUG>
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index > 0) {
| return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
|
8,633 | private static FGStorageManager instance;
private final Logger logger = FoxGuardMain.instance().getLogger();</BUG>
private final Set<LoadEntry> loaded = new HashSet<>();
private final Path directory = getDirectory();
private final Map<String, Path> worldDirectories;
<BUG>private FGStorageManager() {
defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG>
if (k instanceof IFGObject) {
m.put((IFGObject) k, true);
return true;
| public final HashMap<IFGObject, Boolean> defaultModifiedMap;
private final UserStorageService userStorageService;
private final Logger logger = FoxGuardMain.instance().getLogger();
userStorageService = FoxGuardMain.instance().getUserStorage();
defaultModifiedMap = new CacheMap<>((k, m) -> {
|
8,634 | String name = fgObject.getName();
Path singleDir = dir.resolve(name.toLowerCase());
</BUG>
boolean shouldSave = fgObject.shouldSave();
if (force || shouldSave) {
<BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir);
</BUG>
constructDirectory(singleDir);
try {
fgObject.save(singleDir);
| UUID owner = fgObject.getOwner();
boolean isOwned = !owner.equals(SERVER_UUID);
Optional<User> userOwner = userStorageService.get(owner);
String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name;
if (fgObject.autoSave()) {
Path singleDir = serverDir.resolve(name.toLowerCase());
logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
|
8,635 | if (fgObject.autoSave()) {
Path singleDir = dir.resolve(name.toLowerCase());
</BUG>
boolean shouldSave = fgObject.shouldSave();
if (force || shouldSave) {
<BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir);
</BUG>
constructDirectory(singleDir);
try {
fgObject.save(singleDir);
| Path singleDir = serverDir.resolve(name.toLowerCase());
logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
|
8,636 | public synchronized void loadRegionLinks() {
logger.info("Loading region links");
try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) {
Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen();
linksMap.entrySet().forEach(entry -> {
<BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey());
if (region != null) {
logger.info("Loading links for region \"" + region.getName() + "\"");</BUG>
String handlersString = entry.getValue();
| Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey());
if (regionOpt.isPresent()) {
IRegion region = regionOpt.get();
logger.info("Loading links for region \"" + region.getName() + "\"");
|
8,637 | public synchronized void loadWorldRegionLinks(World world) {
logger.info("Loading world region links for world \"" + world.getName() + "\"");
try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) {
Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen();
linksMap.entrySet().forEach(entry -> {
<BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey());
if (region != null) {
logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG>
String handlersString = entry.getValue();
| Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey());
if (regionOpt.isPresent()) {
IWorldRegion region = regionOpt.get();
logger.info("Loading links for world region \"" + region.getName() + "\"");
|
8,638 | StringBuilder builder = new StringBuilder();
for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) {
builder.append(it.next().getName());
if (it.hasNext()) builder.append(",");
}
<BUG>return builder.toString();
}</BUG>
private final class LoadEntry {
public final String name;
public final Type type;
| public enum Type {
REGION, WREGION, HANDLER
|
8,639 | .autoCloseQuotes(true)
.leaveFinalAsIs(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
<BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream()
</BUG>
.filter(new StartsWithPredicate(parse.current.token))
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index == 1) {
| return Stream.of("region", "worldregion", "handler", "controller")
|
8,640 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
8,641 | }
@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);
|
8,642 | 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);
|
8,643 | 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(
|
8,644 | 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 {
|
8,645 | 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;
|
8,646 | 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) {
|
8,647 | 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;
|
8,648 | private Path storePath;
private static final String EXTENSION_PROPERTY_JSON_SUFFIX = "-properties.json";
private static final String SHORT_DESCRIPTION = "shortDescription";
private static final String RESOURCES_DIR = "resources";
private static final String LIBS_DIR = "libs";
<BUG>public static final String EXTENSION_STORE_URI = "extension.store.uri";
private static final ExtensionStore STORE = new ExtensionStore();</BUG>
public static ExtensionStore get() {
return STORE;
}
| private static final ExtensionStore STORE = new ExtensionStore();
|
8,649 | return fileSystem;
} catch (Exception e) {
throw new RuntimeException("Unable to bring up extension store for path: " + storePath, e);
}
}
<BUG>public Map<String, String> getExtensionArtifacts(final String extensionName) throws
</BUG>
FalconException {
Map<String, String> extensionFileMap = new HashMap<>();
Path extensionPath;
| private Map<String, String> getExtensionArtifacts(final String extensionName) throws
|
8,650 | return writer.toString();
} catch (IOException e) {
throw new StoreAccessException(e);
}
}
<BUG>public List<String> getTrustedExtensions() throws StoreAccessException {
</BUG>
List<String> extensionList = new ArrayList<>();
try {
FileStatus[] fileStatuses = fs.listStatus(storePath);
| private List<String> getTrustedExtensions() throws StoreAccessException {
|
8,651 | private FileSystem getHdfsFileSystem(String path) throws FalconException {
Configuration conf = new Configuration();
URI uri;
try {
uri = new URI(path);
<BUG>} catch (URISyntaxException e){
</BUG>
LOG.error("Exception : ", e);
throw new FalconException(e);
}
| } catch (URISyntaxException e) {
|
8,652 | public boolean isExtensionStoreInitialized() {
return (storePath != null);
}
public String updateExtensionStatus(final String extensionName, String currentUser, ExtensionStatus status) throws
FalconException {
<BUG>validateStatusChange(extensionName, currentUser);
if (metaStore.getDetail(extensionName).getStatus().equals(status)) {
</BUG>
throw new ValidationException(extensionName + " is already in " + status.toString() + " state.");
} else {
| ExtensionBean extensionBean = metaStore.getDetail(extensionName);
if (extensionBean == null) {
LOG.error("Extension not found: " + extensionName);
throw new FalconException("Extension not found:" + extensionName);
if (extensionBean.getStatus().equals(status)) {
|
8,653 | InstancesResult status = wfEngine.getStatus(entity, nominalTime,
new Date(nominalTime.getTime() + 200), PROCESS_LIFE_CYCLE, false);
if (status.getInstances().length > 0
&& status.getInstances()[0].status == InstancesResult.
WorkflowStatus.SUCCEEDED) {
<BUG>LOG.debug("Instance of nominaltime {} of entity {} has succeeded, removing "
</BUG>
+ "from backlog entries", nominalTimeStr, entity.getName());
backlogMetricStore.deleteMetricInstance(entity.getName(),
metricInfo.getCluster(), nominalTime, entity.getEntityType());
| LOG.debug("Instance of nominal time {} of entity {} has succeeded, removing "
|
8,654 | public APIResult getExtensionDescription(
@PathParam("extension-name") String extensionName) {
checkIfExtensionServiceIsEnabled();
validateExtensionName(extensionName);
try {
<BUG>return new APIResult(APIResult.Status.SUCCEEDED, ExtensionStore.get().getResource(extensionName, README));
} catch (Throwable e) {</BUG>
throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR);
}
}
| } catch (FalconException e) {
throw FalconWebException.newAPIException(e, Response.Status.BAD_REQUEST);
} catch (Throwable e) {
|
8,655 | public APIResult getExtensionDefinition(
@PathParam("extension-name") String extensionName) {
checkIfExtensionServiceIsEnabled();
try {
return new APIResult(APIResult.Status.SUCCEEDED, ExtensionStore.get().getResource(extensionName,
<BUG>extensionName.toLowerCase() + EXTENSION_PROPERTY_JSON_SUFFIX));
} catch (Throwable e) {</BUG>
throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR);
}
}
| } catch (FalconException e) {
throw FalconWebException.newAPIException(e, Response.Status.BAD_REQUEST);
} catch (Throwable e) {
|
8,656 | public List<ExtensionBean> getAllExtensions() {
EntityManager entityManager = getEntityManager();
beginTransaction(entityManager);
Query q = entityManager.createNamedQuery(PersistenceConstants.GET_ALL_EXTENSIONS);
try {
<BUG>return q.getResultList();
} finally {</BUG>
commitAndCloseTransaction(entityManager);
}
}
| return (List<ExtensionBean>)q.getResultList();
} finally {
|
8,657 | final WebManager webman = getWebManager();
final WebApp wapp = webman.getWebApp();
final WebAppCtrl wappc = (WebAppCtrl)wapp;
final HttpServletRequest httpreq = RenderHttpServletRequest.getInstance(request);
final HttpServletResponse httpres = RenderHttpServletResponse.getInstance(response);
<BUG>final ServletContext svlctx = (ServletContext)wapp.getNativeContext();
</BUG>
final DesktopRecycle dtrc = wapp.getConfiguration().getDesktopRecycle();
Desktop desktop = dtrc != null ?
DesktopRecycles.beforeService(dtrc, svlctx, sess, httpreq, httpres, path): null;
| final ServletContext svlctx = wapp.getServletContext();
|
8,658 | public void clear() {
throw new UnsupportedOperationException();
}
};
public void init(WebApp wapp) throws Exception {
<BUG>loadProperites((ServletContext)wapp.getNativeContext());
}</BUG>
static Map getCateMap() {
return _cateMap;
}
| loadProperites(wapp.getServletContext());
|
8,659 | if (webman == null)
throw new UiException("The Web manager not found. Make sure <load-on-startup> is specified for "+DHtmlLayoutServlet.class.getName());
return webman;
}
public static final WebManager getWebManager(WebApp wapp) {
<BUG>return getWebManager((ServletContext)wapp.getNativeContext());
}</BUG>
public static final WebManager getWebManagerIfAny(ServletContext ctx) {
return (WebManager)ctx.getAttribute(ATTR_WEB_MANAGER);
}
| return getWebManager(wapp.getServletContext());
|
8,660 | Page newPage(UiFactory uf, RequestInfo ri, PageDefinition pagedef,
ServletResponse response, String path) {
final DesktopCtrl desktopCtrl = (DesktopCtrl)ri.getDesktop();
final Execution exec = ExecutionsCtrl.getCurrent();
TemporaryExecution de = new TemporaryExecution(
<BUG>(ServletContext)ri.getWebApp().getNativeContext(),
(HttpServletRequest)ri.getNativeRequest(),</BUG>
(HttpServletResponse)response, ri.getDesktop());
desktopCtrl.setExecution(de);
ExecutionsCtrl.setCurrent(de);
| ri.getWebApp().getServletContext(),
(HttpServletRequest)ri.getNativeRequest(),
|
8,661 | Page newPage(UiFactory uf, RequestInfo ri, Richlet richlet,
ServletResponse response, String path) {
final DesktopCtrl desktopCtrl = (DesktopCtrl)ri.getDesktop();
final Execution exec = ExecutionsCtrl.getCurrent();
TemporaryExecution de = new TemporaryExecution(
<BUG>(ServletContext)ri.getWebApp().getNativeContext(),
(HttpServletRequest)ri.getNativeRequest(),</BUG>
(HttpServletResponse)response, ri.getDesktop());
desktopCtrl.setExecution(de);
ExecutionsCtrl.setCurrent(de);
| ri.getWebApp().getServletContext(),
(HttpServletRequest)ri.getNativeRequest(),
|
8,662 | = "org.zkoss.zk.au.http.auProcessors";
private long _lastModified;
private Map<String, AuExtension> _aues = new HashMap<String, AuExtension>(8);
private boolean _compress = true;
public static DHtmlUpdateServlet getUpdateServlet(WebApp wapp) {
<BUG>return (DHtmlUpdateServlet)
((ServletContext)wapp.getNativeContext())
.getAttribute(ATTR_UPDATE_SERVLET);</BUG>
}
public void init() throws ServletException {
| (wapp.getServletContext()).getAttribute(ATTR_UPDATE_SERVLET);
|
8,663 | path = j > 0 ? path.substring(0, j + 1): "/";
} else {
final Execution exec = Executions.getCurrent();
if (exec != null) path = exec.getDesktop().getCurrentDirectory();
}
<BUG>final Object ctx = wapp.getNativeContext();
if (ctx instanceof ServletContext)
return new ServletContextLocator((ServletContext)ctx, path);
throw new UnsupportedOperationException("Unknown context: "+ctx);</BUG>
}
| return new ServletContextLocator(wapp.getServletContext(), path);
|
8,664 | package org.zkoss.zk.ui;
import java.util.Map;
import java.util.Set;
import java.net.URL;
<BUG>import java.io.InputStream;
import org.zkoss.util.resource.Locator;</BUG>
import org.zkoss.zk.ui.util.Configuration;
import org.zkoss.zk.ui.ext.Scope;
public interface WebApp extends Scope, Locator {
| import javax.servlet.ServletContext;
import org.zkoss.util.resource.Locator;
|
8,665 | }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
<BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh")
.in(() -> task1)</BUG>
.in(() -> task2)
.process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\"")));
}
| return Task.named("exec", "/bin/sh").ofType(Exec.Result.class)
.in(() -> task1)
|
8,666 | return args;
}
static class MyTask {
static final int PLUS = 10;
static Task<String> create(String parameter) {
<BUG>return Task.ofType(String.class).named("MyTask", parameter)
.in(() -> Adder.create(parameter.length(), PLUS))</BUG>
.in(() -> Fib.create(parameter.length()))
.process((sum, fib) -> something(parameter, sum, fib));
}
| return Task.named("MyTask", parameter).ofType(String.class)
.in(() -> Adder.create(parameter.length(), PLUS))
|
8,667 | final String instanceField = "from instance";
final TaskContext context = TaskContext.inmem();
final AwaitingConsumer<String> val = new AwaitingConsumer<>();
@Test
public void shouldJavaUtilSerialize() throws Exception {
<BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39)
.process(() -> 9999L);
Task<String> task2 = Task.ofType(String.class).named("Baz", 40)
.in(() -> task1)</BUG>
.ins(() -> singletonList(task1))
| Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class)
Task<String> task2 = Task.named("Baz", 40).ofType(String.class)
.in(() -> task1)
|
8,668 | assertEquals(des.id().name(), "Baz");
assertEquals(val.awaitAndGet(), "[9999] hello 10004");
}
@Test(expected = NotSerializableException.class)
public void shouldNotSerializeWithInstanceFieldReference() throws Exception {
<BUG>Task<String> task = Task.ofType(String.class).named("WithRef")
.process(() -> instanceField + " causes an outer reference");</BUG>
serialize(task);
}
@Test
| Task<String> task = Task.named("WithRef").ofType(String.class)
.process(() -> instanceField + " causes an outer reference");
|
8,669 | serialize(task);
}
@Test
public void shouldSerializeWithLocalReference() throws Exception {
String local = instanceField;
<BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef")
.process(() -> local + " won't cause an outer reference");</BUG>
serialize(task);
Task<String> des = deserialize();
context.evaluate(des).consume(val);
| Task<String> task = Task.named("WithLocalRef").ofType(String.class)
.process(() -> local + " won't cause an outer reference");
|
8,670 | }
@RootTask
public static Task<String> standardArgs(int first, String second) {
firstInt = first;
secondString = second;
<BUG>return Task.ofType(String.class).named("StandardArgs", first, second)
.process(() -> second + " " + first * 100);</BUG>
}
@Test
public void shouldParseFlags() throws Exception {
| return Task.named("StandardArgs", first, second).ofType(String.class)
.process(() -> second + " " + first * 100);
|
8,671 | assertThat(parsedEnum, is(CustomEnum.BAR));
}
@RootTask
public static Task<String> enums(CustomEnum enm) {
parsedEnum = enm;
<BUG>return Task.ofType(String.class).named("Enums", enm)
.process(enm::toString);</BUG>
}
@Test
public void shouldParseCustomTypes() throws Exception {
| return Task.named("Enums", enm).ofType(String.class)
.process(enm::toString);
|
8,672 | assertThat(parsedType.content, is("blarg parsed for you!"));
}
@RootTask
public static Task<String> customType(CustomType myType) {
parsedType = myType;
<BUG>return Task.ofType(String.class).named("Types", myType.content)
.process(() -> myType.content);</BUG>
}
public enum CustomEnum {
BAR
| return Task.named("Types", myType.content).ofType(String.class)
.process(() -> myType.content);
|
8,673 | TaskContext taskContext = TaskContext.inmem();
TaskContext.Value<Long> value = taskContext.evaluate(fib92);
value.consume(f92 -> System.out.println("fib(92) = " + f92));
}
static Task<Long> create(long n) {
<BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n);
</BUG>
if (n < 2) {
return fib
.process(() -> n);
| TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
|
8,674 | Iterable<jetbrains.mps.openapi.editor.cells.EditorCell> cells) {
if (editorComponent.isReadOnly()) {
return true;
}
for (jetbrains.mps.openapi.editor.cells.EditorCell cell : cells) {
<BUG>if (isCellOrSelectionReadOnlyInEditor(editorComponent, cell)) {
return true;</BUG>
}
}
return false;
| if (cell == null || isCellReadOnly(cell)) {
|
8,675 | package org.gedcomx.conversion.gedcom.dq55;
import org.folg.gedcom.model.Change;
import org.folg.gedcom.model.DateTime;
import org.folg.gedcom.model.SourceCitation;
<BUG>import org.folg.gedcom.model.SpouseRef;
import org.gedcomx.common.Note;</BUG>
import org.gedcomx.common.ResourceReference;
import org.gedcomx.common.URI;
import org.gedcomx.conclusion.*;
| import org.gedcomx.common.Attribution;
import org.gedcomx.common.Note;
|
8,676 | import org.gedcomx.conversion.GedcomxConversionResult;
import org.gedcomx.metadata.dc.DublinCoreDescriptionDecorator;
import org.gedcomx.metadata.dc.ObjectFactory;
import org.gedcomx.metadata.rdf.Description;
import org.gedcomx.metadata.rdf.RDFLiteral;
<BUG>import org.gedcomx.metadata.rdf.RDFValue;
import org.gedcomx.types.FactType;
import org.gedcomx.types.RelationshipType;
import java.text.DateFormat;</BUG>
import java.text.ParseException;
| import org.gedcomx.types.ConfidenceLevel;
import org.gedcomx.types.TypeReference;
import java.io.IOException;
import java.text.DateFormat;
|
8,677 | import org.codehaus.groovy.control.CompilationUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class GroovyTreeParser implements TreeParser {
private static final Logger logger = LoggerFactory.getLogger(GroovyTreeParser.class);
<BUG>private static final String GROOVY_DEFAULT_INTERFACE = "groovy.lang.GroovyObject";
private static final String JAVA_DEFAULT_OBJECT = "java.lang.Object";
private Map<URI, Set<SymbolInformation>> fileSymbols = Maps.newHashMap();
private Map<String, Set<SymbolInformation>> typeReferences = Maps.newHashMap();</BUG>
private final Supplier<CompilationUnit> unitSupplier;
| private Indexer indexer = new Indexer();
|
8,678 | if (scriptClass != null) {
sourceUnit.getAST().getStatementBlock().getVariableScope().getDeclaredVariables().values().forEach(
variable -> {
SymbolInformation symbol =
getVariableSymbolInformation(scriptClass.getName(), sourceUri, variable);
<BUG>addToValueSet(newTypeReferences, variable.getType().getName(), symbol);
symbols.add(symbol);
});
}
newFileSymbols.put(workspaceUriSupplier.get(sourceUri), symbols);</BUG>
});
| newIndexer.addSymbol(sourceUnit.getSource().getURI(), symbol);
if (classes.containsKey(variable.getType().getName())) {
newIndexer.addReference(classes.get(variable.getType().getName()),
GroovyLocations.createLocation(sourceUri, variable.getType()));
|
8,679 | }
if (typeReferences.containsKey(foundSymbol.getName())) {
foundReferences.addAll(typeReferences.get(foundSymbol.getName()));</BUG>
}
<BUG>return foundReferences;
}</BUG>
@Override
public Set<SymbolInformation> getFilteredSymbols(String query) {
checkNotNull(query, "query must not be null");
Pattern pattern = getQueryPattern(query);
| });
sourceUnit.getAST().getStatementBlock()
.visit(new MethodVisitor(newIndexer, sourceUri, sourceUnit.getAST().getScriptClassDummy(),
classes, Maps.newHashMap(), Optional.absent(), workspaceUriSupplier));
|
8,680 | <BUG>package com.palantir.ls.server.api;
import io.typefox.lsapi.ReferenceParams;</BUG>
import io.typefox.lsapi.SymbolInformation;
import java.net.URI;
import java.util.Map;
| import com.google.common.base.Optional;
import io.typefox.lsapi.Location;
import io.typefox.lsapi.Position;
import io.typefox.lsapi.ReferenceParams;
|
8,681 | import java.util.Map;
import java.util.Set;
public interface TreeParser {
void parseAllSymbols();
Map<URI, Set<SymbolInformation>> getFileSymbols();
<BUG>Map<String, Set<SymbolInformation>> getTypeReferences();
Set<SymbolInformation> findReferences(ReferenceParams params);
Set<SymbolInformation> getFilteredSymbols(String query);</BUG>
}
| Map<Location, Set<Location>> getReferences();
Set<Location> findReferences(ReferenceParams params);
Optional<Location> gotoDefinition(URI uri, Position position);
Set<SymbolInformation> getFilteredSymbols(String query);
|
8,682 | .workspaceSymbolProvider(true)
.referencesProvider(true)
.completionProvider(new CompletionOptionsBuilder()
.resolveProvider(false)
.triggerCharacter(".")
<BUG>.build())
.build();</BUG>
InitializeResult result = new InitializeResultBuilder()
.capabilities(capabilities)
.build();
| .definitionProvider(true)
|
8,683 | package com.palantir.ls.server;
import com.palantir.ls.server.api.CompilerWrapper;
import com.palantir.ls.server.api.TreeParser;
import com.palantir.ls.server.api.WorkspaceCompiler;
<BUG>import io.typefox.lsapi.FileEvent;
import io.typefox.lsapi.PublishDiagnosticsParams;</BUG>
import io.typefox.lsapi.ReferenceParams;
import io.typefox.lsapi.SymbolInformation;
import io.typefox.lsapi.TextDocumentContentChangeEvent;
| import com.google.common.base.Optional;
import io.typefox.lsapi.Location;
import io.typefox.lsapi.Position;
import io.typefox.lsapi.PublishDiagnosticsParams;
|
8,684 | return localMapStats;
}
final int backupCount = mapContainer.getTotalBackupCount();
final ClusterService clusterService = nodeEngine.getClusterService();
final InternalPartitionService partitionService = nodeEngine.getPartitionService();
<BUG>final Address thisAddress = clusterService.getThisAddress();
for (int partitionId = 0; partitionId < partitionService.getPartitionCount(); partitionId++) {</BUG>
InternalPartition partition = partitionService.getPartition(partitionId);
Address owner = partition.getOwnerOrNull();
if (owner == null) {
| localMapStats.init();
for (int partitionId = 0; partitionId < partitionService.getPartitionCount(); partitionId++) {
|
8,685 | long lastAccessTime = 0;
long lastUpdateTime = 0;
long ownedEntryMemoryCost = 0;
long hits = 0;
final Map<Data, Record> records = recordStore.getReadonlyRecordMap();
<BUG>localMapStats.incrementHeapCost(recordStore.getHeapCost());
localMapStats.incrementOwnedEntryCount(records.size());</BUG>
for (Record record : records.values()) {
RecordStatistics stats = record.getStatistics();
ownedEntryMemoryCost += record.getCost();
| [DELETED] |
8,686 | localMapStats.incrementOwnedEntryMemoryCost(ownedEntryMemoryCost);
localMapStats.incrementLockedEntryCount(lockedEntryCount);
localMapStats.incrementHits(hits);
localMapStats.incrementDirtyEntryCount(recordStore.getMapDataStore().notFinishedOperationsCount());
localMapStats.setLastAccessTime(lastAccessTime);
<BUG>localMapStats.setLastUpdateTime(lastUpdateTime);
}</BUG>
private void addReplicaPartitionStats(LocalMapStatsImpl localMapStats, String mapName, int partitionId,
InternalPartition partition, ClusterService clusterService,
int backupCount, Address thisAddress) {
| localMapStats.incrementHeapCost(recordStore.getHeapCost());
localMapStats.incrementOwnedEntryCount(records.size());
}
|
8,687 | import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;
import com.hazelcast.util.Clock;
import java.io.IOException;
<BUG>import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;</BUG>
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import static com.hazelcast.util.JsonUtil.getInt;
import static com.hazelcast.util.JsonUtil.getLong;
| [DELETED] |
8,688 | out.writeLong(totalPutLatencies);
out.writeLong(totalRemoveLatencies);
out.writeLong(maxGetLatency);
out.writeLong(maxPutLatency);
out.writeLong(maxRemoveLatency);
<BUG>out.writeLong(heapCost.get());
boolean hasNearCache = nearCacheStats != null;</BUG>
out.writeBoolean(hasNearCache);
if (hasNearCache) {
nearCacheStats.writeData(out);
| out.writeLong(heapCost);
boolean hasNearCache = nearCacheStats != null;
|
8,689 | TOTAL_PUT_LATENCIES_UPDATER.set(this, in.readLong());
TOTAL_REMOVE_LATENCIES_UPDATER.set(this, in.readLong());
MAX_GET_LATENCY_UPDATER.set(this, in.readLong());
MAX_PUT_LATENCY_UPDATER.set(this, in.readLong());
MAX_REMOVE_LATENCY_UPDATER.set(this, in.readLong());
<BUG>heapCost.set(in.readLong());
</BUG>
boolean hasNearCache = in.readBoolean();
if (hasNearCache) {
nearCacheStats = new NearCacheStatsImpl();
| heapCost = in.readLong();
|
8,690 | root.add("totalPutLatencies", totalPutLatencies);
root.add("totalRemoveLatencies", totalRemoveLatencies);
root.add("maxGetLatency", maxGetLatency);
root.add("maxPutLatency", maxPutLatency);
root.add("maxRemoveLatency", maxRemoveLatency);
<BUG>root.add("heapCost", heapCost.get());
if (nearCacheStats != null) {</BUG>
root.add("nearCacheStats", nearCacheStats.toJson());
}
return root;
| root.add("heapCost", heapCost);
if (nearCacheStats != null) {
|
8,691 | TOTAL_PUT_LATENCIES_UPDATER.set(this, getLong(json, "totalPutLatencies", -1L));
TOTAL_REMOVE_LATENCIES_UPDATER.set(this, getLong(json, "totalRemoveLatencies", -1L));
MAX_GET_LATENCY_UPDATER.set(this, getLong(json, "maxGetLatency", -1L));
MAX_PUT_LATENCY_UPDATER.set(this, getLong(json, "maxPutLatency", -1L));
MAX_REMOVE_LATENCY_UPDATER.set(this, getLong(json, "maxRemoveLatency", -1L));
<BUG>heapCost.set(getLong(json, "heapCost", -1L));
</BUG>
final JsonValue jsonNearCacheStats = json.get("nearCacheStats");
if (jsonNearCacheStats != null) {
nearCacheStats = new NearCacheStatsImpl();
| heapCost = getLong(json, "heapCost", -1L);
|
8,692 | package io.apptik.rxhub;
import com.jakewharton.rxrelay.BehaviorRelay;
import com.jakewharton.rxrelay.PublishRelay;
import com.jakewharton.rxrelay.Relay;
import com.jakewharton.rxrelay.ReplayRelay;
<BUG>import com.jakewharton.rxrelay.SerializedRelay;
import java.util.Locale;</BUG>
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import rx.Observable;
| import java.util.Iterator;
import java.util.Locale;
|
8,693 | Observable getObservable(Object tag);
<T> Observable<T> getObservable(Object tag, Class<T> filterClass);
void emit(Object tag, Object event);
RxJava1ProxyType getProxyType(Object tag);
boolean isProxyThreadsafe(Object tag);
<BUG>boolean canTriggerEmit(Object tag);
class Source {</BUG>
final Observable observable;
final Object tag;
Source(Observable observable, Object tag) {
| void resetObsProxy(Object tag);
class Source {
|
8,694 | public ReportElement getBase() {
return base;
}
@Override
public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException {
<BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo);
PDPageContentStream pageStream = new PDPageContentStream(document, currPage, true, false);
</BUG>
base.print(document, pageStream, pageNo, x, y, width);
pageStream.close();
| PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo);
PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
|
8,695 | public PdfTextStyle(String config) {
Assert.hasText(config);
String[] split = config.split(",");
Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000");
fontSize = Integer.parseInt(split[0]);
<BUG>font = resolveStandard14Name(split[1]);
color = new Color(Integer.valueOf(split[2].substring(1), 16));</BUG>
}
public int getFontSize() {
return fontSize;
| font = getFont(split[1]);
color = new Color(Integer.valueOf(split[2].substring(1), 16));
|
8,696 | package cc.catalysts.boot.report.pdf.elements;
import cc.catalysts.boot.report.pdf.config.PdfTextStyle;
import cc.catalysts.boot.report.pdf.utils.ReportAlignType;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
<BUG>import org.apache.pdfbox.pdmodel.font.PDFont;
import org.slf4j.Logger;</BUG>
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.io.IOException;
| import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.apache.pdfbox.util.Matrix;
import org.slf4j.Logger;
|
8,697 | addTextSimple(stream, textConfig, textX, nextLineY, "");
return nextLineY;
}
try {
<BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText);
</BUG>
float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]);
if (!underline) {
addTextSimple(stream, textConfig, x, nextLineY, split[0]);
} else {
| String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
|
8,698 | public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
try {
stream.setFont(textConfig.getFont(), textConfig.getFontSize());
stream.setNonStrokingColor(textConfig.getColor());
stream.beginText();
<BUG>stream.newLineAtOffset(textX, textY);
stream.showText(text);</BUG>
} catch (Exception e) {
LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage());
}
| stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY));
stream.showText(text);
|
8,699 | public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) {
addTextSimple(stream, textConfig, textX, textY, text);
try {
float lineOffset = textConfig.getFontSize() / 8F;
stream.setStrokingColor(textConfig.getColor());
<BUG>stream.setLineWidth(0.5F);
stream.drawLine(textX, textY - lineOffset, textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
</BUG>
stream.stroke();
} catch (IOException e) {
| stream.moveTo(textX, textY - lineOffset);
stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
|
8,700 | list.add(text.length());
return list;
}
public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) {
String endPart = "";
<BUG>String shortenedText = text;
List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
if (breakSplitted.size() > 1) {</BUG>
String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0));
StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
| List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
if (breakSplitted.size() > 1) {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.