id int64 1 49k | buggy stringlengths 34 37.5k | fixed stringlengths 2 37k |
|---|---|---|
10,001 | } else if (SNodeOperations.isInstanceOf(from, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103556dcafL, "jetbrains.mps.lang.structure.structure.InterfaceConceptDeclaration")) && SNodeOperations.isInstanceOf(to, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103556dcafL, "jetbrains.mps.lang.structure.structure.InterfaceConceptDeclaration"))) {
ListSequence.fromList(SLinkOperations.getChildren(SNodeOperations.cast(to, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103556dcafL, "jetbrains.mps.lang.structure.structure.InterfaceConceptDeclaration")), MetaAdapterFactory.getContainmentLink(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103556dcafL, 0x110356e9df4L, "extends"))).addElement(createInterfaceConceptReference_c4c66o_a0a0a0e0b(SNodeOperations.cast(from, MetaAdapterFactory.getConcept(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x1103556dcafL, "jetbrains.mps.lang.structure.structure.InterfaceConceptDeclaration"))));
} else {
throw new IllegalStateException();
}
<BUG>migrationBuilder.addPart(initialState._1().getDeclarationNode(), finalState._1().getDeclarationNode(), createMoveConcept_c4c66o_c0a5a1());
}</BUG>
public Collection<SNode> findInstances(final SAbstractConcept concept, SearchScope searchScope) {
{
final SearchScope scope = CommandUtil.createScope(searchScope);
| migrationBuilder.addPart(from, to, createMoveConcept_c4c66o_c0a5a1());
|
10,002 | package sagan.guides.support;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
<BUG>import org.apache.commons.lang.WordUtils;
</BUG>
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.Attributes;
import org.asciidoctor.OptionsBuilder;
| import org.apache.commons.lang3.text.WordUtils;
|
10,003 | }
@Override</BUG>
public String[] getCommands() {
return new String[]{CMD_ADD,CMD_SUB,CMD_MUL,CMD_DIV}; //To change body of implemented methods use File | Settings | File Templates.
}
<BUG>@Override
public TaskResult getFallBack(TaskContext taskContext, String command, TaskRequestWrapper taskRequestWrapper)
{
return null; //To change body of implemented methods use File | Settings | File Templates.</BUG>
}
| public String getName() {
return "Arithmetic";
public void shutdown(TaskContext taskContext) throws Exception {
|
10,004 | public String getDetails() {
String details = "Service Class: " + this.getThriftServiceClass() + "\n";
details += "Endpoint: " + this.getThriftServer() + ":" + this.getThriftPort() + "\n";
details += "Timeout: " + this.getThriftTimeoutMillis() + "ms\n";
details += "Executor Timeout: " + this.getProxyExecutorTimeout() + "ms\n";
<BUG>details += "Methods: " + StringUtils.join(processMap.keySet().toArray(new String[]{}),", ") + "\n";
</BUG>
return details;
}
public int getExecutorTimeout(String commandName) {
| details += "Methods: " + StringUtils.collectionToDelimitedString(processMap.keySet(), ", ") + "\n";
|
10,005 | import com.flipkart.phantom.task.utils.StringUtils;</BUG>
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
<BUG>import org.springframework.beans.factory.DisposableBean;
import org.trpr.platform.core.PlatformException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
</BUG>
public abstract class TaskHandler extends AbstractHandler implements DisposableBean {
| package com.flipkart.phantom.task.impl;
import com.flipkart.phantom.task.spi.AbstractHandler;
import com.flipkart.phantom.task.spi.Decoder;
import com.flipkart.phantom.task.spi.TaskContext;
import org.springframework.util.StringUtils;
import java.util.*;
|
10,006 | }
@Override
public String getDetails() {
String[] commands = getCommands();
if (commands != null && commands.length > 0) {
<BUG>return "Commands: " + StringUtils.join(commands,", ");
}</BUG>
return "No commands registered";
}
public void init(TaskContext taskContext) throws Exception {
| return "Commands: " + StringUtils.collectionToDelimitedString(Arrays.asList(commands), ", ");
|
10,007 | for (Map<String,String> initParam : this.initializationCommands) {
String commandName = initParam.get(PARAM_COMMAND_NAME);
if (commandName == null) {
LOGGER.error("Fatal error. commandName not specified in initializationCommands for TaskHandler: " + this.getName());
throw new UnsupportedOperationException("Fatal error. commandName not specified in initializationCommands of TaskHandler: "+this.getName());
<BUG>}
TaskRequestWrapper requestWrapper = new TaskRequestWrapper();
requestWrapper.setParams(new HashMap<String, String>(initParam));
TaskResult result = this.execute(taskContext, commandName,requestWrapper);
if (result != null && result.isSuccess() == false) {
</BUG>
throw new PlatformException("Initialization command: "+commandName+" failed for TaskHandler: "+this.getName()+" The params were: "+initParam);
| [DELETED] |
10,008 | throw new PlatformException("Initialization command: "+commandName+" failed for TaskHandler: "+this.getName()+" The params were: "+initParam);
}
}
}
}
<BUG>public abstract <T> TaskResult<T> execute(TaskContext taskContext, String command, TaskRequestWrapper<T> requestWrapper) throws RuntimeException;
public abstract String[] getCommands();</BUG>
public void destroy() throws Exception {
this.shutdown(null);
| public abstract TaskResult<byte[]> execute(TaskContext taskContext, String command, Map<String,String> params, byte[] data) throws RuntimeException;
public <T> TaskResult<T> execute(TaskContext taskContext, String command,
TaskRequestWrapper taskRequestWrapper,Decoder<T> decoder) throws RuntimeException {
throw new UnsupportedOperationException("Not Supported. It has to be implemented by sub-classes");
public abstract String[] getCommands();
|
10,009 | package com.flipkart.phantom.task.impl;
<BUG>import com.fasterxml.jackson.databind.ObjectMapper;
import com.flipkart.phantom.task.spi.TaskContext;</BUG>
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.InetAddress;
| import com.flipkart.phantom.task.spi.Decoder;
import com.flipkart.phantom.task.spi.TaskContext;
|
10,010 | public String getConfig(String group, String key, int count) {
Map<String, String> params = new HashMap<String, String>();
params.put("group", group);
params.put("key", key);
params.put("count", Integer.toString(count));
<BUG>TaskRequestWrapper taskRequestWrapper = new TaskRequestWrapper();
taskRequestWrapper.setParams(params);
TaskResult result = this.executeCommand(GET_CONFIG_COMMAND, taskRequestWrapper);
</BUG>
if (result == null)
| TaskResult result = this.executeCommand(GET_CONFIG_COMMAND, null, params);
|
10,011 | listener.handleJsonMetric(jsonString.getBuffer().toString());
}
for (HystrixThreadPoolMetrics threadPoolMetrics : HystrixThreadPoolMetrics.getInstances()) {
HystrixThreadPoolKey key = threadPoolMetrics.getThreadPoolKey();
StringWriter jsonString = new StringWriter();
<BUG>JsonGenerator json = jsonFactory.createJsonGenerator(jsonString);
json.writeStartObject();</BUG>
json.writeStringField("type", "HystrixThreadPool");
json.writeStringField("name", key.name());
json.writeNumberField("currentTime", System.currentTimeMillis());
| JsonGenerator json = jsonFactory.createGenerator(jsonString);
json.writeStartObject();
|
10,012 | public abstract class HystrixTaskHandler extends TaskHandler {
public static final int DEFAULT_EXECUTOR_TIMEOUT = 1000;
private Map<String,Integer> concurrentPoolSizeParams = new HashMap<String,Integer>();
private Map<String,Integer> commandPoolSizeParams = new HashMap<String,Integer>();
protected Map<String,Integer> executorTimeouts = new HashMap<String, Integer>();
<BUG>public abstract TaskResult getFallBack(TaskContext taskContext, String command, TaskRequestWrapper taskRequestWrapper);
public ExecutionIsolationStrategy getIsolationStrategy() {</BUG>
return ExecutionIsolationStrategy.THREAD;
}
public int getExecutorTimeout(String commandName) {
| public abstract TaskResult<byte[]> getFallBack(TaskContext taskContext, String command, Map<String,String> params, byte[] data);
public ExecutionIsolationStrategy getIsolationStrategy() {
|
10,013 | package com.flipkart.phantom.runtime.impl.server.oio;
import com.flipkart.phantom.event.ServiceProxyEvent;
import com.flipkart.phantom.event.ServiceProxyEventProducer;
import com.flipkart.phantom.runtime.impl.server.AbstractNetworkServer;
import com.flipkart.phantom.runtime.impl.server.concurrent.NamedThreadFactory;
<BUG>import com.flipkart.phantom.runtime.impl.server.netty.handler.command.CommandInterpreter;
import com.flipkart.phantom.task.impl.*;
import com.flipkart.phantom.task.spi.Decoder;</BUG>
import com.flipkart.phantom.task.spi.repository.ExecutorRepository;
| import com.flipkart.phantom.task.impl.TaskHandler;
import com.flipkart.phantom.task.impl.TaskHandlerExecutor;
import com.flipkart.phantom.task.impl.TaskRequestWrapper;
import com.flipkart.phantom.task.impl.TaskResult;
|
10,014 | package org.neo4j.server.rest;
<BUG>import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import org.junit.After;</BUG>
import org.junit.Before;
import org.junit.Test;
| import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import javax.ws.rs.core.MediaType;
import org.junit.After;
|
10,015 | server = null;
}
@Test
public void shouldRespondWithTheWebAdminClientSettings() throws Exception {
String url = functionalTestHelper.mangementUri() + "properties/neo4j-servers";
<BUG>ClientResponse response = Client.create().resource(url).get(ClientResponse.class);
String json = response.getEntity(String.class);</BUG>
assertEquals(200, response.getStatus());
assertThat(json, containsString("\"url\" : \"" + server.baseUri() + "db/data/\""));
| ClientResponse response = Client.create().resource( url ).accept(
MediaType.APPLICATION_JSON_TYPE ).get( ClientResponse.class );
String json = response.getEntity(String.class);
|
10,016 | package org.neo4j.server.rest;
import static org.junit.Assert.assertEquals;
<BUG>import java.io.IOException;
import org.junit.After;</BUG>
import org.junit.Before;
import org.junit.Test;
import org.neo4j.server.NeoServer;
| import javax.ws.rs.core.MediaType;
import org.junit.After;
|
10,017 | this.descriptorHash = entry.moduleDescriptorHash;
this.ageMillis = timeProvider.getCurrentTime() - entry.createTimestamp;
if (moduleDescriptor == null) {
metaData = null;
} else {
<BUG>metaData = new ModuleDescriptorAdapter(moduleDescriptor);
metaData.setChanging(entry.isChanging);
}</BUG>
}
| ModuleDescriptorAdapter moduleDescriptorAdapter = new ModuleDescriptorAdapter(moduleDescriptor);
moduleDescriptorAdapter.setChanging(entry.isChanging);
moduleDescriptorAdapter.setMetaDataOnly(entry.isMetaDataOnly);
metaData = moduleDescriptorAdapter;
|
10,018 | import org.gradle.util.VersionNumber;
import java.io.File;
public enum CacheLayout {
ROOT(null, "modules", 2),
FILE_STORE(ROOT, "files", 1),
<BUG>META_DATA(ROOT, "metadata", 3);
</BUG>
private final String name;
private final CacheLayout parent;
private final int version;
| META_DATA(ROOT, "metadata", 4);
|
10,019 | import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
<BUG>import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;</BUG>
public final class PatchUtils {
| import java.text.DateFormat;
import java.util.Date;
import java.util.List;
|
10,020 | package org.jboss.as.patching.runner;
<BUG>import org.jboss.as.boot.DirectoryStructure;
import org.jboss.as.patching.LocalPatchInfo;</BUG>
import org.jboss.as.patching.PatchInfo;
import org.jboss.as.patching.PatchLogger;
import org.jboss.as.patching.PatchMessages;
| import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp;
import org.jboss.as.patching.CommonAttributes;
import org.jboss.as.patching.LocalPatchInfo;
|
10,021 | private static final String PATH_DELIMITER = "/";
public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT;
enum Element {
ADDED_BUNDLE("added-bundle"),
ADDED_MISC_CONTENT("added-misc-content"),
<BUG>ADDED_MODULE("added-module"),
BUNDLES("bundles"),</BUG>
CUMULATIVE("cumulative"),
DESCRIPTION("description"),
MISC_FILES("misc-files"),
| APPLIES_TO_VERSION("applies-to-version"),
BUNDLES("bundles"),
|
10,022 | final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
<BUG>case APPLIES_TO_VERSION:
builder.addAppliesTo(value);
break;</BUG>
case RESULTING_VERSION:
if(type == Patch.PatchType.CUMULATIVE) {
| [DELETED] |
10,023 | final StringBuilder path = new StringBuilder();
for(final String p : item.getPath()) {
path.append(p).append(PATH_DELIMITER);
}
path.append(item.getName());
<BUG>writer.writeAttribute(Attribute.PATH.name, path.toString());
if(type != ModificationType.REMOVE) {</BUG>
writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash()));
}
if(type != ModificationType.ADD) {
| if (item.isDirectory()) {
writer.writeAttribute(Attribute.DIRECTORY.name, "true");
if(type != ModificationType.REMOVE) {
|
10,024 | package org.jboss.as.patching;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.patching.runner.PatchingException;
import org.jboss.logging.Messages;
import org.jboss.logging.annotations.Message;
<BUG>import org.jboss.logging.annotations.MessageBundle;
import java.io.IOException;</BUG>
import java.util.List;
@MessageBundle(projectCode = "JBAS")
public interface PatchMessages {
| import org.jboss.logging.annotations.Cause;
import java.io.IOException;
|
10,025 | }
@RootTask
static Task<Exec.Result> exec(String parameter, int number) {
Task<String> task1 = MyTask.create(parameter);
Task<Integer> task2 = Adder.create(number, number + 2);
<BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh")
.in(() -> task1)</BUG>
.in(() -> task2)
.process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\"")));
}
| return Task.named("exec", "/bin/sh").ofType(Exec.Result.class)
.in(() -> task1)
|
10,026 | return args;
}
static class MyTask {
static final int PLUS = 10;
static Task<String> create(String parameter) {
<BUG>return Task.ofType(String.class).named("MyTask", parameter)
.in(() -> Adder.create(parameter.length(), PLUS))</BUG>
.in(() -> Fib.create(parameter.length()))
.process((sum, fib) -> something(parameter, sum, fib));
}
| return Task.named("MyTask", parameter).ofType(String.class)
.in(() -> Adder.create(parameter.length(), PLUS))
|
10,027 | final String instanceField = "from instance";
final TaskContext context = TaskContext.inmem();
final AwaitingConsumer<String> val = new AwaitingConsumer<>();
@Test
public void shouldJavaUtilSerialize() throws Exception {
<BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39)
.process(() -> 9999L);
Task<String> task2 = Task.ofType(String.class).named("Baz", 40)
.in(() -> task1)</BUG>
.ins(() -> singletonList(task1))
| Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class)
Task<String> task2 = Task.named("Baz", 40).ofType(String.class)
.in(() -> task1)
|
10,028 | assertEquals(des.id().name(), "Baz");
assertEquals(val.awaitAndGet(), "[9999] hello 10004");
}
@Test(expected = NotSerializableException.class)
public void shouldNotSerializeWithInstanceFieldReference() throws Exception {
<BUG>Task<String> task = Task.ofType(String.class).named("WithRef")
.process(() -> instanceField + " causes an outer reference");</BUG>
serialize(task);
}
@Test
| Task<String> task = Task.named("WithRef").ofType(String.class)
.process(() -> instanceField + " causes an outer reference");
|
10,029 | serialize(task);
}
@Test
public void shouldSerializeWithLocalReference() throws Exception {
String local = instanceField;
<BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef")
.process(() -> local + " won't cause an outer reference");</BUG>
serialize(task);
Task<String> des = deserialize();
context.evaluate(des).consume(val);
| Task<String> task = Task.named("WithLocalRef").ofType(String.class)
.process(() -> local + " won't cause an outer reference");
|
10,030 | }
@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);
|
10,031 | 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);
|
10,032 | 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);
|
10,033 | TaskContext taskContext = TaskContext.inmem();
TaskContext.Value<Long> value = taskContext.evaluate(fib92);
value.consume(f92 -> System.out.println("fib(92) = " + f92));
}
static Task<Long> create(long n) {
<BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n);
</BUG>
if (n < 2) {
return fib
.process(() -> n);
| TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
|
10,034 | import org.neo4j.graphdb.traversal.ReturnFilter;
import org.neo4j.graphdb.traversal.SourceSelector;
import org.neo4j.graphdb.traversal.Traverser;
class TraverserImpl implements Traverser
{
<BUG>final UniquenessFilter uniquness;
private final PruneEvaluator pruning;
private final ReturnFilter filter;
private final SourceSelector sourceSelector;</BUG>
private final TraversalDescriptionImpl description;
| [DELETED] |
10,035 | if ( relationship.equals( howIGotHere ) )
{
continue;
}
Node node = relationship.getOtherNode( source );
<BUG>ExpansionSource next = new ExpansionSourceImpl( traverser, this, node,
</BUG>
expander, relationship );
if ( traverser.okToProceed( next ) )
{
| ExpansionSource next = new ExpansionSourceImpl( traverser, this, depth + 1, node,
|
10,036 | import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import java.io.IOException;
<BUG>import java.net.ServerSocket;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;</BUG>
import org.junit.Test;
| import java.net.URI;
import org.dummy.web.service.DummyThirdPartyWebService;
|
10,037 | package org.neo4j.server.configuration;
<BUG>import java.io.File;
import java.util.Map;
import org.apache.commons.configuration.CompositeConfiguration;</BUG>
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
| import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import org.apache.commons.configuration.CompositeConfiguration;
|
10,038 | private String rrdbDir = "/tmp/neo.rr.db";
private String webAdminUri = "http://localhost:7474/db/manage/";
private String webAdminDataUri = "http://localhost:7474/db/data/";
private StartupHealthCheck startupHealthCheck;
private AddressResolver addressResolver = new LocalhostAddressResolver();
<BUG>private static enum WhatToDo { CREATE_GOOD_TUNING_FILE,
CREATE_DANGLING_TUNING_FILE_PROPERTY,
CREATE_CORRUPT_TUNING_FILE };
private WhatToDo action;</BUG>
public static ServerBuilder server() {
| private HashMap<String, String> thirdPartyPackages = new HashMap<String, String>();
private static enum WhatToDo {
CREATE_GOOD_TUNING_FILE, CREATE_DANGLING_TUNING_FILE_PROPERTY, CREATE_CORRUPT_TUNING_FILE
private WhatToDo action;
|
10,039 | writePropertyToFile(Configurator.WEBSERVER_PORT_PROPERTY_KEY, portNo, temporaryConfigFile);
}
writePropertyToFile(Configurator.WEBADMIN_NAMESPACE_PROPERTY_KEY + ".rrdb.location", rrdbDir, temporaryConfigFile);
writePropertyToFile(Configurator.WEB_ADMIN_PATH_PROPERTY_KEY, webAdminUri, temporaryConfigFile);
writePropertyToFile(Configurator.WEB_ADMIN_REST_API_PATH_PROPERTY_KEY, webAdminDataUri, temporaryConfigFile);
<BUG>if(action == WhatToDo.CREATE_GOOD_TUNING_FILE) {
</BUG>
File databaseTuningPropertyFile = createTempPropertyFile();
writePropertyToFile("neostore.nodestore.db.mapped_memory", "25M", databaseTuningPropertyFile);
writePropertyToFile("neostore.relationshipstore.db.mapped_memory", "50M", databaseTuningPropertyFile);
| if (action == WhatToDo.CREATE_GOOD_TUNING_FILE) {
|
10,040 | package org.neo4j.server;
import java.io.File;
import java.io.IOException;
<BUG>import java.net.URI;
import java.net.UnknownHostException;</BUG>
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
| import java.net.URISyntaxException;
import java.net.UnknownHostException;
|
10,041 | import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.management.MalformedObjectNameException;
import org.apache.commons.configuration.Configuration;
<BUG>import org.neo4j.server.configuration.Configurator;
import org.neo4j.server.configuration.validation.DatabaseLocationMustBeSpecifiedRule;</BUG>
import org.neo4j.server.configuration.validation.Validator;
import org.neo4j.server.database.Database;
import org.neo4j.server.logging.Logger;
| import org.neo4j.server.configuration.ThirdPartyJaxRsPackage;
import org.neo4j.server.configuration.validation.DatabaseLocationMustBeSpecifiedRule;
|
10,042 | log.info("Mounting webadmin at [%s]", Configurator.WEB_ADMIN_PATH);
webServer.addStaticContent(Configurator.WEB_ADMIN_STATIC_WEB_CONTENT_LOCATION, Configurator.WEB_ADMIN_PATH);
log.info("Mounting management API at [%s]", Configurator.WEB_ADMIN_REST_API_PATH);
webServer.addJAXRSPackages(listFrom(new String[] { Configurator.WEB_ADMIN_REST_API_PACKAGE }), Configurator.WEB_ADMIN_REST_API_PATH);
log.info("Mounting REST API at [%s]", Configurator.REST_API_PATH);
<BUG>webServer.addJAXRSPackages(listFrom(new String[] { Configurator.REST_API_PACKAGE }), Configurator.REST_API_PATH);
try {</BUG>
webServer.start();
} catch (Exception e) {
log.error("Failed to start Neo Server on port [%d], reason [%s]", getWebServerPort(), e.getMessage());
| for(ThirdPartyJaxRsPackage tpp : configurator.getThirdpartyJaxRsClasses()) {
log.info("Mounting third-party JAX-RS package [%s] at [%s]", tpp.getPackageName(), tpp.getMountPoint());
webServer.addJAXRSPackages(listFrom(new String[] { tpp.getPackageName() }), tpp.getMountPoint());
}
try {
|
10,043 | return al;
}
public Database getDatabase() {
return database;
}
<BUG>public String baseUri() throws UnknownHostException {
</BUG>
StringBuilder sb = new StringBuilder();
sb.append("http");
int webServerPort = getWebServerPort();
| public URI baseUri() throws UnknownHostException {
|
10,044 | sb.append(addressResolver.getHostname());
if (webServerPort != 80) {
sb.append(":");
sb.append(webServerPort);
}
<BUG>sb.append("/");
return sb.toString();
}</BUG>
private URI generateUriFor(String serviceName) {
| try {
return new URI(sb.toString());
} catch (URISyntaxException e) {
throw new RuntimeException(e);
|
10,045 | if (serviceName.startsWith("/")) {
serviceName = serviceName.substring(1);
}
StringBuilder sb = new StringBuilder();
try {
<BUG>sb.append(baseUri());
</BUG>
sb.append(serviceName);
sb.append("/");
return new URI(sb.toString());
| sb.append(baseUri().toString());
|
10,046 | import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.ServiceVerificationHandler;
<BUG>import org.jboss.as.threads.ThreadsSubsystemThreadPoolOperationUtils.BoundedThreadPoolParameters;
</BUG>
import org.jboss.dmr.ModelNode;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
| import org.jboss.as.threads.ThreadPoolManagementUtils.BoundedThreadPoolParameters;
|
10,047 | params.getMaxThreads(),
params.getQueueLength(),
blocking,
params.getKeepAliveTime(),
params.isAllowCoreTimeout());
<BUG>ThreadsSubsystemThreadPoolOperationUtils.installThreadPoolService(service, params.getName(), serviceNameBase, params.getThreadFactory(),
defaultThreadFactoryProvider, service.getThreadFactoryInjector(), service.getHandoffExecutorInjector(),
params.getHandoffExecutor(), context.getServiceTarget(), newControllers, verificationHandler);
}</BUG>
ServiceName getServiceNameBase() {
| ThreadPoolManagementUtils.installThreadPoolService(service, params.getName(), serviceNameBase,
params.getThreadFactory(), threadFactoryResolver, service.getThreadFactoryInjector(),
params.getHandoffExecutor(), handoffExecutorResolver, service.getHandoffExecutorInjector(),
}
boolean isBlocking() {
return blocking;
}
|
10,048 | public class BoundedQueueThreadPoolRemove extends AbstractRemoveStepHandler {
private final BoundedQueueThreadPoolAdd addHandler;
public BoundedQueueThreadPoolRemove(final BoundedQueueThreadPoolAdd addHandler) {
this.addHandler = addHandler;
}
<BUG>protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) {
final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
final String name = address.getLastElement().getValue();
context.removeService(addHandler.getServiceNameBase().append(name));
}</BUG>
protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
| protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
final ThreadPoolManagementUtils.BoundedThreadPoolParameters params =
ThreadPoolManagementUtils.parseBoundedThreadPoolParameters(context, operation, model, addHandler.isBlocking());
ThreadPoolManagementUtils.removeThreadPoolService(params.getName(), addHandler.getServiceNameBase(),
params.getThreadFactory(), addHandler.getThreadFactoryResolver(),
params.getHandoffExecutor(), addHandler.getHandoffExecutorResolver(),
context);
|
10,049 | package org.xerial.snappy;
import java.io.IOException;
public class BitShuffleNative
{
<BUG>public native boolean supportBitSuffle();</BUG>
public native int bitShuffle(Object input, int inputOffset, int typeSize, int byteLength, Object output, int outputOffset)
throws IOException;
public native int bitUnShuffle(Object input, int inputOffset, int typeSize, int byteLength, Object output, int outputOffset)
throws IOException;
}
| [DELETED] |
10,050 | public class OutboundTest extends TestCase{
private I2PAppContext _context;
</BUG>
public void setUp() {
<BUG>_context = I2PAppContext.getGlobalContext();
</BUG>
}
public void testOutbound() {
int numHops = 8;
TunnelCreatorConfig config = prepareConfig(numHops);
| private RouterContext _context;
_context = (RouterContext) I2PAppContext.getGlobalContext();
|
10,051 | peers[i] = new Hash();
peers[i].setData(new byte[Hash.HASH_LENGTH]);
_context.random().nextBytes(peers[i].getData());
_context.random().nextBytes(tunnelIds[i]);
}
<BUG>TunnelCreatorConfig config = new TunnelCreatorConfig(numHops, false);
</BUG>
for (int i = 0; i < numHops; i++) {
config.setPeer(i, peers[i]);
HopConfig cfg = config.getConfig(i);
| TunnelCreatorConfig config = new TunnelCreatorConfig(_context, numHops, false);
|
10,052 | public class InboundTest extends TestCase{
private I2PAppContext _context;
</BUG>
public void setUp() {
<BUG>_context = I2PAppContext.getGlobalContext();
</BUG>
}
public void testInbound() {
int numHops = 8;
TunnelCreatorConfig config = prepareConfig(numHops);
| private RouterContext _context;
_context = (RouterContext) I2PAppContext.getGlobalContext();
|
10,053 | peers[i] = new Hash();
peers[i].setData(new byte[Hash.HASH_LENGTH]);
_context.random().nextBytes(peers[i].getData());
_context.random().nextBytes(tunnelIds[i]);
}
<BUG>TunnelCreatorConfig config = new TunnelCreatorConfig(numHops, false);
</BUG>
for (int i = 0; i < numHops; i++) {
config.setPeer(i, peers[i]);
HopConfig cfg = config.getConfig(i);
| TunnelCreatorConfig config = new TunnelCreatorConfig(_context, numHops, false);
|
10,054 | private TunnelGateway.QueuePreprocessor _preprocessor;
private TunnelGateway.Sender _sender;
private TestReceiver _receiver;
private TunnelGateway _gw;
public void setUp() {
<BUG>_context = I2PAppContext.getGlobalContext();
</BUG>
_config = prepareConfig(8);
_preprocessor = new TrivialPreprocessor(_context);
_sender = new InboundSender(_context, _config.getConfig(0));
| _context = (RouterContext) I2PAppContext.getGlobalContext();
|
10,055 | public TestReceiver(TunnelCreatorConfig config) {
_config = config;
_handler = new FragmentHandler(_context, TestReceiver.this);
_received = new ArrayList(1000);
}
<BUG>public void receiveEncrypted(byte[] encrypted) {
</BUG>
for (int i = 1; i <= _config.getLength() - 2; i++) {
HopProcessor hop = new HopProcessor(_context, _config.getConfig(i));
assertTrue(hop.process(encrypted, 0, encrypted.length, _config.getConfig(i).getReceiveFrom()));
| public long receiveEncrypted(byte[] encrypted) {
|
10,056 | peers[i] = new Hash();
peers[i].setData(new byte[Hash.HASH_LENGTH]);
_context.random().nextBytes(peers[i].getData());
_context.random().nextBytes(tunnelIds[i]);
}
<BUG>TunnelCreatorConfig config = new TunnelCreatorConfig(numHops, false);
</BUG>
for (int i = 0; i < numHops; i++) {
config.setPeer(i, peers[i]);
HopConfig cfg = config.getConfig(i);
| TunnelCreatorConfig config = new TunnelCreatorConfig(_context, numHops, false);
|
10,057 | import junit.framework.TestCase;
import net.i2p.I2PAppContext;
import net.i2p.data.Hash;
import net.i2p.data.TunnelId;
import net.i2p.data.i2np.DataMessage;
<BUG>import net.i2p.data.i2np.I2NPMessage;
public class OutboundGatewayTest extends TestCase{
private I2PAppContext _context;
</BUG>
private TunnelCreatorConfig _config;
| import net.i2p.router.RouterContext;
private RouterContext _context;
|
10,058 | private TunnelGateway.QueuePreprocessor _preprocessor;
private TunnelGateway.Sender _sender;
private TestReceiver _receiver;
private TunnelGateway _gw;
public void setUp() {
<BUG>_context = I2PAppContext.getGlobalContext();
</BUG>
_config = prepareConfig(8);
_preprocessor = new TrivialPreprocessor(_context);
_sender = new OutboundSender(_context, _config);
| _context = (RouterContext) I2PAppContext.getGlobalContext();
|
10,059 | public TestReceiver(TunnelCreatorConfig config) {
_config = config;
_handler = new FragmentHandler(_context, TestReceiver.this);
_received = new ArrayList(1000);
}
<BUG>public void receiveEncrypted(byte[] encrypted) {
</BUG>
for (int i = 1; i < _config.getLength(); i++) {
HopProcessor hop = new HopProcessor(_context, _config.getConfig(i));
assertTrue(hop.process(encrypted, 0, encrypted.length, _config.getConfig(i).getReceiveFrom()));
| public long receiveEncrypted(byte[] encrypted) {
|
10,060 | peers[i] = new Hash();
peers[i].setData(new byte[Hash.HASH_LENGTH]);
_context.random().nextBytes(peers[i].getData());
_context.random().nextBytes(tunnelIds[i]);
}
<BUG>TunnelCreatorConfig config = new TunnelCreatorConfig(numHops, false);
</BUG>
for (int i = 0; i < numHops; i++) {
config.setPeer(i, peers[i]);
HopConfig cfg = config.getConfig(i);
| TunnelCreatorConfig config = new TunnelCreatorConfig(_context, numHops, false);
|
10,061 | package net.i2p.router.tunnel;
import java.util.ArrayList;
<BUG>import net.i2p.I2PAppContext;
public class BatchedFragmentTest extends FragmentTest {</BUG>
public void setUp() {
super.setUp();
BatchedPreprocessor.DEFAULT_DELAY = 200;
| import net.i2p.router.RouterContext;
public class BatchedFragmentTest extends FragmentTest {
|
10,062 |
TunnelGateway.Pending pending3 = createPending(thirdSize, thirdRouter, thirdTunnel);
</BUG>
runBatch(pending1, pending2, pending3);
}
<BUG>private void runBatch(TunnelGateway.Pending pending1, TunnelGateway.Pending pending2, TunnelGateway.Pending pending3) {
</BUG>
ArrayList messages = new ArrayList();
messages.add(pending1);
TunnelGateway.QueuePreprocessor pre = createPreprocessor(_context);
| protected TunnelGateway.QueuePreprocessor createPreprocessor(RouterContext ctx) {
return new BatchedPreprocessor(ctx, "testBatchedPreprocessor");
public void testBatched() {
PendingGatewayMessage pending1 = createPending(10, false, false);
PendingGatewayMessage pending2 = createPending(1024, false, false);
|
10,063 | try { Thread.sleep(100); } catch (InterruptedException ie) {}
}
assertTrue(handleReceiver.receivedOk());
}
public void testMultiple() {
<BUG>TunnelGateway.Pending pending = createPending(2048, false, false);
</BUG>
ArrayList messages = new ArrayList();
messages.add(pending);
TunnelGateway.QueuePreprocessor pre = createPreprocessor(_context);
| PendingGatewayMessage pending = createPending(2048, false, false);
|
10,064 | try { Thread.sleep(100); } catch (InterruptedException ie) {}
}
assertTrue(handleReceiver.receivedOk());
}
public void runDelayed() {
<BUG>TunnelGateway.Pending pending = createPending(2048, false, false);
</BUG>
ArrayList messages = new ArrayList();
messages.add(pending);
TunnelGateway.QueuePreprocessor pre = createPreprocessor(_context);
| public void testMultiple() {
PendingGatewayMessage pending = createPending(2048, false, false);
|
10,065 | assertTrue(runVaried(i, true, false));
assertTrue(runVaried(i, true, true));
}
}
protected boolean runVaried(int size, boolean includeRouter, boolean includeTunnel) {
<BUG>TunnelGateway.Pending pending = createPending(size, includeRouter, includeTunnel);
</BUG>
ArrayList messages = new ArrayList();
messages.add(pending);
DefragmentedReceiverImpl handleReceiver = new DefragmentedReceiverImpl(pending.getData());
| PendingGatewayMessage pending = createPending(size, includeRouter, includeTunnel);
|
10,066 | if (keepGoing)
try { Thread.sleep(100); } catch (InterruptedException ie) {}
}
return handleReceiver.receivedOk();
}
<BUG>protected TunnelGateway.Pending createPending(int size, boolean includeRouter, boolean includeTunnel) {
</BUG>
DataMessage m = new DataMessage(_context);
byte data[] = new byte[size];
_context.random().nextBytes(data);
| protected PendingGatewayMessage createPending(int size, boolean includeRouter, boolean includeTunnel) {
|
10,067 | long start = _context.clock().now();
_version = VERSION;
_destSerializer = _destSerializerV4;
try {
BlockFile rv = new BlockFile(f, true);
<BUG>SkipList hdr = rv.makeIndex(INFO_SKIPLIST, _stringSerializer, _infoSerializer);
</BUG>
Properties info = new Properties();
info.setProperty(PROP_VERSION, VERSION);
info.setProperty(PROP_CREATED, Long.toString(_context.clock().now()));
| SkipList<String, Properties> hdr = rv.makeIndex(INFO_SKIPLIST, _stringSerializer, _infoSerializer);
|
10,068 | return true;
}
private boolean upgrade() {
try {
if (VersionComparator.comp(_version, "2") < 0) {
<BUG>SkipList rev = _bf.getIndex(REVERSE_SKIPLIST, _hashIndexSerializer, _infoSerializer);
</BUG>
if (rev == null) {
rev = _bf.makeIndex(REVERSE_SKIPLIST, _hashIndexSerializer, _infoSerializer);
if (_log.shouldLog(Log.WARN))
| SkipList<Integer, Properties> rev = _bf.getIndex(REVERSE_SKIPLIST, _hashIndexSerializer, _infoSerializer);
|
10,069 | throw new IOException(e.toString());
}
}
private void addEntry(BlockFile bf, String listname, String key, Destination dest, String source) throws IOException {
try {
<BUG>SkipList sl = bf.getIndex(listname, _stringSerializer, _destSerializer);
</BUG>
if (sl == null) {
sl = bf.makeIndex(listname, _stringSerializer, _destSerializer);
}
| SkipList<String, DestEntry> sl = bf.getIndex(listname, _stringSerializer, _destSerializer);
|
10,070 | List<String> rv = new ArrayList<String>(tok.countTokens());
while (tok.hasMoreTokens())
rv.add(tok.nextToken());
return rv;
}
<BUG>private static Object removeEntry(SkipList sl, String key) {
</BUG>
return sl.remove(key);
}
private String getReverseEntry(Hash hash) {
| private static Object removeEntry(SkipList<String, ?> sl, String key) {
|
10,071 | " limit=" + limit + " skip=" + skip);
synchronized(_bf) {
if (_isClosed)
return Collections.emptyMap();
try {
<BUG>SkipList sl = _bf.getIndex(listname, _stringSerializer, _destSerializer);
</BUG>
if (sl == null) {
if (_log.shouldLog(Log.WARN))
_log.warn("No skiplist found for lookup in " + listname);
| SkipList<String, DestEntry> sl = _bf.getIndex(listname, _stringSerializer, _destSerializer);
|
10,072 | if (sl == null) {
if (_log.shouldLog(Log.WARN))
_log.warn("No skiplist found for lookup in " + listname);
return Collections.emptyMap();
}
<BUG>SkipIterator iter;
if (beginWith != null)</BUG>
iter = sl.find(beginWith);
else
iter = sl.iterator();
| SkipIterator<String, DestEntry> iter;
if (beginWith != null)
|
10,073 | Map<String, Destination> rv = new TreeMap<String, Destination>();
for (int i = 0; i < skip && iter.hasNext(); i++) {
iter.next();
}
for (int i = 0; i < limit && iter.hasNext(); ) {
<BUG>String key = (String) iter.nextKey();
if (startsWith != null) {</BUG>
if (startsWith.equals("[0-9]")) {
if (key.charAt(0) > '9')
break;
| String key = iter.nextKey();
if (startsWith != null) {
|
10,074 | break;
} else if (!key.startsWith(startsWith)) {
break;
}
}
<BUG>DestEntry de = (DestEntry) iter.next();
if (!validate(key, de, listname))</BUG>
continue;
if (search != null && key.indexOf(search) < 0)
continue;
| DestEntry de = iter.next();
if (!validate(key, de, listname))
|
10,075 | if (sl == null) {
if (_log.shouldLog(Log.WARN))
_log.warn("No skiplist found for lookup in " + listname);
return Collections.emptyMap();
}
<BUG>SkipIterator iter;
if (beginWith != null)</BUG>
iter = sl.find(beginWith);
else
iter = sl.iterator();
| SkipIterator<String, DestEntry> iter;
if (beginWith != null)
|
10,076 | Map<String, String> rv = new TreeMap<String, String>();
for (int i = 0; i < skip && iter.hasNext(); i++) {
iter.next();
}
for (int i = 0; i < limit && iter.hasNext(); ) {
<BUG>String key = (String) iter.nextKey();
if (startsWith != null) {</BUG>
if (startsWith.equals("[0-9]")) {
if (key.charAt(0) > '9')
break;
| String key = iter.nextKey();
if (startsWith != null) {
|
10,077 | break;
} else if (!key.startsWith(startsWith)) {
break;
}
}
<BUG>DestEntry de = (DestEntry) iter.next();
if (!validate(key, de, listname))</BUG>
continue;
if (search != null && key.indexOf(search) < 0)
continue;
| DestEntry de = iter.next();
if (!validate(key, de, listname))
|
10,078 | if (sl == null) {
if (_log.shouldLog(Log.WARN))
_log.warn("No skiplist found for lookup in " + listname);
return Collections.emptySet();
}
<BUG>SkipIterator iter;
if (beginWith != null)</BUG>
iter = sl.find(beginWith);
else
iter = sl.iterator();
| SkipIterator<String, DestEntry> iter;
if (beginWith != null)
|
10,079 | Set<String> rv = new HashSet<String>();
for (int i = 0; i < skip && iter.hasNext(); i++) {
iter.next();
}
for (int i = 0; i < limit && iter.hasNext(); ) {
<BUG>String key = (String) iter.nextKey();
if (startsWith != null) {</BUG>
if (startsWith.equals("[0-9]")) {
if (key.charAt(0) > '9')
break;
| String key = iter.nextKey();
if (startsWith != null) {
|
10,080 | _log.error("Removing " + _invalid.size() + " corrupt entries from database");
for (InvalidEntry ie : _invalid) {
String key = ie.key;
String list = ie.list;
try {
<BUG>SkipList sl = _bf.getIndex(list, _stringSerializer, _destSerializer);
</BUG>
if (sl == null) {
_log.error("No list found to remove corrupt \"" + key + "\" from database " + list);
continue;
| SkipList<String, DestEntry> sl = _bf.getIndex(list, _stringSerializer, _destSerializer);
|
10,081 | private class Shutdown implements Runnable {
public void run() {
close();
}
}
<BUG>private static class PropertiesSerializer implements Serializer {
public byte[] getBytes(Object o) {
Properties p = (Properties) o;</BUG>
try {
| private static class PropertiesSerializer implements Serializer<Properties> {
public byte[] getBytes(Properties p) {
|
10,082 | } catch (DataFormatException dfe) {
logError("DB Write Fail - properties too big?", dfe);
return new byte[2];
}
}
<BUG>public Object construct(byte[] b) {
</BUG>
Properties rv = new Properties();
try {
DataHelper.fromProperties(b, 0, rv);
| public Properties construct(byte[] b) {
|
10,083 | import java.io.InputStream;
import java.net.URL;
import static org.assertj.core.api.Assertions.assertThat;
public class TomcatWebServerTest {
@Test
<BUG>public void shouldBootWebServer() throws Exception {
try(WeldContainer weldContainer = new Weld().disableDiscovery()</BUG>
.extensions(new ConfigurationExtension())
.beanClasses(TomcatWebServer.class, DefaultServlet.class, MessageProvider.class,
WebServerConfiguration.class, DefaultConfigPropertyProducer.class)
| SSLBypass.disableSSLChecks();
try(WeldContainer weldContainer = new Weld().disableDiscovery()
|
10,084 | tomcat.start();
try(InputStream stream = new URL("http://localhost:8080/").openStream()) {
String data = IOUtils.toString(stream).trim();
assertThat(data).isEqualTo(MessageProvider.DATA);
}
<BUG>try(InputStream stream = new URL("http://localhost:8080/rest").openStream()) {
</BUG>
String data = IOUtils.toString(stream).trim();
assertThat(data).isEqualTo("Hello, world!");
}
| try(InputStream stream = new URL("https://localhost:8443/rest").openStream()) {
|
10,085 | import java.io.InputStream;
import java.net.URL;
import static org.assertj.core.api.Assertions.assertThat;
public class JettyBootTest {
@Test
<BUG>public void shouldBootWebServer() throws Exception {
try(WeldContainer weldContainer = new Weld().disableDiscovery()</BUG>
.extensions(new ConfigurationExtension())
.beanClasses(JettyWebServer.class, DefaultServlet.class, MessageProvider.class,
WebServerConfiguration.class, DefaultConfigPropertyProducer.class)
| SSLBypass.disableSSLChecks();
try(WeldContainer weldContainer = new Weld().disableDiscovery()
|
10,086 | webServer.start();
try(InputStream stream = new URL("http://localhost:8080/").openStream()) {
String data = IOUtils.toString(stream).trim();
assertThat(data).isEqualTo(MessageProvider.DATA);
}
<BUG>try(InputStream stream = new URL("http://localhost:8080/").openStream()) {
</BUG>
String data = IOUtils.toString(stream).trim();
assertThat(data).isEqualTo(MessageProvider.DATA);
}
| try(InputStream stream = new URL("https://localhost:8443/").openStream()) {
|
10,087 | }
public String getAddress() {
return address;
}
public boolean isSecuredConfigured(){
<BUG>return securedPort != 0 && keystorePath != null && truststorePassword != null;
}</BUG>
public int getSecuredPort(){
return securedPort;
}
| public int getPort() {
return port;
return securedPort != 0;
|
10,088 | import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;</BUG>
public class BlockStatement_TextGen extends SNodeTextGen {
<BUG>public void doGenerateText(SNode node) {
if (getBuffer().hasPositionsSupport()) {
TraceInfoGenerationUtil.createPositionInfo(this, node);
}</BUG>
boolean needBrackets = false;
if (SNodeOperations.isInstanceOf(SNodeOperations.getParent(node), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc092b6b77L, "jetbrains.mps.baseLanguage.structure.BlockStatement")) || SNodeOperations.isInstanceOf(SNodeOperations.getParent(node), MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b200L, "jetbrains.mps.baseLanguage.structure.StatementList"))) {
if ((SLinkOperations.getTarget(node, MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfc092b6b77L, 0xfc092b6b78L, "statements")) != null)) {
| package jetbrains.mps.baseLanguage.textGen;
import jetbrains.mps.textGen.SNodeTextGen;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.smodel.behaviour.BehaviorReflection;
createPositionInfo(node);
|
10,089 | }
TraceInfoGenerationUtil.fillPositionInfo(this, node, traceableProperty);</BUG>
}
}
}
<BUG>protected static Logger LOG = LogManager.getLogger(BlockStatement_TextGen.class);
}</BUG>
| this.increaseDepth();
|
10,090 | import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;</BUG>
public class AssertStatement_TextGen extends SNodeTextGen {
<BUG>public void doGenerateText(SNode node) {
if (getBuffer().hasPositionsSupport()) {
TraceInfoGenerationUtil.createPositionInfo(this, node);
}</BUG>
this.appendNewLine();
this.indentBuffer();
this.append("assert ");
| package jetbrains.mps.baseLanguage.textGen;
import jetbrains.mps.textGen.SNodeTextGen;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.smodel.behaviour.BehaviorReflection;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
createPositionInfo(node);
|
10,091 | this.append(";");
} else {
this.appendWithIndent("break;");
}
if (getBuffer().hasPositionsSupport()) {
<BUG>{
String traceableProperty = "";
try {
traceableProperty = BehaviorReflection.invokeVirtual(String.class, SNodeOperations.cast(node, MetaAdapterFactory.getInterfaceConcept(0x9ded098bad6a4657L, 0xbfd948636cfe8bc3L, 0x465516cf87c705a3L, "jetbrains.mps.lang.traceable.structure.TraceableConcept")), "virtual_getTraceableProperty_5067982036267369901", new Object[]{});
} catch (Throwable t) {
if (LOG.isEnabledFor(Level.ERROR)) {
LOG.error("Can't calculate traceable prorerty for a node " + node + ".", t);</BUG>
}
| } else if (isNotEmptyString(SPropertyOperations.getString(node, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbe39a867fL, 0x11745bfb2d8L, "label")))) {
this.appendWithIndent("break ");
this.append(SPropertyOperations.getString(node, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbe39a867fL, 0x11745bfb2d8L, "label")));
|
10,092 | } catch (Throwable t) {
if (LOG.isEnabledFor(Level.ERROR)) {
LOG.error("Can't calculate traceable prorerty for a node " + node + ".", t);</BUG>
}
}
<BUG>TraceInfoGenerationUtil.fillPositionInfo(this, node, traceableProperty);
}
}
}
protected static Logger LOG = LogManager.getLogger(BreakStatement_TextGen.class);</BUG>
private static boolean isNotEmptyString(String str) {
| this.append(";");
} else if (isNotEmptyString(SPropertyOperations.getString(node, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbe39a867fL, 0x11745bfb2d8L, "label")))) {
this.appendWithIndent("break ");
this.append(SPropertyOperations.getString(node, MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xfbe39a867fL, 0x11745bfb2d8L, "label")));
this.append(";");
} else {
this.appendWithIndent("break;");
if (getBuffer().hasPositionsSupport()) {
fillPositionInfo(node, BehaviorReflection.invokeVirtual(String.class, SNodeOperations.cast(node, MetaAdapterFactory.getInterfaceConcept(0x9ded098bad6a4657L, 0xbfd948636cfe8bc3L, 0x465516cf87c705a3L, "jetbrains.mps.lang.traceable.structure.TraceableConcept")), "virtual_getTraceableProperty_5067982036267369901", new Object[]{}));
|
10,093 | 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);
|
10,094 | 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(
|
10,095 | } else {
updateMemo();
callback.updateMemo();
}
dismiss();
<BUG>}else{
</BUG>
Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show();
}
}
| [DELETED] |
10,096 | }
@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);
|
10,097 | 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);
|
10,098 | 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(
|
10,099 | 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 {
|
10,100 | 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;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.