id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
501
else if (node.isDirect()) writer.write("br label " + symbol(node.getLabel())); else if (node.isIndirect()) { StringBuilder sb = new StringBuilder("indirectbr i8* "). append(symbol(node.getOperand())).append(", [ "); <BUG>TACDestination dest = node.getDestination(); for (int i = 0; i < dest.getNumPossibilities(); i++) sb.append("label ").append(symbol(dest.getPossibility(i))). </BUG> append(", ");
TACPhiRef dest = node.getDestination(); for (int i = 0; i < dest.getSize(); i++) sb.append("label ").append(symbol(dest.getValue(i))).
502
public final void addError(Node node, Error error, String message, Type... errorTypes) { if( containsUnknown(errorTypes) ) return; // Don't add error if it has an unknown type in it. if( node == null ) addError(error, message, errorTypes); <BUG>else { message = makeMessage(error, message, node.getFile(), node.getLineStart(), node.getLineEnd(), node.getColumnStart(), node.getColumnEnd() ); errorList.add(new TypeCheckException(error, message)); }</BUG> }
else errorList.add(new TypeCheckException(error, message, node.getFile(), node.getLineStart(), node.getLineEnd(), node.getColumnStart(), node.getColumnEnd() ));
503
errorList.add(new TypeCheckException(error, message)); }</BUG> } protected final void addWarning(Error warning, String message) { <BUG>message = makeMessage(warning, message, getFile(), getLineStart(), getLineEnd(), getColumnStart(), getColumnEnd()); warningList.add(new TypeCheckException(warning, message));</BUG> }
public final void addError(Node node, Error error, String message, Type... errorTypes) { if( containsUnknown(errorTypes) ) return; // Don't add error if it has an unknown type in it. if( node == null ) addError(error, message, errorTypes); else errorList.add(new TypeCheckException(error, message, node.getFile(), node.getLineStart(), node.getLineEnd(), node.getColumnStart(), node.getColumnEnd() )); warningList.add(new TypeCheckException(warning, message, getFile(), getLineStart(), getLineEnd(), getColumnStart(), getColumnEnd()));
504
} @Override public final void addWarning(Node node, Error warning, String message) { if( node == null ) addWarning(warning, message); <BUG>else { message = makeMessage(warning, message, node.getFile(), node.getLineStart(), node.getLineEnd(), node.getColumnStart(), node.getColumnEnd() ); warningList.add(new TypeCheckException(warning, message));</BUG> }
protected final void addErrors(List<TypeCheckException> errors) { if( errors != null ) for( TypeCheckException error : errors ) addError( error.getError(), error.getMessage() );
505
writer.writeLeft(symbol(node.getRef()) + ':'); } private int otherCounter = 0; protected String nextLabel() { <BUG>return "%_mabel" + otherCounter++; </BUG> } protected String symbol(TACLabelRef label) { String value = label.getName();
return "%_label" + otherCounter++;
506
package org.technicalsoftwareconfigurationmanagement.maven.plugin; <BUG>import java.io.InputStream; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Set; </BUG> import java.util.HashSet;
import java.io.IOException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList;
507
if (formatFile.exists() && formatFile.isFile()) { InputStream inputStream = null; Document xml = null; try { inputStream = new FileInputStream(formatFile); <BUG>if (inputStream == null) { getLog().error("[xml formatter] File<" + formatFile + "> could not be opened, skipping"); return; }</BUG> DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
[DELETED]
508
} @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)
509
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))
510
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)
511
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");
512
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");
513
} @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);
514
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);
515
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);
516
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);
517
@Parameter( defaultValue = "maven.version" ) private String versionProperty; public void execute() { ArtifactVersion mavenVersion = runtime.getApplicationVersion(); <BUG>if ( getLog().isDebugEnabled() ) { getLog().debug( "Retrieved maven version: " + mavenVersion.toString() ); } if ( project != null ) { project.getProperties().put( versionProperty, mavenVersion.toString() ); </BUG> }
defineProperty( versionProperty, mavenVersion.toString() );
518
String qualifier = artifactVersion.getQualifier(); if ( qualifier == null ) { qualifier = ""; } <BUG>props.setProperty( propertyPrefix + ".qualifier", qualifier ); props.setProperty( propertyPrefix + ".buildNumber", Integer.toString( artifactVersion.getBuildNumber() ) ); String osgiVersion = getOsgiVersion( artifactVersion ); props.setProperty( propertyPrefix + ".osgiVersion", osgiVersion ); }</BUG> public void setPropertyPrefix( String prefix )
defineVersionProperty( "qualifier", qualifier ); defineVersionProperty( "buildNumber", artifactVersion.getBuildNumber() ); defineVersionProperty( "osgiVersion", osgiVersion );
519
import sonar.core.registries.ISonarRegistryItem; import sonar.core.registries.InventoryProviderRegistry; import sonar.core.upgrades.MachineUpgradeRegistry; @Mod(modid = SonarCore.modid, name = "SonarCore", version = SonarCore.version) public class SonarCore { <BUG>public static final String modid = "SonarCore"; </BUG> public static final String version = "3.1.6"; @SidedProxy(clientSide = "sonar.core.network.SonarClient", serverSide = "sonar.core.network.SonarCommon") public static SonarCommon proxy;
public static final String modid = "sonarcore";
520
return plant.getPlantType(world, pos); } @Override public IBlockState getPlant(ItemStack stack, World world, BlockPos pos) { IPlantable plant = (IPlantable) stack.getItem(); <BUG>Block base = world.getBlockState(pos.offset(EnumFacing.DOWN)).getBlock(); if (base != null && base.canSustainPlant(base.getDefaultState(), world, pos, EnumFacing.UP, plant)) { </BUG> return plant.getPlant(world, pos);
IBlockState state = world.getBlockState(pos.offset(EnumFacing.DOWN)); Block base = state.getBlock(); if (base != null && !base.isAir(state, world, pos) && base.canSustainPlant(state, world, pos, EnumFacing.UP, plant)) {
521
public boolean liquidStack, wasNull, wrongSize; public T helper; public SonarRemoveRecipeV2(T helper, RecipeObjectType type, ArrayList ingredients) { this.helper = helper; this.type = type; <BUG>if (type == RecipeObjectType.OUTPUT ? ingredients.size() != helper.outputSize : ingredients.size() != helper.inputSize) { MineTweakerAPI.logError("A " + helper.getRecipeID() + " recipe was the wrong size");</BUG> wrongSize = true; return; }
if (helper instanceof DefinedRecipeHelper && (type == RecipeObjectType.OUTPUT ? ingredients.size() != ((DefinedRecipeHelper) helper).getOutputSize() : ingredients.size() != ((DefinedRecipeHelper) helper).getInputSize())) { MineTweakerAPI.logError("A " + helper.getRecipeID() + " recipe was the wrong size");
522
public String getName() { return name; } @Override public boolean canHandleItems(TileEntity tile, EnumFacing dir) { <BUG>return tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, dir); </BUG> } @Override public StoredItemStack getStack(int slot, TileEntity tile, EnumFacing dir) {
return tile != null && tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, dir);
523
} @Override public void toBytes(ByteBuf buf) { super.toBytes(buf); buf.writeInt(id); <BUG>tile.writePacket(buf, id); if (writables != null) { for (ByteBufWritable writable : writables) { writable.writeToBuf(buf); } } }</BUG> public static class Handler extends PacketTileEntityHandler<PacketByteBuf> {
public PacketByteBuf(IByteBufTile tile, BlockPos pos, int id, ByteBufWritable... writables) { super(pos); this.tile = tile; this.id = id; this.writables = writables;
524
@Override protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(this.getBackground()); drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); <BUG>} @SideOnly(Side.CLIENT)</BUG> public class PauseButton extends SonarButtons.ImageButton { boolean paused; public int id;
public void bindTexture(ResourceLocation resource) { mc.getTextureManager().bindTexture(resource); @SideOnly(Side.CLIENT)
525
import sonar.core.api.wrappers.EnergyWrapper; import sonar.core.api.wrappers.FluidWrapper; import sonar.core.api.wrappers.InventoryWrapper; import sonar.core.api.wrappers.RegistryWrapper; public final class SonarAPI { <BUG>public static final String MODID = "SonarCore"; public static final String NAME = "SonarAPI"; </BUG> public static final String VERSION = "1.0.1";
public static final String MODID = "sonarcore"; public static final String NAME = "sonarapi";
526
private static RegistryWrapper registry = new RegistryWrapper(); private static FluidWrapper fluids = new FluidWrapper(); private static InventoryWrapper inventories = new InventoryWrapper(); private static EnergyWrapper energy = new EnergyWrapper(); public static void init() { <BUG>if (Loader.isModLoaded("SonarCore")) { try {</BUG> registry = (RegistryWrapper) Class.forName("sonar.core.SonarRegistry").newInstance(); fluids = (FluidWrapper) Class.forName("sonar.core.helpers.FluidHelper").newInstance(); inventories = (InventoryWrapper) Class.forName("sonar.core.helpers.InventoryHelper").newInstance();
if (Loader.isModLoaded("SonarCore")|| Loader.isModLoaded("sonarcore")) { try {
527
import sonar.core.recipes.ISonarRecipeObject; import sonar.core.recipes.RecipeHelperV2; import sonar.core.recipes.RecipeItemStack; import sonar.core.recipes.RecipeOreStack; import sonar.core.recipes.ValueHelperV2; <BUG>public class SonarAddRecipeV2<T extends DefinedRecipeHelper> implements IUndoableAction { </BUG> public ArrayList<ISonarRecipeObject> inputs; public ArrayList<ISonarRecipeObject> outputs; public boolean liquidStack, wasNull, wrongSize;
public class SonarAddRecipeV2<T extends RecipeHelperV2> implements IUndoableAction {
528
public ArrayList<ISonarRecipeObject> outputs; public boolean liquidStack, wasNull, wrongSize; public T helper; public SonarAddRecipeV2(T helper, ArrayList inputs, ArrayList<ItemStack> outputs) { this.helper = helper; <BUG>if (inputs.size() != helper.inputSize || outputs.size() != helper.outputSize) { MineTweakerAPI.logError("A " + helper.getRecipeID() + " recipe was the wrong size");</BUG> wrongSize = true; return; }
if (helper instanceof DefinedRecipeHelper && (inputs.size() != ((DefinedRecipeHelper) helper).getInputSize() || outputs.size() != ((DefinedRecipeHelper) helper).getOutputSize())) { MineTweakerAPI.logError("A " + helper.getRecipeID() + " recipe was the wrong size");
529
this.inputs = adaptedInputs; this.outputs = adaptedOutputs; } @Override public void apply() { <BUG>if (!wasNull && !liquidStack && !wrongSize) { helper.addRecipe(helper.buildRecipe((ArrayList<ISonarRecipeObject>) inputs.clone(), (ArrayList<ISonarRecipeObject>) outputs.clone(), new ArrayList(), helper.shapeless)); </BUG> } else { SonarCore.logger.error(String.format("Failed to add %s recipe (%s = %s)", helper.getRecipeID(), inputs, outputs));
boolean isShapeless = helper instanceof DefinedRecipeHelper ? ((DefinedRecipeHelper) helper).shapeless : true; helper.addRecipe(helper.buildRecipe((ArrayList<ISonarRecipeObject>) inputs.clone(), (ArrayList<ISonarRecipeObject>) outputs.clone(), new ArrayList(), isShapeless));
530
} public static boolean wailaLoaded() { return Loader.isModLoaded("Waila"); } public static boolean calculatorLoaded() { <BUG>return Loader.isModLoaded("Calculator"); }</BUG> public static boolean opticsLoaded() { return Loader.isModLoaded("Optics"); }
public static boolean ic2Loaded() { return Loader.isModLoaded("IC2"); return calculatorLoaded;
531
package sonar.core.recipes; import java.util.ArrayList; public abstract class DefinedRecipeHelper<T extends ISonarRecipe> extends RecipeHelperV2<T> { <BUG>public int inputSize, outputSize; </BUG> public boolean shapeless; public DefinedRecipeHelper(int inputSize, int outputSize, boolean shapeless) { this.inputSize = inputSize;
private int inputSize, outputSize;
532
ArrayList inputs = new ArrayList(); ArrayList outputs = new ArrayList(); ArrayList additionals = new ArrayList(); for (int i = 0; i < objs.length; i++) { Object obj = objs[i]; <BUG>if (i < inputSize) { inputs.add(obj); } else if (i < inputSize + outputSize) { </BUG> outputs.add(obj);
if (i < (reverseRecipes() ? getOutputSize() : getInputSize())) { } else if (i < getInputSize() + getOutputSize()) {
533
import org.apache.sling.jcr.resource.JcrResourceConstants; import org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl; import org.apache.sling.jcr.resource.internal.helper.MapEntries; import org.apache.sling.jcr.resource.internal.helper.Mapping; import org.apache.sling.performance.annotation.PerformanceTestSuite; <BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG> import org.junit.runner.RunWith;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
534
@PerformanceTestSuite public ParameterizedTestList testPerformance() throws Exception { Helper helper = new Helper(); ParameterizedTestList testCenter = new ParameterizedTestList(); testCenter.setTestSuiteTitle("jcr.resource-2.0.10"); <BUG>testCenter.addTestObject(new ResolveNonExistingWith1000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith1000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000AliasTest(helper)); </BUG> return testCenter;
testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith1000VanityPathTest",helper, 100, 10)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith5000VanityPathTest",helper, 100, 50)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith10000VanityPathTest",helper, 100, 100)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWithManyAliasTest",helper, 1000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith5000AliasTest",helper, 5000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith10000AliasTest",helper, 10000));
535
package org.apache.sling.performance; <BUG>import static org.mockito.Mockito.*; import javax.jcr.NamespaceRegistry;</BUG> import javax.jcr.Session; import junitx.util.PrivateAccessor;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.mock; import javax.jcr.NamespaceRegistry;
536
import org.apache.sling.jcr.resource.JcrResourceConstants; import org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl; import org.apache.sling.jcr.resource.internal.helper.MapEntries; import org.apache.sling.jcr.resource.internal.helper.Mapping; import org.apache.sling.performance.annotation.PerformanceTestSuite; <BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG> import org.junit.runner.RunWith;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
537
import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.jcr.api.SlingRepository; import org.apache.sling.jcr.resource.JcrResourceConstants; import org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory; import org.apache.sling.performance.annotation.PerformanceTestSuite; <BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG> import org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
538
@PerformanceTestSuite public ParameterizedTestList testPerformance() throws Exception { Helper helper = new Helper(); ParameterizedTestList testCenter = new ParameterizedTestList(); testCenter.setTestSuiteTitle("jcr.resource-2.2.0"); <BUG>testCenter.addTestObject(new ResolveNonExistingWith1000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith1000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000AliasTest(helper)); </BUG> return testCenter;
testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith1000VanityPathTest",helper, 100, 10)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith5000VanityPathTest",helper, 100, 50)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith10000VanityPathTest",helper, 100, 100)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith1000AliasTest",helper, 1000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith5000AliasTest",helper, 5000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith10000AliasTest",helper, 10000));
539
public class UserControllerTest { private static final Logger LOGGER = Logger.getLogger( UserControllerTest.class.getName() ); Properties properties = new Properties(); InputStream input = null; <BUG>private String neo4jServerPort = System.getProperty( "neo4j.server.port" ); private String neo4jRemoteShellPort = System.getProperty( "neo4j.remoteShell.port" ); private String neo4jGraphDb = System.getProperty( "neo4j.graph.db" ); private ServerControls server;</BUG> @Before
private String dbmsConnectorHttpPort = System.getProperty( "dbms.connector.http.port" ); private String dbmsConnectorBoltPort = System.getProperty( "dbms.connector.bolt.port" ); private String dbmsShellPort = System.getProperty( "dbms.shell.port" ); private String dbmsDirectoriesData = System.getProperty( "dbms.directories.data" ); private ServerControls server;
540
@Bean public Configuration getConfiguration() { if ( StringUtils.isEmpty( url ) ) { <BUG>url = "http://localhost:" + port; </BUG> } Configuration config = new Configuration(); config.driverConfiguration().setDriverClassName( HttpDriver.class.getName() )
url = "http://localhost:" + dbmsConnectorHttpPort;
541
import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.naming.NamingException; import org.apache.sling.commons.testing.jcr.RepositoryUtil; import org.apache.sling.jcr.api.SlingRepository; <BUG>public abstract class AbstractRepositoryTest extends AbstractTest { private static class ShutdownThread extends Thread {</BUG> @Override public void run() { try {
public abstract class AbstractRepositoryTest { private static class ShutdownThread extends Thread {
542
initSchema(storeSignature); } public ResourceSchema getSchema(String location, Job job) throws IOException { setLocation(location, job); <BUG>CfDef cfDef = getCfDef(loadSignature); ResourceSchema schema = new ResourceSchema();</BUG> Map<MarshallerType, AbstractType> marshallers = getDefaultMarshallers(cfDef); Map<ByteBuffer, AbstractType> validators = getValidatorMap(cfDef);
CfInfo cfInfo = getCfInfo(loadSignature); CfDef cfDef = cfInfo.cfDef; ResourceSchema schema = new ResourceSchema();
543
catch (InterruptedException e) { throw new IOException(e); } } <BUG>protected List<ColumnDef> getColumnMetadata(Cassandra.Client client, boolean cql3Table) throws InvalidRequestException,</BUG> UnavailableException, TimedOutException, SchemaDisagreementException,
protected List<ColumnDef> getColumnMetadata(Cassandra.Client client) throws InvalidRequestException,
544
Tuple t = TupleFactory.getInstance().newTuple(result.size()); for (int i=0; i<result.size(); i++) setTupleValue(t, i, cassandraToObj(result.get(i).comparator, result.get(i).value)); return t; } <BUG>protected Tuple columnToTuple(Column col, CfDef cfDef, AbstractType comparator) throws IOException { Tuple pair = TupleFactory.getInstance().newTuple(2);</BUG> if(comparator instanceof AbstractCompositeType)
protected Tuple columnToTuple(Column col, CfInfo cfInfo, AbstractType comparator) throws IOException CfDef cfDef = cfInfo.cfDef; Tuple pair = TupleFactory.getInstance().newTuple(2);
545
protected byte getPigType(AbstractType type) { if (type instanceof LongType || type instanceof DateType || type instanceof TimestampType) // DateType is bad and it should feel bad return DataType.LONG; else if (type instanceof IntegerType || type instanceof Int32Type) // IntegerType will overflow at 2**31, but is kept for compatibility until pig has a BigInteger <BUG>return DataType.INTEGER; else if (type instanceof AsciiType || type instanceof UTF8Type || type instanceof DecimalType || type instanceof InetAddressType || type instanceof LexicalUUIDType || type instanceof UUIDType )</BUG> return DataType.CHARARRAY;
else if (type instanceof AsciiType || type instanceof UTF8Type || type instanceof DecimalType || type instanceof InetAddressType)
546
catch (AuthorizationException e) { throw new AssertionError(e); // never actually throws AuthorizationException. } } <BUG>CfDef cfDef = getCfDef(client); if (cfDef != null) properties.setProperty(signature, cfdefToString(cfDef)); else</BUG> throw new IOException(String.format("Column family '%s' not found in keyspace '%s'",
CfInfo cfInfo = getCfInfo(client); if (cfInfo.cfDef != null) StringBuilder sb = new StringBuilder(); sb.append(cfInfo.compactCqlTable ? 1 : 0).append(cfInfo.cql3Table ? 1: 0).append(cfdefToString(cfInfo.cfDef)); properties.setProperty(signature, sb.toString()); else
547
key = (ByteBuffer)reader.getCurrentKey(); tuple = keyToTuple(key, cfDef, parseType(cfDef.getKey_validation_class())); } for (Map.Entry<ByteBuffer, Column> entry : lastRow.entrySet()) { <BUG>bag.add(columnToTuple(entry.getValue(), cfDef, parseType(cfDef.getComparator_type()))); </BUG> } lastKey = null; lastRow = null;
bag.add(columnToTuple(entry.getValue(), cfInfo, parseType(cfDef.getComparator_type())));
548
tuple = keyToTuple(lastKey, cfDef, parseType(cfDef.getKey_validation_class())); else addKeyToTuple(tuple, lastKey, cfDef, parseType(cfDef.getKey_validation_class())); for (Map.Entry<ByteBuffer, Column> entry : lastRow.entrySet()) { <BUG>bag.add(columnToTuple(entry.getValue(), cfDef, parseType(cfDef.getComparator_type()))); </BUG> } tuple.append(bag); lastKey = key;
bag.add(columnToTuple(entry.getValue(), cfInfo, parseType(cfDef.getComparator_type())));
549
SortedMap<ByteBuffer, Column> row = (SortedMap<ByteBuffer, Column>)reader.getCurrentValue(); if (lastRow != null) // prepend what was read last time { for (Map.Entry<ByteBuffer, Column> entry : lastRow.entrySet()) { <BUG>bag.add(columnToTuple(entry.getValue(), cfDef, parseType(cfDef.getComparator_type()))); </BUG> } lastKey = null; lastRow = null;
bag.add(columnToTuple(entry.getValue(), cfInfo, parseType(cfDef.getComparator_type())));
550
lastKey = null; lastRow = null; } for (Map.Entry<ByteBuffer, Column> entry : row.entrySet()) { <BUG>bag.add(columnToTuple(entry.getValue(), cfDef, parseType(cfDef.getComparator_type()))); </BUG> } } }
bag.add(columnToTuple(entry.getValue(), cfInfo, parseType(cfDef.getComparator_type())));
551
return getNextWide(); try { if (!reader.nextKeyValue()) return null; <BUG>CfDef cfDef = getCfDef(loadSignature); ByteBuffer key = reader.getCurrentKey();</BUG> Map<ByteBuffer, Column> cf = reader.getCurrentValue(); assert key != null && cf != null;
CfInfo cfInfo = getCfInfo(loadSignature); CfDef cfDef = cfInfo.cfDef; ByteBuffer key = reader.getCurrentKey();
552
added.put(cdef.name, true); } for (Map.Entry<ByteBuffer, Column> entry : cf.entrySet()) { if (!added.containsKey(entry.getKey())) <BUG>bag.add(columnToTuple(entry.getValue(), cfDef, parseType(cfDef.getComparator_type()))); </BUG> } tuple.append(bag); if (usePartitionFilter)
bag.add(columnToTuple(entry.getValue(), cfInfo, parseType(cfDef.getComparator_type())));
553
tuple.append(bag); if (usePartitionFilter) { for (ColumnDef cdef : getIndexes()) { <BUG>Tuple throwaway = columnToTuple(cf.get(cdef.name), cfDef, parseType(cfDef.getComparator_type())); </BUG> tuple.append(throwaway.get(1)); } }
Tuple throwaway = columnToTuple(cf.get(cdef.name), cfInfo, parseType(cfDef.getComparator_type()));
554
initSchema(storeSignature); } public ResourceSchema getSchema(String location, Job job) throws IOException { setLocation(location, job); <BUG>CfDef cfDef = getCfDef(loadSignature); if (cfDef.column_type.equals("Super"))</BUG> return null; ResourceSchema schema = new ResourceSchema();
CfInfo cfInfo = getCfInfo(loadSignature); CfDef cfDef = cfInfo.cfDef; if (cfDef.column_type.equals("Super"))
555
bagTupleField.setSchema(bagTupleSchema); bagSchema.setFields(new ResourceFieldSchema[] { bagTupleField }); bagField.setSchema(bagSchema); List<ResourceFieldSchema> allSchemaFields = new ArrayList<ResourceFieldSchema>(); allSchemaFields.add(keyFieldSchema); <BUG>if (!widerows) {</BUG> for (ColumnDef cdef : cfDef.column_metadata) { ResourceSchema innerTupleSchema = new ResourceSchema();
if (!widerows && (cfInfo.compactCqlTable || !cfInfo.cql3Table))
556
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() );
557
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_();
558
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 );
559
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 );
560
sink.tableCaption(); sink.text( getI18nString( locale, "stats.caption" ) ); sink.tableCaption_();</BUG> sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.subprojects" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); sink.text( String.valueOf( reactorProjects.size() ) ); sink.tableCell_();
sink.bold(); sink.bold_(); sink.tableCaption_(); sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.subprojects" ) ); sink.tableHeaderCell_();
561
sink.tableCell(); sink.text( String.valueOf( reactorProjects.size() ) ); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.dependencies" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); sink.text( String.valueOf( depCount ) );
sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.dependencies" ) ); sink.tableHeaderCell_();
562
sink.text( String.valueOf( convergence ) + "%" ); sink.bold_(); sink.tableCell_(); sink.tableRow_(); sink.tableRow(); <BUG>sink.tableHeaderCell(); sink.text( getI18nString( locale, "stats.readyrelease" ) + ":" ); sink.tableHeaderCell_();</BUG> sink.tableCell(); if ( convergence >= PERCENTAGE && snapshotCount <= 0 )
sink.tableHeaderCell( headerCellWidth ); sink.text( getI18nString( locale, "stats.readyrelease" ) ); sink.tableHeaderCell_();
563
{ ReverseDependencyLink p1 = (ReverseDependencyLink) o1; ReverseDependencyLink p2 = (ReverseDependencyLink) o2; return p1.getProject().getId().compareTo( p2.getProject().getId() ); } <BUG>else {</BUG> return 0; } }
iconError( sink );
564
public NodeFirstRelationshipStage( Configuration config, NodeStore nodeStore, RelationshipGroupStore relationshipGroupStore, NodeRelationshipLink cache ) { super( "Node --> Relationship", config, false ); add( new ReadNodeRecordsStep( control(), config.batchSize(), config.movingAverageSize(), nodeStore ) ); <BUG>add( new NodeFirstRelationshipStep( control(), config.workAheadSize(), config.movingAverageSize(), nodeStore, relationshipGroupStore, cache ) ); add( new UpdateRecordsStep<>( control(), config.workAheadSize(), config.movingAverageSize(), nodeStore ) );</BUG> }
add( new RecordProcessorStep<>( control(), "LINK", config.workAheadSize(), config.movingAverageSize(), new NodeFirstRelationshipProcessor( relationshipGroupStore, cache ), false ) ); add( new UpdateRecordsStep<>( control(), config.workAheadSize(), config.movingAverageSize(), nodeStore ) );
565
import org.neo4j.kernel.impl.api.CountsAccessor; import org.neo4j.kernel.impl.store.NodeLabelsField; import org.neo4j.kernel.impl.store.NodeStore; import org.neo4j.kernel.impl.store.record.NodeRecord; import org.neo4j.unsafe.impl.batchimport.cache.NodeLabelsCache; <BUG>public class NodeCountsProcessor implements StoreProcessor<NodeRecord> </BUG> { private final NodeStore nodeStore; private final long[] labelCounts;
public class NodeCountsProcessor implements RecordProcessor<NodeRecord>
566
super.addStatsProviders( providers ); providers.add( monitor ); } @Override protected void done() <BUG>{ monitor.stop();</BUG> } @Override public int numberOfProcessors()
super.done(); monitor.stop();
567
import org.neo4j.kernel.impl.store.RelationshipGroupStore; import org.neo4j.kernel.impl.store.record.NodeRecord; import org.neo4j.kernel.impl.store.record.RelationshipGroupRecord; import org.neo4j.unsafe.impl.batchimport.cache.NodeRelationshipLink; import org.neo4j.unsafe.impl.batchimport.cache.NodeRelationshipLink.GroupVisitor; <BUG>public class NodeFirstRelationshipProcessor implements StoreProcessor<NodeRecord>, GroupVisitor </BUG> { private final RelationshipGroupStore relGroupStore; private final NodeRelationshipLink nodeRelationshipLink;
public class NodeFirstRelationshipProcessor implements RecordProcessor<NodeRecord>, GroupVisitor
568
final Port port = this.getPort(deviceId, networkId); if (port == null) { throw new OpenstackException("Port not found for deviceId=" + deviceId); } try { <BUG>final String input = String.format("{\"floatingip\":{\"floating_network_id\":\"%s\",\"port_id\":\"%s\"}}", floatingNetworkId, port.getId()); final String response = this.doPost("floatingips", input);</BUG> final FloatingIp floatingIp = JsonUtils.unwrapRootToObject(FloatingIp.class, response); return floatingIp.getFloatingIpAddress();
final String input = String.format( "{\"floatingip\":{\"floating_network_id\":\"%s\"," + "\"port_id\":\"%s\", \"fixed_ip_address\":\"%s\"}}", floatingNetworkId, port.getId(), port.getFixedIps().get(0).getIpAddress()); final String response = this.doPost("floatingips", input);
569
package org.cloudifysource.esc.driver.provisioning.openstack; import java.util.ArrayList; import java.util.Collection; import java.util.List; <BUG>import java.util.Map; import org.apache.commons.lang.BooleanUtils;</BUG> import org.apache.commons.lang.StringUtils; import org.cloudifysource.domain.ServiceNetwork; import org.cloudifysource.domain.cloud.Cloud;
import java.util.logging.Logger; import org.apache.commons.lang.BooleanUtils;
570
private AccessRules serviceAccessRules; private boolean serviceUseNetworkTemplate; OpenStackNetworkConfigurationHelper() { } public OpenStackNetworkConfigurationHelper(final ComputeDriverConfiguration configuration) <BUG>throws CloudProvisioningException { this.validateNetworkNames(configuration.getCloud().getCloudNetwork());</BUG> this.initManagementNetworkConfig(configuration); this.management = configuration.isManagement(); if (!this.management) {
String name = configuration.isManagement() ? "managers" : configuration.getServiceName(); logger.info("Setup network configuration for " + name); this.validateNetworkNames(configuration.getCloud().getCloudNetwork());
571
this.serviceNetworkConfiguration = this.managementNetworkConfiguration; } else { this.serviceComputeNetworks = this.managementComputeNetworks; } } <BUG>} }</BUG> public NetworkConfiguration getNetworkConfiguration() { return management ? this.managementNetworkConfiguration : this.serviceNetworkConfiguration; }
logger.info("Service '" + configuration.getServiceName() + "' using network '" + this.getPrivateIpNetworkName() + "' for private ip");
572
request.setImageRef(imageId); request.setFlavorRef(hardwareId); if (this.networkHelper.useManagementNetwork()) { final String managementNetworkName = this.networkHelper.getManagementNetworkName(); final Network managementNetwork = this.getNetworkByNameThenPrefix(managementNetworkName); <BUG>for (final String subnetId : managementNetwork.getSubnets()) { final Port port = this.addPortToRequest(request, managementNetwork.getId(), subnetId); reservedPortIds.add(port.getId()); }</BUG> }
final Port port = this.addPortToRequest(request, managementNetwork.getId(), managementNetwork.getSubnets());
573
throws OpenstackException { final RouteFixedIp fixedIp = new RouteFixedIp();</BUG> fixedIp.setSubnetId(subnetId); <BUG>final Port port = new Port(); port.addFixedIp(fixedIp); port.setNetworkId(networkId);</BUG> final Port createdPort = this.networkApi.createPort(port); final NovaServerNetwork nsn = new NovaServerNetwork(); nsn.setPort(createdPort.getId()); request.addNetworks(nsn);
for (String subnetId : subnetIds) { final RouteFixedIp fixedIp = new RouteFixedIp(); } port.setNetworkId(networkId);
574
timeWarp = new OwnLabel(getFormattedTimeWrap(), skin, "warp"); timeWarp.setName("time warp"); Container wrapWrapper = new Container(timeWarp); wrapWrapper.width(60f * GlobalConf.SCALE_FACTOR); wrapWrapper.align(Align.center); <BUG>VerticalGroup timeGroup = new VerticalGroup().align(Align.left).space(3 * GlobalConf.SCALE_FACTOR).padTop(3 * GlobalConf.SCALE_FACTOR); </BUG> HorizontalGroup dateGroup = new HorizontalGroup(); dateGroup.space(4 * GlobalConf.SCALE_FACTOR); dateGroup.addActor(date);
VerticalGroup timeGroup = new VerticalGroup().align(Align.left).columnAlign(Align.left).space(3 * GlobalConf.SCALE_FACTOR).padTop(3 * GlobalConf.SCALE_FACTOR);
575
focusListScrollPane.setFadeScrollBars(false); focusListScrollPane.setScrollingDisabled(true, false); focusListScrollPane.setHeight(tree ? 200 * GlobalConf.SCALE_FACTOR : 100 * GlobalConf.SCALE_FACTOR); focusListScrollPane.setWidth(160); } <BUG>VerticalGroup objectsGroup = new VerticalGroup().align(Align.left).space(3 * GlobalConf.SCALE_FACTOR); </BUG> objectsGroup.addActor(searchBox); if (focusListScrollPane != null) { objectsGroup.addActor(focusListScrollPane);
VerticalGroup objectsGroup = new VerticalGroup().align(Align.left).columnAlign(Align.left).space(3 * GlobalConf.SCALE_FACTOR);
576
headerGroup.addActor(expandIcon); headerGroup.addActor(detachIcon); addActor(headerGroup); expandIcon.setChecked(expanded); } <BUG>public void expand() { </BUG> if (!expandIcon.isChecked()) { expandIcon.setChecked(true); }
public void expandPane() {
577
</BUG> if (!expandIcon.isChecked()) { expandIcon.setChecked(true); } } <BUG>public void collapse() { </BUG> if (expandIcon.isChecked()) { expandIcon.setChecked(false); }
headerGroup.addActor(expandIcon); headerGroup.addActor(detachIcon); addActor(headerGroup); expandIcon.setChecked(expanded); public void expandPane() { public void collapsePane() {
578
}); playstop.addListener(new TextTooltip(txt("gui.tooltip.playstop"), skin)); TimeComponent timeComponent = new TimeComponent(skin, ui); timeComponent.initialize(); CollapsiblePane time = new CollapsiblePane(ui, txt("gui.time"), timeComponent.getActor(), skin, true, playstop); <BUG>time.align(Align.left); mainActors.add(time);</BUG> panes.put(timeComponent.getClass().getSimpleName(), time); if (Constants.desktop) { recCamera = new OwnImageButton(skin, "rec");
time.align(Align.left).columnAlign(Align.left); mainActors.add(time);
579
panes.put(visualEffectsComponent.getClass().getSimpleName(), visualEffects); ObjectsComponent objectsComponent = new ObjectsComponent(skin, ui); objectsComponent.setSceneGraph(sg); objectsComponent.initialize(); CollapsiblePane objects = new CollapsiblePane(ui, txt("gui.objects"), objectsComponent.getActor(), skin, false); <BUG>objects.align(Align.left); mainActors.add(objects);</BUG> panes.put(objectsComponent.getClass().getSimpleName(), objects); GaiaComponent gaiaComponent = new GaiaComponent(skin, ui); gaiaComponent.initialize();
objects.align(Align.left).columnAlign(Align.left); mainActors.add(objects);
580
if (Constants.desktop) { MusicComponent musicComponent = new MusicComponent(skin, ui); musicComponent.initialize(); Actor[] musicActors = MusicActorsManager.getMusicActors() != null ? MusicActorsManager.getMusicActors().getActors(skin) : null; CollapsiblePane music = new CollapsiblePane(ui, txt("gui.music"), musicComponent.getActor(), skin, true, musicActors); <BUG>music.align(Align.left); mainActors.add(music);</BUG> panes.put(musicComponent.getClass().getSimpleName(), music); } Button switchWebgl = new OwnTextButton(txt("gui.webgl.back"), skin, "link");
music.align(Align.left).columnAlign(Align.left); mainActors.add(music);
581
} @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)
582
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))
583
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)
584
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");
585
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");
586
} @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);
587
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);
588
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);
589
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);
590
e.printStackTrace(); } filePlayback=null; } @Override <BUG>public void stop() { if ( filePlayback!=null ) filePlayback.stop(); } void initFiles() throws FileNotFoundException {</BUG> if ((dataDir.length() != 0) && !dataDir.endsWith("/")) { dataDir = dataDir + "/"; } // guard path if needed String samples_str = dataDir + "samples"; String events_str = dataDir + "events";
@Override public boolean isrunning(){ if ( filePlayback!=null ) return filePlayback.isrunning(); return false; } void initFiles() throws FileNotFoundException {
591
public class BufferMonitor extends Thread implements FieldtripBufferMonitor { public static final String TAG = BufferMonitor.class.toString(); private final Context context; private final SparseArray<BufferConnectionInfo> clients = new SparseArray<BufferConnectionInfo>(); private final BufferInfo info; <BUG>private final BroadcastReceiver mMessageReceiver = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) { if (intent.getIntExtra(C.MESSAGE_TYPE, -1) == C.UPDATE_REQUEST) { Log.i(TAG, "Received update request."); sendAllInfo(); } } };</BUG> private boolean run = true;
[DELETED]
592
public static final String CLIENT_INFO_TIME = "c_time"; public static final String CLIENT_INFO_WAITTIMEOUT = "c_waitTimeout"; public static final String CLIENT_INFO_CONNECTED = "c_connected"; public static final String CLIENT_INFO_CHANGED = "c_changed"; public static final String CLIENT_INFO_DIFF = "c_diff"; <BUG>public static final int UPDATE_REQUEST = 0; </BUG> public static final int UPDATE = 1; public static final int REQUEST_PUT_HEADER = 2; public static final int REQUEST_FLUSH_HEADER = 3;
public static final int THREAD_INFO_TYPE = 0;
593
package nl.dcc.buffer_bci.bufferclientsservice; import android.os.Parcel; import android.os.Parcelable; <BUG>import nl.dcc.buffer_bci.bufferservicecontroller.C; public class ThreadInfo implements Parcelable {</BUG> public static final Creator<ThreadInfo> CREATOR = new Creator<ThreadInfo>() { @Override public ThreadInfo createFromParcel(final Parcel in) {
import nl.dcc.buffer_bci.C; public class ThreadInfo implements Parcelable {
594
package org.glowroot.agent.config; import com.google.common.collect.ImmutableList; <BUG>import org.immutables.value.Value; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;</BUG> @Value.Immutable public abstract class UiConfig { @Value.Default
import org.glowroot.common.config.ConfigDefaults; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
595
class RepoAdminImpl implements RepoAdmin { private final DataSource dataSource; private final List<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; private final ConfigRepository configRepository; <BUG>private final AgentDao agentDao; </BUG> private final GaugeValueDao gaugeValueDao; private final GaugeNameDao gaugeNameDao; private final TransactionTypeDao transactionTypeDao;
private final EnvironmentDao agentDao;
596
private final TransactionTypeDao transactionTypeDao; private final FullQueryTextDao fullQueryTextDao; private final TraceAttributeNameDao traceAttributeNameDao; RepoAdminImpl(DataSource dataSource, List<CappedDatabase> rollupCappedDatabases, CappedDatabase traceCappedDatabase, ConfigRepository configRepository, <BUG>AgentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao, </BUG> TransactionTypeDao transactionTypeDao, FullQueryTextDao fullQueryTextDao, TraceAttributeNameDao traceAttributeNameDao) { this.dataSource = dataSource;
EnvironmentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao,
597
this.fullQueryTextDao = fullQueryTextDao; this.traceAttributeNameDao = traceAttributeNameDao; } @Override public void deleteAllData() throws Exception { <BUG>Environment environment = agentDao.readEnvironment(""); dataSource.deleteAll();</BUG> agentDao.reinitAfterDeletingDatabase(); gaugeValueDao.reinitAfterDeletingDatabase(); gaugeNameDao.invalidateCache();
Environment environment = agentDao.read(""); dataSource.deleteAll();
598
public class SimpleRepoModule { private static final long SNAPSHOT_REAPER_PERIOD_MINUTES = 5; private final DataSource dataSource; private final ImmutableList<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; <BUG>private final AgentDao agentDao; private final TransactionTypeDao transactionTypeDao;</BUG> private final AggregateDao aggregateDao; private final TraceAttributeNameDao traceAttributeNameDao; private final TraceDao traceDao;
private final EnvironmentDao environmentDao; private final TransactionTypeDao transactionTypeDao;
599
rollupCappedDatabases.add(new CappedDatabase(file, sizeKb, ticker)); } this.rollupCappedDatabases = ImmutableList.copyOf(rollupCappedDatabases); traceCappedDatabase = new CappedDatabase(new File(dataDir, "trace-detail.capped.db"), storageConfig.traceCappedDatabaseSizeMb() * 1024, ticker); <BUG>agentDao = new AgentDao(dataSource); </BUG> transactionTypeDao = new TransactionTypeDao(dataSource); rollupLevelService = new RollupLevelService(configRepository, clock); FullQueryTextDao fullQueryTextDao = new FullQueryTextDao(dataSource);
environmentDao = new EnvironmentDao(dataSource);
600
traceDao = new TraceDao(dataSource, traceCappedDatabase, transactionTypeDao, fullQueryTextDao, traceAttributeNameDao); GaugeNameDao gaugeNameDao = new GaugeNameDao(dataSource); gaugeValueDao = new GaugeValueDao(dataSource, gaugeNameDao, clock); repoAdmin = new RepoAdminImpl(dataSource, rollupCappedDatabases, traceCappedDatabase, <BUG>configRepository, agentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao, </BUG> fullQueryTextDao, traceAttributeNameDao); if (backgroundExecutor == null) { reaperRunnable = null;
configRepository, environmentDao, gaugeValueDao, gaugeNameDao, transactionTypeDao,