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

Wrong polymorphism leads to null variables

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.1
    • Fix Version/s: 3.0.3, 4.0.0.M3
    • Component/s: karaf
    • Labels:
      None

      Description

      As BundleRef and its parent ArtifactRef are defining the same variable artifact and the artifact resolver is resolving artifacts via ArtifactRef accessing the artifact via BundleRef returns null.

      This bug is leading to an error using the following goal and configuration

      <plugin>
        <groupId>org.apache.karaf.tooling</groupId>
        <artifactId>karaf-maven-plugin</artifactId>
        <version>3.0.1</version>
        <executions>
          <execution>
            ...
            <goals>
              <goal>features-export-meta-data</goal>
            </goals>
            <configuration>
              ...
              <mergedFeature>true</mergedFeature>
              <oneVersion>true</oneVersion>
            </configuration>
          </execution>
        </executions>
      </plugin>
      

      as maps for merging are being filled with null values instead of unique artifact attributes.

      The root reason is unfortunately supressed see

      BundleRef.java
      public void readManifest() {
          JarInputStream bundleJar = null;
          try {
              File file = artifact.getFile();
              bundleJar = new JarInputStream(new FileInputStream(file));
              Manifest manifest = bundleJar.getManifest();
              bundleSymbolicName = manifest.getMainAttributes().getValue("Bundle-SymbolicName");
              bundleVersion = manifest.getMainAttributes().getValue("Bundle-Version");
              bundleJar.close();
          } catch (Exception e) {
              // Ignore errors in manifest
          }
      }
      

      I attached a patch correcting the polymorphism but it seems to be a good idea to think about better error handling at this part.

        Attachments

        1. karaf.patch
          0.7 kB
          Achim Finke

          Activity

            People

            • Assignee:
              chris@die-schneider.net Christian Schneider
              Reporter:
              afinke Achim Finke
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: