@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getName()).append("; nested PropertyAccessExceptions ("); sb.append(getExceptionCount()).append(") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { sb.append('\n').append("PropertyAccessException ").append(i + 1).append(": "); sb.append(this.propertyAccessExceptions[i]); } return sb.toString(); }
@Override public void printStackTrace(PrintStream ps) { synchronized (ps) { ps.println(getClass().getName() + "; nested PropertyAccessException details (" + getExceptionCount() + ") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { ps.println("PropertyAccessException " + (i + 1) + ":"); this.propertyAccessExceptions[i].printStackTrace(ps); } } }
@Override public void printStackTrace(PrintWriter pw) { synchronized (pw) { pw.println(getClass().getName() + "; nested PropertyAccessException details (" + getExceptionCount() + ") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { pw.println("PropertyAccessException " + (i + 1) + ":"); this.propertyAccessExceptions[i].printStackTrace(pw); } } }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getName()).append("; nested PropertyAccessExceptions ("); sb.append(getExceptionCount()).append(") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { sb.append('\n').append("PropertyAccessException ").append(i + 1).append(": "); sb.append(this.propertyAccessExceptions[i]); } return sb.toString(); }
@Override public void printStackTrace(PrintWriter pw) { synchronized (pw) { pw.println(getClass().getName() + "; nested PropertyAccessException details (" + getExceptionCount() + ") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { pw.println("PropertyAccessException " + (i + 1) + ":"); this.propertyAccessExceptions[i].printStackTrace(pw); } } }
@Override public void printStackTrace(PrintStream ps) { synchronized (ps) { ps.println(getClass().getName() + "; nested PropertyAccessException details (" + getExceptionCount() + ") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { ps.println("PropertyAccessException " + (i + 1) + ":"); this.propertyAccessExceptions[i].printStackTrace(ps); } } }
public void xtestTypeMismatch() { try { getBeanFactory().getBean("typeMismatch"); fail("Shouldn't succeed with type mismatch"); } catch (BeanCreationException wex) { assertEquals("typeMismatch", wex.getBeanName()); assertTrue(wex.getCause() instanceof PropertyBatchUpdateException); PropertyBatchUpdateException ex = (PropertyBatchUpdateException) wex.getCause(); // Further tests assertTrue("Has one error ", ex.getExceptionCount() == 1); assertTrue("Error is for field age", ex.getPropertyAccessException("age") != null); assertTrue("We have rejected age in exception", ex.getPropertyAccessException("age").getPropertyChangeEvent().getNewValue().equals("34x")); } }
@Test public void setValidAndInvalidPropertyValuesShouldContainExceptionDetails() { TestBean target = new TestBean(); String newName = "tony"; String invalidTouchy = ".valid"; try { BeanWrapper accessor = createAccessor(target); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.addPropertyValue(new PropertyValue("age", "foobar")); pvs.addPropertyValue(new PropertyValue("name", newName)); pvs.addPropertyValue(new PropertyValue("touchy", invalidTouchy)); accessor.setPropertyValues(pvs); fail("Should throw exception when everything is valid"); } catch (PropertyBatchUpdateException ex) { assertTrue("Must contain 2 exceptions", ex.getExceptionCount() == 2); // Test validly set property matches assertTrue("Valid set property must stick", target.getName().equals(newName)); assertTrue("Invalid set property must retain old value", target.getAge() == 0); assertTrue("New value of dodgy setter must be available through exception", ex.getPropertyAccessException("touchy").getPropertyChangeEvent().getNewValue().equals(invalidTouchy)); } }
@Override public void printStackTrace(PrintWriter pw) { synchronized (pw) { pw.println(getClass().getName() + "; nested PropertyAccessException details (" + getExceptionCount() + ") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { pw.println("PropertyAccessException " + (i + 1) + ":"); this.propertyAccessExceptions[i].printStackTrace(pw); } } }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getName()).append("; nested PropertyAccessExceptions ("); sb.append(getExceptionCount()).append(") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { sb.append('\n').append("PropertyAccessException ").append(i + 1).append(": "); sb.append(this.propertyAccessExceptions[i]); } return sb.toString(); }
@Override public void printStackTrace(PrintStream ps) { synchronized (ps) { ps.println(getClass().getName() + "; nested PropertyAccessException details (" + getExceptionCount() + ") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { ps.println("PropertyAccessException " + (i + 1) + ":"); this.propertyAccessExceptions[i].printStackTrace(ps); } } }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getName()).append("; nested PropertyAccessExceptions ("); sb.append(getExceptionCount()).append(") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { sb.append('\n').append("PropertyAccessException ").append(i + 1).append(": "); sb.append(this.propertyAccessExceptions[i]); } return sb.toString(); }
@Override public void printStackTrace(PrintStream ps) { synchronized (ps) { ps.println(getClass().getName() + "; nested PropertyAccessException details (" + getExceptionCount() + ") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { ps.println("PropertyAccessException " + (i + 1) + ":"); this.propertyAccessExceptions[i].printStackTrace(ps); } } }
@Override public void printStackTrace(PrintWriter pw) { synchronized (pw) { pw.println(getClass().getName() + "; nested PropertyAccessException details (" + getExceptionCount() + ") are:"); for (int i = 0; i < this.propertyAccessExceptions.length; i++) { pw.println("PropertyAccessException " + (i + 1) + ":"); this.propertyAccessExceptions[i].printStackTrace(pw); } } }