You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Wouter Born (JIRA)" <ji...@apache.org> on 2017/12/09 22:22:00 UTC
[jira] [Updated] (KARAF-5533) KarArtifactInstaller does not
properly detect already installed KAR files
[ https://issues.apache.org/jira/browse/KARAF-5533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wouter Born updated KARAF-5533:
-------------------------------
Description:
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 causes 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 the 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.
was:
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.
> 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.1.3, 4.2.0.M1
> 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 causes 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 the 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)