List of usage examples for java.lang InstantiationException InstantiationException
public InstantiationException(String s)
From source file:org.segrada.util.OrientStringEscape.java
private OrientStringEscape() throws InstantiationException { throw new InstantiationException("The class is not created for instantiation"); }
From source file:org.lnicholls.galleon.database.NetworkServerManager.java
public static void initialize() throws Exception { mHibernateProperties = new Properties(); File file = new File(System.getProperty("conf") + "/" + "hibernate.properties"); if (!file.exists()) { InstantiationException exception = new InstantiationException("hibernate.properties not found"); log.error("Creating Derby Network Server failed", exception); throw exception; }/*from ww w . j a v a 2 s. c om*/ mHibernateProperties.load(new FileInputStream(file)); if (mHibernateProperties.getProperty("hibernate.dialect").equals("net.sf.hibernate.dialect.DerbyDialect")) { Properties derbyProperties = new Properties(); file = new File(System.getProperty("conf") + "/" + "derby.properties"); if (!file.exists()) { InstantiationException exception = new InstantiationException("derby.properties not found"); log.error("Creating Derby Network Server failed", exception); throw exception; } derbyProperties.load(new FileInputStream(file)); mPort = DEFAULT_PORT; if (derbyProperties.getProperty("derby.drda.portNumber") != null) { try { mPort = Integer.parseInt(derbyProperties.getProperty("derby.drda.portNumber")); } catch (NumberFormatException ex) { log.error("Invalid derby.drda.portNumber: " + derbyProperties.getProperty("derby.drda.portNumber"), ex); } } int port = Tools.findAvailablePort(mPort); if (port != mPort) { mPort = port; log.info("Changed port to " + mPort); } try { // Only use the network server for Derby database log.info("Creating Database Network Server"); if (derbyProperties.getProperty("derby.system.home") == null) System.setProperty("derby.system.home", System.getProperty("data")); if (derbyProperties.getProperty("derby.stream.error.file") == null) System.setProperty("derby.stream.error.file", System.getProperty("logs") + "/" + "derby.log"); mNetworkServerControl = new NetworkServerControl(InetAddress.getByName("127.0.0.1"), mPort); mNetworkServerControl.start(null); if (SystemUtils.IS_OS_MAC_OSX) System.setProperty("derby.storage.fileSyncTransactionLog", "true"); // OSX bug testDatabase(); log.info("Created Database Network Server"); } catch (Exception ex) { log.error("Derby Network server could not be created", ex); throw ex; } } else log.info("Alternate Hibernate database: " + mHibernateProperties.getProperty("hibernate.dialect")); }
From source file:org.cloudifysource.restDoclet.exampleGenerators.DocDefaultExampleGenerator.java
private String generateJSON(final Type type) throws Exception { Class<?> clazz = ClassUtils.getClass(type.qualifiedTypeName()); if (MultipartFile.class.getName().equals(clazz.getName())) { return "\"file content\""; }/* w ww .ja va 2 s . co m*/ if (clazz.isInterface()) { throw new InstantiationException("the given class is an interface [" + clazz.getName() + "]."); } Object newInstance = null; if (clazz.isPrimitive()) { newInstance = PrimitiveExampleValues.getValue(clazz); } Class<?> classToInstantiate = clazz; if (newInstance == null) { newInstance = classToInstantiate.newInstance(); } return new ObjectMapper().writeValueAsString(newInstance); }
From source file:ORG.oclc.os.SRW.ParallelSearching.RemoteQueryResult.java
/** Creates a new instance of RemoteQueryResult */ public RemoteQueryResult(String baseURL, String remoteResponse) throws InstantiationException { this.baseURL = baseURL; this.remoteResponse = remoteResponse; try {/*from ww w . jav a 2 s .c o m*/ response = (SearchRetrieveResponseType) Utilities.xmlToObj(remoteResponse); } catch (Exception e) { log.error(e, e); throw new InstantiationException(e.getMessage()); } }
From source file:org.apache.oodt.product.handlers.ofsn.MD5GetHandler.java
public MD5GetHandler() throws InstantiationException { try {// w w w . j a v a 2 s .com this.md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { LOG.log(Level.SEVERE, e.getMessage()); throw new InstantiationException(e.getMessage()); } }
From source file:org.pepstock.jem.commands.util.Factory.java
/** * Creates a PreJob instance, loading JCL content by URL * //from w w w .ja va 2 s . co m * @param url JCL URL to load * @return PreJob instance to put on JEM cluster for submitting * @throws InstantiationException if IOException occurs */ public static PreJob createPreJob(URL url) throws InstantiationException { try { // load JCL content from url String content = load(url); // create PreJob and load content PreJob job = new PreJob(); job.setJclContent(content); return job; } catch (IOException e) { // debug LogAppl.getInstance().debug(e.getMessage(), e); throw new InstantiationException(e.getMessage()); } }
From source file:es.mityc.firmaJava.policy.Facturae31Manager.java
public Facturae31Manager() throws InstantiationException { if (config == null) throw new InstantiationException("No hay configuracin disponible"); }
From source file:jenkins.plugins.logstash.persistence.IndexerDaoFactory.java
/** * Singleton instance accessor./*from w w w. j a v a 2 s . c o m*/ * * @param type * The type of indexer, not null * @param host * The host name or IP address of the indexer, not null * @param port * The port the indexer listens on * @param key * The subcollection to write to in the indexer, not null * @param username * The user name to authenticate with the indexer, nullable * @param password * The password to authenticate with the indexer, nullable * @return The instance of the appropriate indexer DAO, never null * @throws InstantiationException */ public static synchronized LogstashIndexerDao getInstance(IndexerType type, String host, Integer port, String key, String username, String password) throws InstantiationException { if (!INDEXER_MAP.containsKey(type)) { throw new InstantiationException("[logstash-plugin]: Unknown IndexerType '" + type + "'. Did you forget to configure the plugin?"); } // Prevent NPE port = (port == null ? -1 : port.intValue()); if (shouldRefreshInstance(type, host, port, key, username, password)) { try { Class<?> indexerClass = INDEXER_MAP.get(type); Constructor<?> constructor = indexerClass.getConstructor(String.class, int.class, String.class, String.class, String.class); instance = (AbstractLogstashIndexerDao) constructor.newInstance(host, port, key, username, password); } catch (NoSuchMethodException e) { throw new InstantiationException(ExceptionUtils.getRootCauseMessage(e)); } catch (InvocationTargetException e) { throw new InstantiationException(ExceptionUtils.getRootCauseMessage(e)); } catch (IllegalAccessException e) { throw new InstantiationException(ExceptionUtils.getRootCauseMessage(e)); } } return instance; }
From source file:ca.flop.jpublish.dwr.DWRJPublishActionManager.java
/** * @param site the JPublish siteContext object * @param actionName a String containing a valid actionName. The Action is expected to * be registered with the JPublish framework * @throws InstantiationException if the site or the actionName are null or contains invalid values *///from w w w. j a va 2 s . c om public DWRJPublishActionManager(SiteContext site, String actionName) throws InstantiationException { if (site == null) throw new InstantiationException("The JPublish siteContext cannot be null!"); if (actionName == null || actionName.trim().length() == 0) throw new InstantiationException("The Action name cannot be null or empty!"); this.site = site; this.actionName = actionName; }
From source file:org.apache.oodt.cas.catalog.repository.SerializedCatalogRepository.java
public SerializedCatalogRepository(String storageDir) throws InstantiationException { try {/*from w ww . j a v a 2 s. c o m*/ this.storageDir = storageDir; new File(this.storageDir + "/catalogs").mkdirs(); new File(this.storageDir + "/classloaders").mkdirs(); } catch (Exception e) { LOG.log(Level.SEVERE, e.getMessage()); LOG.log(Level.SEVERE, e.getMessage()); throw new InstantiationException( "Failed to instantiate SerializedCatalogRepository : " + e.getMessage()); } }