id
int64 1
49k
| buggy
stringlengths 34
37.5k
| fixed
stringlengths 2
37k
|
---|---|---|
47,501 | public boolean areEqual(TerminationPoint updated, TerminationPoint orig) {
HwvtepPhysicalLocatorAugmentation updatedPhysicalLocator =
updated.getAugmentation(HwvtepPhysicalLocatorAugmentation.class);
HwvtepPhysicalLocatorAugmentation origPhysicalLocator =
orig.getAugmentation(HwvtepPhysicalLocatorAugmentation.class);
<BUG>if (updatedPhysicalLocator.getDstIp().equals(origPhysicalLocator.getDstIp())
&& (updatedPhysicalLocator.getEncapsulationType() == origPhysicalLocator.getEncapsulationType())) {
return true;
}
return false;</BUG>
}
| return updatedPhysicalLocator.getDstIp().equals(origPhysicalLocator.getDstIp())
&& (updatedPhysicalLocator.getEncapsulationType() == origPhysicalLocator.getEncapsulationType());
|
47,502 | NeutronNetworkInterface(final DataBroker dataBroker) {
super(dataBroker);
}
@Override
public boolean networkExists(String uuid) {
<BUG>Network network = readMd(createInstanceIdentifier(toMd(uuid)));
if (network == null) {
return false;
}
return true;</BUG>
}
| [DELETED] |
47,503 | updateMd(delta);
return true;
}
@Override
public boolean networkInUse(String netUUID) {
<BUG>if (!networkExists(netUUID)) {
return true;
}
return false;</BUG>
}
| return !networkExists(netUUID);
|
47,504 | return learntIpToPortOpt.get().getMacAddress();
}
LOG.error("No resolution was found to GW ip {} in subnet {}", gatewayIp, subnetId.getValue());
return null;
}
<BUG>public static boolean isIPv6Subnet(String prefix) {
IpPrefix ipPrefix = new IpPrefix(prefix.toCharArray());
if (ipPrefix.getIpv6Prefix() != null) {
return true;
}
return false;</BUG>
}
| return new IpPrefix(prefix.toCharArray()).getIpv6Prefix() != null;
|
47,505 | public boolean areEqual(LocalUcastMacs updated, LocalUcastMacs orig) {
InstanceIdentifier<?> updatedMacRefIdentifier = updated.getLogicalSwitchRef().getValue();
HwvtepNodeName updatedMacNodeName = updatedMacRefIdentifier
.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName();
InstanceIdentifier<?> origMacRefIdentifier = orig.getLogicalSwitchRef().getValue();
<BUG>HwvtepNodeName origMacNodeName = origMacRefIdentifier.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName();
if (updated.getMacEntryKey().equals(orig.getMacEntryKey())
&& updatedMacNodeName.equals(origMacNodeName)) {
return true;
}
return false;</BUG>
}
| return updated.getMacEntryKey().equals(orig.getMacEntryKey()) && updatedMacNodeName.equals(origMacNodeName);
|
47,506 | availableGlobalNodes.put(globalId, Boolean.TRUE);
}
}
boolean areBothGlobalAndPsNodeAvailable(InstanceIdentifier<Node> key) {
String id = key.firstKeyOf(Node.class).getNodeId().getValue();
<BUG>String psId = null;
String globalId = null;
if (id.indexOf(HwvtepHAUtil.PHYSICALSWITCH) > 0) {
psId = id;</BUG>
globalId = id.substring(0, id.indexOf(HwvtepHAUtil.PHYSICALSWITCH));
| String globalId;
|
47,507 | psId = id;</BUG>
globalId = id.substring(0, id.indexOf(HwvtepHAUtil.PHYSICALSWITCH));
} else {
globalId = id;
}
<BUG>if (availableGlobalNodes.containsKey(globalId) && availablePsNodes.containsKey(globalId)) {
return true;
}
return false;</BUG>
}
| availableGlobalNodes.put(globalId, Boolean.TRUE);
boolean areBothGlobalAndPsNodeAvailable(InstanceIdentifier<Node> key) {
String id = key.firstKeyOf(Node.class).getNodeId().getValue();
String globalId;
if (id.indexOf(HwvtepHAUtil.PHYSICALSWITCH) > 0) {
return availableGlobalNodes.containsKey(globalId) && availablePsNodes.containsKey(globalId);
|
47,508 | 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.*;
|
47,509 | .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);
|
47,510 | </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) {
|
47,511 | 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)
|
47,512 | .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))
|
47,513 | .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))
|
47,514 | @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;
|
47,515 | 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;
}
|
47,516 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
47,517 | 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.*;
|
47,518 | .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))
|
47,519 | 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) -> {
|
47,520 | 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);
|
47,521 | 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);
|
47,522 | 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() + "\"");
|
47,523 | 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() + "\"");
|
47,524 | 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
|
47,525 | .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")
|
47,526 | chart.addYAxisLabels(AxisLabelsFactory.newAxisLabels(labels));
chart.addXAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, max));
chart.setBarWidth(BarChart.AUTO_RESIZE);
chart.setSize(600, 500);
chart.setHorizontal(true);
<BUG>chart.setTitle("Total Evaluations by User");
showChartImg(resp, chart.toURLString());
}</BUG>
private List<Entry<String, Integer>> sortEntries(Collection<Entry<String, Integer>> entries) {
List<Entry<String, Integer>> result = new ArrayList<Entry<String, Integer>>(entries);
| chart.setDataEncoding(DataEncoding.TEXT);
return chart;
}
|
47,527 | checkEvaluationsEqual(eval4, foundissueProto.getEvaluations(0));
checkEvaluationsEqual(eval5, foundissueProto.getEvaluations(1));
}
public void testGetRecentEvaluationsNoneFound() throws Exception {
DbIssue issue = createDbIssue("fad", persistenceHelper);
<BUG>DbEvaluation eval1 = createEvaluation(issue, "someone", 100);
DbEvaluation eval2 = createEvaluation(issue, "someone", 200);
DbEvaluation eval3 = createEvaluation(issue, "someone", 300);
issue.addEvaluations(eval1, eval2, eval3);</BUG>
getPersistenceManager().makePersistent(issue);
| [DELETED] |
47,528 | public int read() throws IOException {
return inputStream.read();
}
});
}
<BUG>}
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {</BUG>
DbUser user;
Query query = getPersistenceManager().newQuery("select from " + persistenceHelper.getDbUserClass().getName()
+ " where openid == :myopenid");
| @SuppressWarnings({"unchecked"})
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {
|
47,529 | eval.setComment("my comment");
eval.setDesignation("MUST_FIX");
eval.setIssue(issue);
eval.setWhen(when);
eval.setWho(user.createKeyObject());
<BUG>eval.setEmail(who);
return eval;</BUG>
}
protected PersistenceManager getPersistenceManager() {
return testHelper.getPersistenceManager();
| issue.addEvaluation(eval);
return eval;
|
47,530 | import org.opendaylight.controller.sal.action.Action;
import org.opendaylight.controller.sal.action.Output;
import org.opendaylight.controller.sal.core.ConstructionException;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.core.NodeConnector;
<BUG>import org.opendaylight.controller.sal.flowprogrammer.Flow;
import org.opendaylight.controller.sal.match.Match;</BUG>
import org.opendaylight.controller.sal.match.MatchType;
import org.opendaylight.controller.sal.reader.FlowOnNode;
import org.opendaylight.controller.sal.utils.EtherTypes;
| import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService;
import org.opendaylight.controller.sal.match.Match;
|
47,531 | import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.snmp4sdn.core.internal.Controller;
import org.opendaylight.snmp4sdn.core.internal.SwitchHandler;
import org.opendaylight.snmp4sdn.internal.DiscoveryService;
<BUG>import org.opendaylight.snmp4sdn.eth.util.HexString;
</BUG>
@RunWith(PaxExam.class)
public class FlowProgrammerIT {
private Logger log = LoggerFactory.getLogger(FlowProgrammerIT.class);
| import org.opendaylight.snmp4sdn.protocol.util.HexString;
|
47,532 | 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.*;
|
47,533 | .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);
|
47,534 | </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) {
|
47,535 | 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)
|
47,536 | .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))
|
47,537 | .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))
|
47,538 | @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;
|
47,539 | 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;
}
|
47,540 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
47,541 | 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.*;
|
47,542 | .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))
|
47,543 | 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) -> {
|
47,544 | 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);
|
47,545 | 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);
|
47,546 | 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() + "\"");
|
47,547 | 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() + "\"");
|
47,548 | 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
|
47,549 | .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")
|
47,550 | public class Relationship {
private static final int ARROWHEAD_LENGTH = 10;</BUG>
private static final int ARROWHEAD_WIDTH = ARROWHEAD_LENGTH / 2;
private Line edge;
private HTML label;
<BUG>private Widget from;
private Widget to;
</BUG>
private Line arrowheadLeft;
| package org.neo4j.server.ext.visualization.gwt.client;
import org.vaadin.gwtgraphics.client.Line;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.HTML;
private static final int ARROWHEAD_LENGTH = 10;
private Node from;
private Node to;
|
47,551 | arrowheadRight = new Line(0, 0, 0, 0);
parent.add(arrowheadRight);
updateArrowhead();
}
private void addEdge(VGraphComponent parent) {
<BUG>edge = new Line((int) Math.round(getCenterX(from)),
(int) Math.round(getCenterY(from)),
(int) Math.round(getCenterX(to)),
(int) Math.round(getCenterY(to)));
</BUG>
parent.add(edge);
| [DELETED] |
47,552 | label = new HTML("<div style='text-align:center'>" + type + "</div>");
parent.add(label);
Style style = label.getElement().getStyle();
style.setPosition(Position.ABSOLUTE);
style.setBackgroundColor("white");
<BUG>style.setFontSize(9, Unit.PX);
</BUG>
updateLabel();
}
void update() {
| style.setFontSize(10, Unit.PX);
|
47,553 | void update() {
updateEdge();
updateLabel();
updateArrowhead();
}
<BUG>private void updateArrowhead() {
double originX = getArrowheadOrigin(getCenterX(from), getCenterX(to));
double originY = getArrowheadOrigin(getCenterY(from), getCenterY(to));
double angle = Math.atan2(getCenterY(to) - getCenterY(from),
getCenterX(to) - getCenterX(from));</BUG>
double leftX = originX
| double fromX = from.getCenterX();
double fromY = from.getCenterY();
double toX = to.getCenterX();
double toY = to.getCenterY();
double originX = getArrowheadOrigin(fromX, toX);
double originY = getArrowheadOrigin(fromY, toY);
double angle = Math.atan2(toY - fromY, toX - fromX);
|
47,554 | double rightY = originY
+ rotateY(-ARROWHEAD_LENGTH, ARROWHEAD_WIDTH, angle);
updateLine(arrowheadRight, originX, originY, rightX, rightY);
}
private void updateEdge() {
<BUG>updateLine(edge, getCenterX(from), getCenterY(from), getCenterX(to),
getCenterY(to));
</BUG>
}
| updateLine(edge, from.getCenterX(), from.getCenterY(), to.getCenterX(),
to.getCenterY());
|
47,555 | 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.text.DateFormat;
import java.util.Date;
import java.util.List;
|
47,556 | 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;
| import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp;
import org.jboss.as.patching.CommonAttributes;
import org.jboss.as.patching.LocalPatchInfo;
|
47,557 | 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 {
| import org.jboss.logging.annotations.Cause;
import java.io.IOException;
|
47,558 | package org.opencms.editors.usergenerated.client.export;
import org.opencms.editors.usergenerated.client.CmsRequestCounter;
<BUG>import org.opencms.editors.usergenerated.client.CmsRpcCallHelper;
import org.opencms.editors.usergenerated.shared.CmsFormContent;
import org.opencms.editors.usergenerated.shared.rpc.I_CmsFormEditService;
import org.opencms.editors.usergenerated.shared.rpc.I_CmsFormEditServiceAsync;
import org.opencms.util.CmsUUID;</BUG>
import org.timepedia.exporter.client.Export;
| import org.opencms.editors.usergenerated.shared.CmsFormConstants;
import org.opencms.editors.usergenerated.shared.CmsFormException;
import org.opencms.gwt.client.util.CmsDebugLog;
import org.opencms.util.CmsUUID;
|
47,559 | package org.opencms.editors.usergenerated;
import org.opencms.editors.usergenerated.shared.CmsFormConstants;
<BUG>import org.opencms.editors.usergenerated.shared.CmsFormContent;
import org.opencms.editors.usergenerated.shared.rpc.I_CmsFormEditService;</BUG>
import org.opencms.file.CmsObject;
import org.opencms.file.CmsResource;
import org.opencms.gwt.CmsGwtService;
| import org.opencms.editors.usergenerated.shared.CmsFormException;
import org.opencms.editors.usergenerated.shared.rpc.I_CmsFormEditService;
|
47,560 | private static final Log LOG = CmsLog.getLog(CmsFormEditService.class);
private static final long serialVersionUID = 5479252081304867604L;
@Override
public void checkPermissions(CmsObject cms) {
}
<BUG>public void destroySession(CmsUUID sessionId) throws CmsRpcException {
</BUG>
try {
CmsFormSession formSession = getFormSession(sessionId);
getRequest().getSession().removeAttribute("" + sessionId);
| public void destroySession(CmsUUID sessionId) throws CmsFormException {
|
47,561 | package org.opencms.editors.usergenerated.client;
import org.opencms.editors.usergenerated.client.export.CmsClientFormSession;
import org.opencms.editors.usergenerated.client.export.CmsXmlContentFormApi;
<BUG>import org.opencms.editors.usergenerated.client.export.I_CmsStringCallback;
</BUG>
import org.opencms.editors.usergenerated.shared.CmsFormConstants;
import org.opencms.util.CmsUUID;
import java.util.List;
| import org.opencms.editors.usergenerated.client.export.I_CmsErrorCallback;
|
47,562 | m_formSession = session;
}
public void uploadFields(
final Set<String> fields,
final Function<Map<String, String>, Void> filenameCallback,
<BUG>final I_CmsStringCallback errorCallback) {
</BUG>
disableAllFileFieldsExcept(fields);
final String id = CmsJsUtils.generateRandomId();
updateFormAction(id);
| final I_CmsErrorCallback errorCallback) {
|
47,563 | sessionId,
fields,
id,
new AsyncCallback<Map<String, String>>() {
public void onFailure(Throwable caught) {
<BUG>errorCallback.call(caught.getMessage());
}</BUG>
public void onSuccess(Map<String, String> fileNames) {
filenameCallback.apply(fileNames);
}
| m_formSession.getContentFormApi().handleError(caught, errorCallback);
|
47,564 | package org.opencms.editors.usergenerated.client.export;
import org.opencms.editors.usergenerated.client.CmsFormWrapper;
import org.opencms.editors.usergenerated.client.CmsJsUtils;
import org.opencms.editors.usergenerated.shared.CmsFormConstants;
<BUG>import org.opencms.editors.usergenerated.shared.CmsFormContent;
import org.opencms.util.CmsUUID;</BUG>
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
| import org.opencms.editors.usergenerated.shared.CmsFormException;
import org.opencms.util.CmsUUID;
|
47,565 | m_formWrapper.setFormSession(this);
}
public CmsUUID internalGetSessionId() {
return m_content.getSessionId();
}
<BUG>public void saveContent(final I_CmsStringCallback onSuccess, final I_CmsJavaScriptObjectCallback onFailure) {
</BUG>
m_apiRoot.getRpcHelper().executeRpc(
CmsXmlContentFormApi.SERVICE.saveContent(
m_content.getSessionId(),
| public void saveContent(final I_CmsStringCallback onSuccess, final I_CmsErrorCallback onFailure) {
|
47,566 | m_newValues.put(xpath, value);
}
public void uploadFile(
final String fieldName,
final I_CmsStringCallback fileCallback,
<BUG>I_CmsStringCallback errorCallback) {
</BUG>
Set<String> fieldSet = new HashSet<String>();
fieldSet.add(fieldName);
m_formWrapper.uploadFields(fieldSet, new Function<Map<String, String>, Void>() {
| I_CmsErrorCallback errorCallback) {
|
47,567 | }, errorCallback);
}
public void uploadFiles(
String[] fieldNames,
final I_CmsJavaScriptObjectCallback fileCallback,
<BUG>I_CmsStringCallback errorCallback) {
</BUG>
Set<String> fieldSet = new HashSet<String>();
for (String field : fieldNames) {
fieldSet.add(field);
| I_CmsErrorCallback errorCallback) {
|
47,568 | debug("Class is annotation, skipping method analysis");
return;
}
final TIntHashSet affectedFiles = new TIntHashSet(DEFAULT_SET_CAPACITY, DEFAULT_SET_LOAD_FACTOR);
Ref<ClassRepr> oldItRef = null;
<BUG>for (final MethodRepr m : diff.methods().added()) {
debug("Method: ", m.name);</BUG>
if ((it.access & Opcodes.ACC_INTERFACE) > 0 ||
(it.access & Opcodes.ACC_ABSTRACT) > 0 ||
(m.access & Opcodes.ACC_ABSTRACT) > 0) {
| for (final MethodRepr m : added) {
debug("Method: ", m.name);
|
47,569 | myFuture.affectFieldUsages(f, propagated, f.createUsage(myContext, it.name), state.myAffectedUsages, state.myDependants);
}
debug("End of removed fields processing");
return true;
}
<BUG>private boolean processChangedFields(final DiffState state, final ClassRepr.Diff diff, final ClassRepr it) {
debug("Processing changed fields:");
for (final Pair<FieldRepr, Difference> f : diff.fields().changed()) {
final Difference d = f.second;</BUG>
final FieldRepr field = f.first;
| final Collection<Pair<FieldRepr, Difference>> changed = diff.fields().changed();
if (changed.isEmpty()) {
for (final Pair<FieldRepr, Difference> f : changed) {
final Difference d = f.second;
|
47,570 | state.myAffectedUsages.add(c.createUsage());
}
}
debug("End of removed classes processing.");
}
<BUG>private void processAddedClasses(final DiffState state) {
debug("Processing added classes:");
for (final ClassRepr c : state.myClassDiff.added()) {
</BUG>
debug("Class name: ", c.name);
| final Collection<ClassRepr> addedClasses = state.myClassDiff.added();
if (addedClasses.isEmpty()) {
return;
for (final ClassRepr c : addedClasses) {
|
47,571 | });
}
});
return;
}
<BUG>}
showDialog(session, file, editorsProvider, stackFrame, evaluator, mode, text);
</BUG>
}
private static void showDialog(@NotNull XDebugSession session,
| XExpression expression = XExpressionImpl.fromText(StringUtil.notNullize(text), mode);
showDialog(session, file, editorsProvider, stackFrame, evaluator, expression);
|
47,572 | import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.CommonClassNames;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.util.TypeConversionUtil;
<BUG>import com.intellij.util.ThreeState;
import com.intellij.xdebugger.XSourcePosition;</BUG>
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
import com.intellij.xdebugger.evaluation.XInstanceEvaluator;
import com.intellij.xdebugger.frame.*;
| import com.intellij.xdebugger.XExpression;
import com.intellij.xdebugger.XSourcePosition;
|
47,573 | import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Consumer;
import com.intellij.xdebugger.XDebugSession;
<BUG>import com.intellij.xdebugger.XDebuggerManager;
import com.intellij.xdebugger.impl.XDebugSessionImpl;</BUG>
import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
import com.intellij.xdebugger.impl.frame.XWatchesView;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
| import com.intellij.xdebugger.XExpression;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
|
47,574 | import com.intellij.ui.AppUIUtil;
import com.intellij.ui.EditorTextField;
import com.intellij.ui.ScreenUtil;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.ui.popup.list.ListPopupImpl;
<BUG>import com.intellij.xdebugger.XDebuggerManager;
import com.intellij.xdebugger.breakpoints.XBreakpoint;</BUG>
import com.intellij.xdebugger.breakpoints.XBreakpointAdapter;
import com.intellij.xdebugger.breakpoints.XBreakpointListener;
import com.intellij.xdebugger.breakpoints.XBreakpointManager;
| import com.intellij.xdebugger.XExpression;
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
47,575 | package com.intellij.xdebugger.impl.ui.tree.actions;
import com.intellij.execution.console.ConsoleExecuteAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.LangDataKeys;
<BUG>import com.intellij.util.Consumer;
import com.intellij.xdebugger.impl.actions.handlers.XEvaluateInConsoleFromEditorActionHandler;</BUG>
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
| import com.intellij.xdebugger.XExpression;
import com.intellij.xdebugger.impl.actions.handlers.XEvaluateInConsoleFromEditorActionHandler;
|
47,576 | package com.intellij.xdebugger.frame;
<BUG>import com.intellij.util.ThreeState;
import com.intellij.xdebugger.evaluation.XInstanceEvaluator;</BUG>
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.concurrency.Promise;
| import com.intellij.xdebugger.XDebuggerUtil;
import com.intellij.xdebugger.XExpression;
import com.intellij.xdebugger.evaluation.EvaluationMode;
import com.intellij.xdebugger.evaluation.XInstanceEvaluator;
|
47,577 | @Nullable
public String getEvaluationExpression() {
return null;
}
@NotNull
<BUG>public Promise<String> calculateEvaluationExpression() {
return Promise.resolve(getEvaluationExpression());
}</BUG>
@Nullable
| public Promise<XExpression> calculateEvaluationExpression() {
String expression = getEvaluationExpression();
XExpression res =
expression != null ? XDebuggerUtil.getInstance().createExpression(expression, null, null, EvaluationMode.EXPRESSION) : null;
return Promise.resolve(res);
|
47,578 | artifacts.addAll( plugins );
final FilterArtifacts filter = getPluginArtifactsFilter();
artifacts = filter.filter( artifacts );
for ( final Artifact artifact : new HashSet<Artifact>( artifacts ) )
{
<BUG>this.resolver.resolve( artifact, this.remotePluginRepositories, this.getLocal() );
}</BUG>
return artifacts;
}
@Override
| ProjectBuildingRequest buildingRequest =
new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() );
buildingRequest.setLocalRepository( this.getLocal() );
buildingRequest.setRemoteRepositories( this.remotePluginRepositories );
getArtifactResolver().resolveArtifact( buildingRequest, artifact );
|
47,579 | import org.apache.maven.shared.artifact.filter.collection.ArtifactIdFilter;
import org.apache.maven.shared.artifact.filter.collection.ClassifierFilter;
import org.apache.maven.shared.artifact.filter.collection.FilterArtifacts;
import org.apache.maven.shared.artifact.filter.collection.GroupIdFilter;
import org.apache.maven.shared.artifact.filter.collection.ScopeFilter;
<BUG>import org.apache.maven.shared.artifact.filter.collection.TypeFilter;
public abstract class AbstractResolveMojo</BUG>
extends AbstractDependencyFilterMojo
{
@Component
| import org.apache.maven.shared.artifact.resolve.ArtifactResolverException;
public abstract class AbstractResolveMojo
|
47,580 | Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.tab_qibla, container, false);
final QiblaCompassView qiblaCompassView = (QiblaCompassView)rootView.findViewById(R.id.qibla_compass);
qiblaCompassView.setConstants(((TextView)rootView.findViewById(R.id.bearing_north)), getText(R.string.bearing_north),
((TextView)rootView.findViewById(R.id.bearing_qibla)), getText(R.string.bearing_qibla));
<BUG>sOrientationListener = new SensorListener() {
</BUG>
public void onSensorChanged(int s, float v[]) {
float northDirection = v[SensorManager.DATA_X];
qiblaCompassView.setDirections(northDirection, sQiblaDirection);
| sOrientationListener = new android.hardware.SensorListener() {
|
47,581 | import org.opendaylight.controller.cluster.notifications.RegisterRoleChangeListenerReply;
import org.opendaylight.controller.cluster.notifications.RoleChangeNotification;
import scala.concurrent.Await;
import scala.concurrent.duration.FiniteDuration;
public class ExampleRoleChangeListener extends AbstractUntypedActor implements AutoCloseable{
<BUG>private static final String NOTIFIER_AKKA_URL = "akka.tcp://[email protected]:2550/user/";
private Map<String, Boolean> notifierRegistrationStatus = new HashMap<>();</BUG>
private Cancellable registrationSchedule = null;
private static final FiniteDuration duration = new FiniteDuration(100, TimeUnit.MILLISECONDS);
private static final FiniteDuration schedulerDuration = new FiniteDuration(1, TimeUnit.SECONDS);
| private static final String NOTIFIER_AKKA_URL = "akka://[email protected]:2550/user/";
private Map<String, Boolean> notifierRegistrationStatus = new HashMap<>();
|
47,582 | return checkEquivalence(a1.getLeft(), a2.getLeft()) && a1.getOperationToken().equals(a2.getOperationToken());
}
private static boolean checkFoldableIfExpressionWithAssignments(JetIfExpression ifExpression) {
JetExpression thenBranch = ifExpression.getThen();
JetExpression elseBranch = ifExpression.getElse();
<BUG>JetBinaryExpression thenAssignment = checkAndGetFoldableBranchedAssignment(thenBranch);
JetBinaryExpression elseAssignment = checkAndGetFoldableBranchedAssignment(elseBranch);
</BUG>
if (thenAssignment == null || elseAssignment == null) return false;
| JetBinaryExpression thenAssignment = getFoldableBranchedAssignment(thenBranch);
JetBinaryExpression elseAssignment = getFoldableBranchedAssignment(elseBranch);
|
47,583 | if (!JetPsiUtil.checkWhenExpressionHasSingleElse(whenExpression)) return false;
List<JetWhenEntry> entries = whenExpression.getEntries();
if (entries.isEmpty()) return false;
List<JetBinaryExpression> assignments = new ArrayList<JetBinaryExpression>();
for (JetWhenEntry entry : entries) {
<BUG>JetBinaryExpression assignment = checkAndGetFoldableBranchedAssignment(entry.getExpression());
</BUG>
if (assignment == null) return false;
assignments.add(assignment);
}
| JetBinaryExpression assignment = getFoldableBranchedAssignment(entry.getExpression());
|
47,584 | if (!checkAssignmentsMatch(assignment, firstAssignment)) return false;
}
return true;
}
private static boolean checkFoldableIfExpressionWithReturns(JetIfExpression ifExpression) {
<BUG>return checkAndGetFoldableBranchedReturn(ifExpression.getThen()) != null &&
checkAndGetFoldableBranchedReturn(ifExpression.getElse()) != null;
</BUG>
}
| return getFoldableBranchedReturn(ifExpression.getThen()) != null &&
getFoldableBranchedReturn(ifExpression.getElse()) != null;
|
47,585 | private static boolean checkFoldableWhenExpressionWithReturns(JetWhenExpression whenExpression) {
if (!JetPsiUtil.checkWhenExpressionHasSingleElse(whenExpression)) return false;
List<JetWhenEntry> entries = whenExpression.getEntries();
if (entries.isEmpty()) return false;
for (JetWhenEntry entry : entries) {
<BUG>if (checkAndGetFoldableBranchedReturn(entry.getExpression()) == null) return false;
</BUG>
}
return true;
}
| if (getFoldableBranchedReturn(entry.getExpression()) == null) return false;
|
47,586 | </BUG>
}
return true;
}
private static boolean checkFoldableIfExpressionWithAsymmetricReturns(JetIfExpression ifExpression) {
<BUG>if (checkAndGetFoldableBranchedReturn(ifExpression.getThen()) == null ||
</BUG>
ifExpression.getElse() != null) {
return false;
}
| private static boolean checkFoldableWhenExpressionWithReturns(JetWhenExpression whenExpression) {
if (!JetPsiUtil.checkWhenExpressionHasSingleElse(whenExpression)) return false;
List<JetWhenEntry> entries = whenExpression.getEntries();
if (entries.isEmpty()) return false;
for (JetWhenEntry entry : entries) {
if (getFoldableBranchedReturn(entry.getExpression()) == null) return false;
if (getFoldableBranchedReturn(ifExpression.getThen()) == null ||
|
47,587 | JetExpression thenExpr = thenReturn.getReturnedExpression();
JetExpression elseExpr = elseReturn.getReturnedExpression();
assert thenExpr != null : FOLD_WITHOUT_CHECK;
assert elseExpr != null : FOLD_WITHOUT_CHECK;
thenReturn.replace(thenExpr);
<BUG>elseReturn.replace(elseExpr);
}</BUG>
public static void foldIfExpressionWithAsymmetricReturns(JetIfExpression ifExpression) {
Project project = ifExpression.getProject();
JetExpression condition = ifExpression.getCondition();
| ifExpression.replace(newReturnExpression);
}
|
47,588 | jFields.put("maxRetry", new Long(modelService.maxRetry));
jFields.put("runtimeDataId", dataId);
if (UtilValidate.isNotEmpty(authUserLoginId)) {
jFields.put("authUserLoginId", authUserLoginId);
}
<BUG>jobV = dispatcher.getDelegator().makeValue("JobSandbox", jFields);
toBeStored.add(jobV);
dispatcher.getDelegator().storeAll(toBeStored);</BUG>
} catch (GenericEntityException e) {
throw new GenericServiceException("Unable to create persisted job", e);
| jobV.create();
|
47,589 | import org.ofbiz.service.jms.JmsListenerFactory;
import org.ofbiz.service.job.JobManager;
import org.ofbiz.service.job.JobManagerException;
public class ServiceDispatcher {
public static final String module = ServiceDispatcher.class.getName();
<BUG>public static final int lruLogSize = 200;
protected static final Map runLog = new LRUMap(lruLogSize);</BUG>
protected static Map dispatchers = FastMap.newInstance();
protected static boolean enableJM = true;
protected static boolean enableJMS = true;
| public static final int LOCK_RETRIES = 3;
protected static final Map runLog = new LRUMap(lruLogSize);
|
47,590 | public void runSyncIgnore(String localName, ModelService modelService, Map context) throws GenericServiceException {
Map result = runSync(localName, modelService, context);
}
public Map runSync(String localName, ModelService modelService, Map context) throws GenericServiceException {
Object result = serviceInvoker(localName, modelService, context);
<BUG>if (result == null || !(result instanceof Map))
throw new GenericServiceException("Service did not return expected result");
return (Map) result;</BUG>
}
| if (result == null || !(result instanceof Map)) {
return (Map) result;
|
47,591 | import ml.puredark.hviewer.ui.activities.BaseActivity;
import ml.puredark.hviewer.ui.dataproviders.ListDataProvider;
import ml.puredark.hviewer.ui.fragments.SettingFragment;
import ml.puredark.hviewer.ui.listeners.OnItemLongClickListener;
import ml.puredark.hviewer.utils.SharedPreferencesUtil;
<BUG>import static android.webkit.WebSettings.LOAD_CACHE_ELSE_NETWORK;
public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {</BUG>
private BaseActivity activity;
private Site site;
private ListDataProvider mProvider;
| import static ml.puredark.hviewer.R.id.container;
public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {
|
47,592 | final PictureViewHolder viewHolder = new PictureViewHolder(view);
if (pictures != null && position < pictures.size()) {
final Picture picture = pictures.get(getPicturePostion(position));
if (picture.pic != null) {
loadImage(container.getContext(), picture, viewHolder);
<BUG>} else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null && site.extraRule.pictureUrl != null) {
getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);</BUG>
} else if (site.picUrlSelector != null) {
getPictureUrl(container.getContext(), viewHolder, picture, site, site.picUrlSelector, null);
} else {
| } else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null) {
if(site.extraRule.pictureRule != null && site.extraRule.pictureRule.url != null)
getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureRule.url, site.extraRule.pictureRule.highRes);
else if(site.extraRule.pictureUrl != null)
getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);
|
47,593 | import java.util.regex.Pattern;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.puredark.hviewer.R;
import ml.puredark.hviewer.beans.Category;
<BUG>import ml.puredark.hviewer.beans.CommentRule;
import ml.puredark.hviewer.beans.Rule;</BUG>
import ml.puredark.hviewer.beans.Selector;
import ml.puredark.hviewer.beans.Site;
import ml.puredark.hviewer.ui.adapters.CategoryInputAdapter;
| import ml.puredark.hviewer.beans.PictureRule;
import ml.puredark.hviewer.beans.Rule;
|
47,594 | inputGalleryRulePictureUrlReplacement.setText(site.galleryRule.pictureUrl.replacement);
}
if (site.galleryRule.pictureHighRes != null) {
inputGalleryRulePictureHighResSelector.setText(joinSelector(site.galleryRule.pictureHighRes));
inputGalleryRulePictureHighResRegex.setText(site.galleryRule.pictureHighRes.regex);
<BUG>inputGalleryRulePictureHighResReplacement.setText(site.galleryRule.pictureHighRes.replacement);
}</BUG>
if (site.galleryRule.commentRule != null) {
if (site.galleryRule.commentRule.item != null) {
inputGalleryRuleCommentItemSelector.setText(joinSelector(site.galleryRule.commentRule.item));
| [DELETED] |
47,595 | inputExtraRuleCommentDatetimeReplacement.setText(site.extraRule.commentDatetime.replacement);
}
if (site.extraRule.commentContent != null) {
inputExtraRuleCommentContentSelector.setText(joinSelector(site.extraRule.commentContent));
inputExtraRuleCommentContentRegex.setText(site.extraRule.commentContent.regex);
<BUG>inputExtraRuleCommentContentReplacement.setText(site.extraRule.commentContent.replacement);
}</BUG>
}
}
}
| [DELETED] |
47,596 | lastSite.galleryRule.cover = loadSelector(inputGalleryRuleCoverSelector, inputGalleryRuleCoverRegex, inputGalleryRuleCoverReplacement);
lastSite.galleryRule.category = loadSelector(inputGalleryRuleCategorySelector, inputGalleryRuleCategoryRegex, inputGalleryRuleCategoryReplacement);
lastSite.galleryRule.datetime = loadSelector(inputGalleryRuleDatetimeSelector, inputGalleryRuleDatetimeRegex, inputGalleryRuleDatetimeReplacement);
lastSite.galleryRule.rating = loadSelector(inputGalleryRuleRatingSelector, inputGalleryRuleRatingRegex, inputGalleryRuleRatingReplacement);
lastSite.galleryRule.description = loadSelector(inputGalleryRuleDescriptionSelector, inputGalleryRuleDescriptionRegex, inputGalleryRuleDescriptionReplacement);
<BUG>lastSite.galleryRule.tags = loadSelector(inputGalleryRuleTagsSelector, inputGalleryRuleTagsRegex, inputGalleryRuleTagsReplacement);
lastSite.galleryRule.pictureThumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement);
lastSite.galleryRule.pictureUrl = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement);
lastSite.galleryRule.pictureHighRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement);
lastSite.galleryRule.commentRule = new CommentRule();
lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);</BUG>
lastSite.galleryRule.commentRule.avatar = loadSelector(inputGalleryRuleCommentAvatarSelector, inputGalleryRuleCommentAvatarRegex, inputGalleryRuleCommentAvatarReplacement);
| lastSite.galleryRule.pictureRule = (lastSite.galleryRule.pictureRule == null) ? new PictureRule() : lastSite.galleryRule.pictureRule;
lastSite.galleryRule.pictureRule.thumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement);
lastSite.galleryRule.pictureRule.url = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement);
lastSite.galleryRule.pictureRule.highRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement);
lastSite.galleryRule.commentRule = (lastSite.galleryRule.commentRule == null) ? new CommentRule() : lastSite.galleryRule.commentRule;
lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);
|
47,597 | lastSite.extraRule.cover = loadSelector(inputExtraRuleCoverSelector, inputExtraRuleCoverRegex, inputExtraRuleCoverReplacement);
lastSite.extraRule.category = loadSelector(inputExtraRuleCategorySelector, inputExtraRuleCategoryRegex, inputExtraRuleCategoryReplacement);
lastSite.extraRule.datetime = loadSelector(inputExtraRuleDatetimeSelector, inputExtraRuleDatetimeRegex, inputExtraRuleDatetimeReplacement);
lastSite.extraRule.rating = loadSelector(inputExtraRuleRatingSelector, inputExtraRuleRatingRegex, inputExtraRuleRatingReplacement);
lastSite.extraRule.description = loadSelector(inputExtraRuleDescriptionSelector, inputExtraRuleDescriptionRegex, inputExtraRuleDescriptionReplacement);
<BUG>lastSite.extraRule.tags = loadSelector(inputExtraRuleTagsSelector, inputExtraRuleTagsRegex, inputExtraRuleTagsReplacement);
lastSite.extraRule.pictureThumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement);
lastSite.extraRule.pictureUrl = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement);
lastSite.extraRule.pictureHighRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement);
lastSite.extraRule.commentRule = new CommentRule();
lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);</BUG>
lastSite.extraRule.commentRule.avatar = loadSelector(inputExtraRuleCommentAvatarSelector, inputExtraRuleCommentAvatarRegex, inputExtraRuleCommentAvatarReplacement);
| lastSite.extraRule.pictureRule = (lastSite.extraRule.pictureRule == null) ? new PictureRule() : lastSite.extraRule.pictureRule;
lastSite.extraRule.pictureRule.thumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement);
lastSite.extraRule.pictureRule.url = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement);
lastSite.extraRule.pictureRule.highRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement);
lastSite.extraRule.commentRule = (lastSite.extraRule.commentRule == null) ? new CommentRule() : lastSite.extraRule.commentRule;
lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);
|
47,598 | notifyItemChanged(position);
if (mItemClickListener != null)
mItemClickListener.onItemClick(v, position);
}
});
<BUG>if (tag.selected)
label.getChildAt(0).setBackgroundResource(R.color.colorPrimary);
else
label.getChildAt(0).setBackgroundResource(R.color.dimgray);</BUG>
}
| [DELETED] |
47,599 | loadPicture(picture, task, null, true);
} else if (!TextUtils.isEmpty(picture.pic) && !highRes) {
picture.retries = 0;
loadPicture(picture, task, null, false);
} else if (task.collection.site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE)
<BUG>&& task.collection.site.extraRule != null
&& task.collection.site.extraRule.pictureUrl != null) {
</BUG>
getPictureUrl(picture, task, task.collection.site.extraRule.pictureUrl, task.collection.site.extraRule.pictureHighRes);
| && task.collection.site.extraRule != null) {
if(task.collection.site.extraRule.pictureRule != null && task.collection.site.extraRule.pictureRule.url != null)
getPictureUrl(picture, task, task.collection.site.extraRule.pictureRule.url, task.collection.site.extraRule.pictureRule.highRes);
else if(task.collection.site.extraRule.pictureUrl != null)
|
47,600 | if (Picture.hasPicPosfix(picture.url)) {
picture.pic = picture.url;
loadPicture(picture, task, null, false);
} else
if (task.collection.site.hasFlag(Site.FLAG_JS_NEEDED_ALL)) {
<BUG>new Handler(Looper.getMainLooper()).post(()->{
</BUG>
WebView webView = new WebView(HViewerApplication.mContext);
WebSettings mWebSettings = webView.getSettings();
mWebSettings.setJavaScriptEnabled(true);
| new Handler(Looper.getMainLooper()).post(() -> {
|