{
svcObj = m_factory.getService(bundle, this);
}
catch (Throwable th)
{
throw new ServiceException(
"Service factory exception: " + th.getMessage(),
ServiceException.FACTORY_EXCEPTION, th);
}
if (svcObj != null)
{
for (int i = 0; i < m_classes.length; i++)
{
Class clazz = Util.loadClassUsingClass(
svcObj.getClass(), m_classes[i], Felix.m_secureAction);
if ((clazz == null) || !clazz.isAssignableFrom(svcObj.getClass()))
{
if (clazz == null)
{
throw new ServiceException(
"Service cannot be cast due to missing class: " + m_classes[i],
ServiceException.FACTORY_ERROR);
}
else
{
throw new ServiceException(
"Service cannot be cast: " + m_classes[i],
ServiceException.FACTORY_ERROR);
}
}
}
}
else
{
throw new ServiceException(
"Service factory returned null.", ServiceException.FACTORY_ERROR);
}
return svcObj;
}