Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-2309

Normal Zip file which put into the deploy folder can't be deleted anymore

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.1
    • Fix Version/s: 2.3.2, 2.4.0, 3.0.0
    • Component/s: karaf-kar
    • Labels:
      None
    • Environment:

      Win7, java 7

      Description

      If user put a normal zip file into deploy folder (has not META-INF/KARAF.MF), then, this zip file can't be removed anymore due to karaf still open it.

        Activity

        Hide
        xldai Xilai Dai added a comment -

        the fix could be simple just invoke close() on the zipfile in the canHandle() method of org.apache.karaf.deployer.kar.KarArtifactInstaller, like this:

                    ZipFile zipFile = null;
                    try {
                        zipFile = new ZipFile(file);
                        if (zipFile.getEntry("META-INF/KARAF.MF") != null) {
                            logger.info("Found a Karaf archive with .zip prefix; will deploy.");
                            return true;
                        }
                    } catch (Exception e) {
                        logger.warn("Problem extracting zip file '{}'; ignoring.", file.getName(), e);
                    } finally {
                        zipFile.close();
                    }
        
        Show
        xldai Xilai Dai added a comment - the fix could be simple just invoke close() on the zipfile in the canHandle() method of org.apache.karaf.deployer.kar.KarArtifactInstaller, like this: ZipFile zipFile = null ; try { zipFile = new ZipFile(file); if (zipFile.getEntry( "META-INF/KARAF.MF" ) != null ) { logger.info( "Found a Karaf archive with .zip prefix; will deploy." ); return true ; } } catch (Exception e) { logger.warn( "Problem extracting zip file '{}'; ignoring." , file.getName(), e); } finally { zipFile.close(); }

          People

          • Assignee:
            ffang Freeman Fang
            Reporter:
            xldai Xilai Dai
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development