X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.repo%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Frepo%2Fosgi%2FImportBundlesZip.java;h=a11f2439c7d494114df8fa7c7eadbaae447a1d43;hb=e146631736be22397edf93f81f3218b5a178dc06;hp=8701688d8e80ddbbb8e8db5e2b1ae10a44856190;hpb=ece297b709bf55a514b471e1141dcd22fcdc54c6;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/ImportBundlesZip.java b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/ImportBundlesZip.java index 8701688d8..a11f2439c 100644 --- a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/ImportBundlesZip.java +++ b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/ImportBundlesZip.java @@ -22,7 +22,6 @@ import org.argeo.slc.SlcException; import org.argeo.slc.repo.ArtifactIndexer; import org.argeo.slc.repo.JarFileIndexer; import org.argeo.slc.repo.RepoUtils; -import org.argeo.slc.repo.maven.MavenConventionsUtils; import org.sonatype.aether.artifact.Artifact; import org.sonatype.aether.util.artifact.DefaultArtifact; @@ -53,14 +52,14 @@ public class ImportBundlesZip implements Runnable { session = repository.login(workspace); // clear - String groupPath = MavenConventionsUtils.groupPath( - artifactBasePath, groupId); - if (session.itemExists(groupPath)) { - session.getNode(groupPath).remove(); - session.save(); - if (log.isDebugEnabled()) - log.debug("Cleared " + groupPath); - } + // String groupPath = MavenConventionsUtils.groupPath( + // artifactBasePath, groupId); + // if (session.itemExists(groupPath)) { + // session.getNode(groupPath).remove(); + // session.save(); + // if (log.isDebugEnabled()) + // log.debug("Cleared " + groupPath); + // } zipIn = new ZipInputStream(url.openStream()); ZipEntry zipEntry = null; @@ -78,12 +77,23 @@ public class ImportBundlesZip implements Runnable { log.warn(entryName + " has no MANIFEST"); continue entries; } - NameVersion nv = RepoUtils.readNameVersion(manifest); + NameVersion nv; + try { + nv = RepoUtils.readNameVersion(manifest); + } catch (Exception e) { + log.warn("Cannot read name version from " + entryName, e); + continue entries; + } + String bundleName = RepoUtils.extractBundleNameFromSourceName(nv + .getName()); // skip excluded bundles and their sources - if (excludedBundles.contains(extractBundleNameFromSourceName(nv - .getName()))) + if (excludedBundles.contains(bundleName)) continue entries; + // for(String excludedBundle:excludedBundles){ + // if(bundleName.contains(excludedBundle)) + // continue entries; + // } Artifact artifact = new DefaultArtifact(groupId, nv.getName(), "jar", nv.getVersion()); @@ -109,15 +119,6 @@ public class ImportBundlesZip implements Runnable { } - /** If a source return the base bundle name, does not change otherwise */ - private String extractBundleNameFromSourceName(String sourceBundleName) { - if (sourceBundleName.endsWith(".source")) - return sourceBundleName.substring(0, sourceBundleName.length() - - ".source".length()); - else - return sourceBundleName; - } - public void setRepository(Repository repository) { this.repository = repository; }