id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
11,301 | .baseDir(baseDir)
.glowrootDir(glowrootDir)
.ticker(ticker)
.clock(clock)
.liveJvmService(agentModule.getLiveJvmService())
<BUG>.configRepository(simpleRepoModule.getConfigRepository())
.agentRepository(simpleRepoModule.getAgentDao())
</BUG>
.transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository())
.traceAttributeNameRepository(
| .agentRepository(new AgentRepositoryImpl())
.environmentRepository(simpleRepoModule.getEnvironmentDao())
|
11,302 | .baseDir(baseDir)
.glowrootDir(glowrootDir)
.ticker(ticker)
.clock(clock)
.liveJvmService(null)
<BUG>.configRepository(simpleRepoModule.getConfigRepository())
.agentRepository(simpleRepoModule.getAgentDao())
</BUG>
.transactionTypeRepository(simpleRepoModule.getTransactionTypeRepository())
.traceAttributeNameRepository(
| .liveJvmService(agentModule.getLiveJvmService())
.agentRepository(new AgentRepositoryImpl())
.environmentRepository(simpleRepoModule.getEnvironmentDao())
|
11,303 | }
@Override
public void lazyRegisterMBean(Object object, String name) {
lazyPlatformMBeanServer.lazyRegisterMBean(object, name);
}
<BUG>}
}
</BUG>
| void initEmbeddedServer() throws Exception {
if (simpleRepoModule == null) {
return;
|
11,304 | List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs());
for (GaugeConfig loopConfig : configs) {
if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) {
throw new DuplicateMBeanObjectNameException();
}
<BUG>}
String version = Versions.getVersion(gaugeConfig);
for (GaugeConfig loopConfig : configs) {
if (Versions.getVersion(loopConfig.toProto()).equals(version)) {
throw new IllegalStateException("This exact gauge already exists");
}
}
configs.add(GaugeConfig.create(gaugeConfig));</BUG>
configService.updateGaugeConfigs(configs);
| [DELETED] |
11,305 | configService.updateGaugeConfigs(configs);
}
}
@Override
public void updateGaugeConfig(String agentId, AgentConfig.GaugeConfig gaugeConfig,
<BUG>String priorVersion) throws Exception {
synchronized (writeLock) {</BUG>
List<GaugeConfig> configs = Lists.newArrayList(configService.getGaugeConfigs());
boolean found = false;
for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
| GaugeConfig config = GaugeConfig.create(gaugeConfig);
synchronized (writeLock) {
|
11,306 | boolean found = false;
for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
GaugeConfig loopConfig = i.next();
String loopVersion = Versions.getVersion(loopConfig.toProto());
if (loopVersion.equals(priorVersion)) {
<BUG>i.set(GaugeConfig.create(gaugeConfig));
found = true;
break;</BUG>
} else if (loopConfig.mbeanObjectName().equals(gaugeConfig.getMbeanObjectName())) {
throw new DuplicateMBeanObjectNameException();
| i.set(config);
|
11,307 | boolean found = false;
for (ListIterator<PluginConfig> i = configs.listIterator(); i.hasNext();) {
PluginConfig loopPluginConfig = i.next();
if (pluginId.equals(loopPluginConfig.id())) {
String loopVersion = Versions.getVersion(loopPluginConfig.toProto());
<BUG>checkVersionsEqual(loopVersion, priorVersion);
PluginDescriptor pluginDescriptor = getPluginDescriptor(pluginId);
i.set(PluginConfig.create(pluginDescriptor, properties));</BUG>
found = true;
break;
| for (ListIterator<GaugeConfig> i = configs.listIterator(); i.hasNext();) {
GaugeConfig loopConfig = i.next();
String loopVersion = Versions.getVersion(loopConfig.toProto());
if (loopVersion.equals(version)) {
i.remove();
|
11,308 | boolean found = false;
for (ListIterator<InstrumentationConfig> i = configs.listIterator(); i.hasNext();) {
InstrumentationConfig loopConfig = i.next();
String loopVersion = Versions.getVersion(loopConfig.toProto());
if (loopVersion.equals(priorVersion)) {
<BUG>i.set(InstrumentationConfig.create(instrumentationConfig));
found = true;
break;
}</BUG>
}
| i.set(config);
} else if (loopConfig.equals(config)) {
throw new IllegalStateException("This exact instrumentation already exists");
|
11,309 | package org.glowroot.agent.embedded.init;
import java.io.File;
import java.util.List;
import org.glowroot.agent.collector.Collector;
<BUG>import org.glowroot.agent.embedded.repo.AgentDao;
import org.glowroot.agent.embedded.repo.AggregateDao;
import org.glowroot.agent.embedded.repo.GaugeValueDao;</BUG>
import org.glowroot.agent.embedded.repo.TraceDao;
import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
| import org.glowroot.agent.embedded.repo.EnvironmentDao;
import org.glowroot.agent.embedded.repo.GaugeValueDao;
|
11,310 | </BUG>
private final AggregateDao aggregateDao;
private final TraceDao traceDao;
private final GaugeValueDao gaugeValueDao;
<BUG>CollectorImpl(AgentDao agentDao, AggregateDao aggregateRepository, TraceDao traceRepository,
GaugeValueDao gaugeValueRepository) {
this.agentDao = agentDao;</BUG>
this.aggregateDao = aggregateRepository;
this.traceDao = traceRepository;
| import org.glowroot.wire.api.model.CollectorServiceOuterClass.Environment;
import org.glowroot.wire.api.model.CollectorServiceOuterClass.GaugeValue;
import org.glowroot.wire.api.model.CollectorServiceOuterClass.LogEvent;
import org.glowroot.wire.api.model.TraceOuterClass.Trace;
class CollectorImpl implements Collector {
private final EnvironmentDao agentDao;
CollectorImpl(EnvironmentDao agentDao, AggregateDao aggregateRepository,
TraceDao traceRepository, GaugeValueDao gaugeValueRepository) {
this.agentDao = agentDao;
|
11,311 | 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.*;
|
11,312 | .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);
|
11,313 | </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) {
|
11,314 | 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)
|
11,315 | .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))
|
11,316 | .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))
|
11,317 | @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;
|
11,318 | 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;
}
|
11,319 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
11,320 | 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.*;
|
11,321 | .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))
|
11,322 | 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) -> {
|
11,323 | 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);
|
11,324 | 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);
|
11,325 | 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() + "\"");
|
11,326 | 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() + "\"");
|
11,327 | 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
|
11,328 | .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")
|
11,329 | import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EcoreFactory;
<BUG>import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.index.ecore.impl.EcoreIndexFeederImpl;</BUG>
import org.eclipse.emf.index.impl.PersistableIndexStore;
import org.eclipse.emf.index.resource.impl.IndexFeederImpl;
import org.eclipse.xtext.index.indexTestLanguage.Datatype;
| import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.index.ecore.impl.EcoreIndexFeederImpl;
|
11,330 | scope = scope.getOuterScope(); // baz {
</BUG>
names = toListOfNames(scope.getContents());
assertEquals(names.toString(), 1, names.size());
assertTrue(names.contains("Person"));
<BUG>scope = scope.getOuterScope(); // import baz.*
names = toListOfNames(scope.getContents());
assertEquals(names.toString(), 1, names.size());
assertTrue(names.contains("Person"));
scope = scope.getOuterScope(); // stuff {
names = toListOfNames(scope.getContents());
assertEquals(names.toString(), 1, names.size());
assertTrue(names.contains("baz.Person"));</BUG>
scope = scope.getOuterScope(); // global scope
| assertTrue(names.toString(), names.contains("Person"));
assertTrue(names.contains("baz.Person"));
|
11,331 | 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();
|
11,332 | 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()));
|
11,333 | }
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));
|
11,334 | <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;
|
11,335 | 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);
|
11,336 | .workspaceSymbolProvider(true)
.referencesProvider(true)
.completionProvider(new CompletionOptionsBuilder()
.resolveProvider(false)
.triggerCharacter(".")
<BUG>.build())
.build();</BUG>
InitializeResult result = new InitializeResultBuilder()
.capabilities(capabilities)
.build();
| .definitionProvider(true)
|
11,337 | 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;
|
11,338 | import com.android.volley.VolleyError;
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
<BUG>import java.util.List;
import androidrss.MediaEnclosure;</BUG>
import androidrss.RSSConfig;
import androidrss.RSSFeed;
import androidrss.RSSItem;
| import java.util.regex.Matcher;
import java.util.regex.Pattern;
import androidrss.MediaEnclosure;
|
11,339 | private int currentWorkingThreads = 0;
private IDatabaseHandler databaseHandler;
private boolean updateDatabase;
public void start() {
sendMessage(context.getString(R.string.update_news), STATUS_CHANGED);
<BUG>if (updateDatabase){
dropCategory();
}</BUG>
results = new ArrayList<FetchingResult>();
currentWorkingThreads = category.getFeeds().size();
| [DELETED] |
11,340 | results.add(result);
}
if (currentWorkingThreads <= 0){
new AsyncTask<Void, Void, Void>(){
@Override
<BUG>protected Void doInBackground(Void... params) {
parseInformation();</BUG>
return null;
}
}.execute();
| if (updateDatabase){
dropCategory();
parseInformation();
|
11,341 | if (pubDate != null){
time = pubDate.getTime();
}
String desc = item.getDescription();
if (desc != null) {
<BUG>desc = desc.replaceAll("\\<.*?>","").replaceAll("()", "");
</BUG>
}
return new Entry(-1, feedId, category.getId(), item.getTitle(), desc, time, source, url, mediaUri);
}
| desc = desc.replaceAll("\\<.*?>","").replace("()", "").replace(" ", "");
|
11,342 | protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mNavigationDrawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
<BUG>mTitle = getTitle();
mNavigationDrawerFragment.setUp(</BUG>
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
databaseHandler = DatabaseHandler.getInstance();
| getSupportActionBar().setTitle(getString(R.string.simple_news_title));
mNavigationDrawerFragment.setUp(
|
11,343 | bottomView = (RelativeLayout) findViewById(R.id.bottom_view);
createProgressView();
onPageSelected(0);
overridePendingTransition(R.anim.open_translate,R.anim.close_scale);
}
<BUG>@Override
protected void onPause() {</BUG>
super.onPause();
overridePendingTransition(R.anim.open_scale,R.anim.close_translate);
}
| public void onBackPressed() {
finish();
protected void onPause() {
|
11,344 | import colorpicker.ColorUtils;
import colorpicker.OnColorSelectedListener;
import de.dala.simplenews.R;
import de.dala.simplenews.common.Category;
import de.dala.simplenews.database.DatabaseHandler;
<BUG>import de.dala.simplenews.utilities.UIUtils;
public class CategorySelectionFragment extends Fragment implements ContextualUndoAdapter.DeleteItemCallback {</BUG>
public interface OnCategoryClicked {
void onMoreClicked(Category category);
void onRSSSavedClick(Category category, String rssPath);
| import de.keyboardsurfer.android.widget.crouton.Crouton;
import de.keyboardsurfer.android.widget.crouton.Style;
public class CategorySelectionFragment extends Fragment implements ContextualUndoAdapter.DeleteItemCallback {
|
11,345 | private String rssPath;
private static final String CATEGORIES_KEY = "categories";
private static final String FROM_RSS_KEY = "rss";
private static final String RSS_PATH_KEY = "path";
OnCategoryClicked categoryClicked;
<BUG>private TextView topView;
public CategorySelectionFragment(){</BUG>
}
public static CategorySelectionFragment newInstance(ArrayList<Category> categories, boolean fromRSS, String path){
| private TextView topTextView;
private ViewGroup topView;
public CategorySelectionFragment(){
|
11,346 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
this.categoryClicked = UIUtils.getParent(this, OnCategoryClicked.class);
if (categoryClicked == null){
throw new ClassCastException("No Parent with Interface OnCategoryClicked");
}
<BUG>View rootView = inflater.inflate(R.layout.category_selection, container, false);
if (fromRSS){
topView = (TextView) rootView.findViewById(R.id.topTextView);
topView.setText("Select Category to add Feed");
topView.setVisibility(View.VISIBLE);
</BUG>
}
| topView = (ViewGroup) rootView.findViewById(R.id.topView);
topTextView = (TextView) rootView.findViewById(R.id.topTextView);
topTextView.setText(getActivity().getString(R.string.category_add));
topTextView.setVisibility(View.VISIBLE);
|
11,347 | break;
}
}
};
new AlertDialog.Builder(getActivity()).
<BUG>setPositiveButton("Ok", dialogClickListener).setNegativeButton("Cancel", dialogClickListener).setTitle(getActivity().getString(R.string.create_category_1_2))
.setMessage("Name for the Category").setView(input).show();
}</BUG>
private void editClicked(final Category category) {
| case R.id.edit:
editClicked(category);
case R.id.show:
case R.id.more:
categoryClicked.onMoreClicked(category);
private void createCategoryClicked(){
|
11,348 | case DialogInterface.BUTTON_POSITIVE:
String newName = input.getText().toString();
category.setName(newName);
adapter.notifyDataSetChanged();
DatabaseHandler.getInstance().updateCategoryName(category.getId(), newName);
<BUG>Toast.makeText(getActivity(), "New name: " + newName, Toast.LENGTH_SHORT).show();
break;</BUG>
case DialogInterface.BUTTON_NEGATIVE:
break;
}
| String categoryName = input.getText().toString();
selectColor(categoryName);
|
11,349 | newCategory.setColor(color);
long id = DatabaseHandler.getInstance().addCategory(newCategory, true, true);
newCategory.setId(id);
adapter.add(newCategory);
adapter.notifyDataSetChanged();
<BUG>Toast.makeText(getActivity(), "Category created", Toast.LENGTH_SHORT).show();
}</BUG>
});
colorCalendar.show(getChildFragmentManager(), "dash");
}
| Crouton.makeText(getActivity(), R.string.category_created, Style.CONFIRM, topView).show();
|
11,350 | private static String LOG_PREFIX = "prefix";
private static int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
private static final int MAX_LOG_TAG_LENGTH = 23;
private enum LogType {TOAST, LOG, BOTH};
private Toast currentToast;
<BUG>private LogType type = LogType.BOTH;
</BUG>
private boolean shouldInterrupt = true;
private int toastLength = Toast.LENGTH_LONG;
private Toasty(Context context){
| private LogType type = LogType.LOG;
|
11,351 | DatabaseHandler.getInstance().removeFeeds(null, feed.getId(), false);
category.getFeeds().remove(feed);
}
private class MyFormatCountDownCallback implements ContextualUndoAdapter.CountDownFormatter {
@Override
<BUG>public String getCountDownString(long millisUntilFinished) {
int seconds = (int) Math.ceil((millisUntilFinished / 1000.0));</BUG>
if (seconds > 0) {
return getResources().getQuantityString(R.plurals.countdown_seconds, seconds, seconds);
}
| if (getActivity() == null)
return "";
int seconds = (int) Math.ceil((millisUntilFinished / 1000.0));
|
11,352 | import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
<BUG>import android.widget.RelativeLayout;
import java.util.ArrayList;</BUG>
import de.dala.simplenews.R;
import de.dala.simplenews.common.Category;
import de.dala.simplenews.common.Feed;
| import com.actionbarsherlock.app.SherlockFragmentActivity;
import java.util.ArrayList;
|
11,353 | private boolean fromRSS = false;
private int currentFragment = CATEGORY_SELECTION;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
<BUG>setContentView(R.layout.category_modifier);
categories = new ArrayList<Category>(DatabaseHandler.getInstance().getCategories(false, true));</BUG>
Fragment fragment = null;
if(this.getIntent().getDataString()!=null)
{
| getSupportActionBar().setTitle(getString(R.string.categories_title));
categories = new ArrayList<Category>(DatabaseHandler.getInstance().getCategories(false, true));
|
11,354 | @Documented
@Graph( value = { "I know you" } )
public void testGremlinPostURLEncoded() throws UnsupportedEncodingException
{
String script = "i = g.v("+data.get().get( "I" ).getId() +");i.out";
<BUG>String response = gen.get()
.expectedStatus( Status.OK.getStatusCode() )
.description( formatGroovy( script ) )
.payload( "script=" + URLEncoder.encode( script, "UTF-8") )
</BUG>
.payloadType( MediaType.APPLICATION_FORM_URLENCODED_TYPE )
| gen()
.description( formatGroovy( script ) );
String response = gen().payload( "script=" + URLEncoder.encode( script, "UTF-8") )
|
11,355 | public void testGremlinPostWithVariablesAsJson() throws UnsupportedEncodingException
{
final String script = "g.v(me).out";
final String params = "{ \"me\" : "+data.get().get("I").getId()+" }";
final String payload = String.format("{ \"script\" : \"%s\", \"params\" : %s }", script, params);
<BUG>String response = gen.get()
.description( formatGroovy( script ) )
.expectedStatus( Status.OK.getStatusCode() )</BUG>
.payload( JSONPrettifier.parse( payload ) )
| gen().description( formatGroovy( script ) );
String response = gen()
.expectedStatus( Status.OK.getStatusCode() )
|
11,356 | {
String script = "g.loadGraphML('https://raw.github.com/neo4j/gremlin-plugin/master/src/data/graphml1.xml');" +
"g.V;";
String payload = "{\"script\":\"" +
script +"\"}";
<BUG>String response = gen.get()
.description( formatGroovy( script ) )
.expectedStatus( Status.OK.getStatusCode() )</BUG>
.payload( JSONPrettifier.parse( payload ) )
| final String script = "g.v(me).out";
final String params = "{ \"me\" : "+data.get().get("I").getId()+" }";
final String payload = String.format("{ \"script\" : \"%s\", \"params\" : %s }", script, params);
gen().description( formatGroovy( script ) );
String response = gen()
.expectedStatus( Status.OK.getStatusCode() )
|
11,357 | "out = new java.io.ByteArrayOutputStream();" +
"writer.outputGraph(out);" +
"result = out.toString();";
String payload = "{\"script\":\"" +
script +"\"}";
<BUG>String response = gen.get()
.description( formatGroovy( script ) )
.expectedStatus( Status.OK.getStatusCode() )</BUG>
.payload( JSONPrettifier.parse( payload ) )
| description( formatGroovy( script ) );
.expectedStatus( Status.OK.getStatusCode() )
|
11,358 | @Title("Set script variables")
public void setVariables() throws UnsupportedEncodingException
{
String payload = "{\"script\":\"meaning_of_life\","
+ "\"params\":{\"meaning_of_life\" : 42.0}}";
<BUG>String response = gen.get()
.expectedStatus( Status.OK.getStatusCode() )</BUG>
.payload( JSONPrettifier.parse( payload ) )
.payloadType( MediaType.APPLICATION_JSON_TYPE )
.post( ENDPOINT )
| String response = gen()
.expectedStatus( Status.OK.getStatusCode() )
|
11,359 | {
String script = "g.v(" + data.get()
.get( "I" )
.getId() + ").out.sort{it.name}.toList()";
String payload = "{\"script\":\""+script +"\"}";
<BUG>String response = gen.get()
.description( formatGroovy( script ) )
.expectedStatus( Status.OK.getStatusCode() )</BUG>
.payload( JSONPrettifier.parse( payload ) )
| String payload = "{\"script\":\"meaning_of_life\","
+ "\"params\":{\"meaning_of_life\" : 42.0}}";
String response = gen()
.expectedStatus( Status.OK.getStatusCode() )
|
11,360 | + "i.as('I').out('know').as('friend').out('like').as('likes').table(t,['friend','likes']){it.name}{it.name} >> -1;t;";
String payload = "{\"script\":\""+script +"\"}";
String response = gen.get()
.expectedStatus( Status.OK.getStatusCode() )
.payload( JSONPrettifier.parse( payload ) )
<BUG>.payloadType( MediaType.APPLICATION_JSON_TYPE )
.description( formatGroovy( script ) )
.post( ENDPOINT )
.entity();</BUG>
assertTrue(response.contains( "cats" ));
| .entity();
description( formatGroovy( script ) );
|
11,361 | "results = personIndex.query( query );";
String payload = "{\"script\":\""+script+"\"}";
String response = gen.get()
.expectedStatus( Status.OK.getStatusCode() )
.payload( JSONPrettifier.parse( payload ) )
<BUG>.payloadType( MediaType.APPLICATION_JSON_TYPE )
.description( formatGroovy(script) )
.post( ENDPOINT )
.entity();</BUG>
assertTrue(response.contains( "me" ));
| .entity();
description( formatGroovy(script) );
|
11,362 | " </lucene>" +
" </index>" +
"</collection>";
@Test
public void store() {
<BUG>ExecutorService executor = Executors.newFixedThreadPool(10);
</BUG>
for (int i = 0; i < 10; i++) {
final String name = "thread" + i;
final Runnable run = () -> {
| final ExecutorService executor = Executors.newFixedThreadPool(10);
|
11,363 | }
executor.shutdown();
boolean terminated = false;
try {
terminated = executor.awaitTermination(60 * 60, TimeUnit.SECONDS);
<BUG>} catch (InterruptedException e) {
</BUG>
}
assertTrue(terminated);
}
| };
executor.submit(run);
} catch (final InterruptedException e) {
|
11,364 | for (int i = 0; i < 5; i++) {
final String name = "thread" + i;
Runnable run = () -> {
try {
xupdateDocs(name);
<BUG>} catch (XMLDBException | IOException e) {
</BUG>
e.printStackTrace();
fail(e.getMessage());
}
| } catch (final XMLDBException | IOException e) {
|
11,365 | import org.exist.storage.txn.Txn;
import org.exist.util.Configuration;
import org.exist.util.DatabaseConfigurationException;
import org.exist.util.FileUtils;
import org.exist.xmldb.XmldbURI;
<BUG>import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;</BUG>
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
| import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
|
11,366 | import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocalFileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.util.Progressable;
<BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*;
public class S3AFileSystem extends FileSystem {</BUG>
private URI uri;
private Path workingDir;
private AmazonS3Client s3;
| import static org.apache.hadoop.fs.s3a.Constants.*;
public class S3AFileSystem extends FileSystem {
|
11,367 | public void initialize(URI name, Configuration conf) throws IOException {
super.initialize(name, conf);
uri = URI.create(name.getScheme() + "://" + name.getAuthority());
workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri,
this.getWorkingDirectory());
<BUG>String accessKey = conf.get(ACCESS_KEY, null);
String secretKey = conf.get(SECRET_KEY, null);
</BUG>
String userInfo = name.getUserInfo();
| String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null));
String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
|
11,368 | } else {
accessKey = userInfo;
}
}
AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain(
<BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey),
new InstanceProfileCredentialsProvider(),
new S3AAnonymousAWSCredentialsProvider()
);</BUG>
bucket = name.getHost();
| new BasicAWSCredentialsProvider(accessKey, secretKey),
new AnonymousAWSCredentialsProvider()
|
11,369 |
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT));
</BUG>
s3 = new AmazonS3Client(credentials, awsConf);
<BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS);
partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
</BUG>
if (partSize < 5 * 1024 * 1024) {
| new InstanceProfileCredentialsProvider(),
new AnonymousAWSCredentialsProvider()
bucket = name.getHost();
ClientConfiguration awsConf = new ClientConfiguration();
awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS)));
awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP);
awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES)));
awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)));
maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS));
partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE));
partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
|
11,370 | cannedACL = null;
}
if (!s3.doesBucketExist(bucket)) {
throw new IOException("Bucket " + bucket + " does not exist");
}
<BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART);
long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE);
</BUG>
if (purgeExistingMultipart) {
| boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART));
long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
|
11,371 | import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
<BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*;
public class S3AOutputStream extends OutputStream {</BUG>
private OutputStream backupStream;
private File backupFile;
private boolean closed;
| import static org.apache.hadoop.fs.s3a.Constants.*;
public class S3AOutputStream extends OutputStream {
|
11,372 | this.client = client;
this.progress = progress;
this.fs = fs;
this.cannedACL = cannedACL;
this.statistics = statistics;
<BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
</BUG>
if (conf.get(BUFFER_DIR, null) != null) {
| partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
|
11,373 | 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;
|
11,374 | 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());
|
11,375 | 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
|
11,376 | <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;
|
11,377 | 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] |
11,378 | <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;
|
11,379 | 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;
|
11,380 | 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;
|
11,381 | 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);
|
11,382 | 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 {
|
11,383 | 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(),
|
11,384 | )
);
}else{
return new TimeNode(
generateDayCandidatesQuestionMarkNotSupported(
<BUG>date.getYear(), date.getMonthOfYear(),
</BUG>
((DayOfWeekFieldDefinition)
cronDefinition.getFieldDefinition(DAY_OF_WEEK)
).getMondayDoWValue()
| date.getYear(), date.getMonthValue(),
|
11,385 | }
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);
|
11,386 | 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] |
11,387 | <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;
|
11,388 | 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;
|
11,389 | 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()
|
11,390 | import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nullable;
public class QuerySession {
<BUG>protected List<Flag> flags = new ArrayList<Flag>();
protected final CommandSource commandSource;</BUG>
protected Query query;
protected int radius;
public QuerySession() {
| protected List<Flag> flags = new ArrayList<>();
protected final CommandSource commandSource;
|
11,391 | DataView location = data.getView(DataQueries.Location).get();
entity.set(DataQueries.WorldUuid, location.getString(DataQueries.WorldUuid).get());
location.remove(DataQueries.WorldUuid);
entity.set(DataQueries.Position, location);
DataView unsafe = entity.getView(DataQueries.UnsafeData).get();
<BUG>List<Double> coordinates = new ArrayList<Double>();
coordinates.add(location.getDouble(DataQueries.X).get());</BUG>
coordinates.add(location.getDouble(DataQueries.Y).get());
coordinates.add(location.getDouble(DataQueries.Z).get());
unsafe.set(DataQueries.Pos, coordinates);
| List<Double> coordinates = new ArrayList<>();
coordinates.add(location.getDouble(DataQueries.X).get());
|
11,392 | public class NearCommand {
private NearCommand() {}
public static CommandSpec getCommand() {
return CommandSpec.builder()
.description(Text.of("Alias of /pr l r:(default radius)"))
<BUG>.permission("prism.lookup")
.executor(new CommandExecutor() {
@Override
public CommandResult execute(CommandSource source, CommandContext args) throws CommandException {</BUG>
int radius = Prism.getConfig().getNode("commands", "near", "defaultRadius").getInt();
| .executor((source, args) -> {
|
11,393 | return pattern.matcher(value).matches();
}
@Override
public Optional<ListenableFuture<?>> process(QuerySession session, String parameter, String value, Query query) {
ListenableFuture<GameProfile> profile = Prism.getGame().getServer().getGameProfileManager().get(value, true);
<BUG>profile.addListener(new Runnable() {
@Override
public void run() {</BUG>
try {
| profile.addListener(() -> {
|
11,394 | return fromArguments(session, (arguments != null ? arguments.split(" ") : new String[]{}));
}
public static CompletableFuture<Query> fromArguments(QuerySession session, @Nullable String[] arguments) throws ParameterException {
checkNotNull(session);
Query query = new Query();
<BUG>CompletableFuture<Query> future = new CompletableFuture<Query>();
Map<String, String> definedParameters = new HashMap<String, String>();
if (arguments.length > 0) {
List<ListenableFuture<?>> futures = new ArrayList<ListenableFuture<?>>();
for (String arg : arguments) {</BUG>
Optional<ListenableFuture<?>> listenable;
| CompletableFuture<Query> future = new CompletableFuture<>();
Map<String, String> definedParameters = new HashMap<>();
List<ListenableFuture<?>> futures = new ArrayList<>();
for (String arg : arguments) {
|
11,395 | if (listenable.isPresent()) {
futures.add(listenable.get());
}
}
if (!futures.isEmpty()) {
<BUG>ListenableFuture<List<Object>> combinedFuture = Futures.allAsList(futures);
combinedFuture.addListener(new Runnable() {
@Override
public void run() {
future.complete(query);
}
}, MoreExecutors.sameThreadExecutor());</BUG>
} else {
| combinedFuture.addListener(() -> future.complete(query), MoreExecutors.sameThreadExecutor());
|
11,396 | private LookupCommand() {}
public static CommandSpec getCommand() {
return CommandSpec.builder()
.description(Text.of("Search event records."))
.permission("prism.lookup")
<BUG>.arguments(GenericArguments.optional(GenericArguments.remainingJoinedStrings(Text.of("arguments"))))
.executor(new CommandExecutor() {
@Override
public CommandResult execute(CommandSource source, CommandContext args) throws CommandException {</BUG>
final QuerySession session = new QuerySession(source);
| .executor((source, args) -> {
|
11,397 | CompletableFuture<Void> future = session.newQueryFromArguments(args.<String>getOne("parameters").get());
future.thenAccept((v) -> {
session.getQuery().setAggregate(false);
session.getQuery().setLimit(Prism.getConfig().getNode("query", "actionable", "limit").getInt());
try {
<BUG>List<ActionableResult> actionResults = new ArrayList<ActionableResult>();
CompletableFuture<List<Result>> futureResults = Prism.getStorageAdapter().records().query(session, false);</BUG>
futureResults.thenAccept(results -> {
if (results.isEmpty()) {
source.sendMessage(Format.error("No results."));
| List<ActionableResult> actionResults = new ArrayList<>();
CompletableFuture<List<Result>> futureResults = Prism.getStorageAdapter().records().query(session, false);
|
11,398 | appliedCount++;
} else {
skippedCount++;
}
}
<BUG>Map<String,String> tokens = new HashMap<String, String>();
</BUG>
tokens.put("appliedCount", ""+appliedCount);
tokens.put("skippedCount", ""+skippedCount);
String messageTemplate = null;
| Map<String, String> tokens = new HashMap<>();
|
11,399 | import java.util.List;
import org.spongepowered.api.world.Location;
import com.google.common.collect.Range;
import com.helion3.prism.util.DataQueries;
final public class ConditionGroup implements Condition {
<BUG>private List<Condition> conditions = new ArrayList<Condition>();
private final Operator operator;</BUG>
public enum Operator {
AND, OR
}
| private List<Condition> conditions = new ArrayList<>();
private final Operator operator;
|
11,400 | public class ExtinguishCommand {
private ExtinguishCommand() {}
public static CommandSpec getCommand() {
return CommandSpec.builder()
.permission("prism.extinguish")
<BUG>.arguments(GenericArguments.integer(Text.of("radius")))
.executor(new CommandExecutor() {
@Override
public CommandResult execute(CommandSource source, CommandContext args) throws CommandException {</BUG>
if (!(source instanceof Player)) {
| .executor((source, args) -> {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.