private static ObjectAccessException wrap(final String message, final Class type, final String name, final Throwable ex) { final ObjectAccessException exception = new ObjectAccessException(message, ex); exception.add("field", type.getName() + "." + name); return exception; } }
} catch (IllegalAccessException e) { ObjectAccessException exception = new ObjectAccessException("Cannot access field", e); exception.add("field", type.getName() + "." + CALLBACK_MARKER + i); throw exception;
private Map buildMap(Class type) { Map nameMap = (Map)propertyNameCache.get(type); if (nameMap == null) { BeanInfo beanInfo; try { beanInfo = Introspector.getBeanInfo(type, Object.class); } catch (IntrospectionException e) { ObjectAccessException oaex = new ObjectAccessException("Cannot get BeanInfo of type", e); oaex.add("bean-type", type.getName()); throw oaex; } nameMap = new OrderRetainingMap(); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (int i = 0; i < propertyDescriptors.length; i++ ) { PropertyDescriptor descriptor = propertyDescriptors[i]; nameMap.put(descriptor.getName(), descriptor); } nameMap = sorter.sort(type, nameMap); propertyNameCache.put(type, nameMap); } return nameMap; }
oaex = new ObjectAccessException("Cannot find class", e); oaex.add("construction-type", type.getName()); throw oaex;
private void write(Field field, Object object, Object value) { if (exception != null) { ObjectAccessException ex = new ObjectAccessException("Cannot set field", exception); ex.add("field", object.getClass() + "." + field.getName()); throw ex; } else { ObjectAccessException ex = new ObjectAccessException("Cannot set field of unknown type", exception); ex.add("field", object.getClass() + "." + field.getName()); ex.add("unknown-type", type.getName()); throw ex; ex.add("field", object.getClass() + "." + field.getName()); throw ex;
oaex.add("construction-type", type.getName()); throw oaex;
} catch (IllegalAccessException e) { ObjectAccessException exception = new ObjectAccessException("Cannot access method", e); exception.add("method", calledMethod.toString()); throw exception; } catch (InvocationTargetException e) {
public Object newInstance(Class type) { if (exception != null) { ObjectAccessException ex = new ObjectAccessException("Cannot construct type", exception); ex.add("construction-type", type.getName()); throw ex; } ErrorWritingException ex = null; if (type == void.class || type == Void.class) { ex = new ConversionException("Type void cannot have an instance"); } else { try { return unsafe.allocateInstance(type); } catch (final SecurityException e) { ex = new ObjectAccessException("Cannot construct type", e); } catch (final InstantiationException e) { ex = new ConversionException("Cannot construct type", e); } catch (final IllegalArgumentException e) { ex = new ObjectAccessException("Cannot construct type", e); } } ex.add("construction-type", type.getName()); throw ex; }
exception.add("field", type.getName() + ".serialVersionUID"); throw exception;
private static ObjectAccessException wrap(final String message, final Class<?> type, final String name, final Throwable ex) { final ObjectAccessException exception = new ObjectAccessException(message, ex); exception.add("field", type.getName() + "." + name); return exception; } }
private static ObjectAccessException wrap(final String message, final Class type, final String name, final Throwable ex) { final ObjectAccessException exception = new ObjectAccessException(message, ex); exception.add("field", type.getName() + "." + name); return exception; } }
private static ObjectAccessException wrap(final String message, final Class type, final String name, final Throwable ex) { final ObjectAccessException exception = new ObjectAccessException(message, ex); exception.add("field", type.getName() + "." + name); return exception; } }
private static ObjectAccessException wrap(final String message, final Class type, final String name, final Throwable ex) { final ObjectAccessException exception = new ObjectAccessException(message, ex); exception.add("field", type.getName() + "." + name); return exception; } }
private Map<String, PropertyDescriptor> buildMap(final Class<?> type) { Map<String, PropertyDescriptor> nameMap = propertyNameCache.get(type); if (nameMap == null) { BeanInfo beanInfo; try { beanInfo = Introspector.getBeanInfo(type, Object.class); } catch (final IntrospectionException e) { final ObjectAccessException oaex = new ObjectAccessException("Cannot get BeanInfo of type", e); oaex.add("bean-type", type.getName()); throw oaex; } nameMap = new LinkedHashMap<>(); final PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (final PropertyDescriptor descriptor : propertyDescriptors) { nameMap.put(descriptor.getName(), descriptor); } nameMap = sorter.sort(type, nameMap); propertyNameCache.put(type, nameMap); } return nameMap; }
private Map buildMap(Class type) { Map nameMap = (Map)propertyNameCache.get(type); if (nameMap == null) { BeanInfo beanInfo; try { beanInfo = Introspector.getBeanInfo(type, Object.class); } catch (IntrospectionException e) { ObjectAccessException oaex = new ObjectAccessException("Cannot get BeanInfo of type", e); oaex.add("bean-type", type.getName()); throw oaex; } nameMap = new OrderRetainingMap(); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (int i = 0; i < propertyDescriptors.length; i++ ) { PropertyDescriptor descriptor = propertyDescriptors[i]; nameMap.put(descriptor.getName(), descriptor); } nameMap = sorter.sort(type, nameMap); propertyNameCache.put(type, nameMap); } return nameMap; }
private Map buildMap(Class type) { Map nameMap = (Map)propertyNameCache.get(type); if (nameMap == null) { BeanInfo beanInfo; try { beanInfo = Introspector.getBeanInfo(type, Object.class); } catch (IntrospectionException e) { ObjectAccessException oaex = new ObjectAccessException("Cannot get BeanInfo of type", e); oaex.add("bean-type", type.getName()); throw oaex; } nameMap = new OrderRetainingMap(); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (int i = 0; i < propertyDescriptors.length; i++ ) { PropertyDescriptor descriptor = propertyDescriptors[i]; nameMap.put(descriptor.getName(), descriptor); } nameMap = sorter.sort(type, nameMap); propertyNameCache.put(type, nameMap); } return nameMap; }
@Override public Object newInstance(final Class<?> type) { if (exception != null) { final ObjectAccessException ex = new ObjectAccessException("Cannot construct type", exception); ex.add("construction-type", type.getName()); throw ex; } ErrorWritingException ex = null; if (type == void.class || type == Void.class) { ex = new ConversionException("Type void cannot have an instance"); } else { try { return unsafe.allocateInstance(type); } catch (final SecurityException e) { ex = new ObjectAccessException("Cannot construct type", e); } catch (final InstantiationException e) { ex = new ConversionException("Cannot construct type", e); } catch (final IllegalArgumentException e) { ex = new ObjectAccessException("Cannot construct type", e); } } ex.add("construction-type", type.getName()); throw ex; }
public Object newInstance(Class type) { if (exception != null) { ObjectAccessException ex = new ObjectAccessException("Cannot construct type", exception); ex.add("construction-type", type.getName()); throw ex; } ErrorWritingException ex = null; if (type == void.class || type == Void.class) { ex = new ConversionException("Type void cannot have an instance"); } else { try { return unsafe.allocateInstance(type); } catch (final SecurityException e) { ex = new ObjectAccessException("Cannot construct type", e); } catch (final InstantiationException e) { ex = new ConversionException("Cannot construct type", e); } catch (final IllegalArgumentException e) { ex = new ObjectAccessException("Cannot construct type", e); } } ex.add("construction-type", type.getName()); throw ex; }