Wouter Born created KARAF-5533:
----------------------------------

             Summary: KarArtifactInstaller does not properly detect already 
installed KAR files
                 Key: KARAF-5533
                 URL: https://issues.apache.org/jira/browse/KARAF-5533
             Project: Karaf
          Issue Type: Bug
          Components: karaf-kar
    Affects Versions: 4.2.0.M1, 4.1.3
         Environment: All platforms
            Reporter: Wouter Born


When Karaf is restarted the KarArtifactInstaller does not properly detect that 
a previously installed KAR is already installed. As a result it always proceeds 
to reinstall the KAR which casues to uninstall the respective repository 
including all its features.

The check in {{KarArtifactInstaller.install(File file)}} (see 
[master|https://github.com/apache/karaf/blob/2da30f975f1403a324d43db219ccc2dd585a2956/deployer/kar/src/main/java/org/apache/karaf/deployer/kar/KarArtifactInstaller.java#L43])
 that does this seems to compare the whole file name (including .kar) with the 
name of repository (without .kar).

The existing code is:
{code}
        // check if the KAR is not already installed
        if (karService.list().contains(file.getName())) {
            LOGGER.info("KAR {} is already installed. Please uninstall it 
first.", file.getName());
            return;
        }
{code}

What seems to resolve this issue is to change the code to:
{code}
        // check if the KAR is not already installed
        if (karService.list().contains(getKarName(file))) {
            LOGGER.info("KAR {} is already installed. Please uninstall it 
first.", file.getName());
            return;
        }
{code}

When there is agreement on this fix I can submit a PR for this.

We ran into this [issue with 
openHAB|https://github.com/openhab/openhab-distro/issues/519] which uses Karaf 
4.1.3. The respective code has not changed with 4.2.0.M1.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to