package com.loopj.android.http;

import android.os.SystemClock;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.HashSet;
import java.util.Iterator;
import javax.net.ssl.SSLHandshakeException;
import org.apache.http.NoHttpResponseException;
import org.apache.http.client.HttpRequestRetryHandler;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.protocol.HttpContext;

class RetryHandler
  implements HttpRequestRetryHandler
{
  private static final int RETRY_SLEEP_TIME_MILLIS = 1500;
  private static HashSet<Class<?>> exceptionBlacklist;
  private static HashSet<Class<?>> exceptionWhitelist = new HashSet();
  private final int maxRetries;

  static
  {
    exceptionBlacklist = new HashSet();
    exceptionWhitelist.add(NoHttpResponseException.class);
    exceptionWhitelist.add(UnknownHostException.class);
    exceptionWhitelist.add(SocketException.class);
    exceptionBlacklist.add(InterruptedIOException.class);
    exceptionBlacklist.add(SSLHandshakeException.class);
  }

  public RetryHandler(int paramInt)
  {
    this.maxRetries = paramInt;
  }

  protected boolean isInList(HashSet<Class<?>> paramHashSet, Throwable paramThrowable)
  {
    Iterator localIterator = paramHashSet.iterator();
    while (localIterator.hasNext())
      if (((Class)localIterator.next()).isInstance(paramThrowable))
        return true;
    return false;
  }

  public boolean retryRequest(IOException paramIOException, int paramInt, HttpContext paramHttpContext)
  {
    boolean bool1 = true;
    Boolean localBoolean = (Boolean)paramHttpContext.getAttribute("http.request_sent");
    boolean bool2;
    boolean bool3;
    if ((localBoolean != null) && (localBoolean.booleanValue()))
    {
      bool2 = bool1;
      if (paramInt <= this.maxRetries)
        break label93;
      bool3 = false;
    }
    while (true)
    {
      label44: if (bool3)
        if (((HttpUriRequest)paramHttpContext.getAttribute("http.request")).getMethod().equals("POST"));
      while (true)
      {
        if (bool1)
        {
          SystemClock.sleep(1500L);
          return bool1;
          bool2 = false;
          break;
          label93: if (isInList(exceptionBlacklist, paramIOException))
          {
            bool3 = false;
            break label44;
          }
          if (isInList(exceptionWhitelist, paramIOException))
          {
            bool3 = bool1;
            break label44;
          }
          if (bool2)
            break label160;
          bool3 = bool1;
          break label44;
          bool1 = false;
          continue;
        }
        paramIOException.printStackTrace();
        return bool1;
        bool1 = bool3;
      }
      label160: bool3 = bool1;
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.loopj.android.http.RetryHandler
 * JD-Core Version:    0.6.2
 */