id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
46,501
layoutParams.height = height; imageView.setLayoutParams(layoutParams); int width = this.getResources().getDisplayMetrics().widthPixels; Glide.with(this) .load(img_link) <BUG>.override(width, height) .placeholder(R.mipmap.ntvspor)</BUG> .error(R.mipmap.ntvspor) .into(imageView); new ProgressTask().execute(feed_link);
.fitCenter() .placeholder(R.mipmap.ntvspor)
46,502
layoutParams.height = height; imageView.setLayoutParams(layoutParams); int width = this.getResources().getDisplayMetrics().widthPixels; Glide.with(this) .load(img_link) <BUG>.override(width, height) .placeholder(R.mipmap.aspor) .error(R.mipmap.aspor) </BUG> .into(imageView);
.fitCenter() .placeholder(R.mipmap.trtspor) .error(R.mipmap.trtspor)
46,503
layoutParams.height = height; imageView.setLayoutParams(layoutParams); int width = this.getResources().getDisplayMetrics().widthPixels; Glide.with(this) .load(img_link) <BUG>.override(width, height) .placeholder(R.mipmap.sporx)</BUG> .error(R.mipmap.sporx) .into(imageView); new ProgressTask().execute(feed_link);
.fitCenter() .placeholder(R.mipmap.sporx)
46,504
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.*;
46,505
.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);
46,506
</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) {
46,507
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)
46,508
.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))
46,509
.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))
46,510
@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;
46,511
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; }
46,512
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
46,513
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.*;
46,514
.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))
46,515
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) -> {
46,516
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);
46,517
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);
46,518
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() + "\"");
46,519
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() + "\"");
46,520
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
46,521
.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")
46,522
public int getItemCount(); public int getDataSize(); public Integer[] getUniqueIdentifierArray(); public Set<Integer> getUniqueIdentifierSet(); public Integer getOffset(Integer id, Integer type); <BUG>public int getOffset(int index); </BUG> public Set<Integer> getTypes(Integer id); public boolean containsKey(Integer key); public String toString(FieldMap fieldMap);
public int[] getOffsets();
46,523
package net.sf.mpxj.mpp; import java.io.IOException; <BUG>import java.io.InputStream; import java.util.Map;</BUG> import java.util.TreeMap; final class VarMeta9 extends AbstractVarMeta {
import java.util.Arrays; import java.util.Map;
46,524
package net.sf.mpxj.mpp; import java.io.IOException; <BUG>import java.io.InputStream; import java.util.Map;</BUG> import java.util.TreeMap; final class VarMeta12 extends AbstractVarMeta {
import java.util.Arrays; import java.util.Map;
46,525
ph.setLastSaved(summaryInformation.getLastSaveDateTime()); ph.setShortApplicationName(summaryInformation.getApplicationName()); ph.setEditingTime(Integer.valueOf((int) summaryInformation.getEditTime())); ph.setLastPrinted(summaryInformation.getLastPrinted()); ps = new PropertySet(new DocumentInputStream(((DocumentEntry) rootDir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME)))); <BUG>ExtendedDocumentSummaryInformation documentSummaryInformation = new ExtendedDocumentSummaryInformation(ps); ph.setCategory(documentSummaryInformation.getCategory());</BUG> ph.setPresentationFormat(documentSummaryInformation.getPresentationFormat()); ph.setManager(documentSummaryInformation.getManager()); ph.setCompany(documentSummaryInformation.getCompany());
DocumentSummaryInformation documentSummaryInformation = new DocumentSummaryInformation(ps); ph.setCategory(documentSummaryInformation.getCategory());
46,526
import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.*; import com.google.common.primitives.Ints; import com.google.common.util.concurrent.*; import org.slf4j.Logger; <BUG>import org.slf4j.LoggerFactory; import org.apache.cassandra.cache.AutoSavingCache;</BUG> import org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor; import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor; import org.apache.cassandra.concurrent.NamedThreadFactory;
import io.netty.util.concurrent.FastThreadLocal; import org.apache.cassandra.cache.AutoSavingCache;
46,527
public static final String MBEAN_OBJECT_NAME = "org.apache.cassandra.db:type=CompactionManager"; private static final Logger logger = LoggerFactory.getLogger(CompactionManager.class); public static final CompactionManager instance; public static final int NO_GC = Integer.MIN_VALUE; public static final int GC_ALL = Integer.MAX_VALUE; <BUG>public static final ThreadLocal<Boolean> isCompactionManager = new ThreadLocal<Boolean>() </BUG> { @Override protected Boolean initialValue()
public static final FastThreadLocal<Boolean> isCompactionManager = new FastThreadLocal<Boolean>()
46,528
"yyyy-MM-ddXX", "yyyy-MM-ddXXX" }; private static final String DEFAULT_FORMAT = dateStringPatterns[6]; private static final Pattern timestampPattern = Pattern.compile("^-?\\d+$"); <BUG>private static final ThreadLocal<SimpleDateFormat> FORMATTER = new ThreadLocal<SimpleDateFormat>() </BUG> { protected SimpleDateFormat initialValue() {
private static final FastThreadLocal<SimpleDateFormat> FORMATTER = new FastThreadLocal<SimpleDateFormat>()
46,529
{ return new SimpleDateFormat(DEFAULT_FORMAT); } }; private static final String UTC_FORMAT = dateStringPatterns[40]; <BUG>private static final ThreadLocal<SimpleDateFormat> FORMATTER_UTC = new ThreadLocal<SimpleDateFormat>() </BUG> { protected SimpleDateFormat initialValue() {
private static final FastThreadLocal<SimpleDateFormat> FORMATTER_UTC = new FastThreadLocal<SimpleDateFormat>()
46,530
sdf.setTimeZone(TimeZone.getTimeZone("UTC")); return sdf; } }; private static final String TO_JSON_FORMAT = dateStringPatterns[19]; <BUG>private static final ThreadLocal<SimpleDateFormat> FORMATTER_TO_JSON = new ThreadLocal<SimpleDateFormat>() </BUG> { protected SimpleDateFormat initialValue() {
private static final FastThreadLocal<SimpleDateFormat> FORMATTER_TO_JSON = new FastThreadLocal<SimpleDateFormat>()
46,531
package org.apache.cassandra.concurrent; import java.util.concurrent.ThreadFactory; <BUG>import java.util.concurrent.atomic.AtomicInteger; import io.netty.util.concurrent.FastThreadLocal;</BUG> import io.netty.util.concurrent.FastThreadLocalThread; public class NamedThreadFactory implements ThreadFactory {
import com.google.common.annotations.VisibleForTesting; import io.netty.util.concurrent.FastThreadLocal;
46,532
this.threadGroup = threadGroup; } public Thread newThread(Runnable runnable) { String name = id + ':' + n.getAndIncrement(); <BUG>Thread thread = new FastThreadLocalThread(threadGroup, threadLocalDeallocator(runnable), name); thread.setPriority(priority); thread.setDaemon(true);</BUG> if (contextClassLoader != null) thread.setContextClassLoader(contextClassLoader);
Thread thread = createThread(threadGroup, runnable, name, true);
46,533
private static final Logger logger = LoggerFactory.getLogger(RepairRunnable.class); private StorageService storageService; private final int cmd; private final RepairOption options; private final String keyspace; <BUG>private final List<ProgressListener> listeners = new ArrayList<>(); public RepairRunnable(StorageService storageService, int cmd, RepairOption options, String keyspace)</BUG> { this.storageService = storageService; this.cmd = cmd;
private static final AtomicInteger threadCounter = new AtomicInteger(1); public RepairRunnable(StorageService storageService, int cmd, RepairOption options, String keyspace)
46,534
ranges.add(range); neighborRangeList.add(Pair.create(neighbors, ranges)); } private Thread createQueryThread(final int cmd, final UUID sessionId) { <BUG>return new Thread(NamedThreadFactory.threadLocalDeallocator(new WrappedRunnable() </BUG> { public void runMayThrow() throws Exception {
return NamedThreadFactory.createThread(new WrappedRunnable()
46,535
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.spi.TurboFilterList; import ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter; <BUG>import ch.qos.logback.classic.turbo.TurboFilter; public final class ThreadAwareSecurityManager extends SecurityManager</BUG> { static final PermissionCollection noPermissions = new PermissionCollection() {
import io.netty.util.concurrent.FastThreadLocal; public final class ThreadAwareSecurityManager extends SecurityManager
46,536
import java.util.zip.Deflater; import java.util.zip.Inflater; public class DeflateCompressor implements ICompressor { public static final DeflateCompressor instance = new DeflateCompressor(); <BUG>private static final ThreadLocal<byte[]> threadLocalScratchBuffer = new ThreadLocal<byte[]>() </BUG> { @Override protected byte[] initialValue()
private static final FastThreadLocal<byte[]> threadLocalScratchBuffer = new FastThreadLocal<byte[]>()
46,537
protected Deflater initialValue() { return new Deflater(); } }; <BUG>inflater = new ThreadLocal<Inflater>() </BUG> { @Override protected Inflater initialValue()
inflater = new FastThreadLocal<Inflater>()
46,538
package org.apache.cassandra.db.marshal; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; <BUG>import java.nio.charset.CharacterCodingException; import org.apache.cassandra.cql3.Constants;</BUG> import org.apache.cassandra.cql3.Json; import org.apache.cassandra.cql3.CQL3Type; import org.apache.cassandra.cql3.Term;
import io.netty.util.concurrent.FastThreadLocal; import org.apache.cassandra.cql3.Constants;
46,539
import org.apache.cassandra.utils.ByteBufferUtil; public class AsciiType extends AbstractType<String> { public static final AsciiType instance = new AsciiType(); AsciiType() {super(ComparisonType.BYTE_ORDER);} // singleton <BUG>private final ThreadLocal<CharsetEncoder> encoder = new ThreadLocal<CharsetEncoder>() </BUG> { @Override protected CharsetEncoder initialValue()
private final FastThreadLocal<CharsetEncoder> encoder = new FastThreadLocal<CharsetEncoder>()
46,540
while (true) { schedule(); } }; <BUG>Thread scheduler = new Thread(NamedThreadFactory.threadLocalDeallocator(runnable), "REQUEST-SCHEDULER"); </BUG> scheduler.start(); logger.info("Started the RoundRobin Request Scheduler"); }
Thread scheduler = NamedThreadFactory.createThread(runnable, "REQUEST-SCHEDULER");
46,541
logger.info(msg); } finally { versionLatch.countDown(); <BUG>} }; new Thread(NamedThreadFactory.threadLocalDeallocator(r), "HANDSHAKE-" + poolReference.endPoint()).start();</BUG> try {
}, "HANDSHAKE-" + poolReference.endPoint()).start();
46,542
package org.apache.cassandra.index.sasi; import java.util.List; import java.util.Set; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; <BUG>import java.util.concurrent.atomic.AtomicLong; import org.apache.cassandra.concurrent.NamedThreadFactory;</BUG> import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.index.sasi.disk.OnDiskIndexBuilder; import org.apache.cassandra.index.sasi.disk.Token;
import io.netty.util.concurrent.FastThreadLocal; import org.apache.cassandra.concurrent.NamedThreadFactory;
46,543
import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TermIterator extends RangeIterator<Long, Token> { private static final Logger logger = LoggerFactory.getLogger(TermIterator.class); <BUG>private static final ThreadLocal<ExecutorService> SEARCH_EXECUTOR = new ThreadLocal<ExecutorService>() </BUG> { public ExecutorService initialValue() {
private static final FastThreadLocal<ExecutorService> SEARCH_EXECUTOR = new FastThreadLocal<ExecutorService>()
46,544
: Executors.newFixedThreadPool(concurrencyFactor, new ThreadFactory() { public final AtomicInteger count = new AtomicInteger(); public Thread newThread(Runnable task) { <BUG>return new Thread(NamedThreadFactory.threadLocalDeallocator(task), currentThread + "-SEARCH-" + count.incrementAndGet()) {{ setDaemon(true); }}; </BUG> } }); }
return NamedThreadFactory.createThread(task, currentThread + "-SEARCH-" + count.incrementAndGet(), true);
46,545
package org.apache.cassandra.hints; import java.io.IOException; import java.nio.ByteBuffer; import javax.crypto.Cipher; <BUG>import com.google.common.annotations.VisibleForTesting; import org.apache.cassandra.security.EncryptionUtils;</BUG> import org.apache.cassandra.hints.CompressedChecksummedDataInput.Position; import org.apache.cassandra.io.FSReadError; import org.apache.cassandra.io.compress.ICompressor;
import io.netty.util.concurrent.FastThreadLocal; import org.apache.cassandra.security.EncryptionUtils;
46,546
import org.apache.cassandra.io.FSReadError; import org.apache.cassandra.io.compress.ICompressor; import org.apache.cassandra.io.util.ChannelProxy; public class EncryptedChecksummedDataInput extends ChecksummedDataInput { <BUG>private static final ThreadLocal<ByteBuffer> reusableBuffers = new ThreadLocal<ByteBuffer>() </BUG> { protected ByteBuffer initialValue() {
private static final FastThreadLocal<ByteBuffer> reusableBuffers = new FastThreadLocal<ByteBuffer>()
46,547
import java.nio.channels.WritableByteChannel; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.ShortBufferException; <BUG>import com.google.common.base.Preconditions; import org.apache.cassandra.db.commitlog.EncryptedSegment;</BUG> import org.apache.cassandra.io.compress.ICompressor; import org.apache.cassandra.io.util.ChannelProxy; import org.apache.cassandra.io.util.FileDataInput;
import io.netty.util.concurrent.FastThreadLocal; import org.apache.cassandra.db.commitlog.EncryptedSegment;
46,548
import org.apache.cassandra.utils.ByteBufferUtil; public class EncryptionUtils { public static final int COMPRESSED_BLOCK_HEADER_SIZE = 4; public static final int ENCRYPTED_BLOCK_HEADER_SIZE = 8; <BUG>private static final ThreadLocal<ByteBuffer> reusableBuffers = new ThreadLocal<ByteBuffer>() </BUG> { protected ByteBuffer initialValue() {
private static final FastThreadLocal<ByteBuffer> reusableBuffers = new FastThreadLocal<ByteBuffer>()
46,549
{ private static final Logger logger = LoggerFactory.getLogger(StorageService.class); public static final int RING_DELAY = getRingDelay(); // delay after which we assume ring has stablized private final JMXProgressSupport progressSupport = new JMXProgressSupport(this); @Deprecated <BUG>private final LegacyJMXProgressSupport legacyProgressSupport; private static int getRingDelay()</BUG> { String newdelay = System.getProperty("cassandra.ring_delay_ms"); if (newdelay != null)
private static final AtomicInteger threadCounter = new AtomicInteger(1); private static int getRingDelay()
46,550
WindowsTimer.endTimerPeriod(DatabaseDescriptor.getWindowsTimerInterval()); DelayingShutdownHook logbackHook = new DelayingShutdownHook(); logbackHook.setContext((LoggerContext)LoggerFactory.getILoggerFactory()); logbackHook.run(); } <BUG>}), "StorageServiceShutdownHook"); Runtime.getRuntime().addShutdownHook(drainOnShutdown);</BUG> replacing = isReplacing(); if (!Boolean.parseBoolean(System.getProperty("cassandra.start_gossip", "true"))) {
}, "StorageServiceShutdownHook"); Runtime.getRuntime().addShutdownHook(drainOnShutdown);
46,551
public int forceRepairAsync(String keyspace, RepairOption options, boolean legacy) { if (options.getRanges().isEmpty() || Keyspace.open(keyspace).getReplicationStrategy().getReplicationFactor() < 2) return 0; int cmd = nextRepairCommand.incrementAndGet(); <BUG>new Thread(NamedThreadFactory.threadLocalDeallocator(createRepairTask(cmd, keyspace, options, legacy))).start(); return cmd;</BUG> } private FutureTask<Object> createRepairTask(final int cmd, final String keyspace, final RepairOption options, boolean legacy) {
NamedThreadFactory.createThread(createRepairTask(cmd, keyspace, options, legacy), "Repair-Task-" + threadCounter.incrementAndGet()).start(); return cmd;
46,552
import static com.google.common.base.Preconditions.checkNotNull; import static java.lang.annotation.RetentionPolicy.SOURCE; public class GithubLocalDataSource implements GithubDataSource { public static String LOG_TAG = GithubLocalDataSource.class.getSimpleName(); private static final String PREFERENCES_TOKEN = "PREFERENCES_TOKEN"; <BUG>private static final String PREFERENCES_TOKEN_TYPE = "PREFERENCES_TOKEN_TYPE"; @Retention(SOURCE)</BUG> @StringDef({TRENDING_PERIOD_DAILY, TRENDING_PERIOD_WEEKLY, TRENDING_PERIOD_MONTHLY}) public @interface TrendingPeriod {} public static final String TRENDING_PERIOD_DAILY = "daily";
private static final String PREFERENCES_TRENDING_PERIOD = "PREFERENCES_TRENDING_PERIOD"; private static final String PREFERENCES_TRENDING_LANGUAGE = "PREFERENCES_TRENDING_LANGUAGE"; @Retention(SOURCE)
46,553
return true; } public void saveClones(long repositoryId, ResponseClones responseClones) { for (ResponseClones.Clone clone : responseClones.getClones()) { ContentValues contentValues = ClonesContract.ClonesEntry <BUG>.buildContentValues(repositoryId, clone); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); long timeInMilliseconds = 0; try { Date date = df.parse(clone.getTimestamp()); timeInMilliseconds = date.getTime(); } catch (ParseException e) { Log.e(LOG_TAG, e.getMessage(), e); }</BUG> String selection = ClonesContract.ClonesEntry.COLUMN_REPOSITORY_KEY + " = "
String timestamp = clone.getTimestamp(); long timeInMilliseconds = TimeUtils.iso8601ToMilliseconds(timestamp);
46,554
} } public void saveViews(long repositoryId, ResponseViews responseViews) { for (ResponseViews.View view : responseViews.getViews()) { ContentValues contentValues = ViewsContract.ViewsEntry <BUG>.buildContentValues(repositoryId, view); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); long timeInMilliseconds = 0; try { Date date = df.parse(view.getTimestamp()); timeInMilliseconds = date.getTime(); } catch (ParseException e) { Log.e(LOG_TAG, e.getMessage(), e); }</BUG> String selection = ViewsContract.ViewsEntry.COLUMN_REPOSITORY_KEY + " = "
if (cursor != null) { cursor.close(); return true; public void saveClones(long repositoryId, ResponseClones responseClones) { for (ResponseClones.Clone clone : responseClones.getClones()) { ContentValues contentValues = ClonesContract.ClonesEntry .buildContentValues(repositoryId, clone); String timestamp = clone.getTimestamp(); long timeInMilliseconds = TimeUtils.iso8601ToMilliseconds(timestamp); String selection = ClonesContract.ClonesEntry.COLUMN_REPOSITORY_KEY + " = "
46,555
public void saveStargazers(Repository repository, List<ResponseStargazers> responseStargazersList) { for (ResponseStargazers stargazers : responseStargazersList) { if (stargazers != null) { ContentValues contentValues = StargazersContract.Entry <BUG>.buildContentValues(repository.getId(), stargazers); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); long timeInMilliseconds = 0; try { Date date = df.parse(stargazers.getStarredAt()); timeInMilliseconds = date.getTime(); } catch (ParseException e) { Log.e(LOG_TAG, e.getMessage(), e); }</BUG> String selection = StargazersContract.Entry.COLUMN_REPOSITORY_KEY + " = "
String starredAd = stargazers.getStarredAt(); long timeInMilliseconds = TimeUtils.iso8601ToMilliseconds(starredAd);
46,556
import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.net.Uri; import android.provider.BaseColumns; <BUG>import android.util.Log; import com.dmitrymalkovich.android.githubanalytics.data.source.remote.gson.ResponseClones; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale;</BUG> public class ClonesContract {
import com.dmitrymalkovich.android.githubanalytics.util.TimeUtils;
46,557
public static final int COL_ID = 0; public static final int COL_REPOSITORY_KEY = 1; public static final int COL_CLONES_COUNT = 2; public static final int COL_CLONES_UNIQUES = 3; public static final int COL_CLONES_TIMESTAMP = 4; <BUG>public static ContentValues buildContentValues(long repositoryId, ResponseClones.Clone clone) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); long timeInMilliseconds = 0; try { Date date = df.parse(clone.getTimestamp()); timeInMilliseconds = date.getTime(); } catch (ParseException e) { Log.e(LOG_TAG, e.getMessage(), e); }</BUG> ContentValues contentValues = new ContentValues();
String timestamp = clone.getTimestamp(); long timeInMilliseconds = TimeUtils.iso8601ToMilliseconds(timestamp);
46,558
package com.dmitrymalkovich.android.githubanalytics.data.source; import android.database.Cursor; import android.os.AsyncTask; import android.support.annotation.NonNull; <BUG>import com.dmitrymalkovich.android.githubanalytics.data.source.local.GithubLocalDataSource; import com.dmitrymalkovich.android.githubanalytics.data.source.remote.gson.ResponseClones;</BUG> import com.dmitrymalkovich.android.githubanalytics.data.source.remote.gson.ResponseReferrer; import com.dmitrymalkovich.android.githubanalytics.data.source.remote.gson.ResponseStargazers; import com.dmitrymalkovich.android.githubanalytics.data.source.remote.gson.ResponseTrending;
import android.content.Context; import com.dmitrymalkovich.android.githubanalytics.data.source.remote.GithubRemoteDataSource; import com.dmitrymalkovich.android.githubanalytics.data.source.remote.gson.ResponseClones;
46,559
import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.net.Uri; import android.provider.BaseColumns; <BUG>import android.util.Log; import com.dmitrymalkovich.android.githubanalytics.data.source.remote.gson.ResponseStargazers; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale;</BUG> public class StargazersContract {
import com.dmitrymalkovich.android.githubanalytics.util.TimeUtils;
46,560
}; public static final int COL_ID = 0; public static final int COL_REPOSITORY_KEY = 1; public static final int COL_TIMESTAMP = 2; public static ContentValues buildContentValues(long repositoryId, <BUG>ResponseStargazers responseStargazers) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); long timeInMilliseconds = 0; try { Date date = df.parse(responseStargazers.getStarredAt()); timeInMilliseconds = date.getTime(); } catch (ParseException e) { Log.e(LOG_TAG, e.getMessage(), e); }</BUG> ContentValues contentValues = new ContentValues();
String timestamp = responseStargazers.getStarredAt(); long timeInMilliseconds = TimeUtils.iso8601ToMilliseconds(timestamp);
46,561
import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.net.Uri; import android.provider.BaseColumns; <BUG>import android.util.Log; import com.dmitrymalkovich.android.githubanalytics.data.source.remote.gson.ResponseViews; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale;</BUG> public class ViewsContract {
import com.dmitrymalkovich.android.githubanalytics.util.TimeUtils;
46,562
public static final int COL_ID = 0; public static final int COL_REPOSITORY_KEY = 1; public static final int COL_VIEWS_COUNT = 2; public static final int COL_VIEWS_UNIQUES = 3; public static final int COL_VIEWS_TIMESTAMP = 4; <BUG>public static ContentValues buildContentValues(long repositoryId, ResponseViews.View view) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); long timeInMilliseconds = 0; try { Date date = df.parse(view.getTimestamp()); timeInMilliseconds = date.getTime(); } catch (ParseException e) { Log.e(LOG_TAG, e.getMessage(), e); }</BUG> ContentValues contentValues = new ContentValues();
String timestamp = view.getTimestamp(); long timeInMilliseconds = TimeUtils.iso8601ToMilliseconds(timestamp);
46,563
import android.support.annotation.NonNull; import android.support.v4.app.LoaderManager; import android.support.v4.content.Loader; import com.dmitrymalkovich.android.githubanalytics.data.source.GithubDataSource; import com.dmitrymalkovich.android.githubanalytics.data.source.GithubRepository; <BUG>import com.dmitrymalkovich.android.githubanalytics.data.source.LoaderProvider; </BUG> import org.eclipse.egit.github.core.Repository; import java.util.List; import static com.google.common.base.Preconditions.checkNotNull;
import com.dmitrymalkovich.android.githubanalytics.data.source.local.LoaderProvider;
46,564
import android.content.SyncRequest; import android.content.SyncResult; import android.os.Build; import android.os.Bundle; import com.dmitrymalkovich.android.githubanalytics.R; <BUG>import com.dmitrymalkovich.android.githubanalytics.data.source.Injection; </BUG> import com.dmitrymalkovich.android.githubanalytics.data.source.local.GithubLocalDataSource; import com.dmitrymalkovich.android.githubanalytics.data.source.remote.GithubRemoteDataSource; import org.eclipse.egit.github.core.Repository;
import com.dmitrymalkovich.android.githubanalytics.data.source.GithubRepository;
46,565
githubRepository.getRepositoryViewsSync(mostPopularRepository, "day"); githubRepository.getRepositoryClonesSync(mostPopularRepository, "day"); githubRepository.getStargazersSync(mostPopularRepository, "last"); } } <BUG>if (repositoryList.size() > 1) { Repository mostPopularRepository = repositoryList.get(1); </BUG> if (mostPopularRepository != null) {
if (repositories.size() > 1) { Repository mostPopularRepository = repositories.get(1);
46,566
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> {
46,567
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);
46,568
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;
46,569
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]
46,570
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]
46,571
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);
46,572
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);
46,573
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]
46,574
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)
46,575
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(() -> {
46,576
@Override public String toString() { return "desc"; } }; <BUG>public static final SortOrder DEFAULT = DESC; private static final SortOrder PROTOTYPE = DEFAULT; </BUG> @Override public SortOrder readFrom(StreamInput in) throws IOException {
return "asc"; }, DESC { private static final SortOrder PROTOTYPE = ASC;
46,577
GeoDistance geoDistance = GeoDistance.DEFAULT; boolean reverse = false; MultiValueMode sortMode = null; NestedInnerQueryParseSupport nestedHelper = null; final boolean indexCreatedBeforeV2_0 = context.indexShard().getIndexSettings().getIndexVersionCreated().before(Version.V_2_0_0); <BUG>boolean coerce = false; boolean ignoreMalformed = false; XContentParser.Token token;</BUG> String currentName = parser.currentName(); while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
boolean coerce = GeoDistanceSortBuilder.DEFAULT_COERCE; boolean ignoreMalformed = GeoDistanceSortBuilder.DEFAULT_IGNORE_MALFORMED; XContentParser.Token token;
46,578
String currentName = parser.currentName(); while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { currentName = parser.currentName(); } else if (token == XContentParser.Token.START_ARRAY) { <BUG>parseGeoPoints(parser, geoPoints); </BUG> fieldName = currentName; } else if (token == XContentParser.Token.START_OBJECT) { if ("nested_filter".equals(currentName) || "nestedFilter".equals(currentName)) {
GeoDistanceSortBuilder.parseGeoPoints(parser, geoPoints);
46,579
package org.elasticsearch.search.sort; <BUG>import org.elasticsearch.script.Script; public class SortBuilders {</BUG> public static ScoreSortBuilder scoreSort() { return new ScoreSortBuilder(); }
import org.elasticsearch.common.geo.GeoPoint; import java.util.Arrays; public class SortBuilders {
46,580
public GeoDistanceSortBuilder ignoreMalformed(boolean ignoreMalformed) { this.ignoreMalformed = ignoreMalformed; return this; }</BUG> @Override <BUG>public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject("_geo_distance"); if (geohashes.size() == 0 && points.size() == 0) { throw new ElasticsearchParseException("No points provided for _geo_distance sort."); }</BUG> builder.startArray(fieldName);
if (coerce == false) { } } public boolean ignoreMalformed() { return this.ignoreMalformed; } builder.startObject(NAME);
46,581
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.type.MapType; import com.fasterxml.jackson.databind.type.TypeFactory; <BUG>import com.github.jasminb.jsonapi.annotations.Relationship; import java.io.IOException; import java.lang.reflect.Field;</BUG> import java.util.ArrayList; import java.util.HashMap;
import java.io.ByteArrayInputStream; import java.io.InputStream; import java.lang.reflect.Field;
46,582
String identifier = createIdentifier(source); T result = (T) resourceCache.get(identifier); if (result == null) { if (source.has(ATTRIBUTES)) { result = objectMapper.treeToValue(source.get(ATTRIBUTES), clazz); <BUG>} else { result = clazz.newInstance(); }</BUG> if (source.has(META)) { Field field = configuration.getMetaField(clazz);
if (clazz.isInterface()) { result = null; } }
46,583
for (JsonNode jsonNode : parent.get(INCLUDED)) { String type = jsonNode.get(TYPE).asText(); if (type != null) { Class<?> clazz = configuration.getTypeClass(type); if (clazz != null) { <BUG>Object object = readObject(jsonNode, clazz, false); result.add(new Resource(createIdentifier(jsonNode), object)); }</BUG> } }
if (object != null) {
46,584
package com.github.jasminb.jsonapi; import com.fasterxml.jackson.core.JsonProcessingException; <BUG>import com.fasterxml.jackson.databind.JsonNode; import com.github.jasminb.jsonapi.exceptions.ResourceParseException; public class ValidationUtils {</BUG> private ValidationUtils() { }
import com.fasterxml.jackson.databind.ObjectMapper; import com.github.jasminb.jsonapi.models.errors.Errors; public class ValidationUtils {
46,585
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> {
46,586
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);
46,587
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;
46,588
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]
46,589
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]
46,590
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);
46,591
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);
46,592
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]
46,593
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)
46,594
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(() -> {
46,595
if (i != null) { i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.putExtra("anim", true); startActivity(i); <BUG>overridePendingTransition(0, 0); mDrawerLayout.postDelayed(new Runnable() { @Override public void run() { mDrawerLayout.closeDrawers();</BUG> }
mDrawerLayout.postDelayed(() -> mDrawerLayout.closeDrawers(), 500);
46,596
import android.preference.PreferenceManager; import android.widget.Toast; import com.crashlytics.android.Crashlytics; import com.evernote.android.job.Job; import com.evernote.android.job.JobCreator; <BUG>import com.evernote.android.job.JobManager; import com.metinkale.prayer.BuildConfig;</BUG> import com.metinkale.prayerapp.settings.Prefs; import com.metinkale.prayerapp.utils.AndroidTimeZoneProvider; import com.metinkale.prayerapp.utils.TimeZoneChangedReceiver;
import com.github.anrwatchdog.ANRWatchDog; import com.metinkale.prayer.BuildConfig;
46,597
super.onCreate(); if (LeakCanary.isInAnalyzerProcess(this)) { return; } LeakCanary.install(this); <BUG>sContext = new WeakReference<Context>(this); Fabric.with(this, new Crashlytics());</BUG> Crashlytics.setUserIdentifier(Prefs.getUUID()); if (BuildConfig.DEBUG) Crashlytics.setBool("isDebug", true);
sContext = new WeakReference<>(this); Fabric.with(this, new Crashlytics());
46,598
package com.siyeh.ig.junit; <BUG>import com.intellij.psi.PsiClass; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiModifier; import com.intellij.psi.PsiTypeParameter;</BUG> import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.*;
46,599
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
46,600
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { <BUG>try { connectTango();</BUG> setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
TangoSupport.initialize(); connectTango();