Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHristo Iliev2010-12-14 18:37:25 -0500
committerHristo Iliev2010-12-14 18:37:25 -0500
commit3bc5d63124857aa146748636890809cf0d52c551 (patch)
treee6a08633821cf0d405ed3f2c2c7771114b8e21d1 /org.eclipse.virgo.kernel.artifact
parent85097248ae38a1ba28affc099519676b65f41e65 (diff)
downloadorg.eclipse.virgo.kernel-3bc5d63124857aa146748636890809cf0d52c551.tar.gz
org.eclipse.virgo.kernel-3bc5d63124857aa146748636890809cf0d52c551.tar.xz
org.eclipse.virgo.kernel-3bc5d63124857aa146748636890809cf0d52c551.zip
bug 331997: make invalid signature file digest abort the deployment
Diffstat (limited to 'org.eclipse.virgo.kernel.artifact')
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java2
-rw-r--r--org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/internal/BundleManifestUtils.java7
2 files changed, 7 insertions, 2 deletions
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
index ef28709e..d7298b8d 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/bundle/BundleBridge.java
@@ -73,6 +73,8 @@ public final class BundleBridge implements ArtifactBridge {
try {
bundleManifest = BundleManifestUtils.readBundleManifest(artifactFile, JAR_SUFFIX, WAR_SUFFIX);
+ } catch (RuntimeException re) {
+ throw new RuntimeException(String.format("Error occurred while parsing the manifest of file '%s'.", artifactFile.getPath()), re);
} catch (Exception e) {
throw new ArtifactGenerationException("Error occurred while parsing the manifest.", BRIDGE_TYPE, e);
}
diff --git a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/internal/BundleManifestUtils.java b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/internal/BundleManifestUtils.java
index da2b22f5..d5cad092 100644
--- a/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/internal/BundleManifestUtils.java
+++ b/org.eclipse.virgo.kernel.artifact/src/main/java/org/eclipse/virgo/kernel/artifact/internal/BundleManifestUtils.java
@@ -47,8 +47,9 @@ public final class BundleManifestUtils {
* @param archiveSuffixes The suffixes with which an archive's file name must end
* @return The <code>BundleManifest</code> from the file or <code>null</code> if one was not found.
* @throws IOException Thrown if a manifest is detected but the reading of it fails.
+ * @throws SecurityException Thrown if a manifest is detected but the reading of it fails because of signature checks (invalid signature file digest...)
*/
- public static BundleManifest readBundleManifest(File file, String... archiveSuffixes) throws IOException {
+ public static BundleManifest readBundleManifest(File file, String... archiveSuffixes) throws IOException, SecurityException {
String fileName = file.getName();
Reader reader = null;
@@ -73,7 +74,7 @@ public final class BundleManifestUtils {
}
}
- private static Reader manifestReaderFromJar(File file) throws IOException {
+ private static Reader manifestReaderFromJar(File file) throws IOException, SecurityException {
JarFile jar = null;
try {
jar = new JarFile(file);
@@ -85,6 +86,8 @@ public final class BundleManifestUtils {
StringWriter writer = new StringWriter();
FileCopyUtils.copy(new InputStreamReader(jar.getInputStream(entry)), writer);
return new StringReader(writer.toString());
+ } catch (SecurityException se) {
+ throw new SecurityException(String.format("Failed to read manifest from file '%s'.", file.getName()), se);
} catch (Exception e) {
throw new IOException(String.format("Failed to read manifest from file '%s'.", file.getName()), e);
} finally {

Back to the top