List of usage examples for java.lang IllegalAccessException getMessage
public String getMessage()
From source file:org.mangelp.fakeSmtpWeb.httpServer.mvc.controller.AbstractActionHandler.java
protected Object executeAction(ActionInput input, ActionResult result, Method method) { Object methodResult = null;/*from w w w. j a v a2s .c om*/ try { methodResult = method.invoke(this, input, result); } catch (IllegalAccessException e) { result.fail(MvcErrors.UNHANDLED_ACTION_ERROR, e.getClass().getSimpleName() + ": " + e.getMessage()); } catch (IllegalArgumentException e) { result.fail(MvcErrors.UNHANDLED_ACTION_ERROR, e.getClass().getSimpleName() + ": " + e.getMessage()); } catch (InvocationTargetException e) { result.fail(MvcErrors.UNHANDLED_ACTION_ERROR, e.getClass().getSimpleName() + ": " + e.getMessage()); } return methodResult; }
From source file:com.espertech.esper.event.bean.BeanInstantiatorByFactoryReflection.java
public Object instantiate() { try {/*from ww w.j a v a 2 s .c o m*/ return method.invoke(null, null); } catch (InvocationTargetException e) { String message = "Unexpected exception encountered invoking factory method '" + method.getName() + "' on class '" + method.getDeclaringClass().getName() + "': " + e.getTargetException().getMessage(); log.error(message, e); return null; } catch (IllegalAccessException ex) { String message = "Unexpected exception encountered invoking factory method '" + method.getName() + "' on class '" + method.getDeclaringClass().getName() + "': " + ex.getMessage(); log.error(message, ex); return null; } }
From source file:ch.puzzle.itc.mobiliar.presentation.deploy.LogView.java
void loadFileContent() { if (file != null && deploymentId != null && availableLogFiles != null) { if (file != null && !availableLogFiles.contains(file)) { fileContent = null;/*from w ww .j a v a 2 s . c om*/ GlobalMessageAppender.addErrorMessage("The requested file does not belong to the given deployment"); } else { try { fileContent = deploymentBoundary.getDeploymentLog(file); } catch (IllegalAccessException e) { GlobalMessageAppender.addErrorMessage(e); log.log(Level.SEVERE, e.getMessage(), e); } } } }
From source file:org.kuali.coeus.common.budget.framework.query.operator.RelationalOperator.java
/**Compares this object with the specified object for order. *Returns a negative integer, zero, or a positive integer as this object *is less than, equal to, or greater than the specified object. *//*from ww w . ja v a 2 s.c o m*/ protected int compare(Object baseBean) { int compareValue = 0; if (dataClass == null || !dataClass.equals(baseBean.getClass())) { dataClass = baseBean.getClass(); try { field = dataClass.getDeclaredField(fieldName); if (!field.isAccessible()) { throw new NoSuchFieldException(); } } catch (NoSuchFieldException noSuchFieldException) { try { String methodName = ""; if (isBoolean) { methodName = "is" + (fieldName.charAt(0) + "").toUpperCase() + fieldName.substring(1); } else { methodName = "get" + (fieldName.charAt(0) + "").toUpperCase() + fieldName.substring(1); } method = dataClass.getMethod(methodName, null); } catch (NoSuchMethodException noSuchMethodException) { LOG.error(noSuchMethodException.getMessage(), noSuchMethodException); } } } //End if field==null && method==null try { if (field != null && field.isAccessible()) { if (!isBoolean) { Comparable comparable = (Comparable) field.get(baseBean); if (comparable == null && fixedData == null) { compareValue = 0; } else if (comparable == null) { throw new UnsupportedOperationException(); } else { compareValue = comparable.compareTo(fixedData); } } else { if (((Boolean) field.get(baseBean)).booleanValue() == booleanFixedData) compareValue = 0; else compareValue = 1; } } else { if (!isBoolean) { Comparable comparable = (Comparable) method.invoke(baseBean, null); if (comparable == null && fixedData == null) { compareValue = 0; } else if (comparable == null) { throw new UnsupportedOperationException(); } else if (comparable != null && fixedData == null) { compareValue = -1; } else { compareValue = comparable.compareTo(fixedData); } } else { Boolean booleanObj = (Boolean) method.invoke(baseBean, null); if (booleanObj == null) { compareValue = -1; } else { if (booleanObj.booleanValue() == booleanFixedData) compareValue = 0; else compareValue = 1; } } } } catch (IllegalAccessException illegalAccessException) { LOG.error(illegalAccessException.getMessage(), illegalAccessException); } catch (InvocationTargetException invocationTargetException) { LOG.error(invocationTargetException.getMessage(), invocationTargetException); } return compareValue; }
From source file:com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings.java
private ServiceSettings getServiceSettings(String name) { Field serviceField = getServiceField(name); serviceField.setAccessible(true);/* w w w . j av a 2 s . co m*/ try { return (ServiceSettings) serviceField.get(services); } catch (IllegalAccessException e) { throw new HalException(Problem.Severity.FATAL, "Can't access service field for " + name + ": " + e.getMessage()); } finally { serviceField.setAccessible(false); } }
From source file:org.jahia.modules.external.modules.osgi.ModulesSourceSpringInitializer.java
public void mountSourcesProvider(JahiaTemplatesPackage templatePackage) { if (context != null) { JCRStoreProvider provider = jcrStoreService.getSessionFactory().getProviders() .get("module-" + templatePackage.getId() + "-" + templatePackage.getVersion().toString()); if (provider == null) { try { Object dataSource = SpringContextSingleton .getBeanInModulesContext("ModulesDataSourcePrototype"); logger.info("Mounting source for bundle {}", templatePackage.getName()); Map<String, Object> properties = new LinkedHashMap<String, Object>(); properties.put("root", templatePackage.getSourcesFolder().toURI().toString()); properties.put("module", templatePackage); BeanUtils.populate(dataSource, properties); ExternalContentStoreProvider ex = (ExternalContentStoreProvider) SpringContextSingleton .getBeanInModulesContext("ExternalStoreProviderPrototype"); properties.clear();//w ww . j a v a 2s . c o m properties.put("key", "module-" + templatePackage.getId() + "-" + templatePackage.getVersion().toString()); properties.put("mountPoint", "/modules/" + templatePackage.getIdWithVersion() + "/sources"); properties.put("dataSource", dataSource); properties.put("lockSupport", true); properties.put("slowConnection", false); BeanUtils.populate(ex, properties); ex.start(); } catch (IllegalAccessException e) { logger.error(e.getMessage(), e); } catch (InvocationTargetException e) { logger.error(e.getMessage(), e); } catch (JahiaInitializationException e) { logger.error(e.getMessage(), e); } catch (NoSuchBeanDefinitionException e) { logger.debug(e.getMessage(), e); } catch (Exception e) { logger.error(e.getMessage(), e); } } } }
From source file:org.jfree.chart.plot.StackedXYPlot.java
/** * Adds a subplot with the specified weight * @param subplot the subplot (<code>null</code> not permitted). * @param weight the weight (must be >= 1). *///from w w w .jav a 2 s. com @Override public void add(XYPlot subplot, int weight) { Objects.requireNonNull(subplot, "subplot must not be null"); if (weight <= 0) { throw new IllegalArgumentException("weight must be >= 1."); } subplot.setParent(this); subplot.setWeight(weight); subplot.addChangeListener(this); subplot.setRangeZeroBaselineVisible(false); subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0), false); List subplots = Collections.EMPTY_LIST; try { subplots = (List) FieldUtils.readField(this, "subplots", true); } catch (IllegalAccessException ex) { Logger.getLogger(StackedXYPlot.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); } subplots.add(subplot); ValueAxis axis = getDomainAxis(); if (axis != null) { axis.configure(); } fireChangeEvent(); }
From source file:com.technophobia.webdriver.substeps.runner.DefaultWebDriverFactory.java
/** * By default the HtmlUnit driver is set to en-us. This can cause problems * with formatters.//from w w w .ja va 2s . c o m */ private void setDriverLocale(final WebDriver driver) { try { final Field field = driver.getClass().getDeclaredField("webClient"); if (field != null) { final boolean original = field.isAccessible(); field.setAccessible(true); final WebClient webClient = (WebClient) field.get(driver); if (webClient != null) { webClient.addRequestHeader("Accept-Language", "en-gb"); } field.setAccessible(original); } else { Assert.fail("Failed to get webclient field to set accept language"); } } catch (final IllegalAccessException ex) { LOG.warn(ex.getMessage()); } catch (final SecurityException e) { LOG.warn(e.getMessage()); } catch (final NoSuchFieldException e) { LOG.warn(e.getMessage()); } }
From source file:no.sesat.search.datamodel.DataModelFactoryImplTest.java
/** Calls the method.invoke(..) wrapping any thrown exceptions with a RuntimeException. **/ private Object invoke(final Method method, final Object dataObject, final Object... args) { try {//from w w w . ja v a2 s. c o m return method.invoke(dataObject, args); } catch (IllegalAccessException iae) { LOG.error(iae.getMessage(), iae); throw new RuntimeException(iae.getMessage(), iae); } catch (IllegalArgumentException iae) { LOG.info(iae.getMessage(), iae); throw new RuntimeException(iae.getMessage(), iae); } catch (InvocationTargetException ite) { LOG.info(ite.getMessage(), ite); throw new RuntimeException(ite.getMessage(), ite); } }