id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
15,101 | }
public MySQLTable getTable (final String name) {
return new MySQLTable(this, name);
}
public MySQLConnection obtainConnection () {
<BUG>final MySQLConnection connection = new MySQLConnection(this.dataSource);
connection.open();</BUG>
return connection;
}
public void releaseConnection (final MySQLConnection connection) {
| public String getDBName () {
return this.dbName;
final MySQLConnection connection = new MySQLConnection(this);
connection.open();
|
15,102 | import java.util.ArrayList;
public class Transmitter implements Serializable, RestAuthorizable, Searchable {
private static final long serialVersionUID = -8142160974834002456L;
@NotNull
@Size(min = 3, max = 20)
<BUG>protected String name;
@NotNull</BUG>
@Digits(integer = 3, fraction = 8)
@Min(-180)
@Max(+180)
| protected String authKey;
|
15,103 | else
return null;
}
@ValidName(message = "must contain the name of an existing node", fieldName = "nodeName", constraintName = "ValidNodeName")
public Node getNode() throws Exception {
<BUG>if (state == null)
throw new Exception("StateNotSetException");
return state.getNodes().findByName(nodeName);
}</BUG>
@Override
| if (state != null) {
} else {
|
15,104 | public void testParseInvalidIssueKey() throws InvalidIssueKeyException {
new IssueKey("invalidkey");
}
@Test
public void testGetFullyQualifiedIssueKey() throws InvalidIssueKeyException {
<BUG>assertEquals("ABC-123", new IssueKey("ABC", "123").getFullyQualifiedIssueKey());
assertEquals("ABC-123", new IssueKey("ABC-123").getFullyQualifiedIssueKey());
</BUG>
}
| [DELETED] |
15,105 | import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
public class OsMoService {
<BUG>private static String TRACKER_URL = "ws://srv.osmo.mobi";
</BUG>
private URLConnection conn;
private OutputStreamWriter out;
private BufferedReader in;
| private static String TRACKER_URL = "ws://srv.osmo.mobi:4242";
|
15,106 | s += "\n";
}
out.write(s);
return in.readLine();
}
<BUG>public void sendCoordinate(double lat, double lon, float hdop, float alt, float speed, float bearing) throws IOException {
sendCommand("p|"+lat+":"+lon+":"+hdop+":"+alt+":"+speed+":"+bearing);
</BUG>
}
| public String sendCoordinate(double lat, double lon, float hdop, float alt, float speed, float bearing) throws IOException {
return sendCommand("p|"+lat+":"+lon+":"+hdop+":"+alt+":"+speed+":"+bearing);
|
15,107 | import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceScreen;
import android.provider.Settings;
public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlServices {
private OsmandApplication app;
<BUG>public static final String ID = "osmand.osmodroid.v2";
private static final Log log = PlatformUtil.getLog(OsMoPlugin.class);</BUG>
private OsMoService service;
public OsMoPlugin(final OsmandApplication app){
service = new OsMoService();
| public static final String ID = "osmand.osmo";
private static final Log log = PlatformUtil.getLog(OsMoPlugin.class);
|
15,108 | String response;
if (off) {
response = service.activate(getUUID(app));
} else {
response = service.deactivate();
<BUG>}
app.showToastMessage(response);</BUG>
} catch (Exception e) {
app.showToastMessage(app.getString(R.string.error_io_error) + ": " + e.getMessage());
}
| app.showToastMessage(response);
|
15,109 | 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.*;
|
15,110 | .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);
|
15,111 | </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) {
|
15,112 | 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)
|
15,113 | .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))
|
15,114 | .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))
|
15,115 | @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;
|
15,116 | 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;
}
|
15,117 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
15,118 | 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.*;
|
15,119 | .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))
|
15,120 | 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) -> {
|
15,121 | 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);
|
15,122 | 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);
|
15,123 | 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() + "\"");
|
15,124 | 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() + "\"");
|
15,125 | 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
|
15,126 | .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")
|
15,127 | .path(path)
.port(port)
.sshRetries(sshRetries)
.password(password)
.proxyUri(proxyUri != null ? proxyUri : fabricService.getMavenRepoURI())
<BUG>.zookeeperUrl(fabricService.getZookeeperUrl());
CreateContainerMetadata[] metadatas = fabricService.createContainers(args);</BUG>
displayContainers(metadatas);
postCreateContainers(metadatas);
return null;
| .zookeeperUrl(fabricService.getZookeeperUrl())
.jvmOpts(jvmOpts);
CreateContainerMetadata[] metadatas = fabricService.createContainers(args);
|
15,128 | protected URI providerURI;
protected boolean ensembleServer;
protected boolean debugContainer;
protected Integer number = 1;
protected URI proxyUri;
<BUG>protected String zookeeperUrl;
public T ensembleServer(final boolean ensembleServer) {</BUG>
this.ensembleServer = ensembleServer;
return (T) this;
}
| protected String jvmOpts;
public T ensembleServer(final boolean ensembleServer) {
|
15,129 | public T proxyUri(final URI proxyUri) {
this.proxyUri = proxyUri;
return (T) this;
}
public T proxyUri(final String proxyUri) throws URISyntaxException {
<BUG>this.proxyUri = new URI(proxyUri);
return (T) this;</BUG>
}
public String getProviderType() {
return providerType != null ? providerType : (providerURI != null ? providerURI.getScheme() : null);
| public T jvmOpts(final String jvmOpts) {
this.jvmOpts = jvmOpts;
|
15,130 | .number(number)
.debugContainer(debugContainer)
.ensembleServer(isEnsembleServer)
.providerUri(url)
.proxyUri(proxyUri != null ? proxyUri : fabricService.getMavenRepoURI())
<BUG>.zookeeperUrl(fabricService.getZookeeperUrl());
CreateContainerMetadata[] metadatas = fabricService.createContainers(args);</BUG>
displayContainers(metadatas);
postCreateContainers(metadatas);
return null;
| .zookeeperUrl(fabricService.getZookeeperUrl())
.jvmOpts(jvmOpts);
CreateContainerMetadata[] metadatas = fabricService.createContainers(args);
|
15,131 | .parent(parent)
.providerUri(url)
.ensembleServer(isEnsembleServer)
.debugContainer(debugContainer)
.number(number)
<BUG>.zookeeperUrl(fabricService.getZookeeperUrl());
CreateContainerMetadata[] metadatas = fabricService.createContainers(options);</BUG>
displayContainers(metadatas);
postCreateContainers(metadatas);
return null;
| .zookeeperUrl(fabricService.getZookeeperUrl())
.jvmOpts(jvmOpts);
CreateContainerMetadata[] metadatas = fabricService.createContainers(options);
|
15,132 | @Option(name = "--profile", multiValued = true, required = false, description = "The profile IDs to associate with the new container(s)")
protected List<String> profiles;
@Option(name = "--enable-debuging", multiValued = false, required = false, description = "Enable debugging")
protected Boolean debugContainer = Boolean.FALSE;
@Option(name = "--ensemble-server", multiValued = false, required = false, description = "Whether the container should be a new ZooKeeper ensemble server")
<BUG>protected Boolean isEnsembleServer = Boolean.FALSE;
public List<String> getProfileNames() {</BUG>
List<String> names = this.profiles;
if (names == null || names.isEmpty()) {
names = Collections.singletonList("default");
| @Option(name = "--jvm-opts", multiValued = false, required = false, description = "Jvm Options for the container")
protected String jvmOpts;
public List<String> getProfileNames() {
|
15,133 | .number(number)
.owner(owner)
.providerName(providerName)
.user(user)
.proxyUri(proxyUri != null ? proxyUri : fabricService.getMavenRepoURI())
<BUG>.zookeeperUrl(fabricService.getZookeeperUrl());
CreateContainerMetadata[] metadatas = fabricService.createContainers(args);</BUG>
displayContainers(metadatas);
postCreateContainers(metadatas);
return null;
| .zookeeperUrl(fabricService.getZookeeperUrl())
.jvmOpts(jvmOpts);
CreateContainerMetadata[] metadatas = fabricService.createContainers(args);
|
15,134 | appendFile(sb, "etc/system.properties", Arrays.asList(ZooKeeperClusterService.ENSEMBLE_AUTOSTART +"=true"));
} else {
appendFile(sb, "etc/system.properties", Arrays.asList("zookeeper.url = " + options.getZookeeperUrl()));
}
if(options.isDebugContainer()) {
<BUG>sb.append("run export KARAF_DEBUG=true").append("\n");
}</BUG>
appendToLineInFile(sb,"etc/org.apache.karaf.features.cfg","featuresBoot=","fabric-agent,");
appendToLineInFile(sb,"etc/org.ops4j.pax.url.mvn.cfg","repositories=",options.getProxyUri().toString()+",");
sb.append("run nohup bin/start").append("\n");
| if(options.getJvmOpts() != null && !options.getJvmOpts().isEmpty()) {
sb.append("run export JAVA_OPTS=").append(options.getJvmOpts()).append("\n");
|
15,135 | if (options.isDebugContainer()) {
javaOpts += DEBUG_CONTAINER;
}</BUG>
if (options.isEnsembleServer()) {
<BUG>javaOpts += ENSEMBLE_SERVER_CONTAINER;
}</BUG>
String features = "fabric-agent";
String featuresUrls = "mvn:org.fusesource.fabric/fuse-fabric/" + FabricConstants.FABRIC_VERSION + "/xml/features";
for (int i = 1; i <= options.getNumber(); i++) {
String containerName = options.getName();
| jvmOptsBuilder.append(" ").append(DEBUG_CONTAINER);
}
jvmOptsBuilder.append(" ").append(ENSEMBLE_SERVER_CONTAINER);
}
|
15,136 | <BUG>package org.fusesource.fabric.itests.paxexam;
import java.util.HashMap;</BUG>
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
| import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
|
15,137 | Assert.assertNotNull(bundles);
Assert.assertTrue(bundles.contains(expectedSymbolicName));
System.out.println(bundles);
containerSetProfile(containerName, "default");
<BUG>features.remove(featureName);
targetProfile.setFeatures(features);
</BUG>
}
@Test
public void testFeatures() throws Exception {
| targetProfile.setFeatures(originalFeatures);
|
15,138 | FabricService fabricService = getOsgiService(FabricService.class);
assertNotNull(fabricService);
Thread.sleep(DEFAULT_WAIT);
Container parentContainer = fabricService.getContainer(parent);
assertNotNull(parentContainer);
<BUG>CreateContainerOptions args = CreateContainerOptionsBuilder.child().name(name).parent(parent);
</BUG>
CreateContainerMetadata[] metadata = fabricService.createContainers(args);
if (metadata.length > 0) {
if (metadata[0].getFailure() != null) {
| CreateContainerOptions args = CreateContainerOptionsBuilder.child().name(name).parent(parent).jvmOpts("-Xms1024m -Xmx1024m");
|
15,139 | public static final AttributeDescriptor ATTR_DESC_ALIGN_LCRJ = new AttrDescAlignLcrj();
public static final AttributeDescriptor ATTR_DESC_ALIGN_LCRJC = new AttrDescAlignLcrjc();
public static final AttributeDescriptor ATTR_DESC_ALIGN_TBLR = new AttrDescAlignTblr();
public static final AttributeDescriptor ATTR_DESC_ALIGN_TMBB = new AttrDescAlignTmbb();
public static final AttributeDescriptor ATTR_DESC_BGCOLOR = new AttrDescAlignBgColor();
<BUG>public static final AttributeDescriptor ATTR_DESC_CITE = new AttrDescCite();
public static final AttributeDescriptor ATTR_DESC_CLEAR = new AttrDescClear();</BUG>
public static final AttributeDescriptor ATTR_DESC_COLOR = new AttrDescColor();
public static final AttributeDescriptor ATTR_DESC_COMPACT = new AttrDescCompact();
| public static final AttributeDescriptor ATTR_DESC_CITE = new AttrDescUrl();
public static final AttributeDescriptor ATTR_DESC_URL = new AttrDescUrl();
public static final AttributeDescriptor ATTR_DESC_CLEAR = new AttrDescClear();
|
15,140 | NativeAndStringValuePair verified)
{
return AttributeVerifiers.COLOR.verifyAndConvert(parent, verified);
}
}
<BUG>public static final class AttrDescCite
</BUG>
extends
AttributeDescriptor
{
| return AttributeVerifiers.LCR_ALIGN.verifyAndConvert(parent, verified);
public static final class AttrDescAlignLcrj
|
15,141 | if(worldIn.getTileEntity(pos) != null){
TileEntity te = worldIn.getTileEntity(pos);
if(te.hasCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null) && te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).getTemp() >= -273D + mult){
te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).addHeat(-mult);
}
<BUG>for(EnumFacing dir : EnumFacing.values()){
if(te.hasCapability(Capabilities.ROTARY_HANDLER_CAPABILITY, dir)){
te.getCapability(Capabilities.ROTARY_HANDLER_CAPABILITY, dir).addEnergy(-mult, false, false);
break;</BUG>
}
| if(te.hasCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null)){
te.getCapability(Capabilities.HEAT_HANDLER_CAPABILITY, null).addHeat(mult);
|
15,142 | public static double betterRound(double numIn, int decPlac){
double opOn = Math.round(numIn * Math.pow(10, decPlac)) / Math.pow(10D, decPlac);
return opOn;
}
public static double centerCeil(double numIn, int tiers){
<BUG>return ((numIn > 0) ? Math.ceil(numIn * tiers) : Math.floor(numIn * tiers)) / tiers;
</BUG>
}
public static double findEfficiency(double speedIn, double lowerLimit, double upperLimit){
speedIn = Math.abs(speedIn);
| return ((numIn > 0) ? Math.ceil(numIn * (double) tiers) : Math.floor(numIn * (double) tiers)) / (double) tiers;
|
15,143 | package com.Da_Technomancer.crossroads.API;
import com.Da_Technomancer.crossroads.API.DefaultStorageHelper.DefaultStorage;
import com.Da_Technomancer.crossroads.API.heat.DefaultHeatHandler;
import com.Da_Technomancer.crossroads.API.heat.IHeatHandler;
import com.Da_Technomancer.crossroads.API.magic.DefaultMagicHandler;
<BUG>import com.Da_Technomancer.crossroads.API.magic.IMagicHandler;
import com.Da_Technomancer.crossroads.API.rotary.DefaultRotaryHandler;
import com.Da_Technomancer.crossroads.API.rotary.IRotaryHandler;
</BUG>
import net.minecraftforge.common.capabilities.Capability;
| import com.Da_Technomancer.crossroads.API.rotary.DefaultAxleHandler;
import com.Da_Technomancer.crossroads.API.rotary.DefaultCogHandler;
import com.Da_Technomancer.crossroads.API.rotary.IAxleHandler;
import com.Da_Technomancer.crossroads.API.rotary.ICogHandler;
|
15,144 | import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;
public class Capabilities{
@CapabilityInject(IHeatHandler.class)
<BUG>public static Capability<IHeatHandler> HEAT_HANDLER_CAPABILITY = null;
@CapabilityInject(IRotaryHandler.class)
public static Capability<IRotaryHandler> ROTARY_HANDLER_CAPABILITY = null;
</BUG>
@CapabilityInject(IMagicHandler.class)
| @CapabilityInject(IAxleHandler.class)
public static Capability<IAxleHandler> AXLE_HANDLER_CAPABILITY = null;
@CapabilityInject(ICogHandler.class)
public static Capability<ICogHandler> COG_HANDLER_CAPABILITY = null;
|
15,145 | public IEffect getMixEffect(Color col){
if(col == null){
return effect;
}
int top = Math.max(col.getBlue(), Math.max(col.getRed(), col.getGreen()));
<BUG>if(top < rand.nextInt(128) + 128){
return voidEffect;</BUG>
}
return effect;
}
| if(top != 255){
return voidEffect;
|
15,146 | timeWarp = new OwnLabel(getFormattedTimeWrap(), skin, "warp");
timeWarp.setName("time warp");
Container wrapWrapper = new Container(timeWarp);
wrapWrapper.width(60f * GlobalConf.SCALE_FACTOR);
wrapWrapper.align(Align.center);
<BUG>VerticalGroup timeGroup = new VerticalGroup().align(Align.left).space(3 * GlobalConf.SCALE_FACTOR).padTop(3 * GlobalConf.SCALE_FACTOR);
</BUG>
HorizontalGroup dateGroup = new HorizontalGroup();
dateGroup.space(4 * GlobalConf.SCALE_FACTOR);
dateGroup.addActor(date);
| VerticalGroup timeGroup = new VerticalGroup().align(Align.left).columnAlign(Align.left).space(3 * GlobalConf.SCALE_FACTOR).padTop(3 * GlobalConf.SCALE_FACTOR);
|
15,147 | focusListScrollPane.setFadeScrollBars(false);
focusListScrollPane.setScrollingDisabled(true, false);
focusListScrollPane.setHeight(tree ? 200 * GlobalConf.SCALE_FACTOR : 100 * GlobalConf.SCALE_FACTOR);
focusListScrollPane.setWidth(160);
}
<BUG>VerticalGroup objectsGroup = new VerticalGroup().align(Align.left).space(3 * GlobalConf.SCALE_FACTOR);
</BUG>
objectsGroup.addActor(searchBox);
if (focusListScrollPane != null) {
objectsGroup.addActor(focusListScrollPane);
| VerticalGroup objectsGroup = new VerticalGroup().align(Align.left).columnAlign(Align.left).space(3 * GlobalConf.SCALE_FACTOR);
|
15,148 | headerGroup.addActor(expandIcon);
headerGroup.addActor(detachIcon);
addActor(headerGroup);
expandIcon.setChecked(expanded);
}
<BUG>public void expand() {
</BUG>
if (!expandIcon.isChecked()) {
expandIcon.setChecked(true);
}
| public void expandPane() {
|
15,149 | </BUG>
if (!expandIcon.isChecked()) {
expandIcon.setChecked(true);
}
}
<BUG>public void collapse() {
</BUG>
if (expandIcon.isChecked()) {
expandIcon.setChecked(false);
}
| headerGroup.addActor(expandIcon);
headerGroup.addActor(detachIcon);
addActor(headerGroup);
expandIcon.setChecked(expanded);
public void expandPane() {
public void collapsePane() {
|
15,150 | });
playstop.addListener(new TextTooltip(txt("gui.tooltip.playstop"), skin));
TimeComponent timeComponent = new TimeComponent(skin, ui);
timeComponent.initialize();
CollapsiblePane time = new CollapsiblePane(ui, txt("gui.time"), timeComponent.getActor(), skin, true, playstop);
<BUG>time.align(Align.left);
mainActors.add(time);</BUG>
panes.put(timeComponent.getClass().getSimpleName(), time);
if (Constants.desktop) {
recCamera = new OwnImageButton(skin, "rec");
| time.align(Align.left).columnAlign(Align.left);
mainActors.add(time);
|
15,151 | panes.put(visualEffectsComponent.getClass().getSimpleName(), visualEffects);
ObjectsComponent objectsComponent = new ObjectsComponent(skin, ui);
objectsComponent.setSceneGraph(sg);
objectsComponent.initialize();
CollapsiblePane objects = new CollapsiblePane(ui, txt("gui.objects"), objectsComponent.getActor(), skin, false);
<BUG>objects.align(Align.left);
mainActors.add(objects);</BUG>
panes.put(objectsComponent.getClass().getSimpleName(), objects);
GaiaComponent gaiaComponent = new GaiaComponent(skin, ui);
gaiaComponent.initialize();
| objects.align(Align.left).columnAlign(Align.left);
mainActors.add(objects);
|
15,152 | if (Constants.desktop) {
MusicComponent musicComponent = new MusicComponent(skin, ui);
musicComponent.initialize();
Actor[] musicActors = MusicActorsManager.getMusicActors() != null ? MusicActorsManager.getMusicActors().getActors(skin) : null;
CollapsiblePane music = new CollapsiblePane(ui, txt("gui.music"), musicComponent.getActor(), skin, true, musicActors);
<BUG>music.align(Align.left);
mainActors.add(music);</BUG>
panes.put(musicComponent.getClass().getSimpleName(), music);
}
Button switchWebgl = new OwnTextButton(txt("gui.webgl.back"), skin, "link");
| music.align(Align.left).columnAlign(Align.left);
mainActors.add(music);
|
15,153 | if (!source.exists()) {
throw new IOException("Source '" + source + "' doesn't exist.");
}
deleteTotally(target);
ensureParentDirectoryExists(target);
<BUG>try {
Files.createSymbolicLink(
FileSystems.getFileSystem(target.toURI()).getPath(target.getAbsolutePath()),
FileSystems.getFileSystem(source.toURI()).getPath(source.getAbsolutePath())
);</BUG>
} catch (RuntimeException e) {
| Files.createSymbolicLink(Paths.get(target.toURI()), Paths.get(source.toURI()));
|
15,154 | compareProperties(beforeTemplate.primaryType, primaryType, diff);
compareProperties(beforeTemplate.mixinTypes, mixinTypes, diff);
int beforeIndex = 0;
int afterIndex = 0;
while (beforeIndex < beforeTemplate.properties.length
<BUG>&& afterIndex < properties.length) {
int d = Integer.compare(
properties[afterIndex].hashCode(),
beforeTemplate.properties[beforeIndex].hashCode());
</BUG>
if (d == 0) {
| int d = Integer.valueOf(properties[afterIndex].hashCode())
.compareTo(Integer.valueOf(beforeTemplate.properties[beforeIndex].hashCode()));
|
15,155 | package com.projecttango.examples.java.augmentedreality;
import com.google.atap.tangoservice.Tango;
import com.google.atap.tangoservice.Tango.OnTangoUpdateListener;
import com.google.atap.tangoservice.TangoCameraIntrinsics;
import com.google.atap.tangoservice.TangoConfig;
<BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoEvent;</BUG>
import com.google.atap.tangoservice.TangoOutOfDateException;
import com.google.atap.tangoservice.TangoPoseData;
import com.google.atap.tangoservice.TangoXyzIjData;
| import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
|
15,156 | super.onResume();
if (!mIsConnected) {
mTango = new Tango(AugmentedRealityActivity.this, new Runnable() {
@Override
public void run() {
<BUG>try {
connectTango();</BUG>
setupRenderer();
mIsConnected = true;
} catch (TangoOutOfDateException e) {
| TangoSupport.initialize();
connectTango();
|
15,157 | if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) {
mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics);
mCameraPoseTimestamp = lastFramePose.timestamp;</BUG>
} else {
<BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread);
}</BUG>
}
}
}
@Override
| mRenderer.updateRenderCameraPose(lastFramePose);
mCameraPoseTimestamp = lastFramePose.timestamp;
Log.w(TAG, "Can't get device pose at time: " +
|
15,158 | import org.rajawali3d.materials.Material;
import org.rajawali3d.materials.methods.DiffuseMethod;
import org.rajawali3d.materials.textures.ATexture;
import org.rajawali3d.materials.textures.StreamingTexture;
import org.rajawali3d.materials.textures.Texture;
<BUG>import org.rajawali3d.math.Matrix4;
import org.rajawali3d.math.vector.Vector3;</BUG>
import org.rajawali3d.primitives.ScreenQuad;
import org.rajawali3d.primitives.Sphere;
import org.rajawali3d.renderer.RajawaliRenderer;
| import org.rajawali3d.math.Quaternion;
import org.rajawali3d.math.vector.Vector3;
|
15,159 | translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE);
translationMoon.setTransformable3D(moon);
getCurrentScene().registerAnimation(translationMoon);
translationMoon.play();
}
<BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) {
Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics);
getCurrentCamera().setRotation(cameraPose.getOrientation());
getCurrentCamera().setPosition(cameraPose.getPosition());
}</BUG>
public int getTextureId() {
| public void updateRenderCameraPose(TangoPoseData cameraPose) {
float[] rotation = cameraPose.getRotationAsFloats();
float[] translation = cameraPose.getTranslationAsFloats();
Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]);
getCurrentCamera().setRotation(quaternion.conjugate());
getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
|
15,160 | package com.projecttango.examples.java.helloareadescription;
import com.google.atap.tangoservice.Tango;
<BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener;
import com.google.atap.tangoservice.TangoConfig;</BUG>
import com.google.atap.tangoservice.TangoCoordinateFramePair;
import com.google.atap.tangoservice.TangoErrorException;
import com.google.atap.tangoservice.TangoEvent;
| import com.google.atap.tangoservice.TangoAreaDescriptionMetaData;
import com.google.atap.tangoservice.TangoConfig;
|
15,161 | 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.*;
|
15,162 | .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);
|
15,163 | </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) {
|
15,164 | 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)
|
15,165 | .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))
|
15,166 | .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))
|
15,167 | @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;
|
15,168 | 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;
}
|
15,169 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
15,170 | 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.*;
|
15,171 | .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))
|
15,172 | 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) -> {
|
15,173 | 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);
|
15,174 | 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);
|
15,175 | 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() + "\"");
|
15,176 | 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() + "\"");
|
15,177 | 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
|
15,178 | .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")
|
15,179 | Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
private void openLoadingDialog() {
<BUG>progressDialog = LightProgressDialog.create(this,
R.string.login_activity_authenticating);
progressDialog.show();
}</BUG>
public void handleLogin() {
| progressDialog = new MaterialDialog.Builder(this)
.progress(true, 0)
.content(R.string.login_activity_authenticating)
|
15,180 | import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
<BUG>import android.webkit.WebViewClient;
import com.github.pockethub.R;
import com.github.pockethub.ui.LightProgressDialog;</BUG>
import com.github.pockethub.ui.WebView;
public class LoginWebViewActivity extends AppCompatActivity {
| import com.afollestad.materialdialogs.MaterialDialog;
|
15,181 | protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView = new WebView(this);
webView.loadUrl(getIntent().getStringExtra(LoginActivity.INTENT_EXTRA_URL));
webView.setWebViewClient(new WebViewClient() {
<BUG>LightProgressDialog dialog = (LightProgressDialog) LightProgressDialog.create(
LoginWebViewActivity.this, R.string.loading);
@Override</BUG>
public void onPageStarted(android.webkit.WebView view, String url, Bitmap favicon) {
dialog.show();
| MaterialDialog dialog = new MaterialDialog.Builder(LoginWebViewActivity.this)
.content(R.string.loading)
.progress(true, 0)
.build();
@Override
|
15,182 | }
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
Optional<User> user = args.getOne(Arguments.USER);
if (!user.isPresent()) throw new CommandException(Text.of("Invalid user"));
<BUG>Optional<Island> island = IslandUtil.getIslandByOwner(user.get().getUniqueId());
if (!island.isPresent()) throw new CommandException(Text.of("Invalid island"));
island.get().delete();</BUG>
src.sendMessage(Text.of(island.get().getOwnerName(), "'s island has been deleted!"));
return CommandResult.success();
| Optional<Island> island = Island.getByOwner(user.get().getUniqueId());
boolean regen = (boolean) args.getOne(Arguments.REGEN).orElse(true);
if (regen) island.get().regen();
island.get().delete();
|
15,183 | public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
if (!(src instanceof Player))
throw new CommandException(Text.of("You must be a player to use this command!"));
Player player = (Player) src;
String schematic = Options.getStringOption(player.getUniqueId(), Options.DEFAULT_SCHEMATIC);
<BUG>if (IslandUtil.hasIsland(player.getUniqueId()))
throw new CommandException(Text.of("You already have an island!"));</BUG>
if (Arguments.SCHEMATICS.isEmpty())
throw new CommandException(Text.of("There are no valid schematics to create an island with!"));
if (args.getOne(Arguments.SCHEMATIC).isPresent()) {
| if (Island.hasIsland(player.getUniqueId()))
throw new CommandException(Text.of("You already have an island!"));
|
15,184 | .permission(Permissions.COMMAND_ADMIN)
.description(Text.of(helpText))
.child(CommandDelete.commandSpec, "delete")
.child(CommandReload.commandSpec, "reload")
.child(CommandSetup.commandSpec, "setup")
<BUG>.child(CommandCreateSchematic.commandSpec, "createschematic", "cs")
.arguments(GenericArguments.optionalWeak(GenericArguments.onlyOne(GenericArguments.literal(Arguments.HELP, "help"))))</BUG>
.executor(new CommandAdmin())
.build();
public static void register() {
| .child(CommandTransfer.commandSpec, "transfer")
.arguments(GenericArguments.optionalWeak(GenericArguments.onlyOne(GenericArguments.literal(Arguments.HELP, "help"))))
|
15,185 | name.toBuilder()
.onHover(TextActions.showText(Text.of("Click here to view island info")))
.onClick(TextActions.executeCallback(CommandUtil.createCommandConsumer(src, "islandinfo", island.getUniqueId().toString(), createReturnConsumer(src)))),
coords.toBuilder()
.onHover(TextActions.showText(Text.of("Click here to teleport to this island.")))
<BUG>.onClick(TextActions.executeCallback(CommandUtil.createTeleportConsumer(src, island.getSpawn())))
</BUG>
));
}
if (listText.isEmpty())
| .onClick(TextActions.executeCallback(CommandUtil.createTeleportConsumer(src, island.getSpawn().getLocation())))
|
15,186 | CommandReload.register();
CommandReset.register();
CommandSetBiome.register();
CommandSetSpawn.register();
CommandSetup.register();
<BUG>CommandSpawn.register();
CommandUnlock.register();</BUG>
}
private void addCustomMetrics() {
metrics.addCustomChart(new Metrics.SingleLineChart("islands") {
| CommandTransfer.register();
CommandUnlock.register();
|
15,187 | package net.mohron.skyclaims.claim;
import com.flowpowered.math.vector.Vector3i;
import me.ryanhamshire.griefprevention.api.claim.Claim;
<BUG>import me.ryanhamshire.griefprevention.api.claim.ClaimResult;
import me.ryanhamshire.griefprevention.api.claim.TrustManager;
</BUG>
import me.ryanhamshire.griefprevention.api.data.ClaimData;
import org.spongepowered.api.event.cause.Cause;
| import me.ryanhamshire.griefprevention.api.claim.ClaimType;
import me.ryanhamshire.griefprevention.api.claim.TrustType;
|
15,188 | public class Arguments {
private static final SkyClaims PLUGIN = SkyClaims.getInstance();
public static final Text BIOME = Text.of("biome");
public static final Text CONFIRM = Text.of("confirm");
public static final Text HELP = Text.of("help");
<BUG>public static final Text NAME = Text.of("name");
public static final Text SCHEMATIC = Text.of("schematic");</BUG>
public static final Text TARGET = Text.of("target");
public static final Text USER = Text.of("user");
public static final Text UUID = Text.of("uuid");
| public static final Text REGEN = Text.of("regen");
public static final Text SCHEMATIC = Text.of("schematic");
|
15,189 | Text members = Text.of(TextColors.YELLOW, "Members", TextColors.WHITE, " : ");
if (island.getMembers().isEmpty())
members = members.concat(Text.of(TextColors.GRAY, "None"));
else {
int i = 1;
<BUG>for (UUID member : island.getMembers()) {
members = Text.join(members, Text.of(TextColors.AQUA, member.toString(), TextColors.GRAY, (i == island.getMembers().size()) ? "" : ", "));
i++;</BUG>
}
| for (String member : island.getMembers()) {
members = Text.join(members, Text.of(TextColors.AQUA, member, TextColors.GRAY, (i == island.getMembers().size()) ? "" : ", "));
i++;
|
15,190 | package net.mohron.skyclaims.claim;
import me.ryanhamshire.griefprevention.api.claim.Claim;
import me.ryanhamshire.griefprevention.api.claim.ClaimResult;
<BUG>import me.ryanhamshire.griefprevention.api.claim.ClaimResultType;
import java.util.Optional;</BUG>
public class SkyClaimResult implements ClaimResult {
private ClaimResultType resultType;
private Optional<Claim> claim;
| import org.spongepowered.api.text.Text;
import java.util.List;
import java.util.Optional;
|
15,191 | import org.apache.commons.lang3.math.NumberUtils;
import org.json.JSONException;
import org.mariotaku.microblog.library.MicroBlog;
import org.mariotaku.microblog.library.MicroBlogException;
import org.mariotaku.microblog.library.twitter.model.RateLimitStatus;
<BUG>import org.mariotaku.microblog.library.twitter.model.Status;
import org.mariotaku.sqliteqb.library.AllColumns;</BUG>
import org.mariotaku.sqliteqb.library.Columns;
import org.mariotaku.sqliteqb.library.Columns.Column;
import org.mariotaku.sqliteqb.library.Expression;
| import org.mariotaku.pickncrop.library.PNCUtils;
import org.mariotaku.sqliteqb.library.AllColumns;
|
15,192 | context.getApplicationContext().sendBroadcast(intent);
}
}
@Nullable
public static Location getCachedLocation(Context context) {
<BUG>if (BuildConfig.DEBUG) {
Log.v(LOGTAG, "Fetching cached location", new Exception());
}</BUG>
Location location = null;
| DebugLog.v(LOGTAG, "Fetching cached location", new Exception());
|
15,193 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
twitter.updateProfileBannerImage(fileBody);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
15,194 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
twitter.updateProfileBackgroundImage(fileBody, tile);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| twitter.updateProfileBannerImage(fileBody);
if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
15,195 | FileBody fileBody = null;
try {
fileBody = getFileBody(context, imageUri);
return twitter.updateProfileImage(fileBody);
} finally {
<BUG>Utils.closeSilently(fileBody);
if (deleteImage && "file".equals(imageUri.getScheme())) {
final File file = new File(imageUri.getPath());
if (!file.delete()) {
Log.w(LOGTAG, String.format("Unable to delete %s", file));
}</BUG>
}
| twitter.updateProfileBannerImage(fileBody);
if (deleteImage) {
Utils.deleteMedia(context, imageUri);
|
15,196 | import org.mariotaku.twidere.receiver.NotificationReceiver;
import org.mariotaku.twidere.service.LengthyOperationsService;
import org.mariotaku.twidere.util.ActivityTracker;
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
import org.mariotaku.twidere.util.DataStoreFunctionsKt;
<BUG>import org.mariotaku.twidere.util.DataStoreUtils;
import org.mariotaku.twidere.util.ImagePreloader;</BUG>
import org.mariotaku.twidere.util.InternalTwitterContentUtils;
import org.mariotaku.twidere.util.JsonSerializer;
import org.mariotaku.twidere.util.NotificationManagerWrapper;
| import org.mariotaku.twidere.util.DebugLog;
import org.mariotaku.twidere.util.ImagePreloader;
|
15,197 | final List<InetAddress> addresses = mDns.lookup(host);
for (InetAddress address : addresses) {
c.addRow(new String[]{host, address.getHostAddress()});
}
} catch (final IOException ignore) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, ignore);
}</BUG>
}
| DebugLog.w(LOGTAG, null, ignore);
|
15,198 | for (Location location : twitter.getAvailableTrends()) {
map.put(location);
}
return map.pack();
} catch (final MicroBlogException e) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, e);
}</BUG>
}
| DebugLog.w(LOGTAG, null, e);
|
15,199 | import android.content.Context;
import android.content.SharedPreferences;
import android.location.Location;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
<BUG>import android.util.Log;
import org.mariotaku.twidere.BuildConfig;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.util.JsonSerializer;</BUG>
import org.mariotaku.twidere.util.Utils;
| import org.mariotaku.twidere.util.DebugLog;
import org.mariotaku.twidere.util.JsonSerializer;
|
15,200 | }
public static LatLng getCachedLatLng(@NonNull final Context context) {
final Context appContext = context.getApplicationContext();
final SharedPreferences prefs = DependencyHolder.Companion.get(context).getPreferences();
if (!prefs.getBoolean(KEY_USAGE_STATISTICS, false)) return null;
<BUG>if (BuildConfig.DEBUG) {
Log.d(HotMobiLogger.LOGTAG, "getting cached location");
}</BUG>
final Location location = Utils.getCachedLocation(appContext);
| DebugLog.d(HotMobiLogger.LOGTAG, "getting cached location", null);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.