List of usage examples for java.lang IllegalAccessException getMessage
public String getMessage()
From source file:com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings.java
public void setServiceSettings(SpinnakerService.Type type, ServiceSettings settings) { Field serviceField = getServiceField(type.getCanonicalName()); serviceField.setAccessible(true);/* ww w .j a v a 2s . c om*/ try { serviceField.set(services, settings); } catch (IllegalAccessException e) { throw new HalException(Problem.Severity.FATAL, "Can't access service field for " + type.toString() + ": " + e.getMessage()); } finally { serviceField.setAccessible(false); } }
From source file:fr.mycellar.test.matchers.PropertiesMatcher.java
/** * {@inheritDoc}/*from w w w . j av a 2 s . c o m*/ */ @Override protected final boolean matchesSafely(T item, Description mismatchDescription) { boolean matches = true; mismatchDescription.appendText("had {"); for (String property : matchers.keySet()) { Matcher<?> matcher = matchers.get(property); Object subItem; try { subItem = PropertyUtils.getProperty(item, property); } catch (IllegalAccessException e) { throw new RuntimeException( "Cannot get " + property + " from " + item.getClass() + " : " + e.getMessage(), e); } catch (InvocationTargetException e) { throw new RuntimeException( "Cannot get " + property + " from " + item.getClass() + " : " + e.getMessage(), e); } catch (NoSuchMethodException e) { throw new RuntimeException( "Cannot get " + property + " from " + item.getClass() + " : " + e.getMessage(), e); } if (!matcher.matches(subItem)) { if (!matches) { mismatchDescription.appendText(", "); } mismatchDescription.appendText(property).appendText(" "); matcher.describeMismatch(subItem, mismatchDescription); matches = false; } } mismatchDescription.appendText("}"); return matches; }
From source file:org.apache.qpid.disttest.client.MessageProvider.java
protected void setStandardProperty(Message message, String property, Object propertyValue) throws JMSException { String propertyName = "JMS" + StringUtils.capitalize(property); try {//from w w w . j a v a 2s. co m BeanUtils.setProperty(message, propertyName, propertyValue); } catch (IllegalAccessException e) { throw new DistributedTestException("Unable to set property " + propertyName + " :" + e.getMessage(), e); } catch (InvocationTargetException e) { if (e.getCause() instanceof JMSException) { throw ((JMSException) e.getCause()); } else { throw new DistributedTestException("Unable to set property " + propertyName + " :" + e.getMessage(), e); } } }
From source file:org.jfree.chart.plot.StackedXYPlot.java
/** * Draws the plot./*from w w w .j a v a 2 s . c om*/ * @param graphics2d the graphics device. * @param plotArea the plot plotArea (in Java2D space). * @param anchor an anchor point in Java2D space (<code>null</code> permitted). * @param parentState the state from the parent plot (<code>null</code> permitted). * @param plotRenderingInfo chart drawing information (<code>null</code> permitted). */ @Override public void draw(Graphics2D graphics2d, Rectangle2D plotArea, Point2D anchor, PlotState parentState, PlotRenderingInfo plotRenderingInfo) { if (plotRenderingInfo != null) { plotRenderingInfo.setPlotArea(plotArea); } RectangleInsets insets = getInsets(); insets.trim(plotArea); setFixedRangeAxisSpaceForSubplots(null); //calculateAxisSpace will also calculate sub-plot plotArea AxisSpace space = calculateAxisSpace(graphics2d, plotArea); Rectangle2D dataArea = space.shrink(plotArea, null); Rectangle2D[] calculatedSubPlotAreas = null; //get subplotsAreas from parent class try { calculatedSubPlotAreas = (Rectangle2D[]) FieldUtils.readField(this, "subplotAreas", true); } catch (IllegalAccessException ex) { Logger.getLogger(StackedXYPlot.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); } setFixedRangeAxisSpaceForSubplots(space); // draw all the subplots for (int i = 0; i < getSubplots().size(); i++) { XYPlot plot = (XYPlot) getSubplots().get(i); PlotRenderingInfo subplotInfo = null; if (plotRenderingInfo != null) { subplotInfo = new PlotRenderingInfo(plotRenderingInfo.getOwner()); plotRenderingInfo.addSubplotInfo(subplotInfo); } plot.draw(graphics2d, calculatedSubPlotAreas[i], anchor, parentState, subplotInfo); } if (plotRenderingInfo != null) { plotRenderingInfo.setDataArea(dataArea); } }
From source file:nl.b3p.commons.taglib.LinkBeanTag.java
/** * Render the beginning of the bean hyperlink. * * @exception JspException if a JSP exception has occurred *///from w ww. j a v a2 s . c om public int doStartTag() throws JspException { // Calculate page from bean, if present and no page attribute if (blink != null && bpage != null) { // Retrieve the required property try { Object bean = pageContext.findAttribute(blink); page = (String) PropertyUtils.getProperty(bean, bpage); if (page == null) { return (SKIP_BODY); } } catch (IllegalAccessException e) { throw new JspException("No access: " + e.getMessage()); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); throw new JspException("No result: " + e.getMessage()); } catch (NoSuchMethodException e) { throw new JspException("No method: " + e.getMessage()); } catch (Exception e) { } } return super.doStartTag(); }
From source file:org.openadaptor.auxil.processor.map.AttributeMapProcessor.java
protected Object cloneMap(Map incoming) { if (incoming instanceof IOrderedMap) { return ((IOrderedMap) incoming).clone(); }//from w ww . j ava 2s . c om if (incoming instanceof MapFacade) { return ((MapFacade) incoming).clone(); } if (incoming instanceof HashMap) { return ((HashMap) incoming).clone(); } try { Method cloneMethod = incoming.getClass().getMethod(mapCloneMethod, (Class[]) null); return (cloneMethod.invoke(incoming, (Object[]) null)); } catch (NoSuchMethodException nsme) { log.warn("Unable to find clone method " + mapCloneMethod + "(). " + nsme.getMessage()); } catch (InvocationTargetException ite) { log.warn("Unable to invoke clone method " + mapCloneMethod + "(). " + ite.getMessage()); } catch (IllegalAccessException iae) { log.warn("Failed to invoke clone method " + mapCloneMethod + "(). " + iae.getMessage()); } log.warn("Unable to clone incoming map - the original might get modified!"); return incoming; }
From source file:org.kuali.coeus.common.budget.framework.query.QueryEngine.java
public void addDataCollection(Object object, String... strings) { for (int i = 0; i < strings.length; i++) { try {//from w w w.j a va 2 s. c o m List dataList = (List) PropertyUtils.getProperty(object, strings[i]); if (dataList != null && !dataList.isEmpty()) { dataCollection.put(dataList.get(0).getClass(), dataList); } } catch (IllegalAccessException e) { LOG.error(e.getMessage(), e); } catch (InvocationTargetException e) { LOG.error(e.getMessage(), e); } catch (NoSuchMethodException e) { LOG.error(e.getMessage(), e); } } }
From source file:nl.b3p.commons.taglib.LinkBeanTag.java
/** * Render the end of the hyperlink./* w w w . ja v a 2s . c o m*/ * * @exception JspException if a JSP exception has occurred */ public int doEndTag() throws JspException { // Calculate message from bean, if present and no body content if (blink != null && bmessage != null && text == null) { // Retrieve the required property String key = null; try { Object bean = pageContext.findAttribute(blink); key = (String) PropertyUtils.getProperty(bean, bmessage); } catch (IllegalAccessException e) { throw new JspException("No access: " + e.getMessage()); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); throw new JspException("No result: " + e.getMessage()); } catch (NoSuchMethodException e) { throw new JspException("No method: " + e.getMessage()); } catch (Exception e) { } // Retrieve the message string we are looking for String message = TagUtils.getInstance().message(pageContext, this.bundle, this.localeKey, key); if (message != null && message.length() > 0) { text = message; } else if (key != null) { text = key; } else { text = ""; } } return super.doEndTag(); }
From source file:org.jbuilt.utils.MessageClosure.java
public void restoreState(FacesContext context, Object state) { // if we have state if (null == state) { return;/*from ww w . jav a 2s .co m*/ } Object[] stateStruct = (Object[]) state; Object savedState = stateStruct[0]; String className = stateStruct[1].toString(); MethodExpression result = null; Class toRestoreClass = null; if (null != className) { try { toRestoreClass = loadClass(className, this); } catch (ClassNotFoundException e) { throw new IllegalStateException(e.getMessage()); } if (null != toRestoreClass) { try { result = (MethodExpression) toRestoreClass.newInstance(); } catch (InstantiationException e) { throw new IllegalStateException(e.getMessage()); } catch (IllegalAccessException a) { throw new IllegalStateException(a.getMessage()); } } if (null != result && null != savedState) { // don't need to check transient, since that was // done on the saving side. ((StateHolder) result).restoreState(context, savedState); } } }
From source file:org.nuxeo.opensocial.servlet.GuiceContextListener.java
private Module getModuleInstance(String moduleName) throws InstantiationException { try {/*w w w . ja va2 s.com*/ return (Module) Class.forName(moduleName).newInstance(); } catch (IllegalAccessException e) { InstantiationException ie = new InstantiationException("IllegalAccessException: " + e.getMessage()); ie.setStackTrace(e.getStackTrace()); throw ie; } catch (ClassNotFoundException e) { InstantiationException ie = new InstantiationException("ClassNotFoundException: " + e.getMessage()); ie.setStackTrace(e.getStackTrace()); throw ie; } }