*/
private void setPatternSegmentContent(ITmfEvent event, ITmfTimestamp start, ITmfTimestamp end, Map<String, ITmfStateValue> fields, @Nullable TmfXmlScenarioInfo scenarioInfo) {
for (TmfXmlPatternSegmentField field : fFields) {
- fields.put(field.getName(), field.getValue(event, scenarioInfo));
+ fields.put(field.getName().intern(), field.getValue(event, scenarioInfo));
}
if (scenarioInfo != null) {
addStoredFieldsContent(event, fields, scenarioInfo);
for (Entry<String, String> entry : ((XmlPatternStateProvider) fContainer).getStoredFields().entrySet()) {
ITmfStateValue value = ((XmlPatternStateProvider) fContainer).getHistoryBuilder().getStoredFieldValue(fContainer, entry.getValue(), info, event);
if (!value.isNull()) {
- fields.put(entry.getValue(), value);
+ fields.put(entry.getValue().intern(), value);
}
}
}
} else {
name.append(fSegmentNameAttribute);
}
- return name.toString();
+ return name.toString().intern();
}
}
}
switch (attribute.getAttribute(TmfXmlStrings.TYPE)) {
case TmfXmlStrings.TYPE_CONSTANT:
fType = StateAttributeType.CONSTANT;
- fName = fContainer.getAttributeValue(attribute.getAttribute(TmfXmlStrings.VALUE));
+ fName = getAttributeName(attribute);
break;
case TmfXmlStrings.EVENT_FIELD:
fType = StateAttributeType.EVENTFIELD;
- fName = fContainer.getAttributeValue(attribute.getAttribute(TmfXmlStrings.VALUE));
+ fName = getAttributeName(attribute);
break;
case TmfXmlStrings.TYPE_LOCATION:
fType = StateAttributeType.LOCATION;
- fName = fContainer.getAttributeValue(attribute.getAttribute(TmfXmlStrings.VALUE));
+ fName = getAttributeName(attribute);
break;
case TmfXmlStrings.TYPE_QUERY:
List<@Nullable Element> childElements = XmlUtils.getChildElements(attribute);
break;
case TmfXmlStrings.TYPE_EVENT_NAME:
fType = StateAttributeType.EVENTNAME;
- fName = fContainer.getAttributeValue(attribute.getAttribute(TmfXmlStrings.VALUE));
+ fName = getAttributeName(attribute);
break;
case TmfXmlStrings.NULL:
fType = StateAttributeType.NONE;
}
}
+ private String getAttributeName(Element attribute) {
+ return fContainer.getAttributeValue(attribute.getAttribute(TmfXmlStrings.VALUE)).intern();
+ }
+
/**
* @since 2.0
*/
int length = in.readInt();
byte[] bytes = new byte[length];
in.read(bytes, 0, length);
- String name = new String(bytes);
+ String name = new String(bytes).intern();
Byte type = in.readByte();
ITmfStateValue value;
length = in.readInt();
bytes = new byte[length];
in.read(bytes, 0, length);
- value = TmfStateValue.newValueString(new String(bytes));
+ value = TmfStateValue.newValueString(new String(bytes).intern());
break;
default:
throw new IOException("Read object failed : Invalid data"); //$NON-NLS-1$