id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
7,401
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;
7,402
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;
7,403
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"),
7,404
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]
7,405
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) {
7,406
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;
7,407
import static com.yahoo.sketches.quantiles.PreambleUtil.ORDERED_FLAG_MASK; import static com.yahoo.sketches.quantiles.PreambleUtil.READ_ONLY_FLAG_MASK; import static com.yahoo.sketches.quantiles.PreambleUtil.extractFamilyID;</BUG> import static com.yahoo.sketches.quantiles.PreambleUtil.extractFlags; import static com.yahoo.sketches.quantiles.PreambleUtil.extractK; <BUG>import static com.yahoo.sketches.quantiles.PreambleUtil.extractMaxDouble; import static com.yahoo.sketches.quantiles.PreambleUtil.extractMinDouble;</BUG> import static com.yahoo.sketches.quantiles.PreambleUtil.extractN; import static com.yahoo.sketches.quantiles.PreambleUtil.extractPreLongs; import static com.yahoo.sketches.quantiles.PreambleUtil.extractSerVer;
import static com.yahoo.sketches.quantiles.PreambleUtil.PREAMBLE_LONGS_BYTE; import static com.yahoo.sketches.quantiles.PreambleUtil.SER_VER_BYTE; import static com.yahoo.sketches.quantiles.PreambleUtil.extractFamilyID;
7,408
checkDirectMemCapacity(k, n, memCap); checkCompact(serVer, flags); checkEmptyAndN(empty, n); final DirectDoublesSketch dds = new DirectDoublesSketch(k); dds.mem_ = srcMem; <BUG>dds.memObj_ = memObj; dds.memAdd_ = memAdd;</BUG> return dds; } @Override
[DELETED]
7,409
final double maxValue = getMaxValue(); final double minValue = getMinValue(); if (dataItem > maxValue) { putMaxValue(dataItem); } if (dataItem < minValue) { putMinValue(dataItem); } int bbCount = getBaseBufferCount(); <BUG>insertIntoBaseBuffer(memObj_, memAdd_, bbCount++, dataItem); final long newN = getN() + 1; insertFlags(memObj_, memAdd_, 0); //not compact, not ordered, not empty if (bbCount == 2 * k_) { //Propagate</BUG> final int curCombBufItemCap = getCombinedBufferItemCapacity(); //K, prev N, Direct case
mem_.putDouble(COMBINED_BUFFER + bbCount * Double.BYTES, dataItem); bbCount++; mem_.putByte(FLAGS_BYTE, (byte) 0); //not compact, not ordered, not empty if (bbCount == 2 * k_) { //Propagate
7,410
final int curCombBufItemCap = getCombinedBufferItemCapacity(); //K, prev N, Direct case final int curUsedCap = DoublesUpdateImpl.getRequiredItemCapacity(k_, getN()); final int itemSpaceNeeded = DoublesUpdateImpl.getRequiredItemCapacity(k_, newN); if (itemSpaceNeeded > curCombBufItemCap) { mem_ = growCombinedMemBuffer(mem_, itemSpaceNeeded); <BUG>memObj_ = mem_.array(); //may be null memAdd_ = mem_.getCumulativeOffset(0L);</BUG> } if (itemSpaceNeeded > curUsedCap) { //clear out the next level mem_.clear(curUsedCap << 3, (itemSpaceNeeded - curUsedCap) << 3);
[DELETED]
7,411
import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.List; @Path("/speakers") <BUG>@Api(description = "Rooms REST Endpoint") </BUG> @RequestScoped @Produces("application/json") @Consumes("application/json")
@Api(description = "Speakers REST Endpoint")
7,412
</BUG> @POST public Response add(Speaker speaker) { Speaker created = speakerRepository.create(speaker); <BUG>return Response.created(URI.create("/" + created.getId())) .entity(created) .build();</BUG> } @GET
@Consumes("application/json") public class SpeakerEndpoint { @Inject private SpeakerRepository speakerRepository; @Context private UriInfo uriInfo; return Response.created(URI.create("/" + created.getId())).entity(created).build();
7,413
@GET @Path("/{id}") public Response retrieve(@PathParam("id") String id, @DefaultValue("false") @QueryParam("expand") boolean expand) { Speaker speaker = speakerRepository.findById(id); if (speaker != null) { <BUG>speaker.addLink("self", uriInfo.getAbsolutePath().resolve(speaker.getId())); </BUG> if (expand) { for (AcceptedTalk acceptedTalk : speaker.getAcceptedTalks()) { acceptedTalk.addLink("self", uriInfo.getAbsolutePath().resolve(acceptedTalk.getId()));
speaker.addLink("self", uriInfo.getAbsolutePathBuilder().path(speaker.getId()).build());
7,414
package org.agoncal.application.conference.venue.rest; import io.swagger.annotations.Api; <BUG>import org.agoncal.application.conference.venue.resource.RoomResource; </BUG> import org.agoncal.application.conference.venue.repository.RoomRepository; import javax.enterprise.context.RequestScoped; import javax.inject.Inject;
import org.agoncal.application.conference.venue.domain.Room;
7,415
import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import java.net.URI; import java.util.List; <BUG>@Path("/speakers") @Api(description = "Rooms REST Endpoint") </BUG> @RequestScoped
@Path("/talks") @Api(description = "Talks REST Endpoint")
7,416
@Consumes("application/json") public class TalkEndpoint { @Inject private TalkRepository talkRepository; @Context <BUG>UriInfo uriInfo; </BUG> @POST public Response add(Talk talk) { Talk created = talkRepository.create(talk);
private UriInfo uriInfo;
7,417
@GET @Path("/{id}") public Response retrieve(@PathParam("id") String id) { Talk talk = talkRepository.findById(id); if (talk != null) { <BUG>talk.addLink("self", uriInfo.getAbsolutePath().resolve(talk.getId())); </BUG> return Response.ok(talk).build(); } else return Response.status(Response.Status.NOT_FOUND).build();
talk.addLink("self", uriInfo.getAbsolutePathBuilder().path(talk.getId()).build());
7,418
package org.agoncal.application.conference.venue.rest; <BUG>import org.agoncal.application.conference.venue.resource.RoomResource; </BUG> import org.agoncal.application.conference.venue.repository.RoomRepository; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.container.test.api.RunAsClient;
import org.agoncal.application.conference.venue.domain.Room;
7,419
import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE; import static org.junit.Assert.assertEquals; @RunWith(Arquillian.class) @RunAsClient public class RoomEndpointTest { <BUG>private static final RoomResource TEST_ROOM = new RoomResource("Metroxx", "Metropolis"); private static String roomId;</BUG> private Client client; private WebTarget webTarget; @ArquillianResource
private static final Room TEST_ROOM = new Room("Metroxx", "Metropolis"); private static String roomId;
7,420
@Deployment(testable = false) public static WebArchive createDeployment() { File[] files = Maven.resolver().loadPomFromFile("pom.xml") .importRuntimeDependencies().resolve().withTransitivity().asFile(); return ShrinkWrap.create(WebArchive.class) <BUG>.addClasses(RoomResource.class, RoomEndpoint.class, RoomRepository.class, Application.class) .addAsLibraries(files);</BUG> } @Before public void initWebTarget() {
.addClasses(Room.class, RoomEndpoint.class, RoomRepository.class, Application.class) .addAsLibraries(files);
7,421
package org.agoncal.application.conference.venue.repository; <BUG>import org.agoncal.application.conference.venue.resource.RoomResource; </BUG> import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; import java.util.*;
import org.agoncal.application.conference.venue.domain.Room;
7,422
return htmlAsPdf(content, encoding, null, null); } public static NSData htmlAsPdf(String content, String encoding, String urlPrefix) { return htmlAsPdf(content, encoding, urlPrefix, null); } <BUG>public static NSData htmlAsPdf(String html, String encoding, String urlPrefix, NSDictionary<String, Object> config) { NSMutableDictionary<String, Object> _config = config.mutableClone(); if (_config == null) _config = new NSMutableDictionary<String, Object>();</BUG> PDFBuilder builder = PDFBuilderFactory.newBuilder((String) _config.removeObjectForKey("engine"));
NSMutableDictionary<String, Object> _config = config == null ? new NSMutableDictionary<String, Object>() : config.mutableClone();
7,423
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.*;
7,424
.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);
7,425
</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) {
7,426
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)
7,427
.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))
7,428
.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))
7,429
@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;
7,430
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; }
7,431
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
7,432
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.*;
7,433
.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))
7,434
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) -> {
7,435
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);
7,436
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);
7,437
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() + "\"");
7,438
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() + "\"");
7,439
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
7,440
.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")
7,441
import ml.puredark.hviewer.ui.activities.BaseActivity; import ml.puredark.hviewer.ui.dataproviders.ListDataProvider; import ml.puredark.hviewer.ui.fragments.SettingFragment; import ml.puredark.hviewer.ui.listeners.OnItemLongClickListener; import ml.puredark.hviewer.utils.SharedPreferencesUtil; <BUG>import static android.webkit.WebSettings.LOAD_CACHE_ELSE_NETWORK; public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {</BUG> private BaseActivity activity; private Site site; private ListDataProvider mProvider;
import static ml.puredark.hviewer.R.id.container; public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {
7,442
final PictureViewHolder viewHolder = new PictureViewHolder(view); if (pictures != null && position < pictures.size()) { final Picture picture = pictures.get(getPicturePostion(position)); if (picture.pic != null) { loadImage(container.getContext(), picture, viewHolder); <BUG>} else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null && site.extraRule.pictureUrl != null) { getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);</BUG> } else if (site.picUrlSelector != null) { getPictureUrl(container.getContext(), viewHolder, picture, site, site.picUrlSelector, null); } else {
} else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null) { if(site.extraRule.pictureRule != null && site.extraRule.pictureRule.url != null) getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureRule.url, site.extraRule.pictureRule.highRes); else if(site.extraRule.pictureUrl != null) getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);
7,443
import java.util.regex.Pattern; import butterknife.BindView; import butterknife.ButterKnife; import ml.puredark.hviewer.R; import ml.puredark.hviewer.beans.Category; <BUG>import ml.puredark.hviewer.beans.CommentRule; import ml.puredark.hviewer.beans.Rule;</BUG> import ml.puredark.hviewer.beans.Selector; import ml.puredark.hviewer.beans.Site; import ml.puredark.hviewer.ui.adapters.CategoryInputAdapter;
import ml.puredark.hviewer.beans.PictureRule; import ml.puredark.hviewer.beans.Rule;
7,444
inputGalleryRulePictureUrlReplacement.setText(site.galleryRule.pictureUrl.replacement); } if (site.galleryRule.pictureHighRes != null) { inputGalleryRulePictureHighResSelector.setText(joinSelector(site.galleryRule.pictureHighRes)); inputGalleryRulePictureHighResRegex.setText(site.galleryRule.pictureHighRes.regex); <BUG>inputGalleryRulePictureHighResReplacement.setText(site.galleryRule.pictureHighRes.replacement); }</BUG> if (site.galleryRule.commentRule != null) { if (site.galleryRule.commentRule.item != null) { inputGalleryRuleCommentItemSelector.setText(joinSelector(site.galleryRule.commentRule.item));
[DELETED]
7,445
inputExtraRuleCommentDatetimeReplacement.setText(site.extraRule.commentDatetime.replacement); } if (site.extraRule.commentContent != null) { inputExtraRuleCommentContentSelector.setText(joinSelector(site.extraRule.commentContent)); inputExtraRuleCommentContentRegex.setText(site.extraRule.commentContent.regex); <BUG>inputExtraRuleCommentContentReplacement.setText(site.extraRule.commentContent.replacement); }</BUG> } } }
[DELETED]
7,446
lastSite.galleryRule.cover = loadSelector(inputGalleryRuleCoverSelector, inputGalleryRuleCoverRegex, inputGalleryRuleCoverReplacement); lastSite.galleryRule.category = loadSelector(inputGalleryRuleCategorySelector, inputGalleryRuleCategoryRegex, inputGalleryRuleCategoryReplacement); lastSite.galleryRule.datetime = loadSelector(inputGalleryRuleDatetimeSelector, inputGalleryRuleDatetimeRegex, inputGalleryRuleDatetimeReplacement); lastSite.galleryRule.rating = loadSelector(inputGalleryRuleRatingSelector, inputGalleryRuleRatingRegex, inputGalleryRuleRatingReplacement); lastSite.galleryRule.description = loadSelector(inputGalleryRuleDescriptionSelector, inputGalleryRuleDescriptionRegex, inputGalleryRuleDescriptionReplacement); <BUG>lastSite.galleryRule.tags = loadSelector(inputGalleryRuleTagsSelector, inputGalleryRuleTagsRegex, inputGalleryRuleTagsReplacement); lastSite.galleryRule.pictureThumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement); lastSite.galleryRule.pictureUrl = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement); lastSite.galleryRule.pictureHighRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement); lastSite.galleryRule.commentRule = new CommentRule(); lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);</BUG> lastSite.galleryRule.commentRule.avatar = loadSelector(inputGalleryRuleCommentAvatarSelector, inputGalleryRuleCommentAvatarRegex, inputGalleryRuleCommentAvatarReplacement);
lastSite.galleryRule.pictureRule = (lastSite.galleryRule.pictureRule == null) ? new PictureRule() : lastSite.galleryRule.pictureRule; lastSite.galleryRule.pictureRule.thumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement); lastSite.galleryRule.pictureRule.url = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement); lastSite.galleryRule.pictureRule.highRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement); lastSite.galleryRule.commentRule = (lastSite.galleryRule.commentRule == null) ? new CommentRule() : lastSite.galleryRule.commentRule; lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);
7,447
lastSite.extraRule.cover = loadSelector(inputExtraRuleCoverSelector, inputExtraRuleCoverRegex, inputExtraRuleCoverReplacement); lastSite.extraRule.category = loadSelector(inputExtraRuleCategorySelector, inputExtraRuleCategoryRegex, inputExtraRuleCategoryReplacement); lastSite.extraRule.datetime = loadSelector(inputExtraRuleDatetimeSelector, inputExtraRuleDatetimeRegex, inputExtraRuleDatetimeReplacement); lastSite.extraRule.rating = loadSelector(inputExtraRuleRatingSelector, inputExtraRuleRatingRegex, inputExtraRuleRatingReplacement); lastSite.extraRule.description = loadSelector(inputExtraRuleDescriptionSelector, inputExtraRuleDescriptionRegex, inputExtraRuleDescriptionReplacement); <BUG>lastSite.extraRule.tags = loadSelector(inputExtraRuleTagsSelector, inputExtraRuleTagsRegex, inputExtraRuleTagsReplacement); lastSite.extraRule.pictureThumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement); lastSite.extraRule.pictureUrl = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement); lastSite.extraRule.pictureHighRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement); lastSite.extraRule.commentRule = new CommentRule(); lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);</BUG> lastSite.extraRule.commentRule.avatar = loadSelector(inputExtraRuleCommentAvatarSelector, inputExtraRuleCommentAvatarRegex, inputExtraRuleCommentAvatarReplacement);
lastSite.extraRule.pictureRule = (lastSite.extraRule.pictureRule == null) ? new PictureRule() : lastSite.extraRule.pictureRule; lastSite.extraRule.pictureRule.thumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement); lastSite.extraRule.pictureRule.url = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement); lastSite.extraRule.pictureRule.highRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement); lastSite.extraRule.commentRule = (lastSite.extraRule.commentRule == null) ? new CommentRule() : lastSite.extraRule.commentRule; lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);
7,448
notifyItemChanged(position); if (mItemClickListener != null) mItemClickListener.onItemClick(v, position); } }); <BUG>if (tag.selected) label.getChildAt(0).setBackgroundResource(R.color.colorPrimary); else label.getChildAt(0).setBackgroundResource(R.color.dimgray);</BUG> }
[DELETED]
7,449
loadPicture(picture, task, null, true); } else if (!TextUtils.isEmpty(picture.pic) && !highRes) { picture.retries = 0; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) <BUG>&& task.collection.site.extraRule != null && task.collection.site.extraRule.pictureUrl != null) { </BUG> getPictureUrl(picture, task, task.collection.site.extraRule.pictureUrl, task.collection.site.extraRule.pictureHighRes);
&& task.collection.site.extraRule != null) { if(task.collection.site.extraRule.pictureRule != null && task.collection.site.extraRule.pictureRule.url != null) getPictureUrl(picture, task, task.collection.site.extraRule.pictureRule.url, task.collection.site.extraRule.pictureRule.highRes); else if(task.collection.site.extraRule.pictureUrl != null)
7,450
if (Picture.hasPicPosfix(picture.url)) { picture.pic = picture.url; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_JS_NEEDED_ALL)) { <BUG>new Handler(Looper.getMainLooper()).post(()->{ </BUG> WebView webView = new WebView(HViewerApplication.mContext); WebSettings mWebSettings = webView.getSettings(); mWebSettings.setJavaScriptEnabled(true);
new Handler(Looper.getMainLooper()).post(() -> {
7,451
TraitableBean.TRAITSET_FIELD_NAME, Type.getDescriptor( Map.class ) ); mv.visitMethodInsn( INVOKEINTERFACE, "java/io/ObjectOutput", "writeObject", <BUG>"(Ljava/lang/Object;)V" ); mv.visitVarInsn( ALOAD, 1 );</BUG> mv.visitVarInsn( ALOAD, 0 ); mv.visitFieldInsn( Opcodes.GETFIELD, BuildUtils.getInternalType( classDef.getClassName() ),
if ( classDef.isFullTraiting() ) { mv.visitVarInsn( ALOAD, 1 );
7,452
TraitableBean.FIELDTMS_FIELD_NAME, Type.getDescriptor( TraitFieldTMS.class ) ); mv.visitMethodInsn( INVOKEINTERFACE, "java/io/ObjectOutput", "writeObject", <BUG>"(Ljava/lang/Object;)V" ); }</BUG> mv.visitInsn(RETURN); mv.visitMaxs( 0, 0 ); mv.visitEnd();
} }
7,453
"()Ljava/lang/Object;"); mv.visitTypeInsn( CHECKCAST, "java/util/Map" ); mv.visitFieldInsn( Opcodes.PUTFIELD, BuildUtils.getInternalType( classDef.getClassName() ), TraitableBean.TRAITSET_FIELD_NAME, <BUG>Type.getDescriptor( Map.class ) ); mv.visitVarInsn( ALOAD, 0 );</BUG> mv.visitVarInsn( ALOAD, 1 ); mv.visitMethodInsn( INVOKEINTERFACE, "java/io/ObjectInput",
TraitableBean.MAP_FIELD_NAME, mv.visitVarInsn( ALOAD, 0 );
7,454
import java.io.Serializable; import org.drools.compiler.Person; import org.drools.core.SessionConfiguration; import org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession; import org.drools.core.command.impl.FireAllRulesInterceptor; <BUG>import org.drools.core.command.impl.LoggingInterceptor; import org.drools.persistence.SingleSessionCommandService;</BUG> import org.drools.persistence.util.PersistenceUtil; import org.junit.After; import org.junit.Before;
import org.drools.core.factmodel.traits.Traitable; import org.drools.persistence.SingleSessionCommandService;
7,455
final ItemStack first = itemsCurrentlyNeeded.get(0); if (isInHut(first)) { return NEEDS_ITEM; } <BUG>requestWithoutSpam(first.getDisplayName()); </BUG> } return NEEDS_ITEM; }
requestWithoutSpam(first.stackSize + " " + first.getDisplayName());
7,456
alreadyKept.put(tempStorage, shouldKeep.get(tempStorage)); final int dump = tempStorage.getAmount() + amountKept - shouldKeep.get(tempStorage); return new ItemStack(tempStorage.getItem(), dump, tempStorage.getDamageValue()); } protected boolean checkOrRequestItems(@Nullable final ItemStack... items) <BUG>{ if (items == null)</BUG> { return false; }
return checkOrRequestItems(true, items); protected boolean checkOrRequestItems(final boolean useItemDamage, @Nullable final ItemStack... items) if (items == null)
7,457
import java.util.Map; public class BuildingBuilder extends AbstractBuildingWorker { public static final int MAX_BUILDING_LEVEL = 5; private static final String BUILDER = "Builder"; <BUG>private static final String TAG_RESOURCE_LIST = "resources"; private static final String TAG_AMOUNT = "amount"; private HashMap<Block, Integer> neededResources = new HashMap<>(); </BUG> public BuildingBuilder(final Colony c, final BlockPos l)
private static final String TAG_RESOURCE_LIST = "resourcesItem"; private HashMap<String, ItemStack> neededResources = new HashMap<>();
7,458
{ super.readFromNBT(compound); final NBTTagList neededResTagList = compound.getTagList(TAG_RESOURCE_LIST, Constants.NBT.TAG_COMPOUND); for (int i = 0; i < neededResTagList.tagCount(); ++i) { <BUG>final NBTTagCompound neededRes = neededResTagList.getCompoundTagAt(i); final IBlockState state = NBTUtil.readBlockState(neededRes); final int amount = neededRes.getInteger(TAG_AMOUNT); neededResources.put(state.getBlock(), amount);</BUG> }
public static final int MAX_BUILDING_LEVEL = 5; private static final String BUILDER = "Builder"; private static final String TAG_RESOURCE_LIST = "resourcesItem"; private HashMap<String, ItemStack> neededResources = new HashMap<>(); public BuildingBuilder(final Colony c, final BlockPos l) super(c, l);
7,459
materialStore.destroy(); } } public TileEntityColonyBuilding getTileEntity() { <BUG>if (tileEntity == null && colony.getWorld().getBlockState(location).getBlock() != null) </BUG> { final TileEntity te = getColony().getWorld().getTileEntity(location); if (te instanceof TileEntityColonyBuilding)
if ((tileEntity == null || tileEntity.isInvalid()) && colony.getWorld().getBlockState(location).getBlock() != null)
7,460
} else { return isOrSubOf(objectClass, typeClass); } } public static Object simpleTypeConvert(Object obj, String type, String format, Locale locale, boolean noTypeFail) throws GeneralException { <BUG>return simpleTypeConvert(obj, type, format, UtilDateTime.getDefaultTimeZone(), locale, noTypeFail); </BUG> } public static Object simpleTypeConvert(Object obj, String type, String format, TimeZone timeZone, Locale locale, boolean noTypeFail) throws GeneralException { if (obj == null) {
return simpleTypeConvert(obj, type, format, null, locale, noTypeFail);
7,461
throw new GeneralException("Could not convert " + str + " to " + type + ": ", e); } } else if ("Double".equals(type) || "java.lang.Double".equals(type)) { str = StringUtil.removeSpaces(str); try { <BUG>NumberFormat nf = locale == null ? NumberFormat.getNumberInstance() : NumberFormat.getNumberInstance(locale); Number tempNum = nf.parse(str);</BUG> return Double.valueOf(tempNum.doubleValue()); } catch (ParseException e) { throw new GeneralException("Could not convert " + str + " to " + type + ": ", e);
NumberFormat nf = NumberFormat.getNumberInstance(locale); Number tempNum = nf.parse(str);
7,462
throw new GeneralException("Could not convert " + str + " to " + type + ": ", e); } } else if ("Float".equals(type) || "java.lang.Float".equals(type)) { str = StringUtil.removeSpaces(str); try { <BUG>NumberFormat nf = locale == null ? NumberFormat.getNumberInstance() : NumberFormat.getNumberInstance(locale); Number tempNum = nf.parse(str);</BUG> return Float.valueOf(tempNum.floatValue()); } catch (ParseException e) { throw new GeneralException("Could not convert " + str + " to " + type + ": ", e);
} else if ("Double".equals(type) || "java.lang.Double".equals(type)) { NumberFormat nf = NumberFormat.getNumberInstance(locale); Number tempNum = nf.parse(str); return Double.valueOf(tempNum.doubleValue());
7,463
if (timeSplit.length > 1 && timeSplit[1].length() < 3) { str = str + "000".substring(timeSplit[1].length()); } } } else { <BUG>df = UtilDateTime.toDateTimeFormat(format, timeZone, null); </BUG> } try { Date fieldDate = df.parse(str);
df = UtilDateTime.toDateTimeFormat(format, timeZone, locale);
7,464
boolean addGuestPermissions = true; byte[] byteArray = context.getZipReader().getEntryAsByteArray( _ZIP_FOLDER + entry.getName()); DLFileEntry existingEntry = null; try { <BUG>DLFolderUtil.findByPrimaryKey(folderId.longValue()); if (mergeData) {</BUG> existingEntry = DLFileEntryFinderUtil.findByUuid_G( entry.getUuid(), context.getGroupId()); if (existingEntry == null) {
DLFolderUtil.findByPrimaryKey(folderId); if (mergeData) {
7,465
protected void importFolder( PortletDataContext context, boolean mergeData, Map folderPKs, DLFolder folder) throws Exception { long userId = context.getUserId(folder.getUserUuid()); <BUG>long plid = context.getPlid(); Long parentFolderId = (Long)folderPKs.get( new Long(folder.getParentFolderId())); if (parentFolderId == null) { parentFolderId = new Long(folder.getParentFolderId()); }</BUG> boolean addCommunityPermissions = true;
long parentFolderId = MapUtil.getLong( folderPKs, folder.getParentFolderId(), folder.getParentFolderId());
7,466
if (mergeData) { existingFolder = DLFolderUtil.fetchByUUID_G( folder.getUuid(), context.getGroupId()); if (existingFolder == null) { existingFolder = DLFolderLocalServiceUtil.addFolder( <BUG>folder.getUuid(), userId, plid, parentFolderId.longValue(), folder.getName(), folder.getDescription(), addCommunityPermissions, addGuestPermissions);</BUG> }
folder.getUuid(), userId, plid, parentFolderId, folder.getName(), folder.getDescription(), addCommunityPermissions, addGuestPermissions);
7,467
String name = (String)folderPKs.get(rank.getName()); if (name == null) { name = rank.getName(); } try { <BUG>DLFolderUtil.findByPrimaryKey(folderId.longValue()); DLFileRankLocalServiceUtil.updateFileRank( context.getGroupId(), context.getCompanyId(), userId, folderId.longValue(), name); }</BUG> catch (NoSuchFolderException nsfe) {
DLFolderUtil.findByPrimaryKey(folderId); context.getGroupId(), context.getCompanyId(), userId, folderId,
7,468
DLFileShortcut existingShortcut = DLFileShortcutFinderUtil.findByUuid_G( shortcut.getUuid(), context.getGroupId()); if (existingShortcut == null) { DLFileShortcutLocalServiceUtil.addFileShortcut( <BUG>shortcut.getUuid(), userId, folderId.longValue(), toFolderId.longValue(), toName, addCommunityPermissions, addGuestPermissions);</BUG> }
shortcut.getUuid(), userId, folderId, toFolderId, toName, addCommunityPermissions, addGuestPermissions);
7,469
toFolderId.longValue(), toName, addCommunityPermissions, addGuestPermissions);</BUG> } else { DLFileShortcutLocalServiceUtil.updateFileShortcut( <BUG>userId, existingShortcut.getFileShortcutId(), folderId.longValue(), toFolderId.longValue(), toName); }</BUG> }
DLFileShortcut existingShortcut = DLFileShortcutFinderUtil.findByUuid_G( shortcut.getUuid(), context.getGroupId()); if (existingShortcut == null) { DLFileShortcutLocalServiceUtil.addFileShortcut( shortcut.getUuid(), userId, folderId, toFolderId, toName, addCommunityPermissions, addGuestPermissions); userId, existingShortcut.getFileShortcutId(), folderId, toFolderId, toName);
7,470
protected void importFolder( PortletDataContext context, boolean mergeData, Map folderPKs, BookmarksFolder folder) throws Exception { long userId = context.getUserId(folder.getUserUuid()); <BUG>long plid = context.getPlid(); Long parentFolderId = (Long)folderPKs.get( new Long(folder.getParentFolderId())); if (parentFolderId == null) { parentFolderId = new Long(folder.getParentFolderId()); }</BUG> boolean addCommunityPermissions = true;
long parentFolderId = MapUtil.getLong( folderPKs, folder.getParentFolderId(), folder.getParentFolderId());
7,471
if (mergeData) { existingFolder = BookmarksFolderUtil.fetchByUUID_G( folder.getUuid(), context.getGroupId()); if (existingFolder == null) { existingFolder = BookmarksFolderLocalServiceUtil.addFolder( <BUG>folder.getUuid(), userId, plid, parentFolderId.longValue(), folder.getName(), folder.getDescription(), addCommunityPermissions, addGuestPermissions);</BUG> }
folder.getUuid(), userId, plid, parentFolderId, folder.getName(), folder.getDescription(), addCommunityPermissions, addGuestPermissions);
7,472
addGuestPermissions);</BUG> } else { existingFolder = BookmarksFolderLocalServiceUtil.updateFolder( <BUG>existingFolder.getFolderId(), parentFolderId.longValue(), folder.getName(), folder.getDescription(), false); </BUG> }
if (mergeData) { existingFolder = BookmarksFolderUtil.fetchByUUID_G( folder.getUuid(), context.getGroupId()); if (existingFolder == null) { existingFolder = BookmarksFolderLocalServiceUtil.addFolder( folder.getUuid(), userId, plid, parentFolderId, folder.getName(), folder.getDescription(), addCommunityPermissions, addGuestPermissions); existingFolder.getFolderId(), parentFolderId, folder.getName(), folder.getDescription(), false);
7,473
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.*;
7,474
.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);
7,475
</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) {
7,476
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)
7,477
.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))
7,478
.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))
7,479
@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;
7,480
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; }
7,481
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
7,482
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.*;
7,483
.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))
7,484
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) -> {
7,485
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);
7,486
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);
7,487
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() + "\"");
7,488
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() + "\"");
7,489
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
7,490
.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")
7,491
chart.addYAxisLabels(AxisLabelsFactory.newAxisLabels(labels)); chart.addXAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, max)); chart.setBarWidth(BarChart.AUTO_RESIZE); chart.setSize(600, 500); chart.setHorizontal(true); <BUG>chart.setTitle("Total Evaluations by User"); showChartImg(resp, chart.toURLString()); }</BUG> private List<Entry<String, Integer>> sortEntries(Collection<Entry<String, Integer>> entries) { List<Entry<String, Integer>> result = new ArrayList<Entry<String, Integer>>(entries);
chart.setDataEncoding(DataEncoding.TEXT); return chart; }
7,492
checkEvaluationsEqual(eval4, foundissueProto.getEvaluations(0)); checkEvaluationsEqual(eval5, foundissueProto.getEvaluations(1)); } public void testGetRecentEvaluationsNoneFound() throws Exception { DbIssue issue = createDbIssue("fad", persistenceHelper); <BUG>DbEvaluation eval1 = createEvaluation(issue, "someone", 100); DbEvaluation eval2 = createEvaluation(issue, "someone", 200); DbEvaluation eval3 = createEvaluation(issue, "someone", 300); issue.addEvaluations(eval1, eval2, eval3);</BUG> getPersistenceManager().makePersistent(issue);
[DELETED]
7,493
public int read() throws IOException { return inputStream.read(); } }); } <BUG>} protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {</BUG> DbUser user; Query query = getPersistenceManager().newQuery("select from " + persistenceHelper.getDbUserClass().getName() + " where openid == :myopenid");
@SuppressWarnings({"unchecked"}) protected DbEvaluation createEvaluation(DbIssue issue, String who, long when) {
7,494
eval.setComment("my comment"); eval.setDesignation("MUST_FIX"); eval.setIssue(issue); eval.setWhen(when); eval.setWho(user.createKeyObject()); <BUG>eval.setEmail(who); return eval;</BUG> } protected PersistenceManager getPersistenceManager() { return testHelper.getPersistenceManager();
issue.addEvaluation(eval); return eval;
7,495
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 {
7,496
break; case "LOCATE": out.append("CHARINDEX"); break; case "MOD": <BUG>break; default:</BUG> super.appendFunction(functionExpression); } }
case "TRIM": out.append("LTRIM(RTRIM"); default:
7,497
return false; } if (node.getOperandCount() > 1) { return true; } <BUG>if (node.getType() == Expression.OBJ_PATH || node.getType() == Expression.DB_PATH) { return false;</BUG> } return true; }
if (node.getType() == Expression.OBJ_PATH || node.getType() == Expression.DB_PATH || node.getType() == Expression.ASTERISK) {
7,498
import org.apache.cayenne.dba.DbAdapter; import org.apache.cayenne.dba.QuotingStrategy; import org.apache.cayenne.dba.TypesMapping; import org.apache.cayenne.exp.Expression; import org.apache.cayenne.exp.ExpressionFactory; <BUG>import org.apache.cayenne.exp.Property; import org.apache.cayenne.exp.parser.ASTDbPath;</BUG> import org.apache.cayenne.map.DataMap; import org.apache.cayenne.map.DbAttribute; import org.apache.cayenne.map.DbEntity;
import org.apache.cayenne.exp.TraversalHelper; import org.apache.cayenne.exp.parser.ASTAggregateFunctionCall; import org.apache.cayenne.exp.parser.ASTDbPath;
7,499
JoinStack joinStack; List<ColumnDescriptor> resultColumns; Map<ObjAttribute, ColumnDescriptor> attributeOverrides; Map<ColumnDescriptor, ObjAttribute> defaultAttributesByColumn; boolean suppressingDistinct; <BUG>boolean forcingDistinct; public DefaultSelectTranslator(Query query, DbAdapter adapter, EntityResolver entityResolver) {</BUG> super(query, adapter, entityResolver); } protected JoinStack getJoinStack() {
boolean haveAggregate; List<ColumnDescriptor> groupByColumns; public DefaultSelectTranslator(Query query, DbAdapter adapter, EntityResolver entityResolver) {
7,500
joins.appendJoins(queryBuf); joins.appendQualifier(qualifierBuffer, qualifierBuffer.length() == 0); if (qualifierBuffer.length() > 0) { queryBuf.append(" WHERE "); queryBuf.append(qualifierBuffer); <BUG>} if (orderingBuffer.length() > 0) {</BUG> queryBuf.append(" ORDER BY ").append(orderingBuffer); } if (!isSuppressingDistinct()) {
if(haveAggregate && !groupByColumns.isEmpty()) { queryBuf.append(" GROUP BY "); appendGroupByColumns(queryBuf, groupByColumns); if (orderingBuffer.length() > 0) {