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

Fabio Pistolesi
28.33.2015 7b234a46f87e6a4cf1fbd196d624c036e5870c08
Fix path canonization while computing the progressive number of the backup file. 
1 files modified
6 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/util/BackupManager.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/util/BackupManager.java
@@ -1617,16 +1617,16 @@
   */
  private static int getHighestSuffixNumberForPath(final String basePath) throws IOException
  {
    final File baseFile = new File(basePath);
    final File baseFile = new File(basePath).getCanonicalFile();
    final File[] existingFiles = baseFile.getParentFile().listFiles();
    final Pattern pattern = Pattern.compile(basePath + "\\d*");
    final Pattern pattern = Pattern.compile(baseFile + "\\d*");
    int highestNumber = 0;
    for (File file : existingFiles)
    {
      final String name = file.getCanonicalPath();
      if (pattern.matcher(name).matches())
      {
        String numberAsString = name.substring(basePath.length());
        String numberAsString = name.substring(baseFile.getPath().length());
        int number = numberAsString.isEmpty() ? 0 : Integer.valueOf(numberAsString);
        highestNumber = number > highestNumber ? number : highestNumber;
      }