id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
44,001 |
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT));
</BUG>
s3 = new AmazonS3Client(credentials, awsConf);
<BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS);
partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
</BUG>
if (partSize < 5 * 1024 * 1024) {
| new InstanceProfileCredentialsProvider(),
new AnonymousAWSCredentialsProvider()
bucket = name.getHost();
ClientConfiguration awsConf = new ClientConfiguration();
awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS)));
awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP);
awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES)));
awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)));
maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS));
partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE));
partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
|
44,002 | cannedACL = null;
}
if (!s3.doesBucketExist(bucket)) {
throw new IOException("Bucket " + bucket + " does not exist");
}
<BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART);
long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE);
</BUG>
if (purgeExistingMultipart) {
| boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART));
long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
|
44,003 | import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
<BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*;
public class S3AOutputStream extends OutputStream {</BUG>
private OutputStream backupStream;
private File backupFile;
private boolean closed;
| import static org.apache.hadoop.fs.s3a.Constants.*;
public class S3AOutputStream extends OutputStream {
|
44,004 | this.client = client;
this.progress = progress;
this.fs = fs;
this.cannedACL = cannedACL;
this.statistics = statistics;
<BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
</BUG>
if (conf.get(BUFFER_DIR, null) != null) {
| partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE);
partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
|
44,005 | 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.*;
|
44,006 | .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);
|
44,007 | </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) {
|
44,008 | 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)
|
44,009 | .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))
|
44,010 | .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))
|
44,011 | @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;
|
44,012 | 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;
}
|
44,013 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
44,014 | 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.*;
|
44,015 | .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))
|
44,016 | 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) -> {
|
44,017 | 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);
|
44,018 | 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);
|
44,019 | 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() + "\"");
|
44,020 | 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() + "\"");
|
44,021 | 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
|
44,022 | .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")
|
44,023 | 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.*;
|
44,024 | .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);
|
44,025 | </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) {
|
44,026 | 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)
|
44,027 | .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))
|
44,028 | .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))
|
44,029 | @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;
|
44,030 | 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;
}
|
44,031 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
44,032 | 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.*;
|
44,033 | .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))
|
44,034 | 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) -> {
|
44,035 | 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);
|
44,036 | 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);
|
44,037 | 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() + "\"");
|
44,038 | 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() + "\"");
|
44,039 | 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
|
44,040 | .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")
|
44,041 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
44,042 | }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_memo);
<BUG>ChinaPhoneHelper.setStatusBar(this,true);
</BUG>
topicId = getIntent().getLongExtra("topicId", -1);
if (topicId == -1) {
finish();
| ChinaPhoneHelper.setStatusBar(this, true);
|
44,043 | MemoEntry.COLUMN_REF_TOPIC__ID + " = ?"
, new String[]{String.valueOf(topicId)});
}
public Cursor selectMemo(long topicId) {
Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null,
<BUG>MemoEntry._ID + " DESC", null);
</BUG>
if (c != null) {
c.moveToFirst();
}
| MemoEntry.COLUMN_ORDER + " ASC", null);
|
44,044 | MemoEntry._ID + " = ?",
new String[]{String.valueOf(memoId)});
}
public long updateMemoContent(long memoId, String memoContent) {
ContentValues values = new ContentValues();
<BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent);
return db.update(</BUG>
MemoEntry.TABLE_NAME,
values,
MemoEntry._ID + " = ?",
| return db.update(
|
44,045 | import android.widget.RelativeLayout;
import android.widget.TextView;
import com.kiminonawa.mydiary.R;
import com.kiminonawa.mydiary.db.DBManager;
import com.kiminonawa.mydiary.shared.EditMode;
<BUG>import com.kiminonawa.mydiary.shared.ThemeManager;
import java.util.List;
public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode {
</BUG>
private List<MemoEntity> memoList;
| import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter;
public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
|
44,046 | private DBManager dbManager;
private boolean isEditMode = false;
private EditMemoDialogFragment.MemoCallback callback;
private static final int TYPE_HEADER = 0;
private static final int TYPE_ITEM = 1;
<BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) {
this.mActivity = activity;</BUG>
this.topicId = topicId;
this.memoList = memoList;
| public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) {
super(recyclerView);
this.mActivity = activity;
|
44,047 | this.memoList = memoList;
this.dbManager = dbManager;
this.callback = callback;
}
@Override
<BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
</BUG>
View view;
if (isEditMode) {
if (viewType == TYPE_HEADER) {
| public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
44,048 | editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment");
}
});
}
}
<BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
private View rootView;
private TextView TV_memo_item_content;</BUG>
private ImageView IV_memo_item_delete;
| protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private ImageView IV_memo_item_dot;
private TextView TV_memo_item_content;
|
44,049 | import com.android.volley.VolleyError;
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
<BUG>import java.util.List;
import androidrss.MediaEnclosure;</BUG>
import androidrss.RSSConfig;
import androidrss.RSSFeed;
import androidrss.RSSItem;
| import java.util.regex.Matcher;
import java.util.regex.Pattern;
import androidrss.MediaEnclosure;
|
44,050 | private int currentWorkingThreads = 0;
private IDatabaseHandler databaseHandler;
private boolean updateDatabase;
public void start() {
sendMessage(context.getString(R.string.update_news), STATUS_CHANGED);
<BUG>if (updateDatabase){
dropCategory();
}</BUG>
results = new ArrayList<FetchingResult>();
currentWorkingThreads = category.getFeeds().size();
| [DELETED] |
44,051 | results.add(result);
}
if (currentWorkingThreads <= 0){
new AsyncTask<Void, Void, Void>(){
@Override
<BUG>protected Void doInBackground(Void... params) {
parseInformation();</BUG>
return null;
}
}.execute();
| if (updateDatabase){
dropCategory();
parseInformation();
|
44,052 | if (pubDate != null){
time = pubDate.getTime();
}
String desc = item.getDescription();
if (desc != null) {
<BUG>desc = desc.replaceAll("\\<.*?>","").replaceAll("()", "");
</BUG>
}
return new Entry(-1, feedId, category.getId(), item.getTitle(), desc, time, source, url, mediaUri);
}
| desc = desc.replaceAll("\\<.*?>","").replace("()", "").replace(" ", "");
|
44,053 | protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mNavigationDrawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
<BUG>mTitle = getTitle();
mNavigationDrawerFragment.setUp(</BUG>
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
databaseHandler = DatabaseHandler.getInstance();
| getSupportActionBar().setTitle(getString(R.string.simple_news_title));
mNavigationDrawerFragment.setUp(
|
44,054 | bottomView = (RelativeLayout) findViewById(R.id.bottom_view);
createProgressView();
onPageSelected(0);
overridePendingTransition(R.anim.open_translate,R.anim.close_scale);
}
<BUG>@Override
protected void onPause() {</BUG>
super.onPause();
overridePendingTransition(R.anim.open_scale,R.anim.close_translate);
}
| public void onBackPressed() {
finish();
protected void onPause() {
|
44,055 | import colorpicker.ColorUtils;
import colorpicker.OnColorSelectedListener;
import de.dala.simplenews.R;
import de.dala.simplenews.common.Category;
import de.dala.simplenews.database.DatabaseHandler;
<BUG>import de.dala.simplenews.utilities.UIUtils;
public class CategorySelectionFragment extends Fragment implements ContextualUndoAdapter.DeleteItemCallback {</BUG>
public interface OnCategoryClicked {
void onMoreClicked(Category category);
void onRSSSavedClick(Category category, String rssPath);
| import de.keyboardsurfer.android.widget.crouton.Crouton;
import de.keyboardsurfer.android.widget.crouton.Style;
public class CategorySelectionFragment extends Fragment implements ContextualUndoAdapter.DeleteItemCallback {
|
44,056 | private String rssPath;
private static final String CATEGORIES_KEY = "categories";
private static final String FROM_RSS_KEY = "rss";
private static final String RSS_PATH_KEY = "path";
OnCategoryClicked categoryClicked;
<BUG>private TextView topView;
public CategorySelectionFragment(){</BUG>
}
public static CategorySelectionFragment newInstance(ArrayList<Category> categories, boolean fromRSS, String path){
| private TextView topTextView;
private ViewGroup topView;
public CategorySelectionFragment(){
|
44,057 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
this.categoryClicked = UIUtils.getParent(this, OnCategoryClicked.class);
if (categoryClicked == null){
throw new ClassCastException("No Parent with Interface OnCategoryClicked");
}
<BUG>View rootView = inflater.inflate(R.layout.category_selection, container, false);
if (fromRSS){
topView = (TextView) rootView.findViewById(R.id.topTextView);
topView.setText("Select Category to add Feed");
topView.setVisibility(View.VISIBLE);
</BUG>
}
| topView = (ViewGroup) rootView.findViewById(R.id.topView);
topTextView = (TextView) rootView.findViewById(R.id.topTextView);
topTextView.setText(getActivity().getString(R.string.category_add));
topTextView.setVisibility(View.VISIBLE);
|
44,058 | break;
}
}
};
new AlertDialog.Builder(getActivity()).
<BUG>setPositiveButton("Ok", dialogClickListener).setNegativeButton("Cancel", dialogClickListener).setTitle(getActivity().getString(R.string.create_category_1_2))
.setMessage("Name for the Category").setView(input).show();
}</BUG>
private void editClicked(final Category category) {
| case R.id.edit:
editClicked(category);
case R.id.show:
case R.id.more:
categoryClicked.onMoreClicked(category);
private void createCategoryClicked(){
|
44,059 | case DialogInterface.BUTTON_POSITIVE:
String newName = input.getText().toString();
category.setName(newName);
adapter.notifyDataSetChanged();
DatabaseHandler.getInstance().updateCategoryName(category.getId(), newName);
<BUG>Toast.makeText(getActivity(), "New name: " + newName, Toast.LENGTH_SHORT).show();
break;</BUG>
case DialogInterface.BUTTON_NEGATIVE:
break;
}
| String categoryName = input.getText().toString();
selectColor(categoryName);
|
44,060 | newCategory.setColor(color);
long id = DatabaseHandler.getInstance().addCategory(newCategory, true, true);
newCategory.setId(id);
adapter.add(newCategory);
adapter.notifyDataSetChanged();
<BUG>Toast.makeText(getActivity(), "Category created", Toast.LENGTH_SHORT).show();
}</BUG>
});
colorCalendar.show(getChildFragmentManager(), "dash");
}
| Crouton.makeText(getActivity(), R.string.category_created, Style.CONFIRM, topView).show();
|
44,061 | private static String LOG_PREFIX = "prefix";
private static int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
private static final int MAX_LOG_TAG_LENGTH = 23;
private enum LogType {TOAST, LOG, BOTH};
private Toast currentToast;
<BUG>private LogType type = LogType.BOTH;
</BUG>
private boolean shouldInterrupt = true;
private int toastLength = Toast.LENGTH_LONG;
private Toasty(Context context){
| private LogType type = LogType.LOG;
|
44,062 | DatabaseHandler.getInstance().removeFeeds(null, feed.getId(), false);
category.getFeeds().remove(feed);
}
private class MyFormatCountDownCallback implements ContextualUndoAdapter.CountDownFormatter {
@Override
<BUG>public String getCountDownString(long millisUntilFinished) {
int seconds = (int) Math.ceil((millisUntilFinished / 1000.0));</BUG>
if (seconds > 0) {
return getResources().getQuantityString(R.plurals.countdown_seconds, seconds, seconds);
}
| if (getActivity() == null)
return "";
int seconds = (int) Math.ceil((millisUntilFinished / 1000.0));
|
44,063 | import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
<BUG>import android.widget.RelativeLayout;
import java.util.ArrayList;</BUG>
import de.dala.simplenews.R;
import de.dala.simplenews.common.Category;
import de.dala.simplenews.common.Feed;
| import com.actionbarsherlock.app.SherlockFragmentActivity;
import java.util.ArrayList;
|
44,064 | private boolean fromRSS = false;
private int currentFragment = CATEGORY_SELECTION;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
<BUG>setContentView(R.layout.category_modifier);
categories = new ArrayList<Category>(DatabaseHandler.getInstance().getCategories(false, true));</BUG>
Fragment fragment = null;
if(this.getIntent().getDataString()!=null)
{
| getSupportActionBar().setTitle(getString(R.string.categories_title));
categories = new ArrayList<Category>(DatabaseHandler.getInstance().getCategories(false, true));
|
44,065 | 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;
|
44,066 | 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());
|
44,067 | 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);
|
44,068 | 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);
|
44,069 | 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);
|
44,070 | 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;
|
44,071 | 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);
|
44,072 | 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);
|
44,073 | 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;
|
44,074 | }
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);
|
44,075 | public int destroySavedSearchAsync(final UserKey accountKey, final long searchId) {
final DestroySavedSearchTask task = new DestroySavedSearchTask(accountKey, searchId);
return asyncTaskManager.add(task, true);
}
public int destroyStatusAsync(final UserKey accountKey, final String statusId) {
<BUG>final DestroyStatusTask task = new DestroyStatusTask(context,accountKey, statusId);
</BUG>
return asyncTaskManager.add(task, true);
}
public int destroyUserListAsync(final UserKey accountKey, final String listId) {
| final DestroyStatusTask task = new DestroyStatusTask(context, accountKey, statusId);
|
44,076 | @Override
public void afterExecute(Bus handler, SingleResponse<Relationship> result) {
if (result.hasData()) {
handler.post(new FriendshipUpdatedEvent(accountKey, userKey, result.getData()));
} else if (result.hasException()) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, "Unable to update friendship", result.getException());
}</BUG>
}
| public UserKey[] getAccountKeys() {
return DataStoreUtils.getActivatedAccountKeys(context);
|
44,077 | MicroBlog microBlog = MicroBlogAPIFactory.getInstance(context, accountId);
if (!Utils.isOfficialCredentials(context, accountId)) continue;
try {
microBlog.setActivitiesAboutMeUnread(cursor);
} catch (MicroBlogException e) {
<BUG>if (BuildConfig.DEBUG) {
Log.w(LOGTAG, e);
}</BUG>
}
| DebugLog.w(LOGTAG, null, e);
|
44,078 | import android.widget.TextView;
import android.widget.Toast;
import org.xmlpull.v1.XmlPullParser;
import java.security.MessageDigest;
import java.security.cert.Certificate;
<BUG>import java.util.Hashtable;
import de.robv.android.xposed.IXposedHookInitPackageResources;</BUG>
import de.robv.android.xposed.callbacks.XC_InitPackageResources;
import de.robv.android.xposed.callbacks.XC_LayoutInflated;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
| import java.util.logging.Handler;
import de.robv.android.xposed.IXposedHookInitPackageResources;
|
44,079 | public static boolean verifyApps;
public static boolean verifyJar;
public static boolean verifySignature;
private static final String TAG = "InstallerOpt";
@Override
<BUG>public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
xlog_start("XSharedPreferences - Init");
try {</BUG>
prefs = new XSharedPreferences(Main.class.getPackage().getName());
prefs.makeWorldReadable();
| disableCheckSignatures = true;
try {
|
44,080 | deviceAdminsHook = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param)
throws Throwable {
prefs.reload();
<BUG>deviceAdmins = prefs.getBoolean(Common.PREF_ENABLE_UNINSTALL_DEVICE_ADMIN, false);
if (deviceAdmins) {
xlog("deviceAdmins set to", deviceAdmins);
param.setResult(false);</BUG>
return;
| enableDebug = prefs.getBoolean(Common.PREF_ENABLE_DEBUG, false);
if (enableDebug) {
xlog_start("deviceAdminsHook");
xlog_end("deviceAdminsHook");
|
44,081 | private List<Exchange> m_conversation = new ArrayList<Exchange>();
public void addExchange(Exchange exchange) {
</BUG>
m_conversation.add(exchange);
}
<BUG>public boolean attemptClientConversation(BufferedReader in, OutputStream out) throws IOException {
for(Iterator<Exchange> it = m_conversation.iterator(); it.hasNext();) {
Exchange ex = it.next();
if(!ex.processResponse(in)) {
return false;</BUG>
}
| package org.opennms.netmgt.provision.conversation;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.opennms.netmgt.provision.detector.Client;
public class ClientConversation<Request, Response> {
public static interface RequestBuilder<T> {
T getRequest() throws Exception;
|
44,082 | if (m_timeout <= 0) {
throw new IllegalStateException(String.format("Timeout of %d is invalid. Must be > 0", m_timeout));
}
onInit();
}
<BUG>protected void onInit() { }
</BUG>
abstract public boolean isServiceDetected(InetAddress address, DetectorMonitor detectMonitor);
public void setPort(int port) {
m_port = port;
| abstract protected void onInit();
|
44,083 | private long[] inputPosition;
private long[] blockedPosition;
private int[] blockedOpenCount;
private int[] blockedLen;
private int[] blockedState;
<BUG>private final Pipe<ReleaseSchema> ackStop;
</BUG>
private final HTTPSpecification<?,?,?,?> httpSpec;
private final int END_OF_HEADER_ID;
private final int UNSUPPORTED_HEADER_ID;
| private final Pipe<ReleaseSchema> releasePipe;
|
44,084 | HTTPSpecification<?,?,?,?> httpSpec) {
super(graphManager, input, join(output,ackStop));
this.input = input;
this.output = output;//must be 1 for each listener
this.ccm = ccm;
<BUG>this.ackStop = ackStop;
this.httpSpec = httpSpec;</BUG>
this.listenerPipeLookup = listenerPipeLookup;
this.totalBytes = new int[input.length];
int i = input.length;
| this.releasePipe = ackStop;
this.httpSpec = httpSpec;
|
44,085 | blockedOpenCount = new int[input.length];
blockedLen = new int[input.length];
blockedState = new int[input.length];
trieReader = new TrieParserReader(4);//max fields we support capturing.
int x;
<BUG>revisionMap = new TrieParser(256,false); //avoid deep check
HTTPRevision[] revs = httpSpec.supportedHTTPRevisions.getEnumConstants();</BUG>
x = revs.length;
while (--x >= 0) {
int b = revisionMap.setUTF8Value(revs[x].getKey(), " %u %b\n", revs[x].ordinal());
| revisionMap = new TrieParser(256,true); //TODO: set switch to turn on off the deep check skip
HTTPRevision[] revs = httpSpec.supportedHTTPRevisions.getEnumConstants();
|
44,086 | x = revs.length;
while (--x >= 0) {
int b = revisionMap.setUTF8Value(revs[x].getKey(), " %u %b\n", revs[x].ordinal());
revisionMap.setUTF8Value(revs[x].getKey(), " %u %b\r\n", revs[x].ordinal());
}
<BUG>typeMap = new TrieParser(4096,false);
HTTPContentType[] types = httpSpec.contentTypes;</BUG>
x = types.length;
while (--x >= 0) {
typeMap.setUTF8Value(types[x].contentType(),"\r\n", types[x].ordinal());
| typeMap = new TrieParser(4096,true); //TODO: set switch to turn on off the deep check skip
HTTPContentType[] types = httpSpec.contentTypes;
|
44,087 | blockedOpenCount[i] = 0;
blockedLen[i] = trieReader.sourceLen;
blockedState[i] = positionMemoData[stateIdx];
}
}
<BUG>} else {
int msgIdx = Pipe.takeMsgIdx(pipe);
ccId = Pipe.takeLong(pipe);</BUG>
inputPosition[i] = Pipe.takeLong(pipe);
ccIdData[i] = ccId;
| } else while (Pipe.hasContentToRead(pipe)) {
if (msgIdx<0) {
throw new UnsupportedOperationException("no support for shutdown");
ccId = Pipe.takeLong(pipe);
|
44,088 | switch (state) {
case 0:////HTTP/1.1 200 OK FIRST LINE REVISION AND STATUS NUMBER
if (!PipeWriter.hasRoomForWrite(targetPipe)) {
break;
}
<BUG>int startingLength1 = TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx);
final int revisionId = (int)TrieParserReader.parseNext(trieReader, revisionMap);</BUG>
if (revisionId>=0) {
payloadLengthData[i] = 0;//clear payload length rules, to be populated by headers
{
| if (startingLength1<(revisionMap.shortestKnown()+1)) {
final int revisionId = (int)TrieParserReader.parseNext(trieReader, revisionMap);
|
44,089 | } while (headerId>=0 && state==1);
if (headerId<0) {
TrieParserReader.loadPositionMemo(trieReader, positionMemoData, memoIdx);
if (trieReader.sourceLen<MAX_VALID_HEADER) {
break;//not an error just needs more data.
<BUG>} else {
StringBuilder builder = new StringBuilder();
TrieParserReader.debugAsUTF8(trieReader, builder, revisionMap.longestKnown()*2);
logger.warn("{} looking for header field but found:\n{}\n\n",cc.id,builder);</BUG>
}
| reportCorruptStream2(cc);
|
44,090 | break;
}
case 2: //PAYLOAD READING WITH LENGTH
if (2==state) {
long lengthRemaining = payloadLengthData[i];
<BUG>String temp = ("starting length: "+lengthRemaining+" vs "+trieReader.sourceLen);
if (lengthRemaining<=0) {
System.err.println("odd length "+lengthRemaining);
}</BUG>
final DataOutputBlobWriter<NetResponseSchema> writer2 = PipeWriter.outputStream(targetPipe);
| [DELETED] |
44,091 | payloadLengthData[i] = lengthRemaining;
if (0 == lengthRemaining) {
writer2.closeHighLevelField(NetResponseSchema.MSG_RESPONSE_101_FIELD_PAYLOAD_3);
positionMemoData[stateIdx] = state = 5;
PipeWriter.publishWrites(targetPipe);
<BUG>foundWork = finishAndRelease(true, i, stateIdx, ccId, pipe, cc);
</BUG>
break;
} else {
assert(lengthRemaining>0);
| foundWork += finishAndRelease(i, stateIdx, ccId, pipe, cc);
|
44,092 | assert(trieReader.sourceLen == Pipe.releasePendingByteCount(pipe)) : trieReader.sourceLen+" != "+Pipe.releasePendingByteCount(pipe);
TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx);
}
}
int temp3 = TrieParserReader.parseCopy(trieReader, chunkRemaining, writer3);
<BUG>if (temp3>=0) {
foundWork = true;
}</BUG>
chunkRemaining -= temp3;
assert(chunkRemaining>=0);
| [DELETED] |
44,093 | } while (0 == chunkRemaining);
payloadLengthData[i] = chunkRemaining;
assert(positionMemoData[i<<2] == Pipe.releasePendingByteCount(input[i])) : positionMemoData[i<<2]+" != "+Pipe.releasePendingByteCount(input[i]);
break;
case 5: //END SEND ACK
<BUG>foundWork = finishAndRelease(foundWork, i, stateIdx, ccId, pipe, cc);
</BUG>
assert(positionMemoData[(i<<2)+1] == Pipe.releasePendingByteCount(input[i])) : positionMemoData[(i<<2)+1]+" != "+Pipe.releasePendingByteCount(input[i]);
break;
}
| foundWork += finishAndRelease(i, stateIdx, ccId, pipe, cc);
|
44,094 | StringBuilder headerValue = new StringBuilder();
TrieParserReader.capturedFieldBytesAsUTF8(trieReader, 1, headerValue); //in TRIE if we have any exact matches that run short must no pick anything.
logger.info("WARNING unsupported header found: {}: {}",headerName, headerValue);
logger.info("length avail when parsed {}",len);
}
<BUG>break;
}
}
private boolean finishAndRelease(boolean foundWork, int i, final int stateIdx, long ccId,
</BUG>
Pipe<NetPayloadSchema> pipe, ClientConnection cc) {
| private int finishAndRelease(int i, final int stateIdx, long ccId,
|
44,095 | import com.google.common.collect.Maps;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.StringUtils;
import org.codehaus.staxmate.in.SMHierarchicCursor;
import org.codehaus.staxmate.in.SMInputCursor;
<BUG>import org.sonar.api.batch.SensorContext;
</BUG>
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.measures.CoverageMeasuresBuilder;
import org.sonar.api.measures.Measure;
| import org.sonar.api.batch.sensor.SensorContext;
|
44,096 | for (Map.Entry<String, CoverageMeasuresBuilder> entry : builderByFilename.entrySet()) {
String className = sanitizeFilename(entry.getKey());
InputFile resource = javaResourceLocator.findResourceByClassName(className);
if (resourceExists(resource)) {
for (Measure measure : entry.getValue().createMeasures()) {
<BUG>context.saveMeasure(resource, measure);
}</BUG>
}
}
}
| context.newMeasure().forMetric(measure.getMetric()).on(resource).withValue(measure.value()).save();
|
44,097 | throw new IOException("Failed to obtain block writer.");
}
throw new FileDoesNotExistException("Block " + blockId + " does not exist on this worker.");
}
public boolean freeBlock(long userId, long blockId) throws IOException {
<BUG>Optional<Long> optLock = mBlockStore.lockBlock(userId, blockId, BlockLock.BlockLockType.WRITE);
if (!optLock.isPresent()) {
return false;
}
Long lockId = optLock.get();
mBlockStore.removeBlock(userId, blockId, lockId);
mBlockStore.unlockBlock(lockId);
return true;</BUG>
}
| return mBlockStore.removeBlock(userId, blockId);
|
44,098 | return optLock.get();
}
return -1;
}
public boolean moveBlock(long userId, long blockId, int tier) throws IOException {
<BUG>Optional<Long> optLock = mBlockStore.lockBlock(userId, blockId, BlockLock.BlockLockType.WRITE);
if (!optLock.isPresent()) {
return false;
}
Long lockId = optLock.get();</BUG>
BlockStoreLocation dst = BlockStoreLocation.anyDirInTier(tier);
| [DELETED] |
44,099 | return false;
}
Long lockId = optLock.get();</BUG>
BlockStoreLocation dst = BlockStoreLocation.anyDirInTier(tier);
<BUG>boolean result = mBlockStore.moveBlock(userId, blockId, lockId, dst);
mBlockStore.unlockBlock(lockId);
return result;</BUG>
}
public String readBlock(long userId, long blockId, long lockId) throws FileDoesNotExistException {
| return optLock.get();
return -1;
public boolean moveBlock(long userId, long blockId, int tier) throws IOException {
return mBlockStore.moveBlock(userId, blockId, dst);
|
44,100 | import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
public class DependencyConvergenceReport
extends AbstractProjectInfoReport
<BUG>{
private List reactorProjects;
private static final int PERCENTAGE = 100;</BUG>
public String getOutputName()
{
| private static final int PERCENTAGE = 100;
private static final List SUPPORTED_FONT_FAMILY_NAMES = Arrays.asList( GraphicsEnvironment
.getLocalGraphicsEnvironment().getAvailableFontFamilyNames() );
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.