You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2018/07/31 10:00:25 UTC

[sling-org-apache-sling-testing-osgi-mock] 01/02: SLING-7788 always initialize array with proper size

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

sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-osgi-mock.git

commit 2883d389dff97140e6c3cf7435fd8819e6ee7b47
Author: sseifert <ss...@pro-vision.de>
AuthorDate: Tue Jul 31 11:58:52 2018 +0200

    SLING-7788 always initialize array with proper size
---
 .../org/apache/sling/testing/mock/osgi/MockServiceRegistration.java     | 2 +-
 .../org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java b/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java
index 94c3cec..57b8c3b 100644
--- a/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java
+++ b/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java
@@ -66,7 +66,7 @@ class MockServiceRegistration<T> implements ServiceRegistration<T>, Comparable<M
 
         this.properties = properties != null ? properties : new Hashtable<String,Object>();
         this.properties.put(Constants.SERVICE_ID, this.serviceId);
-        this.properties.put(Constants.OBJECTCLASS, this.clazzes.toArray(new String[0]));
+        this.properties.put(Constants.OBJECTCLASS, this.clazzes.toArray(new String[this.clazzes.size()]));
         this.serviceReference = new MockServiceReference<T>(bundle, this);
         this.bundleContext = bundleContext;
     }
diff --git a/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java b/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java
index 174c6a1..d4bee18 100644
--- a/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java
+++ b/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java
@@ -34,7 +34,6 @@ import org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.ServiceInterface1;
 import org.apache.sling.testing.mock.osgi.OsgiServiceUtilTest.ServiceInterface2;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;