[jscover] 01/69: When the attribute CLASS_PATH does not exist in the manifest, return a more explicit error message

Sylvestre Ledru sylvestre at moszumanska.debian.org
Fri Aug 22 05:53:59 UTC 2014


This is an automated email from the git hooks/post-receive script.

sylvestre pushed a commit to branch master
in repository jscover.

commit cbea4bf917d8433c058b091be46303803fdd1fd1
Author: Sylvestre Ledru <sylvestre at debian.org>
Date:   Tue Jun 3 15:13:27 2014 +0200

    When the attribute CLASS_PATH does not exist in the manifest, return a more explicit error message
---
 src/main/java/jscover/Main.java | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/main/java/jscover/Main.java b/src/main/java/jscover/Main.java
index 4a7beac..0164570 100644
--- a/src/main/java/jscover/Main.java
+++ b/src/main/java/jscover/Main.java
@@ -402,9 +402,14 @@ public class Main {
             Manifest mf = new Manifest(getClass().getResourceAsStream("/META-INF/" + manifestName));
             Attributes mainAttributes = mf.getMainAttributes();
             String name = mainAttributes.get(Attributes.Name.IMPLEMENTATION_TITLE).toString();
-            String classPathJARs = mainAttributes.get(Attributes.Name.CLASS_PATH).toString();
-            String message = "%nEnsure these JARs are in the same directory as %s.jar:%n%s";
-            throw new IllegalStateException(format(message, name , classPathJARs), e);
+            if (mainAttributes.containsKey(Attributes.Name.CLASS_PATH)) {
+                String classPathJARs = mainAttributes.get(Attributes.Name.CLASS_PATH).toString();
+                String message = "%nEnsure these JARs are in the same directory as %s.jar:%n%s";
+                throw new IllegalStateException(format(message, name , classPathJARs), e);
+            } else {
+                String message = "Could not find the CLASS_PATH attribute in the manifest '%s'";
+                throw new IllegalStateException(format(message, manifestName), e);
+            }
         }
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jscover.git



More information about the pkg-java-commits mailing list