HHH-8763 OsgiServiceUtil#getServiceImpls broken

This commit is contained in:
Brett Meyer 2013-12-03 23:40:45 -05:00
parent b3219affcd
commit 3ff64a55c5
2 changed files with 5 additions and 4 deletions

View File

@ -23,7 +23,6 @@
*/
package org.hibernate.envers.internal.entities;
import org.hibernate.envers.RevisionType;
import org.hibernate.metamodel.spi.TypeContributions;
import org.hibernate.metamodel.spi.TypeContributor;
import org.hibernate.service.ServiceRegistry;
@ -38,7 +37,7 @@ public class TypeContributorImpl implements TypeContributor {
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
typeContributions.contributeType(
new RevisionTypeType(),
new String[] { RevisionType.class.getName() }
new String[] { RevisionTypeType.class.getName() }
);
}

View File

@ -57,9 +57,11 @@ public class OsgiServiceUtil implements Stoppable {
* @return All know implementors
*/
public <T> T[] getServiceImpls(Class<T> contract) {
T[] services = (T[]) Array.newInstance( contract, 0 );
final ServiceTracker serviceTracker = getServiceTracker( contract.getName() );
try {
T[] services = (T[]) serviceTracker.getServices();
// Yep, this is stupid. But, it's the only way to prevent #getServices from handing us back Object[].
services = (T[]) serviceTracker.getServices( services );
if ( services != null ) {
return services;
}
@ -67,7 +69,7 @@ public class OsgiServiceUtil implements Stoppable {
catch (Exception e) {
LOG.unableToDiscoverOsgiService( contract.getName(), e );
}
return (T[]) Array.newInstance( contract, 0 );
return services;
}
/**