[jboss-modules] 01/06: Imported Upstream version 1.5.2

Markus Koschany apo at moszumanska.debian.org
Fri Jun 24 18:21:58 UTC 2016


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

apo pushed a commit to branch master
in repository jboss-modules.

commit e27d0048a0f84541523c442582bb4cef12632b08
Author: Markus Koschany <apo at debian.org>
Date:   Fri Jun 24 19:58:57 2016 +0200

    Imported Upstream version 1.5.2
---
 pom.xml                                            |  9 +++++-
 src/main/java/org/jboss/modules/Main.java          | 34 +++++++---------------
 src/main/java/org/jboss/modules/Module.java        |  1 +
 .../resources/org/jboss/modules/version.properties | 20 +++++++++++++
 4 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/pom.xml b/pom.xml
index b2caa0e..19a766b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.jboss.modules</groupId>
     <artifactId>jboss-modules</artifactId>
-    <version>1.5.1.Final</version>
+    <version>1.5.2.Final</version>
     <name>JBoss Modules</name>
 
     <parent>
@@ -50,6 +50,13 @@
     </properties>
 
     <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+
         <pluginManagement>
             <plugins>
             <plugin>
diff --git a/src/main/java/org/jboss/modules/Main.java b/src/main/java/org/jboss/modules/Main.java
index 0460167..d647ccc 100644
--- a/src/main/java/org/jboss/modules/Main.java
+++ b/src/main/java/org/jboss/modules/Main.java
@@ -28,18 +28,16 @@ import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.lang.management.ManagementFactory;
 import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
+import java.nio.charset.StandardCharsets;
 import java.security.Policy;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Enumeration;
 import java.util.Iterator;
+import java.util.Properties;
 import java.util.ServiceLoader;
-import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.logging.LogManager;
 
-import java.util.jar.Manifest;
 import java.util.prefs.Preferences;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -538,29 +536,17 @@ public final class Main {
     private static final String VERSION_STRING;
 
     static {
-        final Enumeration<URL> resources;
+        Properties versionProps = new Properties();
         String jarName = "(unknown)";
         String versionString = "(unknown)";
-        try {
-            final ClassLoader classLoader = Main.class.getClassLoader();
-            resources = classLoader == null ? ModuleClassLoader.getSystemResources("META-INF/MANIFEST.MF") : classLoader.getResources("META-INF/MANIFEST.MF");
-            while (resources.hasMoreElements()) {
-                final URL url = resources.nextElement();
-                try {
-                    final InputStream stream = url.openStream();
-                    if (stream != null) try {
-                        final Manifest manifest = new Manifest(stream);
-                        final Attributes mainAttributes = manifest.getMainAttributes();
-                        if (mainAttributes != null && "JBoss Modules".equals(mainAttributes.getValue("Specification-Title"))) {
-                            jarName = mainAttributes.getValue("Jar-Name");
-                            versionString = mainAttributes.getValue("Jar-Version");
-                        }
-                    } finally {
-                        StreamUtil.safeClose(stream);
-                    }
-                } catch (IOException ignored) {}
+        try (InputStream stream = Main.class.getResourceAsStream("version.properties")) {
+            if (stream != null) try (InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8)) {
+                versionProps.load(reader);
+                jarName = versionProps.getProperty("jarName", jarName);
+                versionString = versionProps.getProperty("version", versionString);
             }
-        } catch (IOException ignored) {}
+        } catch (IOException ignored) {
+        }
         JAR_NAME = jarName;
         VERSION_STRING = versionString;
     }
diff --git a/src/main/java/org/jboss/modules/Module.java b/src/main/java/org/jboss/modules/Module.java
index be965b0..cf447f3 100644
--- a/src/main/java/org/jboss/modules/Module.java
+++ b/src/main/java/org/jboss/modules/Module.java
@@ -88,6 +88,7 @@ public final class Module {
         final List<String> list = new ArrayList<String>();
         list.add("java.");
         list.add("sun.reflect.");
+        list.add("jdk.internal.reflect.");
         list.add("__redirected.");
         if (pkgsString != null) {
             int i;
diff --git a/src/main/resources/org/jboss/modules/version.properties b/src/main/resources/org/jboss/modules/version.properties
new file mode 100644
index 0000000..4505298
--- /dev/null
+++ b/src/main/resources/org/jboss/modules/version.properties
@@ -0,0 +1,20 @@
+#
+# JBoss, Home of Professional Open Source.
+# Copyright 2016 Red Hat, Inc., and individual contributors
+# as indicated by the @author tags.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+version=${project.version}
+jarName=${project.artifactId}

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



More information about the pkg-java-commits mailing list