public Map<Integer, Field> getAllFields() {
if (allFields == null) {
try {
final Message message = getMessage();
lock.lock();
allFields = new LinkedHashMap<Integer, Field>();
if (message == null) {
return new HashMap<Integer, Field>();
}
for (final Iterator iterator = message.getHeader().iterator(); iterator.hasNext();) {
Field field = (Field) iterator.next();
allFields.put(field.getTag(), field);
if (retainedFields.contains(field.getTag())) {
cachedFields.put(field.getTag(), field);
}
}
for (final Iterator iterator = message.iterator(); iterator.hasNext();) {
Field field = (Field) iterator.next();
int tag = field.getTag();
if (!allFields.containsKey(tag)) {
allFields.put(tag, field);
if (retainedFields.contains(field.getTag())) {
cachedFields.put(field.getTag(), field);
}
}
}
for (Iterator groupsKeys = message.groupKeyIterator(); groupsKeys.hasNext();) {
int groupCountTag = ((Integer) groupsKeys.next()).intValue();
}
for (final Iterator iterator = message.getTrailer().iterator(); iterator.hasNext();) {
Field field = (Field) iterator.next();
allFields.put(field.getTag(), field);
if (retainedFields.contains(field.getTag())) {
cachedFields.put(field.getTag(), field);