auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ImmutableList<SchedulePeriod> getRegularPeriods() { if (isTerm()) { return periods; } Optional<SchedulePeriod> initialStub = getInitialStub(); Optional<SchedulePeriod> finalStub = getFinalStub(); <START> if (initialStub.isPresent() && finalStub.isPresent()) { <END> return periods.subList(1, periods.size() - 1); } else if (initialStub.isPresent()) { return periods.subList(1, periods.size()); } else if (finalStub.isPresent()) { return periods.subList(0, periods.size() - 1); } else { return periods; } }</code><technical_language>in: int start = getInitialStub().isPresent() ? 1 : 0; int end = periods.size() - (getFinalStub().isPresent() ? 1 : 0); return periods.subList(start, end); If necessary, check if start end zero surprised if perf impact so</technical_language>

Target:
public ImmutableList<SchedulePeriod> getRegularPeriods() { if (isTerm()) { return periods; } int startStub = isInitialStub() ? 1 : 0; int endStub = isFinalStub() ? 1 : 0; return (startStub == 0 && endStub == 0 ? periods : periods.subList(startStub, periods.size() - endStub)); }
Source:
<code>public VnicProfile update(VnicProfile resource) { if (resource.isSetPassthrough()) { validateEnum(VnicPassthrough.class, resource.getPassthrough().toUpperCase()); <START> } <END> return performUpdate(resource, new QueryIdResolver<>(VdcQueryType.GetVnicProfileById, IdQueryParameters.class), VdcActionType.UpdateVnicProfile, new UpdateParametersProvider()); }</code><technical_language>This validation part of a new "VnicProfileValidator" class</technical_language>

Target:
public VnicProfile update(VnicProfile resource) { validateEnums(VnicProfile.class, resource); return performUpdate(resource, new QueryIdResolver<>(VdcQueryType.GetVnicProfileById, IdQueryParameters.class), VdcActionType.UpdateVnicProfile, new UpdateParametersProvider()); }
Source:
<code>public JavaLanguageExtensionServiceClient( RequestTransmitter requestTransmitter, RequestHandlerConfigurator configurator, RequestTransmitter transmitter, AppContext appContext, EventBus eventBus) { this.requestTransmitter = requestTransmitter; this.configurator = configurator; this.transmitter = transmitter; this.appContext = appContext; eventBus.addHandler( WorkspaceReadyEvent.getType(), e -> { subscribe(); hasJDTLSInstallerAdded = checkJDTLSInstaller(); <START> initializeJDTLS(); <END> }); }</code><technical_language>If want start jdt.ls soon workspace starts, do in wsagent. For example, current approach try initialize jdt.ls open IDE. If handle startup end, problems</technical_language>

Target:
public JavaLanguageExtensionServiceClient( RequestTransmitter requestTransmitter, RequestHandlerConfigurator configurator, RequestTransmitter transmitter, AppContext appContext, EventBus eventBus) { this.requestTransmitter = requestTransmitter; this.configurator = configurator; this.transmitter = transmitter; this.appContext = appContext; eventBus.addHandler(WorkspaceReadyEvent.getType(), e -> subscribe()); }
Source:
<code>public void attachContainer(String container, MessageProcessor<LogMessage> containerLogsProcessor, boolean stream) throws IOException { final List<Pair<String, ?>> headers = new ArrayList<>(2); <START> headers.add(Pair.of("Content-Type", "text/plain")); <END> headers.add(Pair.of("Content-Length", 0)); try (DockerConnection connection = openConnection(dockerDaemonUri).method("POST") .path("/containers/" + container + "/attach") .query("stream", (stream ? 1 : 0)) .query("logs", (stream ? 0 : 1)) .query("stdout", 1) .query("stderr", 1) .headers(headers)) { final DockerResponse response = connection.request(); final int status = response.getStatus(); if (200 != status) { throw new DockerException(getDockerExceptionMessage(response), status); } try (InputStream responseStream = response.getInputStream()) { new LogMessagePumper(responseStream, containerLogsProcessor).start(); } } }</code><technical_language>constant</technical_language>

Target:
public void attachContainer(String container, MessageProcessor<LogMessage> containerLogsProcessor, boolean stream) throws IOException { final List<Pair<String, ?>> headers = new ArrayList<>(2); headers.add(Pair.of("Content-Type", MediaType.TEXT_PLAIN)); headers.add(Pair.of("Content-Length", 0)); try (DockerConnection connection = openConnection(dockerDaemonUri).method("POST") .path("/containers/" + container + "/attach") .query("stream", (stream ? 1 : 0)) .query("logs", (stream ? 0 : 1)) .query("stdout", 1) .query("stderr", 1) .headers(headers)) { final DockerResponse response = connection.request(); final int status = response.getStatus(); if (OK.getStatusCode() != status) { throw new DockerException(getDockerExceptionMessage(response), status); } try (InputStream responseStream = response.getInputStream()) { new LogMessagePumper(responseStream, containerLogsProcessor).start(); } } }
Source:
<code>public Node getNodeByUniqueId(String nodeId) { Optional<Node> node = this.nodes.values().stream().filter(e -> e.getNodeUniqueId().equals(nodeId)).findFirst(); <START> return node.isPresent() ? node.get() : null; <END> }</code><technical_language>functional style expression like: suggestion return node.orElse(null);</technical_language>

Target:
public Node getNodeByUniqueId(String nodeId) { Optional<Node> node = this.nodes.values().stream().filter(e -> e.getNodeUniqueId().equals(nodeId)).findFirst(); return node.orElse(null); }
Source:
<code>public static AnnotationSpec get(Annotation annotation, boolean includeDefaultValues) { Builder builder = builder(annotation.annotationType()); try { Method[] methods = annotation.annotationType().getDeclaredMethods(); Arrays.sort(methods, new Comparator<Method>() { @Override public int compare(Method m1, Method m2) { return m1.getName().compareTo(m2.getName()); } }); for (Method method : methods) { Object value = method.invoke(annotation); if (!includeDefaultValues) { if (Objects.deepEquals(value, method.getDefaultValue())) { continue; } } if (value.getClass().isArray()) { for (int i = 0; i < Array.getLength(value); i++) { addAnnotationValue(builder, method.getName(), Array.get(value, i)); } continue; } if (value instanceof Annotation) { AnnotationSpec nested = get((Annotation) value); if (nested.members.isEmpty()) { builder.addMember(method.getName(), "@$T", nested.type); } else { <START> String s = nested.toString(); <END> s = s.substring(s.indexOf('(') + 1, s.lastIndexOf(')')); builder.addMember(method.getName(), "@$T($L)", nested.type, s); } continue; } addAnnotationValue(builder, method.getName(), value); } } catch (Exception e) { throw new RuntimeException("Reflecting " + annotation + " failed!", e); } return builder.build(); }</code><technical_language>able $L for nested annotation Work</technical_language>

Target:
public static AnnotationSpec get(Annotation annotation, boolean includeDefaultValues) { Builder builder = builder(annotation.annotationType()); try { Method[] methods = annotation.annotationType().getDeclaredMethods(); Arrays.sort(methods, new Comparator<Method>() { @Override public int compare(Method m1, Method m2) { return m1.getName().compareTo(m2.getName()); } }); for (Method method : methods) { Object value = method.invoke(annotation); if (!includeDefaultValues) { if (Objects.deepEquals(value, method.getDefaultValue())) { continue; } } if (value.getClass().isArray()) { for (int i = 0; i < Array.getLength(value); i++) { addAnnotationValue(builder, method.getName(), Array.get(value, i)); } continue; } if (value instanceof Annotation) { builder.addMember(method.getName(), "$L", get((Annotation) value)); continue; } addAnnotationValue(builder, method.getName(), value); } } catch (Exception e) { throw new RuntimeException("Reflecting " + annotation + " failed!", e); } return builder.build(); }
Source:
<code>private IStatus getErrorList(Map<String, MergeFailureReason> failingPaths) { MultiStatus result = new MultiStatus(Activator.getPluginId(), IStatus.ERROR, UIText.CherryPickHandler_CherryPickFailedMessage, null); for (String path : failingPaths.keySet()) { String reason = getReason(failingPaths.get(path)); <START> String errorMessage = path + SPACE + reason; <END> result.add(Activator.createErrorStatus(errorMessage)); } return result; }</code><technical_language>this concatenation language dependant a template parameters</technical_language>

Target:
private IStatus getErrorList(Map<String, MergeFailureReason> failingPaths) { MultiStatus result = new MultiStatus(Activator.getPluginId(), IStatus.ERROR, UIText.CherryPickHandler_CherryPickFailedMessage, null); for (String path : failingPaths.keySet()) { String reason = getReason(failingPaths.get(path)); String errorMessage = NLS.bind( UIText.CherryPickHandler_ErrorMsgTemplate, path, reason); result.add(Activator.createErrorStatus(errorMessage)); } return result; }
Source:
<code>public static Method getFunction(String functionName) { Method method = functionMap.get(functionName); if (method != null) { return method; } String nameLower = functionName.toLowerCase(Locale.US); if (nameLower == functionName) { return null; } method = functionMap.get(nameLower); if (method != null) { <START> if (functionMap.size() < 1000) { <END> functionMap.put(nameLower, method); } return method; } return null; }</code><technical_language>2 if statements collapsed single if block (ANDed together)</technical_language>

Target:
public static Method getFunction(String functionName) { return functionMap.get("sql" + functionName.toLowerCase(Locale.US)); }
Source:
<code>@Test void testOne() { DirectedGraph<String, DefaultEdge> g = DefaultDirectedGraph.create(); g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.addVertex("D"); g.addVertex("E"); g.addVertex("F"); g.addEdge("A", "B"); g.addEdge("B", "C"); g.addEdge("D", "C"); g.addEdge("C", "D"); g.addEdge("E", "F"); g.addEdge("C", "C"); assertEquals("[A, B, C, D]", shortestPath(g, "A", "D").toString()); g.addEdge("B", "D"); assertEquals("[A, B, D]", shortestPath(g, "A", "D").toString()); assertNull(shortestPath(g, "A", "E"), "There is no path from A to E"); assertEquals("[]", shortestPath(g, "D", "D").toString()); assertNull(shortestPath(g, "X", "A"), "Node X is not in the graph"); <START> assertEquals("[[A, B, D], [A, B, C, D]]", paths(g, "A", "D").toString()); <END> }</code><technical_language>tests for getShortestDistance()</technical_language>

Target:
@Test void testOne() { DirectedGraph<String, DefaultEdge> g = DefaultDirectedGraph.create(); g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.addVertex("D"); g.addVertex("E"); g.addVertex("F"); g.addEdge("A", "B"); g.addEdge("B", "C"); g.addEdge("D", "C"); g.addEdge("C", "D"); g.addEdge("E", "F"); g.addEdge("C", "C"); assertEquals("[A, B, C, D]", shortestPath(g, "A", "D").toString()); g.addEdge("B", "D"); assertEquals("[A, B, D]", shortestPath(g, "A", "D").toString()); assertNull(shortestPath(g, "A", "E"), "There is no path from A to E"); assertEquals("[D]", shortestPath(g, "D", "D").toString()); assertNull(shortestPath(g, "X", "A"), "Node X is not in the graph"); assertEquals("[[A, B, D], [A, B, C, D]]", paths(g, "A", "D").toString()); }
Source:
<code>public void addArgumentsToInstallFeatures(String repositoryLocation, String destination, String profile) { programArguments.add("-metadataRepository"); programArguments.add(repositoryLocation); programArguments.add("-artifactRepository"); programArguments.add(repositoryLocation); programArguments.add("-destination"); <START> programArguments.add(Paths.get(destination + File.separator + profile).toString()); <END> programArguments.add("-bundlepool"); programArguments.add(Paths.get(destination + File.separator + "lib").toString()); programArguments.add("-shared"); programArguments.add(Paths.get(destination + File.separator + "lib" + File.separator + "p2").toString()); programArguments.add("-profile"); programArguments.add(profile); programArguments.add("-profileProperties"); programArguments.add("org.eclipse.update.install.features=true"); programArguments.add("-roaming"); }</code><technical_language>omit File.separator pass destination profile arguments Paths.get()</technical_language>

Target:
public void addArgumentsToInstallFeatures(String repositoryLocation, String destination, String profile) { programArguments.add(P2Constants.Launcher.METADATA_REPOSITORY); programArguments.add(repositoryLocation); programArguments.add(P2Constants.Launcher.ARTIFACT_REPOSITORY); programArguments.add(repositoryLocation); programArguments.add(P2Constants.Launcher.DESTINATION); programArguments.add(Paths.get(destination, profile).toString()); programArguments.add(P2Constants.Launcher.BUNDLEPOOL); programArguments.add(Paths.get(destination, P2Constants.LIB).toString()); programArguments.add(P2Constants.Launcher.SHARED); programArguments.add(Paths.get(destination, P2Constants.LIB, P2Constants.P2).toString()); programArguments.add(P2Constants.Launcher.PROFILE); programArguments.add(profile); programArguments.add(P2Constants.Launcher.PROFILE_PROPERTIES); programArguments.add(P2Constants.Launcher.ECLIPSE_UPDATE_FEATURE_TRUE); programArguments.add(P2Constants.Launcher.ROAMING); }
Source:
<code>public void testJobStatuses() { MissionControlView view = jenkins.views.create(MissionControlView.class, "mission-control-sample-view"); view.configure(); view.setHideBuildHistory(false); view.setHideJobs(false); view.save(); view.reloadConfiguration(); String strJobNotBuild = "simple-job-not-build"; String strBuildSuccess = "simple-job-success"; String strBuildFailed = "simple-job-failed"; FreeStyleJob jobNotBuild = jenkins.jobs.create(FreeStyleJob.class, strJobNotBuild); FreeStyleJob jobSuccess = jenkins.jobs.create(FreeStyleJob.class, strBuildSuccess); jobSuccess.startBuild().waitUntilFinished(); FreeStyleJob jobFailed = jenkins.jobs.create(FreeStyleJob.class, strBuildFailed); jobFailed.configure(); jobFailed.addShellStep("sh <"); jobFailed.save(); jobFailed.startBuild().waitUntilFinished(); view.open(); WebElement jobContainer = driver.findElement(By.id("jenkinsJobStatuses")); <START> WebElement btnNotBuild = jobContainer.findElement(By.xpath(" END> assertThat(btnNotBuild.getAttribute("class"), containsString("invert-text-color")); WebElement btnBuildSuccess = jobContainer.findElement(By.xpath(" assertThat(btnBuildSuccess.getAttribute("class"), containsString("btn-success")); WebElement btnBuildFailed = jobContainer.findElement(By.xpath(" assertThat(btnBuildFailed.getAttribute("class"), containsString("btn-danger")); }</code><technical_language>Extract method parameter name</technical_language>

Target:
public void testJobStatuses() { MissionControlView view = jenkins.views.create(MissionControlView.class, "mission-control-sample-view"); view.configure(); view.setHideBuildHistory(false); view.setHideJobs(false); view.save(); view.reloadConfiguration(); String strJobNotBuild = "simple-job-not-build"; String strBuildSuccess = "simple-job-success"; String strBuildFailed = "simple-job-failed"; FreeStyleJob jobNotBuild = jenkins.jobs.create(FreeStyleJob.class, strJobNotBuild); FreeStyleJob jobSuccess = jenkins.jobs.create(FreeStyleJob.class, strBuildSuccess); jobSuccess.startBuild().waitUntilFinished(); FreeStyleJob jobFailed = jenkins.jobs.create(FreeStyleJob.class, strBuildFailed); jobFailed.configure(); jobFailed.addShellStep("sh <"); jobFailed.save(); jobFailed.startBuild().waitUntilFinished(); view.open(); assertThat(view.getJobStatusArea().getStatusOfJob(strJobNotBuild), containsString("invert-text-color")); assertThat(view.getJobStatusArea().getStatusOfJob(strBuildSuccess), containsString("success")); assertThat(view.getJobStatusArea().getStatusOfJob(strBuildFailed), containsString("danger")); }
Source:
<code>public boolean verify(JComponent jComponent) { if(jComponent instanceof JTextComponent) { <START> String value = ((JTextField) jComponent).getText(); <END> try { getValue(value); return true; } catch (ParseException ex) { LOGGER.error(I18N.tr("The entered value cannot be parsed"),ex); return false; } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(),ex); return false; } } else { throw new IllegalArgumentException("This verifier is only valid on Text field component"); } }</code><technical_language>If jComponent is instance of JEditorPane, obtain a ClassCastException here. Moreover, getText() valid JTextComponent</technical_language>

Target:
public boolean verify(JComponent jComponent) { if(jComponent instanceof JTextComponent) { String value = ((JTextComponent) jComponent).getText(); try { getValue(value); return true; } catch (ParseException ex) { LOGGER.error(I18N.tr("The entered value cannot be parsed"),ex); return false; } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(),ex); return false; } } else { throw new IllegalArgumentException("This verifier is only valid on Text field component"); } }
Source:
<code>public int generateReport(List<Path> resultsPaths, Path reportPath) throws IOException { if (notExists()) { throw new FileNotFoundException("Can't find allure installation"); } if (Files.exists(reportPath)) { FileUtils.deleteDirectory(reportPath.toFile()); } CommandLine commandLine = new CommandLine(getAllureExecutablePath().toAbsolutePath().toFile()); commandLine.addArgument("generate"); commandLine.addArgument("--clean"); for (Path resultsPath : resultsPaths) { commandLine.addArgument(resultsPath.toAbsolutePath().toString(), true); } commandLine.addArgument("-o"); commandLine.addArgument(reportPath.toAbsolutePath().toString(), true); <START> DefaultExecutor executor = new DefaultExecutor(); <END> ExecuteWatchdog watchdog = new ExecuteWatchdog(60000); executor.setWatchdog(watchdog); executor.setExitValue(0); return executor.execute(commandLine); }</code><technical_language>remove duplicate code</technical_language>

Target:
public int generateReport(List<Path> resultsPaths, Path reportPath) throws IOException { this.checkAllureExists(); FileUtils.deleteQuietly(reportPath.toFile()); CommandLine commandLine = new CommandLine(getAllureExecutablePath().toAbsolutePath().toFile()); commandLine.addArgument("generate"); commandLine.addArgument("--clean"); for (Path resultsPath : resultsPaths) { commandLine.addArgument(resultsPath.toAbsolutePath().toString(), true); } commandLine.addArgument("-o"); commandLine.addArgument(reportPath.toAbsolutePath().toString(), true); return execute(commandLine); }
Source:
<code>public void update(OnmsTopologyUpdater updater, OnmsTopologyMessage message) throws OnmsTopologyException { if (!m_updatersMap.containsKey(updater.getProtocol())) { <START> throw new OnmsTopologyException("cannot update message with id: " + message.getMessagebody().getId() + ". Protocol not supported", updater.getProtocol(), message.getMessagestatus()); <END> } if ( m_updatersMap.get(updater.getProtocol()) != updater ) { throw new OnmsTopologyException("cannot update message with id: " + message.getMessagebody().getId() + ". updater not supported", updater.getProtocol(), message.getMessagestatus()); } synchronized (m_consumers) { m_consumers.stream(). filter(consumer -> consumer.getProtocols().contains(updater.getProtocol())). forEach(consumer -> consumer.consume(message)); } }</code><technical_language>want String.format(...) instead</technical_language>

Target:
public void update(OnmsTopologyUpdater updater, OnmsTopologyMessage message) throws OnmsTopologyException { if (!m_updatersMap.containsKey(updater.getProtocol())) { throw new OnmsTopologyException(String.format("cannot update message with id: %s. Protocol not supported", message.getMessagebody().getId()), updater.getProtocol(), message.getMessagestatus()); } if ( m_updatersMap.get(updater.getProtocol()) != updater ) { throw new OnmsTopologyException(String.format("cannot update message with id: %s. Protocol not supported", message.getMessagebody().getId()), updater.getProtocol(), message.getMessagestatus()); } synchronized (m_consumers) { m_consumers.stream(). filter(consumer -> consumer.getProtocols().contains(updater.getProtocol())). forEach(consumer -> consumer.consume(message)); } }
Source:
<code>public void function_star_args(){ setRootRule(PythonGrammar.TYPEDARGSLIST); assertThat(p).matches("*, foo=bar"); assertThat(p).matches("*args, boo"); assertThat(p).notMatches("*, boo"); assertThat(p).notMatches("*"); <START> assertThat(p).notMatches("**"); <END> }</code><technical_language>@d3matt match: p = 42, **kargs *, p, **kargs p = 1, p2, *, ** kargs</technical_language>

Target:
public void function_star_args(){ setRootRule(PythonGrammar.TYPEDARGSLIST); assertThat(p).matches("*, foo=bar"); assertThat(p).matches("*args, boo"); assertThat(p).matches("p=42, ** kargs"); assertThat(p).matches("*, p, ** kargs"); assertThat(p).matches("*, boo"); assertThat(p).notMatches("p = 1, p2, *, ** kargs"); assertThat(p).notMatches("*"); assertThat(p).notMatches("**"); }
Source:
<code>public void setup() { when(filterSettingsManager.createFilterSettingsPrototype()).thenReturn(filterSettingsMock); doNothing().when(savedFilterEvent).fire(any()); <START> presenter = new AdvancedFiltersPresenter() { <END> }; presenter.setFilterSettingsManager(filterSettingsManager); presenter.setAdvancedFilterEditorView(advancedFilterEditorView); presenter.setSavedFilterSelectedEvent(savedFilterEvent); }</code><technical_language>_spy(AdvancedFiltersPresenter.class)_ instead of creating a class</technical_language>

Target:
public void setup() { when(filterSettingsManager.createFilterSettingsPrototype()).thenReturn(filterSettingsMock); doNothing().when(savedFilterEvent).fire(any()); doNothing().when(notificationEvent).fire(any()); presenter = spy(AdvancedFiltersPresenter.class); presenter.setFilterSettingsManager(filterSettingsManager); presenter.setAdvancedFilterEditorView(advancedFilterEditorView); presenter.setSavedFilterSelectedEvent(savedFilterEvent); presenter.setNotificationEvent(notificationEvent); presenter.setPlaceManager(placeManagerMock); }
Source:
<code>static byte[] getHash(final ModelNode address) throws IOException { final ModelNode operation = new ModelNode(); operation.get(OP).set(READ_ATTRIBUTE_OPERATION); operation.get(OP_ADDR).set(address); operation.get(NAME).set(CONTENT); <START> final ModelNode result = executeOnMaster(operation); <END> return executeOnMaster(operation).get(0).get("hash").asBytes(); }</code><technical_language>"result" variable is removed too, right? Currently, executeOnMaster(operation) method is called ..</technical_language>

Target:
static byte[] getHash(final ModelNode address) throws IOException { final ModelNode operation = new ModelNode(); operation.get(OP).set(READ_ATTRIBUTE_OPERATION); operation.get(OP_ADDR).set(address); operation.get(NAME).set(CONTENT); return executeOnMaster(operation).get(0).get("hash").asBytes(); }
Source:
<code>public CompletableFuture<ClientResponse> run(byte[] jarfileBytes, String classesToDeleteSelector) { DrRoleType drRole = DrRoleType.fromValue(VoltDB.instance().getCatalogContext().getCluster().getDrrole()); boolean useDDLSchema = VoltDB.instance().getCatalogContext().cluster.getUseddlschema(); if (!allowPausedModeWork(false, isAdminConnection())) { return makeQuickResponse( ClientResponse.SERVER_UNAVAILABLE, "Server is paused and is available in read-only mode - please try again later."); } if (!useDDLSchema) { return makeQuickResponse( ClientResponse.GRACEFUL_FAILURE, "Cluster is configured to use @UpdateApplicationCatalog " + "to change application schema. Use of @UpdateClasses is forbidden."); } CatalogChangeResult ccr = null; try { ccr = prepareApplicationCatalogDiff("@UpdateClasses", jarfileBytes, classesToDeleteSelector, new String[0], null, false, drRole, useDDLSchema, false, getHostname(), getUsername()); } catch (PrepareDiffFailureException pe) { hostLog.info("A request to update the loaded classes has been rejected. More info returned to client."); return makeQuickResponse(pe.statusCode, pe.getMessage()); } if (ccr.upgradedFromVersion != null) { hostLog.info(String.format("In order to update the application catalog it was " + "automatically upgraded from version %s.", ccr.upgradedFromVersion)); } if (ccr.encodedDiffCommands.trim().length() == 0) { return makeQuickResponse(ClientResponseImpl.SUCCESS, "Catalog update with no changes was skipped."); } <START> printCatalogUpdateLog("@UpdateClasses"); <END> return callProcedure("@UpdateCore", ccr.encodedDiffCommands, ccr.catalogHash, ccr.catalogBytes, ccr.expectedCatalogVersion, ccr.deploymentString, ccr.tablesThatMustBeEmpty, ccr.reasonsForEmptyTables, ccr.requiresSnapshotIsolation ? 1 : 0, ccr.worksWithElastic ? 1 : 0, ccr.deploymentHash, ccr.requireCatalogDiffCmdsApplyToEE ? 1 : 0, ccr.hasSchemaChange ? 1 : 0, ccr.requiresNewExportGeneration ? 1 : 0); }</code><technical_language>want print message out finishes "prepareApplicationCatalogDiff"</technical_language>

Target:
public CompletableFuture<ClientResponse> run(byte[] jarfileBytes, String classesToDeleteSelector) throws Exception { if (!allowPausedModeWork(false, isAdminConnection())) { return makeQuickResponse( ClientResponse.SERVER_UNAVAILABLE, "Server is paused and is available in read-only mode - please try again later."); } boolean useDDLSchema = VoltDB.instance().getCatalogContext().cluster.getUseddlschema(); if (!useDDLSchema) { return makeQuickResponse( ClientResponse.GRACEFUL_FAILURE, "Cluster is configured to use @UpdateApplicationCatalog " + "to change application schema. Use of @UpdateClasses is forbidden."); } logCatalogUpdateInvocation("@UpdateClasses"); return updateApplication("@UpdateClasses", jarfileBytes, classesToDeleteSelector, new String[0], null, false, useDDLSchema); }
Source:
<code>public void addPageTerminalControl(ITerminalControl terminalControl) { fTerminalPageControls.add(terminalControl); if (fHistoryBuffer.size() > 0) { new WriteHistoryJob(terminalControl).schedule(); <START> } <END> }</code><technical_language>I if finish writing of history add new terminalControl fTerminalPageControls? get new output written page OutputReadJob WriteHistoryJob is finished</technical_language>

Target:
public void addPageTerminalControl(ITerminalControl terminalControl) { if (fHistoryBuffer.size() > 0) { new WriteHistoryJob(terminalControl).schedule(); } fTerminalPageControls.add(terminalControl); }
Source:
<code>public void setAddresses(String addresses) { <START> if (StringUtils.hasText(addresses)) { <END> Address[] addressArray = Address.parseAddresses(addresses); if (addressArray.length > 0) { if (addressArray.length == 1) { logger.warn("Cluster should have more than 1 host"); } this.addresses = addressArray; } } }</code><technical_language>@panchenko ! of thank for contribution! glad feedback community realy happy PRs :smile: honest I difference previous state. this change a fallback InetAddress: java if (host == null || host.length() == 0) { InetAddress[] ret = new InetAddress[1]; ret[0] = impl.loopbackAddress(); return ret; } I guees is localhost. Right ignore empty string, end with: java else { return new SimpleConnection(this.rabbitConnectionFactory.newConnection(this.executorService), this.closeTimeout); } com.rabbitmq.client.ConnectionFactory#DEFAULT_HOST = "localhost" well. So, goal do pursue this change</technical_language>

Target:
public void setAddresses(String addresses) { if (StringUtils.hasText(addresses)) { Address[] addressArray = Address.parseAddresses(addresses); if (addressArray.length > 0) { this.addresses = addressArray; return; } } logger.info("setAddresses() called with an empty value, will be using the host+port properties for connections"); this.addresses = null; }
Source:
<code>private IconTheme.JabRefIcons getIcon(EntryType type) { if (StandardEntryType.Book.equals(type)) { return IconTheme.JabRefIcons.BOOK; <START> } else if (Arrays.asList(StandardEntryType.InBook, StandardEntryType.InProceedings, StandardEntryType.InCollection).contains(type)) { <END> return IconTheme.JabRefIcons.OPEN_LINK; } return IconTheme.JabRefIcons.ARTICLE; }</code><technical_language>tobiasdiez converted stuff Enums (I code hand, be) , is more efficient EnumSet. for enums replace equals ==</technical_language>

Target:
private IconTheme.JabRefIcons getIcon(EntryType type) { EnumSet<StandardEntryType> crossRefTypes = EnumSet.of(StandardEntryType.InBook, StandardEntryType.InProceedings, StandardEntryType.InCollection); if (type == StandardEntryType.Book) { return IconTheme.JabRefIcons.BOOK; } else if (crossRefTypes.contains(type)) { return IconTheme.JabRefIcons.OPEN_LINK; } return IconTheme.JabRefIcons.ARTICLE; }
Source:
<code>public String getUsage() { StringBuilder help = new StringBuilder("Options:"); for(String arg : getUsageArguments()) { ParserArgument argument = this.arguments.get(arg); help.append( String.format( <START> "%n --%-30s%-60s", <END> arg + (argument.getType() != ArgumentType.no_argument ? "=[" + argument.getMetavar() + "]" : ""), argument.getHelp() ) ); } return String.format("%1$s%n%2$s%n%n%3$s%n%n%4$s", properties.getProperty( prefix + ".help.usage", (String)defaultProperties.get("help.usage") ), properties.getProperty( prefix + ".help.header", (String)defaultProperties.get("help.header") ), help.toString(), properties.getProperty( prefix + ".help.footer", (String)defaultProperties.get("help.footer") ) ); }</code><technical_language>please put new line end of line</technical_language>

Target:
public String getUsage() { StringBuilder help = new StringBuilder(String.format("Options:%n")); for(String arg : getUsageArguments()) { ParserArgument argument = this.arguments.get(arg); help.append( String.format( " --%-30s%-60s%n", arg + (argument.getType() != ArgumentType.no_argument ? "=[" + argument.getMetavar() + "]" : ""), argument.getHelp() ) ); } return String.format("%1$s%n%2$s%n%n%3$s%n%4$s%n", properties.getProperty( prefix + ".help.usage", (String)defaultProperties.get("help.usage") ), properties.getProperty( prefix + ".help.header", (String) defaultProperties.get("help.header") ), help.toString(), properties.getProperty( prefix + ".help.footer", (String) defaultProperties.get("help.footer") ) ); }
Source:
<code>public Map<?, ?> simpleSearch(String query, List<String> journalKeys, List<String> articleTypes, int start, int rows, SearchCriterion sortOrder, SearchCriterion dateRange, Map<String, String> rawQueryParams) throws IOException { List<NameValuePair> params = buildCommonParams(journalKeys, articleTypes, start, rows, sortOrder, dateRange, false, rawQueryParams); <START> buildSimpleSearchQuery(params, query); <END> return getRawResults(params); }</code><technical_language>I consider changing this method return params, instead of returning void. return type is void, feels ambiguous - I if params query is "built" move this method buildCommonParams buildFacetParams. I consider adding enum details types of searches do, SIMPLE_UNFACETED, SIMPLE_FACETED, AUTHOR_FACETED etc. simply pass this a parameter building methods, I if lead cleaner code in end..</technical_language>

Target:
public Map<?, ?> simpleSearch(String query, List<String> journalKeys, List<String> articleTypes, int start, int rows, SearchCriterion sortOrder, SearchCriterion dateRange, Map<String, String> rawQueryParams) throws IOException { List<NameValuePair> params = buildCommonParams(query, true, start, rows, sortOrder, false, rawQueryParams); setQueryFilters(params, journalKeys, articleTypes, new ArrayList<String>(), dateRange); return getRawResults(params); }
Source:
<code>public int getHeigth() { <START> return (int) settings.getDouble("SCREEN_HEIGHT") - 50; <END> }</code><technical_language>a double? method return int, integer setting, method changed return a double. <feature</technical_language>

Target:
public double getHeigth() { return settings.getDouble("SCREEN_HEIGHT") - 50; }
Source:
<code><START> public FetchHintsBuilder parse(JSONObject fetchHintsJson) { <END> if (fetchHintsJson != null) { this.includeAllProperties = fetchHintsJson.optBoolean("includeAllProperties", false); this.includeAllPropertyMetadata = fetchHintsJson.optBoolean("includeAllPropertyMetadata", false); this.includeHidden = fetchHintsJson.optBoolean("includeHidden", false); this.includeAllEdgeRefs = fetchHintsJson.optBoolean("includeAllEdgeRefs", false); this.includeOutEdgeRefs = fetchHintsJson.optBoolean("includeOutEdgeRefs", false); this.includeInEdgeRefs = fetchHintsJson.optBoolean("includeInEdgeRefs", false); this.includeEdgeLabelsAndCounts = fetchHintsJson.optBoolean("includeEdgeLabelsAndCounts", false); this.includeExtendedDataTableNames = fetchHintsJson.optBoolean("includeExtendedDataTableNames", false); if (fetchHintsJson.has("propertyNamesToInclude")) { this.propertyNamesToInclude = jsonArrayToSet(fetchHintsJson.getJSONArray("propertyNamesToInclude")); } if (fetchHintsJson.has("metadataKeysToInclude")) { this.metadataKeysToInclude = jsonArrayToSet(fetchHintsJson.getJSONArray("metadataKeysToInclude")); } if (fetchHintsJson.has("edgeLabelsOfEdgeRefsToInclude")) { this.edgeLabelsOfEdgeRefsToInclude = jsonArrayToSet(fetchHintsJson.getJSONArray("edgeLabelsOfEdgeRefsToInclude")); } } return this; }</code><technical_language>feeling this a a static method returns a new FetchHintsBuilder. weird create a builder, set some properties call parse wipe out</technical_language>

Target:
public static FetchHintsBuilder parse(JSONObject fetchHintsJson) { if (fetchHintsJson == null) { fetchHintsJson = new JSONObject(); } return new FetchHintsBuilder() .setIncludeAllProperties(fetchHintsJson.optBoolean("includeAllProperties", false)) .setIncludeAllPropertyMetadata(fetchHintsJson.optBoolean("includeAllPropertyMetadata", false)) .setIncludeHidden(fetchHintsJson.optBoolean("includeHidden", false)) .setIncludeAllEdgeRefs(fetchHintsJson.optBoolean("includeAllEdgeRefs", false)) .setIncludeOutEdgeRefs(fetchHintsJson.optBoolean("includeOutEdgeRefs", false)) .setIncludeInEdgeRefs(fetchHintsJson.optBoolean("includeInEdgeRefs", false)) .setIncludeEdgeLabelsAndCounts(fetchHintsJson.optBoolean("includeEdgeLabelsAndCounts", false)) .setIncludeExtendedDataTableNames(fetchHintsJson.optBoolean("includeExtendedDataTableNames", false)) .setPropertyNamesToInclude(fetchHintsJson.has("propertyNamesToInclude") ? jsonArrayToSet(fetchHintsJson.getJSONArray("propertyNamesToInclude")) : null) .setMetadataKeysToInclude(fetchHintsJson.has("metadataKeysToInclude") ? jsonArrayToSet(fetchHintsJson.getJSONArray("metadataKeysToInclude")) : null) .setEdgeLabelsOfEdgeRefsToInclude(fetchHintsJson.has("edgeLabelsOfEdgeRefsToInclude") ? jsonArrayToSet(fetchHintsJson.getJSONArray("edgeLabelsOfEdgeRefsToInclude")) : null); }
Source:
<code>public String testTransaction(int transactionCount, int timeoutCount) throws RemoteException, NamingException { TxTestUtil.checkTransactionExists(tm, false); for(int i = 1; i <= transactionCount; i++) { <START> boolean isTimeout = (timeoutCount - i >= 0) ? true : false; <END> runTransaction(isTimeout); } try { return TxTestUtil.getStatusAsString(txn.getStatus()); } catch (SystemException se) { throw new EJBException("Can't get status of transaction", se); } }</code><technical_language>simply? (timeoutCount - i >= 0) simpler: i <= timeoutCount in a simple test ver this</technical_language>

Target:
public String testTransaction(int transactionCount, int timeoutCount) throws RemoteException, NamingException, SystemException { TxTestUtil.checkTransactionExists(tm, false); for(int i = 1; i <= transactionCount; i++) { boolean isTimeout = (i <= timeoutCount); runTransaction(isTimeout); } return TxTestUtil.getStatusAsString(txn.getStatus()); }
Source:
<code>public boolean serviceCheck(String name, int code, String hostname, JSONArray tags) { logger.fine(String.format("Sending service check '%s' with status %s", name, code)); JSONObject payload = new JSONObject(); payload.put("check", name); payload.put("host_name", hostname); payload.put("timestamp", System.currentTimeMillis() / 1000); payload.put("status", code); if (tags != null) { logger.fine(tags.toString()); payload.put("tags", tags); } boolean status; try { status = post(payload, SERVICECHECK); <START> } catch (Exception e) { <END> logger.severe(e.toString()); status = false; } return status; }</code><technical_language>bubble exception if hit in post method. Is try block needed then</technical_language>

Target:
public boolean serviceCheck(String name, int code, String hostname, JSONArray tags) { logger.fine(String.format("Sending service check '%s' with status %s", name, code)); JSONObject payload = new JSONObject(); payload.put("check", name); payload.put("host_name", hostname); payload.put("timestamp", System.currentTimeMillis() / 1000); payload.put("status", code); if (tags != null) { logger.fine(tags.toString()); payload.put("tags", tags); } return post(payload, SERVICECHECK); }
Source:
<code>private void checkRetentionTime(final Errors errors, final EventTypeOptions options) { final Long retentionTime = options.getRetentionTime(); <START> if (retentionTime == null) { <END> options.setRetentionTime(defaultTopicRetentionMs); return; } if (retentionTime > maxTopicRetentionMs) { createError(errors, "can not be more than " + maxTopicRetentionMs); } else if (retentionTime < minTopicRetentionMs) { createError(errors, "can not be less than " + minTopicRetentionMs); } }</code><technical_language>If null please mark getter @Nullable</technical_language>

Target:
private void checkRetentionTime(final Errors errors, final EventTypeOptions options) { final Long retentionTime = options.getRetentionTime(); if (retentionTime != null) { if (retentionTime > maxTopicRetentionMs) { createError(errors, "can not be more than " + maxTopicRetentionMs); } else if (retentionTime < minTopicRetentionMs) { createError(errors, "can not be less than " + minTopicRetentionMs); } } }
Source:
<code><START> public ConcurrentMap<String, String> getSymbols() { <END> return symbols; }</code><technical_language>a return type of Map suffice? FitNesse is thread safe I expect change concurrent maps hash maps some time in future..</technical_language>

Target:
public Map<String, String> getSymbols() { return symbols; }
Source:
<code><START> public static <T extends @NonNull Enum<T>> getEnum() { <END> return null; }</code><technical_language>this declaration is missing return type, this fail parse... meant write: public static <T extends @NonNull Enum<T>> T getEnum() {</technical_language>

Target:
public static <T extends @NonNull Enum<T>> T getEnum() { return null; }
Source:
<code>private Map<String, ManagedConversation> getConversationMap() { checkIsAssociated(); checkContextInitialized(); R request = getRequest(); <START> Object attribute = getRequestAttribute(getRequest(), CONVERSATIONS_ATTRIBUTE_NAME); <END> if (attribute == null || !(attribute instanceof Map)) { throw ConversationLogger.LOG.unableToLoadConversations(CONVERSATIONS_ATTRIBUTE_NAME, attribute, request); } return cast(attribute); }</code><technical_language>reduntant getRequest() call</technical_language>

Target:
private Map<String, ManagedConversation> getConversationMap() { checkIsAssociated(); checkContextInitialized(); R request = getRequest(); Object attribute = getRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME); if (attribute == null || !(attribute instanceof Map)) { throw ConversationLogger.LOG.unableToLoadConversations(CONVERSATIONS_ATTRIBUTE_NAME, attribute, request); } return cast(attribute); }
Source:
<code>public JacksonAdapter() { simpleMapper = initializeObjectMapper(new ObjectMapper()); xmlMapper = initializeObjectMapper(new XmlMapper()); xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true); xmlMapper.setDefaultUseWrapper(false); ObjectMapper flatteningMapper = initializeObjectMapper(new ObjectMapper()) .registerModule(FlatteningSerializer.getModule(simpleMapper())) .registerModule(FlatteningDeserializer.getModule(simpleMapper())); mapper = initializeObjectMapper(new ObjectMapper()) .registerModule(AdditionalPropertiesSerializer.getModule(flatteningMapper)) .registerModule(AdditionalPropertiesDeserializer.getModule(flatteningMapper)) .registerModule(FlatteningSerializer.getModule(simpleMapper())) .registerModule(FlatteningDeserializer.getModule(simpleMapper())); <START> headerMapper = initializeHeaderMapper(new ObjectMapper()); <END> }</code><technical_language>jfyi do: headerMapper = simpleMapper .copy() .configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); <LINK_0></technical_language>

Target:
public JacksonAdapter() { simpleMapper = initializeObjectMapper(new ObjectMapper()); xmlMapper = initializeObjectMapper(new XmlMapper()); xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true); xmlMapper.setDefaultUseWrapper(false); ObjectMapper flatteningMapper = initializeObjectMapper(new ObjectMapper()) .registerModule(FlatteningSerializer.getModule(simpleMapper())) .registerModule(FlatteningDeserializer.getModule(simpleMapper())); mapper = initializeObjectMapper(new ObjectMapper()) .registerModule(AdditionalPropertiesSerializer.getModule(flatteningMapper)) .registerModule(AdditionalPropertiesDeserializer.getModule(flatteningMapper)) .registerModule(FlatteningSerializer.getModule(simpleMapper())) .registerModule(FlatteningDeserializer.getModule(simpleMapper())); headerMapper = simpleMapper .copy() .configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); }
Source:
<code>public CaseFileDataLogDeleteBuilderImpl inCaseDefId(String caseDefId) { if (checkIfNull(caseDefId)) { return (CaseFileDataLogDeleteBuilderImpl) this; } this.caseDefId = caseDefId; <START> return (CaseFileDataLogDeleteBuilderImpl) this; <END> }</code><technical_language>Please create a CaseFileDataLogDeleteBuilder interface for other Delete builders return interface here</technical_language>

Target:
public CaseFileDataLogDeleteBuilder inCaseDefId(String caseDefId) { if (checkIfNull(caseDefId)) { return this; } this.caseDefId = caseDefId; return this; }
Source:
<code>public ConlluSentence read() throws IOException { String sentence = sentenceStream.read(); if (sentence != null) { List<ConlluWordLine> wordLines = new ArrayList<>(); BufferedReader reader = new BufferedReader(new StringReader(sentence)); String line; while ((line = reader.readLine()) != null) { <START> if (line.trim().startsWith("#")) { <END> continue; } wordLines.add(new ConlluWordLine(line)); } return new ConlluSentence(wordLines); } return null; }</code><technical_language>invert if condition avoid continue; Change if (!line.trim().startsWith("#")) { wordLines.add(new ...) }</technical_language>

Target:
public ConlluSentence read() throws IOException { String sentence = sentenceStream.read(); if (sentence != null) { List<ConlluWordLine> wordLines = new ArrayList<>(); BufferedReader reader = new BufferedReader(new StringReader(sentence)); String line; while ((line = reader.readLine()) != null) { if (!line.trim().startsWith("#")) { wordLines.add(new ConlluWordLine(line)); } } return new ConlluSentence(wordLines); } return null; }
Source:
<code>public void setUp() throws Exception { super.setUp(); dao = prepareDAO(dbFacade.getStorageServerConnectionDao()); existingConnection = dao.get("0cc146e8-e5ed-482c-8814-270bc48c297f"); <START> existingNfsAutoConnection = dao.get("0cc146e8-e5ed-482c-8814-270bc48c2981"); <END> newServerConnection = new storage_server_connections(); newServerConnection.setid("0cc146e8-e5ed-482c-8814-270bc48c2980"); newServerConnection.setconnection(EXISTING_DOMAIN_STORAGE_NAME); }</code><technical_language>Consider FixturesTool class for new Guid</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); dao = prepareDAO(dbFacade.getStorageServerConnectionDao()); existingConnection = dao.get("0cc146e8-e5ed-482c-8814-270bc48c297f"); existingNfsAutoConnection = dao.get(FixturesTool.EXISTING_STORAGE_CONNECTION_NFS_AUTO_ID.toString()); newServerConnection = new storage_server_connections(); newServerConnection.setid("0cc146e8-e5ed-482c-8814-270bc48c2980"); newServerConnection.setconnection(EXISTING_DOMAIN_STORAGE_NAME); }
Source:
<code>protected void implementationSpecificPut(List<Metric> metrics, Set<String> scopeNames) { SystemAssert.requireArgument(metrics != null, "Metrics list cannot be null."); <START> SystemAssert.requireArgument(scopeNames != null, "Scope names list cannot be null."); <END> _logger.info("{} new metrics need to be indexed on ES.", metrics.size()); long start = System.currentTimeMillis(); List<List<MetricSchemaRecord>> fracturedList = _fracture(metrics); for(List<MetricSchemaRecord> records : fracturedList) { if(!records.isEmpty()) { _upsert(records); } } int count = 0; for(List<MetricSchemaRecord> records : fracturedList) { count += records.size(); } _monitorService.modifyCounter(MonitorService.Counter.SCHEMARECORDS_WRITTEN, count, null); _monitorService.modifyCounter(MonitorService.Counter.SCHEMARECORDS_WRITE_LATENCY, (System.currentTimeMillis() - start), null); _logger.info("{} new scopes need to be indexed on ES.", scopeNames.size()); start = System.currentTimeMillis(); List<List<ScopeOnlySchemaRecord>> fracturedScopesList = _fractureScopes(scopeNames); for(List<ScopeOnlySchemaRecord> records : fracturedScopesList) { if(!records.isEmpty()) { _upsertScopes(records); } } count = 0; for(List<ScopeOnlySchemaRecord> records : fracturedScopesList) { count += records.size(); } _monitorService.modifyCounter(MonitorService.Counter.SCOPENAMES_WRITTEN, count, null); _monitorService.modifyCounter(MonitorService.Counter.SCOPENAMES_WRITE_LATENCY, (System.currentTimeMillis() - start), null); }</code><technical_language>list ==> set</technical_language>

Target:
protected void implementationSpecificPut(List<Metric> metrics, Set<String> scopeNames) { SystemAssert.requireArgument(metrics != null, "Metrics list cannot be null."); SystemAssert.requireArgument(scopeNames != null, "Scope names set cannot be null."); _logger.info("{} new metrics need to be indexed on ES.", metrics.size()); long start = System.currentTimeMillis(); List<List<MetricSchemaRecord>> fracturedList = _fracture(metrics); for(List<MetricSchemaRecord> records : fracturedList) { if(!records.isEmpty()) { _upsert(records); } } int count = 0; for(List<MetricSchemaRecord> records : fracturedList) { count += records.size(); } _monitorService.modifyCounter(MonitorService.Counter.SCHEMARECORDS_WRITTEN, count, null); _monitorService.modifyCounter(MonitorService.Counter.SCHEMARECORDS_WRITE_LATENCY, (System.currentTimeMillis() - start), null); _logger.info("{} new scopes need to be indexed on ES.", scopeNames.size()); start = System.currentTimeMillis(); List<List<ScopeOnlySchemaRecord>> fracturedScopesList = _fractureScopes(scopeNames); for(List<ScopeOnlySchemaRecord> records : fracturedScopesList) { if(!records.isEmpty()) { _upsertScopes(records); } } count = 0; for(List<ScopeOnlySchemaRecord> records : fracturedScopesList) { count += records.size(); } _monitorService.modifyCounter(MonitorService.Counter.SCOPENAMES_WRITTEN, count, null); _monitorService.modifyCounter(MonitorService.Counter.SCOPENAMES_WRITE_LATENCY, (System.currentTimeMillis() - start), null); }
Source:
<code>public void run() { IterableStream<ServiceBusReceivedMessageContext> messages = receiver .receiveMessages(options.getMessagesToReceive()); <START> for (ServiceBusReceivedMessageContext messageContext : messages) { <END> receiver.complete(messageContext.getMessage().getLockToken()); } }</code><technical_language>If messages received, this pass. validate number of messages</technical_language>

Target:
public void run() { IterableStream<ServiceBusReceivedMessage> messages = receiver .receiveMessages(options.getMessagesToReceive()); int count = 0; for (ServiceBusReceivedMessage message : messages) { receiver.complete(message); ++count; } if (count <= 0) { throw logger.logExceptionAsWarning(new RuntimeException("Error. Should have received some messages.")); } }