id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
8,001
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") <BUG>public final class FoxGuardMain { public final Cause pluginCause = Cause.builder().named("plugin", this).build(); private static FoxGuardMain instanceField;</BUG> @Inject private Logger logger;
private static FoxGuardMain instanceField;
8,002
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { <BUG>return instanceField; }</BUG> @Listener public void construct(GameConstructionEvent event) { instanceField = this;
} public static Cause getCause() { return instance().pluginCause; }
8,003
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
8,004
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.*; <BUG>import java.util.stream.Collectors; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
8,005
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index > 0) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
8,006
private static FGStorageManager instance; private final Logger logger = FoxGuardMain.instance().getLogger();</BUG> private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; <BUG>private FGStorageManager() { defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG> if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> {
8,007
String name = fgObject.getName(); Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
UUID owner = fgObject.getOwner(); boolean isOwned = !owner.equals(SERVER_UUID); Optional<User> userOwner = userStorageService.get(owner); String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name; if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
8,008
if (fgObject.autoSave()) { Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
8,009
public synchronized void loadRegionLinks() { logger.info("Loading region links"); try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey()); if (region != null) { logger.info("Loading links for region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\"");
8,010
public synchronized void loadWorldRegionLinks(World world) { logger.info("Loading world region links for world \"" + world.getName() + "\""); try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (region != null) { logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (regionOpt.isPresent()) { IWorldRegion region = regionOpt.get(); logger.info("Loading links for world region \"" + region.getName() + "\"");
8,011
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } <BUG>return builder.toString(); }</BUG> private final class LoadEntry { public final String name; public final Type type;
public enum Type { REGION, WREGION, HANDLER
8,012
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream() </BUG> .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "worldregion", "handler", "controller")
8,013
while(scaleDataIterator.hasNext()) { ScaleData scaleData = scaleDataIterator.next(); if (scaleData.id == id) { <BUG>if (scaleDataIterator.hasNext()) { getIntent().putExtra("id",scaleDataIterator.next().id );</BUG> updateOnView(); return true; } else {
saveScaleData(); getIntent().putExtra("id",scaleDataIterator.next().id );
8,014
while(scaleDataIterator.hasPrevious()) { ScaleData scaleData = scaleDataIterator.previous(); if (scaleData.id == id) { <BUG>if (scaleDataIterator.hasPrevious()) { getIntent().putExtra("id", scaleDataIterator.previous().id);</BUG> updateOnView(); return true; } else {
saveScaleData(); getIntent().putExtra("id", scaleDataIterator.previous().id);
8,015
import java.io.DataOutputStream; import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; <BUG>import java.util.*; public class GossipRouter {</BUG> public static final byte CONNECT=1; // CONNECT(group, addr) --> local address public static final byte DISCONNECT=2; // DISCONNECT(group, addr) public static final byte REGISTER=3; // REGISTER(group, addr)
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentHashMap; public class GossipRouter {
8,016
private int port; private String bindAddressString; private long expiryTime; private long gossipRequestTimeout; private long routingClientReplyTimeout; <BUG>private final Map<String,Map<Address,AddressEntry>> routingTable=new HashMap<String,Map<Address,AddressEntry>>(); </BUG> private ServerSocket srvSock=null; private InetAddress bindAddress=null; private boolean up=true;
private final ConcurrentMap<String,ConcurrentMap<Address,AddressEntry>> routingTable=new ConcurrentHashMap<String,ConcurrentMap<Address,AddressEntry>>();
8,017
public void destroy() { } public String dumpRoutingTable() { String label="routing"; StringBuilder sb=new StringBuilder(); <BUG>synchronized(routingTable) { if(routingTable.isEmpty()) { sb.append("empty "); sb.append(label); sb.append(" table");</BUG> }
sb.append("empty ").append(label).append(" table");
8,018
tcParameters.addValue("result_desc", testCase.getState()); tcParameters.addValue("name", testCase.getName()); tcParameters.addValue("guid", testSuite.getGuid()); tcParameters.addValue("start", testCase.getStartDateAsUnixTimestamp()); tcParameters.addValue("stop", testCase.getStopDateAsUnixTimestamp()); <BUG>tcParameters.addValue("warning", testCase.getWarningTime()); tcParameters.addValue("critical", testCase.getCriticalTime()); tcParameters.addValue("browser", testSuite.getBrowserInfo());</BUG> tcParameters.addValue("lastpage", testCase.getLastURL()); try {
int warningTime = testCase.getWarningTime(); tcParameters.addValue("warning", (warningTime != 0) ? warningTime : null); int criticalTime = testCase.getCriticalTime(); tcParameters.addValue("critical", (criticalTime != 0) ? criticalTime : null); tcParameters.addValue("browser", testSuite.getBrowserInfo());
8,019
stepParameters.addValue("result", step.getState().getErrorCode()); stepParameters.addValue("result_desc", step.getState()); stepParameters.addValue("name", step.getName()); stepParameters.addValue("start", step.getStartDateAsUnixTimestamp()); stepParameters.addValue("stop", step.getStopDateAsUnixTimestamp()); <BUG>stepParameters.addValue("warning", step.getWarningTime()); stepParameters.addValue("duration", step.getDuration());</BUG> logger.info("write the following values to 'sahi_steps': " + stepParameters.getValues() + "\n now execute ....");
int warningTime = step.getWarningTime(); stepParameters.addValue("warning", (warningTime != 0) ? warningTime : null); stepParameters.addValue("duration", step.getDuration());
8,020
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.List; <BUG>import java.util.Optional; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandDelete extends FCCommandBase { private static final FlagMapper MAPPER = map -> key -> value -> { map.put(key, value);
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
8,021
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { <BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); IRegion region = FGManager.getInstance().getRegion(parse.args[1]); </BUG> boolean isWorldRegion = false; if (region == null) {
String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
8,022
</BUG> isWorldRegion = true; } if (region == null) <BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!")); if (region instanceof GlobalWorldRegion) { </BUG> throw new CommandException(Text.of("You may not delete the global region!")); }
if (world == null) throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!")); if (world == null) throw new CommandException(Text.of("Must specify a world!")); region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null); throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) {
8,023
source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region" ); return CommandResult.success(); } else if (isIn(HANDLERS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); <BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]); if (handler == null) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); if (handler instanceof GlobalHandler)</BUG> throw new CommandException(Text.of("You may not delete the global handler!"));
Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler)
8,024
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
8,025
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
8,026
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") <BUG>public final class FoxGuardMain { public final Cause pluginCause = Cause.builder().named("plugin", this).build(); private static FoxGuardMain instanceField;</BUG> @Inject private Logger logger;
private static FoxGuardMain instanceField;
8,027
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { <BUG>return instanceField; }</BUG> @Listener public void construct(GameConstructionEvent event) { instanceField = this;
} public static Cause getCause() { return instance().pluginCause; }
8,028
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
8,029
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.*; <BUG>import java.util.stream.Collectors; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
8,030
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index > 0) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
8,031
private static FGStorageManager instance; private final Logger logger = FoxGuardMain.instance().getLogger();</BUG> private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; <BUG>private FGStorageManager() { defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG> if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> {
8,032
String name = fgObject.getName(); Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
UUID owner = fgObject.getOwner(); boolean isOwned = !owner.equals(SERVER_UUID); Optional<User> userOwner = userStorageService.get(owner); String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name; if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
8,033
if (fgObject.autoSave()) { Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
8,034
public synchronized void loadRegionLinks() { logger.info("Loading region links"); try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey()); if (region != null) { logger.info("Loading links for region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\"");
8,035
public synchronized void loadWorldRegionLinks(World world) { logger.info("Loading world region links for world \"" + world.getName() + "\""); try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (region != null) { logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (regionOpt.isPresent()) { IWorldRegion region = regionOpt.get(); logger.info("Loading links for world region \"" + region.getName() + "\"");
8,036
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } <BUG>return builder.toString(); }</BUG> private final class LoadEntry { public final String name; public final Type type;
public enum Type { REGION, WREGION, HANDLER
8,037
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream() </BUG> .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "worldregion", "handler", "controller")
8,038
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;
8,039
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;
8,040
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"),
8,041
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]
8,042
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) {
8,043
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;
8,044
} @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)
8,045
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))
8,046
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)
8,047
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");
8,048
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");
8,049
} @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);
8,050
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);
8,051
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);
8,052
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);
8,053
loadBeanDefinitionsFromImportedResources(configClass.getImportedResources()); } private void doLoadBeanDefinitionForConfigurationClassIfNecessary(ConfigurationClass configClass) { if (!configClass.isImported()) { return; <BUG>} BeanDefinition configBeanDef = new GenericBeanDefinition(); String className = configClass.getMetadata().getClassName(); </BUG> configBeanDef.setBeanClassName(className);
AnnotationMetadata metadata = configClass.getMetadata(); BeanDefinition configBeanDef = new AnnotatedGenericBeanDefinition(metadata); String className = metadata.getClassName();
8,054
public boolean createParentFolder; public boolean waitingToFinish=true; public boolean followingAbortRemotely; private String remoteSlaveServerName; public boolean passingAllParameters=true; <BUG>private boolean passingExport; private Job job;</BUG> public JobEntryJob(String name) { super(name, "");
public static final LogLevel DEFAULT_LOG_LEVEL = LogLevel.NOTHING; private Job job;
8,055
retval.append(" ").append(XMLHandler.addTagValue("set_logfile", setLogfile)); retval.append(" ").append(XMLHandler.addTagValue("logfile", logfile)); retval.append(" ").append(XMLHandler.addTagValue("logext", logext)); retval.append(" ").append(XMLHandler.addTagValue("add_date", addDate)); retval.append(" ").append(XMLHandler.addTagValue("add_time", addTime)); <BUG>retval.append(" ").append(XMLHandler.addTagValue("loglevel", logFileLevel.getCode())); </BUG> retval.append(" ").append(XMLHandler.addTagValue("slave_server_name", remoteSlaveServerName)); retval.append(" ").append(XMLHandler.addTagValue("wait_until_finished", waitingToFinish)); retval.append(" ").append(XMLHandler.addTagValue("follow_abort_remote", followingAbortRemotely));
retval.append(" ").append(XMLHandler.addTagValue("loglevel", logFileLevel != null ? logFileLevel.getCode() : DEFAULT_LOG_LEVEL.getCode()));
8,056
rep.saveJobEntryAttribute(id_job, getObjectId(), "add_date", addDate); rep.saveJobEntryAttribute(id_job, getObjectId(), "add_time", addTime); rep.saveJobEntryAttribute(id_job, getObjectId(), "logfile", logfile); rep.saveJobEntryAttribute(id_job, getObjectId(), "logext", logext); rep.saveJobEntryAttribute(id_job, getObjectId(), "set_append_logfile", setAppendLogfile); <BUG>rep.saveJobEntryAttribute(id_job, getObjectId(), "loglevel", logFileLevel.getCode()); rep.saveJobEntryAttribute(id_job, getObjectId(), "slave_server_name", remoteSlaveServerName);</BUG> rep.saveJobEntryAttribute(id_job, getObjectId(), "pass_export", passingExport); rep.saveJobEntryAttribute(id_job, getObjectId(), "wait_until_finished", waitingToFinish); rep.saveJobEntryAttribute(id_job, getObjectId(), "follow_abort_remote", followingAbortRemotely);
rep.saveJobEntryAttribute(id_job, getObjectId(), "loglevel", logFileLevel != null ? logFileLevel.getCode() : JobEntryJob.DEFAULT_LOG_LEVEL.getCode()); rep.saveJobEntryAttribute(id_job, getObjectId(), "slave_server_name", remoteSlaveServerName);
8,057
wAddTime.setSelection(jobEntry.addTime); if (jobEntry.getRemoteSlaveServerName()!=null) { wSlaveServer.setText(jobEntry.getRemoteSlaveServerName()); } <BUG>wPassExport.setSelection(jobEntry.isPassingExport()); wLoglevel.select(jobEntry.logFileLevel.getLevel()); wAppendLogfile.setSelection(jobEntry.setAppendLogfile);</BUG> wCreateParentFolder.setSelection(jobEntry.createParentFolder); wWaitingToFinish.setSelection(jobEntry.isWaitingToFinish());
if(jobEntry.logFileLevel != null) { } else { wLoglevel.select(JobEntryJob.DEFAULT_LOG_LEVEL.getLevel()); wAppendLogfile.setSelection(jobEntry.setAppendLogfile);
8,058
import java.util.Map; import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Event; import javax.inject.Inject; <BUG>import javax.inject.Named; import org.drools.workbench.screens.workitems.service.WorkItemsEditorService; import org.guvnor.common.services.project.model.GAV; import org.guvnor.common.services.project.model.POM;</BUG> import org.guvnor.common.services.shared.security.KieWorkbenchPolicy;
import org.drools.workbench.screens.workitems.backend.server.WorkbenchConfigurationHelper;
8,059
import org.guvnor.structure.server.config.ConfigItem; import org.guvnor.structure.server.config.ConfigType; import org.guvnor.structure.server.config.ConfigurationFactory; import org.guvnor.structure.server.config.ConfigurationService; import org.jbpm.console.ng.bd.service.AdministrationService; <BUG>import org.kie.workbench.common.services.shared.project.KieProjectService; import org.slf4j.Logger;</BUG> import org.slf4j.LoggerFactory; import org.uberfire.commons.services.cdi.ApplicationStarted; import org.uberfire.commons.services.cdi.Startup;
import org.kie.workbench.screens.workbench.backend.BaseAppSetup; import org.slf4j.Logger;
8,060
package org.elasticsearch.common.bytes; import org.apache.lucene.util.BytesRef; <BUG>import org.elasticsearch.common.io.stream.StreamInput; import org.jboss.netty.buffer.ChannelBuffer;</BUG> import java.io.IOException; import java.io.OutputStream; import java.nio.channels.GatheringByteChannel;
import org.elasticsearch.common.util.UnsafeUtils; import org.jboss.netty.buffer.ChannelBuffer;
8,061
len -= 8; o1 += 8; o2 += 8; } if (len >= 4) { <BUG>if (readInt(b1.bytes, o1) != readInt(b2.bytes, o2)) { return false;</BUG> } len -= 4; o1 += 4;
if (readInt(b1, o1) != readInt(b2, o2)) { return false;
8,062
len -= 4; o1 += 4; o2 += 4; } if (len >= 2) { <BUG>if (readShort(b1.bytes, o1) != readShort(b2.bytes, o2)) { return false;</BUG> } len -= 2; o1 += 2;
if (readShort(b1, o1) != readShort(b2, o2)) { return false;
8,063
len -= 2; o1 += 2; o2 += 2; } if (len == 1) { <BUG>if (readByte(b1.bytes, o1) != readByte(b2.bytes, o2)) { return false;</BUG> } } else { assert len == 0;
if (readByte(b1, o1) != readByte(b2, o2)) { return false;
8,064
appendAsapAttr(sb, Events.ON_CHECK); appendAsapAttr(sb, Events.ON_RIGHT_CLICK); appendAsapAttr(sb, Events.ON_DOUBLE_CLICK); return sb.toString(); } <BUG>public String getZclass() { String scls = super.getZclass(); if (scls == null) scls = "z-chkbox"; return scls;</BUG> }
return _zclass == null ? "z-chkbox" : super.getZclass();
8,065
final StringBuffer sb = new StringBuffer(64).append(super.getInnerAttrs()); HTMLs.appendAttribute(sb, "value", getValue()); return sb.toString(); } <BUG>public String getZclass() { String scls = super.getZclass(); if (scls == null) scls = "z-radio"; return scls;</BUG> }
return _zclass == null ? "z-radio" : super.getZclass();
8,066
public String getOuterAttrs() { final String attrs = super.getOuterAttrs(); final String clkattrs = getAllOnClickAttrs(); return clkattrs == null ? attrs: attrs + clkattrs; } <BUG>public String getZclass() { String scls = super.getZclass(); if (scls == null) scls = "z-label"; return scls;</BUG> }
return _zclass == null ? "z-label" : super.getZclass();
8,067
wh.write("<span id=\"").write(uuid).write("\" z.type=\"zul.btn.Radio\"") .write(self.getOuterAttrs()).write(">").write("<input type=\"radio\" id=\"") .write(uuid).write("!real\"").write(self.getInnerAttrs()) .write("/><label for=\"").write(uuid).write("!real\"") .write(self.getLabelAttrs()) <BUG>.write(" class=\""+self.getZclass()+"\"") </BUG> .write(">") .write(self.getImgTag()).write(self.getLabel()) .write("</label>");
.write(" class=\""+self.getZclass()+"-cnt\"")
8,068
wh.write("<span id=\"").write(uuid).write("\""); wh.write(" z.type=\"zul.btn.Ckbox\""); wh.write(self.getOuterAttrs()).write("><input type=\"checkbox\" id=\""); wh.write(uuid).write("!real\"").write(self.getInnerAttrs()); wh.write("/><label for=\"").write(uuid).write("!real\""); <BUG>wh.write(self.getLabelAttrs()).write(" class=\""+self.getZclass()+"\"") </BUG> .write(">").write(self.getImgTag()); new Out(self.getLabel()).render(out); wh.write("</label></span>");
wh.write(self.getLabelAttrs()).write(" class=\""+self.getZclass()+"-cnt\"")
8,069
final String clkattrs = getAllOnClickAttrs(); if (clkattrs != null) sb.append(clkattrs); return sb.toString(); } <BUG>public String getZclass(){ String scls = super.getZclass(); if (scls == null) scls = "z-tab"; return scls;</BUG> }
public String getZclass() { return _zclass == null ? "z-tab" : super.getZclass();
8,070
private ConceptDeclaration getSelectedConcept() { if (mySelectedConceptContainer == null) return null; return mySelectedConceptContainer.getNode(); } private void processPopupMenu(MouseEvent e) { <BUG>ActionEventData context = new ActionEventData(myOperationContext); context.put(SNode.class, BaseAdapter.fromAdapter(getSelectedConcept())); context.put(List.class, CollectionUtil.asList(getSelectedConcept()));</BUG> BaseGroup group = ActionUtils.getGroup(ProjectPane.PROJECT_PANE_NODE_ACTIONS); ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group).getComponent().show(this, e.getX(), e.getY());
[DELETED]
8,071
import jetbrains.mps.ide.ThreadUtils; import jetbrains.mps.project.MPSProject; import jetbrains.mps.refactoring.framework.RefactoringContext; import jetbrains.mps.smodel.*; import jetbrains.mps.util.CollectionUtil; <BUG>import jetbrains.mps.workbench.action.ActionEventData; import java.util.List;</BUG> public class MoveConceptRefactoringTester implements IRefactoringTester { public boolean testRefactoring(MPSProject project, final SModelDescriptor sandbox1,
[DELETED]
8,072
ModelAccess.instance().runReadAction(new Runnable() { public void run() { SModelDescriptor structureModelDescriptor = testRefactoringLanguage.getStructureModelDescriptor(); targetStructureModelDescriptor[0] = testRefactoringTargetLanguage.getStructureModelDescriptor(); SNode concept = structureModelDescriptor.getSModel().getRootByName(conceptName); <BUG>data.put(SNode.class, concept); data.put(List.class, CollectionUtil.asList(concept)); data.put(SModelDescriptor.class, structureModelDescriptor); refactoringContext.setParameter(MoveConcepts.targetModel, targetStructureModelDescriptor[0]);</BUG> }
refactoringContext.setSelectedNode(concept); refactoringContext.setSelectedNodes(CollectionUtil.asList(concept)); refactoringContext.setSelectedModel(structureModelDescriptor); refactoringContext.setParameter(MoveConcepts.targetModel, targetStructureModelDescriptor[0]);
8,073
public void run() { SModelDescriptor structureModelDescriptor = testRefactoringTargetLanguage.getStructureModelDescriptor(); SNode node = structureModelDescriptor.getSModel().getRootByName("AbstractGoodConcept"); ConceptDeclaration concept = (ConceptDeclaration) BaseAdapter.fromNode(node); SNode link = concept.getLinkDeclarations().get(0).getNode(); <BUG>data.put(SNode.class, link); data.put(SModelDescriptor.class, structureModelDescriptor); refactoringContext.setParameter(RenameLink.newName, newLinkName);</BUG> } });
refactoringContext.setSelectedNode(link); refactoringContext.setSelectedModel(structureModelDescriptor); refactoringContext.setParameter(RenameLink.newName, newLinkName);
8,074
public void run() { SModelDescriptor structureModelDescriptor = testRefactoringLanguage.getStructureModelDescriptor(); SNode node = structureModelDescriptor.getSModel().getRootByName("MyVeryGoodConcept1"); ConceptDeclaration concept = (ConceptDeclaration) BaseAdapter.fromNode(node); SNode link = concept.getLinkDeclarations().get(0).getNode(); <BUG>data.put(SNode.class, link); data.put(SModelDescriptor.class, structureModelDescriptor); refactoringContext.setParameter(RenameLink.newName, newLinkName);</BUG> } });
refactoringContext.setSelectedNode(link); refactoringContext.setSelectedModel(structureModelDescriptor); refactoringContext.setParameter(RenameLink.newName, newLinkName);
8,075
public void run() { SModelDescriptor structureModelDescriptor = testRefactoringLanguage.getStructureModelDescriptor(); SNode node = structureModelDescriptor.getSModel().getRootByName("YetAnotherGoodConcept"); ConceptDeclaration concept = (ConceptDeclaration) BaseAdapter.fromNode(node); SNode property = concept.getPropertyDeclarations().get(0).getNode(); <BUG>data.put(SNode.class, property); data.put(SModelDescriptor.class, structureModelDescriptor); refactoringContext.setParameter(RenameProperty.newName, newPropertyName);</BUG> } });
refactoringContext.setSelectedNode(property); refactoringContext.setSelectedModel(structureModelDescriptor); refactoringContext.setParameter(RenameProperty.newName, newPropertyName);
8,076
import dpfmanager.conformancechecker.tiff.implementation_checker.Validator; import dpfmanager.conformancechecker.tiff.implementation_checker.rules.model.ImplementationCheckerObjectType; import dpfmanager.shell.modules.report.core.GlobalReport; import dpfmanager.shell.modules.report.core.IndividualReport; import dpfmanager.shell.modules.report.core.ReportGenerator; <BUG>import dpfmanager.shell.modules.report.core.ReportGeneric; import org.apache.commons.lang.StringUtils;</BUG> import java.io.File; public class ReportHtml extends ReportGeneric { public void parseGlobal(String outputfile, GlobalReport gr, ReportGenerator generator) {
import dpfmanager.shell.modules.report.core.SmallIndividualReport; import org.apache.commons.lang.StringUtils;
8,077
String imagePath = "templates/image.html"; String newHtmlFolder = outputfile.substring(0, outputfile.lastIndexOf("/")); String imagesBody = ""; String pieFunctions = ""; int index = 0; <BUG>for (IndividualReport ir : gr.getIndividualReports()) { if (!ir.containsData()) continue; </BUG> String imageBody;
for (SmallIndividualReport ir : gr.getIndividualReports()) { if (!ir.getContainsData()) continue;
8,078
boolean check = tiff2Jpg(ir.getFilePath(), newHtmlFolder + "/" + imgPath); if (!check) { imgPath = "html/img/noise.jpg"; } imageBody = StringUtils.replace(imageBody, "##IMG_PATH##", encodeUrl(imgPath)); <BUG>int percent = ir.calculatePercent(); </BUG> imageBody = StringUtils.replace(imageBody, "##PERCENT##", "" + percent); imageBody = StringUtils.replace(imageBody, "##INDEX##", "" + index); imageBody = StringUtils.replace(imageBody, "##IMG_NAME##", "" + ir.getFileName());
int percent = ir.getPercent();
8,079
public List<String> getIsosCheck() { if (isosCheck == null) return new ArrayList<>(); return isosCheck; } public List<String> getCheckedIsos() { <BUG>List<String> checked = new ArrayList<>(); checked.addAll(errors.keySet()); Collections.sort(checked, Collator.getInstance()); return checked;</BUG> }
if (errors != null) { return checked;
8,080
import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; public class GlobalReport { <BUG>private List<IndividualReport> reports; </BUG> private Map<String, Integer> nReportsOk; private List<String> isos; private List<String> isosChecked;
private List<SmallIndividualReport> reports;
8,081
if (ir.isError()){ toDelete.add(ir); } else { for (String iso : ir.getCheckedIsos()){ if (ir.hasValidation(iso)){ <BUG>if (ir.getErrors(iso).size() == 0){ </BUG> if (nReportsOk.containsKey(iso)){ nReportsOk.put(iso, nReportsOk.get(iso)+1); } else {
if (ir.getNErrors(iso) == 0){
8,082
import dpfmanager.shell.modules.threading.messages.GlobalStatusMessage; import dpfmanager.shell.modules.threading.runnable.DpfRunnable; import org.apache.camel.CamelContext; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; <BUG>import org.apache.camel.impl.DefaultCamelContext; import org.apache.logging.log4j.Level; import java.security.NoSuchAlgorithmException;</BUG> import java.util.List; import java.util.ResourceBundle;
import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; import java.security.NoSuchAlgorithmException;
8,083
context.send(BasicConfig.MODULE_MESSAGE, new LogMessage(getClass(), Level.DEBUG, bundle.getString("globalReport").replace("%1", internalReportFolder))); } catch (OutOfMemoryError e) { context.send(BasicConfig.MODULE_MESSAGE, new AlertMessage(AlertMessage.Type.ERROR, bundle.getString("errorOccurred"), bundle.getString("outOfMemory"))); } try { <BUG>if (DPFManagerProperties.getFeedback() && summaryXml != null) { sendFtpCamel(summaryXml); </BUG> }
if (DPFManagerProperties.getFeedback() && summaryXmlFile != null) { sendFtpCamel(summaryXmlFile);
8,084
context.send(BasicConfig.MODULE_MESSAGE, new ExceptionMessage(bundle.getString("exception"), e)); e.printStackTrace(); } context.send(BasicConfig.MODULE_THREADING, new GlobalStatusMessage(GlobalStatusMessage.Type.FINISH, uuid)); } <BUG>private void sendFtpCamel(String summaryXml) throws NoSuchAlgorithmException { context.send(BasicConfig.MODULE_MESSAGE, new LogMessage(getClass(), Level.DEBUG, bundle.getString("sendingFeedback")));</BUG> String ftp = "84.88.145.109";
private void sendFtpCamel(String summaryXmlFile) throws NoSuchAlgorithmException, IOException { String summaryXml = FileUtils.readFileToString(new File(summaryXmlFile), "utf-8"); context.send(BasicConfig.MODULE_MESSAGE, new LogMessage(getClass(), Level.DEBUG, bundle.getString("sendingFeedback")));
8,085
} @Nonnull @Override public String toJSON() { return super.toJSON("DirectiveName"); } public enum DirectiveNameSubtype { <BUG>BaseUri, ChildSrc,</BUG> ConnectSrc, DefaultSrc, FontSrc,
BlockAllMixedContent, // W3C Candidate Recommendation at http://www.w3.org/TR/mixed-content/#strict-opt-in as of 2015-09-22 ChildSrc,
8,086
Options, // never included in an official CSP specification Unrecognised; @Nonnull static DirectiveNameSubtype fromString(@Nonnull String directiveName) { switch (directiveName.toLowerCase()) { case "base-uri": <BUG>return BaseUri; case "child-src":</BUG> return ChildSrc; case "connect-src": return ConnectSrc;
case "block-all-mixed-content": return BlockAllMixedContent; case "child-src":
8,087
case "allow": return Allow; case "options":</BUG> return Options; <BUG>case "referrer": return Referrer; case "upgrade-insecure-requests": return UpgradeInsecureRequests; case "block-all-mixed-content": return BlockAllMixedContent;</BUG> }
case "frame-src": return FrameSrc; case "options":
8,088
private static final DirectiveParseException MISSING_DIRECTIVE_NAME = new DirectiveParseException("Missing directive-name"); private static final DirectiveParseException INVALID_DIRECTIVE_NAME = new DirectiveParseException("Invalid directive-name"); private static final DirectiveParseException INVALID_DIRECTIVE_VALUE = new DirectiveParseException("Invalid directive-value"); private static final DirectiveParseException INVALID_MEDIA_TYPE_LIST = new DirectiveParseException("Invalid media-type-list"); private static final DirectiveParseException INVALID_SOURCE_LIST = new DirectiveParseException("Invalid source-list"); <BUG>private static final DirectiveParseException INVALID_ANCESTOR_SOURCE_LIST = new DirectiveParseException("Invalid ancestor-source-list"); private static final DirectiveParseException INVALID_SANDBOX_TOKEN_LIST = new DirectiveParseException("Invalid sandbox-token list"); private static final DirectiveParseException INVALID_URI_REFERENCE_LIST = new DirectiveParseException("Invalid uri-reference list"); @Nonnull private Directive<?> parseDirective() throws DirectiveParseException {</BUG> if (!this.hasNext(DirectiveNameToken.class)) {
private static final DirectiveParseException INVALID_REFERRER_TOKEN_LIST = new DirectiveParseException("Invalid referrer-token list"); private static final DirectiveParseException NON_EMPTY_VALUE_TOKEN_LIST = new DirectiveParseException("Non-empty directive-value list"); @Nonnull private Directive<?> parseDirective() throws DirectiveParseException {
8,089
result = new FormActionDirective(this.parseSourceList()); break; case FrameAncestors: result = new FrameAncestorsDirective(this.parseAncestorSourceList()); break; <BUG>case FrameSrc: this.warn("The frame-src directive is deprecated as of CSP version 1.1. Authors who wish to govern nested browsing contexts SHOULD use the child-src directive instead."); result = new FrameSrcDirective(this.parseSourceList()); break;</BUG> case ImgSrc:
[DELETED]
8,090
if (this.hasNext(DirectiveValueToken.class)) this.advance(); throw INVALID_DIRECTIVE_NAME;</BUG> case Allow: this.error("The allow directive has been replaced with default-src and is not in the CSP specification."); if (this.hasNext(DirectiveValueToken.class)) this.advance(); <BUG>throw INVALID_DIRECTIVE_NAME; case Options:</BUG> this.error("The options directive has been replaced with 'unsafe-inline' and 'unsafe-eval' and is not in the CSP specification."); if (this.hasNext(DirectiveValueToken.class)) this.advance(); throw INVALID_DIRECTIVE_NAME;
case FrameSrc: this.warn("The frame-src directive is deprecated as of CSP version 1.1. Authors who wish to govern nested browsing contexts SHOULD use the child-src directive instead."); result = new FrameSrcDirective(this.parseSourceList()); break; case Options:
8,091
if (parseException) { throw INVALID_MEDIA_TYPE_LIST; } } if (mediaTypes.isEmpty()) { <BUG>this.error("media-type-list must contain at least one media-type"); </BUG> throw INVALID_MEDIA_TYPE_LIST; } return mediaTypes;
this.error("The media-type-list must contain at least one media-type");
8,092
String path = matcher.group("path"); return new HostSource(scheme, host, port, path); } } throw this.createError("Expecting ancestor-source but found " + ancestorSource); <BUG>} @Nonnull private Set<SandboxValue> parseSandboxTokenList() throws DirectiveParseException {</BUG> Set<SandboxValue> sandboxTokens = new LinkedHashSet<>(); if (this.hasNext(DirectiveValueToken.class)) { boolean parseException = false;
@Nonnull private Set<ReferrerValue> parseReferrerTokenList() throws DirectiveParseException { Set<ReferrerValue> referrerTokens = new LinkedHashSet<>();
8,093
package com.shapesecurity.salvation; import java.util.regex.Pattern; @SuppressWarnings("MalformedRegex") public class Constants { <BUG>public static final String schemePart = "[a-zA-Z][a-zA-Z0-9+\\-.]*"; public static final Pattern sandboxTokenPattern =</BUG> Pattern.compile("^[!#$%&'*+\\-.^_`|~0-9a-zA-Z]+$"); public static final Pattern mediaTypePattern = Pattern.compile("^(?<type>[^/]+)/(?<subtype>[^/]+)$");
public static final Pattern referrerTokenPattern = Pattern.compile( "^(?:no-referrer|no-referrer-when-downgrade|origin" + "|origin-when-cross-origin|unsafe-url)$", Pattern.CASE_INSENSITIVE); public static final Pattern sandboxTokenPattern =
8,094
import org.elasticsearch.util.inject.Inject; import org.elasticsearch.util.inject.assistedinject.Assisted; import org.elasticsearch.util.lucene.Lucene; import org.elasticsearch.util.settings.Settings; import java.util.Set; <BUG>public class StopAnalyzerProvider extends AbstractAnalyzerProvider<StopAnalyzer> { </BUG> private final Set<String> stopWords; private final StopAnalyzer stopAnalyzer; @Inject public StopAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
public class StopAnalyzerProvider extends AbstractIndexAnalyzerProvider<StopAnalyzer> {
8,095
import org.elasticsearch.util.inject.Inject; import org.elasticsearch.util.inject.assistedinject.Assisted; import org.elasticsearch.util.lucene.Lucene; import org.elasticsearch.util.settings.Settings; import java.util.Set; <BUG>public class StandardAnalyzerProvider extends AbstractAnalyzerProvider<StandardAnalyzer> { </BUG> private final Set<String> stopWords; private final int maxTokenLength; private final StandardAnalyzer standardAnalyzer;
public class StandardAnalyzerProvider extends AbstractIndexAnalyzerProvider<StandardAnalyzer> {
8,096
import org.elasticsearch.index.Index; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.util.inject.Inject; import org.elasticsearch.util.inject.assistedinject.Assisted; import org.elasticsearch.util.settings.Settings; <BUG>public class KeywordAnalyzerProvider extends AbstractAnalyzerProvider<KeywordAnalyzer> { </BUG> private final KeywordAnalyzer keywordAnalyzer; @Inject public KeywordAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) { super(index, indexSettings, name);
public class KeywordAnalyzerProvider extends AbstractIndexAnalyzerProvider<KeywordAnalyzer> {
8,097
import org.elasticsearch.util.inject.Inject; import org.elasticsearch.util.inject.assistedinject.Assisted; import org.elasticsearch.util.lucene.Lucene; import org.elasticsearch.util.settings.Settings; import java.util.Set; <BUG>public class CzechAnalyzerProvider extends AbstractAnalyzerProvider<CzechAnalyzer> { </BUG> private final Set<?> stopWords; private final CzechAnalyzer analyzer; @Inject public CzechAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
public class CzechAnalyzerProvider extends AbstractIndexAnalyzerProvider<CzechAnalyzer> {
8,098
import org.elasticsearch.util.inject.Inject; import org.elasticsearch.util.inject.assistedinject.Assisted; import org.elasticsearch.util.lucene.Lucene; import org.elasticsearch.util.settings.Settings; import java.util.Set; <BUG>public class ArabicAnalyzerProvider extends AbstractAnalyzerProvider<ArabicAnalyzer> { </BUG> private final Set<String> stopWords; private final ArabicAnalyzer arabicAnalyzer; @Inject public ArabicAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
public class ArabicAnalyzerProvider extends AbstractIndexAnalyzerProvider<ArabicAnalyzer> {
8,099
import org.elasticsearch.util.inject.Inject; import org.elasticsearch.util.inject.assistedinject.Assisted; import org.elasticsearch.util.lucene.Lucene; import org.elasticsearch.util.settings.Settings; import java.util.Set; <BUG>public class CjkAnalyzerProvider extends AbstractAnalyzerProvider<CJKAnalyzer> { </BUG> private final Set<?> stopWords; private final CJKAnalyzer analyzer; @Inject public CjkAnalyzerProvider(Index index, @IndexSettings Settings indexSettings, @Assisted String name, @Assisted Settings settings) {
public class CjkAnalyzerProvider extends AbstractIndexAnalyzerProvider<CJKAnalyzer> {
8,100
Class<? extends TokenFilterFactory> type = tokenFilterSettings.getAsClass("type", null, "org.elasticsearch.index.analysis.", "TokenFilterFactory"); if (type == null) { throw new IllegalArgumentException("Token Filter [" + tokenFilterName + "] must have a type associated with it"); } tokenFilterBinder.addBinding(tokenFilterName).toProvider(FactoryProvider.newFactory(TokenFilterFactoryFactory.class, type)).in(Scopes.SINGLETON); <BUG>} for (AnalysisBinderProcessor processor : processors) { processor.processTokenFilters(tokenFilterBinder, tokenFiltersSettings); </BUG> }
AnalysisBinderProcessor.TokenFiltersBindings tokenFiltersBindings = new AnalysisBinderProcessor.TokenFiltersBindings(tokenFilterBinder, tokenFiltersSettings); processor.processTokenFilters(tokenFiltersBindings);