Source:
<code>public OpennmsModelProtos.Event.Builder toEvent(Event event) { if (event == null) { return null; } final OpennmsModelProtos.Event.Builder builder = OpennmsModelProtos.Event.newBuilder() .setId(event.getDbid()) .setUei(event.getUei()) .setSource(event.getSource()) .setSeverity(toSeverity(OnmsSeverity.get(event.getSeverity()))); getString(eventConfDao.getEventLabel(event.getUei())).ifPresent(builder::setLabel); getString(event.getDescr()).ifPresent(builder::setDescription); if (event.getLogmsg() != null) { builder.setLogMessage(event.getLogmsg().getContent()); } if (event.getNodeid() != null) { try { builder.setNodeCriteria(nodeIdToCriteriaCache.get(event.getNodeid())); } catch (ExecutionException e) { LOG.warn("An error occurred when building node criteria for node with id: {}." + " The node foreign source and foreign id (if set) will be missing from the event with id: {}.", event.getNodeid(), event.getDbid(), e); builder.setNodeCriteria(OpennmsModelProtos.NodeCriteria.newBuilder() .setId(event.getNodeid())); } } getString(event.getInterface()).ifPresent(builder::setIpAddress); for (Parm parm : event.getParmCollection()) { if (parm.getParmName() == null || parm.getValue() == null) { continue; <START> } <END> String value = EventDatabaseConstants.escape(parm.getValue().getContent() == null ? "" : parm.getValue().getContent(), EventDatabaseConstants.NAME_VAL_DELIM); builder.addParameter(OpennmsModelProtos.EventParameter.newBuilder() .setName(parm.getParmName()) .setValue(value)); } setTimeIfNotNull(event.getTime(), builder::setTime); setTimeIfNotNull(event.getCreationTime(), builder::setCreateTime); return builder; }</code><technical_language>need escape do we? suggestion String = parm.getValue().getContent() == null ? "" : parm.getValue().getContent();</technical_language>

Target:
public OpennmsModelProtos.Event.Builder toEvent(Event event) { if (event == null) { return null; } final OpennmsModelProtos.Event.Builder builder = OpennmsModelProtos.Event.newBuilder() .setId(event.getDbid()) .setUei(event.getUei()) .setSource(event.getSource()) .setSeverity(toSeverity(OnmsSeverity.get(event.getSeverity()))); getString(eventConfDao.getEventLabel(event.getUei())).ifPresent(builder::setLabel); getString(event.getDescr()).ifPresent(builder::setDescription); if (event.getLogmsg() != null) { builder.setLogMessage(event.getLogmsg().getContent()); } if (event.getNodeid() != null) { try { builder.setNodeCriteria(nodeIdToCriteriaCache.get(event.getNodeid())); } catch (ExecutionException e) { LOG.warn("An error occurred when building node criteria for node with id: {}." + " The node foreign source and foreign id (if set) will be missing from the event with id: {}.", event.getNodeid(), event.getDbid(), e); builder.setNodeCriteria(OpennmsModelProtos.NodeCriteria.newBuilder() .setId(event.getNodeid())); } } getString(event.getInterface()).ifPresent(builder::setIpAddress); for (Parm parm : event.getParmCollection()) { if (parm.getParmName() == null || parm.getValue() == null) { continue; } String value = parm.getValue().getContent() == null ? "" : parm.getValue().getContent(); builder.addParameter(OpennmsModelProtos.EventParameter.newBuilder() .setName(parm.getParmName()) .setValue(value)); } setTimeIfNotNull(event.getTime(), builder::setTime); setTimeIfNotNull(event.getCreationTime(), builder::setCreateTime); return builder; }