felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1806124 - in /felix/trunk/dependencymanager: org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/ org.apache.felix.dependencymanager/resources/ org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/
Date Fri, 25 Aug 2017 05:50:35 GMT
Author: pderop
Date: Fri Aug 25 05:50:35 2017
New Revision: 1806124

URL: http://svn.apache.org/viewvc?rev=1806124&view=rev
Log:
FELIX-5683: getServiceProperties returns null instead of empty dictionary

Added:
    felix/trunk/dependencymanager/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/FELIX5683_GetServicePropertiesReturnsNullTest.java
Modified:
    felix/trunk/dependencymanager/org.apache.felix.dependencymanager/resources/changelog.txt
    felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/FELIX5683_GetServicePropertiesReturnsNullTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/FELIX5683_GetServicePropertiesReturnsNullTest.java?rev=1806124&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/FELIX5683_GetServicePropertiesReturnsNullTest.java
(added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/FELIX5683_GetServicePropertiesReturnsNullTest.java
Fri Aug 25 05:50:35 2017
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.dm.itest.api;
+
+import java.util.Properties;
+
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.itest.util.TestBase;
+import org.junit.Assert;
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class FELIX5683_GetServicePropertiesReturnsNullTest extends TestBase {
+
+    public void testServiceProperties() throws Exception {
+        final DependencyManager dm = getDM();
+        Component provider = dm.createComponent();
+        
+        provider.setImplementation(new ProviderImpl())
+        		.setInterface(Provider.class.getName(), new Properties()); 
+        Assert.assertNotNull(provider.getServiceProperties());
+        dm.clear();
+    }
+
+    public interface Provider {    
+    }
+    
+    public class ProviderImpl implements Provider {    	
+    }
+}

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/resources/changelog.txt
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/resources/changelog.txt?rev=1806124&r1=1806123&r2=1806124&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/resources/changelog.txt
(original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/resources/changelog.txt
Fri Aug 25 05:50:35 2017
@@ -1,3 +1,9 @@
+Release Notes - Felix - Version org.apache.felix.dependencymanager-r12
+======================================================================
+
+** Bug
+    * [FELIX-5683] - getServiceProperties returns null instead of empty dictionary
+
 Release Notes - Felix - Version org.apache.felix.dependencymanager-r11
 ======================================================================
 

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java?rev=1806124&r1=1806123&r2=1806124&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
(original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
Fri Aug 25 05:50:35 2017
@@ -1429,7 +1429,9 @@ public class ComponentImpl implements Co
 		// Now add our component service properties, which overrides previously added propagated
dependency service properties
 		addTo(properties, m_serviceProperties);
 		
-		return properties.size() == 0 ? null : properties;
+		// FELIX-5683: don't return null if no service properties available, but user passed an
empty dictionary in the
+		// setInterface method.
+		return (properties.size() == 0 && m_serviceProperties == null) ? null : properties;
 	}
 
     private void addTo(Dictionary<String, Object> properties, Dictionary<?, Object>
additional) {



Mime
View raw message