Ejemplo n.º 1
0
 /**
  * Iterates over the contents of the pluginJarFile to find the sauce-connect-3.0.jar file.
  *
  * @param jarFileEntry
  * @param updatedSauceConnectJarFile
  * @throws java.io.IOException
  */
 private void search(TFile jarFileEntry, TFile updatedSauceConnectJarFile) throws IOException {
   if (jarFileEntry.getName().endsWith("sauce-connect-3.0.jar")) {
     update(jarFileEntry, updatedSauceConnectJarFile);
   } else if (jarFileEntry.isDirectory()) {
     for (TFile member : jarFileEntry.listFiles()) search(member, updatedSauceConnectJarFile);
   }
 }
Ejemplo n.º 2
0
  /** {@inheritDoc} */
  @Override
  public void execute() throws NoSuchFileOrDirectory, ExecutionException {
    if (isTrace()) {
      Log.v(TAG, String.format("Deleting directory: %s", this.mPath)); // $NON-NLS-1$
    }

    TFile f = getConsole().buildRealFile(this.mPath);
    if (!f.exists()) {
      if (isTrace()) {
        Log.v(TAG, "Result: FAIL. NoSuchFileOrDirectory"); // $NON-NLS-1$
      }
      throw new NoSuchFileOrDirectory(this.mPath);
    }

    // Check that if the path exist, it need to be a folder. Otherwise something is
    // wrong
    if (f.exists() && !f.isDirectory()) {
      if (isTrace()) {
        Log.v(TAG, "Result: FAIL. ExecutionException"); // $NON-NLS-1$
      }
      throw new ExecutionException("the path exists but is not a folder"); // $NON-NLS-1$
    }

    // Delete the file
    if (!FileHelper.deleteFolder(f)) {
      if (isTrace()) {
        Log.v(TAG, "Result: FAIL. ExecutionException"); // $NON-NLS-1$
      }
      throw new ExecutionException("Failed to delete directory");
    }

    if (isTrace()) {
      Log.v(TAG, "Result: OK"); // $NON-NLS-1$
    }
  }