Fix FELIX-4129

Allow changing the optionality of a dependency at runtime

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1493176 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
index 2882464..6d49b9f 100644
--- a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
+++ b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java
@@ -803,12 +803,8 @@
     public void setOptionality(boolean isOptional) {

         try {

             acquireWriteLockIfNotHeld();

-            if (m_tracker == null) { // Not started ...

-                m_optional = isOptional;

-            } else {

-                // This method releases the exclusive lock

-                computeAndSetDependencyState();

-            }

+            m_optional = isOptional;

+            computeAndSetDependencyState();

         } finally {

             releaseWriteLockIfHeld();

         }