Source:
<code>public String run() { LOGGER.debug("run: entity={}, version1={}, version2={}", entity, version1, version2); Error.reset(); Error.push(getClass().getSimpleName()); try { EntityMetadata md1 = getMetadata().getEntityMetadata(entity, version1); EntityMetadata md2 = getMetadata().getEntityMetadata(entity, version2); if (md1 != null) { JSONMetadataParser parser = getJSONParser(); <START> JsonNode jmd1=parser.convert(md1); <END> if(md2!=null) { JsonNode jmd2=parser.convert(md2); List<DocComparator.Delta<JsonNode>> l=new JsonCompare().compareNodes(jmd1,jmd2).getDelta(); ArrayNode ret=JsonNodeFactory.instance.arrayNode(); for(DocComparator.Delta<JsonNode> delta:l) { if(delta instanceof DocComparator.Addition) { ObjectNode node=JsonNodeFactory.instance.objectNode(); node.set("+"+delta.getField2(),((DocComparator.Addition<JsonNode>)delta).getAddedNode()); ret.add(node); } else if(delta instanceof DocComparator.Removal) { ObjectNode node=JsonNodeFactory.instance.objectNode(); node.set("-"+delta.getField1(),((DocComparator.Removal<JsonNode>)delta).getRemovedNode()); ret.add(node); } else if(delta instanceof DocComparator.Modification) { ObjectNode node=JsonNodeFactory.instance.objectNode(); node.set("-"+delta.getField1(),((DocComparator.Modification<JsonNode>)delta).getUnmodifiedNode()); node.set("+"+delta.getField2(),((DocComparator.Modification<JsonNode>)delta).getModifiedNode()); ret.add(node); } } return ret.toString(); } else { throw Error.get(RestMetadataConstants.ERR_NO_ENTITY_VERSION, entity + ":" + version2); } } else { throw Error.get(RestMetadataConstants.ERR_NO_ENTITY_VERSION, entity + ":" + version1); } } catch (Error e) { return e.toString(); } catch (Exception e) { LOGGER.error("Failure: {}", e); return Error.get(RestMetadataConstants.ERR_REST_ERROR, e.toString()).toString(); } }</code><technical_language>pick: perform this convert md2 != null check. point in conversion work if md2 is null</technical_language>

Target:
public String run() { LOGGER.debug("run: entity={}, version1={}, version2={}", entity, version1, version2); Error.reset(); Error.push(getClass().getSimpleName()); try { EntityMetadata md1 = getMetadata().getEntityMetadata(entity, version1); if (md1 != null) { EntityMetadata md2 = getMetadata().getEntityMetadata(entity, version2); if(md2!=null) { JSONMetadataParser parser = getJSONParser(); JsonNode jmd1=parser.convert(md1); JsonNode jmd2=parser.convert(md2); List<DocComparator.Delta<JsonNode>> l=new JsonCompare().compareNodes(jmd1,jmd2).getDelta(); ArrayNode ret=JsonNodeFactory.instance.arrayNode(); for(DocComparator.Delta<JsonNode> delta:l) { if(delta instanceof DocComparator.Addition) { ObjectNode node=JsonNodeFactory.instance.objectNode(); node.set("+"+delta.getField2(),((DocComparator.Addition<JsonNode>)delta).getAddedNode()); ret.add(node); } else if(delta instanceof DocComparator.Removal) { ObjectNode node=JsonNodeFactory.instance.objectNode(); node.set("-"+delta.getField1(),((DocComparator.Removal<JsonNode>)delta).getRemovedNode()); ret.add(node); } else if(delta instanceof DocComparator.Modification) { ObjectNode node=JsonNodeFactory.instance.objectNode(); node.set("-"+delta.getField1(),((DocComparator.Modification<JsonNode>)delta).getUnmodifiedNode()); node.set("+"+delta.getField2(),((DocComparator.Modification<JsonNode>)delta).getModifiedNode()); ret.add(node); } } return ret.toString(); } else { throw Error.get(RestMetadataConstants.ERR_NO_ENTITY_VERSION, entity + ":" + version2); } } else { throw Error.get(RestMetadataConstants.ERR_NO_ENTITY_VERSION, entity + ":" + version1); } } catch (Error e) { return e.toString(); } catch (Exception e) { LOGGER.error("Failure: {}", e); return Error.get(RestMetadataConstants.ERR_REST_ERROR, e.toString()).toString(); } }