java.lang.InstantiationException Java Examples
The following examples show how to use
java.lang.InstantiationException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RegionStatusDaoImpl.java From kardio with Apache License 2.0 | 6 votes |
/** * Loads the given messages to environment table */ public void loadMessages(String environmentName, String messageType, String message) throws InstantiationException { final int envId = environmentDao.getEnironmentIdFromName(environmentName); String updateQuery = null; if (messageType.equalsIgnoreCase(Constants.MESSAGE_TYPE_APP)) { updateQuery = HQLConstants.UPDATE_APP_MESSAGE; } else if (messageType.equalsIgnoreCase(Constants.MESSAGE_TYPE_INFRA)) { updateQuery = HQLConstants.UPDATE_INFRA_MESSAGE; } else if (messageType.equalsIgnoreCase(Constants.MESSAGE_TYPE_GENERAL)) { updateQuery = HQLConstants.UPDATE_GENERAL_MESSAGE; } else if (messageType.equalsIgnoreCase(Constants.MESSAGE_TYPE_COUNTER)) { updateQuery = HQLConstants.UPDATE_COUNTER_MESSAGE; } else { throw new IllegalArgumentException("Invalid value for Message Type : " + messageType); } Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); Query query = session.createQuery(updateQuery).setInteger("envId", envId).setString("message", message); query.executeUpdate(); tx.commit(); session.close(); }
Example #2
Source File: constructor.java From pluotsorbet with GNU General Public License v2.0 | 6 votes |
/** * Runs the test using the specified harness. * * @param harness the test harness (<code>null</code> not permitted). */ public void test(TestHarness harness) { InstantiationException object1 = new InstantiationException(); harness.check(object1 != null); harness.check(object1.toString(), "java.lang.InstantiationException"); InstantiationException object2 = new InstantiationException("nothing happens"); harness.check(object2 != null); harness.check(object2.toString(), "java.lang.InstantiationException: nothing happens"); InstantiationException object3 = new InstantiationException(null); harness.check(object3 != null); harness.check(object3.toString(), "java.lang.InstantiationException"); }
Example #3
Source File: TryCatch.java From pluotsorbet with GNU General Public License v2.0 | 5 votes |
/** * Runs the test using the specified harness. * * @param harness the test harness (<code>null</code> not permitted). */ public void test(TestHarness harness) { // flag that is set when exception is caught boolean caught = false; try { throw new InstantiationException("InstantiationException"); } catch (InstantiationException e) { // correct exception was caught caught = true; } harness.check(caught); }