nus-yam/ex-repair huggingface dataset:
Program: 15307
Project: 15307
Buggy source:
/** 
 * This adds an annotation that corresponds with   {@link Span#getDuration()}, and sends the span for collection.
 * @return true if a span was sent for collection.
 */
boolean submitEndAnnotation(String annotationName,Reporter<zipkin.Span> reporter){
  Span span=spanAndEndpoint().span();
  if (span == null) {
    return false;
  }
  Long startTimestamp;
  Long startTick;
synchronized (span) {
    startTimestamp=span.getTimestamp();
    startTick=span.startTick;
  }
  Long endTimestamp;
  Long duration=null;
  if (startTick != null) {
    long endTick=System.nanoTime();
    duration=Math.max(1L,(endTick - startTick) / 1000L);
    endTimestamp=startTimestamp + duration;
  }
 else {
    endTimestamp=currentTimeMicroseconds(null);
    if (startTimestamp != null) {
      duration=Math.max(1L,endTimestamp - startTimestamp);
    }
  }
  Annotation annotation=Annotation.create(endTimestamp,annotationName,spanAndEndpoint().endpoint());
synchronized (span) {
    span.addToAnnotations(annotation);
    if (startTimestamp != null) {
      span.setDuration(duration);
    }
  }
  reporter.report(span.toZipkin());
  return true;
}

Fixed version (ground truth):
/** 
 * This adds an annotation that corresponds with   {@link Span#getDuration()}, and sends the span for collection.
 * @return true if a span was sent for collection.
 */
boolean submitEndAnnotation(String annotationName,Reporter<zipkin.Span> reporter){
  Span span=spanAndEndpoint().span();
  if (span == null) {
    return false;
  }
  Long startTimestamp;
  Long startTick;
synchronized (span) {
    startTimestamp=span.getTimestamp();
    startTick=span.startTick;
  }
  long endTimestamp=currentTimeMicroseconds(startTimestamp,startTick);
  Annotation annotation=Annotation.create(endTimestamp,annotationName,spanAndEndpoint().endpoint());
synchronized (span) {
    span.addToAnnotations(annotation);
    if (startTimestamp != null) {
      span.setDuration(Math.max(1L,endTimestamp - startTimestamp));
    }
  }
  reporter.report(span.toZipkin());
  return true;
}
Program: 15308
Project: 15308
Buggy source:
/** 
 * This adds an annotation that corresponds with   {@link Span#getTimestamp()} 
 */
void submitStartAnnotation(String annotationName){
  Span span=spanAndEndpoint().span();
  if (span != null) {
    Annotation annotation=Annotation.create(currentTimeMicroseconds(null),annotationName,spanAndEndpoint().endpoint());
synchronized (span) {
      span.setTimestamp(annotation.timestamp);
      span.addToAnnotations(annotation);
      span.startTick=System.nanoTime();
    }
  }
}

Fixed version (ground truth):
/** 
 * This adds an annotation that corresponds with   {@link Span#getTimestamp()} 
 */
void submitStartAnnotation(String annotationName){
  Span span=spanAndEndpoint().span();
  if (span != null) {
    Annotation annotation=Annotation.create(clock().currentTimeMicroseconds(),annotationName,spanAndEndpoint().endpoint());
synchronized (span) {
      span.setTimestamp(annotation.timestamp);
      span.addToAnnotations(annotation);
      span.startTick=System.nanoTime();
    }
  }
}
Program: 15309
Project: 15309
Buggy source:
@Test public void testCurrentTimeMicroSeconds_fromRelativeNanoTick(){
  AnnotationSubmitter anotherAnnotationSubmitter=AnnotationSubmitter.create(StaticSpanAndEndpoint.create(null,endpoint));
  PowerMockito.when(System.nanoTime()).thenReturn(1000L);
  assertEquals(1,anotherAnnotationSubmitter.currentTimeMicroseconds(0L));
}

Fixed version (ground truth):
@Test public void testCurrentTimeMicroSeconds_fromRelativeNanoTick(){
  PowerMockito.when(System.nanoTime()).thenReturn(1000L);
  assertThat(annotationSubmitter.currentTimeMicroseconds(CURRENT_TIME_MICROSECONDS,0L)).isEqualTo(CURRENT_TIME_MICROSECONDS + 1L);
}
Program: 15310
Project: 15310
Buggy source:
@Test public void testSubmitBinaryAnnotationStringValue() throws UnsupportedEncodingException {
  annotationSubmitter.submitBinaryAnnotation(KEY,STRING_VALUE);
  final BinaryAnnotation expectedAnnotation=BinaryAnnotation.create(KEY,STRING_VALUE,endpoint);
  verify(mockSpan).addToBinary_annotations(expectedAnnotation);
  verifyNoMoreInteractions(mockSpan);
}

Fixed version (ground truth):
@Test public void testSubmitBinaryAnnotationStringValue() throws UnsupportedEncodingException {
  annotationSubmitter.submitBinaryAnnotation(KEY,STRING_VALUE);
  assertThat(span.getBinary_annotations()).containsExactly(BinaryAnnotation.create(KEY,STRING_VALUE,endpoint));
}
Program: 15311
Project: 15311
Buggy source:
@Test public void testSubmitAnnotationSpanEndpointString(){
  annotationSubmitter.submitAnnotation(ANNOTATION_NAME);
  Annotation expectedAnnotation=Annotation.create(CURRENT_TIME_MICROSECONDS,ANNOTATION_NAME,endpoint);
  verify(mockSpan).addToAnnotations(expectedAnnotation);
  verifyNoMoreInteractions(mockSpan);
}

Fixed version (ground truth):
@Test public void testSubmitAnnotationSpanEndpointString(){
  annotationSubmitter.submitAnnotation(ANNOTATION_NAME);
  assertThat(span.getAnnotations()).containsExactly(Annotation.create(CURRENT_TIME_MICROSECONDS,ANNOTATION_NAME,endpoint));
}
Program: 15312
Project: 15312
Buggy source:
@Test public void testCurrentTimeMicroSeconds_fromSystemCurrentMillis(){
  AnnotationSubmitter anotherAnnotationSubmitter=AnnotationSubmitter.create(StaticSpanAndEndpoint.create(null,endpoint));
  assertEquals(CURRENT_TIME_MICROSECONDS,anotherAnnotationSubmitter.currentTimeMicroseconds(null));
}

Fixed version (ground truth):
@Test public void testCurrentTimeMicroSeconds_fromSystemCurrentMillis(){
  assertThat(annotationSubmitter.clock().currentTimeMicroseconds()).isEqualTo(CURRENT_TIME_MICROSECONDS);
}
Program: 15313
Project: 15313
Buggy source:
@Before public void setup(){
  mockSpan=mock(Span.class);
  PowerMockito.mockStatic(System.class);
  PowerMockito.when(System.currentTimeMillis()).thenReturn(CURRENT_TIME_MICROSECONDS / 1000);
  annotationSubmitter=AnnotationSubmitter.create(StaticSpanAndEndpoint.create(mockSpan,endpoint));
}

Fixed version (ground truth):
@Before public void setup(){
  PowerMockito.mockStatic(System.class);
  PowerMockito.when(System.currentTimeMillis()).thenReturn(CURRENT_TIME_MICROSECONDS / 1000);
}
Program: 15314
Project: 15314
Buggy source:
@Test public void testSubmitBinaryAnnotationIntValue(){
  annotationSubmitter.submitBinaryAnnotation(KEY,INT_VALUE);
  final BinaryAnnotation expectedAnnotation=BinaryAnnotation.create(KEY,String.valueOf(INT_VALUE),endpoint);
  verify(mockSpan).addToBinary_annotations(expectedAnnotation);
  verifyNoMoreInteractions(mockSpan);
}

Fixed version (ground truth):
@Test public void testSubmitBinaryAnnotationIntValue(){
  annotationSubmitter.submitBinaryAnnotation(KEY,INT_VALUE);
  assertThat(span.getBinary_annotations()).containsExactly(BinaryAnnotation.create(KEY,String.valueOf(INT_VALUE),endpoint));
}
Program: 15315
Project: 15315
Buggy source:
/** 
 * @param rate 0 means never sample, 1 means always sample. Otherwise minimum sample rate is0.0001, or 0.01% of traces
 */
public static Sampler create(float rate){
  if (rate == 0)   return Sampler.NEVER_SAMPLE;
  if (rate == 1.0)   return ALWAYS_SAMPLE;
  checkArgument(rate > 0.0001 && rate < 1,"String_Node_Str",rate);
  final long boundary=(long)(rate * 10000);
  return new BoundarySampler(boundary);
}

Fixed version (ground truth):
/** 
 * @param rate 0 means never sample, 1 means always sample. Otherwise minimum sample rate is0.0001, or 0.01% of traces
 */
public static Sampler create(float rate){
  if (rate == 0)   return Sampler.NEVER_SAMPLE;
  if (rate == 1.0)   return ALWAYS_SAMPLE;
  checkArgument(rate >= 0.0001f && rate < 1,"String_Node_Str",rate);
  final long boundary=(long)(rate * 10000);
  return new BoundarySampler(boundary);
}
Program: 15316
Project: 15316
Buggy source:
/** 
 * Returns a sampler, given a rate expressed as a percentage. <p>The sampler returned is good for low volumes of traffic (<100K requests), as it is precise. If you have high volumes of traffic, consider   {@link BoundarySampler}.
 * @param rate minimum sample rate is 0.0001, or 0.01% of traces
 */
public static Sampler create(float rate){
  return CountingSampler.create(rate);
}

Fixed version (ground truth):
/** 
 * Returns a sampler, given a rate expressed as a percentage. <p>The sampler returned is good for low volumes of traffic (<100K requests), as it is precise. If you have high volumes of traffic, consider   {@link BoundarySampler}.
 * @param rate minimum sample rate is 0.01, or 1% of traces
 */
public static Sampler create(float rate){
  return CountingSampler.create(rate);
}
Program: 15317
Project: 15317
Buggy source:
/** 
 * Requests the thread to stop.
 */
public void stop(){
  stop=true;
}

Fixed version (ground truth):
/** 
 * Requests the thread to stop as well as closes the client connection for this thread.
 */
public void stop(){
  stop=true;
  clientProvider.close();
}
Program: 15318
Project: 15318
Buggy source:
/** 
 * Create a new instance.
 * @param zipkinCollectorHost Host for zipkin collector.
 * @param zipkinCollectorPort Port for zipkin collector.
 * @param params Zipkin Span Collector parameters.
 */
public ZipkinSpanCollector(final String zipkinCollectorHost,final int zipkinCollectorPort,final ZipkinSpanCollectorParams params){
  Validate.notEmpty(zipkinCollectorHost);
  Validate.notNull(params);
  clientProvider=new ZipkinCollectorClientProvider(zipkinCollectorHost,zipkinCollectorPort,params.getSocketTimeout());
  try {
    clientProvider.setup();
  }
 catch (  final TException e) {
    if (params.failOnSetup()) {
      throw new IllegalStateException(e);
    }
 else {
      LOGGER.warn("String_Node_Str",e);
    }
  }
  spanQueue=new ArrayBlockingQueue<Span>(params.getQueueSize());
  executorService=Executors.newFixedThreadPool(params.getNrOfThreads());
  for (int i=1; i <= params.getNrOfThreads(); i++) {
    final SpanProcessingThread spanProcessingThread=new SpanProcessingThread(spanQueue,clientProvider,params.getBatchSize());
    spanProcessingThreads.add(spanProcessingThread);
    futures.add(executorService.submit(spanProcessingThread));
  }
}

Fixed version (ground truth):
/** 
 * Create a new instance.
 * @param zipkinCollectorHost Host for zipkin collector.
 * @param zipkinCollectorPort Port for zipkin collector.
 * @param params Zipkin Span Collector parameters.
 */
public ZipkinSpanCollector(final String zipkinCollectorHost,final int zipkinCollectorPort,final ZipkinSpanCollectorParams params){
  Validate.notEmpty(zipkinCollectorHost);
  Validate.notNull(params);
  spanQueue=new ArrayBlockingQueue<Span>(params.getQueueSize());
  executorService=Executors.newFixedThreadPool(params.getNrOfThreads());
  for (int i=1; i <= params.getNrOfThreads(); i++) {
    ZipkinCollectorClientProvider clientProvider=new ZipkinCollectorClientProvider(zipkinCollectorHost,zipkinCollectorPort,params.getSocketTimeout());
    try {
      clientProvider.setup();
    }
 catch (    final TException e) {
      if (params.failOnSetup()) {
        throw new IllegalStateException(e);
      }
 else {
        LOGGER.warn("String_Node_Str",e);
      }
    }
    final SpanProcessingThread spanProcessingThread=new SpanProcessingThread(spanQueue,clientProvider,params.getBatchSize());
    spanProcessingThreads.add(spanProcessingThread);
    futures.add(executorService.submit(spanProcessingThread));
  }
}
Program: 15319
Project: 15319
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override @PreDestroy public void close(){
  LOGGER.info("String_Node_Str");
  for (  final SpanProcessingThread thread : spanProcessingThreads) {
    thread.stop();
  }
  for (  final Future<Integer> future : futures) {
    try {
      final Integer spansProcessed=future.get();
      LOGGER.info("String_Node_Str",spansProcessed);
    }
 catch (    final Exception e) {
      LOGGER.warn("String_Node_Str",e);
    }
  }
  executorService.shutdown();
  clientProvider.close();
  LOGGER.info("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override @PreDestroy public void close(){
  LOGGER.info("String_Node_Str");
  for (  final SpanProcessingThread thread : spanProcessingThreads) {
    thread.stop();
  }
  for (  final Future<Integer> future : futures) {
    try {
      final Integer spansProcessed=future.get();
      LOGGER.info("String_Node_Str",spansProcessed);
    }
 catch (    final Exception e) {
      LOGGER.warn("String_Node_Str",e);
    }
  }
  executorService.shutdown();
  LOGGER.info("String_Node_Str");
}
Program: 15320
Project: 15320
Buggy source:
private void submitEndpoint(){
  if (!endPointSubmitter.endPointSubmitted()) {
    final String localAddr=servletRequest.getLocalAddr();
    final int localPort=servletRequest.getLocalPort();
    final String contextPath=servletRequest.getContextPath();
    LOGGER.debug("String_Node_Str",localAddr,localPort,contextPath);
    endPointSubmitter.submit(localAddr,localPort,contextPath);
  }
}

Fixed version (ground truth):
private void submitEndpoint(){
  if (!endPointSubmitter.endPointSubmitted()) {
    final String localAddr=servletRequest.getLocalAddr();
    final int localPort=servletRequest.getLocalPort();
    final String contextPath=getContextPathWithoutFirstSlash();
    LOGGER.debug("String_Node_Str",localAddr,localPort,contextPath);
    endPointSubmitter.submit(localAddr,localPort,contextPath);
  }
}
Program: 15321
Project: 15321
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Status process() throws EventDeliveryException {
  Status status=Status.BACKOFF;
  final Channel channel=getChannel();
  final Transaction txn=channel.getTransaction();
  txn.begin();
  try {
    Event event=channel.take();
    if (event != null) {
      final List<LogEntry> logEntries=new ArrayList<LogEntry>(batchSize);
      logEntries.add(create(event));
      int count=1;
      while ((event=channel.take()) != null && count < batchSize) {
        count++;
        logEntries.add(create(event));
      }
      client.Log(logEntries);
      sinkCounter.incrementBatchCompleteCount();
      status=Status.READY;
    }
 else {
      sinkCounter.incrementBatchEmptyCount();
    }
    txn.commit();
  }
 catch (  final TTransportException e) {
    txn.rollback();
    LOGGER.error("String_Node_Str");
    try {
      connect();
      LOGGER.info("String_Node_Str");
    }
 catch (    final TTransportException e1) {
      LOGGER.error("String_Node_Str",e1);
    }
  }
catch (  final Throwable e) {
    txn.rollback();
    throw new EventDeliveryException(e);
  }
 finally {
    txn.close();
  }
  return status;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Status process() throws EventDeliveryException {
  Status status=Status.BACKOFF;
  final Channel channel=getChannel();
  final Transaction txn=channel.getTransaction();
  txn.begin();
  try {
    Event event=channel.take();
    if (event != null) {
      final List<LogEntry> logEntries=new ArrayList<LogEntry>(batchSize);
      logEntries.add(create(event));
      int count=1;
      while (count < batchSize && (event=channel.take()) != null) {
        count++;
        logEntries.add(create(event));
      }
      client.Log(logEntries);
      sinkCounter.incrementBatchCompleteCount();
      status=Status.READY;
    }
 else {
      sinkCounter.incrementBatchEmptyCount();
    }
    txn.commit();
  }
 catch (  final TTransportException e) {
    txn.rollback();
    LOGGER.error("String_Node_Str");
    try {
      connect();
      LOGGER.info("String_Node_Str");
    }
 catch (    final TTransportException e1) {
      LOGGER.error("String_Node_Str",e1);
    }
  }
catch (  final Throwable e) {
    txn.rollback();
    throw new EventDeliveryException(e);
  }
 finally {
    txn.close();
  }
  return status;
}
Program: 15322
Project: 15322
Buggy source:
/** 
 * Submits a binary annotation with custom type.
 * @param span Span.
 * @param endPoint Endpoint, optional, can be <code>null</code>.
 * @param key Key, should not be empty.
 * @param value Should not be null.
 * @param annotationType Indicates the type of the value.
 */
private void submitBinaryAnnotation(final Span span,final Endpoint endPoint,final String key,final ByteBuffer value,final AnnotationType annotationType){
  Validate.notBlank(key);
  Validate.notNull(value);
  final BinaryAnnotation binaryAnnotation=new BinaryAnnotation();
  binaryAnnotation.setKey(key);
  binaryAnnotation.setValue(value);
  binaryAnnotation.setAnnotation_type(annotationType);
  binaryAnnotation.setHost(endPoint);
  span.addToBinary_annotations(binaryAnnotation);
}

Fixed version (ground truth):
/** 
 * Submits a binary annotation with custom type.
 * @param span Span.
 * @param endPoint Endpoint, optional, can be <code>null</code>.
 * @param key Key, should not be empty.
 * @param value Should not be null.
 * @param annotationType Indicates the type of the value.
 */
private void submitBinaryAnnotation(final Span span,final Endpoint endPoint,final String key,final ByteBuffer value,final AnnotationType annotationType){
  Validate.notBlank(key);
  Validate.notNull(value);
  final BinaryAnnotation binaryAnnotation=new BinaryAnnotation();
  binaryAnnotation.setKey(key);
  binaryAnnotation.setValue(value);
  binaryAnnotation.setAnnotation_type(annotationType);
  binaryAnnotation.setHost(endPoint);
  addBinaryAnnotation(span,binaryAnnotation);
}
Program: 15323
Project: 15323
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void submitAnnotation(final String annotationName){
  final Span span=getSpan();
  if (span != null) {
    final Annotation annotation=new Annotation();
    annotation.setTimestamp(currentTimeMicroseconds());
    annotation.setHost(getEndPoint());
    annotation.setValue(annotationName);
    span.addToAnnotations(annotation);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void submitAnnotation(final String annotationName){
  final Span span=getSpan();
  if (span != null) {
    final Annotation annotation=new Annotation();
    annotation.setTimestamp(currentTimeMicroseconds());
    annotation.setHost(getEndPoint());
    annotation.setValue(annotationName);
    addAnnotation(span,annotation);
  }
}
Program: 15324
Project: 15324
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Integer call() throws Exception {
  int subsequentEmptyBatches=0;
  do {
    final Span span=queue.poll(5,TimeUnit.SECONDS);
    if (span == null) {
      subsequentEmptyBatches++;
    }
 else {
      logEntries.add(create(span));
    }
    if (subsequentEmptyBatches >= MAX_SUBSEQUENT_EMPTY_BATCHES && !logEntries.isEmpty() || logEntries.size() >= maxBatchSize || !logEntries.isEmpty() && stop) {
      log(logEntries);
      logEntries.clear();
      subsequentEmptyBatches=0;
    }
  }
 while (stop == false);
  return processedSpans;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Integer call(){
  int subsequentEmptyBatches=0;
  do {
    try {
      final Span span=queue.poll(5,TimeUnit.SECONDS);
      if (span == null) {
        subsequentEmptyBatches++;
      }
 else {
        logEntries.add(create(span));
      }
      if (subsequentEmptyBatches >= MAX_SUBSEQUENT_EMPTY_BATCHES && !logEntries.isEmpty() || logEntries.size() >= maxBatchSize || !logEntries.isEmpty() && stop) {
        log(logEntries);
        logEntries.clear();
        subsequentEmptyBatches=0;
      }
    }
 catch (    final Exception e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
 while (stop == false);
  return processedSpans;
}
Program: 15325
Project: 15325
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Integer call() throws Exception {
  do {
    final Span span=queue.poll(5000,TimeUnit.SECONDS);
    if (span != null) {
      final long start=System.currentTimeMillis();
      try {
        final String spanAsString=base64.encodeToString(spanToBytes(span));
        final LogEntry logEntry=new LogEntry("String_Node_Str",spanAsString);
        client.Log(Arrays.asList(logEntry));
      }
 catch (      final TException e) {
        LOGGER.error("String_Node_Str",e);
      }
 finally {
        if (LOGGER.isDebugEnabled()) {
          final long end=System.currentTimeMillis();
          LOGGER.debug("String_Node_Str" + (end - start) + "String_Node_Str");
        }
      }
      processedSpans++;
    }
  }
 while (stop == false);
  return processedSpans;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Integer call() throws Exception {
  do {
    final Span span=queue.poll(5,TimeUnit.SECONDS);
    if (span != null) {
      final long start=System.currentTimeMillis();
      try {
        final String spanAsString=base64.encodeToString(spanToBytes(span));
        final LogEntry logEntry=new LogEntry("String_Node_Str",spanAsString);
        client.Log(Arrays.asList(logEntry));
      }
 catch (      final TException e) {
        LOGGER.error("String_Node_Str",e);
      }
 finally {
        if (LOGGER.isDebugEnabled()) {
          final long end=System.currentTimeMillis();
          LOGGER.debug("String_Node_Str" + (end - start) + "String_Node_Str");
        }
      }
      processedSpans++;
    }
  }
 while (stop == false);
  return processedSpans;
}
Program: 15326
Project: 15326
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void collect(final Span span){
  final long start=System.currentTimeMillis();
  try {
    spanQueue.offer(span,5000,TimeUnit.SECONDS);
  }
 catch (  final InterruptedException e1) {
    LOGGER.error("String_Node_Str" + span,e1);
  }
  final long end=System.currentTimeMillis();
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("String_Node_Str" + (end - start) + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void collect(final Span span){
  final long start=System.currentTimeMillis();
  try {
    spanQueue.offer(span,5,TimeUnit.SECONDS);
  }
 catch (  final InterruptedException e1) {
    LOGGER.error("String_Node_Str" + span,e1);
  }
  final long end=System.currentTimeMillis();
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("String_Node_Str" + (end - start) + "String_Node_Str");
  }
}
Program: 15330
Project: 15330
Buggy source:
private WritableCacheFile(final CacheRequest request,final UUID session,final String mimetype) throws IOException {
  this.request=request;
  location=PrefsUtility.pref_cache_location(context,PreferenceManager.getDefaultSharedPreferences(context));
  final File tmpFile=new File(location,UUID.randomUUID().toString() + tempExt);
  final FileOutputStream fos=new FileOutputStream(tmpFile);
  final OutputStream bufferedOs=new BufferedOutputStream(fos,64 * 1024);
  final NotifyOutputStream.Listener listener=new NotifyOutputStream.Listener(){
    public void onClose() throws IOException {
      cacheFileId=dbManager.newEntry(request,session,mimetype);
      final File dstFile=new File(location,cacheFileId + ext);
      General.moveFile(tmpFile,dstFile);
      dbManager.setEntryDone(cacheFileId);
      readableCacheFile=new ReadableCacheFile(cacheFileId);
    }
  }
;
  this.os=new NotifyOutputStream(bufferedOs,listener);
}

Fixed version (ground truth):
private WritableCacheFile(final CacheRequest request,final UUID session,final String mimetype) throws IOException {
  this.request=request;
  location=getPreferredCacheLocation();
  final File tmpFile=new File(location,UUID.randomUUID().toString() + tempExt);
  final FileOutputStream fos=new FileOutputStream(tmpFile);
  final OutputStream bufferedOs=new BufferedOutputStream(fos,64 * 1024);
  final NotifyOutputStream.Listener listener=new NotifyOutputStream.Listener(){
    public void onClose() throws IOException {
      cacheFileId=dbManager.newEntry(request,session,mimetype);
      final File dstFile=new File(location,cacheFileId + ext);
      General.moveFile(tmpFile,dstFile);
      dbManager.setEntryDone(cacheFileId);
      readableCacheFile=new ReadableCacheFile(cacheFileId);
    }
  }
;
  this.os=new NotifyOutputStream(bufferedOs,listener);
}
Program: 15331
Project: 15331
Buggy source:
public static List<File> getCacheDirs(Context context){
  List<File> dirs=new ArrayList<>();
  dirs.add(context.getCacheDir());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    Collections.addAll(dirs,context.getExternalCacheDirs());
  }
 else {
    File extDir=context.getExternalCacheDir();
    if (extDir != null)     dirs.add(extDir);
  }
  return dirs;
}

Fixed version (ground truth):
public static List<File> getCacheDirs(Context context){
  final ArrayList<File> dirs=new ArrayList<>();
  dirs.add(context.getCacheDir());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    for (    final File dir : context.getExternalCacheDirs()) {
      if (dir != null) {
        dirs.add(dir);
      }
    }
  }
 else {
    final File extDir=context.getExternalCacheDir();
    if (extDir != null) {
      dirs.add(extDir);
    }
  }
  return dirs;
}
Program: 15332
Project: 15332
Buggy source:
@Override public int hashCode(){
  return username.toLowerCase().hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return getCanonicalUsername().hashCode();
}
Program: 15334
Project: 15334
Buggy source:
private Collection<GroupedRecyclerViewAdapter.Item> filter(Collection<RedditCommentListItem> comments){
  final Collection<RedditCommentListItem> searchComments;
  if (mSearchString == null) {
    searchComments=comments;
  }
 else {
    searchComments=new ArrayList<>();
    for (    RedditCommentListItem comment : comments) {
      if (!comment.isComment())       continue;
      String commentStr=comment.asComment().getParsedComment().getRawComment().body;
      if (commentStr != null) {
        commentStr=commentStr.toLowerCase();
        if (commentStr.contains(mSearchString)) {
          searchComments.add(comment);
        }
      }
    }
  }
  return Collections.<GroupedRecyclerViewAdapter.Item>unmodifiableCollection(searchComments);
}

Fixed version (ground truth):
private Collection<GroupedRecyclerViewAdapter.Item> filter(Collection<RedditCommentListItem> comments){
  final Collection<RedditCommentListItem> searchComments;
  if (mSearchString == null) {
    searchComments=comments;
  }
 else {
    searchComments=new ArrayList<>();
    for (    RedditCommentListItem comment : comments) {
      if (!comment.isComment())       continue;
      String commentStr=comment.asComment().getParsedComment().getRawComment().body;
      if (commentStr != null) {
        commentStr=General.asciiLowercase(commentStr);
        if (commentStr.contains(mSearchString)) {
          searchComments.add(comment);
        }
      }
    }
  }
  return Collections.<GroupedRecyclerViewAdapter.Item>unmodifiableCollection(searchComments);
}
Program: 15335
Project: 15335
Buggy source:
public static boolean isImage(String mimetype){
  return mimetype.toLowerCase().startsWith("String_Node_Str");
}

Fixed version (ground truth):
public static boolean isImage(String mimetype){
  return General.asciiLowercase(mimetype).startsWith("String_Node_Str");
}
Program: 15336
Project: 15336
Buggy source:
@Override public void onClick(DialogInterface dialog,int which){
  final String query=editText.getText().toString().toLowerCase().trim();
  if (StringUtils.isEmpty(query)) {
    listener.onSearch(null);
  }
 else {
    listener.onSearch(query);
  }
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int which){
  final String query=General.asciiLowercase(editText.getText().toString()).trim();
  if (StringUtils.isEmpty(query)) {
    listener.onSearch(null);
  }
 else {
    listener.onSearch(query);
  }
}
Program: 15337
Project: 15337
Buggy source:
public static void showSearchDialog(Context context,int titleRes,final OnSearchListener listener){
  final AlertDialog.Builder alertBuilder=new AlertDialog.Builder(context);
  final EditText editText=(EditText)LayoutInflater.from(context).inflate(R.layout.dialog_editbox,null);
  alertBuilder.setView(editText);
  alertBuilder.setTitle(titleRes);
  alertBuilder.setPositiveButton(R.string.action_search,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      final String query=editText.getText().toString().toLowerCase().trim();
      if (StringUtils.isEmpty(query)) {
        listener.onSearch(null);
      }
 else {
        listener.onSearch(query);
      }
    }
  }
);
  alertBuilder.setNegativeButton(R.string.dialog_cancel,null);
  final AlertDialog alertDialog=alertBuilder.create();
  alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
  alertDialog.show();
}

Fixed version (ground truth):
public static void showSearchDialog(Context context,int titleRes,final OnSearchListener listener){
  final AlertDialog.Builder alertBuilder=new AlertDialog.Builder(context);
  final EditText editText=(EditText)LayoutInflater.from(context).inflate(R.layout.dialog_editbox,null);
  alertBuilder.setView(editText);
  alertBuilder.setTitle(titleRes);
  alertBuilder.setPositiveButton(R.string.action_search,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      final String query=General.asciiLowercase(editText.getText().toString()).trim();
      if (StringUtils.isEmpty(query)) {
        listener.onSearch(null);
      }
 else {
        listener.onSearch(query);
      }
    }
  }
);
  alertBuilder.setNegativeButton(R.string.dialog_cancel,null);
  final AlertDialog alertDialog=alertBuilder.create();
  alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
  alertDialog.show();
}
Program: 15338
Project: 15338
Buggy source:
private static String getImageUrlPatternMatch(final String url){
  final String urlLower=url.toLowerCase();
  final String[] imageExtensions={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  final String ext : imageExtensions) {
    if (urlLower.endsWith(ext)) {
      return url;
    }
  }
  if (url.contains("String_Node_Str")) {
    final String urlBeforeQ=urlLower.split("String_Node_Str")[0];
    for (    final String ext : imageExtensions) {
      if (urlBeforeQ.endsWith(ext)) {
        return url;
      }
    }
  }
  final Matcher matchQkme1=qkmePattern1.matcher(url);
  if (matchQkme1.find()) {
    final String imgId=matchQkme1.group(1);
    if (imgId.length() > 2)     return String.format("String_Node_Str",imgId);
  }
  final Matcher matchQkme2=qkmePattern2.matcher(url);
  if (matchQkme2.find()) {
    final String imgId=matchQkme2.group(1);
    if (imgId.length() > 2)     return String.format("String_Node_Str",imgId);
  }
  final Matcher matchLvme=lvmePattern.matcher(url);
  if (matchLvme.find()) {
    final String imgId=matchLvme.group(1);
    if (imgId.length() > 2)     return String.format("String_Node_Str",imgId);
  }
  return null;
}

Fixed version (ground truth):
private static String getImageUrlPatternMatch(final String url){
  final String urlLower=General.asciiLowercase(url);
  final String[] imageExtensions={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  final String ext : imageExtensions) {
    if (urlLower.endsWith(ext)) {
      return url;
    }
  }
  if (url.contains("String_Node_Str")) {
    final String urlBeforeQ=urlLower.split("String_Node_Str")[0];
    for (    final String ext : imageExtensions) {
      if (urlBeforeQ.endsWith(ext)) {
        return url;
      }
    }
  }
  final Matcher matchQkme1=qkmePattern1.matcher(url);
  if (matchQkme1.find()) {
    final String imgId=matchQkme1.group(1);
    if (imgId.length() > 2)     return String.format("String_Node_Str",imgId);
  }
  final Matcher matchQkme2=qkmePattern2.matcher(url);
  if (matchQkme2.find()) {
    final String imgId=matchQkme2.group(1);
    if (imgId.length() > 2)     return String.format("String_Node_Str",imgId);
  }
  final Matcher matchLvme=lvmePattern.matcher(url);
  if (matchLvme.find()) {
    final String imgId=matchLvme.group(1);
    if (imgId.length() > 2)     return String.format("String_Node_Str",imgId);
  }
  return null;
}
Program: 15339
Project: 15339
Buggy source:
public static boolean pref_pinned_subreddits_check(final Context context,final SharedPreferences sharedPreferences,final String subreddit) throws RedditSubreddit.InvalidSubredditNameException {
  final List<String> list=pref_pinned_subreddits(context,sharedPreferences);
  for (  final String existingSr : list) {
    if (subreddit.toLowerCase().equals(existingSr.toLowerCase()))     return true;
  }
  return false;
}

Fixed version (ground truth):
public static boolean pref_pinned_subreddits_check(final Context context,final SharedPreferences sharedPreferences,final String subreddit) throws RedditSubreddit.InvalidSubredditNameException {
  final List<String> list=pref_pinned_subreddits(context,sharedPreferences);
  for (  final String existingSr : list) {
    if (General.asciiLowercase(subreddit).equals(General.asciiLowercase(existingSr)))     return true;
  }
  return false;
}
Program: 15340
Project: 15340
Buggy source:
public static boolean pref_blocked_subreddits_check(final Context context,final SharedPreferences sharedPreferences,final String subreddit) throws RedditSubreddit.InvalidSubredditNameException {
  final List<String> list=pref_blocked_subreddits(context,sharedPreferences);
  for (  final String existingSr : list) {
    if (subreddit.toLowerCase().equals(existingSr.toLowerCase()))     return true;
  }
  return false;
}

Fixed version (ground truth):
public static boolean pref_blocked_subreddits_check(final Context context,final SharedPreferences sharedPreferences,final String subreddit) throws RedditSubreddit.InvalidSubredditNameException {
  final List<String> list=pref_blocked_subreddits(context,sharedPreferences);
  for (  final String existingSr : list) {
    if (General.asciiLowercase(subreddit).equals(General.asciiLowercase(existingSr)))     return true;
  }
  return false;
}
Program: 15341
Project: 15341
Buggy source:
public static EnumSet<AppearanceCommentHeaderItem> appearance_comment_header_items(final Context context,final SharedPreferences sharedPreferences){
  final Set<String> strings=getStringSet(R.string.pref_appearance_comment_header_items_key,R.array.pref_appearance_comment_header_items_default,context,sharedPreferences);
  final EnumSet<AppearanceCommentHeaderItem> result=EnumSet.noneOf(AppearanceCommentHeaderItem.class);
  for (  String s : strings) {
    if (s.equalsIgnoreCase("String_Node_Str"))     continue;
    try {
      result.add(AppearanceCommentHeaderItem.valueOf(s.toUpperCase()));
    }
 catch (    IllegalArgumentException e) {
    }
  }
  return result;
}

Fixed version (ground truth):
public static EnumSet<AppearanceCommentHeaderItem> appearance_comment_header_items(final Context context,final SharedPreferences sharedPreferences){
  final Set<String> strings=getStringSet(R.string.pref_appearance_comment_header_items_key,R.array.pref_appearance_comment_header_items_default,context,sharedPreferences);
  final EnumSet<AppearanceCommentHeaderItem> result=EnumSet.noneOf(AppearanceCommentHeaderItem.class);
  for (  String s : strings) {
    if (s.equalsIgnoreCase("String_Node_Str"))     continue;
    try {
      result.add(AppearanceCommentHeaderItem.valueOf(General.asciiUppercase(s)));
    }
 catch (    IllegalArgumentException e) {
    }
  }
  return result;
}
Program: 15342
Project: 15342
Buggy source:
private static void pref_subreddits_remove(Context context,SharedPreferences sharedPreferences,String subreddit,int prefId) throws RedditSubreddit.InvalidSubredditNameException {
  final String name=RedditSubreddit.getCanonicalName(subreddit);
  final String value=getString(prefId,"String_Node_Str",context,sharedPreferences);
  final ArrayList<String> list=WritableHashSet.escapedStringToList(value);
  list.add(name);
  final ArrayList<String> result=new ArrayList<>(list.size());
  for (  final String existingSr : list) {
    if (!name.toLowerCase().equals(existingSr.toLowerCase())) {
      result.add(existingSr);
    }
  }
  final String resultStr=WritableHashSet.listToEscapedString(result);
  sharedPreferences.edit().putString(context.getString(prefId),resultStr).apply();
}

Fixed version (ground truth):
private static void pref_subreddits_remove(Context context,SharedPreferences sharedPreferences,String subreddit,int prefId) throws RedditSubreddit.InvalidSubredditNameException {
  final String name=RedditSubreddit.getCanonicalName(subreddit);
  final String value=getString(prefId,"String_Node_Str",context,sharedPreferences);
  final ArrayList<String> list=WritableHashSet.escapedStringToList(value);
  list.add(name);
  final ArrayList<String> result=new ArrayList<>(list.size());
  for (  final String existingSr : list) {
    if (!General.asciiLowercase(name).equals(General.asciiLowercase(existingSr))) {
      result.add(existingSr);
    }
  }
  final String resultStr=WritableHashSet.listToEscapedString(result);
  sharedPreferences.edit().putString(context.getString(prefId),resultStr).apply();
}
Program: 15343
Project: 15343
Buggy source:
public static Sort parseSort(String string){
  Sort[] sorts=Sort.values();
  for (  Sort sort : sorts)   if (sort.name().toLowerCase().contentEquals(string))   return sort;
  return null;
}

Fixed version (ground truth):
public static Sort parseSort(String string){
  Sort[] sorts=Sort.values();
  for (  Sort sort : sorts)   if (General.asciiLowercase(sort.name()).contentEquals(string))   return sort;
  return null;
}
Program: 15344
Project: 15344
Buggy source:
public int compareTo(final RedditSubreddit another){
  return display_name.toLowerCase().compareTo(another.display_name.toLowerCase());
}

Fixed version (ground truth):
public int compareTo(final RedditSubreddit another){
  return General.asciiLowercase(display_name).compareTo(General.asciiLowercase(another.display_name));
}
Program: 15345
Project: 15345
Buggy source:
public static Sort lookup(String name){
  name=name.toUpperCase();
  if (name.equals("String_Node_Str")) {
    return BEST;
  }
  try {
    return Sort.valueOf(name);
  }
 catch (  IllegalArgumentException e) {
    return null;
  }
}

Fixed version (ground truth):
public static Sort lookup(String name){
  name=General.asciiUppercase(name);
  if (name.equals("String_Node_Str")) {
    return BEST;
  }
  try {
    return Sort.valueOf(name);
  }
 catch (  IllegalArgumentException e) {
    return null;
  }
}
Program: 15347
Project: 15347
Buggy source:
private static boolean isRedditUri(Uri uri){
  if (uri == null || uri.getHost() == null)   return false;
  final String[] hostSegments=uri.getHost().toLowerCase().split("String_Node_Str");
  if (hostSegments.length < 2)   return false;
  if (hostSegments[hostSegments.length - 1].equals("String_Node_Str") && hostSegments[hostSegments.length - 2].equals("String_Node_Str"))   return true;
  if (hostSegments[hostSegments.length - 1].equals("String_Node_Str") && hostSegments[hostSegments.length - 2].equals("String_Node_Str"))   return true;
  return false;
}

Fixed version (ground truth):
private static boolean isRedditUri(Uri uri){
  if (uri == null || uri.getHost() == null)   return false;
  final String[] hostSegments=General.asciiLowercase(uri.getHost()).split("String_Node_Str");
  if (hostSegments.length < 2)   return false;
  if (hostSegments[hostSegments.length - 1].equals("String_Node_Str") && hostSegments[hostSegments.length - 2].equals("String_Node_Str"))   return true;
  if (hostSegments[hostSegments.length - 1].equals("String_Node_Str") && hostSegments[hostSegments.length - 2].equals("String_Node_Str"))   return true;
  return false;
}
Program: 15348
Project: 15348
Buggy source:
@Override public Uri generateJsonUri(){
  Uri.Builder builder=new Uri.Builder();
  builder.scheme(Constants.Reddit.getScheme()).authority(Constants.Reddit.getDomain());
  if (subreddit != null) {
    builder.encodedPath("String_Node_Str");
    builder.appendPath(subreddit);
    builder.appendQueryParameter("String_Node_Str","String_Node_Str");
  }
 else {
    builder.encodedPath("String_Node_Str");
  }
  builder.appendEncodedPath("String_Node_Str");
  if (query != null) {
    builder.appendQueryParameter("String_Node_Str",query);
  }
  if (order != null) {
switch (order) {
case RELEVANCE:
case NEW:
case HOT:
case TOP:
case COMMENTS:
      builder.appendQueryParameter("String_Node_Str",order.name().toLowerCase());
    break;
}
}
if (before != null) {
builder.appendQueryParameter("String_Node_Str",before);
}
if (after != null) {
builder.appendQueryParameter("String_Node_Str",after);
}
if (limit != null) {
builder.appendQueryParameter("String_Node_Str",String.valueOf(limit));
}
builder.appendEncodedPath("String_Node_Str");
return builder.build();
}

Fixed version (ground truth):
@Override public Uri generateJsonUri(){
  Uri.Builder builder=new Uri.Builder();
  builder.scheme(Constants.Reddit.getScheme()).authority(Constants.Reddit.getDomain());
  if (subreddit != null) {
    builder.encodedPath("String_Node_Str");
    builder.appendPath(subreddit);
    builder.appendQueryParameter("String_Node_Str","String_Node_Str");
  }
 else {
    builder.encodedPath("String_Node_Str");
  }
  builder.appendEncodedPath("String_Node_Str");
  if (query != null) {
    builder.appendQueryParameter("String_Node_Str",query);
  }
  if (order != null) {
switch (order) {
case RELEVANCE:
case NEW:
case HOT:
case TOP:
case COMMENTS:
      builder.appendQueryParameter("String_Node_Str",General.asciiLowercase(order.name()));
    break;
}
}
if (before != null) {
builder.appendQueryParameter("String_Node_Str",before);
}
if (after != null) {
builder.appendQueryParameter("String_Node_Str",after);
}
if (limit != null) {
builder.appendQueryParameter("String_Node_Str",String.valueOf(limit));
}
builder.appendEncodedPath("String_Node_Str");
return builder.build();
}
Program: 15350
Project: 15350
Buggy source:
@Override public Uri generateJsonUri(){
  Uri.Builder builder=new Uri.Builder();
  builder.scheme(Constants.Reddit.getScheme()).authority(Constants.Reddit.getDomain());
switch (type) {
case FRONTPAGE:
    builder.encodedPath("String_Node_Str");
  break;
case ALL:
builder.encodedPath("String_Node_Str");
break;
case SUBREDDIT:
case SUBREDDIT_COMBINATION:
case ALL_SUBTRACTION:
builder.encodedPath("String_Node_Str");
builder.appendPath(subreddit);
break;
}
if (order != null) {
switch (order) {
case HOT:
case NEW:
case RISING:
case CONTROVERSIAL:
builder.appendEncodedPath(order.name().toLowerCase());
break;
case TOP_HOUR:
case TOP_DAY:
case TOP_WEEK:
case TOP_MONTH:
case TOP_YEAR:
case TOP_ALL:
builder.appendEncodedPath("String_Node_Str");
builder.appendQueryParameter("String_Node_Str",order.name().split("String_Node_Str")[1].toLowerCase());
break;
}
}
if (before != null) {
builder.appendQueryParameter("String_Node_Str",before);
}
if (after != null) {
builder.appendQueryParameter("String_Node_Str",after);
}
if (limit != null) {
builder.appendQueryParameter("String_Node_Str",String.valueOf(limit));
}
builder.appendEncodedPath("String_Node_Str");
return builder.build();
}

Fixed version (ground truth):
@Override public Uri generateJsonUri(){
  Uri.Builder builder=new Uri.Builder();
  builder.scheme(Constants.Reddit.getScheme()).authority(Constants.Reddit.getDomain());
switch (type) {
case FRONTPAGE:
    builder.encodedPath("String_Node_Str");
  break;
case ALL:
builder.encodedPath("String_Node_Str");
break;
case SUBREDDIT:
case SUBREDDIT_COMBINATION:
case ALL_SUBTRACTION:
builder.encodedPath("String_Node_Str");
builder.appendPath(subreddit);
break;
}
if (order != null) {
switch (order) {
case HOT:
case NEW:
case RISING:
case CONTROVERSIAL:
builder.appendEncodedPath(General.asciiLowercase(order.name()));
break;
case TOP_HOUR:
case TOP_DAY:
case TOP_WEEK:
case TOP_MONTH:
case TOP_YEAR:
case TOP_ALL:
builder.appendEncodedPath("String_Node_Str");
builder.appendQueryParameter("String_Node_Str",General.asciiLowercase(order.name().split("String_Node_Str")[1]));
break;
}
}
if (before != null) {
builder.appendQueryParameter("String_Node_Str",before);
}
if (after != null) {
builder.appendQueryParameter("String_Node_Str",after);
}
if (limit != null) {
builder.appendQueryParameter("String_Node_Str",String.valueOf(limit));
}
builder.appendEncodedPath("String_Node_Str");
return builder.build();
}
Program: 15352
Project: 15352
Buggy source:
@Override public String humanReadablePath(){
  String path=super.humanReadablePath();
  if (order == null) {
    return path;
  }
switch (order) {
case TOP_HOUR:
case TOP_DAY:
case TOP_WEEK:
case TOP_MONTH:
case TOP_YEAR:
case TOP_ALL:
    return path + "String_Node_Str" + order.name().split("String_Node_Str")[1].toLowerCase();
default :
  return path;
}
}

Fixed version (ground truth):
@Override public String humanReadablePath(){
  String path=super.humanReadablePath();
  if (order == null) {
    return path;
  }
switch (order) {
case TOP_HOUR:
case TOP_DAY:
case TOP_WEEK:
case TOP_MONTH:
case TOP_YEAR:
case TOP_ALL:
    return path + "String_Node_Str" + General.asciiLowercase(order.name().split("String_Node_Str")[1]);
default :
  return path;
}
}
Program: 15353
Project: 15353
Buggy source:
@Nullable private static PostListingController.Sort getOrder(@Nullable String sort,@Nullable String t){
  if (sort == null) {
    return null;
  }
  sort=sort.toLowerCase();
  t=t != null ? t.toLowerCase() : null;
  if (sort.equals("String_Node_Str")) {
    return PostListingController.Sort.HOT;
  }
 else   if (sort.equals("String_Node_Str")) {
    return PostListingController.Sort.NEW;
  }
 else   if (sort.equals("String_Node_Str")) {
    return PostListingController.Sort.CONTROVERSIAL;
  }
 else   if (sort.equals("String_Node_Str")) {
    return PostListingController.Sort.RISING;
  }
 else   if (sort.equals("String_Node_Str")) {
    if (t == null)     return PostListingController.Sort.TOP_ALL;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_ALL;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_HOUR;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_DAY;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_WEEK;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_MONTH;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_YEAR;
 else     return PostListingController.Sort.TOP_ALL;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Nullable private static PostListingController.Sort getOrder(@Nullable String sort,@Nullable String t){
  if (sort == null) {
    return null;
  }
  sort=General.asciiLowercase(sort);
  t=t != null ? General.asciiLowercase(t) : null;
  if (sort.equals("String_Node_Str")) {
    return PostListingController.Sort.HOT;
  }
 else   if (sort.equals("String_Node_Str")) {
    return PostListingController.Sort.NEW;
  }
 else   if (sort.equals("String_Node_Str")) {
    return PostListingController.Sort.CONTROVERSIAL;
  }
 else   if (sort.equals("String_Node_Str")) {
    return PostListingController.Sort.RISING;
  }
 else   if (sort.equals("String_Node_Str")) {
    if (t == null)     return PostListingController.Sort.TOP_ALL;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_ALL;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_HOUR;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_DAY;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_WEEK;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_MONTH;
 else     if (t.equals("String_Node_Str"))     return PostListingController.Sort.TOP_YEAR;
 else     return PostListingController.Sort.TOP_ALL;
  }
 else {
    return null;
  }
}