[java-support] branch master updated: JPAR-113 - check for problematic automatic module names

Ian Young ian at iay.org.uk
Sat Sep 29 13:10:50 EDT 2018


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

iay pushed a commit to branch master
in repository java-support.

View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=73d55e3c84202cc45291f66d28e11c2668fb8dfd

The following commit(s) were added to refs/heads/master by this push:
       new  73d55e3   JPAR-113 - check for problematic automatic module names
73d55e3 is described below

commit 73d55e3c84202cc45291f66d28e11c2668fb8dfd
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Sat Sep 29 18:10:44 2018 +0100

    JPAR-113 - check for problematic automatic module names
---
 .../java/support/testing/ShowAutomaticModuleNames.java    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/test/java/net/shibboleth/utilities/java/support/testing/ShowAutomaticModuleNames.java b/src/test/java/net/shibboleth/utilities/java/support/testing/ShowAutomaticModuleNames.java
index c1c7c05..2d98f1a 100644
--- a/src/test/java/net/shibboleth/utilities/java/support/testing/ShowAutomaticModuleNames.java
+++ b/src/test/java/net/shibboleth/utilities/java/support/testing/ShowAutomaticModuleNames.java
@@ -102,20 +102,35 @@ public class ShowAutomaticModuleNames {
                 return name.endsWith(".jar");
             }
         });
+        final Map<String, File> seenNames = new HashMap<>();
         final List<File> noName = new ArrayList<>();
         final Map<File, String> withName = new HashMap<>();
+        final Map<File, String> problemNames = new HashMap<>();
         for (File file : files) {
             try (final JarFile jarFile = new JarFile(file)) {
                 final String automaticName = getAutomaticModuleName(jarFile);
                 if (automaticName == null) {
                     noName.add(file);
+                } else if (automaticName.isEmpty()) {
+                    problemNames.put(file,  "empty module name");
+                } else if (seenNames.containsKey(automaticName)) {
+                    problemNames.put(file, "duplicate module name " + automaticName +
+                            " with " + seenNames.get(automaticName).getName());
                 } else {
                     withName.put(file, automaticName);
+                    seenNames.put(automaticName, file);
                 }
             } catch (final IOException e) {
                 throw new TerminationException("could not process " + file.getName(), e);
             }
         }
+        if (!problemNames.isEmpty()) {
+            System.out.println("   *** with problematic names:");
+            final List<File> problemFiles = new ArrayList<>(problemNames.keySet());
+            for (File file : problemFiles) {
+                System.out.println("      " + file.getName() + ": " + problemNames.get(file));
+            }
+        }
         if (!withName.isEmpty()) {
             System.out.println("   with module names:");
             final List<File> withNameFiles = new ArrayList<>(withName.keySet());

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list