You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ff...@apache.org on 2018/06/20 09:46:54 UTC

[karaf] branch master updated: [KARAF-5791]need to check the blacklist when we add feature repo through JMX

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 8d40aa1  [KARAF-5791]need to check the blacklist when we add feature repo through JMX
8d40aa1 is described below

commit 8d40aa1f2f28489a286b2661521e05d8f74cdb9b
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Wed Jun 20 17:46:39 2018 +0800

    [KARAF-5791]need to check the blacklist when we add feature repo through JMX
---
 .../internal/management/FeaturesServiceMBeanImpl.java        | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/management/FeaturesServiceMBeanImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/management/FeaturesServiceMBeanImpl.java
index 9f10a84..cbc169c 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/management/FeaturesServiceMBeanImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/management/FeaturesServiceMBeanImpl.java
@@ -127,11 +127,19 @@ public class FeaturesServiceMBeanImpl extends StandardEmitterMBean implements
     }
 
     public void addRepository(String uri) throws Exception {
-        featuresService.addRepository(new URI(uri));
+        URI repoUri = new URI(uri);
+        if (featuresService.isRepositoryUriBlacklisted(repoUri)) {
+            throw new RuntimeException("Feature URL " + uri + " is blacklisted");
+        }
+        featuresService.addRepository(repoUri);
     }
 
     public void addRepository(String uri, boolean install) throws Exception {
-        featuresService.addRepository(new URI(uri), install);
+        URI repoUri = new URI(uri);
+        if (featuresService.isRepositoryUriBlacklisted(repoUri)) {
+            throw new RuntimeException("Feature URL " + uri + " is blacklisted");
+        }
+        featuresService.addRepository(repoUri, install);
     }
 
     public void removeRepository(String uri) throws Exception {