auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private List<String> importFiles(Path path) throws Exception { String tempPath = new StringBuilder() .append(System.getProperty("java.io.tmpdir")) .append(File.separator) .append(FILE_PATH) .append(File.separator) .toString(); List<String> imported = new ArrayList<String>(); File destDir = new File(tempPath); <START> ZipInputStream zis = new ZipInputStream(new FileInputStream(path.toFile())); <END> ZipEntry zipEntry = zis.getNextEntry(); while (zipEntry != null) { File newFile = unzipFile(destDir, zipEntry, zis); zipEntry = zis.getNextEntry(); FileSystem fileSystem = getImportFileSystem(newFile, tempPath); if (fileSystem == null) { continue; } URI uri = URI.create( new StringBuilder() .append(SpacesAPI.Scheme.GIT) .append("://") .append(fileSystem.getName()) .toString()); String newFilePath = newFile.toPath() .toString() .replace( new StringBuilder(tempPath).append(fileSystem.getName()), ""); ioService.write( Paths.get(uri).resolve(newFilePath), java.nio.file.Files.readAllBytes(newFile.toPath())); imported.add( new StringBuilder() .append(fileSystem.getName()) .append(newFilePath) .toString()); fireEvent(newFile, tempPath, uri, newFilePath); } zis.closeEntry(); zis.close(); FileUtils.deleteDirectory(destDir); return imported; }</code><technical_language>please try-with-resources try-catch-finally block here? If is exception thrown later, this get closed. other spots this in this PR</technical_language>

Target:
private List<String> importFiles(Path path) throws Exception { String tempPath = new StringBuilder() .append(System.getProperty("java.io.tmpdir")) .append(File.separator) .append(FILE_PATH) .append(File.separator) .toString(); List<String> imported = new ArrayList<>(); File destDir = new File(tempPath); try (ZipInputStream zis = new ZipInputStream(new FileInputStream(path.toFile()))) { ZipEntry zipEntry = zis.getNextEntry(); while (zipEntry != null) { File newFile = unzipFile(destDir, zipEntry, zis); zipEntry = zis.getNextEntry(); FileSystem fileSystem = getImportFileSystem(newFile, tempPath); if (fileSystem == null) { continue; } URI uri = URI.create( new StringBuilder() .append(SpacesAPI.Scheme.GIT) .append("://") .append(fileSystem.getName()) .toString()); String newFilePath = newFile.toPath() .toString() .replace( new StringBuilder(tempPath).append(fileSystem.getName()), ""); ioService.write( Paths.get(uri).resolve(newFilePath), java.nio.file.Files.readAllBytes(newFile.toPath())); imported.add( new StringBuilder() .append(fileSystem.getName()) .append(newFilePath) .toString()); fireEvent(newFile, tempPath, uri, newFilePath); } } FileUtils.deleteDirectory(destDir); return imported; }
Source:
<code>public boolean hasNextAvailable(int timeout, TimeUnit timeUnit) { checkExceptionState(); long deadline = System.currentTimeMillis() + timeUnit.toMillis(timeout); try { do { long waitTime = deadline - System.currentTimeMillis(); waitForData(waitTime); <START> } while (peekEvent == null && System.currentTimeMillis() < deadline); <END> return peekEvent != null; } catch (InterruptedException e) { logger.warn("Event consumer thread was interrupted. Returning thread to event processor.", e); Thread.currentThread().interrupt(); return false; } }</code><technical_language>Instead of checking a field (which is set in another method), I suggest calling peek(), knowledge of field more "local". prevent creation of Optional instances, create a private "peekNullable" (or name that) method, returns null. allow do ... while refactored a while, is generally considered cleaner: while (peekNullable() == null && System.currentTimeMillis() < deadline) { ... wait for data } return peekNullable() != null;</technical_language>

Target:
public boolean hasNextAvailable(int timeout, TimeUnit timeUnit) { long deadline = System.currentTimeMillis() + timeUnit.toMillis(timeout); try { while (peekNullable() == null && System.currentTimeMillis() < deadline) { lock.lock(); try { long waitTime = deadline - System.currentTimeMillis(); if (peekNullable() == null && waitTime > 0) { boolean await = dataAvailable.await(Math.min(waitTime, MAX_AWAIT_AVAILABLE_DATA), TimeUnit.MILLISECONDS); logger.trace(await ? "Signaled new events are available" : "No signal received for new events, exiting await"); } } finally { lock.unlock(); } } return peekNullable() != null; } catch (InterruptedException e) { logger.warn("Event consumer thread was interrupted. Returning thread to event processor.", e); Thread.currentThread().interrupt(); return false; } }
Source:
<code>public void testParseLanguage() { String langs[] = { "rb", "groovy", "js", "py" }; Map<String, ScriptExecutingMessageProcessor> scriptProcessors = ctx .getBeansOfType(ScriptExecutingMessageProcessor.class); assertEquals(4, scriptProcessors.size()); for (int i = 0; i < 4; i++) { <START> ScriptExecutingMessageProcessor ruby = ctx.getBean( <END> "org.springframework.integration.scripting.jsr223.ScriptExecutingMessageProcessor#" + i, ScriptExecutingMessageProcessor.class); AbstractScriptExecutor executor = (AbstractScriptExecutor) TestUtils.getPropertyValue(ruby, "scriptExecutor"); assertEquals(langs[i], executor.language); } }</code><technical_language>This variable ruby scriptprocessor :smiley: need a test wrong script language</technical_language>

Target:
public void testParseLanguage() { String langs[] = { "ruby", "Groovy", "ECMAScript", "python" }; Map<String, ScriptExecutingMessageProcessor> scriptProcessors = ctx .getBeansOfType(ScriptExecutingMessageProcessor.class); assertEquals(4, scriptProcessors.size()); for (int i = 0; i < 4; i++) { ScriptExecutingMessageProcessor processor = ctx.getBean( "org.springframework.integration.scripting.jsr223.ScriptExecutingMessageProcessor#" + i, ScriptExecutingMessageProcessor.class); AbstractScriptExecutor executor = (AbstractScriptExecutor) TestUtils.getPropertyValue(processor, "scriptExecutor"); assertEquals(langs[i], executor.language); } }
Source:
<code>public void initialize() { logger.debug("Initializing WeatherUnderground handler."); super.initialize(); WeatherUndergroundConfiguration config = getConfigAs(WeatherUndergroundConfiguration.class); logger.debug("config apikey = {}", config.apikey); logger.debug("config location = {}", config.location); logger.debug("config language = {}", config.language); logger.debug("config refresh = {}", config.refresh); boolean validConfig = true; if (StringUtils.trimToNull(config.apikey) == null) { logger.error("Parameter 'apikey' is mandatory and must be configured, disabling thing '{}'", getThing().getUID()); <START> validConfig = false; <END> } if (StringUtils.trimToNull(config.location) == null) { logger.error("Parameter 'location' is mandatory and must be configured, disabling thing '{}'", getThing().getUID()); validConfig = false; } if (config.language != null) { String lang = StringUtils.trimToEmpty(config.language); if (lang.length() != 2) { logger.error("Parameter 'language' must be 2 letters, disabling thing '{}'", getThing().getUID()); validConfig = false; } } if (config.refresh != null && config.refresh < 5) { logger.error("Parameter 'refresh' must be at least 5 minutes, disabling thing '{}'", getThing().getUID()); validConfig = false; } if (validConfig) { startAutomaticRefresh(); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR); } }</code><technical_language>debugging this stuff I useful do a updateStatus a text string errors config failed. page binding I wrong, a lot easier for user need dig log files find issue</technical_language>

Target:
public void initialize() { logger.debug("Initializing WeatherUnderground handler."); WeatherUndergroundConfiguration config = getConfigAs(WeatherUndergroundConfiguration.class); logger.debug("config apikey = {}", config.apikey); logger.debug("config location = {}", config.location); logger.debug("config language = {}", config.language); logger.debug("config refresh = {}", config.refresh); boolean validConfig = true; String errors = ""; if (StringUtils.trimToNull(config.apikey) == null) { errors += " Parameter 'apikey' must be configured."; validConfig = false; } if (StringUtils.trimToNull(config.location) == null) { errors += " Parameter 'location' must be configured."; validConfig = false; } if (config.language != null) { String lang = StringUtils.trimToEmpty(config.language); if (lang.length() != 2) { errors += " Parameter 'language' must be 2 letters."; validConfig = false; } } if (config.refresh != null && config.refresh < 5) { errors += " Parameter 'refresh' must be at least 5 minutes."; validConfig = false; } errors = errors.trim(); if (validConfig) { startAutomaticRefresh(); } else { logger.debug("Disabling thing '{}': {}", getThing().getUID(), errors); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, errors); } }
Source:
<code>private void checkUpdateReportsPanel(final String url, final Map<String, List<String>> params) { if (errorPopupManager == null) { <START> errorPopupManager = (ErrorPopupManager) TypeResolver.getInstance().resolve(ErrorPopupManager.class); <END> } if (applicationConstants == null) { applicationConstants = GWT.create(ApplicationConstants.class); } RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, buildStatusUrl(url)); try { requestBuilder.setTimeoutMillis(1000); requestBuilder.sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } @Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK && response.getText().trim().equals(REPORTS_WEBAPP_DEPLOYED_MSG)) { reportsWebappDeployed = true; getView().updateReportsPanel(url, params); } else { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } } }); } catch (RequestException e) { errorPopupManager.show(applicationConstants.reportsWebAppErrorMsg()); } }</code><technical_language>inject in ctor mark field final</technical_language>

Target:
private void checkUpdateReportsPanel(final String url, final Map<String, List<String>> params) { RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, buildStatusUrl(url)); try { requestBuilder.setTimeoutMillis(1000); requestBuilder.sendRequest(null, new RequestCallback() { @Override public void onError(Request request, Throwable exception) { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } @Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == Response.SC_OK && response.getText().trim().equals(REPORTS_WEBAPP_DEPLOYED_MSG)) { reportsWebappDeployed = true; getView().updateReportsPanel(url, params); } else { errorPopupManager.show(applicationConstants.reportsWebAppNotDeployedMsg()); } } }); } catch (RequestException e) { errorPopupManager.show(applicationConstants.reportsWebAppErrorMsg()); } }
Source:
<code>public RequestBuilder buildRequest(Api api) { final RequestBuilder req = api.action("query") .param("prop", "pageprops|pageimages") .param("ppprop", "wikibase_item") .param("generator", "search") .param("gsrsearch", searchTerm) .param("gsrnamespace", "0") .param("gsrwhat", "text") .param("gsrinfo", "") .param("gsrprop", "redirecttitle") .param("gsrlimit", NUM_RESULTS_PER_QUERY) .param("list", "search") .param("srsearch", searchTerm) .param("srnamespace", "0") .param("srwhat", "text") .param("srinfo", "suggestion") .param("srprop", "") .param("srlimit", NUM_RESULTS_PER_QUERY) .param("piprop", "thumbnail") .param("pithumbsize", Integer.toString(WikipediaApp.PREFERRED_THUMB_SIZE)) .param("pilimit", NUM_RESULTS_PER_QUERY); if (continueOffset != null) { req.param("continue", continueOffset.cont); <START> if (continueOffset.gsroffset > 0) { <END> req.param("sroffset", Integer.toString(continueOffset.sroffset)); } if (continueOffset.gsroffset > 0) { req.param("gsroffset", Integer.toString(continueOffset.gsroffset)); } } else { req.param("continue", ""); } return req; }</code><technical_language>this "sroffset"? ^</technical_language>

Target:
public RequestBuilder buildRequest(Api api) { final RequestBuilder req = api.action("query") .param("prop", "pageprops|pageimages") .param("ppprop", "wikibase_item") .param("generator", "search") .param("gsrsearch", searchTerm) .param("gsrnamespace", "0") .param("gsrwhat", "text") .param("gsrinfo", "") .param("gsrprop", "redirecttitle") .param("gsrlimit", NUM_RESULTS_PER_QUERY) .param("list", "search") .param("srsearch", searchTerm) .param("srnamespace", "0") .param("srwhat", "text") .param("srinfo", "suggestion") .param("srprop", "") .param("srlimit", NUM_RESULTS_PER_QUERY) .param("piprop", "thumbnail") .param("pithumbsize", Integer.toString(WikipediaApp.PREFERRED_THUMB_SIZE)) .param("pilimit", NUM_RESULTS_PER_QUERY); if (continueOffset != null) { req.param("continue", continueOffset.cont); if (continueOffset.sroffset > 0) { req.param("sroffset", Integer.toString(continueOffset.sroffset)); } if (continueOffset.gsroffset > 0) { req.param("gsroffset", Integer.toString(continueOffset.gsroffset)); } } else { req.param("continue", ""); } return req; }
Source:
<code>public ServiceResponse<SolverInstance> updateSolverState(String containerId, String solverId, SolverInstance instance) { checkMandatoryParameter( "ContainerID", containerId ); checkMandatoryParameter( "SolverId", solverId ); <START> checkMandatoryParameter( "instance", instance ); <END> if( config.isRest() ) { String uri = getURI( containerId, solverId ); return makeHttpPostRequestAndCreateServiceResponse( uri, instance, SolverInstance.class, getHeaders( instance ) ); } else { instance.setContainerId( containerId ); instance.setSolverId( solverId ); CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new UpdateSolverStateCommand( containerId, solverId, serialize( instance ) ) ) ); return (ServiceResponse<SolverInstance>) executeJmsCommand( script ).getResponses().get( 0 ); } }</code><technical_language>I SolverInstance need mandatory terminating solver. solution separate starting terminating of solvers separate client methods mandatory parameter validations</technical_language>

Target:
public ServiceResponse<SolverInstance> updateSolverState(String containerId, String solverId, SolverInstance instance) { checkMandatoryParameter( "ContainerID", containerId ); checkMandatoryParameter( "SolverId", solverId ); checkMandatoryParameter( "instance", instance ); if ( config.isRest() ) { String uri = getURI( containerId, solverId ); return makeHttpPostRequestAndCreateServiceResponse( uri, instance, SolverInstance.class, getHeaders( instance ) ); } else { instance.setContainerId( containerId ); instance.setSolverId( solverId ); CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new UpdateSolverStateCommand( containerId, solverId, serialize( instance ) ) ) ); ServiceResponse<SolverInstance> response = (ServiceResponse<SolverInstance>) executeJmsCommand( script, UpdateSolverStateCommand.class.getName(), KieServerConstants.CAPABILITY_BRP ).getResponses().get( 0 ); throwExceptionOnFailure( response ); return response; } }
Source:
<code>public boolean isEndOfInput() { <START> return responseComplete.get() && chunksToWrite.size() <= 0; <END> }</code><technical_language>of size of a queue possibly 0. Secondly, this method called chunksToWrite is empty, check is unnecessary</technical_language>

Target:
public boolean isEndOfInput() { return responseComplete.get() && !writeFuture.isDone() && chunksToWriteCount.get() == 0; }
Source:
<code>public boolean equals(Object obj) { if (obj instanceof Identity) { return getGuid().equals(((Identity<?>) obj).getGuid()); } <START> return false; <END> }</code><technical_language>Suggest return statement</technical_language>

Target:
public boolean equals(Object obj) { boolean equal = false; if (obj instanceof Identity) { Identity<T> identity = (Identity<T>) obj; if (getGuid() == identity.getGuid()) { equal = true; } equal = getGuid().equals(identity.getGuid()); } return equal; }
Source:
<code>public void testSslWithClientAuthenticationFailsWithoutProperServerTrustStore() { SslConfiguration serverConfig = SslConfiguration.of( TestConstants.SERVER_KEY_STORE_JKS_PATH, TestConstants.SERVER_KEY_STORE_JKS_PATH, TestConstants.SERVER_KEY_STORE_JKS_PASSWORD); SslConfiguration clientConfig = SslConfiguration.of( TestConstants.CA_TRUST_STORE_PATH, TestConstants.CLIENT_KEY_STORE_JKS_PATH, TestConstants.CLIENT_KEY_STORE_JKS_PASSWORD); assertThatThrownBy(() -> { runSslConnectionTest(serverConfig, clientConfig, ClientAuth.WITH_CLIENT_AUTH); }).isInstanceOfSatisfying(RuntimeException.class, ex -> { if (System.getProperty("java.version").startsWith("1.8")) { assertThat(ex).hasCauseInstanceOf(SSLHandshakeException.class).hasMessageContaining("bad_certificate"); } else { assertThat(ex.getCause()).isInstanceOfAny(SSLException.class, SSLHandshakeException.class); <START> assertThat(ex.getMessage()).contains("readHandshakeRecord", "certificate_unknown"); <END> } }); }</code><technical_language>This requires substrings present, want containsAny</technical_language>

Target:
public void testSslWithClientAuthenticationFailsWithoutProperServerTrustStore() { SslConfiguration serverConfig = SslConfiguration.of( TestConstants.SERVER_KEY_STORE_JKS_PATH, TestConstants.SERVER_KEY_STORE_JKS_PATH, TestConstants.SERVER_KEY_STORE_JKS_PASSWORD); SslConfiguration clientConfig = SslConfiguration.of( TestConstants.CA_TRUST_STORE_PATH, TestConstants.CLIENT_KEY_STORE_JKS_PATH, TestConstants.CLIENT_KEY_STORE_JKS_PASSWORD); assertThatThrownBy(() -> { runSslConnectionTest(serverConfig, clientConfig, ClientAuth.WITH_CLIENT_AUTH); }).isInstanceOfSatisfying(RuntimeException.class, ex -> { if (System.getProperty("java.version").startsWith("1.8")) { assertThat(ex).hasCauseInstanceOf(SSLHandshakeException.class).hasMessageContaining("bad_certificate"); } else { assertThat(ex.getCause()).isInstanceOfAny(SSLException.class, SSLHandshakeException.class); assertThat(ex.getMessage()).satisfiesAnyOf( message -> assertThat(message).contains("readHandshakeRecord"), message -> assertThat(message).contains("certificate_unknown")); } }); }
Source:
<code>public void resourceChanged(final IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); delta = delta.findMember(getFile().getFullPath()); IFile file = null; IPath newPath = null; <START> if (delta == null) return; <END> if (delta.getKind() == IResourceDelta.REMOVED) { if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) { newPath = delta.getMovedToPath(); } } if ((delta.getKind() == IResourceDelta.CHANGED)) { if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) { newPath = delta.getResource().getFullPath(); file = ResourcesPlugin.getWorkspace().getRoot().getFile(newPath); } } if (newPath != null) { file = ResourcesPlugin.getWorkspace().getRoot().getFile(newPath); } if (file != null) { synchronizeModelWithResource(file); } final AbstractEditorPage activePage = convertToAbstractEditorPage(getActivePageInstance()); if (activePage != null) { Display.getDefault().asyncExec(handlePageUpdate(activePage, file)); } }</code><technical_language>this return clause checked declare variables do need in return case</technical_language>

Target:
public void resourceChanged(final IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); delta = delta.findMember(getFile().getFullPath()); IFile file = null; IPath newPath = null; if (delta == null) return; if (delta.getKind() == IResourceDelta.REMOVED) { if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) { newPath = delta.getMovedToPath(); } } if ((delta.getKind() == IResourceDelta.CHANGED)) { if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) { newPath = delta.getResource().getFullPath(); file = ResourcesPlugin.getWorkspace().getRoot().getFile(newPath); } } if (newPath != null) { file = ResourcesPlugin.getWorkspace().getRoot().getFile(newPath); } if (file != null) { updateFileModelFromResource(file); } final AbstractEditorPage activePage = convertToAbstractEditorPage(getActivePageInstance()); if (activePage != null) { Display.getDefault().asyncExec(handlePageUpdate(activePage, file)); } }
Source:
<code>public static String setCredentials(final String hostName, String username, String password) { final HostnameRequirement requirement = new HostnameRequirement(hostName); if (!SystemCredentialsProvider.getInstance().getDomainCredentialsMap().containsKey(requirement)) { generateDomain(hostName); <START> } <END> String credentialsId; StandardUsernamePasswordCredentials newCredential = new UsernamePasswordCredentialsImpl( CredentialsScope.GLOBAL, credentialsId = UUID.randomUUID().toString(), "", username, password ); SystemCredentialsProvider.getInstance().getDomainCredentialsMap().get(requirement).add(newCredential); return credentialsId; }</code><technical_language>leave a space brace</technical_language>

Target:
public static String setCredentials(final String hostName, String username, String password) { List<DomainSpecification> domainSpecifications = new ArrayList<>(); domainSpecifications.add(new HostnameSpecification(hostName, null)); Domain domain = new Domain("Generated for " + hostName, "", domainSpecifications); SystemCredentialsProvider.getInstance().getDomainCredentialsMap().put(domain, new ArrayList<Credentials>()); String credentialsId; StandardUsernamePasswordCredentials newCredential = new UsernamePasswordCredentialsImpl( CredentialsScope.GLOBAL, credentialsId = UUID.randomUUID().toString(), "Generated for " + username, username, password ); SystemCredentialsProvider.getInstance().getDomainCredentialsMap().get(domain).add(newCredential); try { SystemCredentialsProvider.getInstance().save(); } catch (IOException ex) { LOGGER.log(Level.WARNING, "SystemCredentialsProvider instance save failed: ", ex); } return credentialsId; }
Source:
<code>public static ComponentURI of(CodeSystemURI codeSystemURI, short terminologyComponentId, String identifier) { <START> return new ComponentURI(codeSystemURI, terminologyComponentId, Strings.nullToEmpty(identifier)); <END> }</code><technical_language>Null empty call is bad here, null empty invalid values for identifier part. convert empty here, validate instead other factory method</technical_language>

Target:
public static ComponentURI of(CodeSystemURI codeSystemURI, short terminologyComponentId, String identifier) { return getOrCache(new ComponentURI(codeSystemURI, terminologyComponentId, identifier)); }
Source:
<code>public void testSendSerialData802ConnectionClosed() throws Exception { PowerMockito.doReturn(XBeeProtocol.RAW_802_15_4).when(xbeeDevice, "getXBeeProtocol"); PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_NOT_OPEN)).when(xbeeDevice, "sendXBeePacket", tx16Packet); PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_NOT_OPEN)).when(xbeeDevice, "sendXBeePacket", tx64Packet); try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { <START> xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); <END> fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } }</code><technical_language>I XBEE_64BIT_ADDRESS</technical_language>

Target:
public void testSendSerialData802ConnectionClosed() throws Exception { PowerMockito.doReturn(XBeeProtocol.RAW_802_15_4).when(xbeeDevice, "getXBeeProtocol"); Mockito.when(xbeeDevice.isOpen()).thenReturn(false); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx16 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } }
Source:
<code>public void invalidateSession( String subjectName, Function<Map<String, Object>, String> sessionSubjectExtractor) { final Optional<String> sessionIdOptional = getSessionAttributeMapsStream() .filter(e -> subjectName.equals(sessionSubjectExtractor.apply(e.getValue()))) <START> .map(e -> e.getKey()) <END> .findFirst(); if (sessionIdOptional.isPresent()) { idManager.invalidateSession(sessionIdOptional.get()); } }</code><technical_language>Replace Map.Entry::getKey</technical_language>

Target:
public void invalidateSession( String subjectName, Function<Map<String, Object>, String> sessionSubjectExtractor) { final Optional<String> sessionIdOptional = idManager .latestSessionAttributes .entrySet() .stream() .filter(e -> subjectName.equals(sessionSubjectExtractor.apply(e.getValue()))) .map(Map.Entry::getKey) .findFirst(); sessionIdOptional.ifPresent(idManager::invalidateSession); }
Source:
<code>public void test_attach_to_activated_cluster_with_offline_node() throws Exception { assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); <START> waitForPassives(1); <END> int activeId = findActive(1).getAsInt(); int passiveId = findPassives(1)[0]; stopNode(1, passiveId); startNode(1, 3); waitForDiagnostic(1, 3); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(1))); invokeConfigTool("attach", "-d", "localhost:" + getNodePort(1, activeId), "-s", "localhost:" + getNodePort(1, 3)); waitForPassive(1, 3); assertThat(getUpcomingCluster("localhost", getNodePort(1, activeId)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, activeId)).getNodeCount(), is(equalTo(3))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(3))); startNode(1, passiveId); waitForPassive(1, passiveId); assertThat(getUpcomingCluster("localhost", getNodePort(1, passiveId)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, passiveId)).getNodeCount(), is(equalTo(3))); }</code><technical_language>waitForNPassives is in setup right</technical_language>

Target:
public void test_attach_to_activated_cluster_with_offline_node() throws Exception { assertThat(getUpcomingCluster("localhost", getNodePort(1, 1)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 2)).getNodeCount(), is(equalTo(2))); int activeId = findActive(1).getAsInt(); int passiveId = findPassives(1)[0]; stopNode(1, passiveId); startNode(1, 3); waitForDiagnostic(1, 3); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(1))); invokeConfigTool("attach", "-d", "localhost:" + getNodePort(1, activeId), "-s", "localhost:" + getNodePort(1, 3)); waitForPassive(1, 3); assertThat(getUpcomingCluster("localhost", getNodePort(1, activeId)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, activeId)).getNodeCount(), is(equalTo(3))); assertThat(getUpcomingCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, 3)).getNodeCount(), is(equalTo(3))); startNode(1, passiveId); waitForPassive(1, passiveId); assertThat(getUpcomingCluster("localhost", getNodePort(1, passiveId)).getNodeCount(), is(equalTo(3))); assertThat(getRuntimeCluster("localhost", getNodePort(1, passiveId)).getNodeCount(), is(equalTo(3))); }
Source:
<code><START> private static void addToMap(long handle, @NonNull C4Replicator repl, @Nullable Object context) { <END> REVERSE_LOOKUP_TABLE.put(handle, repl); CONTEXT_TO_C4_REPLICATOR_MAP.put(context, repl); }</code><technical_language>If context is null, I need add null key replicator CONTEXT_TO_C4_REPLICATOR_MAP</technical_language>

Target:
private static void addToMap(long handle, @NonNull C4Replicator repl, @Nullable Object context) { REVERSE_LOOKUP_TABLE.put(handle, repl); if (context != null) { CONTEXT_TO_C4_REPLICATOR_MAP.put(context, repl); } }
Source:
<code>private void configureRequestLogger() { boolean httpCacheEnabled = jettySettings.getBoolean("http.cache.sizeInMB") != null; <START> boolean structuredLogEnabled = ofNullable(jettySettings.getBoolean("log.requests.structured")).orElse(Boolean.FALSE); <END> server.setRequestLog(structuredLogEnabled ? new StructuredRequestLogger() : httpCacheEnabled ? new RequestWithCacheLogger() : new RequestLogger()); }</code><technical_language>Boolean.TRUE.equals(jettySettings.getBoolean("log.requests.structured"))</technical_language>

Target:
private void configureRequestLogger() { server.setRequestLog(new StructuredRequestLogger()); }
Source:
<code>protected void internalReceiveCommand(String itemName, Command command) { if (logger.isDebugEnabled()) { logger.debug("internalReceiveCommand({},{}) is called!", itemName, command); } SimpleBinaryBindingConfig config = items.get(itemName); if (config != null) { SimpleBinaryGenericDevice device = devices.get(config.device); if (device != null) { try { device.sendData(itemName, command, config); } catch (Exception ex) { <START> logger.error("internalReceiveCommand(): line:" + ex.getStackTrace()[0].getLineNumber() + "|method:" <END> + ex.getStackTrace()[0].getMethodName()); } } else { logger.warn("No device for item: {}", itemName); } } else { logger.warn("No config for item: {}", itemName); } }</code><technical_language>parameterized logging instead of string concatenation</technical_language>

Target:
protected void internalReceiveCommand(String itemName, Command command) { if (logger.isDebugEnabled()) { logger.debug("internalReceiveCommand({},{}) is called!", itemName, command); } SimpleBinaryBindingConfig config = items.get(itemName); if (config == null) { logger.warn("No config for item: {}", itemName); return; } if (logger.isDebugEnabled()) { logger.debug("Config: {}", config); } updateState(config, command); }
Source:
<code>public Token match(int ttype) throws RecognitionException { Token t = getCurrentToken(); if ( t.getType()==ttype ) { <START> if ( t.getType()==Token.EOF ) { <END> matchedEOF = true; } _errHandler.reportMatch(this); consume(); } else { t = _errHandler.recoverInline(this); if ( _buildParseTrees && t.getTokenIndex()==-1 ) { _ctx.addErrorNode(t); } } return t; }</code><technical_language>bulb: t.getType() replaced ttype for efficiency</technical_language>

Target:
public Token match(int ttype) throws RecognitionException { Token t = getCurrentToken(); if ( t.getType()==ttype ) { if ( ttype==Token.EOF ) { matchedEOF = true; } _errHandler.reportMatch(this); consume(); } else { t = _errHandler.recoverInline(this); if ( _buildParseTrees && t.getTokenIndex()==-1 ) { _ctx.addErrorNode(t); } } return t; }
Source:
<code>public String getMessage() { final StringBuilder sb = new StringBuilder(super.getMessage()); <START> for (final Throwable e : this.causes) { <END> sb.append(String.format("\n %s(%s)", e.getClass().getName(), e.getMessage())); } return sb.toString(); }</code><technical_language>I prefer if add final method arguments local variables. of Java8 variables effectively final default IDEA underline non-final variables. final keyword clutters code</technical_language>

Target:
public String getMessage() { return super.getMessage() + this.causes.stream() .map(e -> String.format(" %s(%s)", e.getClass().getName(), e.getMessage())) .collect(Collectors.joining("\n", "\n", "")); }
Source:
<code>public void cloneForRevision_shouldSetAllTheRelevantFields() throws Exception { Order newOrder = new Order(); OrderGroup orderGroup = new OrderGroup(); newOrder.setOrderGroup(orderGroup); Order revisedOrder = newOrder.cloneForRevision(); assertThatAllFieldsAreCopied(revisedOrder, "cloneForRevision", "creator", "dateCreated", "action", "changedBy", "dateChanged", "voided", "dateVoided", "voidedBy", "voidReason", "encounter", "orderNumber", "orderer", <START> "previousOrder", "dateActivated", "dateStopped", "accessionNumber", "orderGroup", "sortWeight"); <END> assertNull("Revised order should not have orderGroup", revisedOrder.getOrderGroup()); assertNull("Revised order should not have sortWeight", revisedOrder.getSortWeight()); }</code><technical_language>here, need undo this</technical_language>

Target:
public void cloneForRevision_shouldSetAllTheRelevantFields() throws Exception { Order newOrder = new Order(); OrderGroup orderGroup = new OrderGroup(); newOrder.setOrderGroup(orderGroup); Order revisedOrder = newOrder.cloneForRevision(); assertThatAllFieldsAreCopied(revisedOrder, "cloneForRevision", "creator", "dateCreated", "action", "changedBy", "dateChanged", "voided", "dateVoided", "voidedBy", "voidReason", "encounter", "orderNumber", "orderer", "previousOrder", "dateActivated", "dateStopped", "accessionNumber"); }
Source:
<code>private ServiceInfo getAssertionConsumerServiceInfoByIndex(Integer index) { return assertionConsumerServices .values() .stream() .filter(serviceInfo -> index.equals(serviceInfo.getIndex())) .filter(serviceInfo -> serviceInfo.getBinding() != null) <START> .filter(serviceInfo -> !serviceInfo.getBinding().equals(Binding.HTTP_REDIRECT)) <END> .filter(serviceInfo -> supportedBindings.contains(serviceInfo.getBinding())) .filter(serviceInfo -> IDP_SUPPORTED_BINDINGS.contains(serviceInfo.getBinding())) .findFirst() .orElse(null); }</code><technical_language>Comparing functionality this method other similar methods, filter condition is unique them. refactored to... java private ServiceInfo getAssertionConsumerServiceInfoByUrl(AuthnRequest request) { return getACS(s -> request.getAssertionConsumerServiceURL().equals(s.getUrl())); } private ServiceInfo getAssertionConsumerServiceInfoByIndex(Integer index) { return getACS(s -> index.equals(s.getIndex())); } private ServiceInfo getAssertionConsumerServiceInfoByProtocolBinding(AuthnRequest request) { return getACS(s -> Binding.from(request.getProtocolBinding()).equals(s.getBinding())); } private ServiceInfo getACS(Predicate<ServiceInfo> predicate) { return assertionConsumerServices .values() .stream() .filter(predicate) .filter(serviceInfo -> serviceInfo.getBinding() != null) .filter(serviceInfo -> !serviceInfo.getBinding().equals(Binding.HTTP_REDIRECT)) .filter(serviceInfo -> supportedBindings.contains(serviceInfo.getBinding())) .filter(serviceInfo -> IDP_SUPPORTED_BINDINGS.contains(serviceInfo.getBinding())) .findFirst() .orElse(null); }</technical_language>

Target:
private ServiceInfo getAssertionConsumerServiceInfoByIndex(Integer index) { return getACS(s -> index.equals(s.getIndex())); }
Source:
<code>public Block getBlock(int[] positions, int positionCount) { checkArgument(outputPositionCount > 0, "outputPositionCount must be greater than zero"); checkState(outputRequired, "This stream reader doesn't produce output"); checkState(positionCount <= outputPositionCount, "Not enough values"); if (positionCount == outputPositionCount) { if (allNulls) { return new RunLengthEncodedBlock(BOOLEAN.createBlockBuilder(null, 1).appendNull().build(), positionCount); } Block block = new ByteArrayBlock(positionCount, Optional.ofNullable(nulls), values); nulls = null; values = null; return block; } byte[] values = new byte[positionCount]; boolean[] nulls = null; if (this.nulls != null) { nulls = new boolean[positionCount]; } <START> <END> int positionIndex = 0; int nextPosition = positions[positionIndex]; for (int i = 0; i < outputPositionCount; i++) { if (outputPositions[i] < nextPosition) { continue; } assert outputPositions[i] == nextPosition; values[positionIndex] = this.values[i]; if (this.nulls != null) { nulls[positionIndex] = this.nulls[i]; } positionIndex++; if (positionIndex >= positionCount) { break; } nextPosition = positions[positionIndex]; } return new ByteArrayBlock(positionCount, Optional.ofNullable(nulls), values); }</code><technical_language>confusing give this name member variable</technical_language>

Target:
public Block getBlock(int[] positions, int positionCount) { checkArgument(outputPositionCount > 0, "outputPositionCount must be greater than zero"); checkState(outputRequired, "This stream reader doesn't produce output"); checkState(positionCount <= outputPositionCount, "Not enough values"); if (allNulls) { return new RunLengthEncodedBlock(BOOLEAN.createBlockBuilder(null, 1).appendNull().build(), outputPositionCount); } if (positionCount == outputPositionCount) { Block block = new ByteArrayBlock(positionCount, Optional.ofNullable(nulls), values); nulls = null; values = null; return block; } byte[] valuesCopy = new byte[positionCount]; boolean[] nullsCopy = null; if (nullsAllowed && presentStream != null) { nullsCopy = new boolean[positionCount]; } int positionIndex = 0; int nextPosition = positions[positionIndex]; for (int i = 0; i < outputPositionCount; i++) { if (outputPositions[i] < nextPosition) { continue; } assert outputPositions[i] == nextPosition; valuesCopy[positionIndex] = this.values[i]; if (nullsCopy != null) { nullsCopy[positionIndex] = this.nulls[i]; } positionIndex++; if (positionIndex >= positionCount) { break; } nextPosition = positions[positionIndex]; } return new ByteArrayBlock(positionCount, Optional.ofNullable(nullsCopy), valuesCopy); }
Source:
<code>public void chunkReceived(Request request, byte[] bs) { chunksReceived++; try { <START> fos.write(bs) ; <END> } catch (IOException e) { e.printStackTrace(); } outstanding.remove(request); }</code><technical_language>forgot seek</technical_language>

Target:
public void chunkReceived(Request request, byte[] bs) { chunksReceived++; try { raf.seek( request.start ); raf.write(bs) ; } catch (IOException e) { e.printStackTrace(); } outstanding.remove(request); }
Source:
<code>public Void visit(TermCons node, Void _void) { if (cache.containsKey(node)) return null; for (int i = 0, j = 0; i < node.getProduction().getItems().size(); i++) { if (node.getProduction().getItems().get(i) instanceof NonTerminal) { Term t = node.getContents().get(j); try { new CollectVariablesVisitor2(context, ((NonTerminal) node.getProduction().getItems().get(i)).getSort()).visitNode(t); } catch (ParseFailedException e) { e.printStackTrace(); } this.visitNode(t); j++; } else if (node.getProduction().getItems().get(i) instanceof UserList) { if (!node.isListTerminator()) { UserList ul = (UserList) node.getProduction().getItems().get(i); Term t1 = node.getContents().get(0); Term t2 = node.getContents().get(1); try { new CollectVariablesVisitor2(context, ul.getSort()).visitNode(t1); new CollectVariablesVisitor2(context, node.getProduction().getSort()).visitNode(t2); <START> } catch (ParseFailedException e) { <END> e.printStackTrace(); } this.visitNode(t1); this.visitNode(t2); } } } return super.visit(node, _void); }</code><technical_language>please remove this catch block</technical_language>

Target:
public Void visit(TermCons node, Void _void) { if (cache.containsKey(node)) return null; for (int i = 0, j = 0; i < node.getProduction().getItems().size(); i++) { if (node.getProduction().getItems().get(i) instanceof NonTerminal) { Term t = node.getContents().get(j); try { new CollectVariablesVisitor2(context, ((NonTerminal) node.getProduction().getItems().get(i)).getSort()).visitNode(t); } catch (ParseFailedException e) { e.printStackTrace(); } this.visitNode(t); j++; } else if (node.getProduction().getItems().get(i) instanceof UserList) { if (!node.isListTerminator()) { UserList ul = (UserList) node.getProduction().getItems().get(i); Term t1 = node.getContents().get(0); Term t2 = node.getContents().get(1); new CollectVariablesVisitor2(context, ul.getSort()).visitNode(t1); new CollectVariablesVisitor2(context, node.getProduction().getSort()).visitNode(t2); this.visitNode(t1); this.visitNode(t2); } } } return super.visit(node, _void); }
Source:
<code>public FactionDisplay(SolGame game, FactionInfo factionInfo) { dimensions = SolApplication.displayDimensions; cam = game.getCam(); info = factionInfo; <START> <END> }</code><technical_language>unnecessary space</technical_language>

Target:
public FactionDisplay(SolGame game, FactionInfo factionInfo) { cam = game.getCam(); info = factionInfo; }
Source:
<code>public RecoveryManager(Master master, long timeToCacheExistsInMillis) { this.master = master; existenceCache = CacheBuilder.newBuilder().expireAfterWrite(timeToCacheExistsInMillis, TimeUnit.MILLISECONDS) <START> .maximumWeight(10000000).weigher(new Weigher<Path,Boolean>() { @Override public int weigh(Path path, Boolean exist) { return path.toString().length(); } }).build(); <END> executor = Executors.newScheduledThreadPool(4, new NamingThreadFactory("Walog sort starter ")); zooCache = new ZooCache(); try { AccumuloConfiguration aconf = master.getConfiguration(); List<String> workIDs = new DistributedWorkQueue(ZooUtil.getRoot(master.getInstance()) + Constants.ZRECOVERY, aconf).getWorkQueued(); sortsQueued.addAll(workIDs); } catch (Exception e) { log.warn("{}", e.getMessage(), e); } }</code><technical_language>Weigher is a functional interface. a lambda here. Also, underscores number more readable: java .maximumWeight(10_000_000).weigher((path, exist) -> path.toString().length()).build();</technical_language>

Target:
public RecoveryManager(Master master, long timeToCacheExistsInMillis) { this.master = master; existenceCache = CacheBuilder.newBuilder().expireAfterWrite(timeToCacheExistsInMillis, TimeUnit.MILLISECONDS) .maximumWeight(10_000_000).weigher(new Weigher<Path,Boolean>() { @Override public int weigh(Path path, Boolean exist) { return path.toString().length(); } }).build(); executor = Executors.newScheduledThreadPool(4, new NamingThreadFactory("Walog sort starter ")); zooCache = new ZooCache(); try { AccumuloConfiguration aconf = master.getConfiguration(); List<String> workIDs = new DistributedWorkQueue(ZooUtil.getRoot(master.getInstance()) + Constants.ZRECOVERY, aconf).getWorkQueued(); sortsQueued.addAll(workIDs); } catch (Exception e) { log.warn("{}", e.getMessage(), e); } }
Source:
<code><START> public void shouldNotUnpausePipelineWhenPipelineIsAlreadyUnaused() throws Exception { <END> setUpValidPipelineWithAuth(); HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); when(pipelineDao.pauseState(VALID_PIPELINE)).thenReturn(new PipelinePauseInfo(false, "", VALID_USER.getUsername().toString())); pipelinePauseService.unpause(VALID_PIPELINE, VALID_USER, result); assertThat(result.isSuccessful(), is(false)); assertThat(result.httpCode(), is(412)); }</code><technical_language>Unaused => Unpaused</technical_language>

Target:
public void shouldNotUnpausePipelineWhenPipelineIsAlreadyUnaused() throws Exception { setUpValidPipelineWithAuth(); HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); when(pipelineDao.pauseState(VALID_PIPELINE)).thenReturn(new PipelinePauseInfo(false, "", VALID_USER.getUsername().toString())); pipelinePauseService.unpause(VALID_PIPELINE, VALID_USER, result); assertThat(result.isSuccessful(), is(false)); assertThat(result.httpCode(), is(409)); }
Source:
<code>public boolean isElementHasClass(String elementId, String targetClass) { try { <START> String classNames = browser.driver.findElement(By.id(elementId)).getAttribute("class"); <END> for (String className : classNames.split(" ")) { if (className.equals(targetClass)) { return true; } } return false; } catch (NoSuchElementException e) { return false; } }</code><technical_language>I By.cssSelector("#" + elementId + "." + targetClass)</technical_language>

Target:
public boolean isElementHasClass(String elementId, String targetClass) { List<WebElement> elementsMatched = browser.driver.findElements(By.cssSelector("#" + elementId + "." + targetClass)); return !elementsMatched.isEmpty(); }
Source:
<code>public CruiseConfig update(CruiseConfig cruiseConfig) { if (partial != null && fingerprint != null) { <START> cruiseConfig.getPartials().remove(resolver.findPartialByFingerprint(cruiseConfig, fingerprint)); <END> cruiseConfig.getPartials().add(CLONER.deepClone(partial)); for (PartialConfig partial : cruiseConfig.getPartials()) { for (EnvironmentConfig environmentConfig : partial.getEnvironments()) { if (!cruiseConfig.getEnvironments().hasEnvironmentNamed(environmentConfig.name())) { cruiseConfig.addEnvironment(new BasicEnvironmentConfig(environmentConfig.name())); } } for (PipelineConfigs pipelineConfigs : partial.getGroups()) { if (!cruiseConfig.getGroups().hasGroup(pipelineConfigs.getGroup())) { cruiseConfig.getGroups().add(new BasicPipelineConfigs(pipelineConfigs.getGroup(), new Authorization())); } } } } return cruiseConfig; }</code><technical_language>findPartialByFingerprint null. Is a problem? In some race condition maybe</technical_language>

Target:
public CruiseConfig update(CruiseConfig cruiseConfig) { if (partial != null && fingerprint != null) { PartialConfig config = resolver.findPartialByFingerprint(cruiseConfig, fingerprint); if (null != config) { cruiseConfig.getPartials().remove(config); } cruiseConfig.getPartials().add(CLONER.deepClone(partial)); for (PartialConfig partial : cruiseConfig.getPartials()) { for (EnvironmentConfig environmentConfig : partial.getEnvironments()) { if (!cruiseConfig.getEnvironments().hasEnvironmentNamed(environmentConfig.name())) { cruiseConfig.addEnvironment(new BasicEnvironmentConfig(environmentConfig.name())); } } for (PipelineConfigs pipelineConfigs : partial.getGroups()) { if (!cruiseConfig.getGroups().hasGroup(pipelineConfigs.getGroup())) { cruiseConfig.getGroups().add(new BasicPipelineConfigs(pipelineConfigs.getGroup(), new Authorization())); } } } } return cruiseConfig; }
Source:
<code>public void updateOptions(Options options) { options.addOption(Option.builder("l") .longOpt("log-name") .desc("Log name") .required() .hasArg() .argName("LOG_NAME") .build()); options.addOption( Option.builder("g").longOpt("group").desc("Consumer group").hasArg().argName("GROUP").build()); options.addOption(Option.builder("r") .longOpt("reset") .desc("Resets all committed positions for the group") .build()); options.addOption(Option.builder("e") .longOpt("to-end") .desc("Set the current position to the end for all partitions") .build()); options.addOption(Option.builder("t") .longOpt("to-timestamp") <START> .desc("Sets the current position to a message >= timestamp eg. " + Instant.now()) <END> .hasArg() .argName("TIMESTAMP") .build()); }</code><technical_language>a "record" instead of message</technical_language>

Target:
public void updateOptions(Options options) { options.addOption(Option.builder("l") .longOpt("log-name") .desc("Log name") .required() .hasArg() .argName("LOG_NAME") .build()); options.addOption( Option.builder("g").longOpt("group").desc("Consumer group").hasArg().argName("GROUP").build()); options.addOption(Option.builder() .longOpt("reset") .desc("Resets all committed positions for the group") .build()); options.addOption(Option.builder() .longOpt("to-end") .desc("Sets the committed positions to the end of partitions for the group") .build()); options.addOption(Option.builder() .longOpt("to-timestamp") .desc("Sets the committed positions for the group to a specific timestamp." + " The record timestamp used depends on the implementation, for Kafka this is the LogAppendTime. " + " The timestamp is specified in ISO-8601 format, eg. " + Instant.now() + ". If no record offset is found with an appropriate timestamp then the command fails.") .hasArg() .argName("TIMESTAMP") .build()); }