List of usage examples for java.lang IllegalAccessException printStackTrace
public void printStackTrace()
From source file:jp.ryoyamamoto.poiutils.Sheets.java
/** * Gets the hyperlinks on the sheet.//from w ww.jav a2s. c om * * @param sheet * the sheet. * @return the hyperlinks on the sheet. */ @SuppressWarnings("unchecked") public static List<Hyperlink> getHyperlinks(Sheet sheet) { try { return (List<Hyperlink>) FieldUtils.readDeclaredField(sheet, "hyperlinks", true); } catch (IllegalAccessException e) { e.printStackTrace(); } return Collections.emptyList(); }
From source file:Main.java
private static boolean equalFields(Object paramObject1, Object paramObject2) { boolean bool1 = false; Field[] arrayOfField1 = paramObject1.getClass().getDeclaredFields(); Field[] arrayOfField2 = paramObject2.getClass().getDeclaredFields(); if (arrayOfField1.length != arrayOfField2.length) { return bool1; }/* ww w. j a v a 2 s. com*/ int i = 0; try { while (true) { if (i >= arrayOfField1.length) break; Field localField1 = arrayOfField1[i]; localField1.setAccessible(true); Field localField2 = arrayOfField2[i]; localField2.setAccessible(true); Object localObject1 = localField1.get(paramObject1); Object localObject2 = localField2.get(paramObject2); if ((localObject1 == null) && (localObject2 != null)) break; if (localObject1 != null) { boolean bool2 = localObject1.equals(localObject2); if (!bool2) break; } i++; } } catch (IllegalArgumentException localIllegalArgumentException) { localIllegalArgumentException.printStackTrace(); bool1 = true; } catch (IllegalAccessException localIllegalAccessException) { label122: localIllegalAccessException.printStackTrace(); } return bool1; }
From source file:com.aw.support.reflection.AttributeAccessor.java
/** * @param target/* ww w. ja v a 2 s .c o m*/ * @return */ public static void set(Object target, Field field, Object value) { field.setAccessible(true); try { field.set(target, value); } catch (IllegalAccessException e) { e.printStackTrace(); throw new IllegalArgumentException("Error setting the value of the attribute:<" + field.getName() + "> of object:<" + target + "> check: Attribute Type:<" + field.getType() + "> value Type: <" + value.getClass() + ">"); } }
From source file:com.github.sumimakito.quickkv.util.DataProcessor.java
public static void printFieldsOfObject(Object object) { System.out.println("[Fields of Object: " + object.getClass().getSimpleName() + "]"); for (Field field : object.getClass().getDeclaredFields()) { field.setAccessible(true); // You might want to set modifier to public first. Object value = null;// www . j a v a 2 s . c om try { value = field.get(object); if (value != null) { System.out.println("- (" + value.getClass().getSimpleName() + ")[" + field.getName() + "]=[" + value + "]"); } } catch (IllegalAccessException e) { e.printStackTrace(); } } }
From source file:com.bitranger.parknshop.common.recommend.util.Functional.java
public static <T> Function<T, Object> invokeMethod(final Method method, final Object target) { return new Function<T, Object>() { @Nullable//from w ww . ja v a2s . c o m @Override public Object apply(@Nullable T input) { try { return method.invoke(target, input); } catch (IllegalAccessException e) { } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return input; } }; }
From source file:com.prashsoft.javakiva.KivaUtil.java
public static Object getBeanProperty(Object bean, String name) { Object beanProperty = null;//www.jav a2s.c o m try { beanProperty = PropertyUtils.isReadable(bean, name) ? PropertyUtils.getProperty(bean, name) : null; } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return beanProperty; }
From source file:com.dtolabs.rundeck.core.common.NodeEntryFactory.java
/** * Create NodeEntryImpl from map data. It will convert "tags" of type String as a comma separated list of tags, or * "tags" a collection of strings into a set. It will remove properties excluded from allowed import. * * @param map input map data// w w w .j ava2s. c om * * @return * * @throws IllegalArgumentException */ @SuppressWarnings("unchecked") public static NodeEntryImpl createFromMap(final Map<String, Object> map) throws IllegalArgumentException { final NodeEntryImpl nodeEntry = new NodeEntryImpl(); final HashMap<String, Object> newmap = new HashMap<String, Object>(map); for (final String excludeProp : excludeProps) { newmap.remove(excludeProp); } if (null != newmap.get("tags") && newmap.get("tags") instanceof String) { String tags = (String) newmap.get("tags"); String[] data; if ("".equals(tags.trim())) { data = new String[0]; } else { data = tags.split(","); } final HashSet set = new HashSet(); for (final String s : data) { if (null != s && !"".equals(s.trim())) { set.add(s.trim()); } } newmap.put("tags", set); } else if (null != newmap.get("tags") && newmap.get("tags") instanceof Collection) { Collection tags = (Collection) newmap.get("tags"); HashSet data = new HashSet(); for (final Object tag : tags) { if (null != tag && !"".equals(tag.toString().trim())) { data.add(tag.toString().trim()); } } newmap.put("tags", data); } else if (null != newmap.get("tags")) { Object o = newmap.get("tags"); newmap.put("tags", new HashSet(Arrays.asList(o.toString().trim()))); } try { BeanUtils.populate(nodeEntry, newmap); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } if (null == nodeEntry.getNodename()) { throw new IllegalArgumentException("Required property 'nodename' was not specified"); } if (null == nodeEntry.getHostname()) { throw new IllegalArgumentException("Required property 'hostname' was not specified"); } if (null == nodeEntry.getAttributes()) { nodeEntry.setAttributes(new HashMap<String, String>()); } //populate attributes with any keys outside of nodeprops for (final Map.Entry<String, Object> entry : newmap.entrySet()) { if (!ResourceXMLConstants.allPropSet.contains(entry.getKey())) { nodeEntry.setAttribute(entry.getKey(), (String) entry.getValue()); } } return nodeEntry; }
From source file:com.selcukcihan.android.namewizard.wizard.ui.BirthDateFragment.java
public static void hideYear(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int yearSpinnerId = Resources.getSystem().getIdentifier("year", "id", "android"); if (yearSpinnerId != 0) { View yearSpinner = view.findViewById(yearSpinnerId); if (yearSpinner != null) { yearSpinner.setVisibility(View.GONE); }//from w w w . j a v a 2 s . com } } else { //Older SDK versions Field f[] = view.getClass().getDeclaredFields(); for (Field field : f) { if (field.getName().equals("mYearPicker") || field.getName().equals("mYearSpinner")) { field.setAccessible(true); Object yearPicker = null; try { yearPicker = field.get(view); } catch (IllegalAccessException e) { e.printStackTrace(); } ((View) yearPicker).setVisibility(View.GONE); } } } }
From source file:at.pcgamingfreaks.Bukkit.Utils.java
/** * Gets the ping for a player./* www . j a v a2s .c om*/ * * @param player The player for witch the ping should be retrieved. * @return The ping of the player. */ public static int getPing(@NotNull Player player) { Validate.notNull(player, "The player for which the ping is requested must not be null!"); if (PLAYER_PING == null) return -1; Object handle = NMSReflection.getHandle(player); if (handle != null && handle.getClass() == ENTITY_PLAYER) // If it's not a real player we can't send him the packet { try { return PLAYER_PING.getInt(handle); } catch (IllegalAccessException e) { e.printStackTrace(); } } return -1; }
From source file:me.ywork.org.entity.DingSuiteThirdMain.java
public static DingSuiteThirdVo toVo(DingSuiteThirdMain model) { if (model == null) return null; DingSuiteThirdVo vo = new DingSuiteThirdVo(); try {/* w w w . ja v a 2 s . c o m*/ BeanUtils.copyProperties(model, vo); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return vo; }