auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String getIpMatch() { <START> return null; <END> }</code><technical_language>more throw OperationNotSupportedException here? returning null end in NPE based current usage anyway</technical_language>

Target:
public String getIpMatch() { throw new UnsupportedOperationException(); }
Source:
<code>public void testSingleUpdate() throws Exception { Subscriber client1 = createSubscriber(new String[] { "refs/heads/*:refs/remotes/origin/*", "refs/tags/*:refs/tags/*" }); <START> Thread.sleep(1000); <END> Repository r = client1.getRepository("testrepository").getRepository(); Ref ref = r.getRef("refs/pubsub/origin/heads/master"); assertNotNull(ref); ObjectId update = triggerUpdate("refs/heads/master"); Thread.sleep(1000); ref = r.getRef("refs/pubsub/origin/heads/master"); assertEquals(update, ref.getObjectId()); }</code><technical_language>1 Thread.sleep in tests, slow brittle. Instead, if some place hook in a CountDownLatch counts client thread connects</technical_language>

Target:
public void testSingleUpdate() throws Exception { setUpPublisher(1); TestSubscriber client1 = createSubscriber(new String[] { "refs/heads/*:refs/remotes/origin/*", "refs/tags/*:refs/tags/*" }, 2); connectLatch.await(); ObjectId update = triggerUpdate("refs/heads/master"); client1.await(); Repository r = client1.getRepository("testrepository").getRepository(); Ref ref = r.getRef("refs/pubsub/origin/heads/master"); assertEquals(update, ref.getObjectId()); }
Source:
<code><START> public String validateChangeName( <END> final String name, final LocalDate previousNameEndDate) { return previousNameEndDate.isAfter(getClockService().now()) ? "You can not select a future end date" : null; }</code><technical_language>some validation if name is current name, reject (ie new name current name)</technical_language>

Target:
public String validateChangeName( final String name, final LocalDate previousNameEndDate) { if (name.equals(this.getName())) { return "New name must be different from the current name"; } else { return previousNameEndDate.isAfter(getClockService().now()) ? "You can not select a future end date" : null; } }
Source:
<code>public void testGetHasStoreEntryHasCacheLoaderEntry() throws Exception { final MockStore realStore = new MockStore(Collections.singletonMap("key", "value")); this.store = spy(realStore); assertThat(realStore.getMap().get("key"), equalTo("value")); <START> when(this.cacheLoader.load("key")).thenThrow(ExceptionFactory.newCacheLoaderException(new Exception())); <END> final Ehcache<String, String> ehcache = this.getEhcache(this.cacheLoader); assertThat(ehcache.get("key"), equalTo("value")); verify(this.store).computeIfAbsent(eq("key"), getAnyFunction()); verify(this.cacheLoader, never()).load(eq("key")); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(realStore.getMap().get("key"), equalTo("value")); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoaderOutcome.class)); }</code><technical_language>This contradicts test description. More generally I some of tests necessary - asserted a CacheLoader sees interactions Store holds entry, is need assert CacheLoader states. do others of that</technical_language>

Target:
public void testGetHasStoreEntryHasCacheLoaderEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", "value")); this.store = spy(fakeStore); assertThat(fakeStore.getEntryMap().get("key"), equalTo("value")); when(this.cacheLoader.load("key")).thenReturn("value"); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheLoader); assertThat(ehcache.get("key"), equalTo("value")); verify(this.store).computeIfAbsent(eq("key"), getAnyFunction()); verify(this.cacheLoader, never()).load(eq("key")); verifyZeroInteractions(this.spiedResilienceStrategy); assertThat(fakeStore.getEntryMap().get("key"), equalTo("value")); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoaderOutcome.class)); }
Source:
<code>public EmailRecords<? extends BasicEmailRecordDto> getEmails(GridSettings filter, HttpServletRequest request) { <START> int defaultRowsAmount = 10; <END> int defaultPage = 1; EmailRecordSearchCriteria criteria = prepareCriteria(filter); List<EmailRecord> filtered = auditService.findEmailRecords(criteria); List<? extends BasicEmailRecordDto> rows = hideColumns(filtered, filter); long total = auditService.countEmailRecords(criteria); if (filter.getRows() == null) { filter.setRows(defaultRowsAmount); } if (filter.getPage() == null) { filter.setPage(defaultPage); } int totalPages = (int) Math.ceil((double) total / filter.getRows()); String username = getUsername(request); if (username != null) { lastFilter.put(username, filter); } return new EmailRecords<>((int) total, filter.getPage(), totalPages, rows); }</code><technical_language>define variables</technical_language>

Target:
public EmailRecords<? extends BasicEmailRecordDto> getEmails(GridSettings filter, HttpServletRequest request) { EmailRecordSearchCriteria criteria = prepareCriteria(filter); List<EmailRecord> filtered = auditService.findEmailRecords(criteria); List<? extends BasicEmailRecordDto> rows = hideColumns(filtered, filter); long total = auditService.countEmailRecords(criteria); if (filter.getRows() == null) { int defaultRowsAmount = 10; filter.setRows(defaultRowsAmount); } if (filter.getPage() == null) { int defaultPage = 1; filter.setPage(defaultPage); } int totalPages = (int) Math.ceil((double) total / filter.getRows()); String username = getUsername(request); if (username != null) { lastFilter.put(username, filter); } return new EmailRecords<>((int) total, filter.getPage(), totalPages, rows); }
Source:
<code>public RegisterResponse call() throws Exception { ServiceManager api = environment.getServiceManager(); RegisterResponse res = api.register(parameters); if (!res.isSuccess()) { return res; } switch (backstoreType) { case TYPE_GOOGLE: <START> case TYPE_FACEBOOK: <END> if (backstoreType == SocialFactory.SOCIAL_SOURCE_TYPE.TYPE_FACEBOOK) { auth = api.loginByFacebook(accessToken); } else if (backstoreType == SocialFactory.SOCIAL_SOURCE_TYPE.TYPE_GOOGLE) { auth = api.loginByGoogle(accessToken); } break; default: String username = parameters.getString("username"); String password = parameters.getString("password"); auth = loginAPI.getAccessToken(username, password); Gson gson = new GsonBuilder().create(); PrefManager pref = new PrefManager(context, PrefManager.Pref.LOGIN); pref.put(PrefManager.Key.AUTH_JSON, gson.toJson(auth)); pref.put(PrefManager.Key.SEGMENT_KEY_BACKEND, ISegment.Values.PASSWORD); if (auth.isSuccess()) { logger.debug("login succeeded after email registration"); } } if (auth != null && auth.isSuccess()) { auth.profile = api.getProfile(); } return res; }</code><technical_language>If changing this code anyway, worth fixing this discussed</technical_language>

Target:
public RegisterResponse call() throws Exception { ServiceManager api = environment.getServiceManager(); RegisterResponse res = api.register(parameters); if (!res.isSuccess()) { return res; } switch (backstoreType) { case TYPE_GOOGLE: auth = api.loginByGoogle(accessToken); break; case TYPE_FACEBOOK: auth = api.loginByFacebook(accessToken); break; default: String username = parameters.getString("username"); String password = parameters.getString("password"); auth = loginAPI.getAccessToken(username, password); Gson gson = new GsonBuilder().create(); PrefManager pref = new PrefManager(context, PrefManager.Pref.LOGIN); pref.put(PrefManager.Key.AUTH_JSON, gson.toJson(auth)); pref.put(PrefManager.Key.SEGMENT_KEY_BACKEND, ISegment.Values.PASSWORD); if (auth.isSuccess()) { logger.debug("login succeeded after email registration"); } } if (auth != null && auth.isSuccess()) { auth.profile = api.getProfile(); } return res; }
Source:
<code><START> public void testRawModeOption() { <END> GetBlobOptions options = new GetBlobOptionsBuilder().operationType(GetBlobOptions.OperationType.BlobInfo).rawMode(true).build(); assertEquals("RawMode from options not as expected.", true, options.isRawMode()); }</code><technical_language>doc</technical_language>

Target:
public void testRawModeOption() { for (Boolean boolVal : TestUtils.BOOLEAN_VALUES) { GetBlobOptions options = new GetBlobOptionsBuilder().operationType(GetBlobOptions.OperationType.All).rawMode(boolVal).build(); assertEquals("RawMode from options not as expected.", boolVal, options.isRawMode()); } }
Source:
<code>public void destroy() throws DestroyFailedException { if (password != null) { for (int i = 0; i < password.length; i++) <START> password[i] = 0; <END> } }</code><technical_language>Possibly a choice: Arrays.fill(password, (char)0);</technical_language>

Target:
public void destroy() throws DestroyFailedException { if (password != null) Arrays.fill(password, (char)0); }
Source:
<code>private void testExecuteAsyncQuery(GrillQueryCommands qCom) throws Exception { String sql = "cube select id,name from test_dim"; String qh = qCom.executeQuery(sql, true); String result = qCom.getAllQueries("",""); Assert.assertTrue(result.contains(qh)); while(!client.getQueryStatus(qh).isFinished()) { Thread.sleep(5000); } Assert.assertTrue(qCom.getStatus(qh).contains("Status : SUCCESSFUL")); result = qCom.getQueryResults(qh); Assert.assertTrue(result.contains("1\tfirst")); <START> result = qCom.getAllQueries("SUCCESSFUL",""); <END> Assert.assertTrue(result.contains(qh)); String user = client.getGrillStatement(new QueryHandle(UUID.fromString(qh))).getQuery().getSubmittedUser(); result = qCom.getAllQueries("",user); Assert.assertTrue(result.contains(qh)); result = qCom.getAllQueries("SUCCESSFUL",user); Assert.assertTrue(result.contains(qh)); }</code><technical_language>add more case for asking FAILED queries assert query handles returned</technical_language>

Target:
private void testExecuteAsyncQuery(GrillQueryCommands qCom) throws Exception { String sql = "cube select id,name from test_dim"; String qh = qCom.executeQuery(sql, true); String result = qCom.getAllQueries("",""); Assert.assertTrue(result.contains(qh)); while(!client.getQueryStatus(qh).isFinished()) { Thread.sleep(5000); } Assert.assertTrue(qCom.getStatus(qh).contains("Status : SUCCESSFUL")); result = qCom.getQueryResults(qh); Assert.assertTrue(result.contains("1\tfirst")); result = qCom.getAllQueries("SUCCESSFUL",""); Assert.assertTrue(result.contains(qh)); result = qCom.getAllQueries("FAILED",""); Assert.assertTrue(result.contains("No queries")); String user = client.getGrillStatement(new QueryHandle(UUID.fromString(qh))).getQuery().getSubmittedUser(); result = qCom.getAllQueries("",user); Assert.assertTrue(result.contains(qh)); result = qCom.getAllQueries("","dummyuser"); Assert.assertTrue(result.contains("No queries")); result = qCom.getAllQueries("SUCCESSFUL",user); Assert.assertTrue(result.contains(qh)); }
Source:
<code>public String getClassName(String rawTableName, TableDefinition table) { <START> return Renderers.getClassTableName(rawTableName, table) + "SimpleTable"; <END> }</code><technical_language>this "SimpleTable" string shows in a places, extract a constant</technical_language>

Target:
public String getClassName(String rawTableName, TableDefinition table) { return Renderers.getClassTableName(rawTableName, table) + SCHEMA_V2_TABLE_NAME; }
Source:
<code><START> public Query<T> disableSnapshotMode() { <END> getOptions().getModifiersDBObject().remove("$snapshot"); return this; }</code><technical_language>I a test for this</technical_language>

Target:
public Query<T> disableSnapshotMode() { getOptions().getModifiers().removeField("$snapshot"); return this; }
Source:
<code>public AggregateResults calculate( final GamePlayer attacker, final GamePlayer defender, final Territory location, final Collection<Unit> attacking, final Collection<Unit> defending, final Collection<Unit> bombarding, final Collection<TerritoryEffect> territoryEffects, final boolean retreatWhenOnlyAirLeft, final int runCount) throws IllegalStateException { synchronized (mutexCalcIsRunning) { awaitLatch(); final long start = System.currentTimeMillis(); final AtomicInteger overflowRunsAvailable = new AtomicInteger(runCount % workers.size()); final int runsPerWorker = runCount / workers.size(); final List<Future<AggregateResults>> list = workers.stream() .map( worker -> executor.submit( () -> worker.calculate( attacker, defender, location, attacking, defending, bombarding, territoryEffects, retreatWhenOnlyAirLeft, (overflowRunsAvailable.getAndDecrement() > 0 ? 1 : 0) + runsPerWorker))) <START> .collect(Collectors.toList()); <END> if (!getIsReady()) { return new AggregateResults(0); } final AggregateResults results = new AggregateResults(runCount); for (final Future<AggregateResults> future : list) { try { final AggregateResults result = future.get(); results.addResults(result.getResults()); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); } catch (final ExecutionException e) { throw new IllegalStateException("Battle results workers aborted by exception", e); } } results.setTime(System.currentTimeMillis() - start); return results; } }</code><technical_language>suggestion: thoughts add a postcondition check sum of aggregated results is equal run count</technical_language>

Target:
public AggregateResults calculate( final GamePlayer attacker, final GamePlayer defender, final Territory location, final Collection<Unit> attacking, final Collection<Unit> defending, final Collection<Unit> bombarding, final Collection<TerritoryEffect> territoryEffects, final boolean retreatWhenOnlyAirLeft, final int runCount) throws IllegalStateException { synchronized (mutexCalcIsRunning) { awaitLatch(); final long start = System.currentTimeMillis(); final var runCountDistributor = new RunCountDistributor(runCount, workers.size()); final List<Future<AggregateResults>> list = workers.stream() .map( worker -> executor.submit( () -> worker.calculate( attacker, defender, location, attacking, defending, bombarding, territoryEffects, retreatWhenOnlyAirLeft, runCountDistributor.nextRunCount()))) .collect(Collectors.toList()); if (!getIsReady()) { return new AggregateResults(0); } final AggregateResults results = new AggregateResults(runCount); for (final Future<AggregateResults> future : list) { try { final AggregateResults result = future.get(); results.addResults(result.getResults()); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); } catch (final ExecutionException e) { throw new IllegalStateException("Battle results workers aborted by exception", e); } } results.setTime(System.currentTimeMillis() - start); return results; } }
Source:
<code>void enqueueContentForDelivery(String content) { if (storeDirectory == null) { return; } String filename = getFilename(content); discardOldestFileIfNeeded(); lock.lock(); Writer out = null; try { FileOutputStream fos = new FileOutputStream(filename); out = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8")); out.write(content); } catch (Exception exc) { <START> File errorFile = new File(filename); if (delegate != null) { delegate.onErrorIOFailure(exc, errorFile, "NDK Crash report copy"); } try { if (!errorFile.delete()) { errorFile.deleteOnExit(); } } catch (Exception ex) { Logger.warn("Failed to delete partially written file", ex); <END> } } finally { try { if (out != null) { out.close(); } } catch (Exception exception) { Logger.warn(String.format("Failed to close unsent payload writer (%s) ", filename), exception); } lock.unlock(); } }</code><technical_language>This functional change mentioned in PR description a changelog entry</technical_language>

Target:
void enqueueContentForDelivery(String content) { if (storeDirectory == null) { return; } String filename = getFilename(content); discardOldestFileIfNeeded(); lock.lock(); Writer out = null; try { FileOutputStream fos = new FileOutputStream(filename); out = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8")); out.write(content); } catch (Exception exc) { File errorFile = new File(filename); if (delegate != null) { delegate.onErrorIOFailure(exc, errorFile, "NDK Crash report copy"); } IOUtils.deleteFile(errorFile); } finally { try { if (out != null) { out.close(); } } catch (Exception exception) { Logger.warn(String.format("Failed to close unsent payload writer (%s) ", filename), exception); } lock.unlock(); } }
Source:
<code>public String _findDeck(String val) { if ("*".equals(val)) { return "skip"; } else if ("filtered".equals(val)) { return "c.odid"; } List<Long> ids = null; if ("current".equalsIgnoreCase(val)) { ids = dids(mCol.getDecks().selected()); } else if (!val.contains("*")) { ids = dids(mCol.getDecks().id(val, false)); } else { try{ <START> ids = dids(mCol.getDecks().id(val, false)); <END> }catch(Exception e){ ids = new ArrayList<>(); } val = val.replace("*", ".*"); val = val.replace("+", "\\+"); for (JSONObject d : mCol.getDecks().all()) { String deckName = d.getString("name"); deckName = Normalizer.normalize(deckName, Normalizer.Form.NFC); if (deckName.matches("(?i)" + val)) { for (long id : dids(d.getLong("id"))) { if (!ids.contains(id)) { ids.add(id); } } } } } if (ids == null || ids.size() == 0) { return null; } String sids = Utils.ids2str(ids); return "c.did in " + sids + " or c.odid in " + sids; }</code><technical_language>This duplicate values in ArrayList. this done a separate branch in if (potentially combined logic): **Pseudocde:** If a deck name matching exactly, ids, otherwise, move regex search. .id() return null, a conditional</technical_language>

Target:
public String _findDeck(String val) { if ("*".equals(val)) { return "skip"; } else if ("filtered".equals(val)) { return "c.odid"; } List<Long> ids = null; if ("current".equalsIgnoreCase(val)) { ids = dids(mCol.getDecks().selected()); } else if (!val.contains("*")) { ids = dids(mCol.getDecks().id(val, false)); } else { ids = dids(mCol.getDecks().id(val, false)); if (ids == null) { ids = new ArrayList<>(); val = val.replace("*", ".*"); val = val.replace("+", "\\+"); for (JSONObject d : mCol.getDecks().all()) { String deckName = d.getString("name"); deckName = Normalizer.normalize(deckName, Normalizer.Form.NFC); if (deckName.matches("(?i)" + val)) { for (long id : dids(d.getLong("id"))) { if (!ids.contains(id)) { ids.add(id); } } } } } } if (ids == null || ids.size() == 0) { return null; } String sids = Utils.ids2str(ids); return "c.did in " + sids + " or c.odid in " + sids; }
Source:
<code>void runBenchmark() { long start, time; start = JVM.monotonicTimeMillis(); for (int i = 0; i < 1000; i++) { System.out.println("I am the very model of a modern major general."); } <START> <END> for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { System.out.print(j % 10); } System.out.println(); } time = JVM.monotonicTimeMillis() - start; System.out.println("Time: " + time); }</code><technical_language>print a result for println a for print later, output be: println: X ms print: Y ms</technical_language>

Target:
void runBenchmark() { long start, time; start = JVM.monotonicTimeMillis(); for (int i = 0; i < 1000; i++) { System.out.println("I am the very model of a modern major general."); } time = JVM.monotonicTimeMillis() - start; System.out.println("System.out.println time: " + time); start = JVM.monotonicTimeMillis(); for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { System.out.print(j % 10); } } time = JVM.monotonicTimeMillis() - start; System.out.println(); System.out.println("System.out.print time: " + time); }
Source:
<code>public void shouldMakeRenditionAvailableImageToPDF() throws Exception { Blob source = Blobs.createBlob(FileUtils.getResourceFileFromContext("images/test.jpg")); DocumentModel doc = session.createDocumentModel("/", "picture", "Picture"); doc.setProperty("file", "filename", source.getFilename()); doc.setProperty("file", "content", source); <START> assertNotNull(renditionService.getRendition(doc, "imageToPDF")); <END> }</code><technical_language>Rendition#getBlob do actual conversion PDF rendition definition (and chain Image.Blob.ConvertToPDF)</technical_language>

Target:
public void shouldMakeRenditionAvailableImageToPDF() throws Exception { Blob source = Blobs.createBlob(FileUtils.getResourceFileFromContext("images/test.jpg")); DocumentModel doc = session.createDocumentModel("/", "picture", "Picture"); doc.setProperty("file", "filename", source.getFilename()); doc.setProperty("file", "content", source); Rendition imageToPDFRendition = renditionService.getRendition(doc, "imageToPDF"); assertNotNull(imageToPDFRendition); Blob pdfRendition = imageToPDFRendition.getBlob(); assertNotNull(pdfRendition); assertEquals("pdf", FilenameUtils.getExtension(pdfRendition.getFilename())); }
Source:
<code>public void idle() { if (lastSendInterval++ >= sendIntervals) { lastSendInterval = 0; Iterator<DispatchAttempt> iterator = sendQueue.iterator(); while (iterator.hasNext()) { DispatchAttempt attempt = iterator.next(); try { EventMessageContent message = new EventMessageContent(); message.prepareMessage(hostName, attempt.event, isBodyHtml); log.info("Sending mail subject='{}' to='{}'", message.getMessageSubject(), attempt.address); log.debug("Send mail body='{}'", message.getMessageBody()); sendMail(attempt.address, message.getMessageSubject(), message.getMessageBody()); <START> log.info("E-mail sent successfully"); <END> notifyObservers(DispatchResult.success(attempt.event, attempt.address, EventNotificationMethod.SMTP)); iterator.remove(); } catch (Exception ex) { attempt.retries++; if (attempt.retries >= retries) { notifyObservers(DispatchResult.failure(attempt.event, attempt.address, EventNotificationMethod.SMTP, ex.getMessage())); iterator.remove(); } } } } }</code><technical_language>Please add 'subject' 'to' message, identify email successfully</technical_language>

Target:
public void idle() { if (lastSendInterval++ >= sendIntervals) { lastSendInterval = 0; Iterator<DispatchAttempt> iterator = sendQueue.iterator(); while (iterator.hasNext()) { DispatchAttempt attempt = iterator.next(); try { EventMessageContent message = new EventMessageContent(); message.prepareMessage(hostName, attempt.event, isBodyHtml); log.info("Sending mail subject='{}' to='{}'", message.getMessageSubject(), attempt.address); log.debug("Send mail body='{}'", message.getMessageBody()); sendMail(attempt.address, message.getMessageSubject(), message.getMessageBody()); log.info( "E-mail subject='{}' to='{} sent successfully", message.getMessageSubject(), attempt.address ); notifyObservers(DispatchResult.success(attempt.event, attempt.address, EventNotificationMethod.SMTP)); iterator.remove(); } catch (Exception ex) { attempt.retries++; if (attempt.retries >= retries) { notifyObservers(DispatchResult.failure(attempt.event, attempt.address, EventNotificationMethod.SMTP, ex.getMessage())); iterator.remove(); } } } } }
Source:
<code>private String generateId(GeneratedValue generatedValue, TreeMap<Integer, String> prefixes, TreeMap<Integer, String> suffixes, TreeMap<Integer, String> idAttributes) { String delimiter = generatedValue.delimiter(); StringBuilder sb = new StringBuilder(); boolean isAppending = false; if (prefixes.size() > 0) { <START> appendKeyParts(sb, prefixes.values(), generatedValue.delimiter()); <END> isAppending = true; } if (generatedValue.strategy() == USE_ATTRIBUTES && idAttributes.size() > 0) { if(isAppending) { sb.append(delimiter); } appendKeyParts(sb, idAttributes.values(), generatedValue.delimiter()); } if (generatedValue.strategy() == UNIQUE) { if(isAppending) { sb.append(delimiter); } sb.append(UUID.randomUUID()); } if (suffixes.size() > 0) { if(isAppending) { sb.append(delimiter); } appendKeyParts(sb, suffixes.values(), generatedValue.delimiter()); } return sb.toString(); }</code><technical_language>reuse delimiter variable (applies blocks below)</technical_language>

Target:
private String generateId(GeneratedValue generatedValue, TreeMap<Integer, String> prefixes, TreeMap<Integer, String> suffixes, TreeMap<Integer, String> idAttributes) { String delimiter = generatedValue.delimiter(); StringBuilder sb = new StringBuilder(); boolean isAppending = false; if (prefixes.size() > 0) { appendKeyParts(sb, prefixes.values(), delimiter); isAppending = true; } if (generatedValue.strategy() == USE_ATTRIBUTES && idAttributes.size() > 0) { if(isAppending) { sb.append(delimiter); } appendKeyParts(sb, idAttributes.values(), delimiter); } if (generatedValue.strategy() == UNIQUE) { if(isAppending) { sb.append(delimiter); } sb.append(UUID.randomUUID()); } if (suffixes.size() > 0) { if(isAppending) { sb.append(delimiter); } appendKeyParts(sb, suffixes.values(), delimiter); } return sb.toString(); }
Source:
<code>public void skipInt() throws IOException { <START> readInt(); <END> }</code><technical_language>I (still) understand calling tokenizer.skipInt() (and below) If caller called "skip...()", intention is skip, read, right</technical_language>

Target:
public void skipInt() throws IOException { tokenizer.skipInt(); }
Source:
<code>public synchronized ProcessorTopology buildTopology() { final Set<String> nodeGroup = new HashSet<>(); for (final Set<String> value : nodeGroups().values()) { nodeGroup.addAll(value); } nodeGroup.removeAll(globalNodeGroups()); for (final NodeFactory<?, ?> entry : nodeFactories.values()) { if (entry instanceof ProcessorNodeFactory) { ProcessorNodeFactory<?, ?> factory = (ProcessorNodeFactory<?, ?>) entry; if (factory.supplier.get() == factory.supplier.get()) { throw new TopologyException("topology has singleton result of ProcessorSupplier " + factory.name); } } <START> } <END> initializeSubscription(); return build(nodeGroup); }</code><technical_language>extract this a helper method call addProcessor() is called. stack trace is easier map call addProcessor() passed in incorrect supplier? Similarly, add this check KStreamImpl#process() others</technical_language>

Target:
public synchronized ProcessorTopology buildTopology() { final Set<String> nodeGroup = new HashSet<>(); for (final Set<String> value : nodeGroups().values()) { nodeGroup.addAll(value); } nodeGroup.removeAll(globalNodeGroups()); initializeSubscription(); return build(nodeGroup); }
Source:
<code><START> public static <END> void setBaseElement(EObject stereotypeApplication, Element element, Stereotype stereotype) { if (stereotypeApplication != null) { EClass eClass = stereotypeApplication.eClass(); if (stereotype == null) { stereotype = getStereotype(eClass, stereotypeApplication); if (stereotype == null) { return; } } for (EReference eReference : eClass .getEAllReferences()) { if (eReference.getName().startsWith( Extension.METACLASS_ROLE_PREFIX) && (element == null || eReference.getEType() .isInstance(element))) { stereotypeApplication.eSet(eReference, element); } } } }</code><technical_language>this protected (or package protected) internally</technical_language>

Target:
protected static void setBaseElement(EObject stereotypeApplication, Element element, Stereotype stereotype) { if (stereotypeApplication != null) { EClass eClass = stereotypeApplication.eClass(); if (stereotype == null) { stereotype = getStereotype(eClass, stereotypeApplication); if (stereotype == null) { return; } } for (EReference eReference : eClass .getEAllReferences()) { if (eReference.getName().startsWith( Extension.METACLASS_ROLE_PREFIX) && (element == null || eReference.getEType() .isInstance(element))) { stereotypeApplication.eSet(eReference, element); } } } }
Source:
<code>public Set<? extends NodeMetadata> resumeNodesMatching(Predicate<NodeMetadata> filter) { logger.debug(">> resuming nodes matching(%s)", filter); Set<NodeMetadata> set = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminatedExceptionIfNotFound(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { resumeNode(from.getId()); return from; } public String toString() { return "resumeNode(" + from.getId() + ")"; } }); } <START> <END> }, userExecutor, null, logger, "resumeNodesMatching(" + filter + ")")); logger.debug("<< resumed"); cleanUpIncidentalResourcesOfDeadNodes(set); return set; }</code><technical_language>Please fix indenting rename set resumedNodes</technical_language>

Target:
public Set<? extends NodeMetadata> resumeNodesMatching(Predicate<NodeMetadata> filter) { logger.debug(">> resuming nodes matching(%s)", filter); Set<NodeMetadata> resumeNodes = ImmutableSet.copyOf(transformParallel(nodesMatchingFilterAndNotTerminated(filter), new Function<NodeMetadata, ListenableFuture<? extends NodeMetadata>>() { @Override public ListenableFuture<NodeMetadata> apply(final NodeMetadata from) { return userExecutor.submit(new Callable<NodeMetadata>() { public NodeMetadata call() throws Exception { resumeNode(from.getId()); return from; } public String toString() { return "resumeNode(" + from.getId() + ")"; } }); } }, userExecutor, null, logger, "resumeNodesMatching(" + filter + ")")); logger.debug("<< resumed(%d)", resumeNodes.size()); return resumeNodes; }
Source:
<code>public void configure(Context context) { port = context.getInteger("port", DEFAULT_PORT); maxReadBufferBytes = context.getLong("maxReadBufferBytes", DEFAULT_MAX_READ_BUFFER_BYTES); if (maxReadBufferBytes <= 0) { maxReadBufferBytes = DEFAULT_MAX_READ_BUFFER_BYTES; } maxThriftFrameSizeBytes = context.getInteger("maxThriftFrameSizeBytes", DEFAULT_MAX_THRIFT_FRAME_SIZE_BYTES); if (maxThriftFrameSizeBytes <= 0) { maxThriftFrameSizeBytes = DEFAULT_MAX_THRIFT_FRAME_SIZE_BYTES; } workerThreadNum = context.getInteger("workerThreads", DEFAULT_WORKERS); if (workerThreadNum <= 0) { workerThreadNum = DEFAULT_WORKERS; } try { thriftServerType = ThriftServerType.getServerType( context.getString("thriftServer", DEFAULT_THRIFT_SERVER_TYPE.getValue())); } catch (IllegalArgumentException ex) { <START> LOG.error("Wrong thrift server type config", ex); <END> } selectorThreadNum = context.getInteger("selectorThreads", DEFAULT_THREADED_SELECTOR_NUM_THREADS); if (selectorThreadNum <= 0) { selectorThreadNum = DEFAULT_THREADED_SELECTOR_NUM_THREADS; } }</code><technical_language>I include bad in error message, finding bad config. throw exception instead of error logging</technical_language>

Target:
public void configure(Context context) { port = context.getInteger("port", DEFAULT_PORT); maxReadBufferBytes = context.getLong("maxReadBufferBytes", DEFAULT_MAX_READ_BUFFER_BYTES); if (maxReadBufferBytes <= 0) { maxReadBufferBytes = DEFAULT_MAX_READ_BUFFER_BYTES; } maxThriftFrameSizeBytes = context.getInteger("maxThriftFrameSizeBytes", DEFAULT_MAX_THRIFT_FRAME_SIZE_BYTES); if (maxThriftFrameSizeBytes <= 0) { maxThriftFrameSizeBytes = DEFAULT_MAX_THRIFT_FRAME_SIZE_BYTES; } workerThreadNum = context.getInteger("workerThreads", DEFAULT_WORKERS); if (workerThreadNum <= 0) { workerThreadNum = DEFAULT_WORKERS; } String thriftServerTypeStr = context.getString("thriftServer", DEFAULT_THRIFT_SERVER_TYPE.getValue()); thriftServerType = ThriftServerType.getServerType(thriftServerTypeStr); selectorThreadNum = context.getInteger("selectorThreads", DEFAULT_THREADED_SELECTOR_NUM_THREADS); if (selectorThreadNum <= 0) { selectorThreadNum = DEFAULT_THREADED_SELECTOR_NUM_THREADS; } }
Source:
<code>private void checkForSuccessfulTokenRefreshStatus(JsonNode rootNode) { JsonNode detailNode = rootNode.findValue(PaymentWorksTokenRefreshConstants.DETAIL_FIELD); if (ObjectUtils.isNotNull(detailNode)) { LOG.error("checkForSuccessfulTokenRefreshStatus(): Token refresh failed. Detail message: " + detailNode.textValue()); handleDetailMessageFromTokenRefreshFailure(detailNode.textValue()); throw new RuntimeException("Token refresh failed: Received failure response from PaymentWorks"); } JsonNode statusNode = rootNode.findValue(PaymentWorksTokenRefreshConstants.STATUS_FIELD); if (ObjectUtils.isNull(statusNode)) { LOG.error("checkForSuccessfulTokenRefreshStatus(): Did not receive a refresh status from PaymentWorks"); throw new RuntimeException("Token refresh failed: Did not receive a refresh status from PaymentWorks"); } else if (!StringUtils.equalsIgnoreCase(PaymentWorksTokenRefreshConstants.STATUS_OK, statusNode.textValue())) { LOG.error("checkForSuccessfulTokenRefreshStatus(): Unexpected status from PaymentWorks response: " + statusNode.textValue()); throw new RuntimeException("Token refresh failed: Received an unexpected refresh status from PaymentWorks"); <START> } <END> }</code><technical_language>"else" clause logs fact refresh successful</technical_language>

Target:
private void checkForSuccessfulTokenRefreshStatus(JsonNode rootNode) { JsonNode detailNode = rootNode.findValue(PaymentWorksTokenRefreshConstants.DETAIL_FIELD); if (ObjectUtils.isNotNull(detailNode)) { LOG.error("checkForSuccessfulTokenRefreshStatus(): Token refresh failed. Detail message: " + detailNode.textValue()); handleDetailMessageFromTokenRefreshFailure(detailNode.textValue()); throw new RuntimeException("Token refresh failed: Received failure response from PaymentWorks"); } JsonNode statusNode = rootNode.findValue(PaymentWorksTokenRefreshConstants.STATUS_FIELD); if (ObjectUtils.isNull(statusNode)) { LOG.error("checkForSuccessfulTokenRefreshStatus(): Did not receive a refresh status from PaymentWorks"); throw new RuntimeException("Token refresh failed: Did not receive a refresh status from PaymentWorks"); } else if (!StringUtils.equalsIgnoreCase(PaymentWorksTokenRefreshConstants.STATUS_OK, statusNode.textValue())) { LOG.error("checkForSuccessfulTokenRefreshStatus(): Unexpected status from PaymentWorks response: " + statusNode.textValue()); throw new RuntimeException("Token refresh failed: Received an unexpected refresh status from PaymentWorks"); } else { LOG.info("checkForSuccessfulTokenRefreshStatus(): Received a successful refresh status from PaymentWorks"); } }
Source:
<code>public void run() { Logging.putPrefix(MessageConsumerManager.LOG_PREFIX); try { consumer.subscribe(Arrays.asList(topic)); while (!closed.get()) { ConsumerRecords<String, byte[]> records = consumer.poll(100); for (ConsumerRecord<String, byte[]> record : records) { try { byte[] messageInBytes = getSinkMessageFromProto(record.value()); dispatch(module, module.unmarshal(messageInBytes)); } catch (RuntimeException e) { LOG.warn("Unexpected exception while dispatching message", e); } catch (InvalidProtocolBufferException e) { <START> LOG.warn("Error parsing protobuf", e); <END> } } } } catch (WakeupException e) { if (!closed.get()) { throw e; } } finally { consumer.close(); } }</code><technical_language>suggestion LOG.error("Error parsing procotol buffer in message. message dropped. Ensure components running version of software.");</technical_language>

Target:
public void run() { Logging.putPrefix(MessageConsumerManager.LOG_PREFIX); try { consumer.subscribe(Arrays.asList(topic)); while (!closed.get()) { ConsumerRecords<String, byte[]> records = consumer.poll(100); for (ConsumerRecord<String, byte[]> record : records) { try { byte[] messageInBytes = getSinkMessageFromProto(record.value()); dispatch(module, module.unmarshal(messageInBytes)); } catch (RuntimeException e) { LOG.warn("Unexpected exception while dispatching message", e); } catch (InvalidProtocolBufferException e) { LOG.warn("Error parsing procotol buffer in message. The message will be dropped. \n" + "Ensure that all components are running the same version of the software."); } } } } catch (WakeupException e) { if (!closed.get()) { throw e; } } finally { consumer.close(); } }
Source:
<code>public JsonDecoder configure(InputStream in) throws IOException { <START> Objects.requireNonNull(in, "InputStream to read from cannot be null"); <END> parser.reset(); reorderBuffers.clear(); currentReorderBuffer = null; this.in = jsonFactory.createParser(in); this.in.nextToken(); return this; }</code><technical_language>suggestion Objects.requireNonNull(in, "InputStream null");</technical_language>

Target:
public JsonDecoder configure(InputStream in) throws IOException { Objects.requireNonNull(in, "InputStream cannot be null"); parser.reset(); reorderBuffers.clear(); currentReorderBuffer = null; this.in = jsonFactory.createParser(in); this.in.nextToken(); return this; }
Source:
<code>public void write(Enriched<EntityType> enrichable, JsonGenerator jg) { try (TokenBuffer tb = new TokenBuffer(MAPPER, false)) { tb.writeStartObject(); write(tb, enrichable.getEntity()); tb.writeEndObject(); tb.flush(); try (JsonParser parser = tb.asParser()) { parser.nextToken(); while (parser.nextToken() == FIELD_NAME) { jg.copyCurrentStructure(parser); } if (parser.currentToken() != END_OBJECT) { <START> log.error("Enricher: failed on current token: {}, output: {}", name, parser.currentToken(), tb); <END> } } } catch (Exception e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); throw new RuntimeException("interrupted", e); } else { log.info("Enricher failed", name, e); } } }</code><technical_language>wondering... log error tb produce? If currently in logs (see below), I interesting output is truncated anyway. [TokenBuffer: START_OBJECT, FIELD_NAME(acls), START_ARRAY, START_OBJECT, FIELD_NAME(name), VALUE_STRING, FIELD_NAME(aces), START_ARRAY, START_OBJECT, FIELD_NAME(id), VALUE_STRING, FIELD_NAME(username), START_OBJECT, FIELD_NAME(entity-type), ..</technical_language>

Target:
public void write(Enriched<EntityType> enrichable, JsonGenerator jg) { try (TokenBuffer tb = new TokenBuffer(MAPPER, false)) { tb.writeStartObject(); write(tb, enrichable.getEntity()); tb.writeEndObject(); tb.flush(); try (JsonParser parser = tb.asParser()) { parser.nextToken(); while (parser.nextToken() == FIELD_NAME) { jg.copyCurrentStructure(parser); } if (parser.currentToken() != END_OBJECT) { log.error("Enricher: failed on current token: {}, output to write: {}", name::toString, parser::currentToken, () -> safeReadBuffer(tb)); } } } catch (Exception e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); throw new RuntimeException("interrupted", e); } else { log.info("Enricher: failed", name, e); } } }
Source:
<code>public synchronized GoConfigSaveResult writeFullConfigWithLock(FullConfigUpdateCommand updatingCommand, GoConfigHolder configHolder) { try { GoConfigHolder validatedConfigHolder; try { validatedConfigHolder = trySavingConfigWithLastKnownPartials(updatingCommand, configHolder); } catch (Exception e) { if (cannotSaveWithLastValidPartials()) { throw e; } else { <START> LOGGER.warn(String.format( <END> "Merged config update operation failed on LATEST %s partials. Falling back to using LAST VALID %s partials. Exception message was: %s", cachedGoPartials.lastKnownPartials().size(), cachedGoPartials.lastValidPartials().size(), e.getMessage()), e); validatedConfigHolder = trySavingConfigWithValidPartials(updatingCommand, configHolder); } } ConfigSaveState configSaveState = shouldMergeConfig(updatingCommand, configHolder) ? ConfigSaveState.MERGED : ConfigSaveState.UPDATED; return new GoConfigSaveResult(validatedConfigHolder, configSaveState); } catch (ConfigFileHasChangedException e) { LOGGER.warn("Configuration file could not be merged successfully after a concurrent edit: " + e.getMessage(), e); throw e; } catch (GoConfigInvalidException e) { LOGGER.warn("Configuration file is invalid: " + e.getMessage(), e); throw bomb(e.getMessage(), e); } catch (Exception e) { LOGGER.error("Configuration file is not valid: " + e.getMessage(), e); throw bomb(e.getMessage(), e); } finally { LOGGER.debug("[Config Save] Done writing with lock"); } }</code><technical_language>slf4j avoid need for String.format</technical_language>

Target:
public synchronized GoConfigSaveResult writeFullConfigWithLock(FullConfigUpdateCommand updatingCommand, GoConfigHolder configHolder) { try { GoConfigHolder validatedConfigHolder; try { validatedConfigHolder = trySavingConfigWithLastKnownPartials(updatingCommand, configHolder); } catch (Exception e) { if (!canUpdateConfigWithLastValidPartials()) throw e; LOGGER.warn("Merged config update operation failed on LATEST partials. Falling back to using LAST VALID partials." + " Exception message was: {}", cachedGoPartials.lastKnownPartials().size(), cachedGoPartials.lastValidPartials().size(), e.getMessage(), e); validatedConfigHolder = trySavingConfigWithLastValidPartials(updatingCommand, configHolder); } ConfigSaveState configSaveState = shouldMergeConfig(updatingCommand, configHolder) ? ConfigSaveState.MERGED : ConfigSaveState.UPDATED; return new GoConfigSaveResult(validatedConfigHolder, configSaveState); } catch (ConfigFileHasChangedException e) { LOGGER.warn("Configuration file could not be merged successfully after a concurrent edit: {}", e.getMessage(), e); throw e; } catch (GoConfigInvalidException e) { LOGGER.warn("Configuration file is invalid: {}", e.getMessage(), e); throw bomb(e.getMessage(), e); } catch (Exception e) { LOGGER.error("Configuration file is not valid: {}", e.getMessage(), e); throw bomb(e.getMessage(), e); } finally { LOGGER.debug("[Config Save] Done writing with lock"); } }
Source:
<code>public String getMetadataStoreRealm(String path) throws IllegalArgumentException, NoSuchElementException { if (path.isEmpty() || !path.substring(0, 1).equals(DELIMITER)) { throw new IllegalArgumentException( <START> "Provided path is empty or does not have a leading delimiter: " + path); <END> } TrieNode leafNode = findTrieNode(path, true); return leafNode.getRealmAddress(); }</code><technical_language>delimiter = "/"</technical_language>

Target:
public String getMetadataStoreRealm(String path) throws IllegalArgumentException, NoSuchElementException { if (path.isEmpty() || !path.substring(0, 1).equals(DELIMITER)) { throw new IllegalArgumentException("Provided path is empty or does not have a leading \"" + DELIMITER + "\" character: " + path); } TrieNode leafNode = findTrieNode(path, true); return leafNode.getRealmAddress(); }
Source:
<code>public Observable<DeleteResult> asRxObservable() { throwExceptionIfRxJavaIsNotAvailable("asRxObservable()"); final Observable<DeleteResult> observable = Observable.create(OnSubscribeExecuteAsBlocking.newInstance(this)); <START> final Scheduler scheduler = storIOSQLite.defaultScheduler(); <END> if (scheduler != null) { observable.subscribeOn(scheduler); } return observable; }</code><technical_language>extract 4 lines static function: subscribeOn(observable, storIOSQLite)</technical_language>

Target:
public Observable<DeleteResult> asRxObservable() { return RxJavaUtils.createObservable(storIOSQLite, this); }
Source:
<code>private List<CustomPropertyDefinition> writeResourceHeaders(SpreadsheetWriter writer) throws IOException { <START> List<CustomPropertyDefinition> customFieldDefs = myHumanResourceCustomPropertyManager.getDefinitions(); <END> for (Map.Entry<String, BooleanOption> entry : myCsvOptions.getResourceOptions().entrySet()) { ResourceDefaultColumn defaultColumn = ResourceDefaultColumn.find(entry.getKey()); if (!entry.getValue().isChecked()) { continue; } if (defaultColumn == null) { if ("id".equals(entry.getKey())) { writer.print(i18n("tableColID")); } else { writer.print(i18n(entry.getKey())); } } else { writer.print(defaultColumn.getName()); } } for (CustomPropertyDefinition nextDef : customFieldDefs) { writer.print(nextDef.getName()); } writer.println(); return customFieldDefs; }</code><technical_language>This list is unused line 253, moving here</technical_language>

Target:
private List<CustomPropertyDefinition> writeResourceHeaders(SpreadsheetWriter writer) throws IOException { for (Map.Entry<String, BooleanOption> entry : myCsvOptions.getResourceOptions().entrySet()) { ResourceDefaultColumn defaultColumn = ResourceDefaultColumn.find(entry.getKey()); if (!entry.getValue().isChecked()) { continue; } if (defaultColumn == null) { if ("id".equals(entry.getKey())) { writer.print(i18n("tableColID")); } else { writer.print(i18n(entry.getKey())); } } else { writer.print(defaultColumn.getName()); } } List<CustomPropertyDefinition> customFieldDefs = myHumanResourceCustomPropertyManager.getDefinitions(); for (CustomPropertyDefinition nextDef : customFieldDefs) { writer.print(nextDef.getName()); } writer.println(); return customFieldDefs; }
Source:
<code>public void invoke() { PRPAIN201306UV02 request = new PRPAIN201306UV02(); AssertionType assertion = new AssertionType(); MCCIIN000002UV01 expectedResponse = new MCCIIN000002UV01(); NhinTargetSystemType target = new NhinTargetSystemType(); AdapterPatientDiscoveryDeferredRespProxyObjectFactory adapterFactory = mock(AdapterPatientDiscoveryDeferredRespProxyObjectFactory.class); AdapterPatientDiscoveryDeferredRespProxy adapterProxy = mock(AdapterPatientDiscoveryDeferredRespProxy.class); <START> PatientDiscoveryDeferredResponseAuditLogger auditLogger = mock(PatientDiscoveryDeferredResponseAuditLogger.class); <END> Properties webContextProperties = new Properties(); when(adapterFactory.create()).thenReturn(adapterProxy); when(adapterProxy.processPatientDiscoveryAsyncResp(request, assertion)).thenReturn(expectedResponse); PassthroughInboundPatientDiscoveryDeferredResponse passthroughPatientDiscovery = new PassthroughInboundPatientDiscoveryDeferredResponse(adapterFactory, auditLogger); MCCIIN000002UV01 actualResponse = passthroughPatientDiscovery.respondingGatewayDeferredPRPAIN201306UV02( request, assertion, webContextProperties); assertSame(expectedResponse, actualResponse); verify(auditLogger).auditResponseMessage(request, actualResponse, assertion, null, NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, NhincConstants.AUDIT_LOG_NHIN_INTERFACE, Boolean.FALSE, webContextProperties, NhincConstants.PATIENT_DISCOVERY_DEFERRED_RESP_SERVICE_NAME); }</code><technical_language>forget line wrap breaking 120 chars; exceptions (NB auto formatter dislikes breaking a long diamond operator, some weird rules multi-param annotations), in general wrap for readability</technical_language>

Target:
public void invoke() { PRPAIN201306UV02 request = new PRPAIN201306UV02(); AssertionType assertion = new AssertionType(); MCCIIN000002UV01 expectedResponse = new MCCIIN000002UV01(); AdapterPatientDiscoveryDeferredRespProxyObjectFactory adapterFactory = mock(AdapterPatientDiscoveryDeferredRespProxyObjectFactory.class); AdapterPatientDiscoveryDeferredRespProxy adapterProxy = mock(AdapterPatientDiscoveryDeferredRespProxy.class); PatientDiscoveryDeferredResponseAuditLogger auditLogger = mock(PatientDiscoveryDeferredResponseAuditLogger.class); Properties webContextProperties = new Properties(); when(adapterFactory.create()).thenReturn(adapterProxy); when(adapterProxy.processPatientDiscoveryAsyncResp(request, assertion)).thenReturn(expectedResponse); PassthroughInboundPatientDiscoveryDeferredResponse passthroughPatientDiscovery = new PassthroughInboundPatientDiscoveryDeferredResponse(adapterFactory, auditLogger); MCCIIN000002UV01 actualResponse = passthroughPatientDiscovery.respondingGatewayDeferredPRPAIN201306UV02( request, assertion, webContextProperties); assertSame(expectedResponse, actualResponse); verify(auditLogger).auditResponseMessage(request, actualResponse, assertion, null, NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, NhincConstants.AUDIT_LOG_NHIN_INTERFACE, Boolean.FALSE, webContextProperties, NhincConstants.PATIENT_DISCOVERY_DEFERRED_RESP_SERVICE_NAME); }
Source:
<code>public void closeThread(String reason) { clickOnMoreButton(); clickOnCloseThreadButton(); waitForElementByElement(closeThreadTextarea); closeThreadTextarea.sendKeys(reason); waitForElementByElement(removeThreadModal_removeButton); waitForElementClickableByElement(removeThreadModal_removeButton); <START> clickAndWait(removeThreadModal_removeButton); <END> PageObjectLogging.log("closeThread", "closed thread with the following reason: "+reason, true, driver); }</code><technical_language>click element</technical_language>

Target:
public void closeThread(String reason) { clickOnMoreButton(); clickOnCloseThreadButton(); waitForElementByElement(closeThreadTextarea); closeThreadTextarea.sendKeys(reason); waitForElementByElement(removeThreadModal_removeButton); waitForElementClickableByElement(removeThreadModal_removeButton); scrollAndClick(removeThreadModal_removeButton); PageObjectLogging.log("closeThread", "closed thread with the following reason: "+reason, true, driver); }