Пример #1
0
  /**
   * Remove xml files and zipFile.
   *
   * @param zipFile
   */
  private static void removeSendedFiles(File zipFile) {
    IPath pluginSaveFolder = FeedbackUtils.getFeedbackSaveFolder();
    java.io.File source = pluginSaveFolder.toFile();
    List<java.io.File> fileList = FileHelper.listAll(source);
    for (java.io.File f : fileList) {
      if (f.getName().endsWith(FeedbackUtils.END_FILE_NAME)) {
        f.delete();
      }
    }

    try {
      File.umount(true);
    } catch (ArchiveException e) {
      e.printStackTrace();
    }

    // Delete with trueZip function doesn't work
    java.io.File testFile = new java.io.File(source, FeedbackActivator.ZIP_FILE_NAME);
    if (testFile.exists()) {
      try {
        testFile.delete();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
Пример #2
0
  /** Send all *-log.xml files to blueXml server. */
  protected static boolean send() {
    File zipFile = null;
    boolean noError = true;
    // Zip creation
    try {
      zipFile = createZip();
    } catch (ArchiveException e) {
      e.printStackTrace();
      noError = false;
    }

    if (zipFile != null && zipFile.list() != null && zipFile.list().length > 0) {
      // Send it
      try {
        sendFile(zipFile);
        // Remove all files send previously
        removeSendedFiles(zipFile);
      } catch (Exception e) {
        e.printStackTrace();
        noError = false;
      }
    }
    return noError;
  }