List of usage examples for java.lang IllegalAccessException printStackTrace
public void printStackTrace()
From source file:org.shortbrain.vaadin.container.AbstractContainerFactory.java
/** * Add an item (using bean) to the container, and look for * <code>children</code> if needed. * //from www . j ava 2 s . c o m * @param container * the container. * @param properties * the properties. * @param bean * the bean to add. * @param introspect * introspect for children. * @return the id of the added item */ @SuppressWarnings("unchecked") protected Object addItem(Container container, List<PropertyMetadata> properties, BEAN bean, boolean introspect) { Object itemId = container.addItem(); for (PropertyMetadata metadata : properties) { String propertyId = metadata.getPropertyName(); Object value = null; try { value = PropertyUtils.getProperty(bean, metadata.getPropertyAttribute()); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } container.getContainerProperty(itemId, propertyId).setValue(value); } // At the end, add the bean to the container (just in case) container.getContainerProperty(itemId, getBeanProperty()).setValue(bean); if (introspect) { Collection<BEAN> children; try { children = (Collection<BEAN>) PropertyUtils.getProperty(bean, "children"); if (children != null && !children.isEmpty()) { for (BEAN child : children) { addItem(container, properties, child, introspect); } } } catch (IllegalAccessException e) { // TODO Auto-generated catch block } catch (InvocationTargetException e) { // TODO Auto-generated catch block } catch (NoSuchMethodException e) { // TODO Auto-generated catch block } catch (RuntimeException e) { // FIXME This is evil (but I need this temporarly forhibernate // lazyInitialisation) // e.printStackTrace(); } } return itemId; }
From source file:com.taobao.android.builder.tasks.transform.ClassInjectTransform.java
private ClassPool initClassPool(List<JarInput> jarInputs, List<DirectoryInput> directoryInputs) { if (((VariantScopeImpl) this.appVariantContext.getScope()).getVariantData().getName().toLowerCase() .contains("debug")) { try {//ww w. j a v a 2s . com FieldUtils.writeStaticField(ClassPool.class, "defaultPool", null, true); } catch (IllegalAccessException e) { e.printStackTrace(); } } else { //logger.warn(">>> ?daemon <<<<"); } final ClassPool pool = ClassPool.getDefault(); try { File verifyFile = PathUtil.getJarFile(com.taobao.verify.Verifier.class); pool.insertClassPath(verifyFile.getAbsolutePath()); for (File file : appVariantContext.getScope().getJavaClasspath()) { if (file.isFile()) { pool.insertClassPath(file.getAbsolutePath()); } else { pool.appendClassPath(file.getAbsolutePath()); } } String path = Joiner.on(File.pathSeparator) .join(scope.getGlobalScope().getAndroidBuilder().getBootClasspathAsStrings(false)); pool.appendPathList(path); for (JarInput jarInput : jarInputs) { pool.insertClassPath(jarInput.getFile().getAbsolutePath()); } for (DirectoryInput directoryInput : directoryInputs) { pool.appendClassPath(directoryInput.getFile().getAbsolutePath()); } } catch (NotFoundException e) { throw new StopExecutionException(e.getMessage()); } return pool; }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.ChipSeqExperimentModel.java
@NotifyChange({ "currentSample" }) @Command//from w w w .j a v a 2 s .co m public void editChipSeqUnitSampleInput(@BindingParam("experiment") CSExperiment experiment, @BindingParam("unit") ChipSeqUnit unit) { this.edit = true; this.currentSample = unit.getSampleInput(); this.currentTmpSample = new Sample(); try { BeanUtils.copyProperties(this.currentTmpSample, this.currentSample); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.ChipSeqExperimentModel.java
@NotifyChange({ "currentSample" }) @Command/*from w ww. j a v a 2 s .c om*/ public void editChipSeqUnitSampleTreatment(@BindingParam("experiment") CSExperiment experiment, @BindingParam("unit") ChipSeqUnit unit) { this.edit = true; this.currentSample = unit.getSampleTreatment(); this.currentTmpSample = new Sample(); try { BeanUtils.copyProperties(this.currentTmpSample, this.currentSample); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }
From source file:org.openhie.openempi.loader.configuration.ConfigurableFileLoader.java
private void processField(String fieldName, String stringValue, String formatString, Class personClass, Object personInstance) {//from w ww. j ava 2 s . co m if (fieldName.length() == 0) return; if (personClass == Person.class && fieldName.equals("idSequence")) { idSeq = stringValue; return; } String setMethodName = ConvertUtil.getSetMethodName(fieldName); Class[] paramTypes = new Class[1]; Field field = null; try { field = personClass.getDeclaredField(fieldName); } catch (SecurityException e1) { e1.printStackTrace(); } catch (NoSuchFieldException e1) { e1.printStackTrace(); } Object value = null; Date dateValue = null; Race raceValue = null; Gender genderValue = null; Class paramClass = field.getType(); if (paramClass == String.class) { value = stringValue; } else if (paramClass == Date.class) { SimpleDateFormat format = new SimpleDateFormat(formatString); try { dateValue = format.parse(stringValue); } catch (ParseException e) { e.printStackTrace(); } value = dateValue; } else if (paramClass == Race.class) { raceValue = findRaceByName(stringValue); value = raceValue; } else if (paramClass == Gender.class) { genderValue = findGenderByCode(stringValue); value = genderValue; } if (value == null) return; paramTypes[0] = paramClass; Method setMethod = null; try { setMethod = personClass.getDeclaredMethod(setMethodName, paramTypes); Object[] params = new Object[1]; params[0] = value; try { setMethod.invoke(personInstance, params); } catch (IllegalArgumentException e1) { e1.printStackTrace(); } catch (IllegalAccessException e2) { e2.printStackTrace(); } catch (InvocationTargetException e3) { e3.printStackTrace(); } } catch (NoSuchMethodException e) { e.printStackTrace(); } }
From source file:org.openremote.beehive.api.service.impl.ModelServiceImpl.java
/** * {@inheritDoc}/*from ww w. j a va 2 s .c o m*/ */ public List<ModelDTO> findModelsByVendorId(long vendorId) { List<ModelDTO> modelDTOList = new ArrayList<ModelDTO>(); for (Model model : genericDAO.loadById(Vendor.class, vendorId).getModels()) { ModelDTO modelDTO = new ModelDTO(); try { BeanUtils.copyProperties(modelDTO, model); } catch (IllegalAccessException e) { // TODO handle exception e.printStackTrace(); } catch (InvocationTargetException e) { // TODO handle exception e.printStackTrace(); } modelDTOList.add(modelDTO); } return modelDTOList; }
From source file:org.openremote.beehive.api.service.impl.ModelServiceImpl.java
/** * {@inheritDoc}//w w w. j a v a2 s .c o m */ public ModelDTO loadByVendorNameAndModelName(String vendorName, String modelName) { Model model = null; List<Model> models = genericDAO.findByDetachedCriteria(getDetachedCriteria().createAlias("vendor", "v") .add(Restrictions.eq("v.name", vendorName)).add(Restrictions.eq("name", modelName))); if (models.size() > 0) { if (models.size() > 1) { logger.warn("There is more than one model named '" + modelName + "' belong to Vendor '" + vendorName + "'."); } model = models.get(0); } else { return null; } ModelDTO modelDTO = new ModelDTO(); try { BeanUtils.copyProperties(modelDTO, model); } catch (IllegalAccessException e) { // TODO handle exception e.printStackTrace(); } catch (InvocationTargetException e) { // TODO handle exception e.printStackTrace(); } return modelDTO; }
From source file:org.openremote.beehive.api.service.impl.ModelServiceImpl.java
/** * {@inheritDoc}/*from w w w. j a v a 2 s . com*/ */ public List<ModelDTO> findModelsByVendorName(String vendorName) { if (genericDAO.getByNonIdField(Vendor.class, "name", vendorName) == null) { return null; } DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Model.class); detachedCriteria.createAlias("vendor", "v").add(Restrictions.eq("v.name", vendorName)); List<Model> models = genericDAO.findByDetachedCriteria(detachedCriteria); List<ModelDTO> modelDTOList = new ArrayList<ModelDTO>(); for (Model model : models) { ModelDTO modelDTO = new ModelDTO(); try { BeanUtils.copyProperties(modelDTO, model); } catch (IllegalAccessException e) { // TODO handle exception e.printStackTrace(); } catch (InvocationTargetException e) { // TODO handle exception e.printStackTrace(); } modelDTOList.add(modelDTO); } return modelDTOList; }
From source file:org.seasar.s2click.control.S2ClickForm.java
@Override public void onInit() { if (requiresJavaScript()) { add(new HiddenField("action", "")); }/*from w ww .ja v a 2 s.c o m*/ for (java.lang.reflect.Field field : getClass().getFields()) { if (Field.class.isAssignableFrom(field.getType())) { try { Field value = (Field) field.get(this); Properties attrs = field.getAnnotation(Properties.class); if (attrs != null) { Properties.PropertiesProcessor.process(attrs, value); } if (value instanceof AjaxControl) { AjaxHandler handler = field.getAnnotation(AjaxHandler.class); if (handler != null) { AjaxHandler.AjaxHandlerProcessor.process(handler, (AjaxControl) value); } } if (isFieldAutoRegistration()) { add(value); } } catch (IllegalAccessException ex) { ex.printStackTrace(); } } } super.onInit(); }
From source file:com.krawler.common.notification.handlers.NotificationExtractorManager.java
public void replacePlaceholders(StringBuffer htmlMsg, NotificationRequest notificationReqObj, User recipientUser, DateFormat df) { try {//from ww w.j a v a 2 s . c o m // e.g // First Type of placeholder => #reftype1:oppmainowner.firstName# // Second Type of placeholder => #reftype1:oppname# java.lang.reflect.Method objMethod; String expr = "[#]{1}[a-zA-Z0-9]+[:]{1}[a-zA-Z0-9]+(\\.){0,1}[a-zA-Z0-9]*[#]{1}"; Pattern p = Pattern.compile(expr); Matcher m = p.matcher(htmlMsg); while (m.find()) { String table = m.group(); String woHash = table.substring(1, table.length() - 1); String[] sp = woHash.split(":"); if (!StringUtil.isNullOrEmpty(sp[0])) { // sp[0] having reftype1 which holds placeholder class path Class cl = notificationReqObj.getClass(); String methodStr = sp[0].substring(0, 1).toUpperCase() + sp[0].substring(1); // Make first letter of operand capital. String methodGetIdStr = methodStr.replace("type", "id"); objMethod = cl.getMethod("get" + methodStr + ""); // Gets the value of the operand String classPath = (String) objMethod.invoke(notificationReqObj); objMethod = cl.getMethod("get" + methodGetIdStr + ""); //refid1 which holds placeholder class object primary id String classObjectId = (String) objMethod.invoke(notificationReqObj); // Placeholder Class String value = "-"; Object invoker = commonTablesDAOObj.getObject(classPath, classObjectId); // load placeholder class Class placeHolderClass = invoker.getClass(); String[] operator = sp[1].split("\\."); // if (operator.length > 1) { // if having oppmainowner.firstName methodStr = operator[0].substring(0, 1).toUpperCase() + operator[0].substring(1); // Make first letter of operand capital. objMethod = placeHolderClass.getMethod("get" + methodStr + ""); Object innerClassObject = objMethod.invoke(invoker); // get oppmainowner object if (!StringUtil.isNullObject(innerClassObject)) { placeHolderClass = innerClassObject.getClass(); methodStr = operator[1].substring(0, 1).toUpperCase() + operator[1].substring(1); // Make first letter of operand capital. objMethod = placeHolderClass.getMethod("get" + methodStr + "");// get oppmainowner's firstName field value = String.valueOf(objMethod.invoke(innerClassObject)); } } else if (operator.length == 1) { // if having oppname methodStr = operator[0].substring(0, 1).toUpperCase() + operator[0].substring(1); // Make first letter of operand capital. objMethod = placeHolderClass.getMethod("get" + methodStr + ""); java.util.Date.class.isAssignableFrom(objMethod.getReturnType()); if (java.util.Date.class.isAssignableFrom(objMethod.getReturnType())) value = df.format(((java.util.Date) objMethod.invoke(invoker))); else if ((methodStr.equals("Startdate") && java.lang.Long.class.isAssignableFrom(objMethod.getReturnType())) || (methodStr.equals("Enddate") && java.lang.Long.class.isAssignableFrom(objMethod.getReturnType()))) { value = df.format(new java.util.Date((java.lang.Long) objMethod.invoke(invoker))); } else value = String.valueOf(objMethod.invoke(invoker)); } else { value = table.replaceAll("#", "@~@~"); } int i1 = htmlMsg.indexOf(table); int i2 = htmlMsg.indexOf(table) + table.length(); if (StringUtil.isNullOrEmpty(value)) { value = ""; } if (i1 >= 0) { htmlMsg.replace(i1, i2, value); } } m = p.matcher(htmlMsg); } // replace receiver placeholders expr = "[$]{1}recipient[:]{1}[a-zA-Z0-9]+(\\.){0,1}[a-zA-Z0-9]*[$]{1}"; //$recipient:firstName$ $recipient:lastName$ p = Pattern.compile(expr); m = p.matcher(htmlMsg); while (m.find()) { String table = m.group(); String woHash = table.substring(1, table.length() - 1); String[] sp = woHash.split(":"); String value = "-"; if (!StringUtil.isNullOrEmpty(sp[0])) { // sp[0] having recipient which holds placeholder class path Class placeHolderClass = recipientUser.getClass(); String[] operator = sp[1].split("\\."); if (operator.length > 1) { // if having oppmainowner.firstName String methodStr = operator[0].substring(0, 1).toUpperCase() + operator[0].substring(1); // Make first letter of operand capital. objMethod = placeHolderClass.getMethod("get" + methodStr + ""); Object innerClassObject = objMethod.invoke(recipientUser); // get oppmainowner object if (!StringUtil.isNullObject(innerClassObject)) { placeHolderClass = innerClassObject.getClass(); methodStr = operator[1].substring(0, 1).toUpperCase() + operator[1].substring(1); // Make first letter of operand capital. objMethod = placeHolderClass.getMethod("get" + methodStr + "");// get oppmainowner's firstName field value = (String) objMethod.invoke(innerClassObject); } } else if (operator.length == 1) { // if having oppname String methodStr = operator[0].substring(0, 1).toUpperCase() + operator[0].substring(1); // Make first letter of operand capital. objMethod = placeHolderClass.getMethod("get" + methodStr + ""); java.util.Date.class.isAssignableFrom(objMethod.getReturnType()); if (java.util.Date.class.isAssignableFrom(objMethod.getReturnType())) value = df.format(((java.util.Date) objMethod.invoke(recipientUser))); else value = (String) objMethod.invoke(recipientUser); } else { value = table.replaceAll("$", "@~@~"); } int i1 = htmlMsg.indexOf(table); int i2 = htmlMsg.indexOf(table) + table.length(); if (StringUtil.isNullOrEmpty(value)) { value = ""; } if (i1 >= 0) { htmlMsg.replace(i1, i2, value); } } m = p.matcher(htmlMsg); } } catch (IllegalAccessException ex) { LOG.info(ex.getMessage(), ex); ex.printStackTrace(); } catch (IllegalArgumentException ex) { LOG.info(ex.getMessage(), ex); ex.printStackTrace(); } catch (InvocationTargetException ex) { LOG.info(ex.getMessage(), ex); ex.printStackTrace(); } catch (NoSuchMethodException ex) { LOG.info(ex.getMessage(), ex); ex.printStackTrace(); } catch (ServiceException ex) { LOG.info(ex.getMessage(), ex); ex.printStackTrace(); } }