id
int64 1
60k
| buggy
stringlengths 34
37.5k
| fixed
stringlengths 6
37.4k
|
---|---|---|
59,901 | metaCategory.set(FGUtil.getCategory(fgObject));
<BUG>metaType.set(fgObject.getUniqueTypeString());
metaEnabled.set(fgObject.isEnabled());</BUG>
}
} else {
<BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping...");
</BUG>
}
mainMap.put(name, FGUtil.getCategory(fgObject));
<BUG>typeMap.put(name, fgObject.getUniqueTypeString());
enabledMap.put(name, fgObject.isEnabled());</BUG>
defaultModifiedMap.put(fgObject, false);
| metaCategory.set(FGUtil.getCategory(fgObject));
metaType.set(fgObject.getUniqueTypeString());
metaOwner.set(owner);
metaEnabled.set(fgObject.isEnabled());
}
} else {
logger.info("Region " + logName + " is already up to date. Skipping...");
}
mainMap.put(name, FGUtil.getCategory(fgObject));
typeMap.put(name, fgObject.getUniqueTypeString());
ownerMap.put(name, owner);
enabledMap.put(name, fgObject.isEnabled());
defaultModifiedMap.put(fgObject, false);
|
59,902 | mainMap.put(name, FGUtil.getCategory(fgObject));
<BUG>typeMap.put(name, fgObject.getUniqueTypeString());
enabledMap.put(name, fgObject.isEnabled());</BUG>
defaultModifiedMap.put(fgObject, false);
} else {
<BUG>logger.info("Region " + fgObject.getName() + " does not need saving. Skipping...");
</BUG>
}
if (fgObject.saveLinks()) {
linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
| mainMap.put(name, FGUtil.getCategory(fgObject));
typeMap.put(name, fgObject.getUniqueTypeString());
ownerMap.put(name, owner);
enabledMap.put(name, fgObject.isEnabled());
defaultModifiedMap.put(fgObject, false);
} else {
logger.info("Region " + logName + " does not need saving. Skipping...");
}
if (fgObject.saveLinks()) {
linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
|
59,903 | constructDirectory(singleDir);
try {
fgObject.save(singleDir);
} catch (Exception e) {
<BUG>logger.error("There was an error while saving world region \"" + name + "\" in world \"" + world.getName() + "\"!", e);
</BUG>
}
<BUG>logger.info("Saving metadata for world region \"" + name + "\"");
</BUG>
try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
| constructDirectory(singleDir);
try {
fgObject.save(singleDir);
} catch (Exception e) {
logger.error("There was an error while saving world region " + logName + " in world " + world.getName() + "!", e);
}
logger.info("Saving metadata for world region " + logName);
try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
|
59,904 | metaCategory.set(FGUtil.getCategory(fgObject));
<BUG>metaType.set(fgObject.getUniqueTypeString());
metaEnabled.set(fgObject.isEnabled());</BUG>
}
} else {
<BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping...");
</BUG>
}
mainMap.put(name, FGUtil.getCategory(fgObject));
<BUG>typeMap.put(name, fgObject.getUniqueTypeString());
enabledMap.put(name, fgObject.isEnabled());</BUG>
defaultModifiedMap.put(fgObject, false);
| metaCategory.set(FGUtil.getCategory(fgObject));
metaType.set(fgObject.getUniqueTypeString());
metaOwner.set(owner);
metaEnabled.set(fgObject.isEnabled());
}
} else {
logger.info("Region " + logName + " is already up to date. Skipping...");
}
mainMap.put(name, FGUtil.getCategory(fgObject));
typeMap.put(name, fgObject.getUniqueTypeString());
ownerMap.put(name, owner);
enabledMap.put(name, fgObject.isEnabled());
defaultModifiedMap.put(fgObject, false);
|
59,905 | mainMap.put(name, FGUtil.getCategory(fgObject));
<BUG>typeMap.put(name, fgObject.getUniqueTypeString());
enabledMap.put(name, fgObject.isEnabled());</BUG>
defaultModifiedMap.put(fgObject, false);
} else {
<BUG>logger.info("World region " + fgObject.getName() + " does not need saving. Skipping...");
</BUG>
}
if (fgObject.saveLinks()) {
linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
| mainMap.put(name, FGUtil.getCategory(fgObject));
typeMap.put(name, fgObject.getUniqueTypeString());
ownerMap.put(name, owner);
enabledMap.put(name, fgObject.isEnabled());
defaultModifiedMap.put(fgObject, false);
} else {
logger.info("World region " + logName + " does not need saving. Skipping...");
}
if (fgObject.saveLinks()) {
linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
|
59,906 | 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);
| String name = fgObject.getName();
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());
boolean shouldSave = fgObject.shouldSave();
if (force || shouldSave) {
logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
constructDirectory(singleDir);
try {
fgObject.save(singleDir);
|
59,907 | constructDirectory(singleDir);
try {
fgObject.save(singleDir);
} catch (Exception e) {
<BUG>logger.error("There was an error while saving region \"" + name + "\"!", e);
</BUG>
}
<BUG>logger.info("Saving metadata for region \"" + name + "\"");
</BUG>
try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
| constructDirectory(singleDir);
try {
fgObject.save(singleDir);
} catch (Exception e) {
logger.error("There was an error while saving region " + logName + "!", e);
}
logger.info("Saving metadata for region " + logName);
try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
|
59,908 | metaCategory.set(FGUtil.getCategory(fgObject));
<BUG>metaType.set(fgObject.getUniqueTypeString());
metaEnabled.set(fgObject.isEnabled());</BUG>
}
} else {
<BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping...");
</BUG>
}
mainMap.put(name, FGUtil.getCategory(fgObject));
<BUG>typeMap.put(name, fgObject.getUniqueTypeString());
enabledMap.put(name, fgObject.isEnabled());</BUG>
defaultModifiedMap.put(fgObject, false);
| metaCategory.set(FGUtil.getCategory(fgObject));
metaType.set(fgObject.getUniqueTypeString());
metaOwner.set(owner);
metaEnabled.set(fgObject.isEnabled());
}
} else {
logger.info("Region " + logName + " is already up to date. Skipping...");
}
mainMap.put(name, FGUtil.getCategory(fgObject));
typeMap.put(name, fgObject.getUniqueTypeString());
ownerMap.put(name, owner);
enabledMap.put(name, fgObject.isEnabled());
defaultModifiedMap.put(fgObject, false);
|
59,909 | mainMap.put(name, FGUtil.getCategory(fgObject));
<BUG>typeMap.put(name, fgObject.getUniqueTypeString());
enabledMap.put(name, fgObject.isEnabled());</BUG>
defaultModifiedMap.put(fgObject, false);
} else {
<BUG>logger.info("Region " + fgObject.getName() + " does not need saving. Skipping...");
</BUG>
}
if (fgObject.saveLinks()) {
linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
| mainMap.put(name, FGUtil.getCategory(fgObject));
typeMap.put(name, fgObject.getUniqueTypeString());
ownerMap.put(name, owner);
enabledMap.put(name, fgObject.isEnabled());
defaultModifiedMap.put(fgObject, false);
} else {
logger.info("Region " + logName + " does not need saving. Skipping...");
}
if (fgObject.saveLinks()) {
linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
|
59,910 | 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);
| if (fgObject.autoSave()) {
Path singleDir = serverDir.resolve(name.toLowerCase());
boolean shouldSave = fgObject.shouldSave();
if (force || shouldSave) {
logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
constructDirectory(singleDir);
try {
fgObject.save(singleDir);
|
59,911 | </BUG>
constructDirectory(singleDir);
try {
fgObject.save(singleDir);
} catch (Exception e) {
<BUG>logger.error("There was an error while saving world region \"" + name + "\" in world \"" + world.getName() + "\"!", e);
</BUG>
}
<BUG>logger.info("Saving metadata for world region \"" + name + "\"");
</BUG>
try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
| if (fgObject.autoSave()) {
Path singleDir = serverDir.resolve(name.toLowerCase());
boolean shouldSave = fgObject.shouldSave();
if (force || shouldSave) {
logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
constructDirectory(singleDir);
try {
fgObject.save(singleDir);
} catch (Exception e) {
logger.error("There was an error while saving world region " + logName + " in world " + world.getName() + "!", e);
}
logger.info("Saving metadata for world region " + logName);
try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
|
59,912 | metaCategory.set(FGUtil.getCategory(fgObject));
<BUG>metaType.set(fgObject.getUniqueTypeString());
metaEnabled.set(fgObject.isEnabled());</BUG>
}
} else {
<BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping...");
}</BUG>
mainMap.put(name, FGUtil.getCategory(fgObject));
<BUG>typeMap.put(name, fgObject.getUniqueTypeString());
enabledMap.put(name, fgObject.isEnabled());</BUG>
defaultModifiedMap.put(fgObject, false);
| metaCategory.set(FGUtil.getCategory(fgObject));
metaType.set(fgObject.getUniqueTypeString());
metaOwner.set(owner);
metaEnabled.set(fgObject.isEnabled());
}
} else {
logger.info("Region " + name + " is already up to date. Skipping...");
}
mainMap.put(name, FGUtil.getCategory(fgObject));
typeMap.put(name, fgObject.getUniqueTypeString());
ownerMap.put(name, owner);
enabledMap.put(name, fgObject.isEnabled());
|
59,913 | mainMap.put(name, FGUtil.getCategory(fgObject));
<BUG>typeMap.put(name, fgObject.getUniqueTypeString());
enabledMap.put(name, fgObject.isEnabled());</BUG>
defaultModifiedMap.put(fgObject, false);
} else {
<BUG>logger.info("World region " + fgObject.getName() + " does not need saving. Skipping...");
</BUG>
}
if (fgObject.saveLinks()) {
linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
| mainMap.put(name, FGUtil.getCategory(fgObject));
typeMap.put(name, fgObject.getUniqueTypeString());
ownerMap.put(name, owner);
enabledMap.put(name, fgObject.isEnabled());
defaultModifiedMap.put(fgObject, false);
} else {
logger.info("World region " + logName + " does not need saving. Skipping...");
}
if (fgObject.saveLinks()) {
linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
|
59,914 | 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();
| 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 -> {
Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey());
if (regionOpt.isPresent()) {
IRegion region = regionOpt.get();
logger.info("Loading links for region \"" + region.getName() + "\"");
String handlersString = entry.getValue();
|
59,915 | 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();
| 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 -> {
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() + "\"");
String handlersString = entry.getValue();
|
59,916 | 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;
| StringBuilder builder = new StringBuilder();
for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) {
builder.append(it.next().getName());
if (it.hasNext()) builder.append(",");
}
return builder.toString();
}
public enum Type {
REGION, WREGION, HANDLER
}
private final class LoadEntry {
public final String name;
public final Type type;
|
59,917 | 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 org.spongepowered.api.world.Locatable;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;
import javax.annotation.Nullable;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
public class CommandHere extends FCCommandBase {
private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"};
private static final FlagMapper MAPPER = map -> key -> value -> {
|
59,918 | import net.foxdenstudio.sponge.foxguard.plugin.handler.GlobalHandler;
import net.foxdenstudio.sponge.foxguard.plugin.handler.IHandler;
import net.foxdenstudio.sponge.foxguard.plugin.object.IFGObject;
import net.foxdenstudio.sponge.foxguard.plugin.object.IGlobal;
import net.foxdenstudio.sponge.foxguard.plugin.region.IRegion;
<BUG>import net.foxdenstudio.sponge.foxguard.plugin.region.world.GlobalWorldRegion;</BUG>
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.ArgumentParseException;
<BUG>import org.spongepowered.api.entity.living.player.Player;</BUG>
import org.spongepowered.api.text.Text;
| import net.foxdenstudio.sponge.foxguard.plugin.handler.GlobalHandler;
import net.foxdenstudio.sponge.foxguard.plugin.handler.IHandler;
import net.foxdenstudio.sponge.foxguard.plugin.object.IFGObject;
import net.foxdenstudio.sponge.foxguard.plugin.object.IGlobal;
import net.foxdenstudio.sponge.foxguard.plugin.region.IRegion;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.ArgumentParseException;
import org.spongepowered.api.text.Text;
|
59,919 | 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 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;
import java.util.Optional;
import java.util.stream.Stream;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
public class CommandDelete extends FCCommandBase {
private static final FlagMapper MAPPER = map -> key -> value -> {
map.put(key, value);
|
59,920 | .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) {
| .append(Text.of(TextColors.GREEN, "Usage: "))
.append(getUsage(source))
.build());
return CommandResult.empty();
} else if (isIn(REGIONS_ALIASES, parse.args[0])) {
if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!"));
String regionName = parse.args[1];
IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
boolean isWorldRegion = false;
if (region == null) {
|
59,921 | </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);
isWorldRegion = true;
}
if (region == null)
throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!"));
if (region instanceof IGlobal) {
throw new CommandException(Text.of("You may not delete the global region!"));
}
|
59,922 | 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!"));
| 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!"));
Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]);
if (!handlerOpt.isPresent())
throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1);
IHandler handler = handlerOpt.get();
if (handler instanceof GlobalHandler)
throw new CommandException(Text.of("You may not delete the global handler!"));
|
59,923 | .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) {
| .excludeCurrent(true)
.autoCloseQuotes(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index == 1) {
|
59,924 | .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) {
| .excludeCurrent(true)
.autoCloseQuotes(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index == 1) {
|
59,925 | .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) {
| .autoCloseQuotes(true)
.leaveFinalAsIs(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
return Stream.of("region", "worldregion", "handler", "controller")
.filter(new StartsWithPredicate(parse.current.token))
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index == 1) {
|
59,926 | .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) {
| .excludeCurrent(true)
.autoCloseQuotes(true)
.parse();
if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) {
if (parse.current.index == 0)
return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
.map(args -> parse.current.prefix + args)
.collect(GuavaCollectors.toImmutableList());
else if (parse.current.index > 0) {
|
59,927 | @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;
| @Dependency(id = "foxcore")
},
description = "A world protection plugin built for SpongeAPI. Requires FoxCore.",
authors = {"gravityfox"},
url = "https://github.com/FoxDenStudio/FoxGuard")
public final class FoxGuardMain {
private static FoxGuardMain instanceField;
public final Cause pluginCause = Cause.builder().named("plugin", this).build();
@Inject
private Logger logger;
|
59,928 | 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;
| private UserStorageService userStorage;
private EconomyService economyService = null;
private boolean loaded = false;
private FCCommandDispatcher fgDispatcher;
public static FoxGuardMain instance() {
return instanceField;
}
public static Cause getCause() {
return instance().pluginCause;
}
@Listener
public void construct(GameConstructionEvent event) {
instanceField = this;
|
59,929 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
public EconomyService getEconomyService() {
return economyService;
|
59,930 | public class UserControllerTest
{
private static final Logger LOGGER = Logger.getLogger( UserControllerTest.class.getName() );
Properties properties = new Properties();
InputStream input = null;
<BUG>private String neo4jServerPort = System.getProperty( "neo4j.server.port" );
private String neo4jRemoteShellPort = System.getProperty( "neo4j.remoteShell.port" );
private String neo4jGraphDb = System.getProperty( "neo4j.graph.db" );
private ServerControls server;</BUG>
@Before
| public class UserControllerTest
{
private static final Logger LOGGER = Logger.getLogger( UserControllerTest.class.getName() );
Properties properties = new Properties();
InputStream input = null;
private String dbmsConnectorHttpPort = System.getProperty( "dbms.connector.http.port" );
private String dbmsConnectorBoltPort = System.getProperty( "dbms.connector.bolt.port" );
private String dbmsShellPort = System.getProperty( "dbms.shell.port" );
private String dbmsDirectoriesData = System.getProperty( "dbms.directories.data" );
private ServerControls server;
@Before
|
59,931 | @org.springframework.context.annotation.Configuration
@EnableNeo4jRepositories( basePackages = {"org.neo4j.extensions.spring.repository"} )
@EnableTransactionManagement
public class AppGraphConfig extends Neo4jConfiguration
{
<BUG>@Value( "${neo4j.graph.db}" )
private String graphDb;
@Value( "${spring.data.neo4j.url}" )</BUG>
private String url;
<BUG>@Value( "${neo4j.server.port}" )
private Integer port;</BUG>
@Value( "${spring.data.neo4j.username}" )
| @org.springframework.context.annotation.Configuration
@EnableNeo4jRepositories( basePackages = {"org.neo4j.extensions.spring.repository"} )
@EnableTransactionManagement
public class AppGraphConfig extends Neo4jConfiguration
{
@Value( "${dbms.connector.http.port}" )
private Integer dbmsConnectorHttpPort;
@Value( "${dbms.connector.bolt.port}" )
private Integer dbmsConnectorBoltPort;
@Value( "${spring.data.neo4j.url}" )
private String url;
@Value( "${spring.data.neo4j.username}" )
|
59,932 | @Bean
public Configuration getConfiguration()
{
if ( StringUtils.isEmpty( url ) )
{
<BUG>url = "http://localhost:" + port;
</BUG>
}
Configuration config = new Configuration();
config.driverConfiguration().setDriverClassName( HttpDriver.class.getName() )
| @Bean
public Configuration getConfiguration()
{
if ( StringUtils.isEmpty( url ) )
{
url = "http://localhost:" + dbmsConnectorHttpPort;
}
Configuration config = new Configuration();
config.driverConfiguration().setDriverClassName( HttpDriver.class.getName() )
|
59,933 | import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import grails.web.servlet.mvc.GrailsHttpSession;
import grails.web.servlet.mvc.GrailsParameterMap;
import grails.core.GrailsApplication;
<BUG>import grails.core.GrailsControllerClass;
import org.grails.core.io.support.GrailsFactoriesLoader;</BUG>
import org.grails.encoder.CodecLookupHelper;
import org.grails.encoder.DefaultEncodingStateRegistry;
import org.grails.encoder.Encoder;
| import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import grails.web.servlet.mvc.GrailsHttpSession;
import grails.web.servlet.mvc.GrailsParameterMap;
import grails.core.GrailsApplication;
import grails.core.GrailsControllerClass;
import org.grails.core.artefact.ControllerArtefactHandler;
import org.grails.core.io.support.GrailsFactoriesLoader;
import org.grails.encoder.CodecLookupHelper;
import org.grails.encoder.DefaultEncodingStateRegistry;
import org.grails.encoder.Encoder;
|
59,934 | }
@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 + "\"")));
}
| }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
return Task.named("exec", "/bin/sh").ofType(Exec.Result.class)
.in(() -> task1)
.in(() -> task2)
.process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\"")));
}
|
59,935 | 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 args;
}
static class MyTask {
static final int PLUS = 10;
static Task<String> create(String parameter) {
return Task.named("MyTask", parameter).ofType(String.class)
.in(() -> Adder.create(parameter.length(), PLUS))
.in(() -> Fib.create(parameter.length()))
.process((sum, fib) -> something(parameter, sum, fib));
}
|
59,936 | 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))
| final String instanceField = "from instance";
final TaskContext context = TaskContext.inmem();
final AwaitingConsumer<String> val = new AwaitingConsumer<>();
@Test
public void shouldJavaUtilSerialize() throws Exception {
Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class)
.process(() -> 9999L);
Task<String> task2 = Task.named("Baz", 40).ofType(String.class)
.in(() -> task1)
.ins(() -> singletonList(task1))
|
59,937 | 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
| assertEquals(des.id().name(), "Baz");
assertEquals(val.awaitAndGet(), "[9999] hello 10004");
}
@Test(expected = NotSerializableException.class)
public void shouldNotSerializeWithInstanceFieldReference() throws Exception {
Task<String> task = Task.named("WithRef").ofType(String.class)
.process(() -> instanceField + " causes an outer reference");
serialize(task);
}
@Test
|
59,938 | 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);
| serialize(task);
}
@Test
public void shouldSerializeWithLocalReference() throws Exception {
String local = instanceField;
Task<String> task = Task.named("WithLocalRef").ofType(String.class)
.process(() -> local + " won't cause an outer reference");
serialize(task);
Task<String> des = deserialize();
context.evaluate(des).consume(val);
|
59,939 | 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);
| 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) {
TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
if (n < 2) {
return fib
.process(() -> n);
|
59,940 | }
@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 {
| }
@RootTask
public static Task<String> standardArgs(int first, String second) {
firstInt = first;
secondString = second;
return Task.named("StandardArgs", first, second).ofType(String.class)
.process(() -> second + " " + first * 100);
}
@Test
public void shouldParseFlags() throws Exception {
|
59,941 | 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 {
| assertThat(parsedEnum, is(CustomEnum.BAR));
}
@RootTask
public static Task<String> enums(CustomEnum enm) {
parsedEnum = enm;
return Task.named("Enums", enm).ofType(String.class)
.process(enm::toString);
}
@Test
public void shouldParseCustomTypes() throws Exception {
|
59,942 | 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
| assertThat(parsedType.content, is("blarg parsed for you!"));
}
@RootTask
public static Task<String> customType(CustomType myType) {
parsedType = myType;
return Task.named("Types", myType.content).ofType(String.class)
.process(() -> myType.content);
}
public enum CustomEnum {
BAR
|
59,943 | package com.hazelcast.config;
import java.util.ArrayList;
import java.util.List;
public class JoinMembers {
<BUG>public int connectionTimeoutSeconds = 5;
public boolean enabled = false;
public List<String> lsMembers = new ArrayList<String>();
public String requiredMember = null;
</BUG>
public void add(final String member) {
| package com.hazelcast.config;
import java.util.ArrayList;
import java.util.List;
public class JoinMembers {
private int connectionTimeoutSeconds = 5;
private boolean enabled = false;
private List<String> lsMembers = new ArrayList<String>();
private String requiredMember = null;
public void add(final String member) {
|
59,944 | final Join join = config.getJoin();
for (int a = 0; a < atts.getLength(); a++) {
final org.w3c.dom.Node att = atts.item(a);
final String value = getTextContent(att).trim();
if (att.getNodeName().equals("enabled")) {
<BUG>join.getJoinMembers().enabled = checkTrue(value);
</BUG>
} else if (att.getNodeName().equals("conn-timeout-seconds")) {
<BUG>join.getJoinMembers().connectionTimeoutSeconds = getIntegerValue("conn-timeout-seconds",
value, 5);</BUG>
}
| final Join join = config.getJoin();
for (int a = 0; a < atts.getLength(); a++) {
final org.w3c.dom.Node att = atts.item(a);
final String value = getTextContent(att).trim();
if (att.getNodeName().equals("enabled")) {
join.getMulticastConfig().setEnabled(checkTrue(value));
|
59,945 | members:
for (int i = 0; i < nodelist.getLength(); i++) {
final org.w3c.dom.Node n = nodelist.item(i);
final String value = getTextContent(n).trim();
if (n.getNodeName().equalsIgnoreCase("required-member")) {
<BUG>join.getJoinMembers().requiredMember = value;
</BUG>
} else if (n.getNodeName().equalsIgnoreCase("hostname")) {
join.getJoinMembers().add(value);
} else if (n.getNodeName().equalsIgnoreCase("interface")) {
| members:
for (int i = 0; i < nodelist.getLength(); i++) {
final org.w3c.dom.Node n = nodelist.item(i);
final String value = getTextContent(n).trim();
if (n.getNodeName().equalsIgnoreCase("required-member")) {
join.getJoinMembers().setRequiredMember(value);
} else if (n.getNodeName().equalsIgnoreCase("hostname")) {
join.getJoinMembers().add(value);
} else if (n.getNodeName().equalsIgnoreCase("interface")) {
|
59,946 | ClusterManager.get().sendJoinRequest(masterAddress);
}
private void joinViaPossibleMembers() {
final Config config = Config.get();
try {
<BUG>final List<Address> lsPossibleAddresses = getPossibleMembers(config.getJoin().getJoinMembers().lsMembers);
</BUG>
lsPossibleAddresses.remove(address);
for (final Address adrs : lsPossibleAddresses) {
if (DEBUG)
| ClusterManager.get().sendJoinRequest(masterAddress);
}
private void joinViaPossibleMembers() {
final Config config = Config.get();
try {
final List<Address> lsPossibleAddresses = getPossibleMembers(config.getJoin().getJoinMembers().getLsMembers());
lsPossibleAddresses.remove(address);
for (final Address adrs : lsPossibleAddresses) {
if (DEBUG)
|
59,947 | TreeSet::addAll);
Transaction modeshapeTx = repositoryEnvironment.getTransactions().currentTransaction();
assert modeshapeTx != null;
String txId = modeshapeTx.id();
Set<String> lockedKeysForTx = LOCKED_KEYS_BY_TX_ID.computeIfAbsent(txId, id -> new LinkedHashSet<>());
<BUG>if (keysToLock.removeAll(lockedKeysForTx)) {
if (LOGGER.isDebugEnabled()) {</BUG>
LOGGER.debug("The keys {0} have been locked previously as part of the transaction {1}; skipping them...",
<BUG>lockedKeysForTx, txId);
}
}
if (keysToLock.isEmpty()) {
return;
}</BUG>
int retryCountOnLockTimeout = 3;
| TreeSet::addAll);
Transaction modeshapeTx = repositoryEnvironment.getTransactions().currentTransaction();
assert modeshapeTx != null;
String txId = modeshapeTx.id();
Set<String> lockedKeysForTx = LOCKED_KEYS_BY_TX_ID.computeIfAbsent(txId, id -> new LinkedHashSet<>());
if (lockedKeysForTx.containsAll(changedNodesKeys)) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("The keys {0} have been locked previously as part of the transaction {1}; skipping them...",
changedNodesKeys, txId);
}
} else {
Set<String> newKeysToLock = new TreeSet<>(changedNodesKeys);
newKeysToLock.removeAll(lockedKeysForTx);
int retryCountOnLockTimeout = 3;
|
59,948 | int threadCount = 150;
IntStream.range(0, threadCount).parallel().forEach(this::insertAndQueryNodes);
}
@Test
@FixFor( "MODE-2607" )
<BUG>public void shouldBeAbleToUpdateParentNodeWithOneSessionAndRemoveChildNodeWithAnotherSession() throws Exception {
final String parentPath = "/parent";</BUG>
final String childPath = "/parent/child";
startTransaction();
Session session = newSession();
| int threadCount = 150;
IntStream.range(0, threadCount).parallel().forEach(this::insertAndQueryNodes);
}
@Test
@FixFor( "MODE-2607" )
public void shouldUpdateParentAndRemoveChildWithDifferentTransactions1() throws Exception {
final String parentPath = "/parent";
final String childPath = "/parent/child";
startTransaction();
Session session = newSession();
|
59,949 | package org.modeshape.jcr.cache.document;
import java.util.ArrayList;
import java.util.Collections;
<BUG>import java.util.HashMap;</BUG>
import java.util.List;
import java.util.Map;
<BUG>import java.util.stream.Stream;
import javax.transaction.RollbackException;</BUG>
import javax.transaction.Status;
| package org.modeshape.jcr.cache.document;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.transaction.RollbackException;
import javax.transaction.Status;
|
59,950 | public void changed( ChangeSet changes ) {
sharedWorkspaceCache.changed(changes);
changedWithinTransaction(changes);
}
public void changedWithinTransaction( final ChangeSet changes ) {
<BUG>txWorkspaceCaches.workspaceCachesFor(txn).forEach(cache -> cache.internalChangedWithinTransaction(changes));
}</BUG>
@Override
public void clear() {
<BUG>txWorkspaceCaches.workspaceCachesFor(txn).forEach(TransactionalWorkspaceCache::internalClear);
}</BUG>
protected void internalClear() {
| public void changed( ChangeSet changes ) {
sharedWorkspaceCache.changed(changes);
changedWithinTransaction(changes);
}
public void changedWithinTransaction( final ChangeSet changes ) {
txWorkspaceCaches.dispatchChangesForTransaction(txn, changes);
}
@Override
public void clear() {
txWorkspaceCaches.clearAllCachesForTransaction(txn);
}
protected void internalClear() {
|
59,951 | return BASE_UNITS[index].multiply(factor);
}
try {
return parseUnit(name);
} catch (ParserException e) {
<BUG>throw (ParseException) new LocalizedParseException(errorLocale,
Errors.Keys.UnknownUnit_1, new Object[] {name}, element.offset).initCause(e);
}</BUG>
}
final void parseParameters(final Element element, final ParameterValueGroup parameters,
| return BASE_UNITS[index].multiply(factor);
}
try {
return parseUnit(name);
} catch (ParserException e) {
throw new LocalizedParseException(errorLocale, Errors.Keys.UnknownUnit_1,
new Object[] {name}, element.offset).initCause(e);
}
}
final void parseParameters(final Element element, final ParameterValueGroup parameters,
|
59,952 | parameter.setValue(param.pullString("stringValue"));
}
param.close(ignoredElements);
}
} catch (ParameterNotFoundException e) {
<BUG>throw (ParseException) new LocalizedParseException(errorLocale, Errors.Keys.UnexpectedParameter_1,
new String[] {e.getParameterName()}, param.offset).initCause(e);</BUG>
} catch (InvalidParameterValueException e) {
throw (ParseException) new ParseException(e.getLocalizedMessage(), param.offset).initCause(e);
}
| parameter.setValue(param.pullString("stringValue"));
}
param.close(ignoredElements);
}
} catch (ParameterNotFoundException e) {
throw new LocalizedParseException(errorLocale, Errors.Keys.UnexpectedParameter_1,
new String[] {e.getParameterName()}, param.offset).initCause(e);
} catch (InvalidParameterValueException e) {
throw (ParseException) new ParseException(e.getLocalizedMessage(), param.offset).initCause(e);
|
59,953 | import org.opengis.util.FactoryException;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.DataStoreReferencingException;
import org.apache.sis.storage.UnsupportedStorageException;
<BUG>import org.apache.sis.storage.StorageConnector;
import org.apache.sis.util.Debug;</BUG>
public class LandsatStore extends DataStore {
private final String name;
private Reader source;
| import org.opengis.util.FactoryException;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.DataStoreReferencingException;
import org.apache.sis.storage.UnsupportedStorageException;
import org.apache.sis.storage.StorageConnector;
import org.apache.sis.setup.OptionKey;
import org.apache.sis.util.Debug;
public class LandsatStore extends DataStore {
private final String name;
private Reader source;
|
59,954 | super(provider, connector);
name = connector.getStorageName();
source = connector.getStorageAs(Reader.class);
connector.closeAllExcept(source);
if (source == null) {
<BUG>throw new UnsupportedStorageException(super.getLocale(), true, "Landsat", connector.getStorage());
}</BUG>
}
@Override
public synchronized Metadata getMetadata() throws DataStoreException {
| super(provider, connector);
name = connector.getStorageName();
source = connector.getStorageAs(Reader.class);
connector.closeAllExcept(source);
if (source == null) {
throw new UnsupportedStorageException(super.getLocale(), "Landsat",
connector.getStorage(), connector.getOption(OptionKey.OPEN_OPTIONS));
}
}
@Override
public synchronized Metadata getMetadata() throws DataStoreException {
|
59,955 | try {
synchronized (Angle.class) {
angle = getAngleFormat().parseObject(text);
}
} catch (ParseException exception) {
<BUG>NumberFormatException e = new NumberFormatException(exception.getMessage());
e.initCause(exception);
throw e;</BUG>
}
| try {
synchronized (Angle.class) {
angle = getAngleFormat().parseObject(text);
}
} catch (ParseException exception) {
throw (NumberFormatException) new NumberFormatException(exception.getMessage()).initCause(exception);
}
|
59,956 | protected final Object readResolve() throws InvalidObjectException {
final Class<?> type = getClass();
try {
return type.cast(type.getField(getName()).get(null));
} catch (Exception cause) { // Many exceptions, including unchecked ones.
<BUG>InvalidObjectException e = new InvalidObjectException(cause.toString());
e.initCause(cause);
throw e;</BUG>
}
| protected final Object readResolve() throws InvalidObjectException {
final Class<?> type = getClass();
try {
return type.cast(type.getField(getName()).get(null));
} catch (Exception cause) { // Many exceptions, including unchecked ones.
throw (InvalidObjectException) new InvalidObjectException(cause.toString()).initCause(cause);
|
59,957 | if (verify != null) try {
if (Math.abs(verify.getConverterToAny(unit).convert(1) - 1) > Numerics.COMPARISON_THRESHOLD) {
warning(parent, element, Errors.formatInternational(Errors.Keys.UnexpectedScaleFactorForUnit_2, verify, factor), null);
}
} catch (IncommensurableException e) {
<BUG>throw (ParseException) new LocalizedParseException(errorLocale,
Errors.Keys.InconsistentUnitsForCS_1, new Object[] {verify}, element.offset).initCause(e);
}</BUG>
}
return unit;
| if (verify != null) try {
if (Math.abs(verify.getConverterToAny(unit).convert(1) - 1) > Numerics.COMPARISON_THRESHOLD) {
warning(parent, element, Errors.formatInternational(Errors.Keys.UnexpectedScaleFactorForUnit_2, verify, factor), null);
}
} catch (IncommensurableException e) {
throw new LocalizedParseException(errorLocale, Errors.Keys.InconsistentUnitsForCS_1,
new Object[] {verify}, element.offset).initCause(e);
}
}
return unit;
|
59,958 | } catch (IOException exception) {
record.setLevel (Level.WARNING);
record.setMessage(exception.getMessage()); // For administrator, use system locale.
record.setThrown (exception);
Logging.log(IndexedResourceBundle.class, methodName, record);
<BUG>final MissingResourceException error = new MissingResourceException(
Exceptions.getLocalizedMessage(exception, locale), // For users, use requested locale.
baseName, key);
error.initCause(exception);
throw error;</BUG>
}
| } catch (IOException exception) {
record.setLevel (Level.WARNING);
record.setMessage(exception.getMessage()); // For administrator, use system locale.
record.setThrown (exception);
Logging.log(IndexedResourceBundle.class, methodName, record);
throw (MissingResourceException) new MissingResourceException(
Exceptions.getLocalizedMessage(exception, locale), // For users, use requested locale.
baseName, key).initCause(exception);
}
|
59,959 | @Override
public Date parse(final String text) throws ParseException {
try {
return toDate(format.parse(text));
} catch (DateTimeException | ArithmeticException e) {
<BUG>ParseException p = new ParseException(e.getLocalizedMessage(), getErrorIndex(e, null));
p.initCause(e);
throw p;</BUG>
}
| @Override
public final Calendar getCalendar() {
if (calendar == null) {
calendar = Calendar.getInstance(getTimeZone(), format.getLocale());
|
59,960 | public Object parseObject(String source) throws ParseException {
source = CharSequences.trimWhitespaces(source);
try {
return valueOf(source);
} catch (NumberFormatException cause) {
<BUG>ParseException e = new LocalizedParseException(null, type, source, null);
e.initCause(cause);
throw e;</BUG>
}
| public Object parseObject(String source) throws ParseException {
source = CharSequences.trimWhitespaces(source);
try {
return valueOf(source);
} catch (NumberFormatException cause) {
throw new LocalizedParseException(null, type, source, null).initCause(cause);
|
59,961 |
private static short key(final Object[] arguments) {
</BUG>
final short key;
<BUG>switch (arguments.length) {
</BUG>
case 1: key = Errors.Keys.UnexpectedEndOfString_1; break;
case 2: key = Errors.Keys.UnparsableStringForClass_2; break;
case 3: key = Errors.Keys.UnparsableStringForClass_3; break;
default: throw new AssertionError();
| if (erroneous.length() == 0) {
return new Object[] {type, text};
}
return new Object[] {type, text, erroneous};
}
@Workaround(library="JDK", version="1.8")
private static short key(final Object[] parameters) {
final short key;
switch (parameters.length) {
case 1: key = Errors.Keys.UnexpectedEndOfString_1; break;
case 2: key = Errors.Keys.UnparsableStringForClass_2; break;
case 3: key = Errors.Keys.UnparsableStringForClass_3; break;
default: throw new AssertionError();
|
59,962 | final String classname = classe.getSimpleName();
final URL resources = classe.getResource(toResourceName(toBundleName(classname, locale), EXTENSION));
try {
return (ResourceBundle) classe.getDeclaredConstructor(URL.class).newInstance(resources);
} catch (NoSuchMethodException | InvocationTargetException e) {
<BUG>InstantiationException exception = new InstantiationException(e.toString());
exception.initCause(e);
throw exception;</BUG>
}
| final String classname = classe.getSimpleName();
final URL resources = classe.getResource(toResourceName(toBundleName(classname, locale), EXTENSION));
try {
return (ResourceBundle) classe.getDeclaredConstructor(URL.class).newInstance(resources);
} catch (NoSuchMethodException | InvocationTargetException e) {
throw (InstantiationException) new InstantiationException(e.toString()).initCause(e);
|
59,963 | private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
try {
key = getKeyConstants().getKeyValue(in.readUTF());
} catch (ReflectiveOperationException cause) {
<BUG>InvalidObjectException e = new InvalidObjectException(cause.toString());
e.initCause(cause);
throw e;</BUG>
}
| private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
try {
key = getKeyConstants().getKeyValue(in.readUTF());
} catch (ReflectiveOperationException cause) {
throw (InvalidObjectException) new InvalidObjectException(cause.toString()).initCause(cause);
|
59,964 | import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.greenaddress.greenapi.GAException;
<BUG>import com.greenaddress.greenapi.Network;
import com.greenaddress.greenapi.Output;</BUG>
import com.greenaddress.greenapi.PreparedTransaction;
import com.greenaddress.greenbits.GaService;
import com.greenaddress.greenbits.wallets.TrezorHWWallet;
| import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.greenaddress.greenapi.GAException;
import com.greenaddress.greenapi.Network;
import com.greenaddress.greenapi.JSONMap;
import com.greenaddress.greenapi.Output;
import com.greenaddress.greenapi.PreparedTransaction;
import com.greenaddress.greenbits.GaService;
import com.greenaddress.greenbits.wallets.TrezorHWWallet;
|
59,965 | if (txSize == null)
txSize = tx.getMessageSize();
final long requiredFeeDelta = txSize + tx.getInputs().size() * 4;
final List<TransactionInput> oldInputs = new ArrayList<>(tx.getInputs());
tx.clearInputs();
<BUG>for (int i = 0; i < txItem.eps.size(); ++i) {
final Map<String, Object> ep = (Map) txItem.eps.get(i);
if (((Boolean) ep.get("is_credit"))) continue;
final TransactionInput oldInput = oldInputs.get((Integer) ep.get("pt_idx"));
</BUG>
final TransactionInput newInput = new TransactionInput(
| if (txSize == null)
txSize = tx.getMessageSize();
final long requiredFeeDelta = txSize + tx.getInputs().size() * 4;
final List<TransactionInput> oldInputs = new ArrayList<>(tx.getInputs());
tx.clearInputs();
for (final JSONMap ep : txItem.eps) {
if (ep.getBool("is_credit"))
continue;
final TransactionInput oldInput = oldInputs.get(ep.getInt("pt_idx"));
final TransactionInput newInput = new TransactionInput(
|
59,966 | final TransactionInput newInput = new TransactionInput(
Network.NETWORK,
null,
oldInput.getScriptBytes(),
oldInput.getOutpoint(),
<BUG>Coin.valueOf(Long.valueOf((String) ep.get("value")))
);</BUG>
newInput.setSequenceNumber(0);
tx.addInput(newInput);
}
| final TransactionInput newInput = new TransactionInput(
Network.NETWORK,
null,
oldInput.getScriptBytes(),
oldInput.getOutpoint(),
ep.getCoin("value")
);
newInput.setSequenceNumber(0);
tx.addInput(newInput);
}
|
59,967 | new CB.Toast<ArrayList>(TransactionActivity.this) {
@Override
public void onSuccess(final ArrayList result) {
Coin remaining = finalRemaining;
final List<ListenableFuture<byte[]>> scripts = new ArrayList<>();
<BUG>final List<Map<String, Object>> moreInputs = new ArrayList<>();
for (final Object utxo_ : result) {
final Map<String, Object> utxo = (Map) utxo_;
remaining = remaining.subtract(Coin.valueOf(Long.valueOf((String)utxo.get("value"))));
scripts.add(mService.createOutScript((Integer)utxo.get("subaccount"), (Integer)utxo.get("pointer")));
</BUG>
moreInputs.add(utxo);
| new CB.Toast<ArrayList>(TransactionActivity.this) {
@Override
public void onSuccess(final ArrayList result) {
Coin remaining = finalRemaining;
final List<ListenableFuture<byte[]>> scripts = new ArrayList<>();
final List<JSONMap> moreInputs = new ArrayList<>();
for (final Object o : result) {
final JSONMap utxo = new JSONMap((Map<String, Object>) o);
remaining = remaining.subtract(utxo.getCoin("value"));
scripts.add(mService.createOutScript(utxo.getInt("subaccount"), utxo.getInt("pointer")));
moreInputs.add(utxo);
|
59,968 | oldInput.getValue().longValue()
));
}
int i = 0;
if (moreInputs != null) {
<BUG>for (final Map<String, Object> ep : moreInputs) {
</BUG>
ptx.mPrevOutputs.add(new Output(
<BUG>(Integer) ep.get("subaccount"),
(Integer) ep.get("pointer"),
1,</BUG>
TransactionItem.P2SH_FORTIFIED_OUT,
| oldInput.getValue().longValue()
));
}
int i = 0;
if (moreInputs != null) {
for (final JSONMap ep : moreInputs) {
ptx.mPrevOutputs.add(new Output(
ep.getInt("subaccount"),
ep.getInt("pointer"),
1,
TransactionItem.P2SH_FORTIFIED_OUT,
|
59,969 | public PeerGroup getSPVPeerGroup() { return mSPV.getPeerGroup(); }
public int getSPVHeight() { return mSPV.getSPVHeight(); }
public int getSPVBlocksRemaining() { return mSPV.getSPVBlocksRemaining(); }
public Coin getSPVVerifiedBalance(final int subAccount) {
final Coin balance = mSPV.getVerifiedBalance(subAccount);
<BUG>return balance == null ? Coin.valueOf(0) : balance;
</BUG>
}
public boolean isSPVVerified(final Sha256Hash txHash) { return mSPV.isVerified(txHash); }
public void enableSPVPingMonitoring() { mSPV.enablePingMonitoring(); }
| public PeerGroup getSPVPeerGroup() { return mSPV.getPeerGroup(); }
public int getSPVHeight() { return mSPV.getSPVHeight(); }
public int getSPVBlocksRemaining() { return mSPV.getSPVBlocksRemaining(); }
public Coin getSPVVerifiedBalance(final int subAccount) {
final Coin balance = mSPV.getVerifiedBalance(subAccount);
return balance == null ? Coin.ZERO : balance;
}
public boolean isSPVVerified(final Sha256Hash txHash) { return mSPV.isVerified(txHash); }
public void enableSPVPingMonitoring() { mSPV.enablePingMonitoring(); }
|
59,970 | private void setAccountTitle(final int subAccount) {
String suffix = "";
if (mService.showBalanceInTitle()) {
Coin balance = mService.getCoinBalance(subAccount);
if (balance == null)
<BUG>balance = Coin.valueOf(0);
</BUG>
suffix = formatValuePostfix(balance);
} else if (mService.haveSubaccounts()) {
final Map<String, ?> m = mService.findSubaccount(subAccount);
| private void setAccountTitle(final int subAccount) {
String suffix = "";
if (mService.showBalanceInTitle()) {
Coin balance = mService.getCoinBalance(subAccount);
if (balance == null)
balance = Coin.ZERO;
suffix = formatValuePostfix(balance);
} else if (mService.haveSubaccounts()) {
final Map<String, ?> m = mService.findSubaccount(subAccount);
|
59,971 | package org.opennms.netmgt.collectd;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Iterator;
<BUG>import java.util.List;
import org.opennms.netmgt.mock.OpenNMSTestCase;</BUG>
import org.opennms.netmgt.utils.BarrierSignaler;
import org.opennms.protocols.snmp.SnmpCounter32;
import org.opennms.protocols.snmp.SnmpGauge32;
| package org.opennms.netmgt.collectd;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.TreeMap;
import org.opennms.netmgt.mock.OpenNMSTestCase;
import org.opennms.netmgt.utils.BarrierSignaler;
import org.opennms.protocols.snmp.SnmpCounter32;
import org.opennms.protocols.snmp.SnmpGauge32;
|
59,972 | import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
<BUG>import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;</BUG>
public final class PatchUtils {
| import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
public final class PatchUtils {
|
59,973 | package org.jboss.as.patching;
import org.jboss.as.controller.AttributeDefinition;
<BUG>import org.jboss.as.controller.SimpleAttributeDefinition;</BUG>
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.dmr.ModelType;
<BUG>class Constants {
</BUG>
static final AttributeDefinition PATCH_ID = SimpleAttributeDefinitionBuilder.create("patch-id", ModelType.STRING).build();
| package org.jboss.as.patching;
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.dmr.ModelType;
public class Constants {
|
59,974 | package org.jboss.as.patching;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.patching.runner.PatchingException;
import org.jboss.logging.Messages;
import org.jboss.logging.annotations.Message;
<BUG>import org.jboss.logging.annotations.MessageBundle;
import java.io.IOException;</BUG>
import java.util.List;
@MessageBundle(projectCode = "JBAS")
public interface PatchMessages {
| package org.jboss.as.patching;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.patching.runner.PatchingException;
import org.jboss.logging.Messages;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageBundle;
import org.jboss.logging.annotations.Cause;
import java.io.IOException;
import java.util.List;
@MessageBundle(projectCode = "JBAS")
public interface PatchMessages {
|
59,975 | package org.jboss.as.patching.runner;
<BUG>import org.jboss.as.boot.DirectoryStructure;
import org.jboss.as.patching.LocalPatchInfo;</BUG>
import org.jboss.as.patching.PatchInfo;
import org.jboss.as.patching.PatchLogger;
import org.jboss.as.patching.PatchMessages;
| package org.jboss.as.patching.runner;
import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp;
import org.jboss.as.boot.DirectoryStructure;
import org.jboss.as.patching.CommonAttributes;
import org.jboss.as.patching.LocalPatchInfo;
import org.jboss.as.patching.PatchInfo;
import org.jboss.as.patching.PatchLogger;
import org.jboss.as.patching.PatchMessages;
|
59,976 | private static final String PATH_DELIMITER = "/";
public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT;
enum Element {
ADDED_BUNDLE("added-bundle"),
ADDED_MISC_CONTENT("added-misc-content"),
<BUG>ADDED_MODULE("added-module"),
BUNDLES("bundles"),</BUG>
CUMULATIVE("cumulative"),
DESCRIPTION("description"),
MISC_FILES("misc-files"),
| private static final String PATH_DELIMITER = "/";
public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT;
enum Element {
ADDED_BUNDLE("added-bundle"),
ADDED_MISC_CONTENT("added-misc-content"),
ADDED_MODULE("added-module"),
APPLIES_TO_VERSION("applies-to-version"),
BUNDLES("bundles"),
CUMULATIVE("cumulative"),
DESCRIPTION("description"),
MISC_FILES("misc-files"),
|
59,977 | writer.writeEndElement();
final Patch.PatchType type = patch.getPatchType();
<BUG>final List<String> appliesTo = patch.getAppliesTo();</BUG>
if(type == Patch.PatchType.ONE_OFF) {
<BUG>writer.writeEmptyElement(Element.ONE_OFF.name);
</BUG>
} else {
<BUG>writer.writeEmptyElement(Element.CUMULATIVE.name);
</BUG>
writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion());
| writer.writeEndElement();
writer.writeStartElement(Element.DESCRIPTION.name);
writer.writeCharacters(patch.getDescription());
writer.writeEndElement();
final Patch.PatchType type = patch.getPatchType();
if(type == Patch.PatchType.ONE_OFF) {
writer.writeStartElement(Element.ONE_OFF.name);
} else {
writer.writeStartElement(Element.CUMULATIVE.name);
writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion());
|
59,978 | } else {
<BUG>writer.writeEmptyElement(Element.CUMULATIVE.name);
</BUG>
writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion());
}
<BUG>writer.writeAttribute(Attribute.APPLIES_TO_VERSION.name, appliesTo);
final List<ContentModification> bundlesAdd = new ArrayList<ContentModification>();</BUG>
final List<ContentModification> bundlesUpdate = new ArrayList<ContentModification>();
final List<ContentModification> bundlesRemove = new ArrayList<ContentModification>();
final List<ContentModification> miscAdd = new ArrayList<ContentModification>();
| } else {
writer.writeStartElement(Element.CUMULATIVE.name);
writer.writeAttribute(Attribute.RESULTING_VERSION.name, patch.getResultingVersion());
}
writeAppliesToVersions(writer, patch.getAppliesTo());
writer.writeEndElement(); // </one-off> or </cumulative>
final List<ContentModification> bundlesAdd = new ArrayList<ContentModification>();
final List<ContentModification> bundlesUpdate = new ArrayList<ContentModification>();
final List<ContentModification> bundlesRemove = new ArrayList<ContentModification>();
final List<ContentModification> miscAdd = new ArrayList<ContentModification>();
|
59,979 | final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
<BUG>case APPLIES_TO_VERSION:
builder.addAppliesTo(value);
break;</BUG>
case RESULTING_VERSION:
if(type == Patch.PatchType.CUMULATIVE) {
| final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case RESULTING_VERSION:
if(type == Patch.PatchType.CUMULATIVE) {
|
59,980 | final StringBuilder path = new StringBuilder();
for(final String p : item.getPath()) {
path.append(p).append(PATH_DELIMITER);
}
path.append(item.getName());
<BUG>writer.writeAttribute(Attribute.PATH.name, path.toString());
if(type != ModificationType.REMOVE) {</BUG>
writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash()));
}
if(type != ModificationType.ADD) {
| final StringBuilder path = new StringBuilder();
for(final String p : item.getPath()) {
path.append(p).append(PATH_DELIMITER);
}
path.append(item.getName());
writer.writeAttribute(Attribute.PATH.name, path.toString());
if (item.isDirectory()) {
writer.writeAttribute(Attribute.DIRECTORY.name, "true");
}
if(type != ModificationType.REMOVE) {
writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash()));
}
if(type != ModificationType.ADD) {
|
59,981 | protected CompilationResult compilationResult = null;
protected boolean isSolution = false;
protected int lastGenAnalyzed = 0;
protected Date bornDate = new Date();
protected List<CtClass> modifiedClasses = new ArrayList<CtClass>();
<BUG>ProgramVariantValidationResult validationResult = null;
public ProgramVariant(){</BUG>
modificationPoints = new ArrayList<ModificationPoint>();
operations = new HashMap<Integer,List<OperatorInstance>>();
}
| protected CompilationResult compilationResult = null;
protected boolean isSolution = false;
protected int lastGenAnalyzed = 0;
protected Date bornDate = new Date();
protected List<CtClass> modifiedClasses = new ArrayList<CtClass>();
VariantValidationResult validationResult = null;
public ProgramVariant(){
modificationPoints = new ArrayList<ModificationPoint>();
operations = new HashMap<Integer,List<OperatorInstance>>();
}
|
59,982 | return modifiedClasses;
}
public void setModifiedClasses(List<CtClass> resultedClasses) {
this.modifiedClasses = resultedClasses;
}
<BUG>public ProgramVariantValidationResult getValidationResult() {
return validationResult;</BUG>
}
<BUG>public void setValidationResult(ProgramVariantValidationResult validationResult) {
this.validationResult = validationResult;</BUG>
}
| return modifiedClasses;
}
public void setModifiedClasses(List<CtClass> resultedClasses) {
this.modifiedClasses = resultedClasses;
}
public VariantValidationResult getValidationResult() {
return validationResult;
}
public void setValidationResult(VariantValidationResult validationResult) {
this.validationResult = validationResult;
}
|
59,983 | ConfigurationProperties.setProperty("forceExecuteRegression", Boolean.TRUE.toString());
boolean validInstance = validateInstance(originalVariant);
if (validInstance) {
throw new IllegalStateException("The application under repair has not failling test cases");
}
<BUG>double fitness = originalVariant.getFitness();
log.debug("The original fitness is : "+fitness);</BUG>
for (ProgramVariant initvariant : variants) {
initvariant.setFitness(fitness);
}
| ConfigurationProperties.setProperty("forceExecuteRegression", Boolean.TRUE.toString());
boolean validInstance = validateInstance(originalVariant);
if (validInstance) {
throw new IllegalStateException("The application under repair has not failling test cases");
}
double fitness = this.fitnessFunction.calculateFitnessValue(originalVariant);
originalVariant.setFitness(fitness);
log.debug("The original fitness is : "+fitness);
for (ProgramVariant initvariant : variants) {
initvariant.setFitness(fitness);
}
|
59,984 | package fr.inria.astor.core.validation.validators;
<BUG>import fr.inria.astor.core.entities.ProgramVariantValidationResult;
</BUG>
public class EvoSuiteValidationResult extends CompoundValidationResult {
<BUG>public ProgramVariantValidationResult getFailingTestValidation() {
</BUG>
return this.validations.get("failing");
| package fr.inria.astor.core.validation.validators;
import fr.inria.astor.core.entities.TestCaseVariantValidationResult;
public class EvoSuiteValidationResult extends CompoundValidationResult {
public TestCaseVariantValidationResult getFailingTestValidation() {
return this.validations.get("failing");
|
59,985 | public class EvoSuiteValidationResult extends CompoundValidationResult {
<BUG>public ProgramVariantValidationResult getFailingTestValidation() {
</BUG>
return this.validations.get("failing");
}
<BUG>public void setFailingTestValidation(ProgramVariantValidationResult evoValidation) {
</BUG>
this.addValidation("failing", evoValidation);
}
<BUG>public ProgramVariantValidationResult getEvoValidation() {
</BUG>
return this.validations.get("evo");
| public class EvoSuiteValidationResult extends CompoundValidationResult {
public TestCaseVariantValidationResult getFailingTestValidation() {
return this.validations.get("failing");
|
59,986 | +((this.getManualTestValidation() != null)?"\nmanual_regression: "+(getManualTestValidation()):"")
+((getEvoValidation() != null)?"\nevo_regression: "+ (getEvoValidation()):"")
;
}
@Override
<BUG>public boolean wasSuccessful() {
return (getValidation("failing") == null || getValidation("failing").wasSuccessful())
</BUG>
;
| +((this.getManualTestValidation() != null)?"\nmanual_regression: "+(getManualTestValidation()):"")
+((getEvoValidation() != null)?"\nevo_regression: "+ (getEvoValidation()):"")
;
|
59,987 | import org.apache.log4j.Logger;
import com.martiansoftware.jsap.JSAPException;
import fr.inria.astor.core.entities.OperatorInstance;
import fr.inria.astor.core.entities.ModificationPoint;
import fr.inria.astor.core.entities.ProgramVariant;
<BUG>import fr.inria.astor.core.entities.ProgramVariantValidationResult;
import fr.inria.astor.core.entities.SuspiciousModificationPoint;</BUG>
import fr.inria.astor.core.entities.WeightCtElement;
import fr.inria.astor.core.faultlocalization.FaultLocalizationStrategy;
<BUG>import fr.inria.astor.core.loop.extension.SolutionVariantSortCriterion;
import fr.inria.astor.core.loop.population.PopulationController;</BUG>
import fr.inria.astor.core.loop.population.ProgramVariantFactory;
| import org.apache.log4j.Logger;
import com.martiansoftware.jsap.JSAPException;
import fr.inria.astor.core.entities.OperatorInstance;
import fr.inria.astor.core.entities.ModificationPoint;
import fr.inria.astor.core.entities.ProgramVariant;
import fr.inria.astor.core.entities.VariantValidationResult;
import fr.inria.astor.core.entities.SuspiciousModificationPoint;
import fr.inria.astor.core.entities.WeightCtElement;
import fr.inria.astor.core.faultlocalization.FaultLocalizationStrategy;
import fr.inria.astor.core.loop.extension.SolutionVariantSortCriterion;
import fr.inria.astor.core.loop.population.FitnessFunction;
import fr.inria.astor.core.loop.population.PopulationController;
import fr.inria.astor.core.loop.population.ProgramVariantFactory;
|
59,988 | protected MutationSupporter mutatorSupporter = null;
protected ProjectRepairFacade projectFacade = null;
protected Date dateInitEvolution = new Date();
protected FaultLocalizationStrategy faultLocalization = null;
protected int generationsExecuted = 0;
<BUG>protected SolutionVariantSortCriterion patchSortCriterion = null;
public AstorCoreEngine(MutationSupporter mutatorExecutor, ProjectRepairFacade projFacade) throws JSAPException {</BUG>
this.mutatorSupporter = mutatorExecutor;
this.projectFacade = projFacade;
this.currentStat = Stats.getCurrentStats();
| protected MutationSupporter mutatorSupporter = null;
protected ProjectRepairFacade projectFacade = null;
protected Date dateInitEvolution = new Date();
protected FaultLocalizationStrategy faultLocalization = null;
protected int generationsExecuted = 0;
protected SolutionVariantSortCriterion patchSortCriterion = null;
protected FitnessFunction fitnessFunction = null;
public AstorCoreEngine(MutationSupporter mutatorExecutor, ProjectRepairFacade projFacade) throws JSAPException {
this.mutatorSupporter = mutatorExecutor;
this.projectFacade = projFacade;
this.currentStat = Stats.getCurrentStats();
|
59,989 | protected abstract void applyPreviousMutationOperationToSpoonElement(OperatorInstance operation)
throws IllegalAccessException;
protected abstract void applyNewMutationOperationToSpoonElement(OperatorInstance operation)
throws IllegalAccessException;
protected boolean validateInstance(ProgramVariant variant) {
<BUG>ProgramVariantValidationResult validationResult;
if ((validationResult = programValidator.validate(variant, projectFacade)) != null) {
double fitness = this.populationControler.getFitnessValue(variant, validationResult);
variant.setFitness(fitness);
boolean wasSuc = validationResult.wasSuccessful();
</BUG>
variant.setIsSolution(wasSuc);
| protected abstract void applyPreviousMutationOperationToSpoonElement(OperatorInstance operation)
throws IllegalAccessException;
protected abstract void applyNewMutationOperationToSpoonElement(OperatorInstance operation)
throws IllegalAccessException;
protected boolean validateInstance(ProgramVariant variant) {
VariantValidationResult validationResult;
if ((validationResult = programValidator.validate(variant, projectFacade)) != null) {
boolean wasSuc = validationResult.isSuccessful();
variant.setIsSolution(wasSuc);
|
59,990 | package fr.inria.astor.core.validation.validators;
import java.util.HashMap;
import java.util.Map;
<BUG>import fr.inria.astor.core.entities.ProgramVariantValidationResult;
public class CompoundValidationResult extends ProgramVariantValidationResult {
protected Map<String,ProgramVariantValidationResult> validations = new HashMap<>();
</BUG>
public CompoundValidationResult() {
| package fr.inria.astor.core.validation.validators;
import java.util.HashMap;
import java.util.Map;
import fr.inria.astor.core.entities.TestCaseVariantValidationResult;
public class CompoundValidationResult implements TestCaseVariantValidationResult {
protected Map<String,TestCaseVariantValidationResult> validations = new HashMap<>();
public CompoundValidationResult() {
|
59,991 |
protected Map<String,ProgramVariantValidationResult> validations = new HashMap<>();
</BUG>
public CompoundValidationResult() {
}
<BUG>public void addValidation(String mode, ProgramVariantValidationResult p){
</BUG>
this.validations.put(mode, p);
}
<BUG>public ProgramVariantValidationResult getValidation(String mode){
</BUG>
return this.validations.get(mode);
| package fr.inria.astor.core.validation.validators;
import java.util.HashMap;
import java.util.Map;
import fr.inria.astor.core.entities.TestCaseVariantValidationResult;
public class CompoundValidationResult implements TestCaseVariantValidationResult {
protected Map<String,TestCaseVariantValidationResult> validations = new HashMap<>();
public CompoundValidationResult() {
|
59,992 | public void setRegressionExecuted(boolean regressionExecuted) {
}
@Override
public int getPassingTestCases() {
int count = 0;
<BUG>for (ProgramVariantValidationResult pv : this.validations.values()) {
</BUG>
count+= pv.getPassingTestCases();
}
return count;
| public void setRegressionExecuted(boolean regressionExecuted) {
}
@Override
public int getPassingTestCases() {
int count = 0;
for (TestCaseVariantValidationResult pv : this.validations.values()) {
count+= pv.getPassingTestCases();
}
return count;
|
59,993 | solutionVariant.getOperations().put(generationsExecuted, Arrays.asList(pointOperation));
applyNewMutationOperationToSpoonElement(pointOperation);
boolean solution = processCreatedVariant(solutionVariant, generationsExecuted);
if (solution) {
this.solutions.add(solutionVariant);
<BUG>if (ConfigurationProperties.getPropertyBool("stopfirst"))
System.out.println(" modpoint analyzed "+modifPointsAnalyzed + ", operators "+operatorExecuted);
}</BUG>
undoOperationToSpoonElement(pointOperation);
| solutionVariant.getOperations().put(generationsExecuted, Arrays.asList(pointOperation));
applyNewMutationOperationToSpoonElement(pointOperation);
boolean solution = processCreatedVariant(solutionVariant, generationsExecuted);
if (solution) {
this.solutions.add(solutionVariant);
if (ConfigurationProperties.getPropertyBool("stopfirst")){
log.debug(" modpoint analyzed "+modifPointsAnalyzed + ", operators "+operatorExecuted);
return;
}
}
undoOperationToSpoonElement(pointOperation);
|
59,994 | BufferedImage image = document.getValue();
if (image != null) {
paintBorder(g, ic);
Dimension size = ic.getCanvasSize();
Graphics igc = g.create(2, 2, size.width, size.height);
<BUG>if (ic.isTransparencyChessboardVisible()) {
paintChessboard(igc, ic);</BUG>
}
paintImage(igc, ic);
if (ic.isGridVisible()) {
| BufferedImage image = document.getValue();
if (image != null) {
paintBorder(g, ic);
Dimension size = ic.getCanvasSize();
Graphics igc = g.create(2, 2, size.width, size.height);
if (ic.isTransparencyChessboardVisible() && image.getTransparency() != Transparency.OPAQUE) {
paintChessboard(igc, ic);
}
paintImage(igc, ic);
if (ic.isGridVisible()) {
|
59,995 | }
igc.dispose();
}
}
}
<BUG>private void paintBorder(Graphics g, ImageComponent ic) {
</BUG>
Dimension size = ic.getSize();
g.setColor(ic.getTransparencyChessboardBlackColor());
g.drawRect(0, 0, size.width - 1, size.height - 1);
| }
paintImage(igc, ic);
if (ic.isGridVisible()) {
paintGrid(igc, ic);
}
igc.dispose();
}
}
}
private static void paintBorder(Graphics g, ImageComponent ic) {
Dimension size = ic.getSize();
g.setColor(ic.getTransparencyChessboardBlackColor());
g.drawRect(0, 0, size.width - 1, size.height - 1);
|
59,996 | g.drawRect(0, 0, size.width - 1, size.height - 1);
}
private void paintChessboard(Graphics g, ImageComponent ic) {
Dimension size = ic.getCanvasSize();
int cellSize = ic.getTransparencyChessboardCellSize();
<BUG>int patternSize = 2 * cellSize;
BufferedImage pattern = UIUtil.createImage(patternSize, patternSize, BufferedImage.TYPE_INT_ARGB);
Graphics imageGraphics = pattern.getGraphics();</BUG>
imageGraphics.setColor(ic.getTransparencyChessboardWhiteColor());
imageGraphics.fillRect(0, 0, patternSize, patternSize);
| g.drawRect(0, 0, size.width - 1, size.height - 1);
}
private void paintChessboard(Graphics g, ImageComponent ic) {
Dimension size = ic.getCanvasSize();
int cellSize = ic.getTransparencyChessboardCellSize();
int patternSize = 2 * cellSize;
if (pattern == null) {
pattern = UIUtil.createImage(patternSize, patternSize, BufferedImage.TYPE_INT_ARGB);
Graphics imageGraphics = pattern.getGraphics();
imageGraphics.setColor(ic.getTransparencyChessboardWhiteColor());
imageGraphics.fillRect(0, 0, patternSize, patternSize);
|
59,997 | g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
g.drawImage(document.getRenderer(), 0, 0, size.width, size.height, ic);
</BUG>
g2d.setRenderingHints(oldHints);
}
<BUG>private void paintGrid(Graphics g, ImageComponent ic) {
</BUG>
Dimension size = ic.getCanvasSize();
BufferedImage image = ic.getDocument().getValue();
int imageWidth = image.getWidth();
| g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
} else {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
}
g.drawImage(renderer, 0, 0, size.width, size.height, ic);
g2d.setRenderingHints(oldHints);
}
private static void paintGrid(Graphics g, ImageComponent ic) {
Dimension size = ic.getCanvasSize();
BufferedImage image = ic.getDocument().getValue();
int imageWidth = image.getWidth();
|
59,998 | import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.List;
public class ImageComponent extends JComponent {
@NonNls
<BUG>private static final String TRANSPARENCY_CHESSBOARD_CELL_SIZE_PROP = "TransparencyChessboard.cellSize";
</BUG>
@NonNls
<BUG>private static final String TRANSPARENCY_CHESSBOARD_WHITE_COLOR_PROP = "TransparencyChessboard.whiteColor";
</BUG>
@NonNls
| import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.List;
public class ImageComponent extends JComponent {
|
59,999 | @NonNls
<BUG>private static final String TRANSPARENCY_CHESSBOARD_WHITE_COLOR_PROP = "TransparencyChessboard.whiteColor";
</BUG>
@NonNls
<BUG>private static final String TRANSPARENCY_CHESSBOARD_BLACK_COLOR_PROP = "TransparencyChessboard.blackColor";
</BUG>
@NonNls
private static final String TRANSPARENCY_CHESSBOARD_VISIBLE_PROP = "TransparencyChessboard.visible";
@NonNls
private static final String GRID_LINE_ZOOM_FACTOR_PROP = "Grid.lineZoomFactor";
| @NonNls
public static final String TRANSPARENCY_CHESSBOARD_CELL_SIZE_PROP = "TransparencyChessboard.cellSize";
@NonNls
public static final String TRANSPARENCY_CHESSBOARD_WHITE_COLOR_PROP = "TransparencyChessboard.whiteColor";
@NonNls
public static final String TRANSPARENCY_CHESSBOARD_BLACK_COLOR_PROP = "TransparencyChessboard.blackColor";
@NonNls
private static final String TRANSPARENCY_CHESSBOARD_VISIBLE_PROP = "TransparencyChessboard.visible";
@NonNls
private static final String GRID_LINE_ZOOM_FACTOR_PROP = "Grid.lineZoomFactor";
|
60,000 | package org.intellij.plugins.intelliLang.pattern;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ProblemsHolder;
<BUG>import com.intellij.ide.DataManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;</BUG>
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtil;
| package org.intellij.plugins.intelliLang.pattern;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.ide.DataManager;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.AsyncResult;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtil;
|
Subsets and Splits