List of usage examples for org.apache.commons.lang IllegalClassException IllegalClassException
public IllegalClassException(String message)
Instantiates with the specified message.
From source file:com.comcast.cats.service.util.YAMLUtils.java
@SuppressWarnings("unchecked") public static synchronized <T> T loadFromYAML(String filePath, T resultObject, Constructor constructor) throws IllegalClassException, IOException { Yaml yaml;/*from www . jav a 2 s . c om*/ FileInputStream fileIS = null; if (constructor != null) { yaml = new Yaml(constructor); } else { yaml = new Yaml(); } try { fileIS = new FileInputStream(filePath); resultObject = (T) yaml.load(fileIS); } catch (FileNotFoundException exception) { File file = new File(filePath); file.createNewFile(); // create file if one does not exist. fileIS = new FileInputStream(filePath); resultObject = (T) yaml.load(fileIS); } catch (ClassCastException e) { logger.warn( "YAML content found at " + filePath + " does not conform to passed object " + e.getMessage()); throw new IllegalClassException( "YAML content found at " + filePath + " does not conform to passed object " + e.getMessage()); } finally { if (fileIS != null) { fileIS.close(); } } return resultObject; }
From source file:mitm.common.security.crlstore.dao.X509CRLStoreCRLIterator.java
@Override protected Object parseElement(Object element) { if (!(element instanceof X509CRLStoreEntryHibernate)) { throw new IllegalClassException( "The object returned from the ScrollableResults" + " is not a X509CRLStoreEntryHibernate."); }//from w w w . j a v a 2s .c o m X509CRLStoreEntryHibernate crlStoreEntry = (X509CRLStoreEntryHibernate) element; return crlStoreEntry.getCRL(); }
From source file:mitm.common.security.certstore.dao.X509CertStoreCertificateIterator.java
@Override protected Object parseElement(Object element) { if (!(element instanceof X509CertStoreEntryHibernate)) { throw new IllegalClassException( "The object returned from the ScrollableResults" + " is not a X509CertStoreEntryHibernate."); }//from ww w .j a v a2 s. com X509CertStoreEntryHibernate certStoreEntry = (X509CertStoreEntryHibernate) element; return certStoreEntry.getCertificate(); }
From source file:mitm.common.hibernate.AbstractScrollableResultsIterator.java
protected Object parseElement(Object element) { if (!ReflectionUtils.isInstanceOf(element.getClass(), persistentClass)) { throw new IllegalClassException("The object returned from the ScrollableResults is not a " + persistentClass.getCanonicalName()); }//from w w w. j a va2 s. co m return element; }
From source file:com.gzj.tulip.jade.context.spring.SpringDataSourceFactory.java
private DataSourceHolder getDataSourceByKey(Class<?> daoClass, String key) { if (applicationContext.containsBean(key)) { Object dataSource = applicationContext.getBean(key); if (!(dataSource instanceof DataSource) && !(dataSource instanceof DataSourceFactory)) { throw new IllegalClassException( "expects DataSource or DataSourceFactory, but a " + dataSource.getClass().getName()); }/*from w w w .j ava 2s . c om*/ if (logger.isDebugEnabled()) { logger.debug("found dataSource: " + key + " for DAO " + daoClass.getName()); } return new DataSourceHolder(dataSource); } return null; }
From source file:nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.chunks.Chunk1_10Type.java
@Override public void write(ByteBuf output, ClientWorld world, Chunk input) throws Exception { if (!(input instanceof Chunk1_10)) throw new IllegalClassException( "Tried to send the wrong chunk type from 1.9.3-4 chunk: " + input.getClass()); Chunk1_10 chunk = (Chunk1_10) input; output.writeInt(chunk.getX());//from w w w . j a v a 2s.co m output.writeInt(chunk.getZ()); output.writeBoolean(chunk.isGroundUp()); Type.VAR_INT.write(output, chunk.getBitmask()); ByteBuf buf = Unpooled.buffer(); for (int i = 0; i < 16; i++) { ChunkSection section = chunk.getSections()[i]; if (section == null) continue; // Section not set section.writeBlocks(buf); section.writeBlockLight(buf); if (!section.hasSkyLight()) continue; // No sky light, we're done here. section.writeSkyLight(buf); } buf.readerIndex(0); Type.VAR_INT.write(output, buf.readableBytes() + (chunk.isBiomeData() ? 256 : 0)); output.writeBytes(buf); buf.release(); // release buffer // Write biome data if (chunk.isBiomeData()) { output.writeBytes(chunk.getBiomeData()); } Type.NBT_ARRAY.write(output, chunk.getBlockEntities().toArray(new CompoundTag[0])); }
From source file:org.esupportail.publisher.service.factories.impl.EvaluatorDTOSelectorFactoryImpl.java
private AEvaluatorDTOFactory<? extends EvaluatorDTO, ? extends AbstractEvaluator> getFactory( final EvaluatorDTO dtoObject) { for (AEvaluatorDTOFactory<? extends EvaluatorDTO, ? extends AbstractEvaluator> factory : evaluatorFactories) { if (factory.isDTOFactoryImpl(dtoObject)) return factory; }/*from ww w. j av a 2s . c o m*/ throw new IllegalClassException("No DTOFactoryImpl found for " + dtoObject.getClass().getCanonicalName()); }
From source file:org.esupportail.publisher.service.factories.impl.EvaluatorDTOSelectorFactoryImpl.java
private AEvaluatorDTOFactory<? extends EvaluatorDTO, ? extends AbstractEvaluator> getFactory( final AbstractEvaluator model) { for (AEvaluatorDTOFactory<? extends EvaluatorDTO, ? extends AbstractEvaluator> factory : evaluatorFactories) { if (factory.isDTOFactoryImpl(model)) return factory; }//from w ww . j a va2 s. co m throw new IllegalClassException("No DTOFactoryImpl found for " + model.getClass().getCanonicalName()); }
From source file:org.esupportail.publisher.service.factories.impl.ItemDTOSelectorFactoryImpl.java
private AItemDTOFactory<? extends ItemDTO, ? extends AbstractItem> getFactory(final ItemDTO dtoObject) { for (AItemDTOFactory<? extends ItemDTO, ? extends AbstractItem> factory : AbstractItemFactories) { if (factory.isDTOFactoryImpl(dtoObject)) { log.debug("Factory selected {} for object type {}", factory.getFactoryName(), dtoObject.getClass().getCanonicalName()); return factory; }//from w w w.j a v a 2 s . co m } throw new IllegalClassException("No DTOFactoryImpl found for " + dtoObject.getClass().getCanonicalName()); }
From source file:org.esupportail.publisher.service.factories.impl.ItemDTOSelectorFactoryImpl.java
private AItemDTOFactory<? extends ItemDTO, ? extends AbstractItem> getFactory(final AbstractItem model) { for (AItemDTOFactory<? extends ItemDTO, ? extends AbstractItem> factory : AbstractItemFactories) { if (factory.isDTOFactoryImpl(model)) { log.debug("Factory selected {} for object type {}", factory.getFactoryName(), model.getClass().getCanonicalName()); return factory; }// w w w .j av a 2 s . c o m } throw new IllegalClassException("No DTOFactoryImpl found for " + model.getClass().getCanonicalName()); }