auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void showJob(Job job) { name_.setText(job.name); progress_.setLabel(job.name); String status = JobConstants.stateDescription(job.state); <START> stop_.addClickHandler(new ClickHandler() <END> { @Override public void onClick(ClickEvent event) { eventBus_.fireEvent(new JobExecuteActionEvent(job.id, JobConstants.ACTION_STOP)); } }); if (job.completed > 0) { progress_.setVisible(false); status += " " + StringUtil.friendlyDateTime(new Date(job.completed * 1000)); elapsed_.setText(StringUtil.conciseElaspedTime(job.completed - job.started)); status_.setVisible(true); stop_.setVisible(false); } else if (job.max > 0) { progress_.setVisible(true); progress_.setProgress(job.progress, job.max); status_.setVisible(false); stop_.setVisible(true); } else { progress_.setVisible(false); status_.setVisible(true); stop_.setVisible(true); if (!StringUtil.isNullOrEmpty(job.status)) { status = job.status; } } status_.setText(status); jobProgress_ = new LocalJobProgress(job); complete_ = job.completed > 0; }</code><technical_language>Minor style thing: new code lambda syntax instead of anonymous class, so: stop_.addClickHandler(clickEvent -> eventBus_.fireEvent(new JobExecuteActionEvent(job.id, JobConstants.ACTION_STOP));</technical_language>

Target:
public void showJob(Job job) { name_.setText(job.name); progress_.setLabel(job.name); String status = JobConstants.stateDescription(job.state); stop_.addClickHandler(clickEvent -> eventBus_.fireEvent(new JobExecuteActionEvent(job.id, JobConstants.ACTION_STOP))); if (job.completed > 0) { progress_.setVisible(false); status += " " + StringUtil.friendlyDateTime(new Date(job.completed * 1000)); elapsed_.setText(StringUtil.conciseElaspedTime(job.completed - job.started)); status_.setVisible(true); } else if (job.max > 0) { progress_.setVisible(true); progress_.setProgress(job.progress, job.max); status_.setVisible(false); } else { progress_.setVisible(false); status_.setVisible(true); if (!StringUtil.isNullOrEmpty(job.status)) { status = job.status; } } if (job.completed == 0) stop_.setVisible(JsArrayUtil.jsArrayStringContains(job.actions, JobConstants.ACTION_STOP)); else stop_.setVisible(false); status_.setText(status); jobProgress_ = new LocalJobProgress(job); complete_ = job.completed > 0; }
Source:
<code>public void unload() { super.unload(); ExtensionSpider spider = Control.getSingleton().getExtensionLoader().getExtension(ExtensionSpider.class); <START> if (spider != null) { <END> spider.removeCustomParseFilter(graphQlParseFilter); spider.removeCustomParser(graphQlSpider); LOG.debug("Removed GraphQl spider."); } }</code><technical_language>This needs tweaked version check</technical_language>

Target:
public void unload() { super.unload(); if (!"2.9.0".equals(Constant.PROGRAM_VERSION)) { ExtensionSpider spider = Control.getSingleton().getExtensionLoader().getExtension(ExtensionSpider.class); if (spider != null) { spider.removeCustomParseFilter(graphQlParseFilter); spider.removeCustomParser(graphQlSpider); LOG.debug("Removed GraphQl spider."); } } }
Source:
<code>private void addAffinityLabels() { List<Label> affinityLabels = getParameters().getAffinityLabels(); if (affinityLabels == null) { <START> affinityLabels = Collections.emptyList(); <END> } List<Guid> labelIds = affinityLabels.stream() .map(Label::getId) .collect(Collectors.toList()); labelDao.addVmToLabels(getVmId(), labelIds); }</code><technical_language>This line changed a return statement. effect, DB call avoided. Similarly UpdateVmCommand.java</technical_language>

Target:
private void addAffinityLabels() { List<Label> affinityLabels = getParameters().getAffinityLabels(); if (affinityLabels == null) { return; } List<Guid> labelIds = affinityLabels.stream() .map(Label::getId) .collect(Collectors.toList()); labelDao.addVmToLabels(getVmId(), labelIds); }
Source:
<code>public ActionResult execute() { String recoveryEmailAddress = getNonNullRequestParamValue(Const.ParamsNames.SESSION_LINKS_RECOVERY_EMAIL); boolean hasStudentsWithRecoveryEmail = !logic.getAllStudentForEmail(recoveryEmailAddress).isEmpty(); if (hasStudentsWithRecoveryEmail) { EmailWrapper email = new EmailGenerator().generateSessionLinksRecoveryEmail(recoveryEmailAddress); emailSender.sendEmail(email); } <START> <END> return new JsonResult(new SessionLinksRecoveryResponseData(hasStudentsWithRecoveryEmail, "The recovery links for your feedback sessions have been sent to the " + "specified email address: " + recoveryEmailAddress)); }</code><technical_language>uhmmm if is student, gonna alert in frontend is user? if user put a wrong email address telll email didn't</technical_language>

Target:
public ActionResult execute() { String recoveryEmailAddress = getNonNullRequestParamValue(Const.ParamsNames.SESSION_LINKS_RECOVERY_EMAIL); if (!StringHelper.isMatching(recoveryEmailAddress, REGEX_EMAIL)) { return new JsonResult("Invalid email address: " + recoveryEmailAddress, HttpStatusCodes.STATUS_CODE_BAD_REQUEST); } String userCaptchaResponse = getRequestParamValue(Const.ParamsNames.USER_CAPTCHA_RESPONSE); if (!new RecaptchaVerifier().isVerificationSuccessful(userCaptchaResponse)) { return new JsonResult(new SessionLinksRecoveryResponseData(false, "Something went wrong with " + "the reCAPTCHA verification. Please try again.")); } EmailWrapper email = emailGenerator.generateSessionLinksRecoveryEmailForStudent(recoveryEmailAddress); EmailSendingStatus status = emailSender.sendEmail(email); if (status.isSuccess()) { return new JsonResult(new SessionLinksRecoveryResponseData(true, "The recovery links for your feedback sessions have been sent to the " + "specified email address: " + recoveryEmailAddress)); } else { return new JsonResult(new SessionLinksRecoveryResponseData(false, "An error occurred. " + "The email could not be sent.")); } }
Source:
<code>public void execute(LauncherDiscoveryRequest discoveryRequest, TestExecutionListener... listeners) { Preconditions.notNull(discoveryRequest, "LauncherDiscoveryRequest must not be null"); Preconditions.notNull(listeners, "TestExecutionListener array must not be null"); <START> this.listenerRegistry.registerListeners(listeners); <END> execute(discoverRoot(discoveryRequest, "execution"), discoveryRequest.getConfigurationParameters()); this.listenerRegistry.removeListeners(listeners); }</code><technical_language>state execute() method run in parallel threads for Launcher instance, a bit uneasy _mutate_ listener registry in this manner. I I prefer introduce a composite wrapper in cases leave original listener registry untouched. @junit-team/junit-lambda, thoughts</technical_language>

Target:
public void execute(LauncherDiscoveryRequest discoveryRequest, TestExecutionListener... listeners) { Preconditions.notNull(discoveryRequest, "LauncherDiscoveryRequest must not be null"); Preconditions.notNull(listeners, "TestExecutionListener array must not be null"); Preconditions.containsNoNullElements(listeners, "individual listeners must not be null"); execute(discoverRoot(discoveryRequest, "execution"), discoveryRequest.getConfigurationParameters(), listeners); }
Source:
<code>public void renameTable(JdbcTableHandle handle, SchemaTableName newTable) { <START> renameTable(null, handle.getSchemaTableName(), newTable); <END> }</code><technical_language>passing null handle.getCatalogName()</technical_language>

Target:
public void renameTable(JdbcTableHandle handle, SchemaTableName newTable) { renameTable(handle.getCatalogName(), handle.getSchemaTableName(), newTable); }
Source:
<code>public void store(String tenantId, List<Property<?>> properties) throws CacheException { if (cacheContainer != null) { propertyCache.startBatch(); } for (Property<?> property: properties) { if (log.isLoggable(Level.FINEST)) { log.finest("Store property [id=" + property.getId() + "]: " + property); } propertyCache.put(property.getId(), property); } if (cacheContainer != null) { propertyCache.endBatch(true); <START> } <END> }</code><technical_language>minor thing, block this PR all: properties.forEach(this::store) instead of 7 lines</technical_language>

Target:
public void store(String tenantId, List<Property<?>> properties) throws CacheException { if (cacheContainer != null) { propertyCache.startBatch(); } for (Property<?> property: properties) { store(tenantId, property); } if (cacheContainer != null) { propertyCache.endBatch(true); } }
Source:
<code>public void handle_addsTheHashAndThenSavesInTheDatabase() throws Exception { LoadHandler loadHandler = new LoadHandler(entriesUpdateDAO, logStream); String payload = "{\"key1\":\"value1\"}\n{\"key2\":\"value2\"}"; String expectedHash1 = Digest.shasum("{\"key1\":\"value1\"}"); String expectedHash2 = Digest.shasum("{\"key2\":\"value2\"}"); final String entry1 = "{\"entry\":{\"key1\":\"value1\"},\"hash\":\"" + expectedHash1 + "\"}"; final byte[] entry1Bytes = canonicalise(entry1); final String entry2 = "{\"entry\":{\"key2\":\"value2\"},\"hash\":\"" + expectedHash2 + "\"}"; final byte[] entry2Bytes = canonicalise(entry2); loadHandler.handle(payload); ArgumentCaptor<List> captor = ArgumentCaptor.forClass(List.class); verify(entriesUpdateDAO, times(1)).add(captor.capture()); <START> final List<byte[]> payloadArray = captor.getValue(); <END> assertThat(payloadArray.size(), equalTo(2)); assertThat(payloadArray.get(0), equalTo(entry1Bytes)); assertThat(payloadArray.get(1), equalTo(entry2Bytes)); verify(logStream, times(1)).notifyOfNewEntries(); }</code><technical_language>avoid unchecked assignment warnings [@Captor annotation](<LINK_0></technical_language>

Target:
public void handle_addsTheHashAndThenSavesInTheDatabase() throws Exception { LoadHandler loadHandler = new LoadHandler(entriesUpdateDAO, logStream); String payload = "{\"key1\":\"value1\"}\n{\"key2\":\"value2\"}"; String expectedHash1 = Digest.shasum("{\"key1\":\"value1\"}"); String expectedHash2 = Digest.shasum("{\"key2\":\"value2\"}"); final String entry1 = "{\"entry\":{\"key1\":\"value1\"},\"hash\":\"" + expectedHash1 + "\"}"; final byte[] entry1Bytes = canonicalise(entry1); final String entry2 = "{\"entry\":{\"key2\":\"value2\"},\"hash\":\"" + expectedHash2 + "\"}"; final byte[] entry2Bytes = canonicalise(entry2); loadHandler.handle(payload); verify(entriesUpdateDAO, times(1)).add(entriesCaptor.capture()); final List<byte[]> payloadArray = entriesCaptor.getValue(); assertThat(payloadArray.size(), equalTo(2)); assertThat(payloadArray.get(0), equalTo(entry1Bytes)); assertThat(payloadArray.get(1), equalTo(entry2Bytes)); verify(logStream, times(1)).notifyOfNewEntries(); }
Source:
<code>protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return super.appendAttributes(tsb) .append("srcHost", getSrcHost()) .append("dstVdsId", getDstVdsId()) .append("dstHost", getDstHost()) .append("migrationMethod", getMigrationMethod()) .append("tunnelMigration", isTunnelMigration()) .append("migrationDowntime", getMigrationDowntime()) <START> .append("autoConverge", getAutoConverge()) <END> .append("migrateCompressed", getMigrateCompressed()) .append("consoleAddress", getConsoleAddress()) .append("maxBandwidth", getMaxBandwidth()) .append("enableGuestEvents", isEnableGuestEvents()) .append("convergenceSchedule", getConvergenceSchedule()); }</code><technical_language>need add</technical_language>

Target:
protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return super.appendAttributes(tsb) .append("srcHost", getSrcHost()) .append("dstVdsId", getDstVdsId()) .append("dstHost", getDstHost()) .append("migrationMethod", getMigrationMethod()) .append("tunnelMigration", isTunnelMigration()) .append("migrationDowntime", getMigrationDowntime()) .append("autoConverge", getAutoConverge()) .append("migrateCompressed", getMigrateCompressed()) .append("consoleAddress", getConsoleAddress()) .append("maxBandwidth", getMaxBandwidth()) .append("enableGuestEvents", isEnableGuestEvents()) .append("maxIncomingMigrations", getMaxIncomingMigrations()) .append("maxOutgoingMigrations", getMaxOutgoingMigrations()) .append("convergenceSchedule", getConvergenceSchedule()); }
Source:
<code>boolean conditionsAreEqual(Rule that) { if (!Objects.equals(this.fileTypeCondition, that.getFileMIMETypeCondition())) { return false; } this.fileSizeConditions.sort(null); <START> that.sortFileSizeConditions(); <END> if (!this.fileSizeConditions.equals(that.getFileSizeConditions())) { return false; } this.artifactConditions.sort(null); that.sortArtifactConditions(); return this.artifactConditions.equals(that.getArtifactConditions()); }</code><technical_language>a tiny bit more readable call this.sortFileSizeConditions well. Ditto line 359</technical_language>

Target:
boolean conditionsAreEqual(Rule that) { if (!Objects.equals(this.fileTypeCondition, that.getFileMIMETypeCondition())) { return false; } this.sortFileSizeConditions(); that.sortFileSizeConditions(); if (!this.fileSizeConditions.equals(that.getFileSizeConditions())) { return false; } this.sortArtifactConditions(); that.sortArtifactConditions(); return this.artifactConditions.equals(that.getArtifactConditions()); }
Source:
<code>public Set<ThingTypeUID> getSupportedThingTypes() { <START> Set<ThingTypeUID> supportedThingTypes = new HashSet<>(); <END> supportedThingTypes.add(BluetoothBindingConstants.THING_TYPE_BEACON); for (BluetoothDiscoveryParticipant participant : participants) { supportedThingTypes.addAll(participant.getSupportedThingTypeUIDs()); } return supportedThingTypes; }</code><technical_language>I _think_ sense construct this set a BDP is added/removed ina a field, IIRC this method called frequently</technical_language>

Target:
public Set<ThingTypeUID> getSupportedThingTypes() { return supportedThingTypes; }
Source:
<code>public static boolean isPasswordEncrypted(String carbonHome) throws Exception { boolean foundEncryption = false; try { FileInputStream file = new FileInputStream(new File(carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "datasources" + File.separator + "master-datasources.xml")); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(file); XPath xPath = XPathFactory.newInstance().newXPath(); <START> String expression = " END> "[@type='RDBMS']/configuration/password"; NodeList nodeList = ( NodeList) xPath.compile(expression).evaluate(xmlDocument, XPathConstants.NODESET); for (int i = 0; i < nodeList.getLength(); i++) { Element eElement = (Element) nodeList.item(i); if (eElement.getAttribute("svns:secretAlias").equals("Datasources.WSO2_CARBON_DB.Configuration.Password") && nodeList.item(i).getFirstChild().getNodeValue().equals("password")) { foundEncryption = true; break; } } } catch (Exception e) { handleException("Error when passing the master-datasources.xml file to create xmlDocument", e); } return foundEncryption; }</code><technical_language>Move this constant class</technical_language>

Target:
public static boolean isPasswordEncrypted(String carbonHome) throws Exception { boolean foundEncryption = false; try { FileInputStream file = new FileInputStream(new File(carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "datasources" + File.separator + "master-datasources.xml")); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(file); XPath xPath = XPathFactory.newInstance().newXPath(); NodeList nodeList = (NodeList) xPath.compile (ASIntegrationConstants.ENCRYPTED_PASSWD_URL).evaluate(xmlDocument, XPathConstants.NODESET); for (int i = 0; i < nodeList.getLength(); i++) { Element eElement = (Element) nodeList.item(i); if (eElement.getAttribute(ASIntegrationConstants.PASSWORD_PROPERTY_SECRET_ALIAS_KEY). equals(ASIntegrationConstants.PASSWORD_PROPERTY_SECRET_ALIAS_VALUE) && nodeList.item(i).getFirstChild().getNodeValue().equals("password")) { foundEncryption = true; break; } } } catch (Exception e) { log.error("Error when passing the master-datasources.xml file to create xmlDocument", e); throw new PasswordEncryptionIntegrationTestException("Error when passing the master-datasources.xml file to create xmlDocument", e); } return foundEncryption; }
Source:
<code>private void fillDependencies(@Nonnull InputJackLibrary library, @Nonnull VPath dependencyVPath, @Nonnull Dependency dependency) throws CannotReadException, FileTypeDoesNotExistException { InputVFile dependenciesVFile = library.getFile(FileType.DEPENDENCIES, dependencyVPath); InputStreamReader fileReader = null; try { fileReader = new InputStreamReader(dependenciesVFile.getInputStream()); dependency.read(fileReader); } catch (NoSuchElementException | WrongPermissionException e) { throw new CannotReadException(dependenciesVFile, e); } <START> catch (IOException e) { throw new CannotReadException(dependenciesVFile, e); } finally <END> { if (fileReader != null) { try { fileReader.close(); } catch (IOException e) { } } } }</code><technical_language>Multicatch</technical_language>

Target:
private void fillDependencies(@Nonnull InputJackLibrary library, @Nonnull VPath dependencyVPath, @Nonnull Dependency dependency) throws CannotReadException, FileTypeDoesNotExistException { InputVFile dependenciesVFile = library.getFile(FileType.DEPENDENCIES, dependencyVPath); InputStreamReader fileReader = null; try { fileReader = new InputStreamReader(dependenciesVFile.getInputStream()); dependency.read(fileReader); } catch (NoSuchElementException | WrongPermissionException | IOException e) { throw new CannotReadException(dependenciesVFile, e); } finally { if (fileReader != null) { try { fileReader.close(); } catch (IOException e) { } } } }
Source:
<code>public void fetchCartInStoreById() { <START> StoreFixtures.withStore(client(), store -> { <END> final CartDraft cartDraft = CartDraft.of(DefaultCurrencyUnits.EUR).withStore(store.toResourceIdentifier()); final CartCreateCommand cartCreateCommand = CartCreateCommand.of(cartDraft); final Cart cart = client().executeBlocking(cartCreateCommand); final Cart cartInStore = client().executeBlocking(CartInStoreByIdGet.of(store.getKey(), cart.getId())); assertThat(cartInStore).isNotNull(); assertThat(cartInStore.getId()).isEqualTo(cart.getId()); client().executeBlocking(CartDeleteCommand.of(cart)); }); }</code><technical_language>nice a static import - more consistent other code</technical_language>

Target:
public void fetchCartInStoreById() { withStore(client(), store -> { final CartDraft cartDraft = CartDraft.of(DefaultCurrencyUnits.EUR).withStore(store.toResourceIdentifier()); final CartCreateCommand cartCreateCommand = CartCreateCommand.of(cartDraft); final Cart cart = client().executeBlocking(cartCreateCommand); final Cart cartInStore = client().executeBlocking(CartInStoreByIdGet.of(store.getKey(), cart.getId())); assertThat(cartInStore).isNotNull(); assertThat(cartInStore.getId()).isEqualTo(cart.getId()); client().executeBlocking(CartDeleteCommand.of(cart)); }); }
Source:
<code>public void close() { if (dispatcher == null) { <START> return; <END> } try { dispatcher.unsubscribe(subject); } catch (IllegalStateException e) { LOGGER.warn("NATS transport could not unsubscribe from subscription: " + e.getMessage()); } dispatcher = null; super.close(); }</code><technical_language>Need call super.close() closedCallback is called. java @Override public void close() { if (dispatcher != null) { try { dispatcher.unsubscribe(subject); } catch (IllegalStateException e) { LOGGER.warn("NATS transport unsubscribe subscription: " + e.getMessage()); } dispatcher = null; } super.close(); }</technical_language>

Target:
public void close() { if (dispatcher != null) { dispatcher.unsubscribe(subject); dispatcher = null; } super.close(); }
Source:
<code><START> CheckpointBarrier parseCheckpointBarrierOrNull(Buffer buffer) throws IOException { <END> if (buffer.isBuffer()) { return null; } AbstractEvent event = EventSerializer.fromBuffer(buffer, getClass().getClassLoader()); buffer.setReaderIndex(0); return event instanceof CheckpointBarrier ? (CheckpointBarrier) event : null; }</code><technical_language>Unnecessary change. protected give subclasses access this method. currently in package is coincidental</technical_language>

Target:
protected CheckpointBarrier parseCheckpointBarrierOrNull(Buffer buffer) throws IOException { if (buffer.isBuffer()) { return null; } AbstractEvent event = EventSerializer.fromBuffer(buffer, getClass().getClassLoader()); buffer.setReaderIndex(0); return event.getClass() == CheckpointBarrier.class ? (CheckpointBarrier) event : null; }
Source:
<code>private static boolean isBlack(BufferedImage var) throws Exception { double[] varArr = new double[var.getWidth()*var.getHeight()*3]; for(int i = 0; i < var.getHeight(); i++) { <START> for(int j = 0; j < var.getWidth(); j++) { <END> varArr[i*var.getWidth() + j + 0] = new Color(var.getRGB(j, i)).getRed(); varArr[i*var.getWidth() + j + 1] = new Color(var.getRGB(j, i)).getGreen(); varArr[i*var.getWidth() + j + 2] = new Color(var.getRGB(j, i)).getBlue(); } } for(int i=0;i!=varArr.length;i++){ if(varArr[i] != 0) return false; } return true; }</code><technical_language>loop removed this reduced to: for(int j = 0; j < var.getWidth(); j++) { if((var.getRGB(j,i) & 0x00FFFFFF) != 0) { return false; } }</technical_language>

Target:
private static boolean isBlack(BufferedImage var) { double[] varArr = new double[var.getWidth()*var.getHeight()*3]; for(int i = 0; i < var.getHeight(); i++) { for(int j = 0; j < var.getWidth(); j++) { varArr[i*var.getWidth() + j + 0] = new Color(var.getRGB(j, i)).getRed(); varArr[i*var.getWidth() + j + 1] = new Color(var.getRGB(j, i)).getGreen(); varArr[i*var.getWidth() + j + 2] = new Color(var.getRGB(j, i)).getBlue(); } } for(int i=0;i!=varArr.length;i++){ if(varArr[i] != 0) return false; } return true; }
Source:
<code>private void checkReplTxnForTest(Long startTxnId, Long endTxnId, String replPolicy, List<Long> targetTxnId) throws Exception { int numReplTxns = TxnDbUtil.countQueryAgent(conf, "select count(*) from REPL_TXN_MAP where " + <START> " RTM_SRC_TXN_ID >= " + startTxnId + "and RTM_SRC_TXN_ID <= " + endTxnId + <END> " and RTM_REPL_POLICY = \'" + replPolicy + "\'"); assertEquals(numReplTxns, targetTxnId.size()); String[] output = TxnDbUtil.queryToString(conf, "select RTM_TARGET_TXN_ID from REPL_TXN_MAP where " + " RTM_SRC_TXN_ID >= " + startTxnId + "and RTM_SRC_TXN_ID <= " + endTxnId + " and RTM_REPL_POLICY = \'" + replPolicy + "\'").split("\n"); for (int idx = 1; idx < output.length; idx++) { long txnId = Long.parseLong(output[idx].trim()); assertEquals(txnId, targetTxnId.get(idx-1).longValue()); } }</code><technical_language>Instead of 2 queries, compare size of "output" for count</technical_language>

Target:
private void checkReplTxnForTest(Long startTxnId, Long endTxnId, String replPolicy, List<Long> targetTxnId) throws Exception { String[] output = TxnDbUtil.queryToString(conf, "select RTM_TARGET_TXN_ID from REPL_TXN_MAP where " + " RTM_SRC_TXN_ID >= " + startTxnId + "and RTM_SRC_TXN_ID <= " + endTxnId + " and RTM_REPL_POLICY = \'" + replPolicy + "\'").split("\n"); assertEquals(output.length - 1, targetTxnId.size()); for (int idx = 1; idx < output.length; idx++) { long txnId = Long.parseLong(output[idx].trim()); assertEquals(txnId, targetTxnId.get(idx-1).longValue()); } }
Source:
<code>FileTailerState getState() { <START> FileTailerState finalState = events.get(0).getState(); <END> for (FileTailerEvent event : events) { FileTailerState tmpState = event.getState(); if (tmpState.getLastModifyTime() >= finalState.getLastModifyTime() && tmpState.getPosition() > finalState.getPosition()) { finalState = tmpState; } } return finalState; }</code><technical_language>If events is empty, exception thrown. Is expected caller catch it</technical_language>

Target:
FileTailerState getState() { if (events.isEmpty()) { return null; } FileTailerState finalState = events.get(0).getState(); for (FileTailerEvent event : events) { FileTailerState tmpState = event.getState(); if (tmpState.getLastModifyTime() > finalState.getLastModifyTime() || tmpState.getLastModifyTime() == finalState.getLastModifyTime() && tmpState.getPosition() > finalState.getPosition()) { finalState = tmpState; } } return finalState; }
Source:
<code>public void Serialize(File outputFile) { try { JAXBContext context = JAXBContext.newInstance(ScenarioTemplate.class); JAXBElement<ScenarioTemplate> templateElement = new JAXBElement<>(new QName(ROOT_XML_ELEMENT_NAME), ScenarioTemplate.class, this); Marshaller m = context.createMarshaller(); <START> m.setProperty("jaxb.formatted.output", true); <END> m.marshal(templateElement, outputFile); } catch(Exception e) { MekHQ.getLogger().error(ScenarioTemplate.class, "Serialize", e.getMessage()); } }</code><technical_language>constant also</technical_language>

Target:
public void Serialize(File outputFile) { try { JAXBContext context = JAXBContext.newInstance(ScenarioTemplate.class); JAXBElement<ScenarioTemplate> templateElement = new JAXBElement<>(new QName(ROOT_XML_ELEMENT_NAME), ScenarioTemplate.class, this); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(templateElement, outputFile); } catch(Exception e) { MekHQ.getLogger().error(ScenarioTemplate.class, "Serialize", e.getMessage()); } }
Source:
<code><START> JobRecoveryTypeException(final String expectedType, final String actualType) { <END> super(buildMessage(expectedType, actualType)); }</code><technical_language>This public</technical_language>

Target:
public JobRecoveryTypeException(final String expectedType, final String actualType) { super(buildMessage(expectedType, actualType)); }
Source:
<code><START> public ProtocolVersion protocolVersion() { <END> return protocolVersion; }</code><technical_language>change this signature. add a separate method</technical_language>

Target:
public String protocolVersion() { return protocolVersion.toString(); }
Source:
<code>public ThreadedHistoryTreeBackendTest(Boolean reOpen) { <START> super(reOpen); <END> }</code><technical_language>notion of reopening apply threaded backend. re-open non-threaded backend, future insertions. tempted "super(false)". run tests (it anyway)</technical_language>

Target:
public ThreadedHistoryTreeBackendTest(Boolean reOpen) { super(false); }
Source:
<code>public void run() { long lastRpcTs = 0; while (!Thread.interrupted()) { try { synchronized (refreshMasters) { refreshMasters.wait(periodicRefreshMs); } long currentTs = EnvironmentEdgeManager.currentTime(); if (lastRpcTs != 0 && currentTs - lastRpcTs <= timeBetweenRefreshesMs) { continue; } lastRpcTs = currentTs; LOG.debug("Attempting to refresh master address end points."); Set<ServerName> newMasters = new HashSet<>(registry.getMasters().get()); registry.populateMasterStubs(newMasters); LOG.debug("Finished refreshing master end points. {}", newMasters); } catch (InterruptedException e) { LOG.debug("Interrupted during wait, aborting refresh-masters-thread.", e); <START> break; <END> } catch (ExecutionException | IOException e) { LOG.debug("Error populating latest list of masters.", e); } } }</code><technical_language>aborting refresh breaking out of loop basically, done refreshing master stubs. log this ERROR</technical_language>

Target:
public void run() { long lastRpcTs = 0; while (!Thread.interrupted()) { try { synchronized (refreshMasters) { refreshMasters.wait(periodicRefreshMs); } long currentTs = EnvironmentEdgeManager.currentTime(); if (lastRpcTs != 0 && currentTs - lastRpcTs <= timeBetweenRefreshesMs) { continue; } lastRpcTs = currentTs; LOG.debug("Attempting to refresh master address end points."); Set<ServerName> newMasters = new HashSet<>(registry.getMasters().get()); registry.populateMasterStubs(newMasters); LOG.debug("Finished refreshing master end points. {}", newMasters); } catch (InterruptedException e) { LOG.debug("Interrupted during wait, aborting refresh-masters-thread.", e); break; } catch (ExecutionException | IOException e) { LOG.debug("Error populating latest list of masters.", e); } } LOG.info("Master end point refresher loop exited."); }
Source:
<code>private boolean updatePostObject() { if (mEditorFragment == null) { AppLog.e(AppLog.T.POSTS, "Fragment not initialized"); return false; } try { UpdateResult updateResult = mViewModel .updatePostObject(this, mShowAztecEditor, mEditPostRepository, (String) mEditorFragment.getTitle(), oldContent -> { try { return (String) mEditorFragment.getContent(oldContent); } catch (EditorFragmentNotAddedException e) { <START> return null; <END> } }); return updateResult instanceof UpdateResult.Success; } catch (EditorFragmentNotAddedException e) { AppLog.e(T.EDITOR, "Impossible to save the post, we weren't able to update it."); return false; } }</code><technical_language>want consider logging log trackable. Wdyt</technical_language>

Target:
private boolean updatePostObject() { if (mEditorFragment == null) { AppLog.e(AppLog.T.POSTS, "Fragment not initialized"); return false; } UpdateResult updateResult = mViewModel .updatePostObject(this, mShowAztecEditor, mEditPostRepository, oldContent -> { try { String title = (String) mEditorFragment.getTitle(); String content = (String) mEditorFragment.getContent(oldContent); return new PostFields(title, content); } catch (EditorFragmentNotAddedException e) { AppLog.e(T.EDITOR, "Impossible to save the post, we weren't able to update it."); return new UpdateFromEditor.Failed(e); } }); return updateResult instanceof UpdateResult.Success; }
Source:
<code>public Map<Integer,Error> commit() { Map<Integer,Error> results=new HashMap<>(); if(!idsInBatch.isEmpty()) { BulkWriteResult writeResult; <START> LOGGER.debug("attempToUpdate={}",idsInBatch.size()); <END> try { if(writeConcern==null) { writeResult=bwo.execute(); } else { writeResult=bwo.execute(writeConcern); } LOGGER.debug("writeResult={}",writeResult); if(idsInBatch.size()==writeResult.getMatchedCount()) { LOGGER.debug("Successful update"); } else { LOGGER.debug("notUpdated={}",idsInBatch.size()-writeResult.getMatchedCount()); findConcurrentModifications(results); } } catch (BulkWriteException e) { List<BulkWriteError> writeErrors=e.getWriteErrors(); if(writeErrors!=null) { for(BulkWriteError we:writeErrors) { if (we.getCode() == 11000 || we.getCode() == 11001) { results.put(we.getIndex(), Error.get("update", MongoCrudConstants.ERR_DUPLICATE, we.getMessage())); } else { results.put(we.getIndex(), Error.get("update", MongoCrudConstants.ERR_SAVE_ERROR, we.getMessage())); } } } findConcurrentModifications(results); } } reset(); return results; }</code><technical_language>Typo: attemp_t_ToUpdate</technical_language>

Target:
public Map<Integer,Error> commit() { Map<Integer,Error> results=new HashMap<>(); if(!idsInBatch.isEmpty()) { BulkWriteResult writeResult; LOGGER.debug("attemptToUpdate={}",idsInBatch.size()); try { if(writeConcern==null) { writeResult=bwo.execute(); } else { writeResult=bwo.execute(writeConcern); } LOGGER.debug("writeResult={}",writeResult); if(idsInBatch.size()==writeResult.getMatchedCount()) { LOGGER.debug("Successful update"); } else { LOGGER.debug("notUpdated={}",idsInBatch.size()-writeResult.getMatchedCount()); findConcurrentModifications(results); } } catch (BulkWriteException e) { List<BulkWriteError> writeErrors=e.getWriteErrors(); if(writeErrors!=null) { for(BulkWriteError we:writeErrors) { if (MongoCrudConstants.isDuplicate(we.getCode())) { results.put(we.getIndex(), Error.get("update", MongoCrudConstants.ERR_DUPLICATE, we.getMessage())); } else { results.put(we.getIndex(), Error.get("update", MongoCrudConstants.ERR_SAVE_ERROR, we.getMessage())); } } } findConcurrentModifications(results); } } reset(); return results; }
Source:
<code>public void seek(long position) throws IOException { <START> if (position >= 0 && position < count) { <END> pos = position; } }</code><technical_language>1. position able equal count means end of stream. current logic able seek end. 2. throw exception if position is invalid, for example negative case</technical_language>

Target:
public void seek(long position) throws IOException { if (pos < 0) { throw new IOException("Negative seek offset"); } else if (position >= 0 && position < count) { pos = position; } else { pos = count; } }
Source:
<code>public boolean removeAcl(OzoneObj obj, OzoneAcl acl) throws IOException { Map<String, String> auditMap = obj.toAuditMap(); <START> auditMap.put(OzoneConsts.ACLS, acl.toString()); <END> boolean auditSuccess = true; try{ if(isAclEnabled) { checkAcls(obj.getResourceType(), obj.getStoreType(), ACLType.WRITE_ACL, obj.getVolumeName(), obj.getBucketName(), obj.getKeyName()); } switch (obj.getResourceType()) { case VOLUME: return volumeManager.removeAcl(obj, acl); case BUCKET: return bucketManager.removeAcl(obj, acl); case KEY: return keyManager.removeAcl(obj, acl); case PREFIX: return prefixManager.removeAcl(obj, acl); default: throw new OMException("Unexpected resource type: " + obj.getResourceType(), INVALID_REQUEST); } } catch(Exception ex) { auditSuccess = false; AUDIT.logWriteFailure( buildAuditMessageForFailure(OMAction.REMOVE_ACL, auditMap, ex)); throw ex; } finally { if(auditSuccess){ AUDIT.logWriteSuccess( buildAuditMessageForSuccess(OMAction.REMOVE_ACL, auditMap)); } } }</code><technical_language>move this audit log common method. this is common code for ACL requests. auditAcl(OzoneObj ozoneObj, OzoneAcl ozoneAcl, OMAction omAction, Exception exception)</technical_language>

Target:
public boolean removeAcl(OzoneObj obj, OzoneAcl acl) throws IOException { boolean auditSuccess = true; try{ if(isAclEnabled) { checkAcls(obj.getResourceType(), obj.getStoreType(), ACLType.WRITE_ACL, obj.getVolumeName(), obj.getBucketName(), obj.getKeyName()); } switch (obj.getResourceType()) { case VOLUME: return volumeManager.removeAcl(obj, acl); case BUCKET: return bucketManager.removeAcl(obj, acl); case KEY: return keyManager.removeAcl(obj, acl); case PREFIX: return prefixManager.removeAcl(obj, acl); default: throw new OMException("Unexpected resource type: " + obj.getResourceType(), INVALID_REQUEST); } } catch(Exception ex) { auditSuccess = false; auditAcl(obj, Arrays.asList(acl), OMAction.REMOVE_ACL, ex); throw ex; } finally { if(auditSuccess){ auditAcl(obj, Arrays.asList(acl), OMAction.REMOVE_ACL, null); } } }
Source:
<code>public static <T> T service(final T instance, @SuppressWarnings("rawtypes") final Map<String,ProcessFunction<T,? extends TBase>> processorView) { final Method isOnewayMethod; try { <START> isOnewayMethod = ProcessFunction.class.getDeclaredMethod("isOneway"); <END> } catch (NoSuchMethodException e) { throw new RuntimeException("Could not access isOneway method", e); } catch (SecurityException e) { throw new RuntimeException("Could not access isOneway method", e); } isOnewayMethod.setAccessible(true); final Set<String> onewayMethods = new HashSet<String>(); for (@SuppressWarnings("rawtypes") Entry<String,ProcessFunction<T,? extends TBase>> entry : processorView.entrySet()) { try { if ((Boolean) isOnewayMethod.invoke(entry.getValue())) { onewayMethods.add(entry.getKey()); } } catch (Exception e) { throw new RuntimeException(e); } } log.debug("Found oneway Thrift methods: " + onewayMethods); InvocationHandler handler = new RpcServerInvocationHandler<T>(instance) { private final Logger log = LoggerFactory.getLogger(instance.getClass()); @Override public Object invoke(Object obj, Method method, Object[] args) throws Throwable { try { return super.invoke(obj, method, args); } catch (RuntimeException e) { if (onewayMethods.contains(method.getName())) { throw e; } String msg = e.getMessage(); log.error(msg, e); throw new TException(msg); } catch (Error e) { if (onewayMethods.contains(method.getName())) { throw e; } String msg = e.getMessage(); log.error(msg, e); throw new TException(msg); } } }; @SuppressWarnings("unchecked") T proxiedInstance = (T) Proxy.newProxyInstance(instance.getClass().getClassLoader(), instance.getClass().getInterfaces(), handler); return proxiedInstance; }</code><technical_language>ugh... this code realize brittle this new workaround existing work are. Brittle in sense expecting specific Thrift internal behavior method names, change in Thrift time. I suppose pushing changes and/or test upstream verify some sort of expected behavior</technical_language>

Target:
public static <T> T service(final T instance, @SuppressWarnings("rawtypes") final Map<String,ProcessFunction<T,? extends TBase>> processorView) { final Set<String> onewayMethods = getOnewayMethods(processorView); log.debug("Found oneway Thrift methods: " + onewayMethods); InvocationHandler handler = getInvocationHandler(instance, onewayMethods); @SuppressWarnings("unchecked") T proxiedInstance = (T) Proxy.newProxyInstance(instance.getClass().getClassLoader(), instance.getClass().getInterfaces(), handler); return proxiedInstance; }
Source:
<code>public Long deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException { switch (jsonParser.currentToken()) { case VALUE_NUMBER_INT: return jsonParser.getLongValue(); case VALUE_STRING: <START> return Long.valueOf(jsonParser.getValueAsString()); <END> } throw new IOException("Expected a long value"); }</code><technical_language>Do need handle empty string</technical_language>

Target:
public Long deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException { switch (jsonParser.currentToken()) { case VALUE_NUMBER_INT: return jsonParser.getLongValue(); case VALUE_STRING: return parseLong(jsonParser); case VALUE_NULL: return null; } throw new IOException("Expected a long value"); }
Source:
<code>private GetVmConfigurationBySnapshotQuery<GetVmConfigurationBySnapshotQueryParams> setupQueryBySnapshotId(Guid snapshotId) { GetVmConfigurationBySnapshotQueryParams queryParams = getQueryParameters(); when(queryParams.getSnapshotId()).thenReturn(snapshotId); GetVmConfigurationBySnapshotQuery<GetVmConfigurationBySnapshotQueryParams> executeQuery = getQuery(); <START> return executeQuery; <END> }</code><technical_language>call executeQuery</technical_language>

Target:
private GetVmConfigurationBySnapshotQuery<GetVmConfigurationBySnapshotQueryParams> setupQueryBySnapshotId(Guid snapshotId) { GetVmConfigurationBySnapshotQueryParams queryParams = getQueryParameters(); when(queryParams.getSnapshotId()).thenReturn(snapshotId); GetVmConfigurationBySnapshotQuery<GetVmConfigurationBySnapshotQueryParams> query = getQuery(); return query; }
Source:
<code>DataContextImpl(CalciteConnectionImpl connection, Map<String, Object> parameters, CalciteSchema rootSchema) { this.queryProvider = connection; this.typeFactory = connection.getTypeFactory(); this.rootSchema = rootSchema; final Holder<Long> timeHolder = Holder.of(System.currentTimeMillis()); Hook.CURRENT_TIME.run(timeHolder); final long time = timeHolder.get(); final TimeZone timeZone = connection.getTimeZone(); final long localOffset = timeZone.getOffset(time); final long currentOffset = localOffset; final Holder<Object[]> streamHolder = Holder.of(new Object[] {System.in, System.out, System.err}); Hook.STANDARD_STREAMS.run(streamHolder); ImmutableMap.Builder<Object, Object> builder = ImmutableMap.builder(); builder.put(Variable.UTC_TIMESTAMP.camelName, time) .put(Variable.CURRENT_TIMESTAMP.camelName, time + currentOffset) .put(Variable.LOCAL_TIMESTAMP.camelName, time + localOffset) .put(Variable.TIME_ZONE.camelName, timeZone) .put(Variable.STDIN.camelName, streamHolder.get()[0]) .put(Variable.STDOUT.camelName, streamHolder.get()[1]) <START> .put("#DELTA#", new LinkedList<>()) END> .put(Variable.STDERR.camelName, streamHolder.get()[2]); for (Map.Entry<String, Object> entry : parameters.entrySet()) { Object e = entry.getValue(); if (e == null) { e = AvaticaSite.DUMMY_VALUE; } builder.put(entry.getKey(), e); } map = builder.build(); }</code><technical_language>I guess this done EnumerableDeltaTableScan#implement, no</technical_language>

Target:
DataContextImpl(CalciteConnectionImpl connection, Map<String, Object> parameters, CalciteSchema rootSchema) { this.queryProvider = connection; this.typeFactory = connection.getTypeFactory(); this.rootSchema = rootSchema; final Holder<Long> timeHolder = Holder.of(System.currentTimeMillis()); Hook.CURRENT_TIME.run(timeHolder); final long time = timeHolder.get(); final TimeZone timeZone = connection.getTimeZone(); final long localOffset = timeZone.getOffset(time); final long currentOffset = localOffset; final Holder<Object[]> streamHolder = Holder.of(new Object[] {System.in, System.out, System.err}); Hook.STANDARD_STREAMS.run(streamHolder); ImmutableMap.Builder<Object, Object> builder = ImmutableMap.builder(); builder.put(Variable.UTC_TIMESTAMP.camelName, time) .put(Variable.CURRENT_TIMESTAMP.camelName, time + currentOffset) .put(Variable.LOCAL_TIMESTAMP.camelName, time + localOffset) .put(Variable.TIME_ZONE.camelName, timeZone) .put(Variable.STDIN.camelName, streamHolder.get()[0]) .put(Variable.STDOUT.camelName, streamHolder.get()[1]) .put(Variable.STDERR.camelName, streamHolder.get()[2]); for (Map.Entry<String, Object> entry : parameters.entrySet()) { Object e = entry.getValue(); if (e == null) { e = AvaticaSite.DUMMY_VALUE; } builder.put(entry.getKey(), e); } map = builder.build(); }
Source:
<code>public Response<CommentInfo> apply(RevisionResource rsrc, Input in) throws AuthException, BadRequestException, ResourceConflictException, OrmException { if (Strings.isNullOrEmpty(in.path)) { throw new BadRequestException("path must be non-empty"); } else if (in.message == null || in.message.trim().isEmpty()) { throw new BadRequestException("message must be non-empty"); } else if (in.line != null && in.line <= 0) { throw new BadRequestException("line must be > 0"); } else if (in.line != null && in.range != null && in.line != in.range.getEndLine()) { throw new BadRequestException("range endLine must be on the same line as the comment"); } else if ((in.line == null || in.line == 0) && in.range != null) { <START> throw new BadRequestException("range must be null if line is null or 0"); <END> } int line; if (in.range != null || in.line != null) { line = in.range != null ? in.range.getEndLine() : in.line; } else { line = 0; } PatchLineComment c = new PatchLineComment( new PatchLineComment.Key( new Patch.Key(rsrc.getPatchSet().getId(), in.path), ChangeUtil.messageUUID(db.get())), line, rsrc.getAccountId(), Url.decode(in.inReplyTo)); c.setSide(in.side == Side.PARENT ? (short) 0 : (short) 1); c.setMessage(in.message.trim()); c.setRange(in.range); db.get().patchComments().insert(Collections.singleton(c)); return Response.created(new CommentInfo(c, null)); }</code><technical_language>I disagree. OK for in.line==null && in.range!=null. line in.range.getEndLine(). problem is in.line==0 in.range!=null. This caught line above</technical_language>

Target:
public Response<CommentInfo> apply(RevisionResource rsrc, Input in) throws AuthException, BadRequestException, ResourceConflictException, OrmException { if (Strings.isNullOrEmpty(in.path)) { throw new BadRequestException("path must be non-empty"); } else if (in.message == null || in.message.trim().isEmpty()) { throw new BadRequestException("message must be non-empty"); } else if (in.line != null && in.line <= 0) { throw new BadRequestException("line must be > 0"); } else if (in.line != null && in.range != null && in.line != in.range.getEndLine()) { throw new BadRequestException("range endLine must be on the same line as the comment"); } int line = in.line != null ? in.line : in.range != null ? in.range.getEndLine() : 0; PatchLineComment c = new PatchLineComment( new PatchLineComment.Key( new Patch.Key(rsrc.getPatchSet().getId(), in.path), ChangeUtil.messageUUID(db.get())), line, rsrc.getAccountId(), Url.decode(in.inReplyTo)); c.setSide(in.side == Side.PARENT ? (short) 0 : (short) 1); c.setMessage(in.message.trim()); c.setRange(in.range); db.get().patchComments().insert(Collections.singleton(c)); return Response.created(new CommentInfo(c, null)); }
Source:
<code>public static JSONArray arrayToArray(org.json.JSONArray ar){ <START> assert(ar instanceof JSONArray); <END> return (JSONArray) ar; }</code><technical_language>assert is useful in Android apps I</technical_language>

Target:
public static JSONArray arrayToArray(org.json.JSONArray ar){ Assert.that(ar == null || ar instanceof JSONArray, "Object "+ar+" should have been an instance of our JSONArray."); return (JSONArray) ar; }
Source:
<code>public BinaryCodec(final Path path, final boolean writing) { this(); try { this.isWriting = writing; if (this.isWriting) { this.outputStream = IOUtil.maybeBufferOutputStream(Files.newOutputStream(path)); <START> this.outputFileName = path.toString(); <END> } else { this.inputStream = IOUtil.maybeBufferInputStream(Files.newInputStream(path)); this.inputFileName = path.toString(); } } catch (FileNotFoundException e) { throw new RuntimeIOException("File not found: " + path, e); } catch (IOException e) { throw new RuntimeIOException("Error opening: " + path, e); } }</code><technical_language>If want match behavior path.getFileName() instead of toString()</technical_language>

Target:
public BinaryCodec(final Path path, final boolean writing) { this(); try { this.isWriting = writing; if (this.isWriting) { this.outputStream = IOUtil.maybeBufferOutputStream(Files.newOutputStream(path)); this.outputFileName = path.getFileName().toString(); } else { this.inputStream = IOUtil.maybeBufferInputStream(Files.newInputStream(path)); this.inputFileName = path.getFileName().toString(); } } catch (FileNotFoundException e) { throw new RuntimeIOException("File not found: " + path, e); } catch (IOException e) { throw new RuntimeIOException("Error opening: " + path, e); } }
Source:
<code>public PackageRepository getPackageRepository(String repoId) { <START> return goConfigService.getConfigForEditing().getPackageRepositories().find(repoId); <END> }</code><technical_language>A read operation need configForEditing</technical_language>

Target:
public PackageRepository getPackageRepository(String repoId) { return goConfigService.getPackageRepository(repoId); }
Source:
<code>protected Object call() throws Exception { WanSyncType wanSyncType = WanSyncType.getByType(parameters.wanSyncType); if (wanSyncType == null) { throw new IllegalArgumentException( String.format("Invalid wanSyncType: %s", parameters.wanSyncType)); } switch (wanSyncType) { case ALL_MAPS: return syncAllMaps(); case SINGLE_MAP: return syncSingleMap(); default: <START> return isNullOrEmptyAfterTrim(parameters.mapName) ? syncAllMaps() : syncSingleMap(); <END> } }</code><technical_language>ways for deciding sync is for a single map for maps. Do need this for a concrete case? I handle this error case remove enum</technical_language>

Target:
protected Object call() throws Exception { WanSyncType wanSyncType = WanSyncType.getByType(parameters.wanSyncType); if (wanSyncType == null) { throw new IllegalArgumentException( String.format("Invalid wanSyncType: %s", parameters.wanSyncType)); } switch (wanSyncType) { case ALL_MAPS: return syncAllMaps(); case SINGLE_MAP: return syncSingleMap(); default: throw new IllegalArgumentException( String.format("Unsupported wanSyncType: %s", parameters.wanSyncType)); } }
Source:
<code>private static void assertEventsMatchLoosely(List<Event> events, Condition<? super Event>... conditions) { SoftAssertions softly = new SoftAssertions(); <START> for (Condition<? super Event> condition : conditions) <END> checkCondition(events, softly, condition); softly.assertAll(); }</code><technical_language>Please add curly brackets for for-loop</technical_language>

Target:
private static void assertEventsMatchLoosely(List<Event> events, Condition<? super Event>... conditions) { SoftAssertions softly = new SoftAssertions(); for (Condition<? super Event> condition : conditions) { checkCondition(events, softly, condition); } softly.assertAll(); }