id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
42,201 | list.add(text.length());
return list;
}
public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) {
String endPart = "";
<BUG>String shortenedText = text;
List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
... | List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList());
if (breakSplitted.size() > 1) {
|
42,202 | package cc.catalysts.boot.report.pdf.elements;
import org.apache.pdfbox.pdmodel.PDDocument;
<BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import java.io.IOException;</BUG>
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
| import org.apache.pdfbox.pdmodel.PDPageContentStream;
import java.io.IOException;
|
42,203 | import org.apache.stratos.messaging.event.application.ApplicationInstanceInactivatedEvent;
import org.apache.stratos.messaging.message.processor.MessageProcessor;
import org.apache.stratos.messaging.message.processor.application.updater.ApplicationsUpdater;
import org.apache.stratos.messaging.util.MessagingUtil;
public... | private static final Log log = LogFactory.getLog(ApplicationInstanceInactivatedMessageProcessor.class);
|
42,204 | }
@Override
public boolean process(String type, String message, Object object) {
Applications applications = (Applications) object;
if (ApplicationInstanceInactivatedEvent.class.getName().equals(type)) {
<BUG>if (!applications.isInitialized())
return false;
ApplicationInstanceInactivatedEvent event = (ApplicationInsta... | if (!applications.isInitialized()) {
ApplicationInstanceInactivatedEvent event = (ApplicationInstanceInactivatedEvent) MessagingUtil.
|
42,205 | ApplicationsUpdater.releaseWriteLockForApplication(event.getAppId());
}
} else {
if (nextProcessor != null) {
return nextProcessor.process(type, message, applications);
<BUG>} else {
throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, messa... | throw new RuntimeException(String.format(
"Failed to process message using available message processors: [type] %s [body] %s", type,
|
42,206 | Applications applications = (Applications) object;
if (ApplicationCreatedEvent.class.getName().equals(type)) {
if (!applications.isInitialized()) {
return false;
}
<BUG>ApplicationCreatedEvent event = (ApplicationCreatedEvent) MessagingUtil.jsonToObject(message, ApplicationCreatedEvent.class);
if (event == null) {</BUG... | ApplicationCreatedEvent event = (ApplicationCreatedEvent) MessagingUtil
if (event == null) {
|
42,207 | if (event.getApplication() == null) {
String errorMsg = "Application object of application created event is invalid";
log.error(errorMsg);
throw new RuntimeException(errorMsg);
}
<BUG>if (event.getApplication().getUniqueIdentifier() == null || event.getApplication().getUniqueIdentifier().isEmpty()) {
String errorMsg = ... | if (event.getApplication().getUniqueIdentifier() == null || event.getApplication().getUniqueIdentifier()
String errorMsg = String.format("App id of application created event is invalid: [%s]",
event.getApplication().getUniqueIdentifier());
|
42,208 | public boolean process(String type, String message, Object object) {
Applications applications = (Applications) object;
if (ApplicationInstanceCreatedEvent.class.getName().equals(type)) {
if (!applications.isInitialized()) {
return false;
<BUG>}
ApplicationInstanceCreatedEvent event =
(ApplicationInstanceCreatedEvent) ... | ApplicationInstanceCreatedEvent event = (ApplicationInstanceCreatedEvent) MessagingUtil
.jsonToObject(message, ApplicationInstanceCreatedEvent.class);
|
42,209 | return false;
}
ApplicationsUpdater.acquireWriteLockForApplications();
try {
return doProcess(event, applications);
<BUG>}
finally {
</BUG>
ApplicationsUpdater.releaseWriteLockForApplications();
}
| ApplicationInstanceCreatedEvent event = (ApplicationInstanceCreatedEvent) MessagingUtil
.jsonToObject(message, ApplicationInstanceCreatedEvent.class);
if (event == null) {
log.error("Unable to convert the JSON message to ApplicationInstanceCreatedEvent");
} finally {
|
42,210 | message));
}
}
}
private boolean doProcess(ApplicationInstanceCreatedEvent event, Applications applications) {
<BUG>if (event.getApplicationInstance() == null || event.getApplicationId() == null) {
String errorMsg = "Application instance object of ApplicationInstanceCreatedEvent is invalid. " +
"[ApplicationId] " + ev... | String errorMsg = String
.format("Application instance object of ApplicationInstanceCreatedEvent is invalid: "
+ "[application-id] %s, [app-instance-id] %s", event.getApplicationId(),
event.getApplicationInstance().getInstanceId());
|
42,211 | import org.apache.stratos.messaging.event.application.ApplicationInstanceActivatedEvent;
import org.apache.stratos.messaging.message.processor.MessageProcessor;
import org.apache.stratos.messaging.message.processor.application.updater.ApplicationsUpdater;
import org.apache.stratos.messaging.util.MessagingUtil;
public c... | private static final Log log = LogFactory.getLog(ApplicationInstanceActivatedMessageProcessor.class);
|
42,212 | }
@Override
public boolean process(String type, String message, Object object) {
Applications applications = (Applications) object;
if (ApplicationInstanceActivatedEvent.class.getName().equals(type)) {
<BUG>if (!applications.isInitialized())
return false;
ApplicationInstanceActivatedEvent event = (ApplicationInstanceA... | if (!applications.isInitialized()) {
ApplicationInstanceActivatedEvent event = (ApplicationInstanceActivatedEvent) MessagingUtil.
|
42,213 | ApplicationsUpdater.releaseWriteLockForApplication(event.getAppId());
}
} else {
if (nextProcessor != null) {
return nextProcessor.process(type, message, applications);
<BUG>} else {
throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, messa... | throw new RuntimeException(String.format(
"Failed to process message using available message processors: [type] %s [body] %s", type,
|
42,214 | Applications applications = (Applications) object;
if (ApplicationDeletedEvent.class.getName().equals(type)) {
if (!applications.isInitialized()) {
return false;
}
<BUG>ApplicationDeletedEvent event = (ApplicationDeletedEvent) MessagingUtil.jsonToObject(message, ApplicationDeletedEvent.class);
if (event == null) {</BUG... | ApplicationDeletedEvent event = (ApplicationDeletedEvent) MessagingUtil
if (event == null) {
|
42,215 | ApplicationsUpdater.releaseWriteLockForApplications();
}
} else {
if (nextProcessor != null) {
return nextProcessor.process(type, message, applications);
<BUG>} else {
throw new RuntimeException(String.format("Failed to process message using available message processors: [type] %s [body] %s", type, message));
}</BUG>
}... | throw new RuntimeException(String.format(
"Failed to process message using available message processors: [type] %s [body] %s", type,
|
42,216 | import static org.joda.time.Duration.millis;
import static org.scassandra.http.client.PrimingRequest.then;
public class LockTest {
private static final int BINARY_PORT = PortScavenger.getFreePort();
private static final int ADMIN_PORT = PortScavenger.getFreePort();
<BUG>private static final String LOCK_KEYSPACE = "lock... | private static final LockConfig DEFAULT_LOCK_CONFIG = LockConfig.builder().build();
private static final String REPLICATION_CLASS = "SimpleStrategy";
|
42,217 | .build()
);
Throwable throwable = catchThrowable(new ThrowableAssert.ThrowingCallable() {
@Override
public void call() throws Throwable {
<BUG>Lock.acquire(new LockConfig(), LOCK_KEYSPACE, session);
}</BUG>
});
assertThat(throwable).isNotNull();
assertThat(throwable).isInstanceOf(CannotAcquireLockException.class);
| Lock.acquire(DEFAULT_LOCK_CONFIG, LOCK_KEYSPACE, session);
}
|
42,218 | assertThat(throwable.getCause()).isNotNull();
assertThat(throwable).hasMessage("Query to create locks schema failed to execute");
}
@Test
public void shouldTryToCreateLocksTable() throws Exception {
<BUG>Lock.acquire(new LockConfig(), LOCK_KEYSPACE, session);
Query expectedQuery = Query.builder()</BUG>
.withQuery("CREA... | Lock.acquire(DEFAULT_LOCK_CONFIG, LOCK_KEYSPACE, session);
Query expectedQuery = Query.builder()
|
42,219 | .withQuery("CREATE TABLE IF NOT EXISTS locks.locks (name text PRIMARY KEY, client uuid)")
.build();
assertThat(activityClient.retrieveQueries()).contains(expectedQuery);
}
@Test
<BUG>public void ShouldThrowExceptionIfQueryFailsToCreateLocksTable() throws Exception {
</BUG>
primingClient.prime(PrimingRequest.queryBuilde... | public void shouldThrowExceptionIfQueryFailsToCreateLocksTable() throws Exception {
|
42,220 | .build()
);
Throwable throwable = catchThrowable(new ThrowableAssert.ThrowingCallable() {
@Override
public void call() throws Throwable {
<BUG>Lock.acquire(new LockConfig(), LOCK_KEYSPACE, session);
}</BUG>
});
assertThat(throwable).isNotNull();
assertThat(throwable).isInstanceOf(CannotAcquireLockException.class);
| Lock.acquire(DEFAULT_LOCK_CONFIG, LOCK_KEYSPACE, session);
}
|
42,221 | fail("Should have successfully connected, but got " + t);
}
}
@Test(timeout = 550)
public void shouldThrowCannotAcquireLockExceptionIfLockCannotBeAcquiredAfterTimeout() throws Exception {
<BUG>final CqlMigrator migrator = new CqlMigrator(new LockConfig(millis(50), millis(300), REPLICATION_CLASS, REPLICATION_FACTOR));
U... | final CqlMigrator migrator = new CqlMigrator(LockConfig.builder().withPollingInterval(millis(50)).withTimeout(millis(300)).build());
UUID client = UUID.randomUUID();
|
42,222 | import java.util.Collection;
public final class CqlMigrator {
private static final Logger LOGGER = LoggerFactory.getLogger(CqlMigrator.class);
private final LockConfig lockConfig;
public CqlMigrator() {
<BUG>this.lockConfig = new LockConfig();
</BUG>
}
public CqlMigrator(LockConfig lockConfig) {
this.lockConfig = lockC... | this.lockConfig = LockConfig.builder().build();
|
42,223 | Collection<String> hosts = Lists.newArrayList(hostsProperty.split(","));
Collection<Path> directories = new ArrayList<>();
for (String directoryString : directoriesProperty.split(",")) {
directories.add(java.nio.file.Paths.get(directoryString));
}
<BUG>new CqlMigrator(new LockConfig()).migrate(hosts, 9042, keyspaceProp... | new CqlMigrator(LockConfig.builder().build()).migrate(hosts, 9042, keyspaceProperty, directories);
|
42,224 | package com.easytoolsoft.easyreport.web.controller.common;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value = "/error")
<BUG>public class ErrorController extends AbstractController {
@RequestMapping(value = {"/404"})</BUG>... | public class ErrorController {
@RequestMapping(value = {"/404"})
|
42,225 | import java.util.Arrays;
import java.util.Deque;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
<BUG>import java.util.Map;
import org.jboss.modules.Module;</BUG>
import org.jboss.modules.ModuleIdentifier;
import org.jboss.modules.ModuleLoader;
abstract class AbstractPropertyConfi... | import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jboss.modules.Module;
|
42,226 | package org.jboss.as.patching;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.patching.runner.PatchingException;
import org.jboss.logging.Messages;
import org.jboss.logging.annotations.Message;
<BUG>import org.jboss.logging.annotations.MessageBundle;
import java.io.IOException;</BUG>
impor... | import org.jboss.logging.annotations.Cause;
import java.io.IOException;
|
42,227 | return factory.newClient(vertx, options);
}
int ERR_AUTHENTICATION_FAILED = 1;
int ERR_NOT_AUTHORISED = 2;
int ERR_NO_SUCH_CHANNEL = 3;
<BUG>int ERR_FAILED_TO_PERSIST = 4;
ClientFactory factory = ServiceHelper.loadFactory(ClientFactory.class);</BUG>
CompletableFuture<BsonObject> findByID(String binderName, String id);
... | int ERR_NO_SUCH_BINDER = 4;
int ERR_SERVER_ERROR = 100;
ClientFactory factory = ServiceHelper.loadFactory(ClientFactory.class);
|
42,228 | public void handleQueryResult(int size, BsonObject resp) {
Integer rQueryID = resp.getInteger(Protocol.QUERYRESULT_QUERYID);
Consumer<QueryResult> qrh = queryResultHandlers.get(rQueryID);
if (qrh == null) {
throw new IllegalStateException("Can't find query result handler");
<BUG>}
boolean last = resp.getBoolean(Protoco... | boolean ok = resp.getBoolean(Protocol.QUERYRESULT_OK);
boolean last = resp.getBoolean(Protocol.QUERYRESULT_LAST);
|
42,229 | import java.util.List;
import net.i2p.router.RouterContext;
import net.i2p.util.Log;
class BatchedPreprocessor extends TrivialPreprocessor {
private long _pendingSince;
<BUG>private final String _name;
public BatchedPreprocessor(RouterContext ctx, String name) {</BUG>
super(ctx);
_name = name;
}
| private static final boolean DEBUG = false;
public BatchedPreprocessor(RouterContext ctx, String name) {
|
42,230 | PendingGatewayMessage cur = pending.remove(0);
if (cur.getOffset() < cur.getData().length)
throw new IllegalArgumentException("i=" + i + " j=" + j + " off=" + cur.getOffset()
+ " len=" + cur.getData().length + " alloc=" + allocated);
if (timingBuf != null)
<BUG>timingBuf.append(" sent " + cur);
notePreprocessing(cur.ge... | if (DEBUG)
notePreprocessing(cur.getMessageId(), cur.getFragmentNumber(), cur.getData().length, cur.getMessageIds(), "flushed allocated");
|
42,231 | _context.statManager().addRateData("tunnel.writeDelay", cur.getLifetime(), cur.getData().length);
}
if (msg.getOffset() >= msg.getData().length) {
PendingGatewayMessage cur = pending.remove(0);
if (timingBuf != null)
<BUG>timingBuf.append(" sent perfect fit " + cur).append(".");
notePreprocessing(cur.getMessageId(), cu... | if (DEBUG)
notePreprocessing(cur.getMessageId(), cur.getFragmentNumber(), msg.getData().length, msg.getMessageIds(), "flushed tail, remaining: " + pending);
|
42,232 | int beforeSize = pending.size();
for (int i = 0; i < beforeSize; i++) {
PendingGatewayMessage cur = pending.get(0);
if (cur.getOffset() < cur.getData().length)
break;
<BUG>pending.remove(0);
notePreprocessing(cur.getMessageId(), cur.getFragmentNumber(), cur.getData().length, cur.getMessageIds(), "flushed remaining");</... | if (DEBUG)
notePreprocessing(cur.getMessageId(), cur.getFragmentNumber(), cur.getData().length, cur.getMessageIds(), "flushed remaining");
|
42,233 | package net.i2p.router.tunnel;
import java.util.List;
import java.util.Properties;
import net.i2p.router.RouterContext;
class BatchedRouterPreprocessor extends BatchedPreprocessor {
<BUG>private TunnelCreatorConfig _config;
protected HopConfig _hopConfig;
</BUG>
private final long _sendDelay;
| private final TunnelCreatorConfig _config;
protected final HopConfig _hopConfig;
|
42,234 | import net.i2p.data.Hash;
import net.i2p.router.RouterContext;
import net.i2p.util.ByteCache;
import net.i2p.util.Log;
import net.i2p.util.SimpleByteCache;
<BUG>class TrivialPreprocessor implements TunnelGateway.QueuePreprocessor {
</BUG>
protected final RouterContext _context;
protected final Log _log;
public static f... | abstract class TrivialPreprocessor implements TunnelGateway.QueuePreprocessor {
|
42,235 | _context = ctx;
_log = ctx.logManager().getLog(getClass());
}
public long getDelayAmount() { return 0; }
public boolean preprocessQueue(List<PendingGatewayMessage> pending, TunnelGateway.Sender sender, TunnelGateway.Receiver rec) {
<BUG>throw new IllegalArgumentException("unused, right?");
}</BUG>
protected void notePr... | throw new UnsupportedOperationException("unused, right?");
|
42,236 | if (!isLast)
msg.incrementFragmentNumber();
msg.setOffset(msg.getOffset() + payloadLength);
return offset;
}
<BUG>protected int getInstructionsSize(PendingGatewayMessage msg) {
</BUG>
if (msg.getFragmentNumber() > 0)
return 7;
int header = 1;
| protected static int getInstructionsSize(PendingGatewayMessage msg) {
|
42,237 | if (msg.getToRouter() != null)
header += 32;
header += 2;
return header;
}
<BUG>protected int getInstructionAugmentationSize(PendingGatewayMessage msg, int offset, int instructionsSize) {
</BUG>
int payloadLength = msg.getData().length - msg.getOffset();
if (offset + payloadLength + instructionsSize + IV_SIZE + 1 + 4 >... | protected static int getInstructionAugmentationSize(PendingGatewayMessage msg, int offset, int instructionsSize) {
|
42,238 | import net.i2p.data.i2np.I2NPMessage;
import net.i2p.data.i2np.TunnelGatewayMessage;
import net.i2p.router.RouterContext;
import net.i2p.util.Log;
import net.i2p.util.SimpleTimer2;
<BUG>class TunnelGateway {
</BUG>
protected final RouterContext _context;
protected final Log _log;
protected final List<PendingGatewayMess... | abstract class TunnelGateway {
|
42,239 | import org.apache.log4j.Logger;
class NitroError {
static final int NS_RESOURCE_EXISTS = 273;
static final int NS_RESOURCE_NOT_EXISTS=258;
static final int NS_NO_SERIVCE = 344;
<BUG>static final int NS_OPERATION_NOT_PERMITTED = 257;
}</BUG>
public class NetscalerResource implements ServerResource {
private String _name... | static final int NS_INTERFACE_ALREADY_BOUND_TO_VLAN = 2080;
}
|
42,240 | ipVlanBinding.set_id(vlanTag);
ipVlanBinding.set_ipaddress(vlanSelfIp);
ipVlanBinding.set_netmask(vlanNetmask);
apiCallResult = vlan_nsip_binding.add(_netscalerService, ipVlanBinding);
if (apiCallResult.errorcode != 0) {
<BUG>throw new ExecutionException("Failed to bind vlan with tag:" + vlanTag + " to the subnet due t... | throw new ExecutionException("Failed to bind VLAN with tag:" + vlanTag + " to the subnet due to " + apiCallResult.message);
} catch (nitro_exception e) {
throw new ExecutionException("Failed to bind VLAN with tage:"+ vlanTag + " to the subnet due to " + e.getMessage());
try {
vlan_interface_binding vlanBinding = new vl... |
42,241 | customTokens.put("%%mlFinalForestsPerHost%%", hubConfig.finalForestsPerHost.toString());
customTokens.put("%%mlTraceAppserverName%%", hubConfig.traceHttpName);
customTokens.put("%%mlTracePort%%", hubConfig.tracePort.toString());
customTokens.put("%%mlTraceDbName%%", hubConfig.traceDbName);
customTokens.put("%%mlTraceFo... | customTokens.put("%%mlTriggersDbName%%", hubConfig.triggersDbName);
customTokens.put("%%mlSchemasDbName%%", hubConfig.schemasDbName);
}
|
42,242 | @java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return io.grpc.grpclb.LoadBalancerProto.getDescriptor();
}
}
<BUG>private static io.grpc.ServiceDescriptor serviceDescriptor;
public static synchronized io.grpc.ServiceDescriptor getServiceDescriptor() {
if (serviceDescript... | protected LoadBalancerStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new LoadBalancerStub(channel, callOptions);
|
42,243 | @java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return io.grpc.reflection.testing.ReflectionTestProto.getDescriptor();
}
}
<BUG>private static io.grpc.ServiceDescriptor serviceDescriptor;
public static synchronized io.grpc.ServiceDescriptor getServiceDescriptor() {
if (s... | protected DynamicServiceStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new DynamicServiceStub(channel, callOptions);
|
42,244 | @java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return io.grpc.health.v1.HealthProto.getDescriptor();
}
}
<BUG>private static io.grpc.ServiceDescriptor serviceDescriptor;
public static synchronized io.grpc.ServiceDescriptor getServiceDescriptor() {
if (serviceDescriptor ... | protected HealthStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new HealthStub(channel, callOptions);
|
42,245 | @java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return io.grpc.reflection.v1alpha.ServerReflectionProto.getDescriptor();
}
}
<BUG>private static io.grpc.ServiceDescriptor serviceDescriptor;
public static synchronized io.grpc.ServiceDescriptor getServiceDescriptor() {
if ... | protected ServerReflectionStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new ServerReflectionStub(channel, callOptions);
|
42,246 | 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 CommandDel... | import java.util.stream.Stream;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
|
42,247 | .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... | String regionName = parse.args[1];
IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
|
42,248 | </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 exis... |
42,249 | 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[... | Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]);
if (!handlerOpt.isPresent())
IHandler handler = handlerOpt.get();
if (handler instanceof GlobalHandler)
|
42,250 | .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... | return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
|
42,251 | .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... | return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
|
42,252 | @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 stat... | private static FoxGuardMain instanceField;
|
42,253 | 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;
}
|
42,254 | return configDirectory;
}
public boolean isLoaded() {
return loaded;
}
<BUG>public static Cause getCause() {
return instance().pluginCause;
}</BUG>
public EconomyService getEconomyService() {
return economyService;
| [DELETED] |
42,255 | 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 Comm... | import java.util.stream.Stream;
import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
|
42,256 | .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... | return Stream.of("region", "handler")
.filter(new StartsWithPredicate(parse.current.token))
|
42,257 | 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 ... | 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) -> {
|
42,258 | 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 {
fg... | 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(n... |
42,259 | 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 {
fgOb... | Path singleDir = serverDir.resolve(name.toLowerCase());
logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
|
42,260 | 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(... | Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey());
if (regionOpt.isPresent()) {
IRegion region = regionOpt.get();
logger.info("Loading links for region \"" + region.getName() + "\"");
|
42,261 | 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("l... | 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() + "\"");
|
42,262 | 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
|
42,263 | .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))
.co... | return Stream.of("region", "worldregion", "handler", "controller")
|
42,264 | }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
<BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh")
.in(() -> task1)</BUG>
.in(() -> task2)
.process(Exec.exec((str, i) -> args... | return Task.named("exec", "/bin/sh").ofType(Exec.Result.class)
.in(() -> task1)
|
42,265 | return args;
}
static class MyTask {
static final int PLUS = 10;
static Task<String> create(String parameter) {
<BUG>return Task.ofType(String.class).named("MyTask", parameter)
.in(() -> Adder.create(parameter.length(), PLUS))</BUG>
.in(() -> Fib.create(parameter.length()))
.process((sum, fib) -> something(parameter, s... | return Task.named("MyTask", parameter).ofType(String.class)
.in(() -> Adder.create(parameter.length(), PLUS))
|
42,266 | final String instanceField = "from instance";
final TaskContext context = TaskContext.inmem();
final AwaitingConsumer<String> val = new AwaitingConsumer<>();
@Test
public void shouldJavaUtilSerialize() throws Exception {
<BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39)
.process(() -> 9999L);
Task... | Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class)
Task<String> task2 = Task.named("Baz", 40).ofType(String.class)
.in(() -> task1)
|
42,267 | assertEquals(des.id().name(), "Baz");
assertEquals(val.awaitAndGet(), "[9999] hello 10004");
}
@Test(expected = NotSerializableException.class)
public void shouldNotSerializeWithInstanceFieldReference() throws Exception {
<BUG>Task<String> task = Task.ofType(String.class).named("WithRef")
.process(() -> instanceField +... | Task<String> task = Task.named("WithRef").ofType(String.class)
.process(() -> instanceField + " causes an outer reference");
|
42,268 | serialize(task);
}
@Test
public void shouldSerializeWithLocalReference() throws Exception {
String local = instanceField;
<BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef")
.process(() -> local + " won't cause an outer reference");</BUG>
serialize(task);
Task<String> des = deserialize();
context.e... | Task<String> task = Task.named("WithLocalRef").ofType(String.class)
.process(() -> local + " won't cause an outer reference");
|
42,269 | }
@RootTask
public static Task<String> standardArgs(int first, String second) {
firstInt = first;
secondString = second;
<BUG>return Task.ofType(String.class).named("StandardArgs", first, second)
.process(() -> second + " " + first * 100);</BUG>
}
@Test
public void shouldParseFlags() throws Exception {
| return Task.named("StandardArgs", first, second).ofType(String.class)
.process(() -> second + " " + first * 100);
|
42,270 | assertThat(parsedEnum, is(CustomEnum.BAR));
}
@RootTask
public static Task<String> enums(CustomEnum enm) {
parsedEnum = enm;
<BUG>return Task.ofType(String.class).named("Enums", enm)
.process(enm::toString);</BUG>
}
@Test
public void shouldParseCustomTypes() throws Exception {
| return Task.named("Enums", enm).ofType(String.class)
.process(enm::toString);
|
42,271 | assertThat(parsedType.content, is("blarg parsed for you!"));
}
@RootTask
public static Task<String> customType(CustomType myType) {
parsedType = myType;
<BUG>return Task.ofType(String.class).named("Types", myType.content)
.process(() -> myType.content);</BUG>
}
public enum CustomEnum {
BAR
| return Task.named("Types", myType.content).ofType(String.class)
.process(() -> myType.content);
|
42,272 | TaskContext taskContext = TaskContext.inmem();
TaskContext.Value<Long> value = taskContext.evaluate(fib92);
value.consume(f92 -> System.out.println("fib(92) = " + f92));
}
static Task<Long> create(long n) {
<BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n);
</BUG>
if (n < 2) {
return fib
.process(() ... | TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
|
42,273 | editor.getSketch().getCode(i).getPrettyName().length() * 10);
}
return w;
}
private int estimateFrameHeight(){
<BUG>return Math.min(20 * (editor.getSketch().getCodeCount() + 1),
frmOutlineView.getHeight());
}</BUG>
public void show() {
| int t = Math.max(4, editor.getSketch().getCodeCount() + 1);
return Math.min(20 * t, frmOutlineView.getHeight());
|
42,274 | private static final String DATASET_CAPACITY_TABLE = "dataset_capacity";
private static final String DATASET_TAG_TABLE = "dataset_tag";
private static final String DATASET_CASE_SENSITIVE_TABLE = "dataset_case_sensitivity";
private static final String DATASET_REFERENCE_TABLE = "dataset_reference";
private static final S... | private static final String DATASET_SECURITY_TABLE = "dataset_security_info";
|
42,275 | throw new IllegalArgumentException(
"Dataset deployment info update fail, " + "Json missing necessary fields: " + root.toString());
</BUG>
}
<BUG>final Object[] idUrn = findIdAndUrn(idNode, urnNode);
final Integer datasetId = (Integer) idUrn[0];</BUG>
final String urn = (String) idUrn[1];
ObjectMapper om = new ObjectMa... | "Dataset deployment info update error, missing necessary fields: " + root.toString());
final Object[] idUrn = findDataset(root);
if (idUrn[0] == null || idUrn[1] == null) {
throw new IllegalArgumentException("Cannot identify dataset from id/uri/urn: " + root.toString());
final Integer datasetId = (Integer) idUrn[0];
|
42,276 | rec.setModifiedTime(System.currentTimeMillis() / 1000);
if (datasetId == 0) {
DatasetRecord record = new DatasetRecord();
record.setUrn(urn);
record.setSourceCreatedTime("" + rec.getCreateTime() / 1000);
<BUG>record.setSchema(rec.getOriginalSchema());
record.setSchemaType(rec.getFormat());
</BUG>
record.setFields((Str... | record.setSchema(rec.getOriginalSchema().getText());
record.setSchemaType(rec.getOriginalSchema().getFormat());
|
42,277 | datasetId = Integer.valueOf(DatasetDao.getDatasetByUrn(urn).get("id").toString());
rec.setDatasetId(datasetId);
}
else {
DICT_DATASET_WRITER.execute(UPDATE_DICT_DATASET_WITH_SCHEMA_CHANGE,
<BUG>new Object[]{rec.getOriginalSchema(), rec.getFormat(), StringUtil.objectToJsonString(rec.getFieldSchema()),
"API", System.curr... | new Object[]{rec.getOriginalSchema().getText(), rec.getOriginalSchema().getFormat(),
StringUtil.objectToJsonString(rec.getFieldSchema()), "API", System.currentTimeMillis() / 1000, datasetId});
|
42,278 | case "deploymentInfo":
try {
DatasetInfoDao.updateDatasetDeployment(rootNode);
} catch (Exception ex) {
Logger.debug("Metadata change exception: deployment ", ex);
<BUG>}
break;
case "caseSensitivity":
try {
DatasetInfoDao.updateDatasetCaseSensitivity(rootNode);
} catch (Exception ex) {
Logger.debug("Metadata change ex... | [DELETED] |
42,279 | import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
public class HttpClientBuilder {
private CloseableHttpClient closeableHttpClient;
private CloseableHttpResponse closeableHttpResponse;
<BUG>private OnError onError = new DefaultOnError();
public HttpClientBuilder client() {</B... | private OnError onError;
public HttpClientBuilder(OnError onError) {
this.onError = onError;
}
public HttpClientBuilder client() {
|
42,280 | chart.addYAxisLabels(AxisLabelsFactory.newAxisLabels(labels));
chart.addXAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, max));
chart.setBarWidth(BarChart.AUTO_RESIZE);
chart.setSize(600, 500);
chart.setHorizontal(true);
<BUG>chart.setTitle("Total Evaluations by User");
showChartImg(resp, chart.toURLString())... | chart.setDataEncoding(DataEncoding.TEXT);
return chart;
}
|
42,281 | checkEvaluationsEqual(eval4, foundissueProto.getEvaluations(0));
checkEvaluationsEqual(eval5, foundissueProto.getEvaluations(1));
}
public void testGetRecentEvaluationsNoneFound() throws Exception {
DbIssue issue = createDbIssue("fad", persistenceHelper);
<BUG>DbEvaluation eval1 = createEvaluation(issue, "someone", 100... | [DELETED] |
42,282 | public int read() throws IOException {
return inputStream.read();
}
});
}
<BUG>}
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {</BUG>
DbUser user;
Query query = getPersistenceManager().newQuery("select from " + persistenceHelper.getDbUserClass().getName()
+ " where openid == :myopenid")... | @SuppressWarnings({"unchecked"})
protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {
|
42,283 | eval.setComment("my comment");
eval.setDesignation("MUST_FIX");
eval.setIssue(issue);
eval.setWhen(when);
eval.setWho(user.createKeyObject());
<BUG>eval.setEmail(who);
return eval;</BUG>
}
protected PersistenceManager getPersistenceManager() {
return testHelper.getPersistenceManager();
| issue.addEvaluation(eval);
return eval;
|
42,284 | import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
@XStreamAlias("associationCommandClass")
public class ZWaveAssociationCommandClass extends ZWaveCommandClass implements ZWaveCommandClassInitialization {
@XStreamOmitField
<BUG>private static final Lo... | private static final int MAX_SUPPORTED_VERSION = 2;
private static final int ASSOCIATIONCMD_SET = 1;
|
42,285 | private ZWaveAssociationGroup pendingAssociation = null;
private int maxGroups = 0;
@XStreamOmitField
private boolean initialiseDone = false;
public ZWaveAssociationCommandClass(ZWaveNode node, ZWaveController controller, ZWaveEndpoint endpoint) {
<BUG>super(node, controller, endpoint);
}</BUG>
@Override
public Command... | versionMax = MAX_SUPPORTED_VERSION;
}
|
42,286 | assertTrue(Arrays.equals(msg.getMessageBuffer(), expectedResponse1));
msg = cls.removeAssociationMessage(1, 2, 3);
msg.setCallbackId(4);
assertTrue(Arrays.equals(msg.getMessageBuffer(), expectedResponse2));
}
<BUG>@Test
public void setAssociationMessage() {
ZWaveMultiAssociationCommandClass cls = (ZWaveMultiAssociatio... | public void clearAssociationMessage() {
ZWaveMultiAssociationCommandClass cls = (ZWaveMultiAssociationCommandClass) getCommandClass(
|
42,287 | import org.slf4j.LoggerFactory;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
@XStreamAlias("multiAssociationCommandClass")
public class ZWaveMultiAssociationCommandClass extends ZWaveCommandClass implements ZWaveCommandClassInitialization {
<BUG... | private static final int MAX_SUPPORTED_VERSION = 3;
private static final int MULTI_INSTANCE_MARKER = 0x00;
|
42,288 | private ZWaveAssociationGroup pendingAssociation = null;
@XStreamOmitField
private boolean initialiseDone = false;
private int maxGroups = 0;
public ZWaveMultiAssociationCommandClass(ZWaveNode node, ZWaveController controller, ZWaveEndpoint endpoint) {
<BUG>super(node, controller, endpoint);
}</BUG>
@Override
public Co... | versionMax = MAX_SUPPORTED_VERSION;
}
|
42,289 | for (ZWaveAssociation member : newMembers.getAssociations()) {
if (currentMembers.isAssociated(member.getNode(), member.getEndpoint()) == false) {
controllerHandler.sendData(
node.setAssociation(null, groupIndex, member.getNode(), member.getEndpoint()));
}
<BUG>}
controllerHandler.sendData(node.getAssociation(groupInde... | if (node.getAssociationGroup(groupIndex).getAssociationCnt() == 0) {
controllerHandler.sendData(node.clearAssociation(groupIndex));
controllerHandler.sendData(node.getAssociation(groupIndex));
|
42,290 | import org.codehaus.groovy.control.CompilationUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class GroovyTreeParser implements TreeParser {
private static final Logger logger = LoggerFactory.getLogger(GroovyTreeParser.class);
<BUG>private static final String GROOVY_DEFAULT_INTERFACE = "groo... | private Indexer indexer = new Indexer();
|
42,291 | if (scriptClass != null) {
sourceUnit.getAST().getStatementBlock().getVariableScope().getDeclaredVariables().values().forEach(
variable -> {
SymbolInformation symbol =
getVariableSymbolInformation(scriptClass.getName(), sourceUri, variable);
<BUG>addToValueSet(newTypeReferences, variable.getType().getName(), symbol);
s... | newIndexer.addSymbol(sourceUnit.getSource().getURI(), symbol);
if (classes.containsKey(variable.getType().getName())) {
newIndexer.addReference(classes.get(variable.getType().getName()),
GroovyLocations.createLocation(sourceUri, variable.getType()));
|
42,292 | }
if (typeReferences.containsKey(foundSymbol.getName())) {
foundReferences.addAll(typeReferences.get(foundSymbol.getName()));</BUG>
}
<BUG>return foundReferences;
}</BUG>
@Override
public Set<SymbolInformation> getFilteredSymbols(String query) {
checkNotNull(query, "query must not be null");
Pattern pattern = getQueryP... | });
sourceUnit.getAST().getStatementBlock()
.visit(new MethodVisitor(newIndexer, sourceUri, sourceUnit.getAST().getScriptClassDummy(),
classes, Maps.newHashMap(), Optional.absent(), workspaceUriSupplier));
|
42,293 | <BUG>package com.palantir.ls.server.api;
import io.typefox.lsapi.ReferenceParams;</BUG>
import io.typefox.lsapi.SymbolInformation;
import java.net.URI;
import java.util.Map;
| import com.google.common.base.Optional;
import io.typefox.lsapi.Location;
import io.typefox.lsapi.Position;
import io.typefox.lsapi.ReferenceParams;
|
42,294 | import java.util.Map;
import java.util.Set;
public interface TreeParser {
void parseAllSymbols();
Map<URI, Set<SymbolInformation>> getFileSymbols();
<BUG>Map<String, Set<SymbolInformation>> getTypeReferences();
Set<SymbolInformation> findReferences(ReferenceParams params);
Set<SymbolInformation> getFilteredSymbols(St... | Map<Location, Set<Location>> getReferences();
Set<Location> findReferences(ReferenceParams params);
Optional<Location> gotoDefinition(URI uri, Position position);
Set<SymbolInformation> getFilteredSymbols(String query);
|
42,295 | .workspaceSymbolProvider(true)
.referencesProvider(true)
.completionProvider(new CompletionOptionsBuilder()
.resolveProvider(false)
.triggerCharacter(".")
<BUG>.build())
.build();</BUG>
InitializeResult result = new InitializeResultBuilder()
.capabilities(capabilities)
.build();
| .definitionProvider(true)
|
42,296 | package com.palantir.ls.server;
import com.palantir.ls.server.api.CompilerWrapper;
import com.palantir.ls.server.api.TreeParser;
import com.palantir.ls.server.api.WorkspaceCompiler;
<BUG>import io.typefox.lsapi.FileEvent;
import io.typefox.lsapi.PublishDiagnosticsParams;</BUG>
import io.typefox.lsapi.ReferenceParams;
i... | import com.google.common.base.Optional;
import io.typefox.lsapi.Location;
import io.typefox.lsapi.Position;
import io.typefox.lsapi.PublishDiagnosticsParams;
|
42,297 | 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() );
|
42,298 | sink.section1();
sink.sectionTitle1();
sink.text( getI18nString( locale, "title" ) );
sink.sectionTitle1_();
Map dependencyMap = getDependencyMap();
<BUG>generateLegend( locale, sink );
generateStats( locale, sink, dependencyMap );
generateConvergence( locale, sink, dependencyMap );
sink.section1_();</BUG>
sink.body_()... | sink.lineBreak();
sink.section1_();
|
42,299 | Iterator it = artifactMap.keySet().iterator();
while ( it.hasNext() )
{
String version = (String) it.next();
sink.tableRow();
<BUG>sink.tableCell();
sink.text( version );</BUG>
sink.tableCell_();
sink.tableCell();
generateVersionDetails( sink, artifactMap, version );
| sink.tableCell( String.valueOf( cellWidth ) + "px" );
sink.text( version );
|
42,300 | sink.tableCell();
sink.text( getI18nString( locale, "legend.shared" ) );
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
<BUG>sink.tableCell();
iconError( sink );</BUG>
sink.tableCell_();
sink.tableCell();
sink.text( getI18nString( locale, "legend.different" ) );
| sink.tableCell( "15px" ); // according /images/icon_error_sml.gif
iconError( sink );
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.