List of usage examples for java.lang IllegalAccessException printStackTrace
public void printStackTrace()
From source file:com.dp2345.util.SettingUtils.java
/** * /*from ww w . j a v a 2 s .c om*/ * * @param setting * */ public static void set(Setting setting) { try { File dp2345XmlFile = new ClassPathResource(CommonAttributes.DP2345_XML_PATH).getFile(); Document document = new SAXReader().read(dp2345XmlFile); List<Element> elements = document.selectNodes("/dp2345/setting"); for (Element element : elements) { try { String name = element.attributeValue("name"); String value = beanUtils.getProperty(setting, name); Attribute attribute = element.attribute("value"); attribute.setValue(value); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } FileOutputStream fileOutputStream = null; XMLWriter xmlWriter = null; try { OutputFormat outputFormat = OutputFormat.createPrettyPrint(); outputFormat.setEncoding("UTF-8"); outputFormat.setIndent(true); outputFormat.setIndent(" "); outputFormat.setNewlines(true); fileOutputStream = new FileOutputStream(dp2345XmlFile); xmlWriter = new XMLWriter(fileOutputStream, outputFormat); xmlWriter.write(document); } catch (Exception e) { e.printStackTrace(); } finally { if (xmlWriter != null) { try { xmlWriter.close(); } catch (IOException e) { } } IOUtils.closeQuietly(fileOutputStream); } Ehcache cache = cacheManager.getEhcache(Setting.CACHE_NAME); cache.put(new net.sf.ehcache.Element(Setting.CACHE_KEY, setting)); } catch (Exception e) { e.printStackTrace(); } }
From source file:gov.guilin.util.SettingUtils.java
/** * //from www . ja va 2s . c o m * * @param setting * */ public static void set(Setting setting) { try { File guilinXmlFile = new ClassPathResource(CommonAttributes.XML_PATH).getFile(); Document document = new SAXReader().read(guilinXmlFile); List<Element> elements = document.selectNodes("/guilin/setting"); for (Element element : elements) { try { String name = element.attributeValue("name"); String value = beanUtils.getProperty(setting, name); Attribute attribute = element.attribute("value"); attribute.setValue(value); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } FileOutputStream fileOutputStream = null; XMLWriter xmlWriter = null; try { OutputFormat outputFormat = OutputFormat.createPrettyPrint(); outputFormat.setEncoding("UTF-8"); outputFormat.setIndent(true); outputFormat.setIndent(" "); outputFormat.setNewlines(true); fileOutputStream = new FileOutputStream(guilinXmlFile); xmlWriter = new XMLWriter(fileOutputStream, outputFormat); xmlWriter.write(document); } catch (Exception e) { e.printStackTrace(); } finally { if (xmlWriter != null) { try { xmlWriter.close(); } catch (IOException e) { } } IOUtils.closeQuietly(fileOutputStream); } Ehcache cache = cacheManager.getEhcache(Setting.CACHE_NAME); cache.put(new net.sf.ehcache.Element(Setting.CACHE_KEY, setting)); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.sammyun.util.SettingUtils.java
/** * /*www. ja va2 s .c o m*/ * * @param setting */ public static void set(Setting setting) { try { File preschoolEduXmlFile = new ClassPathResource(CommonAttributes.PRESCHOOLEDU_XML_PATH).getFile(); Document document = new SAXReader().read(preschoolEduXmlFile); List<Element> elements = document.selectNodes("/preschoolEdu/setting"); for (Element element : elements) { try { String name = element.attributeValue("name"); String value = beanUtils.getProperty(setting, name); Attribute attribute = element.attribute("value"); attribute.setValue(value); } catch (IllegalAccessException e) { e.printStackTrace(); logger.error(e.getMessage()); } catch (InvocationTargetException e) { e.printStackTrace(); logger.error(e.getMessage()); } catch (NoSuchMethodException e) { e.printStackTrace(); logger.error(e.getMessage()); } } FileOutputStream fileOutputStream = null; XMLWriter xmlWriter = null; try { OutputFormat outputFormat = OutputFormat.createPrettyPrint(); outputFormat.setEncoding("UTF-8"); outputFormat.setIndent(true); outputFormat.setIndent(" "); outputFormat.setNewlines(true); fileOutputStream = new FileOutputStream(preschoolEduXmlFile); xmlWriter = new XMLWriter(fileOutputStream, outputFormat); xmlWriter.write(document); } catch (Exception e) { e.printStackTrace(); } finally { if (xmlWriter != null) { try { xmlWriter.close(); } catch (IOException e) { } } IOUtils.closeQuietly(fileOutputStream); } Ehcache cache = cacheManager.getEhcache(Setting.CACHE_NAME); cache.put(new net.sf.ehcache.Element(Setting.CACHE_KEY, setting)); } catch (Exception e) { e.printStackTrace(); logger.error(e.getMessage()); } }
From source file:net.itransformers.idiscover.discoveryhelpers.xml.XmlDiscoveryHelper.java
public static Object getProperty(Object o, String propertyName) { try {/*from w w w. java 2s .c om*/ Object myValue = PropertyUtils.getNestedProperty(o, propertyName); return myValue; } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (NestedNullException nne) { return null; } return null; }
From source file:com.lpm.fanger.commons.util.Reflections.java
/** * , private/protected, ??setter./*from www . ja v a 2 s.c o m*/ */ public static void setFieldValue(final Object obj, final String fieldName, final Object value) { Field field = getAccessibleField(obj, fieldName); if (field == null) { throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + obj + "]"); } try { field.set(obj, value); } catch (IllegalAccessException e) { e.printStackTrace(); } }
From source file:com.lpm.fanger.commons.util.Reflections.java
/** * ?, private/protected, ??getter.//from ww w . j a v a2s .c om */ public static Object getFieldValue(final Object obj, final String fieldName) { Field field = getAccessibleField(obj, fieldName); if (field == null) { throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + obj + "]"); } Object result = null; try { result = field.get(obj); } catch (IllegalAccessException e) { e.printStackTrace(); } return result; }
From source file:com.startechup.tools.ModelParser.java
/** * Finally invokes the method to assign the values. * * @param method The setter method to be invoked. * @param instance The instance of the container class. * @param value The parsed value from the json. *//*from w ww . ja va 2s . c o m*/ private static void invoke(Method method, Object instance, Object value) { try { method.invoke(instance, value); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }
From source file:com.startechup.tools.ModelParser.java
/** * Creates a new instance of the model class. * * @param classModel The class that will contain the parse json values and the one * that will direct the parsing. * @return Returns a new object instance of the model class, null if exceptions occur. *///from w w w.j a v a 2s . c o m private static Object getNewInstance(Class classModel) { Object object = null; try { object = classModel.newInstance(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } return object; }
From source file:com.jilk.ros.rosbridge.implementation.JSON.java
private static Object getFieldObject(Field f, Object o) { Object fo = null;/* w w w. j a v a 2 s. c o m*/ try { fo = f.get(o); } catch (IllegalAccessException ex) { ex.printStackTrace(); } return fo; }
From source file:org.intermine.bio.web.displayer.MouseAllelesDisplayer.java
/** * * @return true if we are on a mouseified gene *///from www . ja va 2 s .com private static Boolean isThisAMouser(ReportObject reportObject) { try { return "Mus".equals( ((InterMineObject) reportObject.getObject().getFieldValue("organism")).getFieldValue("genus")); } catch (IllegalAccessException e) { e.printStackTrace(); } return false; }