[ 
https://issues.apache.org/jira/browse/SLING-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15686740#comment-15686740
 ] 

Antonio Sanso commented on SLING-6315:
--------------------------------------

[~radu.cotescu] are you fine if I apply this patch ?

{code}
Index: 
src/main/java/org/apache/sling/scripting/core/impl/ScriptEngineManagerFactory.java
===================================================================
--- 
src/main/java/org/apache/sling/scripting/core/impl/ScriptEngineManagerFactory.java
  (revision 1770833)
+++ 
src/main/java/org/apache/sling/scripting/core/impl/ScriptEngineManagerFactory.java
  (working copy)
@@ -154,16 +154,25 @@
 
     @Override
     public void bundleChanged(BundleEvent event) {
+        Bundle bundle = event.getBundle();
+        URL url = null;
+
+        try {
+            url = bundle.getEntry(ENGINE_FACTORY_SERVICE);
+        } catch (IllegalStateException ie) {
+            log.info("bundleChanged: an issue while refreshing the Script 
Engine Manager occurred", ie);
+        }
+
         if (event.getType() == BundleEvent.STARTED
-            && event.getBundle().getEntry(ENGINE_FACTORY_SERVICE) != null) {
+                && url != null) {
             synchronized (this.engineSpiBundles) {
-                this.engineSpiBundles.add(event.getBundle());
+                this.engineSpiBundles.add(bundle);
             }
             this.refreshScriptEngineManager();
         } else if (event.getType() == BundleEvent.STOPPED) {
             boolean refresh;
             synchronized (this.engineSpiBundles) {
-                refresh = this.engineSpiBundles.remove(event.getBundle());
+                refresh = this.engineSpiBundles.remove(bundle);
             }
             if (refresh) {
                 this.refreshScriptEngineManager();
@@ -170,7 +179,6 @@
             }
         }
     }
-
     // ---------- SCR integration 
----------------------------------------------
 
     protected void activate(ComponentContext context) {
{code}

> o.a.sling.scripting.core: IllegalStateException: The bundle is uninstalled
> --------------------------------------------------------------------------
>
>                 Key: SLING-6315
>                 URL: https://issues.apache.org/jira/browse/SLING-6315
>             Project: Sling
>          Issue Type: Bug
>          Components: Scripting
>            Reporter: Antonio Sanso
>            Assignee: Antonio Sanso
>            Priority: Minor
>
> {noformat}
> 18.11.2016 02:58:23.445 *ERROR* [FelixDispatchQueue] 
> org.apache.sling.scripting.core FrameworkEvent ERROR 
> (java.lang.IllegalStateException: The bundle is 
> uninstalled.)java.lang.IllegalStateException: The bundle is uninstalled.
>       at org.apache.felix.framework.Felix.getBundleEntry(Felix.java:1741)
>       at org.apache.felix.framework.BundleImpl.getEntry(BundleImpl.java:291)
>       at 
> org.apache.sling.scripting.core.impl.ScriptEngineManagerFactory.bundleChanged(ScriptEngineManagerFactory.java:158)
>       at 
> org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:916)
>       at 
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:835)
>       at 
> org.apache.felix.framework.util.EventDispatcher.run(EventDispatcher.java:1148)
>       at 
> org.apache.felix.framework.util.EventDispatcher.access$000(EventDispatcher.java:55)
>       at 
> org.apache.felix.framework.util.EventDispatcher$1.run(EventDispatcher.java:103)
>       at java.lang.Thread.run(Thread.java:745)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to