auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean isDeletionAllowed(ContainerData containerData, ContainerDeletionChoosingPolicy deletionPolicy) { if (!deletionPolicy .isValidContainerType(containerData.getContainerType())) { return false; } else if (!containerData.isClosed()) { return false; } else { if (ozoneContainer.getWriteChannel() instanceof XceiverServerRatis) { try { XceiverServerRatis ratisServer = (XceiverServerRatis) ozoneContainer.getWriteChannel(); long minReplicatedIndex = ratisServer.getMinReplicatedIndex(PipelineID .valueOf(UUID.fromString(containerData.getOriginPipelineId()))); long containerBCSID = containerData.getBlockCommitSequenceId(); if (minReplicatedIndex >= 0 && minReplicatedIndex < containerBCSID) { LOG.warn("Close Container log Index is not replicated across all" + "the servers in the pipeline as the min replicated " + "index is {}. Deletion is not allowed in this container " + "yet.", containerBCSID, containerData.getOriginPipelineId(), minReplicatedIndex); return false; } else { return true; } } catch (IOException ioe) { LOG.info(ioe.getMessage()); return false; } } return true; } }

Target:
private boolean isDeletionAllowed(ContainerData containerData, ContainerDeletionChoosingPolicy deletionPolicy) { if (!deletionPolicy .isValidContainerType(containerData.getContainerType())) { return false; } else if (!containerData.isClosed()) { return false; } else { if (ozoneContainer.getWriteChannel() instanceof XceiverServerRatis) { XceiverServerRatis ratisServer = (XceiverServerRatis) ozoneContainer.getWriteChannel(); PipelineID pipelineID = PipelineID .valueOf(UUID.fromString(containerData.getOriginPipelineId())); if (!ratisServer.isExist(pipelineID.getProtobuf())) { return true; } try { long minReplicatedIndex = ratisServer.getMinReplicatedIndex(pipelineID); long containerBCSID = containerData.getBlockCommitSequenceId(); if (minReplicatedIndex >= 0 && minReplicatedIndex < containerBCSID) { LOG.warn("Close Container log Index is not replicated across all" + "the servers in the pipeline as the min replicated " + "index is {}. Deletion is not allowed in this container " + "yet.", containerBCSID, containerData.getOriginPipelineId(), minReplicatedIndex); return false; } else { return true; } } catch (IOException ioe) { if (!ratisServer.isExist(pipelineID.getProtobuf())) { return true; } else { LOG.info(ioe.getMessage()); return false; } } } return true; } }
Source:
protected List<? extends EObject> getTargets(IterateCondition condition, EObject domainModel) { try { return databindings.getObservableList(condition.getItemReference(), domainModel); } catch (final DatabindingFailedException e) { Activator.log(e); return Collections.emptyList(); } }

Target:
protected List<? extends EObject> getTargets(IterateCondition condition, EObject domainModel) { try { return databindings.getObservableList(condition.getItemReference(), domainModel); } catch (final DatabindingFailedException e) { reportService.report(new DatabindingFailedReport(e)); return Collections.emptyList(); } }
Source:
private CommcareMetadataInfo populateReportsMetadata(CommcareMetadataJson metadataJson) { CommcareMetadataInfo metadataInfo = new CommcareMetadataInfo(); metadataInfo.setLimit(metadataJson.getLimit()); metadataInfo.setNextPageQueryString(metadataJson.getNextPageQueryString()); metadataInfo.setOffset(metadataJson.getOffset()); metadataInfo.setPreviousPageQueryString(metadataJson.getPreviousPageQueryString()); metadataInfo.setTotalCount(metadataJson.getTotalCount()); return metadataInfo; }

Target:
private CommcareMetadataInfo populateReportsMetadata(CommcareMetadataJson metadataJson) { return new CommcareMetadataInfo(metadataJson.getLimit(), metadataJson.getNextPageQueryString(), metadataJson.getOffset(), metadataJson.getPreviousPageQueryString(), metadataJson.getTotalCount()); }
Source:
public OneReplicaPipelineSafeModeRule(String ruleName, EventQueue eventQueue, PipelineManager pipelineManager, SCMSafeModeManager safeModeManager, Configuration configuration) { super(safeModeManager, ruleName, eventQueue); double percent = configuration.getDouble( HddsConfigKeys.HDDS_SCM_SAFEMODE_ONE_NODE_REPORTED_PIPELINE_PCT, HddsConfigKeys. HDDS_SCM_SAFEMODE_ONE_NODE_REPORTED_PIPELINE_PCT_DEFAULT); Preconditions.checkArgument((percent >= 0.0 && percent <= 1.0), HddsConfigKeys. HDDS_SCM_SAFEMODE_ONE_NODE_REPORTED_PIPELINE_PCT + " value should be >= 0.0 and <= 1.0"); int totalPipelineCount = pipelineManager.getPipelines(HddsProtos.ReplicationType.RATIS, HddsProtos.ReplicationFactor.THREE, Pipeline.PipelineState.OPEN) .size() + pipelineManager.getPipelines(HddsProtos.ReplicationType.RATIS, HddsProtos.ReplicationFactor.THREE, Pipeline.PipelineState.ALLOCATED).size(); thresholdCount = (int) Math.ceil(percent * totalPipelineCount); LOG.info("Total pipeline count is {}, pipeline's with at least one " + "datanode reported threshold count is {}", totalPipelineCount, thresholdCount); getSafeModeMetrics().setNumPipelinesWithAtleastOneReplicaReportedThreshold( thresholdCount); }

Target:
public OneReplicaPipelineSafeModeRule(String ruleName, EventQueue eventQueue, PipelineManager pipelineManager, SCMSafeModeManager safeModeManager, Configuration configuration) { super(safeModeManager, ruleName, eventQueue); double percent = configuration.getDouble( HddsConfigKeys.HDDS_SCM_SAFEMODE_ONE_NODE_REPORTED_PIPELINE_PCT, HddsConfigKeys. HDDS_SCM_SAFEMODE_ONE_NODE_REPORTED_PIPELINE_PCT_DEFAULT); Preconditions.checkArgument((percent >= 0.0 && percent <= 1.0), HddsConfigKeys. HDDS_SCM_SAFEMODE_ONE_NODE_REPORTED_PIPELINE_PCT + " value should be >= 0.0 and <= 1.0"); oldPipelineIDSet = ((SCMPipelineManager)pipelineManager).getOldPipelineIdSet(); int totalPipelineCount = pipelineManager.getPipelines(HddsProtos.ReplicationType.RATIS, HddsProtos.ReplicationFactor.THREE).size(); Preconditions.checkState(totalPipelineCount >= oldPipelineIDSet.size()); oldPipelineThresholdCount = (int) Math.ceil(percent * oldPipelineIDSet.size()); newPipelineThresholdCount = (int) Math.ceil( percent * (totalPipelineCount - oldPipelineIDSet.size())); thresholdCount = oldPipelineThresholdCount + newPipelineThresholdCount; LOG.info("Total pipeline count is {}, pipeline's with at least one " + "datanode reported threshold count is {}", totalPipelineCount, thresholdCount); getSafeModeMetrics().setNumPipelinesWithAtleastOneReplicaReportedThreshold( thresholdCount); }
Source:
public void close() throws IOException { allBarriersReceivedFuture.cancel(false); }

Target:
public synchronized void close() throws IOException { allBarriersReceivedFuture.cancel(false); }
Source:
private void createInterrupt(final ITmfStateSystem ssq, long startTime, long endTime, ResourcesEntryModel cpuEntry, List<Integer> irqQuarks, Type type, List<ResourcesEntryModel> builder) { for (Integer irqQuark : irqQuarks) { String resourceName = ssq.getAttributeName(irqQuark); int resourceId = Integer.parseInt(resourceName); long irqId = getId(irqQuark); builder.add(new ResourcesEntryModel(irqId, cpuEntry.getId(), computeEntryName(type, resourceId), startTime, endTime, resourceId, type)); fEntryModelTypes.put(irqQuark, type); String aggregateIrqtype = type == Type.IRQ ? Attributes.IRQS : Attributes.SOFT_IRQS; int aggregateQuark = ssq.optQuarkAbsolute(aggregateIrqtype, resourceName); long aggregateId = getId(aggregateQuark); if (!Iterables.any(builder, entry -> entry.getId() == aggregateId)) { builder.add(new ResourcesEntryModel(aggregateId, cpuEntry.getParentId(), computeEntryName(type, resourceId), startTime, endTime, resourceId, type)); } builder.add(new ResourcesEntryModel(irqId, aggregateId, computeEntryName(Type.CPU, cpuEntry.getResourceId()), startTime, endTime, cpuEntry.getResourceId(), type)); fEntryModelTypes.put(aggregateQuark, type); } }

Target:
private void createInterrupt(final ITmfStateSystem ssq, long startTime, long endTime, ResourcesEntryModel cpuEntry, List<Integer> irqQuarks, Type type, List<ResourcesEntryModel> builder) { for (Integer irqQuark : irqQuarks) { String resourceName = ssq.getAttributeName(irqQuark); int resourceId = Integer.parseInt(resourceName); long irqId = getId(irqQuark); builder.add(new ResourcesEntryModel(irqId, cpuEntry.getId(), computeEntryName(type, resourceId), startTime, endTime, resourceId, type)); fEntryModelTypes.put(irqQuark, type); String aggregateIrqtype = type == Type.IRQ ? Attributes.IRQS : Attributes.SOFT_IRQS; int aggregateQuark = ssq.optQuarkAbsolute(aggregateIrqtype, resourceName); if (aggregateQuark == ITmfStateSystem.INVALID_ATTRIBUTE) { return; } long aggregateId = getId(aggregateQuark); if (!Iterables.any(builder, entry -> entry.getId() == aggregateId)) { builder.add(new ResourcesEntryModel(aggregateId, cpuEntry.getParentId(), computeEntryName(type, resourceId), startTime, endTime, resourceId, type)); } builder.add(new ResourcesEntryModel(irqId, aggregateId, computeEntryName(Type.CPU, cpuEntry.getResourceId()), startTime, endTime, cpuEntry.getResourceId(), type)); fEntryModelTypes.put(aggregateQuark, type); } }
Source:
public boolean equals(final Object other) { if(this == other) return true; if(other == null || this.getClass() != other.getClass()) return false; Description that = (Description)other; if(id != that.id || alias != that.alias) return false; return true; }

Target:
public boolean equals(final Object other) { if(this == other) return true; if(other == null || this.getClass() != other.getClass()) return false; Description that = (Description)other; if(id != that.id) return false; if ((alias == null) ? (alias != null) : !alias.equals(that.alias)) return false; return true; }
Source:
public boolean removeNeededItem(Map<String, Integer> items, int slotNumber, EntityRef player) { EntityRef inventorySlot = inventoryManager.getItemInSlot(player, slotNumber); BlockItemComponent blockItemComponent = inventorySlot.getComponent(BlockItemComponent.class); String blockFamilyName = blockItemComponent.blockFamily.toString(); logger.info("This Oreon has an item demand for spawning: " + blockFamilyName); logger.info("Found the item needed to spawn stuff! Decrementing by {}, then spawning", items.get(blockFamilyName)); EntityRef result = inventoryManager.removeItem(player, player, inventorySlot, false, items.get(blockFamilyName)); if(result == null) { logger.info("Could not decrement the required amount from inventory, not spawning"); return false; } return true; }

Target:
private boolean removeNeededItem(Map<String, Integer> items, int slotNumber, EntityRef player) { EntityRef inventorySlot = inventoryManager.getItemInSlot(player, slotNumber); BlockItemComponent blockItemComponent = inventorySlot.getComponent(BlockItemComponent.class); String blockFamilyName = blockItemComponent.blockFamily.toString(); logger.info("This Oreon has an item demand for spawning: " + blockFamilyName); logger.info("Found the item needed to spawn stuff! Decrementing by {}, then spawning", items.get(blockFamilyName)); EntityRef result = inventoryManager.removeItem(player, player, inventorySlot, false, items.get(blockFamilyName)); if (result == null) { logger.info("Could not decrement the required amount from inventory, not spawning"); return false; } return true; }
Source:
public static void refreshCache() { try { ZK.createOnceExt(KRYO_REGISTERED_CLASS_PATH, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, true); } catch (KeeperException e) { throw new IllegalStateException( "Failed to refresh kryo cache " + KRYO_REGISTERED_CLASS_PATH, e); } catch (InterruptedException e) { throw new IllegalStateException( "Interrupted while refreshing kryo cache " + KRYO_REGISTERED_CLASS_PATH, e); } List<String> registeredList; try { registeredList = ZK.getChildrenExt(KRYO_REGISTERED_CLASS_PATH, false, true, false); } catch (KeeperException e) { throw new IllegalStateException( "Failed to retrieve child nodes for " + KRYO_REGISTERED_CLASS_PATH, e); } catch (InterruptedException e) { throw new IllegalStateException( "Interrupted while retrieving child nodes for " + KRYO_REGISTERED_CLASS_PATH, e); } for (String name : registeredList) { String className = name.substring(0, name.length() - ZooKeeperExt.SEQUENCE_NUMBER_LENGTH); int classId = Integer.parseInt( name.substring(name.length() - ZooKeeperExt.SEQUENCE_NUMBER_LENGTH)); if (MIN_CLASS_ID == -1) { MIN_CLASS_ID = classId; } int adjustedId = classId - MIN_CLASS_ID + BASE_CLASS_ID; if (CLASS_NAME_TO_ID.putIfAbsent(className, adjustedId) == null) { ID_TO_CLASS_NAME.put(adjustedId, className); } } }

Target:
public static void refreshCache() { if (!IS_CLASS_PATH_CREATED) { try { ZK.createOnceExt(KRYO_REGISTERED_CLASS_PATH, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, true); IS_CLASS_PATH_CREATED = true; } catch (KeeperException e) { throw new IllegalStateException( "Failed to refresh kryo cache " + KRYO_REGISTERED_CLASS_PATH, e); } catch (InterruptedException e) { throw new IllegalStateException( "Interrupted while refreshing kryo cache " + KRYO_REGISTERED_CLASS_PATH, e); } } List<String> registeredList; try { registeredList = ZK.getChildrenExt(KRYO_REGISTERED_CLASS_PATH, false, true, false); } catch (KeeperException e) { throw new IllegalStateException( "Failed to retrieve child nodes for " + KRYO_REGISTERED_CLASS_PATH, e); } catch (InterruptedException e) { throw new IllegalStateException( "Interrupted while retrieving child nodes for " + KRYO_REGISTERED_CLASS_PATH, e); } for (String name : registeredList) { if (LOG.isDebugEnabled()) { LOG.debug("Registered class: " + name); } String className = name.substring(0, name.length() - ZooKeeperExt.SEQUENCE_NUMBER_LENGTH); int classId = Integer.parseInt( name.substring(name.length() - ZooKeeperExt.SEQUENCE_NUMBER_LENGTH)); if (MIN_CLASS_ID == -1) { MIN_CLASS_ID = classId; } int adjustedId = classId - MIN_CLASS_ID + BASE_CLASS_ID; if (CLASS_NAME_TO_ID.putIfAbsent(className, adjustedId) == null) { ID_TO_CLASS_NAME.put(adjustedId, className); } } }
Source:
public <T> Mono<CosmosAsyncItemResponse<T>> createItem(T item, CosmosItemRequestOptions options) { if (options == null) { options = new CosmosItemRequestOptions(); } final CosmosItemRequestOptions requestOptions = options; return withContext(context -> createItem(item, requestOptions, context)).subscriberContext(reactorContext -> { Optional<String> master = reactorContext.getOrEmpty(TracerProvider.MASTER_CALL); if (master.isPresent()) { reactorContext = reactorContext.put(TracerProvider.NESTED_CALL, true); } return reactorContext.put(TracerProvider.MASTER_CALL, true); }); }

Target:
public <T> Mono<CosmosItemResponse<T>> createItem(T item, CosmosItemRequestOptions options) { if (options == null) { options = new CosmosItemRequestOptions(); } if (!database.getClient().getTracerProvider().isEnabled()) { return createItemInternal(item, options); } final CosmosItemRequestOptions requestOptions = options; return withContext(context -> createItemInternal(item, requestOptions, context)); }
Source:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try { LOG.trace("message received called {}", msg); try { LOG.debug("New message from {}", msg, ctx.channel()); NettyServerCnxn cnxn = ctx.channel().attr(CONNECTION_ATTRIBUTE).get(); if (cnxn == null) { LOG.error("channelRead() on a closed or closing NettyServerCnxn"); } else { cnxn.processMessage((ByteBuf) msg); } } catch (Exception ex) { LOG.error("Unexpected exception in receive", ex); throw ex; } } finally { ReferenceCountUtil.release(msg); } }

Target:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try { if (LOG.isTraceEnabled()) { LOG.trace("message received called {}", msg); } try { if (LOG.isDebugEnabled()) { LOG.debug("New message from {}", msg, ctx.channel()); } NettyServerCnxn cnxn = ctx.channel().attr(CONNECTION_ATTRIBUTE).get(); if (cnxn == null) { LOG.error("channelRead() on a closed or closing NettyServerCnxn"); } else { cnxn.processMessage((ByteBuf) msg); } } catch (Exception ex) { LOG.error("Unexpected exception in receive", ex); throw ex; } } finally { ReferenceCountUtil.release(msg); } }
Source:
public Node call() throws Exception { Thread.sleep(time); System.out.println("launching slave"); DumbSlave slave = rule.createSlave(label); slave.getNodeProperties().addAll(nodeProperties); computer = slave.toComputer(); computer.connect(false).get(); synchronized (DummyCloudImpl.this) { System.out.println(computer.getName()+" launch"+(computer.isOnline()?"ed successfully":" failed")); System.out.println(computer.getLog()); } return slave; }

Target:
public Node call() throws Exception { Thread.sleep(time); System.out.println("launching slave"); final DumbSlave slave = rule.createSlave(label); Provider<NodeProperty> nodePropertyProvider = new Provider<NodeProperty>() { @Override public NodeProperty invoke(NodeProperty request) { request.setNode(slave); return request; } }; for (NodeProperty nodeProperty : nodeProperties) { slave.getNodeProperties().add(nodePropertyProvider.invoke(nodeProperty)); } computer = slave.toComputer(); computer.connect(false).get(); synchronized (DummyCloudImpl.this) { System.out.println(computer.getName()+" launch"+(computer.isOnline()?"ed successfully":" failed")); System.out.println(computer.getLog()); } return slave; }
Source:
public ContainerInfo getContainerInfo() { ContainerInfo ci = new ContainerInfo(); ci.id = container.getExternalId(); ci.host = container.host; ci.state = container.getState().name(); ci.jvmName = this.jvmName; ci.numOperators = container.getOperators().size(); ci.operatorsIdandName = new HashMap<>(); for (PTOperator ptOperator : container.getOperators()) { ci.operatorsIdandName.put(ptOperator.getId(), ptOperator.getName()); } ci.memoryMBAllocated = container.getAllocatedMemoryMB(); ci.lastHeartbeat = lastHeartbeatMillis; ci.memoryMBFree = this.memoryMBFree; ci.gcCollectionCount = this.gcCollectionCount; ci.gcCollectionTime = this.gcCollectionTime; ci.startedTime = container.getStartedTime(); ci.finishedTime = container.getFinishedTime(); if (this.container.nodeHttpAddress != null) { YarnConfiguration conf = new YarnConfiguration(); ci.containerLogsUrl = ConfigUtils .getSchemePrefix(conf) + this.container.nodeHttpAddress + "/node/containerlogs/" + ci.id + "/" + System .getenv(ApplicationConstants.Environment.USER.toString()); ci.rawContainerLogsUrl = ConfigUtils .getRawContainerLogsUrl(conf, container.nodeHttpAddress, container.getPlan().getLogicalPlan().getAttributes() .get(LogicalPlan.APPLICATION_ID), ci.id); } return ci; }

Target:
public ContainerInfo getContainerInfo() { ContainerInfo ci = new ContainerInfo(); ci.id = container.getExternalId(); ci.host = container.host; ci.state = container.getState().name(); ci.jvmName = this.jvmName; ci.numOperators = container.getOperators().size(); ci.operators = new TreeMap<>(); for (PTOperator ptOperator : container.getOperators()) { ci.operators.put(ptOperator.getId(), ptOperator.getName()); } ci.memoryMBAllocated = container.getAllocatedMemoryMB(); ci.lastHeartbeat = lastHeartbeatMillis; ci.memoryMBFree = this.memoryMBFree; ci.gcCollectionCount = this.gcCollectionCount; ci.gcCollectionTime = this.gcCollectionTime; ci.startedTime = container.getStartedTime(); ci.finishedTime = container.getFinishedTime(); if (this.container.nodeHttpAddress != null) { YarnConfiguration conf = new YarnConfiguration(); ci.containerLogsUrl = ConfigUtils .getSchemePrefix(conf) + this.container.nodeHttpAddress + "/node/containerlogs/" + ci.id + "/" + System .getenv(ApplicationConstants.Environment.USER.toString()); ci.rawContainerLogsUrl = ConfigUtils .getRawContainerLogsUrl(conf, container.nodeHttpAddress, container.getPlan().getLogicalPlan().getAttributes() .get(LogicalPlan.APPLICATION_ID), ci.id); } return ci; }
Source:
public VoltXMLElement voltAnnotateWindowedAggregateXML(VoltXMLElement exp, SimpleColumnContext context) throws HSQLParseException { VoltXMLElement winspec = new VoltXMLElement("winspec"); VoltXMLElement winargs = new VoltXMLElement("winargs"); exp.children.add(winspec); exp.children.add(winargs); if (m_partitionByList.size() > 0) { VoltXMLElement pxe = new VoltXMLElement("partitionbyList"); winspec.children.add(pxe); for (Expression e : m_partitionByList) { pxe.children.add(e.voltGetXML(context, null)); } } VoltXMLElement rxe = new VoltXMLElement("orderbyList"); winspec.children.add(rxe); if (m_sortAndSlice != null) { for (int i = 0; i < m_sortAndSlice.exprList.size(); i++) { Expression e = (Expression) m_sortAndSlice.exprList.get(i); assert(e instanceof ExpressionOrderBy); ExpressionOrderBy expr = (ExpressionOrderBy)e; VoltXMLElement orderby = expr.voltGetXML(context, null); boolean isDecending = expr.isDescending(); orderby.attributes.put("decending", isDecending ? "true": "false"); rxe.children.add(orderby); } } if (nodes.length > 0) { for (Expression expr : nodes) { winargs.children.add(expr.voltGetXML(context, null)); } } return exp; }

Target:
public VoltXMLElement voltAnnotateWindowedAggregateXML(VoltXMLElement exp, SimpleColumnContext context) throws HSQLParseException { VoltXMLElement winspec = new VoltXMLElement("winspec"); VoltXMLElement winargs = new VoltXMLElement("winargs"); exp.children.add(winspec); exp.children.add(winargs); if (nodes.length > 0) { for (Expression expr : nodes) { winargs.children.add(expr.voltGetXML(context, null)); } } if (m_partitionByList.size() > 0) { VoltXMLElement pxe = new VoltXMLElement("partitionbyList"); winspec.children.add(pxe); for (Expression e : m_partitionByList) { pxe.children.add(e.voltGetXML(context, null)); } } VoltXMLElement rxe = new VoltXMLElement("orderbyList"); winspec.children.add(rxe); if (m_sortAndSlice != null) { for (int i = 0; i < m_sortAndSlice.exprList.size(); i++) { Expression e = (Expression) m_sortAndSlice.exprList.get(i); assert(e instanceof ExpressionOrderBy); ExpressionOrderBy expr = (ExpressionOrderBy)e; VoltXMLElement orderby = expr.voltGetXML(context, null); boolean isDecending = expr.isDescending(); orderby.attributes.put("decending", isDecending ? "true": "false"); rxe.children.add(orderby); } } return exp; }
Source:
public void onPartitionRemoved(PartitionId partitionId) { }

Target:
public void onPartitionRemoved(PartitionId partitionId) { partitionSet.remove(partitionId); latchForRemove.countDown(); }
Source:
public static <M extends MessageEnvelope, K> Window<M, K, WindowKey<K>, Collection<M>, WindowOutput<WindowKey<K>, Collection<M>>> keyedSessionWindow(Function<M, K> keyFn, Duration sessionGap) { BiFunction<M, Collection<M>, Collection<M>> aggregator = (m, c) -> { c.add(m); return c; }; return keyedSessionWindow(keyFn, sessionGap, aggregator); }

Target:
public static <M extends MessageEnvelope, K> Window<M, K, Collection<M>, WindowPane<K, Collection<M>>> keyedSessionWindow(Function<M, K> keyFn, Duration sessionGap) { BiFunction<M, Collection<M>, Collection<M>> aggregator = (m, c) -> { c.add(m); return c; }; return keyedSessionWindow(keyFn, sessionGap, aggregator); }
Source:
public @Nullable VirtualTableLine getElement(long index) { if (fProvider == null) { return null; } if (fCache == null) { populateCache((int) index); } ITmfVirtualTableModel<VirtualTableLine> cache = fCache; if (cache != null) { long cacheStartingIndex = cache.getIndex(); int lineInCache = cache.getData().size(); long lastIndex = cacheStartingIndex + lineInCache; if (index >= cacheStartingIndex && index < lastIndex) { return cache.getData().get((int) (index - cacheStartingIndex)); } populateCache((int) (index)); return getElement(index); } return null; }

Target:
public @Nullable SegmentStoreTableLine getElement(long index) { if(index > getTotalNbLine()) { return null; } if (fProvider == null) { return null; } if (fCache == null) { populateCache((int) index); } ITmfVirtualTableModel<SegmentStoreTableLine> cache = fCache; if (cache != null) { long cacheStartingIndex = cache.getIndex(); int lineInCache = cache.getData().size(); long lastIndex = cacheStartingIndex + lineInCache; if (index >= cacheStartingIndex && index < lastIndex) { return cache.getData().get((int) (index - cacheStartingIndex)); } populateCache((int) (index)); if (fTotalNbLine == -1) { return null; } return getElement(index); } return null; }
Source:
public synchronized void removeRemoteSource(TaskId sourceTaskId) { requireNonNull(sourceTaskId, "sourceTaskId is null"); if (closed.get()) { return; } URI location = taskIdToURI.get(sourceTaskId); if (location == null) { return; } HttpPageBufferClient client = allClients.get(location); if (client == null) { return; } client.close(); cancelledClients.add(client); completedClients.add(client); }

Target:
public synchronized void removeRemoteSource(TaskId sourceTaskId) { requireNonNull(sourceTaskId, "sourceTaskId is null"); if (closed.get()) { return; } removedRemoteSourceTaskIds.add(sourceTaskId); URI location = taskIdToLocationMap.get(sourceTaskId); if (location == null) { return; } HttpPageBufferClient client = allClients.get(location); if (client == null) { return; } closeQuietly(client); removedClients.add(client); completedClients.add(client); }
Source:
private Map<String, Object> getAttributes() { Map<String, Object> attributeValues = new HashMap<String, Object>(); for (String attribute : attributes) { int equalsIndex = attribute.indexOf(ATTRIBUTE_SEPARATOR); if(equalsIndex > -1) { String attributeName = attribute.substring(0, equalsIndex); String attributeValue = attribute.substring(equalsIndex+1, attribute.length()); attributeValues.put(attributeName, attributeValue); } else { attributeValues.put(attribute, ""); } } return attributeValues; }

Target:
private Map<String, Object> getAttributes() { Map<String, Object> attributeValues = new HashMap<String, Object>(); for (String attribute : attributes) { int equalsIndex = attribute.indexOf('='); if(equalsIndex > -1) { String name = attribute.substring(0, equalsIndex); String value = attribute.substring(equalsIndex + 1, attribute.length()); attributeValues.put(name, value); } else { attributeValues.put(attribute, ""); } } return attributeValues; }
Source:
private Jwt createJwt(String token, JWT parsedJwt) { Jwt jwt; try { JWTClaimsSet jwtClaimsSet = this.jwtProcessor.process(parsedJwt, null); Instant expiresAt = null; if (jwtClaimsSet.getExpirationTime() != null) { expiresAt = jwtClaimsSet.getExpirationTime().toInstant(); } Instant issuedAt = null; if (jwtClaimsSet.getIssueTime() != null) { issuedAt = jwtClaimsSet.getIssueTime().toInstant(); } else if (expiresAt != null) { issuedAt = Instant.from(expiresAt).minusSeconds(1); } Map<String, Object> headers = new LinkedHashMap<>(parsedJwt.getHeader().toJSONObject()); jwt = new Jwt(token, issuedAt, expiresAt, headers, jwtClaimsSet.getClaims()); } catch (RemoteKeySourceException ex) { if (ex.getCause() instanceof ParseException) { throw new JwtException("An error occurred while attempting to decode the Jwt: Malformed Jwk set"); } else { throw new JwtException("An error occurred while attempting to decode the Jwt: " + ex.getMessage(), ex); } } catch (Exception ex) { if (ex.getCause() instanceof ParseException) { throw new JwtException("An error occurred while attempting to decode the Jwt: Malformed payload"); } else { throw new JwtException("An error occurred while attempting to decode the Jwt: " + ex.getMessage(), ex); } } return jwt; }

Target:
private Jwt createJwt(String token, JWT parsedJwt) { Jwt jwt; try { JWTClaimsSet jwtClaimsSet = this.jwtProcessor.process(parsedJwt, null); Instant expiresAt = null; if (jwtClaimsSet.getExpirationTime() != null) { expiresAt = jwtClaimsSet.getExpirationTime().toInstant(); } Instant issuedAt = null; if (jwtClaimsSet.getIssueTime() != null) { issuedAt = jwtClaimsSet.getIssueTime().toInstant(); } else if (expiresAt != null) { issuedAt = Instant.from(expiresAt).minusSeconds(1); } Map<String, Object> headers = new LinkedHashMap<>(parsedJwt.getHeader().toJSONObject()); jwt = new Jwt(token, issuedAt, expiresAt, headers, jwtClaimsSet.getClaims()); } catch (RemoteKeySourceException ex) { if (ex.getCause() instanceof ParseException) { throw new JwtException(String.format(DECODING_ERROR_MESSAGE_TEMPLATE, "Malformed Jwk set")); } else { throw new JwtException(String.format(DECODING_ERROR_MESSAGE_TEMPLATE, ex.getMessage()), ex); } } catch (Exception ex) { if (ex.getCause() instanceof ParseException) { throw new JwtException(String.format(DECODING_ERROR_MESSAGE_TEMPLATE, "Malformed payload")); } else { throw new JwtException(String.format(DECODING_ERROR_MESSAGE_TEMPLATE, ex.getMessage()), ex); } } return jwt; }
Source:
private void checkSubtype(TypeMirror expected, Object givenValue) { if (expected.getKind().isPrimitive()) { expected = types.boxedClass((PrimitiveType) expected).asType(); } if (expected.getKind() == TypeKind.DECLARED && TypesUtils.isClass(expected) && givenValue instanceof TypeMirror) { return; } TypeMirror found; boolean isSubtype; if (expected.getKind() == TypeKind.DECLARED && ((DeclaredType) expected).asElement().getKind() == ElementKind.ANNOTATION_TYPE && givenValue instanceof AnnotationMirror) { found = ((AnnotationMirror) givenValue).getAnnotationType(); isSubtype = ((DeclaredType) expected) .asElement() .equals(((DeclaredType) found).asElement()); } else if (givenValue instanceof AnnotationMirror) { found = ((AnnotationMirror) givenValue).getAnnotationType(); isSubtype = false; } else if (givenValue instanceof VariableElement) { found = ((VariableElement) givenValue).asType(); if (expected.getKind() == TypeKind.DECLARED) { isSubtype = types.isSubtype(types.erasure(found), types.erasure(expected)); } else { isSubtype = false; } } else { found = elements.getTypeElement(givenValue.getClass().getCanonicalName()).asType(); isSubtype = types.isSubtype(types.erasure(found), types.erasure(expected)); } if (!isSubtype) { isSubtype = found.toString().equals(expected.toString()); } if (!isSubtype) { if (found.toString().equals(expected.toString())) { throw new BugInCF( "given value differs from expected, but same string representation; " + "this is likely a bootclasspath/classpath issue; " + "found: " + found); } else { throw new BugInCF( "given value differs from expected; " + "found: " + found + "; expected: " + expected); } } }

Target:
private void checkSubtype(TypeMirror expected, Object givenValue) { if (expected.getKind().isPrimitive()) { expected = types.boxedClass((PrimitiveType) expected).asType(); } if (expected.getKind() == TypeKind.DECLARED && TypesUtils.isClass(expected) && givenValue instanceof TypeMirror) { return; } TypeMirror found; boolean isSubtype; if (expected.getKind() == TypeKind.DECLARED && ((DeclaredType) expected).asElement().getKind() == ElementKind.ANNOTATION_TYPE && givenValue instanceof AnnotationMirror) { found = ((AnnotationMirror) givenValue).getAnnotationType(); isSubtype = ((DeclaredType) expected) .asElement() .equals(((DeclaredType) found).asElement()); } else if (givenValue instanceof AnnotationMirror) { found = ((AnnotationMirror) givenValue).getAnnotationType(); isSubtype = false; } else if (givenValue instanceof VariableElement) { found = ((VariableElement) givenValue).asType(); if (expected.getKind() == TypeKind.DECLARED) { isSubtype = types.isSubtype(types.erasure(found), types.erasure(expected)); } else { isSubtype = false; } } else { found = elements.getTypeElement(givenValue.getClass().getCanonicalName()).asType(); isSubtype = types.isSubtype(types.erasure(found), types.erasure(expected)); } if (!isSubtype) { isSubtype = found.toString().equals(expected.toString()); } if (!isSubtype) { throw new BugInCF( "given value differs from expected; " + "found: " + found + "; expected: " + expected); } }
Source:
private void updateNotPropagatedHeaders(String[] headers, boolean merge) { if (!ObjectUtils.isEmpty(headers)) { Assert.noNullElements(headers, "null elements are not allowed in 'headers'"); if (!merge) { this.notPropagatedHeaders.clear(); } this.notPropagatedHeaders.addAll(Arrays.asList(headers)); } this.selectiveHeaderPropagation = this.notPropagatedHeaders.size() > 0; this.shouldCopyRequestHeaders = !this.notPropagatedHeaders.contains("*"); }

Target:
private void updateNotPropagatedHeaders(String[] headers, boolean merge) { Set<String> headerPatterns = new HashSet<>(); if (merge) { headerPatterns.addAll(Arrays.asList(this.notPropagatedHeaders)); } if (!ObjectUtils.isEmpty(headers)) { Assert.noNullElements(headers, "null elements are not allowed in 'headers'"); headerPatterns.addAll(Arrays.asList(headers)); this.notPropagatedHeaders = headerPatterns.toArray(new String[headerPatterns.size()]); } boolean hasAsterisk = headerPatterns.contains("*"); if (hasAsterisk) { this.notPropagatedHeaders = new String[] { "*" }; this.noHeadersPropagation = true; } this.selectiveHeaderPropagation = this.notPropagatedHeaders.length > 0; }
Source:
private CommTestRobot() { super(); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } nodeList.add(new RBSMNode(NodeChannel.ENCODER, NodeChannel.STEERING, RobobuggyConfigFile.getComPortRBSM(), RobobuggyConfigFile.RBSM_COMMAND_PERIOD)); nodeList.add(new SweepNode(NodeChannel.DRIVE_CTRL)); RobobuggyJFrame mainWindow = new RobobuggyJFrame("MainWindow", 1.0, 1.0); Gui.getInstance().addWindow(mainWindow); RobobuggyGUITabs tabs = new RobobuggyGUITabs(); mainWindow.addComponent(tabs, 0.0, 0.0, 1.0, 1.0); tabs.addTab(new MainGuiWindow(), "Home"); tabs.add(new PathPanel(), "Path Visualizer"); tabs.addTab(new ConfigurationPanel(), "Configuration"); }

Target:
private CommTestRobot() { super(); try { Thread.sleep(ARDUINO_BOOTLOADER_TIMEOUT_MS); } catch (InterruptedException e) { e.printStackTrace(); } nodeList.add(new RBSMNode(NodeChannel.ENCODER, NodeChannel.STEERING, RobobuggyConfigFile.getComPortRBSM(), RobobuggyConfigFile.RBSM_COMMAND_PERIOD)); nodeList.add(new SweepNode(NodeChannel.DRIVE_CTRL)); RobobuggyJFrame mainWindow = new RobobuggyJFrame("MainWindow", 1.0, 1.0); Gui.getInstance().addWindow(mainWindow); RobobuggyGUITabs tabs = new RobobuggyGUITabs(); mainWindow.addComponent(tabs, 0.0, 0.0, 1.0, 1.0); tabs.addTab(new MainGuiWindow(), "Home"); }
Source:
public void testQueryElementPrecedingOne() throws Exception { final String xpath = " final RootNode rootNode = getRootNode("InputXpathMapperPreceding.java"); final DetailAST[] actual = convertToArray(getXpathItems(xpath, rootNode)); assertEquals("Invalid number of nodes", 17, actual.length); }

Target:
public void testQueryElementPrecedingOne() throws Exception { final String xpath = " final RootNode rootNode = getRootNode("InputXpathMapperSingleTopClass.java"); final DetailAST[] actual = convertToArray(getXpathItems(xpath, rootNode)); assertThat("Invalid number of nodes", actual.length, equalTo(17)); }
Source:
public void getCandidateByApplicationIdShouldReturnNullWhenThereIsNoApplicationWithTheGivenId() { given(applicationsRepository.findOne(APPLICATION_ID)) .willReturn(dummyApplicationEntity); given(converterService.convert(dummyCandidateEntity, CandidateDTO.class)) .willReturn(dummyCandidateDto); CandidateDTO candidate = candidateService.getCandidateByApplicationID(NON_EXISTENT_APPLICATION_ID); assertThat(candidate, nullValue()); }

Target:
public void getCandidateByApplicationIdShouldReturnNullWhenThereIsNoApplicationWithTheGivenId() { given(applicationsRepository.findOne(NON_EXISTENT_APPLICATION_ID)).willReturn(null); CandidateDTO candidate = candidateService.getCandidateByApplicationID(NON_EXISTENT_APPLICATION_ID); assertThat(candidate, nullValue()); }
Source:
public TopNQuery( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("virtualColumns") VirtualColumns virtualColumns, @JsonProperty("dimension") DimensionSpec dimensionSpec, @JsonProperty("metric") TopNMetricSpec topNMetricSpec, @JsonProperty("threshold") int threshold, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec, @JsonProperty("filter") DimFilter dimFilter, @JsonProperty("granularity") QueryGranularity granularity, @JsonProperty("aggregations") List<AggregatorFactory> aggregatorSpecs, @JsonProperty("postAggregations") List<PostAggregator> postAggregatorSpecs, @JsonProperty("context") Map<String, Object> context ) { super(dataSource, querySegmentSpec, false, context); this.virtualColumns = virtualColumns == null ? VirtualColumns.EMPTY : virtualColumns; this.dimensionSpec = dimensionSpec; this.topNMetricSpec = topNMetricSpec; this.threshold = threshold; this.dimFilter = dimFilter; this.granularity = granularity; this.aggregatorSpecs = aggregatorSpecs == null ? ImmutableList.<AggregatorFactory>of() : aggregatorSpecs; this.postAggregatorSpecs = postAggregatorSpecs == null ? ImmutableList.<PostAggregator>of() : postAggregatorSpecs; Preconditions.checkNotNull(dimensionSpec, "dimensionSpec can't be null"); Preconditions.checkNotNull(topNMetricSpec, "must specify a metric"); Preconditions.checkArgument(threshold != 0, "Threshold cannot be equal to 0."); topNMetricSpec.verifyPreconditions(this.aggregatorSpecs, this.postAggregatorSpecs); Queries.verifyAggregations(this.aggregatorSpecs, this.postAggregatorSpecs); }

Target:
public TopNQuery( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("virtualColumns") VirtualColumns virtualColumns, @JsonProperty("dimension") DimensionSpec dimensionSpec, @JsonProperty("metric") TopNMetricSpec topNMetricSpec, @JsonProperty("threshold") int threshold, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec, @JsonProperty("filter") DimFilter dimFilter, @JsonProperty("granularity") QueryGranularity granularity, @JsonProperty("aggregations") List<AggregatorFactory> aggregatorSpecs, @JsonProperty("postAggregations") List<PostAggregator> postAggregatorSpecs, @JsonProperty("context") Map<String, Object> context ) { super(dataSource, querySegmentSpec, false, context); this.virtualColumns = VirtualColumns.nullToEmpty(virtualColumns); this.dimensionSpec = dimensionSpec; this.topNMetricSpec = topNMetricSpec; this.threshold = threshold; this.dimFilter = dimFilter; this.granularity = granularity; this.aggregatorSpecs = aggregatorSpecs == null ? ImmutableList.<AggregatorFactory>of() : aggregatorSpecs; this.postAggregatorSpecs = Queries.prepareAggregations( this.aggregatorSpecs, postAggregatorSpecs == null ? ImmutableList.<PostAggregator>of() : postAggregatorSpecs ); Preconditions.checkNotNull(dimensionSpec, "dimensionSpec can't be null"); Preconditions.checkNotNull(topNMetricSpec, "must specify a metric"); Preconditions.checkArgument(threshold != 0, "Threshold cannot be equal to 0."); topNMetricSpec.verifyPreconditions(this.aggregatorSpecs, this.postAggregatorSpecs); }
Source:
public static boolean validateStatementID(String statementID) { if(statementID.equals("")) return true; String separator = "\\$"; String statementFormat ="^\\{?[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}\\}?$"; String[] statementParts = statementID.split(separator); if(statementParts.length != 2) throw new IllegalArgumentException("Statement ID does not have the correct number of parts"); if(statementParts[0].charAt(0) != 'Q' && statementParts[0].charAt(0) != 'P' && statementParts[0].charAt(0) != 'L') throw new TypeNotPresentException("Query,Property or Lexeme", null); if(!statementParts[1].matches(statementFormat)) throw new IllegalStateException("Statement part does not have a correct format"); return true; }

Target:
public static boolean validateStatementID(String statementID) { if(statementID.equals("")) return true; String separator = "\\$"; String statementFormat ="^\\{?[A-Za-z0-9]{8}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{4}-[A-Za-z0-9]{12}\\}?$"; String[] statementParts = statementID.split(separator); if(statementParts.length != 2) throw new IllegalArgumentException("Statement ID does not have the correct number of parts"); if(statementParts[0].charAt(0) != 'Q' && statementParts[0].charAt(0) != 'P' && statementParts[0].charAt(0) != 'L' && statementParts[0].charAt(0) != 'M') throw new TypeNotPresentException("Query,Property or Lexeme", null); if(!statementParts[1].matches(statementFormat)) throw new IllegalStateException("Statement part does not have a correct format"); return true; }
Source:
public SwrveConversationCampaign(ISwrveCampaignManager campaignManager, SwrveCampaignDisplayer campaignDisplayer, JSONObject campaignData, Set<SwrveAssetsQueueItem> assetImageQueue, Set<SwrveAssetsQueueItem> assetFontQueue) throws JSONException { super(campaignManager, campaignDisplayer, campaignData); if(campaignData.has("conversation")) { JSONObject conversationData = campaignData.getJSONObject("conversation"); this.conversation = createConversation(this, conversationData, campaignManager); for (ConversationPage conversationPage : conversation.getPages()) { for (ConversationAtom conversationAtom : conversationPage.getContent()) { switch (conversationAtom.getType()) { case CONTENT_IMAGE: addImageToQ(assetImageQueue, (Content) conversationAtom); break; case CONTENT_HTML: case INPUT_STARRATING: addFontToQ(assetFontQueue, conversationAtom.getStyle()); break; case INPUT_MULTIVALUE: MultiValueInput multiValueInput = (MultiValueInput) conversationAtom; addFontToQ(assetFontQueue, multiValueInput.getStyle()); for (ChoiceInputItem item : multiValueInput.getValues()) { addFontToQ(assetFontQueue, item.getStyle()); } break; } } for (ButtonControl buttonControl : conversationPage.getControls()) { addFontToQ(assetFontQueue, buttonControl.getStyle()); } } } }

Target:
public SwrveConversationCampaign(ISwrveCampaignManager campaignManager, SwrveCampaignDisplayer campaignDisplayer, JSONObject campaignData, Set<SwrveAssetsQueueItem> assetImageQueue, Set<SwrveAssetsQueueItem> assetFontQueue) throws JSONException { super(campaignManager, campaignDisplayer, campaignData); if(campaignData.has("conversation")) { JSONObject conversationData = campaignData.getJSONObject("conversation"); this.conversation = createConversation(this, conversationData, campaignManager); for (ConversationPage conversationPage : conversation.getPages()) { for (ConversationAtom conversationAtom : conversationPage.getContent()) { switch (conversationAtom.getType()) { case CONTENT_IMAGE: queueImageAsset(assetImageQueue, (Content) conversationAtom); break; case CONTENT_HTML: case INPUT_STARRATING: queueFontAsset(assetFontQueue, conversationAtom.getStyle()); break; case INPUT_MULTIVALUE: MultiValueInput multiValueInput = (MultiValueInput) conversationAtom; queueFontAsset(assetFontQueue, multiValueInput.getStyle()); for (ChoiceInputItem item : multiValueInput.getValues()) { queueFontAsset(assetFontQueue, item.getStyle()); } break; } } for (ButtonControl buttonControl : conversationPage.getControls()) { queueFontAsset(assetFontQueue, buttonControl.getStyle()); } } } }
Source:
public Computation attach(String handle, String filters, Integer resolution) { Map<String, String> params = new HashMap<String, String>(); addParam(params, "filters", filters); addParam(params, "resolution", resolution); return new Computation(this.transport, handle, params, true); }

Target:
public Computation attach(String handle, String filters, Integer resolution) { return new Computation(this.transport, handle, buildParams("filters", filters, "resolution", resolution), true); }
Source:
public void shouldSerializeAllBasicFieldsIndented() { String expectedResult = "<order>\n <price>15.0</price>\n <comments>pack it nicely, please</comments>\n</order>"; Order order = new Order(new Client("guilherme silveira"), 15.0, "pack it nicely, please"); serialization.indented().from(order).serialize(); assertThat(result(), is(equalTo(expectedResult))); }

Target:
public void shouldSerializeAllBasicFieldsIndented() { String expectedResult = "<order>\n" + " <price>15.0</price>\n" + " <comments>pack it nicely, please</comments>\n" + "</order>"; Order order = new Order(new Client("guilherme silveira"), 15.0, "pack it nicely, please"); serialization.indented().from(order).serialize(); assertThat(result(), is(equalTo(expectedResult))); }
Source:
public static <T, E extends Throwable> T execute(final short databaseId, TransactionCallbackWithException<T, E> callback) throws E { String name = "tx-" + counter.incrementAndGet(); TransactionLegacy currentTxn = TransactionLegacy.currentTxn(false); short outer_txn_databaseId = (currentTxn != null ? currentTxn.getDatabaseId() : databaseId); TransactionLegacy txn = TransactionLegacy.open(name, databaseId, true); try { txn.start(); T result = callback.doInTransaction(STATUS); txn.commit(); return result; } finally { txn.close(); TransactionLegacy.open(outer_txn_databaseId).close(); } }

Target:
public static <T, E extends Throwable> T execute(final short databaseId, TransactionCallbackWithException<T, E> callback) throws E { String name = "tx-" + counter.incrementAndGet(); TransactionLegacy currentTxn = TransactionLegacy.currentTxn(false); short outer_txn_databaseId = (currentTxn != null ? currentTxn.getDatabaseId() : databaseId); try (final TransactionLegacy txn = TransactionLegacy.open(name, databaseId, true)) { txn.start(); T result = callback.doInTransaction(STATUS); txn.commit(); return result; } finally { TransactionLegacy.open(outer_txn_databaseId).close(); } }
Source:
public void review(final PendingCertifiedProductDTO listing) { for (PendingCertificationResultDTO cert : listing.getCertificationCriterion()) { if (cert.getMeetsCriteria() != null && cert.getMeetsCriteria()) { if (cert.getTestTools() != null && cert.getTestTools().size() > 0) { Iterator<PendingCertificationResultTestToolDTO> testToolIter = cert.getTestTools().iterator(); while (testToolIter.hasNext()) { PendingCertificationResultTestToolDTO testTool = testToolIter.next(); if (!StringUtils.isEmpty(testTool.getName()) && StringUtils.isEmpty(testTool.getVersion())) { if (listing.getIcs() != null && listing.getIcs().booleanValue()) { listing.getWarningMessages() .add(msgUtil.getMessage("listing.criteria.missingTestToolVersion", testTool.getName(), cert.getNumber())); } else { listing.getErrorMessages() .add(msgUtil.getMessage("listing.criteria.missingTestToolVersion", testTool.getName(), cert.getNumber())); } } } } } } }

Target:
public void review(final PendingCertifiedProductDTO listing) { for (PendingCertificationResultDTO cert : listing.getCertificationCriterion()) { if (cert.getMeetsCriteria() != null && cert.getMeetsCriteria() && cert.getTestTools() != null && cert.getTestTools().size() > 0) { for (PendingCertificationResultTestToolDTO testTool : cert.getTestTools()) { if (!StringUtils.isEmpty(testTool.getName()) && StringUtils.isEmpty(testTool.getVersion())) { if (listing.getIcs() != null && listing.getIcs().booleanValue()) { listing.getWarningMessages() .add(msgUtil.getMessage("listing.criteria.missingTestToolVersion", testTool.getName(), cert.getNumber())); } else { listing.getErrorMessages() .add(msgUtil.getMessage("listing.criteria.missingTestToolVersion", testTool.getName(), cert.getNumber())); } } } } } }