mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Gaetan Boismal
01.07.2016 ed3930daea274cb0f46d77f728f4482c69c48a03
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
@@ -81,6 +81,9 @@
  /** A flag for marking 'rebuild all' task accepted by user. */
  static boolean isRebuildAllIndexesTaskAccepted;
  private static final List<String> SUPPORTED_LOCALES_FOR_3_0_0 = Arrays.asList(
      "ca_ES", "de", "es", "fr", "ja", "ko", "pl", "zh_CN", "zh_TW");
  /**
   * Returns a new upgrade task which adds a config entry to the underlying
   * config file.
@@ -1314,6 +1317,45 @@
    };
  }
  /** Removes server and localized jars from previous version since names have changed. */
  static UpgradeTask removeOldJarFiles()
  {
    return new AbstractUpgradeTask()
    {
      @Override
      public void perform(final UpgradeContext context) throws ClientException
      {
        final ProgressNotificationCallback pnc = new ProgressNotificationCallback(
            INFORMATION, INFO_UPGRADE_TASK_REMOVE_OLD_JARS.get(), 0);
        context.notifyProgress(pnc);
        for (final String locale : SUPPORTED_LOCALES_FOR_3_0_0)
        {
          deleteJarFileIfExists("OpenDJ_" + locale);
          deleteJarFileIfExists("OpenDJ-" + locale);
        }
        deleteJarFileIfExists("OpenDJ",
            // Jar files from 2.6.x
            "jackson-core-asl", "jackson-mapper-asl", "json-fluent", "json-resource-servlet",
            "mail", "opendj-ldap-sdk", "opendj-rest2ldap-servlet", "opendj-server2x-adapter");
        context.notifyProgress(pnc.setProgress(100));
      }
      private void deleteJarFileIfExists(final String... jarFileNames)
      {
        for (final String jarFileName : jarFileNames)
        {
          final File f = new File(libDirectory, jarFileName + ".jar");
          if (f.exists())
          {
            f.delete();
          }
        }
      }
    };
  }
  /** Prevent instantiation. */
  private UpgradeTasks()
  {