List of usage examples for java.lang IllegalAccessException getMessage
public String getMessage()
From source file:nonjsp.application.BuildComponentFromTagImpl.java
public UIComponent createComponentForTag(String shortTagName) { UIComponent result = null;//w w w . ja v a2 s .c o m if (!tagHasComponent(shortTagName)) { return result; } String className = (String) classMap.get(shortTagName); Class componentClass; // PENDING(edburns): this can be way optimized try { componentClass = Util.loadClass(className); result = (UIComponent) componentClass.newInstance(); } catch (IllegalAccessException iae) { throw new RuntimeException("Can't create instance for " + className + ": " + iae.getMessage()); } catch (InstantiationException ie) { throw new RuntimeException("Can't create instance for " + className + ": " + ie.getMessage()); } catch (ClassNotFoundException e) { throw new RuntimeException("Can't find class for " + className + ": " + e.getMessage()); } return result; }
From source file:org.projectforge.business.user.UserPrefDao.java
private void addUserPrefParameters(final UserPrefDO userPref, final Class<?> beanType, final Object obj) { Validate.notNull(userPref);/*from w w w . j a v a 2 s . c om*/ Validate.notNull(beanType); final Field[] fields = beanType.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); int no = 0; for (final Field field : fields) { if (field.isAnnotationPresent(UserPrefParameter.class) == true) { final UserPrefEntryDO userPrefEntry = new UserPrefEntryDO(); userPrefEntry.setParameter(field.getName()); if (obj != null) { Object value = null; try { value = field.get(obj); userPrefEntry.setValue(convertParameterValueToString(value)); } catch (final IllegalAccessException ex) { log.error(ex.getMessage(), ex); } userPrefEntry.valueAsObject = value; } evaluateAnnotation(userPrefEntry, beanType, field); if (userPrefEntry.orderString == null) { userPrefEntry.orderString = "ZZZ" + StringHelper.format2DigitNumber(no++); } userPref.addUserPrefEntry(userPrefEntry); } } }
From source file:com.square.core.util.validation.ValidationExpressionUtil.java
/** * Mthode qui prend une liste de proprit pour vrifier si remplis sur un objet cible. * @param rapport le rapport./* ww w. j a va2 s .c o m*/ * @param bean le bean vrifier * @param props tableau des expressions. * @return this pour chainage des appels */ public ValidationExpressionUtil verifierSiVide(final RapportDto rapport, final Object bean, final ValidationExpressionProp[] props) { for (ValidationExpressionProp prop : props) { try { final Object valeurProp = PropertyUtils.getProperty(bean, prop.getNomPropriete()); verifierSiVide(rapport, prop.getMessage(), prop.getMessageErreur(), valeurProp == null ? null : String.valueOf(valeurProp), formerPropNom(prop, bean)); } catch (IllegalAccessException e) { throw new TechnicalException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new TechnicalException(e.getMessage(), e); } catch (NoSuchMethodException e) { throw new TechnicalException(e.getMessage(), e); } catch (NestedNullException e) { rapport.ajoutRapport(formerPropNom(prop, bean), prop.getMessage(), true); } } return this; }
From source file:com.square.core.util.validation.ValidationExpressionUtil.java
/** * Mthode qui prend une liste de proprit pour vrifier leur nullit sur un objet cible. * @param rapport le rapport.//from w ww . jav a2 s.co m * @param bean le bean vrifier * @param props tableau des expressions. * @return this pour chainage des appels */ public ValidationExpressionUtil verifierSiNull(final RapportDto rapport, final Object bean, final ValidationExpressionProp[] props) { for (ValidationExpressionProp prop : props) { try { final Object valeurProp = PropertyUtils.getProperty(bean, prop.getNomPropriete()); verifierSiNull(rapport, prop.getMessage(), prop.getMessageErreur(), valeurProp, formerPropNom(prop, bean)); } catch (IllegalAccessException e) { throw new TechnicalException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new TechnicalException(e.getMessage(), e); } catch (NoSuchMethodException e) { throw new TechnicalException(e.getMessage(), e); } catch (NestedNullException e) { rapport.ajoutRapport(formerPropNom(prop, bean), prop.getMessage(), true); } } return this; }
From source file:com.ottogroup.bi.asap.repository.CachedComponentClassLoader.java
/** * Looks up the reference {@link DataComponent}, instantiates it and passes over the provided {@link Properties} * @param name name of component to instantiate (required) * @param version version of component to instantiate (required) * @param properties properties to use for instantiation * @return//w w w . ja v a 2 s.c o m * @throws RequiredInputMissingException thrown in case a required parameter value is missing * @throws ComponentInstantiationFailedException thrown in case the instantiation failed for any reason * @throws UnknownComponentException thrown in case the name and version combination does not reference a managed component */ public Component newInstance(final String id, final String name, final String version, final Properties properties) throws RequiredInputMissingException, ComponentInstantiationFailedException, UnknownComponentException { ////////////////////////////////////////////////////////////////////////////////////////// // validate provided input if (StringUtils.isBlank(id)) throw new RequiredInputMissingException("Missing required component id"); if (StringUtils.isBlank(name)) throw new RequiredInputMissingException("Missing required component name"); if (StringUtils.isBlank(version)) throw new RequiredInputMissingException("Missing required component version"); // ////////////////////////////////////////////////////////////////////////////////////////// long start = System.currentTimeMillis(); // generate component key and retrieve the associated descriptor ... if available String componentKey = getManagedComponentKey(name, version); ComponentDescriptor descriptor = this.managedComponents.get(componentKey); if (descriptor == null) throw new UnknownComponentException("Unknown component [name=" + name + ", version=" + version + "]"); // if the descriptor exists, load the referenced component class, create an instance and hand over the properties try { Class<?> messageHandlerClass = loadClass(descriptor.getComponentClass()); Component instance = (Component) messageHandlerClass.newInstance(); instance.setId(id); long beforeInit = System.currentTimeMillis(); instance.init(properties); long endAfterInit = System.currentTimeMillis(); if (logger.isDebugEnabled()) logger.debug("newInstance[name=" + name + ", version=" + version + ", overall=" + (endAfterInit - start) + "ms, instance=" + (beforeInit - start) + "ms, init=" + (endAfterInit - beforeInit) + "ms]"); return instance; } catch (IllegalAccessException e) { throw new ComponentInstantiationFailedException("Failed to instantiate component [name=" + name + ", version=" + version + ", reason=" + e.getMessage()); } catch (InstantiationException e) { throw new ComponentInstantiationFailedException("Failed to instantiate component [name=" + name + ", version=" + version + ", reason=" + e.getMessage()); } catch (ClassNotFoundException e) { throw new ComponentInstantiationFailedException("Failed to instantiate component [name=" + name + ", version=" + version + ", reason=" + e.getMessage()); } }
From source file:com.concursive.connect.indexer.LuceneIndexer.java
private Object getObjectIndexer(String className) { Object classRef = null;/*from w ww . ja v a2 s .c om*/ if (classes.containsKey(className)) { classRef = classes.get(className); } else { try { classRef = Class.forName(className).newInstance(); classes.put(className, classRef); } catch (ClassNotFoundException cnfe) { LOG.warn("Class Not Found Exception. MESSAGE = " + cnfe.getMessage(), cnfe); } catch (InstantiationException ie) { LOG.error("Instantiation Exception. MESSAGE = " + ie.getMessage(), ie); } catch (IllegalAccessException iae) { LOG.error("Illegal Argument Exception. MESSAGE = " + iae.getMessage(), iae); } } return classRef; }
From source file:com.concursive.connect.indexer.LuceneIndexer.java
private boolean indexDeleteItem(IndexWriter writer, Object item, String deleteTerm) throws IOException { // Determine the object's indexer key term for deletion Indexer objectIndexer = (Indexer) getObjectIndexer(item.getClass().getName() + "Indexer"); if (objectIndexer == null) { return false; }/* w w w . j ava2 s .c o m*/ // Delete the previous item from the index Object o = null; try { // now we are ready for the next to last step..to call upon the method in the // class instance we have. Method method = objectIndexer.getClass().getMethod(deleteTerm, Object.class); o = method.invoke(objectIndexer, item); } catch (NoSuchMethodException nm) { LOG.error("No Such Method Exception for method " + deleteTerm + ". MESAGE = " + nm.getMessage(), nm); } catch (IllegalAccessException ia) { LOG.error("Illegal Access Exception. MESSAGE = " + ia.getMessage(), ia); } catch (Exception e) { LOG.error("Exception. MESSAGE = " + e.getMessage(), e); } if (o != null) { LOG.debug("Deleting with deleteTerm: " + deleteTerm); writer.deleteDocuments((Term) o); } return true; }
From source file:nonjsp.application.BuildComponentFromTagImpl.java
public void applyAttributesToComponentInstance(UIComponent child, Attributes attrs) { int attrLen, i = 0; String attrName, attrValue;/* ww w. java 2s . c o m*/ attrLen = attrs.getLength(); for (i = 0; i < attrLen; i++) { attrName = mapAttrNameToPropertyName(attrs.getLocalName(i)); attrValue = attrs.getValue(i); // First, try to set it as a bean property try { PropertyUtils.setNestedProperty(child, attrName, attrValue); } catch (NoSuchMethodException e) { // If that doesn't work, see if it requires special // treatment try { if (attrRequiresSpecialTreatment(attrName)) { handleSpecialAttr(child, attrName, attrValue); } else { // If that doesn't work, this will. child.getAttributes().put(attrName, attrValue); } } catch (IllegalAccessException innerE) { innerE.printStackTrace(); log.trace(innerE.getMessage()); } catch (IllegalArgumentException innerE) { innerE.printStackTrace(); log.trace(innerE.getMessage()); } catch (InvocationTargetException innerE) { innerE.printStackTrace(); log.trace(innerE.getMessage()); } catch (NoSuchMethodException innerE) { innerE.printStackTrace(); log.trace(innerE.getMessage()); } } catch (IllegalArgumentException e) { try { if (attrRequiresSpecialTreatment(attrName)) { handleSpecialAttr(child, attrName, attrValue); } else { // If that doesn't work, this will. child.getAttributes().put(attrName, attrValue); } } catch (IllegalAccessException innerE) { innerE.printStackTrace(); log.trace(innerE.getMessage()); } catch (IllegalArgumentException innerE) { innerE.printStackTrace(); log.trace(innerE.getMessage()); } catch (InvocationTargetException innerE) { innerE.printStackTrace(); log.trace(innerE.getMessage()); } catch (NoSuchMethodException innerE) { innerE.printStackTrace(); log.trace(innerE.getMessage()); } } catch (InvocationTargetException e) { e.printStackTrace(); log.trace(e.getMessage()); } catch (IllegalAccessException e) { e.printStackTrace(); log.trace(e.getMessage()); } } // cleanup: make sure we have the necessary required attributes if (child.getId() == null) { String gId = "foo" + Util.generateId(); child.setId(gId); } }
From source file:org.methodize.nntprss.feed.ChannelManager.java
/** * RSS Manager configuration/* ww w . j a v a 2s . c o m*/ * * - Monitored RSS feeds * feed url, and matching newsgroup name * * Once feeds are loaded, load existing persistent * store information about feeds * */ public void configure(Document config) { channelDAO.loadConfiguration(this); updateProxyConfig(); // Get poller Configuration Element rootElm = config.getDocumentElement(); NodeList cfgElms = rootElm.getElementsByTagName("poller"); if (cfgElms != null && cfgElms.getLength() > 0) { Element pollerElm = (Element) cfgElms.item(0); String threadsStr = pollerElm.getAttribute("threads"); if (threadsStr != null) { pollerThreads = Integer.parseInt(threadsStr); } } NodeList processorsElms = rootElm.getElementsByTagName("itemProcessors"); if (processorsElms != null && processorsElms.getLength() > 0) { NodeList processorElms = ((Element) processorsElms.item(0)).getElementsByTagName("processor"); if (processorElms != null && processorElms.getLength() > 0) { List processors = new ArrayList(); for (int i = 0; i < processorElms.getLength(); i++) { Element processorElm = (Element) processorElms.item(i); String itemProcessorClassName = processorElm.getAttribute("class"); if (itemProcessorClassName != null) { try { Object itemProcessorObject = Class.forName(itemProcessorClassName).newInstance(); if (!(itemProcessorObject instanceof ItemProcessor)) { log.warn(itemProcessorClassName + " not instance of org.methodize.nntprss.plugin.ItemProcessor, skipping"); } else { try { ItemProcessor itemProcessor = (ItemProcessor) itemProcessorObject; itemProcessor.initialize(processorElm); processors.add(itemProcessor); } catch (PluginException pe) { log.warn("Error initializing ItemProcessor plug-in: " + pe.getMessage() + ", skipping.", pe); } } } catch (ClassNotFoundException cnfe) { log.warn("Cannot find ItemProcessor class " + itemProcessorClassName, cnfe); } catch (IllegalAccessException iae) { log.warn("Error instantiating ItemProcessor class: " + iae.getMessage(), iae); } catch (InstantiationException ie) { log.warn("Error instantiating ItemProcessor class: " + ie.getMessage(), ie); } } } if (processors.size() > 0) { itemProcessors = (ItemProcessor[]) processors.toArray(new ItemProcessor[0]); } } } // Load feeds... categories = channelDAO.loadCategories(); channels = channelDAO.loadChannels(this); }
From source file:de.xirp.plugin.SecurePluginView.java
/** * Prints a log message that the access to the given method was * not allowed./* w ww . jav a2 s . c o m*/ * * @param methodName * the method name for which the access wasn't allowed */ private void accessNotAllowed(String methodName) { try { throw new IllegalAccessException(I18n.getString("SecurePluginView.exception.noPermission1", //$NON-NLS-1$ methodName, getName())); } catch (IllegalAccessException e) { logClass.error("Error: " + e.getMessage() + Constants.LINE_SEPARATOR, e); //$NON-NLS-1$ } }