/** * Throws exception if {@code impl} does not * implement or extend the SPI. * * @param spi The SPI type * @param impl The class has to be verified is a SPI implementation/extension * @throws DiscoveryException if the input implementation class is not an SPI implementation */ public static void verifyAncestory(Class<?> spi, Class<?> impl) throws DiscoveryException { if (spi == null) { throw new DiscoveryException("No interface defined!"); } if (impl == null) { throw new DiscoveryException("No implementation defined for " + spi.getName()); } if (!spi.isAssignableFrom(impl)) { throw new DiscoveryException("Class " + impl.getName() + " does not implement " + spi.getName()); } }
String msg = "Internal Error: pre-check for " + clazz.getName() + " failed?!"; log.fatal(msg, e); throw new DiscoveryException(msg, e); String msg = "Internal Error: setLog failed for " + clazz.getName(); log.fatal(msg, e); throw new DiscoveryException(msg, e);
+ " required to implement 'public static void setLog(Log)'"; log.fatal(msg); throw new DiscoveryException(msg); throw new DiscoveryException(msg, se);
throw de; } catch (Exception e) { throw new DiscoveryException("Unable to instantiate implementation class for " + spi.getSPName(), e);
throw new DiscoveryException("No implementation defined for " + spi.getSPName(), error);