List of usage examples for java.lang IllegalAccessException getLocalizedMessage
public String getLocalizedMessage()
From source file:it.geosolutions.geoserver.jms.impl.handlers.catalog.CatalogUtils.java
public static LayerGroupInfo localizeLayerGroup(final LayerGroupInfo info, final Catalog catalog) throws IllegalAccessException, InvocationTargetException { if (info == null || catalog == null) throw new NullArgumentException("Arguments may never be null"); final LayerGroupInfo localObject = catalog.getLayerGroupByName(info.getName()); if (localObject != null) { return localObject; }/*from w w w .j a v a2 s.c om*/ try { info.getLayers().addAll(localizeLayers(info.getLayers(), catalog)); } catch (IllegalAccessException e) { if (LOGGER.isLoggable(java.util.logging.Level.SEVERE)) LOGGER.severe(e.getLocalizedMessage()); throw e; } catch (InvocationTargetException e) { if (LOGGER.isLoggable(java.util.logging.Level.SEVERE)) LOGGER.severe(e.getLocalizedMessage()); throw e; } // localize layers info.getStyles().addAll(localizeStyles(new HashSet<StyleInfo>(info.getStyles()), catalog)); // attach to the catalog final CatalogBuilder builder = new CatalogBuilder(catalog); builder.attach(info); return info; }
From source file:com.tlabs.eve.api.parser.AbstractXMLParser.java
@SuppressWarnings("unchecked") public synchronized final T parse(byte[] data) throws IOException { this.digester.clear(); try {/*from w w w . j av a 2s . co m*/ T t = responseClass.newInstance(); doBeforeParse(t); this.digester.push(t); t = (T) this.digester.parse(new ByteArrayInputStream(data)); t.setContent(data); doAfterParse(t); return t; } catch (IllegalAccessException e) { throw new IOException(e.getLocalizedMessage()); } catch (InstantiationException e) { throw new IOException(e.getLocalizedMessage()); } catch (SAXException e) { e.printStackTrace(System.err); throw new IOException(e.getLocalizedMessage()); } }
From source file:com.google.gwt.sample.dynatablemvp.server.loc.ProxyObjectLocator.java
private Object getFieldValueWithAnnotation(E domainObject, String annotation) { Object result = null;/*from w w w. j av a 2 s .c o m*/ Method[] meths = domainObject.getClass().getMethods(); Method idMethod = null; for (Method m : meths) { for (Annotation a : m.getAnnotations()) { String annotName = a.annotationType().getName(); if (annotName.equalsIgnoreCase(annotation)) { idMethod = m; break; } } if (idMethod != null) { try { result = idMethod.invoke(domainObject); } catch (IllegalAccessException e) { log.error(e.getLocalizedMessage(), e); result = null; } catch (IllegalArgumentException e) { log.error(e.getLocalizedMessage(), e); result = null; } catch (InvocationTargetException e) { log.error(e.getLocalizedMessage(), e); result = null; } break; } } return result; }
From source file:org.opentaps.common.reporting.ChartViewHandler.java
public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException { /*//from www.j a v a 2 s . c o m * Looks for parameter "chart" first. Send this temporary image files * to client if it exists and return. */ String chartFileName = UtilCommon.getParameter(request, "chart"); if (UtilValidate.isNotEmpty(chartFileName)) { try { ServletUtilities.sendTempFile(chartFileName, response); if (chartFileName.indexOf(ServletUtilities.getTempOneTimeFilePrefix()) != -1) { // delete temporary file File file = new File(System.getProperty("java.io.tmpdir"), chartFileName); file.delete(); } } catch (IOException ioe) { Debug.logError(ioe.getLocalizedMessage(), module); } return; } /* * Next option eliminate need to store chart in file system. Some event handler * included in request chain prior to this view handler can prepare ready to use * instance of JFreeChart and place it to request attribute chartContext. * Currently chartContext should be Map<String, Object> and we expect to see in it: * "charObject" : JFreeChart * "width" : positive Integer * "height" : positive Integer * "encodeAlpha" : Boolean (optional) * "compressRatio" : Integer in range 0-9 (optional) */ Map<String, Object> chartContext = (Map<String, Object>) request.getAttribute("chartContext"); if (UtilValidate.isNotEmpty(chartContext)) { try { sendChart(chartContext, response); } catch (IOException ioe) { Debug.logError(ioe.getLocalizedMessage(), module); } return; } /* * Prepare context for next options */ Map<String, Object> callContext = FastMap.newInstance(); callContext.put("parameters", UtilHttp.getParameterMap(request)); callContext.put("delegator", request.getAttribute("delegator")); callContext.put("dispatcher", request.getAttribute("dispatcher")); callContext.put("userLogin", request.getSession().getAttribute("userLogin")); callContext.put("locale", UtilHttp.getLocale(request)); /* * view-map attribute "page" may contain BeanShell script in component * URL format that should return chartContext map. */ if (UtilValidate.isNotEmpty(page) && UtilValidate.isUrl(page) && page.endsWith(".bsh")) { try { chartContext = (Map<String, Object>) BshUtil.runBshAtLocation(page, callContext); if (UtilValidate.isNotEmpty(chartContext)) { sendChart(chartContext, response); } } catch (GeneralException ge) { Debug.logError(ge.getLocalizedMessage(), module); } catch (IOException ioe) { Debug.logError(ioe.getLocalizedMessage(), module); } return; } /* * As last resort we can decide that "page" attribute contains class name and "info" * contains method Map<String, Object> getSomeChart(Map<String, Object> context). * There are parameters, delegator, dispatcher, userLogin and locale in the context. * Should return chartContext. */ if (UtilValidate.isNotEmpty(page) && UtilValidate.isNotEmpty(info)) { Class handler = null; synchronized (this) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { handler = loader.loadClass(page); if (handler != null) { Method runMethod = handler.getMethod(info, new Class[] { Map.class }); chartContext = (Map<String, Object>) runMethod.invoke(null, callContext); if (UtilValidate.isNotEmpty(chartContext)) { sendChart(chartContext, response); } } } catch (ClassNotFoundException cnfe) { Debug.logError(cnfe.getLocalizedMessage(), module); } catch (SecurityException se) { Debug.logError(se.getLocalizedMessage(), module); } catch (NoSuchMethodException nsme) { Debug.logError(nsme.getLocalizedMessage(), module); } catch (IllegalArgumentException iae) { Debug.logError(iae.getLocalizedMessage(), module); } catch (IllegalAccessException iace) { Debug.logError(iace.getLocalizedMessage(), module); } catch (InvocationTargetException ite) { Debug.logError(ite.getLocalizedMessage(), module); } catch (IOException ioe) { Debug.logError(ioe.getLocalizedMessage(), module); } } } // Why you disturb me? throw new ViewHandlerException( "In order to generate chart you have to provide chart object or file name. There are no such data in request. Please read comments to ChartViewHandler class."); }
From source file:it.geosolutions.geobatch.imagemosaic.ImageMosaicCommand.java
/** * clone/* w w w. java 2 s. co m*/ */ @Override public ImageMosaicCommand clone() { try { return (ImageMosaicCommand) BeanUtils.cloneBean(this); } catch (IllegalAccessException e) { if (LOGGER.isErrorEnabled()) LOGGER.error(e.getLocalizedMessage()); } catch (InstantiationException e) { if (LOGGER.isErrorEnabled()) LOGGER.error(e.getLocalizedMessage()); } catch (InvocationTargetException e) { if (LOGGER.isErrorEnabled()) LOGGER.error(e.getLocalizedMessage()); } catch (NoSuchMethodException e) { if (LOGGER.isErrorEnabled()) LOGGER.error(e.getLocalizedMessage()); } return null; }
From source file:fr.inria.atlanmod.instantiator.SpecimenGenerator.java
/** * @param instanceClass/*w w w . j a v a2 s . c om*/ */ private Object nextObject(Class<?> instanceClass) { if (instanceClass == String.class) { return Gpw.generate(generator.nextInt(24) + 1); } else if (Number.class.isAssignableFrom(instanceClass)) { try { Method method = instanceClass.getMethod("valueOf", long.class); return method.invoke(null, Gpw.generate(generator.nextInt(24) + 1).hashCode()); } catch (IllegalAccessException e) { log(e.getLocalizedMessage()); } catch (NoSuchMethodException e) { log(e.getLocalizedMessage()); } catch (SecurityException e) { log(e.getLocalizedMessage()); } catch (IllegalArgumentException e) { log(e.getLocalizedMessage()); } catch (InvocationTargetException e) { log(e.getLocalizedMessage()); } } else { log("Do not know how to randomly generate " + instanceClass.getName() + " object"); } return null; }
From source file:com.opencsv.bean.AbstractBeanField.java
/** * Assigns the given object to this field of the destination bean. * Uses a custom setter method if available. * * @param <T> Type of the bean// w ww .j a v a 2 s.c o m * @param bean The bean in which the field is located * @param obj The data to be assigned to this field of the destination bean * @throws CsvDataTypeMismatchException If the data to be assigned cannot * be converted to the type of the destination field */ private <T> void assignValueToField(T bean, Object obj) throws CsvDataTypeMismatchException { // obj == null means that the source field was empty. Then we simply // leave the field as it was initialized by the VM. For primitives, // that will be values like 0, and for objects it will be null. if (obj != null) { Class<?> fieldType = field.getType(); // Find and use a setter method if one is available. String setterName = "set" + Character.toUpperCase(field.getName().charAt(0)) + field.getName().substring(1); try { Method setterMethod = bean.getClass().getMethod(setterName, fieldType); try { setterMethod.invoke(bean, obj); } catch (IllegalAccessException e) { // Can't happen, because we've already established that the // method is public through the use of getMethod(). } catch (InvocationTargetException e) { CsvDataTypeMismatchException csve = new CsvDataTypeMismatchException(obj, fieldType, e.getLocalizedMessage()); csve.initCause(e); throw csve; } } catch (NoSuchMethodException e1) { // Replace with a multi-catch as soon as we support Java 7 // Otherwise set the field directly. writeWithoutSetter(bean, obj); } catch (SecurityException e1) { // Otherwise set the field directly. writeWithoutSetter(bean, obj); } } }
From source file:org.cropinformatics.ui.components.impl.PropertySetValueOperation.java
@Override public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { try {//from www.ja v a2s . c o m PropertyUtils.setProperty(bean, property, value); return Status.OK_STATUS; } catch (IllegalAccessException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } catch (InvocationTargetException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } catch (NoSuchMethodException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } }
From source file:org.cropinformatics.ui.components.impl.PropertySetValueOperation.java
@Override public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { try {//from ww w . jav a 2 s . co m PropertyUtils.setProperty(bean, property, oldValue); return Status.OK_STATUS; } catch (IllegalAccessException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } catch (InvocationTargetException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } catch (NoSuchMethodException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } }
From source file:org.eclipse.jubula.client.archive.XmlImporter.java
/** * @param proj The project to which the test result summaries belongs. * @param trsListXml//from www . ja v a 2s . c om * The XML element for the test result summaries */ private void initTestResultSummaries(TestresultSummaries trsListXml, IProjectPO proj) { PropertyDescriptor[] propertiesToImport = BEAN_UTILS.getPropertyUtils() .getPropertyDescriptors(ITestResultSummary.class); for (TestresultSummary trsXml : trsListXml.getTestresultSummaryList()) { ITestResultSummaryPO summary = PoMaker.createTestResultSummaryPO(); summary.setInternalProjectGuid(proj.getGuid()); for (PropertyDescriptor pd : propertiesToImport) { List<SummaryAttribute> entries = trsXml.getAttributeList(); String propertyNameToSet = pd.getName(); boolean found = false; int pos = 0; for (SummaryAttribute me : entries) { if (me.getKey().equals(propertyNameToSet)) { found = true; break; } pos++; } if (found) { SummaryAttribute sa = entries.get(pos); if (!sa.isNilValue()) { try { BEAN_UTILS.setProperty(summary, propertyNameToSet, sa.getValue()); } catch (IllegalAccessException e) { log.warn(e.getLocalizedMessage(), e); } catch (InvocationTargetException e) { log.warn(e.getLocalizedMessage(), e); } } } else { log.warn(Messages.Property + StringConstants.SPACE + propertyNameToSet + StringConstants.SPACE + Messages.NotFound + StringConstants.DOT); } } List<MonitoringValues> tmpList = trsXml.getMonitoringValueList(); Map<String, IMonitoringValue> tmpMap = new HashMap<String, IMonitoringValue>(); for (int i = 0; i < tmpList.size(); i++) { MonitoringValues tmpMon = tmpList.get(i); MonitoringValue tmp = new MonitoringValue(); tmp.setCategory(tmpMon.getCategory()); tmp.setSignificant(tmpMon.getIsSignificant()); tmp.setType(tmpMon.getType()); tmp.setValue(tmpMon.getValue()); tmpMap.put(tmpMon.getKey(), tmp); } summary.setMonitoringValues(tmpMap); if (!TestResultSummaryPM.doesTestResultSummaryExist(summary)) { TestResultSummaryPM.storeTestResultSummaryInDB(summary); } } }