I have 4 functions with same get...() method, and I only change the name or identifier, but I've got different result with the fourth which is when to adding new item to list, it throws java.lang.UnsupportedOperationException. I assure you, I've already double checked all 4 functions and their relations, but have no idea why the fourth function like this.
public List<PropertyAttribute> getAttributes() {
if (selectedCode == null)
return null;
Criteria criteria = this.propertyAttributeDAO.createCriteria();
FilterUtils.byField(criteria, "propertyCode", this.selectedCode, true);
List<PropertyAttribute> list = criteria.list();
if (isNewAttribute()) {
list.add(0, this.curAttribute); //this line that throws exception
}
return list;
}
UPDATE STACK TRACE:
Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:148)
at bos.web.pages.instrument.ViewProperty.getAttributes(ViewProperty.java:654)
at $InternalPropertyConduit_237587e282284.get(Unknown Source)
at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:59)