com.crashlytics.tools.android_2.1.0

ired argument(s) missing.");
    }
    if (properties.containsKey("tool"))
    {
      sharedWebApi.setToolId(properties.getProperty("tool"));
      if (properties.containsKey("version")) {
        sharedWebApi.setToolVersion(properties.getProperty("version"));
      }
    }
    else
    {
      Package packageInfo = DeveloperTools.class.getPackage();
      sharedWebApi.setToolId(packageInfo.getImplementationTitle());
      sharedWebApi.setToolVersion(packageInfo.getImplementationVersion());
    }
    sharedWebApi.setOperatingSystem(System.getProperty("os.name"));
    
    AndroidProject project = PROJECT_FACTORY.create(properties);
    
    DeobfuscationManager deobsManager = new DataDirDeobsManager(project, XmlBuildIdManager.createManager(project.getResourceFile()));
    
    AndroidBuildHandler buildHandler = new DefaultAndroidBuildHandler(sharedWebApi, project);
    
    String apiKey = project.getApiKey();
    String packageName = project.getPackageName();
    if ((apiKey != null) && (apiKey.matches("^0[0]*$")))
    {
      logD("Crashlytics API key is empty. To enable real-time crash reporting with Crashlytics, visit http://www.crashlytics.com.");
      return;
    }
    if ((apiKey == null) || (!isValidApiKeyFormat(apiKey))) {
      throw new IllegalArgumentException("Invalid API key: " + apiKey + ". Check the Crashlytics plugin to make sure that the application has been added successfully! Contact support@crashlytics.com for assistance.");
    }
    logD("apiKey is " + apiKey);
    
    String buildSecret = project.getBuildSecret();
    boolean buildSecretRequired = properties.containsKey("uploadDist");
    if (((buildSecret == null) && (buildSecretRequired)) || ((buildSecret != null) && (!isValidBuildSecretFormat(buildSecret)))) {
      throw new IllegalArgumentException("Invalid secret API key: " + buildSecret + ". Check the Crashlytics plugin to make sure that the application has been added successfully! Contact support@crashlytics.com for assistance.");
    }
    if (properties.containsKey("resourceCheck"))
    {
      logD("Checking for Resource");
      File resourceFile = project.getResourceFile();
      if (!resourceFile.exists())
      {
        String failMessage;
        String failMessage;
        if (packageName != null) {
          failMessage = "Your team has updated " + packageName + " to include real-time crash reporting with Crashlytics.\n" + "Confirm you're part of this team and set up Android Studio here:\n" + "https://crashlytics.com/register/" + apiKey + "/android/" + packageName;
        } else {
          failMessage = "Your team has updated this project to include real-time crash reporting with Crashlytics.\nConfirm you're part of this team and set up Android Studio here:\nhttps://crashlytics.com";
        }
        logD(failMessage);
        throw new PluginException(failMessage);
      }
    }
    if (properties.containsKey("generateResourceFile"))
    {
      if ((properties.containsKey("injectableManifest")) && (properties.containsKey("apiKey")))
      {
        logD("Generating crashlytics resources with injected API key");
        File manifestFile = project.getManifestFile();
        ManifestOnboarder onboarder = new ManifestOnboarder(apiKey, false);
        FileCode modifiableAndroidManifest = new FileCode(manifestFile);
        ManifestProvider provider = new ManifestFileProvider(project.getManifestFile());
        
        List<CodeChange.BlockChange> manifestChanges = onboarder.getChanges(provider, null);
        
        CodeChange changes = new CodeChange(manifestFile.getName(), modifiableAndroidManifest, manifestChanges);
        logD("Applying changes: " + changes);
        changes.applyChange();
      }
      else
      {
        logD("Generating crashlytics resources");
      }
      ResourceUpdateData updatedResources = buildHandler.updateBuildResources();
      logD("Set build id to " + updatedResources.getBuildId());
    }
    if (properties.containsKey("cleanupResourceFile"))
    {
      logD("Cleaning crashlytics resources");
      buildHandler.cleanBuildResources();
    }
    if ((properties.containsKey("obfuscating")) && (properties.containsKey("storeDeobs")))
    {
      logD("Caching deobfuscation file");
      File deobsFile = new File(properties.getProperty("storeDeobs"));
      if ((!properties.containsKey("obfuscator")) || (!properties.containsKey("obVer"))) {
        throw new IllegalArgumentException("storeDeobs requires obfuscator and obVer");
      }
      if (deobsFile.exists())
      {
        String obfuscator = properties.getProperty("obfuscator");
        String obfuscatorVer = properties.getProperty("obVer");
        logD("Saving deobfuscation file: " + deobsFile);
        deobsManager.storeDeobfuscationFile(deobsFile, obfuscator, obfuscatorVer);
      }
      else
      {
        logD("Crashlytics detected deobfuscation, but did not find a mapping file at " + deobsFile);
      }
    }
    if (properties.containsKey("uploadDeobs"))
    {
      logD("Uploading deobfuscation file");
      boolean hasFiles = deobsManager.hasCachedDeobfuscationFiles();
      
      DeobsUploader uploader = new DeobsUploader(getWebApi());
      if (hasFiles)
      {
        boolean requireSuccess = properties.containsKey("requireUploadSuccess");
        try
        {
          boolean result = uploader.uploadDeobfuscationFiles(deobsManager, apiKey);
          if (result)
          {
            logD("Deobfuscation file(s) uploaded.");
          }
          else
          {
            logW("Crashlytics had a problem uploading the deobs file. Please check network connectivity and try again...", null);
            if (requireSuccess) {
              throw new PluginException("Crashlytics halted compilation because it had a problem uploading the deobs file. Please check network connectivity and try again...");
            }
          }
        }
        catch (Exception e)
        {
          logW("Crashlytics had a problem uploading the deobs file. Please check network connectivity and try again.", e);
          if (requireSuccess) {
            throw new PluginException("Crashlytics halted compilation because it had a problem uploading the deobs file. Please check network connectivity and try again.", e);
          }
        }
      }
      else
      {
        logD("Crashlytics found no deobfuscation files.");
      }
    }
    if (properties.containsKey("uploadDist"))
    {
      String path = properties.getProperty("uploadDist");
      
      logD("Uploading distribution at" + path);
      DistributionUploader uploader = new DistributionUploader(getWebApi());
      try
      {
        boolean result = uploader.uploadDistribution(path, apiKey, buildSecret);
        if (result)
        {
          logD("Distribution uploaded.");
        }
        else
        {
          logW("Crashlytics had a problem uploading the distribution. Please check network connectivity and try again...", null);
          
          throw new PluginException("Crashlytics halted compilation because it had a problem uploading the distribution. Please check network connectivity and try again...");
        }
      }
      catch (Exception e)
      {
        logW("Crashlytics had a problem uploading the distribution. Please check network connectivity and try again.", e);
        throw new PluginException("Crashlytics halted compilation because it had a problem uploading the distribution. Please check network connectivity and try again.", e);
      }
    }
    if (properties.containsKey("buildEvent")) {
      buildHandler.notifyBuildEvent();
    }
  }
  
  protected static Options createOptions()
  {
    Options options = new Options();
    
    Option buildId = new Option("generateResourceFile", "Generate Crashlytics-required resources for the project.");
    
    Option deleteStrings = new Option("cleanupResourceFile", "Remove Crashlytics-generated resource files");
    OptionBuilder.withArgName("file");OptionBuilder.hasArg();OptionBuilder.withDescription("Store the specified deobfuscation file in preparation for upload.");Option saveDeobs = OptionBuilder.create("storeDeobs");
    
    Option obfuscating = new Option("obfuscating", "This build included obfuscation.");
    
    OptionBuilder.withArgName("obfuscatorId");OptionBuilder.hasArg();OptionBuilder.withDescription("Optionally specify an obfuscator vendor identifier for use with storeDeobs.");Option obfuscatorId = OptionBuilder.create("obfuscator");
    
    OptionBuilder.withArgName("obfuscatorVersion");OptionBuilder.hasArg();OptionBuilder.withDescription("Optionally specify the obfuscator vendor software version for use with obfuscator.");Option obfuscatorVer = OptionBuilder.create("obVer");
    
    Option uploadDeobs = new Option("uploadDeobs", "Attempt to upload deobfuscation file(s) to Crashlytics servers.");
    
    OptionBuilder.withArgName("file");OptionBuilder.hasArg();Option uploadDist = OptionBuilder.create("uploadDist");
    
    OptionBuilder.withArgName("path");OptionBuilder.hasArg();OptionBuilder.withDescription("Path to Android project root");Option projectPath = OptionBuilder.create("projectPath");
    
    OptionBuilder.withArgName("androidManifestPath");OptionBuilder.hasArg();OptionBuilder.withDescription("Path to AndroidManifest.xml)");Option manifestPath = OptionBuilder.create("androidManifest");
    
    OptionBuilder.withArgName("androidResPath");OptionBuilder.hasArg();OptionBuilder.withDescription("Path to Android resources (res/ folder)");Option resPath = OptionBuilder.create("androidRes");
    
    OptionBuilder.withArgName("androidAssetsPath");OptionBuilder.hasArg();OptionBuilder.withDescription("Path to Android assets (assets/ folder)");Option assetsPath = OptionBuilder.create("androidAssets");
    
    OptionBuilder.withArgName("key");OptionBuilder.hasArg();OptionBuilder.withDescription("API Secret for the project");Option buildSecret = OptionBuilder.create("apiSecret");
    
    Option verbose = new Option("verbose", "Verbose command line output");
    Option quiet = new Option("quiet", "Silent command line output");
    Option help = new Option("help", "Display command help.");
    
    Option check = new Option("resourceCheck", "Check if a resource file already exists.");
    OptionBuilder.withArgName("toolarg");OptionBuilder.hasArg();OptionBuilder.withDescription("Name of the build tool");Option toolName = OptionBuilder.create("tool");
    
    OptionBuilder.withArgName("versionarg");OptionBuilder.hasArg();OptionBuilder.withDescription("Version of the build tool");Option toolVersion = OptionBuilder.create("version");
    
    OptionBuilder.withArgName("propertiesarg");OptionBuilder.hasArg();OptionBuilder.withDescription("Properties file that overrides the input properties");Option propertiesPath = OptionBuilder.create("properties");
    
    Option buildEvent = new Option("buildEvent", "Notify Crashlytics that a build event has occurred");
    
    Option requireUploadSuccess = new Option("requireUploadSuccess", "Throw an exception if the deobfuscation upload was not successful");
    
    Option injectableManifest = new Option("injectableManifest", "If the manifest is in a build folder and can be modified during the build.");
    
    OptionBuilder.withArgName("apiKeyarg");OptionBuilder.hasArg();OptionBuilder.withDescription("If the Manifest is injectable, this api key will be added to it.");Option apiKey = OptionBuilder.create("apiKey");
    
    OptionBuilder.withArgName("renamedPackagearg");OptionBuilder.hasArg();OptionBuilder.withDescription("Package name to override the original project package found in the Manifest");Option renamedPackage = OptionBuilder.create("renamedPackage");
    
    options.addOption(buildId);
    options.addOption(deleteStrings);
    options.addOption(saveDeobs);
    options.addOption(obfuscating);
    options.addOption(obfuscatorId);
    options.addOption(obfuscatorVer);
    options.addOption(uploadDeobs);
    options.addOption(uploadDist);
    options.addOption(projectPath);
    options.addOption(manifestPath);
    options.addOption(quiet);
    options.addOption(resPath);
    options.addOption(assetsPath);
    options.addOption(buildSecret);
    options.addOption(verbose);
    options.addOption(help);
    options.addOption(check);
    options.addOption(requireUploadSuccess);
    options.addOption(toolName);
    options.addOption(toolVersion);
    options.addOption(buildEvent);
    options.addOption(propertiesPath);
    options.addOption(injectableManifest);
    options.addOption(apiKey);
    options.addOption(renamedPackage);
    
    return options;
  }
  
  public static abstract interface Logger
  {
    public abstract void logD(String paramString);
    
    public abstract void logI(String paramString);
    
    public abstract void logW(String paramString, Throwable paramThrowable);
    
    public abstract void logE(String paramString, Throwable paramThrowable);
  }
  
  public static class MultiLogger
    implements DeveloperTools.Logger
  {
    private final DeveloperTools.Logger[] _loggers;
    
    public MultiLogger(DeveloperTools.Logger... loggers)
    {
      _loggers = loggers;
    }
    
    public synchronized void logD(String msg)
    {
      for (DeveloperTools.Logger l : _loggers) {
        l.logD(msg);
      }
    }
    
    public synchronized void logI(String msg)
    {
      for (DeveloperTools.Logger l : _loggers) {
        l.logI(msg);
      }
    }
    
    public synchronized void logW(String msg, Throwable t)
    {
      for (DeveloperTools.Logger l : _loggers) {
        l.logW(msg, t);
      }
    }
    
    public synchronized void logE(String msg, Throwable t)
    {
      for (DeveloperTools.Logger l : _loggers) {
        l.logE(msg, t);
      }
    }
  }
  
  public static class L4JWrappedLogger
    implements DeveloperTools.Logger
  {
    private final Logger _logger;
    
    public L4JWrappedLogger(Logger logger)
    {
      _logger = logger;
    }
    
    public synchronized void logD(String msg)
    {
      _logger.debug(msg);
    }
    
    public synchronized void logI(String msg)
    {
      _logger.info(msg);
    }
    
    public synchronized void logW(String msg, Throwable t)
    {
      _logger.warn(msg, t);
    }
    
    public synchronized void logE(String msg, Throwable t)
    {
      _logger.error(msg, t);
    }
  }
  
  public static class StdOutLogger
    implements DeveloperTools.Logger
  {
    public synchronized void logD(String msg)
    {
      System.out.println("[CLSLOG DEBUG] " + msg);
    }
    
    public synchronized void logI(String msg)
    {
      System.out.println("[CLSLOG INFO] " + msg);
    }
    
    public synchronized void logW(String msg, Throwable t)
    {
      System.out.println("[CLSLOG WARN] " + msg);
      if (t != null)
      {
        System.err.println(t);
        t.printStackTrace();
      }
    }
    
    public synchronized void logE(String msg, Throwable t)
    {
      System.err.println("[CLSLOG ERR] " + msg);
      if (t != null)
      {
        System.err.println(t);
        t.printStackTrace();
      }
    }
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.DeveloperTools
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.io.InputStream;

public class EmptySDK
  implements SDK
{
  public boolean exists()
  {
    return false;
  }
  
  public String getVersion()
  {
    return null;
  }
  
  public InputStream getStream()
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.EmptySDK
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import com.crashlytics.tools.utils.FileUtils;
import com.crashlytics.tools.utils.JarUtils;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.jar.Manifest;

public class FileBasedSDK
  implements PersistedSDK
{
  private File _location;
  
  public FileBasedSDK(File location)
  {
    _location = location;
  }
  
  public boolean exists()
  {
    return (_location != null) && (_location.exists());
  }
  
  public String toString()
  {
    if (_location != null) {
      return String.format("SDK File:( %s )", new Object[] { _location.getAbsolutePath() });
    }
    return String.format("SDK File:( empty )", new Object[0]);
  }
  
  public File getLocation()
  {
    return _location;
  }
  
  public String getVersion()
  {
    if (_location == null) {
      return null;
    }
    Manifest manifest = JarUtils.getMaybeManifest(_location);
    if (manifest == null) {
      return null;
    }
    return JarUtils.getVersion(manifest, "com/crashlytics/android/");
  }
  
  public void replaceWith(SDK replacementSDK)
  {
    if (replacementSDK.exists())
    {
      FileOutputStream fos = null;
      try
      {
        fos = new FileOutputStream(_location, false);
        FileUtils.redirect(replacementSDK.getStream(), fos);
        fos.flush();
      }
      catch (Exception e)
      {
        DeveloperTools.logE("An error occurred creating the default SDK at " + _location, e);
      }
      finally
      {
        closeIfNonNull(fos, "SDK Stream");
      }
    }
    else
    {
      DeveloperTools.logI("Crashlytics could not replace an SDK with an empty one.");
    }
  }
  
  private void closeIfNonNull(Closeable closable, String name)
  {
    if (closable != null) {
      try
      {
        closable.close();
      }
      catch (IOException e)
      {
        DeveloperTools.logE("Could not close " + name, e);
      }
    }
  }
  
  public InputStream getStream()
  {
    try
    {
      return new FileInputStream(_location);
    }
    catch (FileNotFoundException e)
    {
      DeveloperTools.logE("Crashlytics could not create a file stream for an sdk.", e);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.FileBasedSDK
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.io.File;
import java.io.IOException;
import java.util.List;

public abstract interface ObfuscatorConfig
{
  public abstract void updateConfig(List<File> paramList)
    throws IOException;
  
  public abstract boolean isObsfucationEnabled();
  
  public abstract File getDeobfuscationFile();
  
  public abstract String getObfuscatorId();
  
  public abstract String getObfuscatorVersion();
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.ObfuscatorConfig
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.io.File;
import java.io.InputStream;

class OldSDKFactory$ForcedOldPersistedSDK
  implements PersistedSDK
{
  private PersistedSDK _parentSDK;
  
  public OldSDKFactory$ForcedOldPersistedSDK(PersistedSDK parentSDK)
  {
    _parentSDK = parentSDK;
  }
  
  public boolean exists()
  {
    return _parentSDK.exists();
  }
  
  public String toString()
  {
    return String.format("Old: %s", new Object[] { _parentSDK.toString() });
  }
  
  public String getVersion()
  {
    return "0.0.0";
  }
  
  public InputStream getStream()
  {
    return _parentSDK.getStream();
  }
  
  public void replaceWith(SDK sdk)
  {
    _parentSDK.replaceWith(sdk);
  }
  
  public File getLocation()
  {
    return _parentSDK.getLocation();
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.OldSDKFactory.ForcedOldPersistedSDK
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.io.InputStream;

class OldSDKFactory$ForcedOldSDK
  implements SDK
{
  private SDK _parentSDK;
  
  public OldSDKFactory$ForcedOldSDK(SDK parentSDK)
  {
    _parentSDK = parentSDK;
  }
  
  public boolean exists()
  {
    return _parentSDK.exists();
  }
  
  public String toString()
  {
    return String.format("Old: %s", new Object[] { _parentSDK.toString() });
  }
  
  public String getVersion()
  {
    return "0.0.0";
  }
  
  public InputStream getStream()
  {
    return _parentSDK.getStream();
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.OldSDKFactory.ForcedOldSDK
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.io.File;
import java.io.InputStream;

public class OldSDKFactory
  implements SDKFactory
{
  public PersistedSDK createFromFile(File sdk)
  {
    return new ForcedOldPersistedSDK(new FileBasedSDK(sdk));
  }
  
  public SDK createFromStream(InputStream stream)
  {
    return new ForcedOldSDK(new StreamBasedSDK(stream));
  }
  
  private static class ForcedOldPersistedSDK
    implements PersistedSDK
  {
    private PersistedSDK _parentSDK;
    
    public ForcedOldPersistedSDK(PersistedSDK parentSDK)
    {
      _parentSDK = parentSDK;
    }
    
    public boolean exists()
    {
      return _parentSDK.exists();
    }
    
    public String toString()
    {
      return String.format("Old: %s", new Object[] { _parentSDK.toString() });
    }
    
    public String getVersion()
    {
      return "0.0.0";
    }
    
    public InputStream getStream()
    {
      return _parentSDK.getStream();
    }
    
    public void replaceWith(SDK sdk)
    {
      _parentSDK.replaceWith(sdk);
    }
    
    public File getLocation()
    {
      return _parentSDK.getLocation();
    }
  }
  
  private static class ForcedOldSDK
    implements SDK
  {
    private SDK _parentSDK;
    
    public ForcedOldSDK(SDK parentSDK)
    {
      _parentSDK = parentSDK;
    }
    
    public boolean exists()
    {
      return _parentSDK.exists();
    }
    
    public String toString()
    {
      return String.format("Old: %s", new Object[] { _parentSDK.toString() });
    }
    
    public String getVersion()
    {
      return "0.0.0";
    }
    
    public InputStream getStream()
    {
      return _parentSDK.getStream();
    }
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.OldSDKFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.io.File;

public abstract interface PersistedSDK
  extends SDK
{
  public abstract void replaceWith(SDK paramSDK);
  
  public abstract File getLocation();
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.PersistedSDK
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.io.IOException;

public class ReleaseNotesManager$ReleaseNotesCommitException
  extends IOException
{
  private static final long serialVersionUID = 8368676710690552969L;
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.ReleaseNotesManager.ReleaseNotesCommitException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import com.crashlytics.api.WebApi;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FileUtils;

public abstract class ReleaseNotesManager
{
  public static final String HAS_UPDATED_RELEASE_NOTES_KEY = "com.crashlytics.tools.ide.Ide.HAS_UPDATED_RELEASE_NOTES";
  public static final String HAS_UPDATED_RELEASE_NOTES_DEFAULT = "false";
  private static final String RELEASE_NOTES_FILE_NAME = "release_notes.html";
  private static final String RELEASE_NOTES_FILE_NAME_TMP = "release_notes.html.dl";
  private File _releaseNotesDir;
  
  public ReleaseNotesManager(File dataDir)
  {
    _releaseNotesDir = new File(dataDir, ".release_notes");
    if (!_releaseNotesDir.exists()) {
      _releaseNotesDir.mkdirs();
    }
  }
  
  protected File getReleaseNotesDir()
  {
    return _releaseNotesDir;
  }
  
  public abstract String getReleaseNotesUrl();
  
  public abstract String getBuiltInReleaseNotesPath();
  
  public abstract boolean hasReleaseNotesUpdate();
  
  public abstract void setHasReleaseNotesUpdate(boolean paramBoolean);
  
  public boolean downloadReleaseNotes()
  {
    String releaseNotesUrl = getReleaseNotesUrl();
    File destination = getReleaseNotesFileTemp();
    DeveloperTools.logD("Downloading release notes from " + releaseNotesUrl + " to " + destination.getAbsolutePath());
    
    boolean downloadSuccess = false;
    try
    {
      downloadSuccess = DeveloperTools.getWebApi().downloadFile(new URL(releaseNotesUrl), destination);
    }
    catch (IOException e)
    {
      DeveloperTools.logW("Failed to download release notes.", e);
      destination.delete();
      return false;
    }
    if (!downloadSuccess)
    {
      DeveloperTools.logW("Failed to download release notes.", null);
      destination.delete();
    }
    return downloadSuccess;
  }
  
  public File getReleaseNotesFile()
  {
    return new File(_releaseNotesDir, "release_notes.html");
  }
  
  public File getReleaseNotesFileTemp()
  {
    return new File(_releaseNotesDir, "release_notes.html.dl");
  }
  
  public boolean commitDownloadedReleaseNotes()
    throws ReleaseNotesManager.ReleaseNotesCommitException
  {
    boolean success = true;
    
    File oldReleaseNotes = getReleaseNotesFile();
    File newReleaseNotes = getReleaseNotesFileTemp();
    
    String newSha = null;String oldSha = null;
    if ((oldReleaseNotes.exists()) && (newReleaseNotes.exists())) {
      try
      {
        byte[] oldBytes = FileUtils.readFileToByteArray(oldReleaseNotes);
        byte[] newBytes = FileUtils.readFileToByteArray(newReleaseNotes);
        oldSha = DigestUtils.shaHex(oldBytes);
        newSha = DigestUtils.shaHex(newBytes);
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
    }
    boolean changed = (hasReleaseNotesUpdate()) || (oldSha == null) || (newSha == null) || (!oldSha.equals(newSha));
    if (newReleaseNotes.exists())
    {
      success &= ((oldReleaseNotes.delete()) || (!oldReleaseNotes.exists()));
      success &= newReleaseNotes.renameTo(oldReleaseNotes);
    }
    else
    {
      success = false;
    }
    if (!success) {
      throw new ReleaseNotesCommitException();
    }
    setHasReleaseNotesUpdate(changed);
    return changed;
  }
  
  public InputStream getReleaseNotesInput()
    throws IOException
  {
    return new FileInputStream(getReleaseNotesFile());
  }
  
  public static class ReleaseNotesCommitException
    extends IOException
  {
    private static final long serialVersionUID = 8368676710690552969L;
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.ReleaseNotesManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.io.InputStream;

public abstract interface SDK
{
  public static final String CRASHLYTICS_ATTRIBUTES_KEY = "com/crashlytics/android/";
  
  public abstract boolean exists();
  
  public abstract String getVersion();
  
  public abstract InputStream getStream();
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.SDK
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.io.File;
import java.io.InputStream;

public abstract interface SDKFactory
{
  public abstract SDK createFromStream(InputStream paramInputStream);
  
  public abstract PersistedSDK createFromFile(File paramFile);
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.SDKFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import com.crashlytics.api.WebApi;
import java.io.IOException;

public abstract interface SDKManager
{
  public abstract boolean copyCachedSDK(String paramString, PersistedSDK paramPersistedSDK)
    throws IOException;
  
  public abstract boolean updateCachedSDK(WebApi paramWebApi, String paramString)
    throws IOException;
  
  public abstract void dispose();
  
  public abstract void addSDKManagerListener(SDKManagerListener paramSDKManagerListener);
  
  public abstract void removeSDKManagerListener(SDKManagerListener paramSDKManagerListener);
  
  public abstract boolean isSdkAvailable(String paramString);
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.SDKManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

public abstract interface SDKManagerListener
{
  public abstract void onNewReleaseNotesAvailable();
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.SDKManagerListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import com.crashlytics.tools.utils.JarUtils;
import java.io.IOException;
import java.io.InputStream;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;

public class StreamBasedSDK
  implements SDK
{
  private InputStream _inputStream;
  
  public StreamBasedSDK(InputStream inputStream)
  {
    _inputStream = inputStream;
  }
  
  public boolean exists()
  {
    return _inputStream != null;
  }
  
  public String toString()
  {
    if (_inputStream != null) {
      return String.format("SDK stream:( empty )", new Object[0]);
    }
    return String.format("SDK stream:( %s )", new Object[] { Integer.valueOf(_inputStream.hashCode()) });
  }
  
  public String getVersion()
  {
    if (_inputStream == null) {
      return null;
    }
    JarInputStream jarStream = null;
    try
    {
      jarStream = new JarInputStream(_inputStream);
      try
      {
        jarStream.close();
      }
      catch (IOException e)
      {
        DeveloperTools.logE("Crashlytics could not close manifest jar.", e);
      }
      manifest = jarStream.getManifest();
    }
    catch (IOException e)
    {
      DeveloperTools.logW("Crashlytics could not get version information from manifest.", e);
    }
    finally
    {
      try
      {
        jarStream.close();
      }
      catch (IOException e)
      {
        DeveloperTools.logE("Crashlytics could not close manifest jar.", e);
      }
    }
    Manifest manifest;
    String verison = null;
    if (manifest != null) {
      verison = JarUtils.getVersion(manifest, "com/crashlytics/android/");
    }
    return verison;
  }
  
  public InputStream getStream()
  {
    return _inputStream;
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.StreamBasedSDK
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.util.concurrent.Callable;

class ThreadedSDKManager$1
  implements Callable<Boolean>
{
  ThreadedSDKManager$1(ThreadedSDKManager paramThreadedSDKManager, String paramString, PersistedSDK paramPersistedSDK) {}
  
  public Boolean call()
    throws Exception
  {
    return Boolean.valueOf(ThreadedSDKManager.access$000(this$0).copyCachedSDK(val$apiKey, val$currentSDK));
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.ThreadedSDKManager.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import com.crashlytics.api.WebApi;
import java.util.concurrent.Callable;

class ThreadedSDKManager$2
  implements Callable<Boolean>
{
  ThreadedSDKManager$2(ThreadedSDKManager paramThreadedSDKManager, WebApi paramWebApi, String paramString) {}
  
  public Boolean call()
    throws Exception
  {
    return Boolean.valueOf(ThreadedSDKManager.access$000(this$0).updateCachedSDK(val$api, val$apiKey));
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.ThreadedSDKManager.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

class ThreadedSDKManager$3
  implements Runnable
{
  ThreadedSDKManager$3(ThreadedSDKManager paramThreadedSDKManager) {}
  
  public void run()
  {
    ThreadedSDKManager.access$000(this$0).dispose();
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.ThreadedSDKManager.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.util.concurrent.Callable;

class ThreadedSDKManager$4
  implements Callable<Void>
{
  ThreadedSDKManager$4(ThreadedSDKManager paramThreadedSDKManager, SDKManagerListener paramSDKManagerListener) {}
  
  public Void call()
    throws Exception
  {
    ThreadedSDKManager.access$000(this$0).addSDKManagerListener(val$listener);
    return null;
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.ThreadedSDKManager.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.util.concurrent.Callable;

class ThreadedSDKManager$5
  implements Callable<Void>
{
  ThreadedSDKManager$5(ThreadedSDKManager paramThreadedSDKManager, SDKManagerListener paramSDKManagerListener) {}
  
  public Void call()
    throws Exception
  {
    ThreadedSDKManager.access$000(this$0).removeSDKManagerListener(val$listener);
    return null;
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.ThreadedSDKManager.5
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import java.util.concurrent.Callable;

class ThreadedSDKManager$6
  implements Callable<Boolean>
{
  ThreadedSDKManager$6(ThreadedSDKManager paramThreadedSDKManager, String paramString) {}
  
  public Boolean call()
    throws Exception
  {
    return Boolean.valueOf(ThreadedSDKManager.access$000(this$0).isSdkAvailable(val$apiKey));
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.ThreadedSDKManager.6
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android;

import com.crashlytics.api.WebApi;
import java.io.IOException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;

public class ThreadedSDKManager
  implements SDKManager
{
  private final ScheduledExecutorService _sdkExecutor = Executors.newSingleThreadScheduledExecutor();
  private final SDKManager _manager;
  
  public ThreadedSDKManager(SDKManager manager)
  {
    _manager = manager;
  }
  
  public boolean copyCachedSDK(final String apiKey, final PersistedSDK currentSDK)
    throws IOException
  {
    try
    {
      ((Boolean)_sdkExecutor.submit(new Callable()
      {
        public Boolean call()
          throws Exception
        {
          return Boolean.valueOf(_manager.copyCachedSDK(apiKey, currentSDK));
        }
      }).get()).booleanValue();
    }
    catch (InterruptedException e)
    {
      DeveloperTools.logD("Crashlytics was interrupted during its update of the SDK for api key " + apiKey);
    }
    catch (ExecutionException e)
    {
      DeveloperTools.logE("Crashlytics execution failed during its update of the SDK for api key " + apiKey, e);
    }
    return false;
  }
  
  public boolean updateCachedSDK(final WebApi api, final String apiKey)
    throws IOException
  {
    try
    {
      ((Boolean)_sdkExecutor.submit(new Callable()
      {
        public Boolean call()
          throws Exception
        {
          return Boolean.valueOf(_manager.updateCachedSDK(api, apiKey));
        }
      }).get()).booleanValue();
    }
    catch (InterruptedException e)
    {
      DeveloperTools.logE("Crashlytics was interrupted during its update of the SDK for api key " + apiKey, e);
    }
    catch (ExecutionException e)
    {
      DeveloperTools.logE("Crashlytics execution failed during its update of the SDK for api key " + apiKey, e);
    }
    return false;
  }
  
  public void dispose()
  {
    DeveloperTools.logD("Crashlytics is shutting down the SDK...");
    _sdkExecutor.submit(new Runnable()
    {
      public void run()
      {
        _manager.dispose();
      }
    });
    _sdkExecutor.shutdown();
  }
  
  public void addSDKManagerListener(final SDKManagerListener listener)
  {
    try
    {
      _sdkExecutor.submit(new Callable()
      {
        public Void call()
          throws Exception
        {
          _manager.addSDKManagerListener(listener);
          return null;
        }
      }).get();
    }
    catch (InterruptedException e)
    {
      DeveloperTools.logE("Crashlytics was interrupted during adding a listener to the SDK manager", e);
    }
    catch (ExecutionException e)
    {
      DeveloperTools.logE("Crashlytics execution failed during adding a listener to the SDK manager", e);
    }
  }
  
  public void removeSDKManagerListener(final SDKManagerListener listener)
  {
    try
    {
      _sdkExecutor.submit(new Callable()
      {
        public Void call()
          throws Exception
        {
          _manager.removeSDKManagerListener(listener);
          return null;
        }
      }).get();
    }
    catch (InterruptedException e)
    {
      DeveloperTools.logE("Crashlytics was interrupted during removal a listener to of the SDK manager", e);
    }
    catch (ExecutionException e)
    {
      DeveloperTools.logE("Crashlytics execution failed during removal a listener to of the SDK manager", e);
    }
  }
  
  public boolean isSdkAvailable(final String apiKey)
  {
    try
    {
      ((Boolean)_sdkExecutor.submit(new Callable()
      {
        public Boolean call()
          throws Exception
        {
          return Boolean.valueOf(_manager.isSdkAvailable(apiKey));
        }
      }).get()).booleanValue();
    }
    catch (InterruptedException e)
    {
      DeveloperTools.logE("Crashlytics was interrupted during adding a listener to the SDK manager", e);
    }
    catch (ExecutionException e)
    {
      DeveloperTools.logE("Crashlytics execution failed during adding a listener to the SDK manager", e);
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.ThreadedSDKManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android.onboard;

class AndroidGradleOnboarder$LineNotFoundException
  extends Exception
{
  public AndroidGradleOnboarder$LineNotFoundException(AndroidGradleOnboarder paramAndroidGradleOnboarder, String lineDescription)
  {
    super(lineDescription);
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.tools.android.onboard.AndroidGradleOnboarder.LineNotFoundException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.tools.android.onboard;

import com.crashlytics.tools.android.DeveloperTools;
import com.crashlytics.tools.utils.GradleParser;
import com.crashlytics.tools.utils.GradleParser.SearchResult;
import com.crashlytics.tools.utils.GradleUtils;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

public class AndroidGradleOnboarder
{
  private final Repository _pluginRepository;
  private final Repository _moduleRepository;
  private final List<Module> _modules;
  private final GradleParser _parser;
  private final Code _code;
  
  public static AndroidGradleOnboarder createDefaultAndroidGradleOnboarder(GradleParser parser, Code code)
  {
    List<Module> modules = Arrays.asList(new Module[] { OnboardingConstants.CRASHLYTICS_DEPENDENCY });
    return new AndroidGradleOnboarder(OnboardingConstants.CRASHLYTICS_REPOSITORY, OnboardingConstants.CRASHLYTICS_REPOSITORY, modules, parser, code);
  }
  
  public AndroidGradleOnboarder(Repository pluginRepository, Repository moduleRepository, List<Module> modules, GradleParser parser, Code code)
  {
    _pluginRepository = pluginRepository;
    _moduleRepository = moduleRepository;
    _modules = modules
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd