|
19 | 19 | import org.apache.commons.logging.LogFactory;
|
20 | 20 | import org.openmrs.BaseOpenmrsObject;
|
21 | 21 | import org.openmrs.User;
|
| 22 | +import org.openmrs.api.APIException; |
22 | 23 | import org.openmrs.api.context.Context;
|
23 | 24 | import org.openmrs.module.metadatasharing.ExportedPackage;
|
24 | 25 | import org.openmrs.module.metadatasharing.Item;
|
@@ -185,15 +186,20 @@ protected MapperWrapper wrapMapper(MapperWrapper next) {
|
185 | 186 | }
|
186 | 187 |
|
187 | 188 | private void setupXStreamSecurity(XStream xstream) {
|
188 |
| - SimpleXStreamSerializer serializer = Context.getRegisteredComponent("simpleXStreamSerializer", SimpleXStreamSerializer.class); |
189 |
| - if (serializer != null) { |
190 |
| - try { |
191 |
| - Method method = serializer.getClass().getMethod("initXStream", XStream.class); |
192 |
| - method.invoke(serializer, xstream); |
193 |
| - } |
194 |
| - catch (Exception ex) { |
195 |
| - log.error("Failed to set up XStream Security", ex); |
| 189 | + try { |
| 190 | + SimpleXStreamSerializer serializer = Context.getRegisteredComponent("simpleXStreamSerializer", SimpleXStreamSerializer.class); |
| 191 | + if (serializer != null) { |
| 192 | + try { |
| 193 | + Method method = serializer.getClass().getMethod("initXStream", XStream.class); |
| 194 | + method.invoke(serializer, xstream); |
| 195 | + } |
| 196 | + catch (Exception ex) { |
| 197 | + log.error("Failed to set up XStream Security", ex); |
| 198 | + } |
196 | 199 | }
|
197 | 200 | }
|
| 201 | + catch (APIException ex) { |
| 202 | + //Ignore APIException("Error during getting registered component) for platform versions below 2.7.0 |
| 203 | + } |
198 | 204 | }
|
199 | 205 | }
|
0 commit comments