Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-427

Access file error exception when RuntimeIndexSelector trying to load indexes from zip file

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.1.0
    • 6.0.0
    • Common
    • None
    • Low

      loadIndexesFromZipFile() method extract folders as file, during the unzip process, this cause an access file error, because the directories will included into the array indexes.

      [code]
      File entryFile = new File(getIndexDirectoryPath(), entry.getName());
      FileUtils.write(zipInputStream, entryFile, length);

      if (SimpleIndexUtil.indexFileExists(entryFile))

      { tmp.add(new Index(entryFile.getAbsolutePath(), true)); }
      [/code]

      I tried this solution, it seems to work:

      [code]
      File entryFile = new File(getIndexDirectoryPath(), entry.getName());
      if (entry.isDirectory()) { entryFile.mkdir(); } else { FileUtils.write(zipInputStream, entryFile, length); }

      if (SimpleIndexUtil.indexFileExists(entryFile)) { tmp.add(new Index(entryFile.getAbsolutePath(), true)); }

      [/code]

      In this case the indexFileExist() excludes all the directories, form the array indexes.

              rhn-engineering-shawkins Steven Hawkins
              sincande@redhat.com Salvatore Incandela (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: