karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject karaf git commit: [KARAF-4802]Auto Deploy does not release resource
Date Thu, 12 Jan 2017 05:56:17 GMT
Repository: karaf
Updated Branches:
  refs/heads/master 69f54ee11 -> e7f307150


[KARAF-4802]Auto Deploy does not release resource


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/e7f30715
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/e7f30715
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/e7f30715

Branch: refs/heads/master
Commit: e7f3071501314ea68dd330b671dff30717119eac
Parents: 69f54ee
Author: Freeman Fang <freeman.fang@gmail.com>
Authored: Thu Jan 12 13:56:05 2017 +0800
Committer: Freeman Fang <freeman.fang@gmail.com>
Committed: Thu Jan 12 13:56:05 2017 +0800

----------------------------------------------------------------------
 .../karaf/deployer/blueprint/BlueprintTransformer.java   | 11 ++++++++++-
 .../apache/karaf/deployer/spring/SpringTransformer.java  | 11 ++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/e7f30715/deployer/blueprint/src/main/java/org/apache/karaf/deployer/blueprint/BlueprintTransformer.java
----------------------------------------------------------------------
diff --git a/deployer/blueprint/src/main/java/org/apache/karaf/deployer/blueprint/BlueprintTransformer.java
b/deployer/blueprint/src/main/java/org/apache/karaf/deployer/blueprint/BlueprintTransformer.java
index 19ed906..692cac4 100644
--- a/deployer/blueprint/src/main/java/org/apache/karaf/deployer/blueprint/BlueprintTransformer.java
+++ b/deployer/blueprint/src/main/java/org/apache/karaf/deployer/blueprint/BlueprintTransformer.java
@@ -20,11 +20,13 @@ package org.apache.karaf.deployer.blueprint;
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.net.URLConnection;
 import java.util.Enumeration;
 import java.util.Properties;
 import java.util.Set;
@@ -91,7 +93,7 @@ public class BlueprintTransformer {
         }
 
         // get original last modification date
-        long lastModified = url.openConnection().getLastModified();
+        long lastModified = getLastModified(url);
 
         JarOutputStream out = new JarOutputStream(os);
         ZipEntry e = new ZipEntry(JarFile.MANIFEST_NAME);
@@ -170,6 +172,13 @@ public class BlueprintTransformer {
         }
     }
 
+    protected static long getLastModified(URL url) throws IOException {
+        URLConnection urlConnection = url.openConnection();
+        try(InputStream is = urlConnection.getInputStream()) {
+            return urlConnection.getLastModified();
+        }
+    }
+
     protected static String getPath(URL url) {
         if (url.getProtocol().equals("mvn")) {
             String[] parts = url.toExternalForm().substring(4).split("/");

http://git-wip-us.apache.org/repos/asf/karaf/blob/e7f30715/deployer/spring/src/main/java/org/apache/karaf/deployer/spring/SpringTransformer.java
----------------------------------------------------------------------
diff --git a/deployer/spring/src/main/java/org/apache/karaf/deployer/spring/SpringTransformer.java
b/deployer/spring/src/main/java/org/apache/karaf/deployer/spring/SpringTransformer.java
index c76379c..56fd308 100644
--- a/deployer/spring/src/main/java/org/apache/karaf/deployer/spring/SpringTransformer.java
+++ b/deployer/spring/src/main/java/org/apache/karaf/deployer/spring/SpringTransformer.java
@@ -20,10 +20,12 @@ package org.apache.karaf.deployer.spring;
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.net.URL;
+import java.net.URLConnection;
 import java.util.Enumeration;
 import java.util.Properties;
 import java.util.Set;
@@ -92,7 +94,7 @@ public class SpringTransformer {
         }
 
         // get original last modification date
-        long lastModified = url.openConnection().getLastModified();
+        long lastModified = getLastModified(url);
 
         JarOutputStream out = new JarOutputStream(os);
         ZipEntry e = new ZipEntry(JarFile.MANIFEST_NAME);
@@ -167,6 +169,13 @@ public class SpringTransformer {
         }
     }
 
+    protected static long getLastModified(URL url) throws IOException {
+        URLConnection urlConnection = url.openConnection();
+        try(InputStream is = urlConnection.getInputStream()) {
+            return urlConnection.getLastModified();
+        }
+    }
+
     protected static String getPath(URL url) {
         if (url.getProtocol().equals("mvn")) {
             String[] parts = url.toExternalForm().substring(4).split("/");


Mime
View raw message