Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRUNK-6188 Upgrade xstream and migrate to whitelisting #247

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,33 @@ public Object unmarshal(HierarchicalStreamReader reader, Object root) {
return unmarshal(reader, root, cache.get());
}
});
}

@Override
protected void initXStream(XStream xstream) {
super.initXStream(xstream);

Mapper mapper = xstream.getMapper();
ConverterLookup converterLookup = xstream.getConverterLookup();
Mapper mapper = xstream.getMapper();
ConverterLookup converterLookup = xstream.getConverterLookup();

xstream.registerConverter(new PersonQueryConverter(mapper, converterLookup));
xstream.registerConverter(new CohortDefinitionConverter(mapper, converterLookup));
xstream.registerConverter(new EncounterQueryConverter(mapper, converterLookup));
xstream.registerConverter(new ObsQueryConverter(mapper, converterLookup));
xstream.registerConverter(new PersonQueryConverter(mapper, converterLookup));
xstream.registerConverter(new CohortDefinitionConverter(mapper, converterLookup));
xstream.registerConverter(new EncounterQueryConverter(mapper, converterLookup));
xstream.registerConverter(new ObsQueryConverter(mapper, converterLookup));
xstream.registerConverter(new CalculationRegistrationShortConverter(mapper, converterLookup));

xstream.registerConverter(new PersonDataDefinitionConverter(mapper, converterLookup));
xstream.registerConverter(new PatientDataDefinitionConverter(mapper, converterLookup));
xstream.registerConverter(new EncounterDataDefinitionConverter(mapper, converterLookup));
xstream.registerConverter(new DataSetDefinitionConverter(mapper, converterLookup));
xstream.registerConverter(new DimensionConverter(mapper, converterLookup));
xstream.registerConverter(new IndicatorConverter(mapper, converterLookup));
xstream.registerConverter(new PatientDataDefinitionConverter(mapper, converterLookup));
xstream.registerConverter(new EncounterDataDefinitionConverter(mapper, converterLookup));

xstream.registerConverter(new DataSetDefinitionConverter(mapper, converterLookup));

xstream.registerConverter(new DimensionConverter(mapper, converterLookup));
xstream.registerConverter(new IndicatorConverter(mapper, converterLookup));

xstream.registerConverter(new ReportDefinitionConverter(mapper, converterLookup));
}

@Override
synchronized public <T> T deserialize(String serializedObject, Class<? extends T> clazz) throws SerializationException {
boolean cacheOwner = cache.get() == null;
Expand All @@ -105,7 +110,7 @@ synchronized public <T> T deserialize(String serializedObject, Class<? extends T
*/
public void serializeToStream(Object object, OutputStream out) {
try {
xstream.toXML(object, new OutputStreamWriter(out, "UTF-8"));
getXstream().toXML(object, new OutputStreamWriter(out, "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("Unsupported encoding", e);
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<reportingCompatibilityVersion>2.0.6</reportingCompatibilityVersion>
<openMRSMinorVersion>1.9</openMRSMinorVersion>
<htmlwidgetsVersion>1.7.2</htmlwidgetsVersion>
<serializationVersion>0.2.14</serializationVersion>
<serializationVersion>0.2.17-SNAPSHOT</serializationVersion>
<calculationVersion>1.2</calculationVersion>
<jacksonVersion>1.5.0</jacksonVersion>
<quartzVersion>2.1.1</quartzVersion>
Expand Down