From e4c0edea06c8fee28369f03f393b7d54b2b6235c Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 16 Sep 2016 13:25:06 +0000
Subject: [PATCH] OPENDJ-3246 Return the CREST descriptor over REST for rest2ldap endpoints

---
 opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolVersionHandler.java |   23 ++---------------------
 1 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolVersionHandler.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolVersionHandler.java
index cbb713e..a2d03dd 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolVersionHandler.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolVersionHandler.java
@@ -15,12 +15,7 @@
  */
 package com.forgerock.opendj.cli;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
+import com.forgerock.opendj.util.ManifestUtil;
 
 /** Class that prints the version of the SDK to System.out. */
 public final class ToolVersionHandler implements VersionHandler {
@@ -64,20 +59,6 @@
     }
 
     private String getVersion() {
-        try {
-            final Enumeration<URL> manifests = getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
-            while (manifests.hasMoreElements()) {
-                final URL manifestUrl = manifests.nextElement();
-                if (manifestUrl.toString().contains(moduleName)) {
-                    try (InputStream manifestStream = manifestUrl.openStream()) {
-                        final Attributes attrs = new Manifest(manifestStream).getMainAttributes();
-                        return attrs.getValue("Bundle-Version") + " (revision " + attrs.getValue("SCM-Revision") + ")";
-                    }
-                }
-            }
-            return null;
-        } catch (IOException e) {
-            throw new RuntimeException("IOException while determining opendj tool version", e);
-        }
+        return ManifestUtil.getVersionWithRevision(moduleName);
     }
 }

--
Gitblit v1.10.0