List of usage examples for java.lang Exception getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:com.clustercontrol.winevent.session.MonitorWinEventControllerBean.java
/** * Windows???/*from ww w . j a va 2 s . co m*/ * * * @return Object?2? * @throws MonitorNotFound * @throws InvalidRole * @throws HinemosUnknown */ public ArrayList<MonitorInfo> getWinEventList() throws MonitorNotFound, InvalidRole, HinemosUnknown { JpaTransactionManager jtm = null; ArrayList<MonitorInfo> list = null; try { jtm = new JpaTransactionManager(); jtm.begin(); list = new SelectMonitor() .getMonitorListObjectPrivilegeModeNONE(HinemosModuleConstant.MONITOR_WINEVENT); jtm.commit(); } catch (Exception e) { m_log.warn("getWinEventList() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); if (jtm != null) jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } finally { if (jtm != null) jtm.close(); } return list; }
From source file:com.veterinaria.jsf.controllers.ClienteController.java
public String updateCliente() { try {/*from w w w . ja va 2 s . co m*/ getClienteFacade().edit(clienteActual); addSuccesMessage("Actualizar Cliente", "Cliente Actualizado Exitosamente."); recargarLista(); return "/faces/usuario/UsuarioView"; } catch (Exception e) { addErrorMessage("Error closing resource " + e.getClass().getName(), "Message: " + e.getMessage()); return null; } }
From source file:net.pandoragames.far.ui.swing.component.MacOSXMenuAdapter.java
/** * Instantiates the <code>Application</code> class and initialises <i>this</i> * as a Proxy for interface <code>ApplicationListener</code>. Wires the two together. */// w w w .java2 s.co m public MacOSXMenuAdapter() { // 1. get an instance of apples Application class Class applicationClass = null; try { applicationClass = Class.forName(CL_OSX_APP); macOSXApplication = applicationClass.newInstance(); } catch (Exception x) { String message = x.getClass().getName() + " instantiating " + CL_OSX_APP + ": " + x.getMessage(); logger.error(message); throw new IllegalStateException(message); } // 2. Make THIS a Proxy for an ApplicationListener instance try { Class applicationListenerClass = Class.forName(CL_OSX_APP_LSTR); applicationListenerProxy = Proxy.newProxyInstance(MacOSXMenuAdapter.class.getClassLoader(), new Class[] { applicationListenerClass }, this); Method addListenerMethod = applicationClass.getDeclaredMethod("addApplicationListener", new Class[] { applicationListenerClass }); addListenerMethod.invoke(macOSXApplication, new Object[] { applicationListenerProxy }); } catch (Exception x) { String message = x.getClass().getName() + " instantiating " + CL_OSX_APP_LSTR + ": " + x.getMessage(); logger.error(message); throw new IllegalStateException(message); } }
From source file:com.clustercontrol.logfile.session.MonitorLogfileControllerBean.java
/** * ???//w w w. j a va 2 s. co m * * * @return Object?2? * @throws MonitorNotFound * @throws InvalidRole * @throws HinemosUnknown */ public ArrayList<MonitorInfo> getLogfileList() throws MonitorNotFound, InvalidRole, HinemosUnknown { JpaTransactionManager jtm = null; ArrayList<MonitorInfo> list = null; try { jtm = new JpaTransactionManager(); jtm.begin(); list = new SelectMonitor().getMonitorListObjectPrivilegeModeNONE(HinemosModuleConstant.MONITOR_LOGFILE); jtm.commit(); } catch (Exception e) { m_log.warn("getLogfileList() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); if (jtm != null) jtm.rollback(); throw new HinemosUnknown(e.getMessage(), e); } finally { if (jtm != null) jtm.close(); } return list; }
From source file:com.veterinaria.jsf.controllers.ClienteController.java
public List<Cliente> getListaCliente() { if (listaCliente == null) { try {/*from w ww . ja v a2s . co m*/ listaCliente = getClienteFacade().findAll(); } catch (Exception e) { addErrorMessage("Error closing resource " + e.getClass().getName(), "Message: " + e.getMessage()); } } return listaCliente; }
From source file:com.poscoict.license.web.controller.ExceptionControllerAdvice.java
public ModelAndView errView(Exception ex) { ex.printStackTrace();// w w w .j a va 2s . co m logger.error(ex.toString()); ModelAndView mv = new ModelAndView(DEFAULT_ERROR_VIEW); mv.addObject("name", ex.getClass().getSimpleName()); //mv.addObject("message", ex.getMessage()); mv.addObject("message", "?"); if (ex.getClass().getSimpleName().equals("BadSqlGrammarException")) { mv.addObject("message", "?? ? . ? ."); } else if (ex.getClass().getSimpleName().equals("MySQLSyntaxErrorException")) { mv.addObject("message", "?? ? . ? ."); } else if (ex.getClass().getSimpleName().equals("NullPointerException")) { mv.addObject("message", "?? ?. ?? ? ."); } else if (ex.getClass().getSimpleName().equals("DuplicateKeyException")) { mv.addObject("message", "? ?. ?? ? ."); } else if (ex.getClass().getSimpleName().equals("SQLException")) { mv.addObject("message", "?? ? . ? ."); } else if (ex.getClass().getSimpleName().equals("MySQLIntegrityConstraintViolationException")) { mv.addObject("message", "? ?. ?? ? ."); } else if (ex.getClass().getSimpleName().equals("DataIntegrityViolationException")) { mv.addObject("message", "? ?. ?? ? . ? ? ? ? ? ."); } else if (ex.getClass().getSimpleName().equals("IOException")) { mv.addObject("message", "?"); } else if (ex.getClass().getSimpleName().equals("Exception")) { mv.addObject("message", "ex.?"); } else { mv.addObject("message", "?"); } return mv; }
From source file:com.qrmedia.commons.persistence.hibernate.clone.property.AbstractValueAwareCollectionCloner.java
@SuppressWarnings("unchecked") @Override//from w w w. java 2s .c o m protected <T> boolean cloneValue(Object source, Object target, String propertyName, Object propertyValue, HibernateEntityGraphCloner entityGraphCloner) throws IllegalArgumentException { if (!(propertyValue instanceof Collection<?>)) { return false; } Collection<T> clonedCollection = cloneCollection(source, target, propertyName, (Collection<T>) propertyValue, entityGraphCloner); boolean cloneSuccessful = (clonedCollection != null); /* * The cloned collection should only be linked to the target if the cloner * actually processed it! */ if (cloneSuccessful) { try { PropertyUtils.setSimpleProperty(target, propertyName, clonedCollection); } catch (Exception exception) { throw new IllegalArgumentException("Unable to set collection '" + propertyName + "' on " + target + " due to " + exception.getClass().getSimpleName() + ": " + exception.getMessage()); } } return cloneSuccessful; }
From source file:net.pandoragames.far.ui.swing.component.MacOSXMenuAdapter.java
/** * Some methods must explicitely be enabled. * @param methodName name of a method on class Application that takes a single boolean argument *///w w w. ja v a 2s. c o m private void enableApplicationMenuItem(String methodName) { try { Method enableAboutMethod = macOSXApplication.getClass().getDeclaredMethod(methodName, new Class[] { boolean.class }); enableAboutMethod.invoke(macOSXApplication, new Object[] { Boolean.TRUE }); } catch (Exception x) { logger.error( x.getClass().getName() + " enabling menu item, calling " + methodName + ": " + x.getMessage()); } }
From source file:cz.muni.fi.mir.controllers.ExceptionHandlingController.java
private ModelAndView processException(Exception e) { StringWriter writer = new StringWriter(); e.printStackTrace(new PrintWriter(writer)); StringBuilder sb = new StringBuilder(); sb.append("An exception from following class has occurred: ").append(e.getClass().getName()).append("\n"); sb.append("Message was: ").append(e.getMessage()).append("\n"); sb.append("With following stacktrace:\n").append(writer.toString()); mailservice.sendMail("Error occured", sb.toString()); return new ModelAndView("errors/error", prepareModelMap(e, writer.toString())); }
From source file:ly.apps.androdi.rest.tests.FormValuesConverterTest.java
public void testFromResponseBody() throws UnsupportedEncodingException { Exception ne = null; try {/*from w ww. ja va 2 s . c o m*/ converter.fromResponseBody(null, null, null, null); } catch (Exception e) { ne = e; } assertNotNull(ne); assertEquals(UnsupportedOperationException.class, ne.getClass()); }