auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean updateOH(VeluxBindingProvider provider, EventPublisher eventPublisher) { logger.trace("updateOH() called."); <START> if (channel.existingProducts.isDirty()) { <END> logger.trace("updateOH(): existingProducts have changed."); for (VeluxProduct product : channel.existingProducts.valuesOfModified()) { logger.trace("updateOH(): actuator has changed values.", product.getName().toString()); for (String thisItemName : provider.getInBindingItemNames()) { VeluxBindingConfig thisItemConfig = provider.getConfigForItemName(thisItemName); if (thisItemConfig.getBindingItemType() != VeluxItemType.ACTUATOR_SERIAL) { continue; } if (product.getSerialNumber().equals(thisItemConfig.getBindingConfig())) { logger.trace("updateOH(): product {}/{} used within item {}.", product.getName(), product.getSerialNumber(),thisItemName); try { PercentType positionAsPercent = new VeluxProductPosition(product.getCurrentPosition()).getPositionAsPercentType(); if (positionAsPercent != null) { logger.debug("updateOH(): updating item to position {}%.", thisItemName,positionAsPercent); eventPublisher.postUpdate(thisItemName, positionAsPercent); } else { logger.trace("updateOH(): update of item to position skipped.", thisItemName,positionAsPercent); } } catch (Exception e) { logger.warn("updateOH(): getProducts() exception: {}.", e.getMessage()); } } } } channel.existingProducts.resetDirtyFlag(); } logger.trace("updateOH() finished."); return true; }</code><technical_language>invert this if</technical_language>

Target:
public boolean updateOH(VeluxBindingProvider provider, EventPublisher eventPublisher) { logger.trace("updateOH() called."); if (!channel.existingProducts.isDirty()) { logger.trace("updateOH() finished."); return true; } logger.trace("updateOH(): existingProducts have changed."); for (VeluxProduct product : channel.existingProducts.valuesOfModified()) { logger.trace("updateOH(): actuator has changed values.", product.getProductName().toString()); for (String thisItemName : provider.getInBindingItemNames()) { VeluxBindingConfig thisItemConfig = provider.getConfigForItemName(thisItemName); if (thisItemConfig.getBindingItemType() != VeluxItemType.ACTUATOR_SERIAL) { continue; } if (product.getSerialNumber().equals(thisItemConfig.getBindingConfig())) { logger.trace("updateOH(): product {}/{} used within item {}.", product.getProductName(), product.getSerialNumber(), thisItemName); try { PercentType positionAsPercent = new VeluxProductPosition(product.getCurrentPosition()) .getPositionAsPercentType(); if (positionAsPercent != null) { logger.debug("updateOH(): updating item to position {}%.", thisItemName, positionAsPercent); eventPublisher.postUpdate(thisItemName, positionAsPercent); } else { logger.trace("updateOH(): update of item to position skipped.", thisItemName, positionAsPercent); } } catch (Exception e) { logger.warn("updateOH(): getProducts() exception: {}.", e.getMessage()); } } } } channel.existingProducts.resetDirtyFlag(); logger.trace("updateOH() finished."); return true; }
Source:
<code>public byte[][] transformToBytesValuesSV(ProjectionBlock projectionBlock) { if (_results == null) { _results = new byte[DocIdSetPlanNode.MAX_DOC_PER_CALL][]; } byte[][] argumentValues = _transformFunction.transformToBytesValuesSV(projectionBlock); for (int i = 0; i < projectionBlock.getNumDocs(); i++) { try { Geometry geometry = _reader.read(argumentValues[i]); _results[i] = GeometrySerializer.serialize(geometry); } catch (ParseException e) { <START> throw new RuntimeException(String.format("Failed to parse geometry from bytes %s", argumentValues[i])); <END> } } return _results; }</code><technical_language>suggestion throw new RuntimeException(String.format("Failed parse geometry bytes: %s", BytesUtils.toHexString(argumentValues[i])));</technical_language>

Target:
public byte[][] transformToBytesValuesSV(ProjectionBlock projectionBlock) { if (_results == null) { _results = new byte[DocIdSetPlanNode.MAX_DOC_PER_CALL][]; } byte[][] argumentValues = _transformFunction.transformToBytesValuesSV(projectionBlock); for (int i = 0; i < projectionBlock.getNumDocs(); i++) { try { Geometry geometry = _reader.read(argumentValues[i]); _results[i] = GeometrySerializer.serialize(geometry); } catch (ParseException e) { throw new RuntimeException( String.format("Failed to parse geometry from bytes %s", BytesUtils.toHexString(argumentValues[i]))); } } return _results; }
Source:
<code>public void close() { <START> _baseDataAccessor.close(); <END> }</code><technical_language>call unlock() here</technical_language>

Target:
public void close() { if (isCurrentOwner()) { throw new HelixException("Please unlock the lock before closing it."); } _baseDataAccessor.close(); }
Source:
<code>protected void configure(NullPointerTester tester) { super.configure(tester); tester.setDefault(InboxId.class, InboxId.getDefaultInstance()) .setDefault(TypeUrl.class, TypeUrl.of(Calc.class)); <START> tester.testStaticMethods(getUtilityClass(), NullPointerTester.Visibility.PACKAGE); <END> }</code><technical_language>configure method is meant execute tests</technical_language>

Target:
protected void configure(NullPointerTester tester) { super.configure(tester); tester.setDefault(InboxId.class, InboxId.getDefaultInstance()) .setDefault(TypeUrl.class, TypeUrl.of(Calc.class)); }
Source:
<code>public void removeAggregateProvidersTest() throws Exception { String provider1name = randomAlphanumeric(5) + "_1", provider2name = randomAlphanumeric(5) + "_2", aggregateProvidersName = randomAlphanumeric(5); Address provider1address = elyOps.getElytronAddress(PROVIDER_LOADER, provider1name), provider2address = elyOps.getElytronAddress(PROVIDER_LOADER, provider2name), aggregateProvidersAddress = elyOps.getElytronAddress(AGGREGATE_PROVIDERS, aggregateProvidersName); page.navigateToApplication().selectResource(AGGREGATE_PROVIDERS_LABEL); try { <START> ops.add(provider1address).assertSuccess(); <END> ops.add(provider2address).assertSuccess(); ops.add(aggregateProvidersAddress, Values.of(PROVIDERS, new ModelNodeListBuilder() .addNode(new ModelNode(provider1name)) .addNode(new ModelNode(provider2name)).build())); page.navigateToApplication().selectResource(AGGREGATE_PROVIDERS_LABEL).getResourceManager() .removeResource(aggregateProvidersName).confirmAndDismissReloadRequiredMessage().assertClosed(); assertFalse("Removed resource should not be present in the table any more!", page.resourceIsPresentInMainTable(aggregateProvidersName)); new ResourceVerifier(aggregateProvidersAddress, client).verifyDoesNotExist(); } finally { ops.removeIfExists(aggregateProvidersAddress); ops.removeIfExists(provider1address); ops.removeIfExists(provider2address); adminOps.reloadIfRequired(); } }</code><technical_language>Navigating again..</technical_language>

Target:
public void removeAggregateProvidersTest() throws Exception { String provider1name = randomAlphanumeric(5) + "_1", provider2name = randomAlphanumeric(5) + "_2", aggregateProvidersName = randomAlphanumeric(5); Address provider1address = elyOps.getElytronAddress(PROVIDER_LOADER, provider1name), provider2address = elyOps.getElytronAddress(PROVIDER_LOADER, provider2name), aggregateProvidersAddress = elyOps.getElytronAddress(AGGREGATE_PROVIDERS, aggregateProvidersName); try { ops.add(provider1address).assertSuccess(); ops.add(provider2address).assertSuccess(); ops.add(aggregateProvidersAddress, Values.of(PROVIDERS, new ModelNodeListBuilder() .addNode(new ModelNode(provider1name)) .addNode(new ModelNode(provider2name)).build())); page.navigateToApplication().selectResource(AGGREGATE_PROVIDERS_LABEL).getResourceManager() .removeResource(aggregateProvidersName).confirmAndDismissReloadRequiredMessage().assertClosed(); assertFalse("Removed resource should not be present in the table any more!", page.resourceIsPresentInMainTable(aggregateProvidersName)); new ResourceVerifier(aggregateProvidersAddress, client).verifyDoesNotExist(); } finally { ops.removeIfExists(aggregateProvidersAddress); ops.removeIfExists(provider1address); ops.removeIfExists(provider2address); adminOps.reloadIfRequired(); } }
Source:
<code>public boolean visit(final SwitchStatement node) { List<Pair<List<Statement>, List<Statement>>> switchStructure = getSwitchStructure(node); for (int referenceIndex = 0; referenceIndex < switchStructure.size() - 1; referenceIndex++) { for (int comparedIndex = referenceIndex + 1; comparedIndex < switchStructure.size(); comparedIndex++) { Pair<List<Statement>, List<Statement>> referenceCase = switchStructure.get(referenceIndex); Pair<List<Statement>, List<Statement>> comparedCase = switchStructure.get(comparedIndex); if (!referenceCase.getSecond().isEmpty() && breaksControlFlow(referenceCase.getSecond().get(referenceCase.getSecond().size() - 1)) && isTheSameCode(referenceCase.getSecond(), comparedCase.getSecond())) { List<Statement> precedingStatements = switchStructure.get(comparedIndex - 1).getSecond(); if (breaksControlFlow(precedingStatements.get(precedingStatements.size() - 1))) { refactorByMergingCases(false, referenceCase, comparedCase); <START> return DO_NOT_VISIT_SUBTREE; <END> } else if (referenceIndex == 0) { refactorByMergingCases(true, comparedCase, referenceCase); return DO_NOT_VISIT_SUBTREE; } else { precedingStatements = switchStructure.get(referenceIndex - 1).getSecond(); if (breaksControlFlow(precedingStatements.get(precedingStatements.size() - 1))) { refactorByMergingCases(true, comparedCase, referenceCase); return DO_NOT_VISIT_SUBTREE; } } } } } return VISIT_SUBTREE; }</code><technical_language>java return refactorByMergingCases(false, referenceCase, comparedCase); ? for call sites of refactorByMergingCases() method</technical_language>

Target:
public boolean visit(final SwitchStatement node) { final List<SwitchCaseSection> switchStructure = getSwitchStructure(node); for (int referenceIndex = 0; referenceIndex < switchStructure.size() - 1; referenceIndex++) { for (int comparedIndex = referenceIndex + 1; comparedIndex < switchStructure.size(); comparedIndex++) { final SwitchCaseSection referenceCase = switchStructure.get(referenceIndex); final SwitchCaseSection comparedCase = switchStructure.get(comparedIndex); if (!referenceCase.stmts.isEmpty() && breaksControlFlow(referenceCase.stmts.get(referenceCase.stmts.size() - 1)) && isSameCode(referenceCase.stmts, comparedCase.stmts)) { List<Statement> precedingStatements = switchStructure.get(comparedIndex - 1).stmts; if (breaksControlFlow(precedingStatements.get(precedingStatements.size() - 1))) { mergeCases(false, referenceCase, comparedCase); return DO_NOT_VISIT_SUBTREE; } else if (referenceIndex == 0) { mergeCases(true, comparedCase, referenceCase); return DO_NOT_VISIT_SUBTREE; } else { precedingStatements = switchStructure.get(referenceIndex - 1).stmts; if (breaksControlFlow(precedingStatements.get(precedingStatements.size() - 1))) { mergeCases(true, comparedCase, referenceCase); return DO_NOT_VISIT_SUBTREE; } } } } } return VISIT_SUBTREE; }
Source:
<code>static Protocol resolve(final Protocol protocol) { Protocol result = new Protocol(protocol.getName(), protocol.getDoc(), protocol.getNamespace()); final Collection<Schema> types = protocol.getTypes(); List<Schema> newSchemas = new ArrayList(types.size()); Map<String, Schema> processed = new HashMap<String, Schema>(); for (Schema schema : types) { newSchemas.add(resolve(schema, protocol, processed)); } result.setTypes(newSchemas); for (Map.Entry<String, Protocol.Message> entry : protocol.getMessages().entrySet()) { Protocol.Message value = entry.getValue(); Protocol.Message nvalue; if (value.isOneWay()) { Schema request = value.getRequest(); nvalue = result.createMessage(value.getName(), value.getDoc(), <START> value.getObjectProps(), intern(request, processed)); <END> } else { Schema request = value.getRequest(); Schema response = value.getResponse(); Schema errors = value.getErrors(); nvalue = result.createMessage(value.getName(), value.getDoc(), value.getObjectProps(), intern(request, processed), intern(response, processed), intern(errors, processed)); } result.getMessages().put(entry.getKey(), nvalue); } copyProps(protocol, result); return result; }</code><technical_language>messages interned types resolved? types defined first, making need resolved? I guess recursive types need resolution, this define recursive schemas types, messages</technical_language>

Target:
static Protocol resolve(final Protocol protocol) { Protocol result = new Protocol(protocol.getName(), protocol.getDoc(), protocol.getNamespace()); final Collection<Schema> types = protocol.getTypes(); List<Schema> newSchemas = new ArrayList(types.size()); IdentityHashMap<Schema, Schema> replacements = new IdentityHashMap<Schema, Schema>(); for (Schema schema : types) { newSchemas.add(Schemas.visit(schema, new ResolvingVisitor(schema, replacements, new SymbolTable(protocol)))); } result.setTypes(newSchemas); for (Map.Entry<String, Protocol.Message> entry : protocol.getMessages().entrySet()) { Protocol.Message value = entry.getValue(); Protocol.Message nvalue; if (value.isOneWay()) { Schema replacement = resolve(replacements, value.getRequest(), protocol); nvalue = result.createMessage(value.getName(), value.getDoc(), value.getObjectProps(), replacement); } else { Schema request = resolve(replacements, value.getRequest(), protocol); Schema response = resolve(replacements, value.getResponse(), protocol); Schema errors = resolve(replacements, value.getErrors(), protocol); nvalue = result.createMessage(value.getName(), value.getDoc(), value.getObjectProps(), request, response, errors); } result.getMessages().put(entry.getKey(), nvalue); } Schemas.copyProperties(protocol, result); return result; }
Source:
<code>private void initRevisionActions(ChangeInfo info, RevisionInfo revInfo, boolean hasUser) { NativeMap<ActionInfo> actions = revInfo.has_actions() ? revInfo.actions() : NativeMap.<ActionInfo> create(); actions.copyKeysIntoChildren("id"); canSubmit = false; if (hasUser) { canSubmit = actions.containsKey("submit"); if (canSubmit) { ActionInfo actionInfo = actions.get("submit"); submit.setTitle(actionInfo.title()); <START> submit.setText(actionInfo.label()); <END> } a2b(actions, "/", deleteRevision); a2b(actions, "cherrypick", cherrypick); a2b(actions, "publish", publish); a2b(actions, "rebase", rebase); for (String id : filterNonCore(actions)) { add(new ActionButton(info, revInfo, actions.get(id))); } } }</code><technical_language>CSS requires this text of a <div> in button</technical_language>

Target:
private void initRevisionActions(ChangeInfo info, RevisionInfo revInfo, boolean hasUser) { NativeMap<ActionInfo> actions = revInfo.has_actions() ? revInfo.actions() : NativeMap.<ActionInfo> create(); actions.copyKeysIntoChildren("id"); canSubmit = false; if (hasUser) { canSubmit = actions.containsKey("submit"); if (canSubmit) { ActionInfo action = actions.get("submit"); submit.setTitle(action.title()); submit.setHTML(new SafeHtmlBuilder() .openDiv() .append(action.label()) .closeDiv()); } a2b(actions, "/", deleteRevision); a2b(actions, "cherrypick", cherrypick); a2b(actions, "publish", publish); a2b(actions, "rebase", rebase); for (String id : filterNonCore(actions)) { add(new ActionButton(info, revInfo, actions.get(id))); } } }
Source:
<code>private static String generateTitle(Collection<IDataChartDescriptor<?, ?>> descriptors, @Nullable IAxis axis) { String title; <START> if (descriptors.size() <= 0) { <END> return StringUtils.EMPTY; } IDataChartDescriptor<?, ?> descriptor = descriptors.iterator().next(); if (descriptors.size() == 1) { title = descriptor.getLabel(); } else { long nbDiffDescriptorName = descriptors.stream() .map(d -> d.getName()) .distinct() .count(); long nbDiffDescriptorUnits = descriptors.stream() .map(d -> d.getUnit()) .distinct() .count(); title = "Value"; if (nbDiffDescriptorName == 1) { title = descriptor.getName(); } String units = null; if (nbDiffDescriptorUnits == 1) { units = descriptor.getUnit(); } if (units != null) { title = title + ' ' + '(' + units + ')'; } } if (axis != null) { Format format = axis.getTick().getFormat(); if (format instanceof ChartTimeStampFormat) { title = title + ' ' + '(' + ((ChartTimeStampFormat) format).getPattern() + ')'; } } return title; }</code><technical_language>isEmpty</technical_language>

Target:
private static String generateTitle(Collection<IDataChartDescriptor<?, ?>> descriptors, @Nullable IAxis axis) { String title; if (descriptors.isEmpty()) { return StringUtils.EMPTY; } IDataChartDescriptor<?, ?> descriptor = descriptors.iterator().next(); long nbDiffDescriptorName = descriptors.stream() .map(d -> d.getName()) .distinct() .count(); long nbDiffDescriptorUnits = descriptors.stream() .map(d -> d.getUnit()) .distinct() .count(); title = "Value"; if (nbDiffDescriptorName == 1) { title = descriptor.getName(); } String units = null; if (nbDiffDescriptorUnits == 1) { units = descriptor.getUnit(); } if (units != null) { title = title + ' ' + '(' + units + ')'; } if (axis != null) { Format format = axis.getTick().getFormat(); if (format instanceof ChartTimeStampFormat) { title = title + ' ' + '(' + ((ChartTimeStampFormat) format).getPattern() + ')'; } } return title; }
Source:
<code>public List<ErlangCallbackFunction> getOptionalCallbacks() { ErlangFileStub stub = getStub(); if (stub != null) { return getChildrenByType(stub, ErlangTypes.ERL_CALLBACK_FUNCTION, new ArrayFactory<ErlangCallbackFunction>() { @NotNull @Override public ErlangCallbackFunction[] create(int count) { return new ErlangCallbackFunction[count]; } }); } final List<ErlangCallbackFunction> result = ContainerUtil.newArrayList(); for (ErlangAttribute attribute : getAttributes()) { ErlangOptionalCallbacks callbacks = attribute.getOptionalCallbacks(); ErlangOptionalCallbackFunctions functions = callbacks != null ? callbacks.getOptionalCallbackFunctions() : null; if (functions == null) continue; for (ErlangCallbackFunction function : functions.getCallbackFunctionList()) { result.add(function); } } <START> return result; <END> }</code><technical_language>compute callback functions getOptionalCallbacks call. a other methods in this class - of caching - should, too</technical_language>

Target:
public Collection<ErlangCallbackFunction> getOptionalCallbacks() { return myOptionalCallbacks.getValue(); }
Source:
<code>public IPath getGDBPath() { IPath retVal = getDefaultGDBPath(); try { String gdb = getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME); if (gdb == null) { gdb = getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, <START> (String) null); <END> } if (gdb != null) { gdb = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(gdb, false); retVal = new Path(gdb); } } catch (CoreException e) { GdbPlugin.log(e.getStatus()); } return retVal; }</code><technical_language>Putting null instead of defaultGdbCommand means defaultGDBPath longer variable substitution below. new getDefaultGDBPath() method return a String instead of a Path? done before</technical_language>

Target:
public IPath getGDBPath() { try { String gdb = getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME); if (gdb == null) { gdb = getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, getDefaultGDBPath()); } if (gdb != null) { gdb = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(gdb, false); return new Path(gdb); } else { return null; } } catch (CoreException e) { GdbPlugin.log(e.getStatus()); return null; } }
Source:
<code>private EntityGraph createEntityGraph(RequestScope scope, EntityProjection projection) { EntityDictionary dictionary = scope.getDictionary(); Class<?> entityClass = projection.getType(); List<String> relationshipNames = dictionary.getRelationships(entityClass); for (String relationshipName : relationshipNames) { if (!projection.getIncludedRelationsName().contains(relationshipName)) { continue; } <START> RelationshipType type = dictionary.getRelationshipType(entityClass, relationshipName); <END> if (type.isToMany() && !type.isComputed()) { String relationshipClassName = dictionary.getJsonAliasFor( dictionary.getParameterizedType(entityClass, relationshipName)); boolean isDirtyResource = StreamSupport.stream(scope.getDirtyResources().spliterator(), false) .anyMatch(resource -> resource.getType().equals(relationshipClassName)); if (!isDirtyResource || dictionary.cascadeAll(entityClass, relationshipName)) { EntityGraph entityGraph = em.createEntityGraph(entityClass); entityGraph.addAttributeNodes(relationshipName); return entityGraph; } } } return null; }</code><technical_language>this information dictionary (name class of relationship), get entity projection</technical_language>

Target:
private EntityGraph createEntityGraph(RequestScope scope, EntityProjection projection) { EntityDictionary dictionary = scope.getDictionary(); Class<?> entityClass = projection.getType(); EntityGraph entityGraph = em.createEntityGraph(entityClass); boolean toManyAdded = false; for (Relationship relationship : projection.getRelationships()) { RelationshipType type = dictionary.getRelationshipType(entityClass, relationship.getName()); if (type.isComputed()) { continue; } else if (type.isToOne()) { populateSubGraph(entityGraph.addSubgraph(relationship.getName()), scope, relationship.getProjection(), toManyAdded); } else if (type.isToMany()) { if (!toManyAdded && !checkTransient(scope, entityClass, relationship)) { toManyAdded = true; populateSubGraph(entityGraph.addSubgraph(relationship.getName()), scope, relationship.getProjection(), toManyAdded); } } } for (Attribute attribute : projection.getAttributes()) { if (dictionary.isComputed(entityClass, attribute.getName())) { continue; } if (attribute.getType().isAssignableFrom(Collection.class)) { if (!toManyAdded) { entityGraph.addAttributeNodes(attribute.getName()); toManyAdded = true; } } else { entityGraph.addAttributeNodes(attribute.getName()); } } return entityGraph; }
Source:
<code>public static void main(String[] args) throws XmppStringprepException, FileNotFoundException { PrintWriter pw; boolean breakStateName; switch (args.length) { case 0: pw = new PrintWriter(System.out); breakStateName = false; printStateGraph(pw, breakStateName); pw.flush(); break; case 1: Path outputFilePath = Paths.get(args[0]); File outputFile = outputFilePath.toFile(); if (outputFile.exists()) { outputFile.delete(); } pw = new PrintWriter(outputFile); breakStateName = true; printStateGraph(pw, breakStateName); pw.flush(); break; <START> case 2: <END> Path outputFilePathTcp = Paths.get(args[0]); File outputFileTcp = outputFilePathTcp.toFile(); if (outputFileTcp.exists()) { outputFileTcp.delete(); } pw = new PrintWriter(outputFileTcp); breakStateName = true; printStateGraph(pw, breakStateName); pw.flush(); Path outputFilePathWebsocket = Paths.get(args[1]); File outputFileWebsocket = outputFilePathWebsocket.toFile(); if (outputFileWebsocket.exists()) { outputFileWebsocket.delete(); } pw = new PrintWriter(outputFileWebsocket); breakStateName = true; printWebsocketStateGraph(pw, breakStateName); pw.flush(); break; default: throw new IllegalArgumentException("At most two arguments allowed"); } }</code><technical_language>This case removed, means of changes this method reverted</technical_language>

Target:
public static void main(String[] args) throws XmppStringprepException, FileNotFoundException { final PrintWriter pw; final boolean breakStateName; switch (args.length) { case 0: pw = new PrintWriter(System.out); breakStateName = false; break; case 1: Path outputFilePath = Paths.get(args[0]); File outputFile = outputFilePath.toFile(); if (outputFile.exists()) { outputFile.delete(); } pw = new PrintWriter(outputFile); breakStateName = true; break; default: throw new IllegalArgumentException("At most one argument allowed"); } printStateGraph(pw, breakStateName); pw.flush(); }
Source:
<code>public void addStatus(AlluxioURI path, UfsStatus status) { <START> UfsStatus prev = mStatuses.putIfAbsent(path, status); <END> if (!path.getName().equals(status.getName())) { throw new IllegalArgumentException( String.format("path name %s does not match ufs status name %s", path.getName(), status.getName())); } }</code><technical_language>is prev for, if there, do</technical_language>

Target:
public UfsStatus addStatus(AlluxioURI path, UfsStatus status) { if (!path.getName().equals(status.getName())) { throw new IllegalArgumentException( String.format("path name %s does not match ufs status name %s", path.getName(), status.getName())); } return mStatuses.put(path, status); }
Source:
<code>public void addContents(@NonNull Container container, FileListCap fileListCap) { synchronized (fileListCap) { File[] files = fileListCap.getFolder().listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".txt"); } }); for (File f : Util.fixNull(Arrays.asList(files))) { if (f.length() < MAX_FILE_SIZE) container.add(new FileContent(fileListCap.getFolder().getName() + "/" + f.getName(), f)); else LOGGER.log(Level.INFO, "File : " + f.getAbsolutePath() <START> + " is too large. Max file size is " + MAX_FILE_SIZE + " bytes."); <END> } } }</code><technical_language>include in truncated form</technical_language>

Target:
public void addContents(@NonNull Container container, FileListCap fileListCap) { synchronized (fileListCap) { File[] files = fileListCap.getFolder().listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".txt"); } }); for (File f : Util.fixNull(Arrays.asList(files))) { if (f.length() < MAX_FILE_SIZE) container.add(new FileContent(fileListCap.getFolder().getName() + "/" + f.getName(), f)); else { LOGGER.log(Level.INFO, "File : " + f.getAbsolutePath() + " is too large. Max file size is " + MAX_FILE_SIZE + " bytes. Truncating the thread dump."); File truncatedFile = new File(f.getParent(), "truncated-" + f.getName()); FileChannel fileChannel = null; try { FileUtils.copyFile(f, truncatedFile); fileChannel = new FileOutputStream(truncatedFile, true).getChannel(); fileChannel.truncate(MAX_FILE_SIZE * 1l); } catch (FileNotFoundException e) { LOGGER.log(Level.INFO, "Unable to find file.", e); } catch (IOException e) { LOGGER.log(Level.INFO, "Failed to write to file", e); } finally { if (fileChannel != null) { try { fileChannel.close(); } catch (IOException e) { LOGGER.log(Level.FINE, "Failed to close file.", e); } } } if (truncatedFile.exists()) { container.add(new FileContent(fileListCap.getFolder().getName() + "/" + truncatedFile.getName(), truncatedFile)); } else { LOGGER.fine("Issue with truncating file: " + f.getAbsolutePath()); } } } } }
Source:
<code>public static void initializeFromOptions(DebugOptions options, boolean pluginIsDebugging) { if (pluginIsDebugging) { myTrace = new DebugTrace() { <START> <END> public void trace(String location, String message, Throwable error) { } public void trace(String location, String message) { } }; for (GitTraceLocation loc : values()) { boolean active = options.getBooleanOption(loc.getFullPath(), false); loc.setActive(active); } } else { for (GitTraceLocation loc : values()) { loc.setActive(false); } } }</code><technical_language>CRLF line endings</technical_language>

Target:
public static void initializeFromOptions(DebugOptions options, boolean pluginIsDebugging) { if (pluginIsDebugging) { myTrace = new DebugTraceImpl(); for (GitTraceLocation loc : values()) { boolean active = options.getBooleanOption(loc.getFullPath(), false); loc.setActive(active); } } else { for (GitTraceLocation loc : values()) { loc.setActive(false); } } }
Source:
<code>public TObject sumKey(String key, AccessToken creds, TransactionToken transaction, String environment) throws SecurityException, TransactionException, TException { <START> checkAccess(creds, transaction); <END> AtomicSupport store = getStore(transaction, environment); AtomicOperation atomic = null; BigDecimal result = new BigDecimal(0); while (atomic == null || !atomic.commit()) { atomic = store.startAtomicOperation(); try { Map<TObject, Set<Long>> map = atomic.browse(key); for (TObject k : map.keySet()) { Set<Long> records = map.get(k); Object obj = Convert.thriftToJava(k); BigDecimal val = null; if(!(obj instanceof Number)) { throw new UnsupportedOperationException(); } else { Number number = (Number) obj; if(number instanceof Byte || number instanceof Short) { throw new UnsupportedOperationException(); } else { val = Numbers.toBigDecimal(number); } } for (int i = 0; i < records.size(); i++) { result = result.add(val); } } } catch (AtomicStateException e) { atomic = null; result = null; } } return Convert.javaToThrift(result); }</code><technical_language>This method sumKeyRecordAtomic duplicating logic</technical_language>

Target:
public TObject sumKey(String key, AccessToken creds, TransactionToken transaction, String environment) throws TException { checkAccess(creds, transaction); AtomicSupport store = getStore(transaction, environment); AtomicOperation atomic = null; Number sum = 0; while (atomic == null || !atomic.commit()) { atomic = store.startAtomicOperation(); try { sum = sumKeyAtomic(key, Time.NONE, sum, atomic); } catch (AtomicStateException e) { atomic = null; sum = 0; } } return Convert.javaToThrift(sum); }
Source:
<code>public Map<String,byte[]> findScriptResources( String targetId ) throws IOException { Map<String,byte[]> result = new HashMap<String,byte[]> (); File targetDir = findTargetDirectory( targetId ); if( targetDir.isDirectory()){ <START> File scriptFile = new File( targetDir, Constants.TARGET_SCRIPT_FILE_NAME ); <END> if( scriptFile.exists()) { ByteArrayOutputStream os = new ByteArrayOutputStream(); Utils.copyStream( scriptFile, os ); result.put( scriptFile.getName(), os.toByteArray()); } } return result; }</code><technical_language>right, script this name? likely, not</technical_language>

Target:
public Map<String,byte[]> findScriptResources( String targetId ) throws IOException { Map<String,byte[]> result = new HashMap<String,byte[]> (); File targetDir = findTargetDirectory( targetId ); String prefix = Utils.removeFileExtension(findTargetFile(targetId, Constants.TARGET_PROPERTIES_FILE_NAME).getName()); if( targetDir.isDirectory()){ List<File> scriptFiles = Utils.listAllFiles(targetDir); for( File scriptFile : scriptFiles) { String name = scriptFile.getName(); if( ! CREATED_BY.equals(name) && name.startsWith(prefix) && ! name.toLowerCase().endsWith(Constants.FILE_EXT_PROPERTIES)) { ByteArrayOutputStream os = new ByteArrayOutputStream(); Utils.copyStream( scriptFile, os ); result.put( scriptFile.getName(), os.toByteArray()); } } } return result; }
Source:
<code>private void updateExternalNics(){ for (VmNetworkInterface nic : vmNetworkInterfaceDao.getAllForVm(getVmId())) { VnicProfile vnicProfile = vnicProfileDao.get(nic.getVnicProfileId()); Network network = networkDao.get(vnicProfile.getNetworkId()); if (network.isExternal()) { Provider<?> provider = providerDao.get(network.getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = providerProxyFactory.create(provider); <START> providerProxy.allocate(network, vnicProfile, nic, destinationVds); <END> } } }</code><technical_language>update 'runtimeProperties' returned 'allocate'</technical_language>

Target:
private void updateExternalNics(){ Map<VmDeviceId, VmDevice> nicDevices = Entities.businessEntitiesById(vmDeviceDao.getVmDeviceByVmIdAndType(getVmId(), VmDeviceGeneralType.INTERFACE)); for (VmNetworkInterface nic : vmNetworkInterfaceDao.getAllForVm(getVmId())) { VnicProfile vnicProfile = vnicProfileDao.get(nic.getVnicProfileId()); Network network = networkDao.get(vnicProfile.getNetworkId()); if (network.isExternal()) { Provider<?> provider = providerDao.get(network.getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = providerProxyFactory.create(provider); Map<String, String> deviceProperties = providerProxy.allocate( network, vnicProfile, nic, destinationVds); VmDevice vmDevice = nicDevices.get(new VmDeviceId(nic.getId(), getVmId())); getVm().getRuntimeDeviceCustomProperties().put(vmDevice.getId(), deviceProperties); } } }
Source:
<code>protected void upgradeNexusVersion() throws IOException { final String currentVersion = checkNotNull( applicationStatusSource.getSystemStatus().getVersion() ); final String previousVersion = getConfiguration().getNexusVersion(); if ( currentVersion.equals( previousVersion ) ) { setInstanceUpgraded( false ); } else { setInstanceUpgraded( true ); getConfiguration().setNexusVersion( currentVersion ); storeConfiguration(); <START> eventMulticaster.notifyEventListeners( new NexusVersionChangedEvent( this, previousVersion, <END> currentVersion ) ); } }</code><technical_language>events (yet). Model upgrade emitting events either, Status flags this change properly set. baby steps, introduce events for (unless some other good reason mentioned for need)</technical_language>

Target:
protected void upgradeNexusVersion() throws IOException { final String currentVersion = checkNotNull( applicationStatusSource.getSystemStatus().getVersion() ); final String previousVersion = getConfiguration().getNexusVersion(); if ( currentVersion.equals( previousVersion ) ) { setInstanceUpgraded( false ); } else { setInstanceUpgraded( true ); getConfiguration().setNexusVersion( currentVersion ); storeConfiguration(); } }
Source:
<code>private AmazonS3 getS3Client() { AmazonS3 amazonS3 = null; AWSCredentials awsCredentials = null; AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(s3Endpoint, getS3Region()); if (StringUtils.isNotBlank(s3AccessKey)) { awsCredentials = new BasicAWSCredentials(s3AccessKey, s3SecretKey); AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(awsCredentials); amazonS3 = <START> AmazonS3ClientBuilder.standard() <END> .withCredentials(credentialsProvider) .withEndpointConfiguration(endpointConfiguration) .build(); } if (amazonS3 == null) { amazonS3 = AmazonS3ClientBuilder.standard().withEndpointConfiguration(endpointConfiguration).build(); } return amazonS3; }</code><technical_language>return result of builder instead of storing local variable? need if check either</technical_language>

Target:
private AmazonS3 getS3Client() { AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(s3Endpoint, getS3Region()); if (StringUtils.isNotBlank(s3AccessKey)) { AWSCredentials awsCredentials = new BasicAWSCredentials(s3AccessKey, s3SecretKey); AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(awsCredentials); return AmazonS3ClientBuilder.standard() .withCredentials(credentialsProvider) .withEndpointConfiguration(endpointConfiguration) .build(); } return AmazonS3ClientBuilder.standard() .withEndpointConfiguration(endpointConfiguration) .build(); }
Source:
<code>static void call(final Button b, final String project) { b.setEnabled(false); <START> ChangeApi.createDraftChange(project, <END> "refs/meta/config", Util.C.editConfigMessage(), null, new GerritCallback<ChangeInfo>() { @Override public void onSuccess(ChangeInfo result) { Gerrit.display(Dispatcher.toEditScreen( new PatchSet.Id(result.legacy_id(), 1), "project.config")); } @Override public void onFailure(Throwable caught) { b.setEnabled(true); super.onFailure(caught); } }); }</code><technical_language>This renamed in [1]. [1] <LINK_0></technical_language>

Target:
static void call(final Button b, final String project) { b.setEnabled(false); ChangeApi.createChange(project, "refs/meta/config", Util.C.editConfigMessage(), null, new GerritCallback<ChangeInfo>() { @Override public void onSuccess(ChangeInfo result) { Gerrit.display(Dispatcher.toEditScreen( new PatchSet.Id(result.legacy_id(), 1), "project.config")); } @Override public void onFailure(Throwable caught) { b.setEnabled(true); super.onFailure(caught); } }); }
Source:
<code>public void checkinProjects(List<Project> projects) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Project project : projects) { <START> List<Project> result = queryService.queryByString(Project.class, "name:\"" + project.getName() + "\""); <END> if (result.size() == 0) { commit.addInsert(project); } else { commit.addUpdate(project); } } persistService.commit(commit); revokePersistenceAccess(); }</code><technical_language>query(QueryRequest) method</technical_language>

Target:
public void checkinProjects(List<Project> projects) { EKBCommit commit = getEKBCommit(); preparePersistenceAccess(); for (Project project : projects) { List<Project> result = queryService.query(Project.class, QueryRequest.query("name", project.getName())); if (result.size() == 0) { commit.addInsert(project); } else { commit.addUpdate(project); } } persistService.commit(commit); revokePersistenceAccess(); }
Source:
<code>public ExtensionJobList getExtensionJobs(String extensionName, String sortOrder, String doAsUser) { Comparator<ExtensionJobsBean> compareByJobName = new Comparator<ExtensionJobsBean>() { @Override public int compare(ExtensionJobsBean o1, ExtensionJobsBean o2) { return o1.getJobName().compareToIgnoreCase(o2.getJobName()); } }; Map<String, String> jobAndExtensionNames = new HashMap<>(); List<ExtensionJobsBean> extensionJobs = null; if (extensionName != null) { <START> extensionJobs = new ArrayList<>(ExtensionStore.getMetaStore().getJobsForAnExtension(extensionName)); <END> } else { extensionJobs = new ArrayList<>(ExtensionStore.getMetaStore().getAllExtensionJobs()); } sortOrder = (sortOrder == null) ? ASCENDING_SORT_ORDER : sortOrder; switch (sortOrder.toLowerCase()) { case DESCENDING_SORT_ORDER: Collections.sort(extensionJobs, Collections.reverseOrder(compareByJobName)); break; default: Collections.sort(extensionJobs, compareByJobName); } for (ExtensionJobsBean job : extensionJobs) { jobAndExtensionNames.put(job.getJobName(), job.getExtensionName()); } return new ExtensionJobList(extensionJobs.size(), jobAndExtensionNames); }</code><technical_language>if result set is 0 null</technical_language>

Target:
public ExtensionJobList getExtensionJobs(String extensionName, String sortOrder, String doAsUser) { Comparator<ExtensionJobsBean> compareByJobName = new Comparator<ExtensionJobsBean>() { @Override public int compare(ExtensionJobsBean o1, ExtensionJobsBean o2) { return o1.getJobName().compareToIgnoreCase(o2.getJobName()); } }; Map<String, String> jobAndExtensionNames = new HashMap<>(); List<ExtensionJobsBean> extensionJobs = null; if (extensionName != null) { extensionJobs = ExtensionStore.getMetaStore().getJobsForAnExtension(extensionName); } else { extensionJobs = ExtensionStore.getMetaStore().getAllExtensionJobs(); } sortOrder = (sortOrder == null) ? ASCENDING_SORT_ORDER : sortOrder; switch (sortOrder.toLowerCase()) { case DESCENDING_SORT_ORDER: Collections.sort(extensionJobs, Collections.reverseOrder(compareByJobName)); break; default: Collections.sort(extensionJobs, compareByJobName); } for (ExtensionJobsBean job : extensionJobs) { jobAndExtensionNames.put(job.getJobName(), job.getExtensionName()); } return new ExtensionJobList(extensionJobs.size(), jobAndExtensionNames); }
Source:
<code>private static void loadProvider() { try { Class<KieStoreServices> cls = (Class<KieStoreServices>) Class.forName( System.getProperty( "org.kie.store.services.class", "org.drools.persistence.jpa.KnowledgeStoreServiceImpl" ) ); setJPAKnowledgeServiceProvider( cls.newInstance() ); } catch ( Exception e ) { <START> throw new RuntimeException( "Provider org.drools.persistence.jpa.KnowledgeStoreServiceImpl could not be set.", <END> e ); } }</code><technical_language>exception message updated well, print actual class name (in case overridden property)</technical_language>

Target:
private static void loadProvider() { String className = System.getProperty( "org.kie.store.services.class", "org.drools.persistence.jpa.KnowledgeStoreServiceImpl" ); try { Class<KieStoreServices> cls = (Class<KieStoreServices>) Class.forName( className ); setJPAKnowledgeServiceProvider( cls.newInstance() ); } catch ( Exception e ) { throw new RuntimeException( "Provider " + className + " could not be set.", e ); } }
Source:
<code>public void toJSONString(JSONStringer stringer) throws JSONException { super.toJSONString(stringer); stringer.keySymbolValuePair(Members.LOOKUP_TYPE.name(), m_lookupType.toString()); stringer.keySymbolValuePair(Members.SORT_DIRECTION.name(), m_sortDirection.toString()); if (m_purpose != FOR_SCANNING_PERFORMANCE_OR_ORDERING) { stringer.keySymbolValuePair(Members.PURPOSE.name(), m_purpose); } stringer.keySymbolValuePair(Members.TARGET_INDEX_NAME.name(), m_targetIndexName); if (m_searchkeyExpressions.size() > 0) { stringer.key(Members.SEARCHKEY_EXPRESSIONS.name()).array(m_searchkeyExpressions); stringer.key(Members.COMPARE_NOTDISTINCT.name()).array(); for (Boolean ignoreNullCandidateValue : m_compareNotDistinct) { stringer.value(ignoreNullCandidateValue); } <START> stringer.endArray(); <END> } if (m_endExpression != null) { stringer.key(Members.END_EXPRESSION.name()); stringer.value(m_endExpression); } if (m_initialExpression != null) { stringer.key(Members.INITIAL_EXPRESSION.name()).value(m_initialExpression); } if (m_skip_null_predicate != null) { stringer.key(Members.SKIP_NULL_PREDICATE.name()).value(m_skip_null_predicate); } }</code><technical_language>a factored out one-liner</technical_language>

Target:
public void toJSONString(JSONStringer stringer) throws JSONException { super.toJSONString(stringer); stringer.keySymbolValuePair(Members.LOOKUP_TYPE.name(), m_lookupType.toString()); stringer.keySymbolValuePair(Members.SORT_DIRECTION.name(), m_sortDirection.toString()); if (m_purpose != FOR_SCANNING_PERFORMANCE_OR_ORDERING) { stringer.keySymbolValuePair(Members.PURPOSE.name(), m_purpose); } stringer.keySymbolValuePair(Members.TARGET_INDEX_NAME.name(), m_targetIndexName); if (m_searchkeyExpressions.size() > 0) { stringer.key(Members.SEARCHKEY_EXPRESSIONS.name()).array(m_searchkeyExpressions); booleanArrayToJSONString(stringer, Members.COMPARE_NOTDISTINCT.name(), m_compareNotDistinct); } if (m_endExpression != null) { stringer.key(Members.END_EXPRESSION.name()); stringer.value(m_endExpression); } if (m_initialExpression != null) { stringer.key(Members.INITIAL_EXPRESSION.name()).value(m_initialExpression); } if (m_skip_null_predicate != null) { stringer.key(Members.SKIP_NULL_PREDICATE.name()).value(m_skip_null_predicate); } }
Source:
<code>public LzoProtobufB64LineScheme(Class protoClass) { <START> super(protoClass); <END> }</code><technical_language>LOG.warn("$class is deprecated, $newclass");</technical_language>

Target:
public LzoProtobufB64LineScheme(Class protoClass) { super(protoClass); LOG.warn("LzoProtobufB64LineScheme is deprecated, please use LzoProtobufScheme"); }
Source:
<code>private static void readCardText(final Card card, final int cardSide) { <START> int qa; <END> String html; if (Sound.SOUNDS_QUESTION == cardSide) { html = card.q(true); qa = Sound.SOUNDS_QUESTION; } else if (Sound.SOUNDS_ANSWER == cardSide) { html = card.getPureAnswer(); qa = Sound.SOUNDS_ANSWER; } else { Timber.w("Unrecognised cardSide"); return; } long deckId = getDeckIdForCard(card); int ord = card.getOrd(); boolean isFirstText = true; for (LocalisedText textToRead : getTextsToRead(html)) { if (!textToRead.getText().isEmpty()) { ReadText.textToSpeech(textToRead.getText(), deckId, ord, qa, textToRead.getLocaleCode(), isFirstText ? TextToSpeech.QUEUE_FLUSH : TextToSpeech.QUEUE_ADD); isFirstText = false; } } }</code><technical_language>this variable more meaningful, I guess questionOrAnswer a variable determines is object a question answer</technical_language>

Target:
private static void readCardText(final Card card, final int cardSide) { final String cardSideContent; if (Sound.SOUNDS_QUESTION == cardSide) { cardSideContent = card.q(true); } else if (Sound.SOUNDS_ANSWER == cardSide) { cardSideContent = card.getPureAnswer(); } else { Timber.w("Unrecognised cardSide"); return; } ReadText.readCardSide(cardSide, cardSideContent, getDeckIdForCard(card), card.getOrd()); }
Source:
<code>public void readSpongeNbt(NBTTagCompound nbt) { <START> this.uuid = new UUID(nbt.getLong(NbtDataUtil.WORLD_UUID_MOST), nbt.getLong(NbtDataUtil.WORLD_UUID_LEAST)); <END> this.dimension = nbt.getInteger(NbtDataUtil.DIMENSION_ID); this.isMod = nbt.getBoolean(NbtDataUtil.IS_MOD); DimensionTypeRegistryModule.getInstance().getAll().stream().filter(type -> type.getId().equalsIgnoreCase(nbt.getString(NbtDataUtil.DIMENSION_TYPE))) .forEach(type -> this.dimensionType = type); this.trackedUniqueIdCount = 0; for (int i = 0; i < this.playerUniqueIdNbt.tagCount(); i++) { NBTTagCompound valueNbt = this.playerUniqueIdNbt.getCompoundTagAt(i); UUID uuid = new UUID(valueNbt.getLong(NbtDataUtil.WORLD_UUID_MOST), valueNbt.getLong(NbtDataUtil.WORLD_UUID_LEAST)); this.playerUniqueIdMap.put(this.trackedUniqueIdCount, uuid); this.trackedUniqueIdCount++; } }</code><technical_language>Is a special reason getUniqueId here</technical_language>

Target:
public void readSpongeNbt(NBTTagCompound nbt) { this.uuid = nbt.getUniqueId(NbtDataUtil.UUID); this.dimension = nbt.getInteger(NbtDataUtil.DIMENSION_ID); this.isMod = nbt.getBoolean(NbtDataUtil.IS_MOD); final String dimensionTypeId = nbt.getString(NbtDataUtil.DIMENSION_TYPE); this.dimensionType = DimensionTypeRegistryModule.getInstance().getById(dimensionTypeId) .orElseThrow(FunctionalUtil.invalidArgument("Could not find a DimensionType by id: " + dimensionTypeId)); this.trackedUniqueIdCount = 0; if (nbt.hasKey(NbtDataUtil.SPONGE_PLAYER_UUID_TABLE, NbtDataUtil.TAG_LIST)) { final NBTTagList playerIdList = nbt.getTagList(NbtDataUtil.SPONGE_PLAYER_UUID_TABLE, NbtDataUtil.TAG_COMPOUND); for (int i = 0; i < playerIdList.tagCount(); i++) { final NBTTagCompound playerId = playerIdList.getCompoundTagAt(i); final UUID playerUuid = playerId.getUniqueId(NbtDataUtil.UUID); this.playerUniqueIdMap.put(this.trackedUniqueIdCount++, playerUuid); } } }
Source:
<code>public void mapAndSend(Event[] events, OutputTransportCallback outputTransportCallback, OptionHolder optionHolder, TemplateBuilder payloadTemplateBuilder) throws ConnectionUnavailableException { if (events.length < 1) { return; } StringBuilder sb = new StringBuilder(); if (payloadTemplateBuilder != null) { if (prefixXml != null) { sb.append(prefixXml); } for (Event event : events) { sb.append(payloadTemplateBuilder.build(event)); } if (suffixXml != null) { sb.append(suffixXml); } if (xmlValidationEnabled) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setNamespaceAware(true); try { DocumentBuilder builder = factory.newDocumentBuilder(); builder.parse(new ByteArrayInputStream(sb.toString().getBytes())); } catch (ParserConfigurationException e) { log.error("Error occurred when trying to validate output XML event for well-formedness. " + "Dropping event: " + sb.toString()); return; } catch (SAXException e) { log.error("Parse error occurred when validating output XML event for well-formedness. " + "Reason: " + e.getMessage() + "Dropping event: " + sb.toString()); return; } catch (IOException e) { log.error("IO error occurred when validating output XML event for well-formedness. " + "Reason: " + e.getMessage() + "Dropping event: " + sb.toString()); return; } } } else { <START> for (Event event : events) { <END> sb.append(constructDefaultMapping(event)); } } outputTransportCallback.publish(sb.toString(), events[0]); }</code><technical_language>java8 forEach</technical_language>

Target:
public void mapAndSend(Event[] events, OutputTransportCallback outputTransportCallback, OptionHolder optionHolder, TemplateBuilder payloadTemplateBuilder) throws ConnectionUnavailableException { if (events.length < 1) { return; } StringBuilder sb = new StringBuilder(); if (payloadTemplateBuilder != null) { if (prefixXml != null) { sb.append(prefixXml); } for (Event event : events) { sb.append(payloadTemplateBuilder.build(event)); } if (suffixXml != null) { sb.append(suffixXml); } if (xmlValidationEnabled) { try { builder.parse(new ByteArrayInputStream(sb.toString().getBytes())); builder.reset(); } catch (SAXException e) { log.error("Parse error occurred when validating output XML event for well-formedness. " + "Reason: " + e.getMessage() + "Dropping event: " + sb.toString()); return; } catch (IOException e) { log.error("IO error occurred when validating output XML event for well-formedness. " + "Reason: " + e.getMessage() + "Dropping event: " + sb.toString()); return; } } } else { for (Event event : events) { sb.append(constructDefaultMapping(event)); } } outputTransportCallback.publish(sb.toString(), events[0]); }