Initialize any null-valued fields that should have a non-null default value.
()
| 1478 | * value. |
| 1479 | */ |
| 1480 | @SuppressWarnings("UseSpecificCatch") |
| 1481 | private void initializeFields() { |
| 1482 | // Get the full field list, don't care about sorting |
| 1483 | List<Field> flist = getFieldList(); |
| 1484 | for (Field f : flist) { |
| 1485 | try { |
| 1486 | Object o = f.get(this); |
| 1487 | if (o == null) { |
| 1488 | initializeField(f, f.getType()); |
| 1489 | } |
| 1490 | } |
| 1491 | catch (Exception e) { |
| 1492 | throw new Error("Exception reading field '" + f.getName() + "' in " + getClass(), e); |
| 1493 | } |
| 1494 | } |
| 1495 | } |
| 1496 | |
| 1497 | private Object initializeField(Field field, Class<?> type) { |
| 1498 | Object value = null; |
no test coverage detected