You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2019/01/25 13:33:38 UTC

[sling-org-apache-sling-commons-fsclassloader] branch master updated: SLING-8241: catch a possible exception when the calling bundle is already stopped.

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

pauls pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-fsclassloader.git


The following commit(s) were added to refs/heads/master by this push:
     new 6e00f59  SLING-8241: catch a possible exception when the calling bundle is already stopped.
6e00f59 is described below

commit 6e00f596721c9e4cf0907c5e673d5aed6126572c
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Fri Jan 25 14:33:29 2019 +0100

    SLING-8241: catch a possible exception when the calling bundle is already stopped.
---
 .../sling/commons/fsclassloader/impl/FSClassLoaderProvider.java     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/commons/fsclassloader/impl/FSClassLoaderProvider.java b/src/main/java/org/apache/sling/commons/fsclassloader/impl/FSClassLoaderProvider.java
index d5ce22d..5151ee2 100644
--- a/src/main/java/org/apache/sling/commons/fsclassloader/impl/FSClassLoaderProvider.java
+++ b/src/main/java/org/apache/sling/commons/fsclassloader/impl/FSClassLoaderProvider.java
@@ -175,7 +175,11 @@ public class FSClassLoaderProvider implements ClassLoaderWriter {
 			final ServiceReference<DynamicClassLoaderManager> localDynamicClassLoaderManager = this.dynamicClassLoaderManager;
 			final Bundle localCallerBundle = this.callerBundle;
 			if (localDynamicClassLoaderManager != null && localCallerBundle != null) {
-				localCallerBundle.getBundleContext().ungetService(localDynamicClassLoaderManager);
+                            try {
+		                localCallerBundle.getBundleContext().ungetService(localDynamicClassLoaderManager);
+                            } catch (Exception ex) {
+                                // Ignore, this is a best effort - likely the calling bundle has been stopped already
+                            }
 			}
 		}
 	}