auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean renameInConditionalBuildStep(Project<?,?> p, String oldName, String newName) { boolean changed = false; List<ConditionalBuilder> cbuilders = p.getBuildersList().getAll(ConditionalBuilder.class); for (ConditionalBuilder conditionalBuilder : cbuilders) { final List<BuildStep> cbs = conditionalBuilder.getConditionalbuilders(); for (BuildStep buildStep : cbs) { <START> if(buildStep instanceof TriggerBuilder) { <END> TriggerBuilder ctb = (TriggerBuilder)buildStep; if (ctb != null) { for (BuildTriggerConfig co : ctb.getConfigs()){ changed |= co.onJobRenamed(oldName, newName); } } } } } List<SingleConditionalBuilder> scb = p.getBuildersList().getAll(SingleConditionalBuilder.class); for (SingleConditionalBuilder singleConditionalBuilder : scb) { final BuildStep buildStep = singleConditionalBuilder.getBuildStep(); if(buildStep instanceof TriggerBuilder) { TriggerBuilder ctb = (TriggerBuilder)buildStep; if (ctb != null) { for (BuildTriggerConfig co : ctb.getConfigs()){ changed |= co.onJobRenamed(oldName, newName); } } } } return changed; }</code><technical_language>FYI: hudson.Util.filter is useful! This written this: for(TriggerBuilder ctb: Util.filter(cbs, TriggerBuilder.class) { ... }</technical_language>

Target:
private boolean renameInConditionalBuildStep(Project<?,?> p, String oldName, String newName) { boolean changed = false; final List<TriggerBuilder> containedBuilders = ConditionalBuildStepHelper.getContainedBuilders(p, TriggerBuilder.class); for (TriggerBuilder triggerBuilder : containedBuilders) { for (BuildTriggerConfig co : triggerBuilder.getConfigs()){ changed |= co.onJobRenamed(oldName, newName); } } return changed; }
Source:
<code>public String getObjectDescription(Object o) { Class<? extends LocationPoint> fcl = getFavoriteClass(); if(o!= null && fcl.isInstance(o)) { String desciption = ((FavouritePoint)o).getDescription() != null ? ((FavouritePoint)o).getDescription() : ""; <START> return getObjName() + " : " + ((LocationPoint)o).getName(view.getContext()) <END> + desciption; } return null; }</code><technical_language>a space description name</technical_language>

Target:
public String getObjectDescription(Object o) { Class<? extends LocationPoint> fcl = getFavoriteClass(); if(o!= null && fcl.isInstance(o)) { String desciption = ((FavouritePoint)o).getDescription() != null ? " " + ((FavouritePoint)o).getDescription() : ""; return getObjName() + ": " + ((LocationPoint)o).getName(view.getContext()) + desciption; } return null; }
Source:
<code>public float getHeightFactor(ITimeEvent event) { <START> int stateTableIndex = getStateTableIndex(event); <END> LinuxStateItem linuxStyle = null; if (stateTableIndex >= 0 && stateTableIndex < STATES.length) { linuxStyle = STATES[stateTableIndex]; } return linuxStyle != null ? linuxStyle.getHeightFactor() : super.getHeightFactor(event); }</code><technical_language>oups, new list event :p</technical_language>

Target:
public float getHeightFactor(ITimeEvent event) { int stateTableIndex = getStateTableIndex(event); LinuxStyle linuxStyle = null; if (stateTableIndex >= 0 && stateTableIndex < STATES.length) { linuxStyle = STYLE_LIST[stateTableIndex]; } return linuxStyle != null ? linuxStyle.getHeightFactor() : super.getHeightFactor(event); }
Source:
<code>public void init(Config config, TaskContext taskContext) { int numberOfTasks = taskContext.getSamzaContainerContext().taskNames.size(); this.rateLimiter = com.google.common.util.concurrent.RateLimiter.create( <START> targetRate / numberOfTasks); <END> }</code><technical_language>nit: log effective rate</technical_language>

Target:
public void init(Config config, TaskContext taskContext) { int effectiveRate = targetRate; if (taskContext != null) { effectiveRate /= taskContext.getSamzaContainerContext().taskNames.size(); LOGGER.info(String.format("Effective rate limit for task %s is %d", taskContext.getTaskName(), effectiveRate)); } this.rateLimiter = com.google.common.util.concurrent.RateLimiter.create(effectiveRate); }
Source:
<code>public Optional<ValueAndBound<T>> getValueForTimestamp(long timestamp) { SequenceAndValueAndBound<T> cachedReference = cache.get(); <START> if (cachedReference == null || cachedReference.bound() < timestamp) { <END> return store.getCoordinationValue() .filter(sequenceAndBound -> sequenceAndBound.bound() >= timestamp) .map(this::getCorrespondingValueFromStore); } return Optional.of(ImmutableValueAndBound.of(cachedReference.value(), cachedReference.bound())); }</code><technical_language>push this bounds logic SequenceAndBound object prevent mistakes - add some method contains(timestamp)</technical_language>

Target:
public Optional<ValueAndBound<T>> getValueForTimestamp(long timestamp) { ValueAndBound<T> cachedReference = cache.get(); if (cachedReference.bound() < timestamp) { return readLatestValueFromStore() .filter(valueAndBound -> valueAndBound.bound() >= timestamp); } return Optional.of(cachedReference); }
Source:
<code>public void shouldDeliverBatchInGivenTimePeriod() throws IOException { Topic topic = operations.buildTopic("deliverBatchInGivenTimePeriod", "topic"); <START> operations.createBatchSubscription(topic, HTTP_ENDPOINT_URL, LARGE_MESSAGE_TTL, LARGE_BATCH_SIZE, SMALL_BATCH_TIME, LARGE_BATCH_VOLUME); <END> remoteService.expectMessages(SINGLE_MESSAGE); publish(topic, SINGLE_MESSAGE); expectSingleBatch(SINGLE_MESSAGE); }</code><technical_language>repeating BIG_VALUES doesnt more readable.. a builder for batch subscription aply some defaults, values instead of consts</technical_language>

Target:
public void shouldDeliverBatchInGivenTimePeriod() throws IOException { Topic topic = operations.buildTopic("deliverBatchInGivenTimePeriod", "topic"); operations.createBatchSubscription(topic, HTTP_ENDPOINT_URL, buildBatchPolicy() .withBatchSize(100) .withBatchTime(1) .withBatchVolume(1024) .build()); remoteService.expectMessages(SINGLE_MESSAGE); publish(topic, SINGLE_MESSAGE); expectSingleBatch(SINGLE_MESSAGE); }
Source:
<code>private Dictionary<String, Object> populatePropertiesWithRequiredAttributes( final Dictionary<String, Object> properties, ConnectorId id) { Dictionary<String, Object> result = DictionaryUtils.copy(properties); for (Entry<String, Object> entry : DictionaryAsMap.wrap(properties).entrySet()) { result.put(entry.getKey(), entry.getValue()); } <START> result.put(Constants.ID_KEY, id.getDomainType()); <END> result.put(Constants.CONNECTOR_KEY, id.getConnectorType()); result.put(Constants.ID_KEY, id.toFullID()); return result; }</code><technical_language>this connector key? wondering..</technical_language>

Target:
private Dictionary<String, Object> populatePropertiesWithRequiredAttributes( final Dictionary<String, Object> properties, ConnectorId id) { Dictionary<String, Object> result = DictionaryUtils.copy(properties); for (Entry<String, Object> entry : DictionaryAsMap.wrap(properties).entrySet()) { result.put(entry.getKey(), entry.getValue()); } result.put(Constants.DOMAIN_KEY, id.getDomainType()); result.put(Constants.CONNECTOR_KEY, id.getConnectorType()); result.put(Constants.ID_KEY, id.toFullID()); return result; }
Source:
<code>private List<UserSession> searchSessions() { return genericSearch(getDbFacade().getEngineSessionDao(), <START> false).stream().map(this::injectSessionInfo) <END> .map(UserSession::new) .collect(Collectors.toList()); }</code><technical_language>this map replaced peek injectSessionInfo changed return 'void'</technical_language>

Target:
private List<UserSession> searchSessions() { return genericSearch(getDbFacade().getEngineSessionDao(), false).stream().peek(this::injectSessionInfo) .map(UserSession::new) .collect(Collectors.toList()); }
Source:
<code>private static void removeInMemoryData(Cache cache) { EmbeddedCacheManager mgr = cache.getCacheManager(); Address a = mgr.getAddress(); String str; if (a == null) str = "a non-clustered cache manager"; else str = "a cache manager at address " + a; log.debugf("Cleaning data for cache '%s' on %s", cache.getName(), str); DataContainer dataContainer = TestingUtil.extractComponent(cache, DataContainer.class); <START> if (log.isDebugEnabled()) log.debugf("removeInMemoryData(): dataContainerBefore == %d", dataContainer.size()); <END> dataContainer.clear(); if (log.isDebugEnabled()) log.debugf("removeInMemoryData(): dataContainerAfter == %d", dataContainer.size()); }</code><technical_language>"size before" sounds me</technical_language>

Target:
private static void removeInMemoryData(Cache cache) { EmbeddedCacheManager mgr = cache.getCacheManager(); Address a = mgr.getAddress(); String str; if (a == null) str = "a non-clustered cache manager"; else str = "a cache manager at address " + a; log.debugf("Cleaning data for cache '%s' on %s", cache.getName(), str); DataContainer dataContainer = TestingUtil.extractComponent(cache, DataContainer.class); if (log.isDebugEnabled()) log.debugf("Data container size before clear: %d", dataContainer.size()); dataContainer.clear(); }
Source:
<code>private static HandlerDecorator buildDecorator(Class<? extends HandlerDecorator> decoratorClass) { HandlerDecorator decorator; try { <START> decorator = decoratorClass.newInstance(); <END> } catch (InstantiationException | IllegalAccessException e) { throw new IllegalStateException("Decorator class " + decoratorClass + "cannot be instantiated", e); } return decorator; }</code><technical_language>FWIW, this method is deprecated: <LINK_0> consider Constructor.newInstance method instead</technical_language>

Target:
private static HandlerDecorator buildDecorator(Class<? extends HandlerDecorator> decoratorClass) { HandlerDecorator decorator; try { decorator = decoratorClass.getConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new IllegalStateException("Decorator class " + decoratorClass + "cannot be instantiated", e); } return decorator; }
Source:
<code>public Path run() { GoGoDuckModule module = GoGoDuckModule.newInstance(profile, indexReader, subset, userLog); Path tmpDir = null; try { tmpDir = Files.createTempDirectory(baseTmpDir, "gogoduck"); URIList URIList = module.getUriList(); enforceFileLimit(URIList, limit); downloadFiles(URIList, tmpDir); throwIfCancelled(); applySubsetMultiThread(tmpDir, module, threadCount); throwIfCancelled(); postProcess(tmpDir, module); throwIfCancelled(); aggregate(tmpDir, outputFile); throwIfCancelled(); updateMetadata(module, outputFile); throwIfCancelled(); <START> if (converter != null) { <END> Path outputPath = converter.convert(outputFile); outputFile = outputPath; mimeType = converter.getMimeType(); extension = converter.getExtension(); throwIfCancelled(); } userLog.log("Your aggregation was successful!"); } catch (Exception e) { userLog.log("Your aggregation failed!"); userLog.log(String.format("Reason for failure is: '%s'", e.getMessage())); logger.error(e.toString()); throw new GoGoDuckException(e.getMessage()); } finally { cleanTmpDir(tmpDir); userLog.close(); return outputFile; } }</code><technical_language>a for loop iterates converters, a converter != null thing..</technical_language>

Target:
public Path run() { GoGoDuckModule module = GoGoDuckModule.newInstance(profile, indexReader, subset, userLog); Path tmpDir = null; try { tmpDir = Files.createTempDirectory(baseTmpDir, "gogoduck"); URIList URIList = module.getUriList(); enforceFileLimit(URIList, limit); downloadFiles(URIList, tmpDir); throwIfCancelled(); applySubsetMultiThread(tmpDir, module, threadCount); throwIfCancelled(); postProcess(tmpDir, module); throwIfCancelled(); aggregate(tmpDir, outputFile); throwIfCancelled(); updateMetadata(module, outputFile); throwIfCancelled(); for (Converter converter : converters) { outputFile = converter.convert(outputFile); mimeType = converter.getMimeType(); extension = converter.getExtension(); throwIfCancelled(); } userLog.log("Your aggregation was successful!"); } catch (Exception e) { userLog.log("Your aggregation failed!"); userLog.log(String.format("Reason for failure is: '%s'", e.getMessage())); logger.error(e.toString()); throw new GoGoDuckException(e.getMessage()); } finally { cleanTmpDir(tmpDir); userLog.close(); return outputFile; } }
Source:
<code>private static Object measureServiceMethod( ServiceProcessorAdapter srvcProc, Service srvc, String srvcName, Method mtd, Object[] args ) throws InvocationTargetException, IllegalAccessException { long startTime = System.nanoTime(); try { return mtd.invoke(srvc, args); } finally { if (srvcProc instanceof IgniteServiceProcessor) { long duration = System.nanoTime() - startTime; HistogramMetricImpl histogram = ((IgniteServiceProcessor)srvcProc).histogram(srvcName, mtd); <START> assert histogram != null; <END> if (histogram != null) histogram.value(duration); } } }</code><technical_language>Do realy want this assertion? assertions enabled, this create some problems</technical_language>

Target:
private static Object measureServiceMethod( ServiceProcessorAdapter srvcProc, Service srvc, String srvcName, Method mtd, Object[] args ) throws InvocationTargetException, IllegalAccessException { long startTime = System.nanoTime(); try { return mtd.invoke(srvc, args); } finally { if (srvcProc instanceof IgniteServiceProcessor) { long duration = System.nanoTime() - startTime; HistogramMetricImpl histogram = ((IgniteServiceProcessor)srvcProc).histogram(srvcName, mtd); if (histogram != null) histogram.value(duration); } } }
Source:
<code>protected RedirectResult createSpecificRedirectResult() { <START> if (regkey == null && !isError) { <END> return createRedirectResult(Const.ActionURIs.STUDENT_HOME_PAGE); } else { RedirectResult redirect = createRedirectResult(Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE); if(student != null){ redirect.responseParams.put(Const.ParamsNames.STUDENT_EMAIL, student.email); redirect.responseParams.put(Const.ParamsNames.COURSE_ID, student.course); } redirect.responseParams.put(Const.ParamsNames.FEEDBACK_SESSION_NAME, getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME)); return redirect; } }</code><technical_language>'explaining variable' clarify regkey == null means. <LINK_0></technical_language>

Target:
protected RedirectResult createSpecificRedirectResult() { if(!isRegisteredStudent()){ return createRedirectResult(Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE); }else if(isError){ RedirectResult result = createRedirectResult(Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE); result.responseParams.put(Const.ParamsNames.COURSE_ID, student.course); result.responseParams.put(Const.ParamsNames.FEEDBACK_SESSION_NAME, getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME)); return result; }else { return createRedirectResult(Const.ActionURIs.STUDENT_HOME_PAGE); } }
Source:
<code>public void testThatSymbolicLinksAreResolved() { <START> Assume.assumeTrue(Platform.isMac()); <END> final String message = "Hello World"; final String file = "file.txt"; try { final Path tempDirectory = Files.createTempDirectory(Paths.get(System.getProperty("java.io.tmpdir")), "ds3"); final Path realDirectory = Files.createDirectory(Paths.get(tempDirectory.toString(), "dir")); final Path symbolicDirectory = Paths.get(tempDirectory.toString(), "symbolic"); Files.createSymbolicLink(symbolicDirectory, realDirectory); Files.createFile(Paths.get(realDirectory.toString(), file)); final ByteBuffer bb = ByteBuffer.wrap(message.getBytes()); final SeekableByteChannel getterChannel = new FileObjectGetter(symbolicDirectory).buildChannel(file); getterChannel.write(bb); getterChannel.close(); final String content = new String(Files.readAllBytes(Paths.get(realDirectory.toString(), file))); assertTrue(message.equals(content)); } catch (final IOException e) { fail("Symbolic links are not handled correctly"); } }</code><technical_language>want this run linux well</technical_language>

Target:
public void testThatSymbolicLinksAreResolved() { Assume.assumeFalse(Platform.isWindows()); final String message = "Hello World"; final String file = "file.txt"; try { final Path tempDirectory = Files.createTempDirectory(Paths.get(System.getProperty("java.io.tmpdir")), "ds3"); final Path realDirectory = Files.createDirectory(Paths.get(tempDirectory.toString(), "dir")); final Path symbolicDirectory = Paths.get(tempDirectory.toString(), "symbolic"); Files.createSymbolicLink(symbolicDirectory, realDirectory); Files.createFile(Paths.get(realDirectory.toString(), file)); final ByteBuffer bb = ByteBuffer.wrap(message.getBytes()); final SeekableByteChannel getterChannel = new FileObjectGetter(symbolicDirectory).buildChannel(file); getterChannel.write(bb); getterChannel.close(); final String content = new String(Files.readAllBytes(Paths.get(realDirectory.toString(), file))); assertTrue(message.equals(content)); } catch (final IOException e) { fail("Symbolic links are not handled correctly"); } }
Source:
<code>private static String getDependencyVersion(MavenProject mavenProject, String dependency) throws MojoExecutionException { if (mavenProject == null) { throw new MojoExecutionException("Unable to read maven project for finding dependencies."); } else { String dependencyVersion = null; <START> for (Artifact artifact : mavenProject.getDependencyArtifacts()) { <END> if (artifact.getArtifactId() != null && artifact.getArtifactId().contains(dependency)) { dependencyVersion = artifact.getBaseVersion(); break; } } return dependencyVersion; } }</code><technical_language>Need change java8 lambda expression</technical_language>

Target:
private static String getDependencyVersion(MavenProject mavenProject, String dependency) throws MojoExecutionException { if (mavenProject == null) { throw new MojoExecutionException("Unable to read maven project for finding dependencies."); } else if (dependency == null || dependency.isEmpty()) { throw new MojoExecutionException("Unable to find version for invalid dependency value."); } else { Artifact artifact = mavenProject.getDependencyArtifacts().stream(). filter(a -> a.getArtifactId().contains(dependency)).findFirst().orElse(null); if (artifact == null) { throw new MojoExecutionException("Unable to find version as there seems to be " + "no pom based configuration for the provided dependency."); } String dependencyVersion = artifact.getBaseVersion(); if (dependencyVersion == null || dependencyVersion.isEmpty()) { throw new MojoExecutionException("Unable to find version for the provided dependency."); } return dependencyVersion; } }
Source:
<code>public DefaultApiRequestAuthenticator(Application application, HttpRequest httpRequest) { Assert.notNull(application, "application argument cannot be null."); Assert.notNull(httpRequest, "httpRequest argument cannot be null."); this.application = application; if (HttpRequest.class.isAssignableFrom(httpRequest.getClass())) { <START> this.httpRequest = (HttpRequest) httpRequest; <END> } else { Assert.isInstanceOf(com.stormpath.sdk.impl.http.ServletHttpRequest.class, httpRequest, "The specified httpRequest argument must be an instance of " + HttpRequest.class.getName() + " or " + ServletHttpRequest.class.getName()); this.httpRequest = (ServletHttpRequest) httpRequest; } }</code><technical_language>unnecessary casting</technical_language>

Target:
public DefaultApiRequestAuthenticator(Application application, HttpRequest httpRequest) { Assert.notNull(application, "application argument cannot be null."); Assert.notNull(httpRequest, "httpRequest argument cannot be null."); this.application = application; if (HttpRequest.class.isAssignableFrom(httpRequest.getClass())) { this.httpRequest = httpRequest; } else { Assert.isInstanceOf(com.stormpath.sdk.impl.http.ServletHttpRequest.class, httpRequest, "The specified httpRequest argument must be an instance of " + HttpRequest.class.getName() + " or " + ServletHttpRequest.class.getName()); this.httpRequest = httpRequest; } }
Source:
<code>private void tryReopenClientConnection() throws IOException { if (writer == null) { LOG.debug("Trying to reopen stream writer ", streamName); try { createStreamClient(); } catch (IOException e) { LOG.error("Error during reopening client by name: for host: {}, port: {}. Reason: ", new Object[]{streamName, host, port, e.getMessage(), e}); <START> throw new IOException(e); <END> } } }</code><technical_language>I rethrow original exception, a new exception message</technical_language>

Target:
private void tryReopenClientConnection() throws IOException { if (writer == null) { LOG.debug("Trying to reopen stream writer ", streamName); try { createStreamClient(); } catch (IOException e) { LOG.error("Error during reopening client by name: for host: {}, port: {}. Reason: ", new Object[]{streamName, host, port, e.getMessage(), e}); throw e; } } }
Source:
<code>public void init(Shell splash) { super.init(splash); String progressString = null; String messageString = null; IProduct product = Platform.getProduct(); if(product != null) { progressString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); } Rectangle progressRect = StringConverter.asRectangle(progressString, new Rectangle(10, 300, 480, 15)); setProgressRect(progressRect); <START> Rectangle messageRect = StringConverter.asRectangle(messageString, new Rectangle(10, 280, 490, 0)); <END> setMessageRect(messageRect); try { setForeground(getSplash().getDisplay().getSystemColor(SWT.COLOR_WHITE).getRGB()); } catch(IllegalArgumentException e) { } getContent().addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.drawText( NLS.bind(Messages.SplahScreen_VersionString, TracingRcpPlugin.getDefault().getBundle().getVersion().toString()), VERSION_LOCATION.x, VERSION_LOCATION.y, true); } }); }</code><technical_language>messageString null here, is this purpose? If so, passing 'null' a parameter clearer</technical_language>

Target:
public void init(Shell splash) { super.init(splash); String progressString = null; String messageString = null; IProduct product = Platform.getProduct(); if(product != null) { progressString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); messageString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT); } Rectangle progressRect = StringConverter.asRectangle(progressString, new Rectangle(10, 300, 480, 15)); setProgressRect(progressRect); Rectangle messageRect = StringConverter.asRectangle(messageString, new Rectangle(10, 280, 490, 0)); setMessageRect(messageRect); try { setForeground(getSplash().getDisplay().getSystemColor(SWT.COLOR_WHITE).getRGB()); } catch(IllegalArgumentException e) { } getContent().addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.drawText( NLS.bind(Messages.SplahScreen_VersionString, TracingRcpPlugin.getDefault().getBundle().getVersion().toString()), VERSION_LOCATION.x, VERSION_LOCATION.y, true); } }); }
Source:
<code>public void processSoftwareCapabilities(VDS vds) { if (vds.getKvmEnabled() != null && vds.getKvmEnabled().equals(false) && vds.getStatus() != VDSStatus.NonOperational) { vdsNonOperational(vds, NonOperationalReason.KVM_NOT_RUNNING, null); vds.setStatus(VDSStatus.NonOperational); } <START> VDSGroup vdsGroup = DbFacade.getInstance().getVdsGroupDao().get(vds.getVdsGroupId()); <END> if (!hostCompliesWithClusterEmulationMode(vds, vdsGroup) && vds.getStatus() != VDSStatus.NonOperational) { Map<String, String> customLogValues = new HashMap<>(); customLogValues.put("hostSupportedEmulatedMachines", vds.getSupportedEmulatedMachines()); customLogValues.put("clusterEmulatedMachines", StringUtils.isEmpty(vdsGroup.getEmulatedMachine()) ? Config.<String>GetValue(ConfigValues.ClusterEmulatedMachines, vds.getVdsGroupCompatibilityVersion().getValue()) : vdsGroup.getEmulatedMachine()); vdsNonOperational(vds, NonOperationalReason.EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER, customLogValues); vds.setStatus(VDSStatus.NonOperational); } }</code><technical_language>this in "else" statement? Do support moving a host non-operational twice, showing reasons</technical_language>

Target:
public void processSoftwareCapabilities(VDS vds) { if (vds.getKvmEnabled() != null && vds.getKvmEnabled().equals(false) && vds.getStatus() != VDSStatus.NonOperational) { vdsNonOperational(vds, NonOperationalReason.KVM_NOT_RUNNING, null); vds.setStatus(VDSStatus.NonOperational); } VDSGroup vdsGroup = vdsGroupDao.get(vds.getVdsGroupId()); if (!hostCompliesWithClusterEmulationMode(vds, vdsGroup) && vds.getStatus() != VDSStatus.NonOperational) { Map<String, String> customLogValues = new HashMap<>(); customLogValues.put("hostSupportedEmulatedMachines", vds.getSupportedEmulatedMachines()); customLogValues.put("clusterEmulatedMachines", StringUtils.isEmpty(vdsGroup.getEmulatedMachine()) ? Config.<String>GetValue(ConfigValues.ClusterEmulatedMachines, vds.getVdsGroupCompatibilityVersion().getValue()) : vdsGroup.getEmulatedMachine()); vdsNonOperational(vds, NonOperationalReason.EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER, customLogValues); vds.setStatus(VDSStatus.NonOperational); } }
Source:
<code><START> public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { <END> ensureDirectory(); String name = getDirectory() + FILE_SEPARATOR + getFileName() + '.' + getFileExtension(); DateFormat dateFormat = new SimpleDateFormat(getFormat()); PrintWriter writer = null; try { writer = new PrintWriter(new BufferedWriter(new FileWriter(name))); writer.println(dateFormat.format(new Date())); } finally { if (writer != null) { writer.close(); } } return RepeatStatus.FINISHED; }</code><technical_language>throws needs based a specific exception</technical_language>

Target:
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws IOException { ensureDirectory(); String name = directory + FILE_SEPARATOR + fileName + '.' + fileExtension; DateFormat dateFormat = new SimpleDateFormat(format); PrintWriter writer = null; try { writer = new PrintWriter(new BufferedWriter(new FileWriter(name))); writer.println(dateFormat.format(new Date())); } finally { if (writer != null) { writer.close(); } } return RepeatStatus.FINISHED; }
Source:
<code>public void applyWritableMetadata(List<String> metadataKeys, DataType consumedDataType) { <START> this.consumedDataType = consumedDataType; <END> this.metadataKeys = metadataKeys; }</code><technical_language>remove consumedDataType is used</technical_language>

Target:
public void applyWritableMetadata(List<String> metadataKeys, DataType consumedDataType) { this.metadataKeys = metadataKeys; }
Source:
<code>void set(CommentLinkProcessor commentLinkProcessor, ChangeInfo change, String revision) { RevisionInfo revInfo = change.revision(revision); CommitInfo commit = revInfo.commit(); String sub = commit.subject(); String msg = commit.message(); if (msg.startsWith(sub)) { msg = msg.substring(sub.length()); if (msg.length() > 0 && msg.charAt(0) == '\n') { msg = msg.substring(1); } } <START> commitName.setText("Commit-Id: " + <END> revision); commitName.setPreviewText(revision); idText.setText("Change-Id: " + change.change_id()); idText.setPreviewText(change.change_id()); formatLink(commit.author(), authorNameEmail, authorDate, change.status()); formatLink(commit.committer(), committerNameEmail, committerDate, change.status()); text.setHTML(commentLinkProcessor.apply( new SafeHtmlBuilder().append(msg).linkify())); GitwebLink gw = Gerrit.getGitwebLink(); if (gw != null && gw.canLink(revInfo)) { browserLink.setInnerText(gw.getLinkName()); browserLink.setHref(gw.toRevision(change.project(), revision)); } else { UIObject.setVisible(browserLink, false); } }</code><technical_language>I this prefix is necessary. I suspect people want copy sha1 paste a command line</technical_language>

Target:
void set(CommentLinkProcessor commentLinkProcessor, ChangeInfo change, String revision) { RevisionInfo revInfo = change.revision(revision); CommitInfo commit = revInfo.commit(); String sub = commit.subject(); String msg = commit.message(); if (msg.startsWith(sub)) { msg = msg.substring(sub.length()); if (msg.length() > 0 && msg.charAt(0) == '\n') { msg = msg.substring(1); } } commitName.setText(revision); commitName.setPreviewText(revision); idText.setText("Change-Id: " + change.change_id()); idText.setPreviewText(change.change_id()); formatLink(commit.author(), authorNameEmail, authorDate, change.status()); formatLink(commit.committer(), committerNameEmail, committerDate, change.status()); text.setHTML(commentLinkProcessor.apply( new SafeHtmlBuilder().append(msg).linkify())); GitwebLink gw = Gerrit.getGitwebLink(); if (gw != null && gw.canLink(revInfo)) { browserLink.setInnerText(gw.getLinkName()); browserLink.setHref(gw.toRevision(change.project(), revision)); } else { UIObject.setVisible(browserLink, false); } }
Source:
<code>public void testGitHubBug207() throws Exception { String c = IOUtils.toString(this.getClass().getResourceAsStream("GitHubBug207.java"), <START> StandardCharsets.UTF_8); <END> parseJava18(c); }</code><technical_language>readAsString(...) instead</technical_language>

Target:
public void testGitHubBug207() { String c = readAsString("GitHubBug207.java"); parseJava18(c); }
Source:
<code>private ISYBindingConfig parseConfig(final Item item, final String bindingConfig) throws BindingConfigParseException { ISYNodeType type; String controller = null; String address = null; ISYControl command = null; if (item instanceof GroupItem) { type = ISYNodeType.GROUP; } else if (item instanceof ContactItem) { type = ISYNodeType.CONTACT; } else if (item instanceof NumberItem) { type = ISYNodeType.NUMBER; } else if (item instanceof StringItem) { type = ISYNodeType.STRING; } else if (item instanceof DimmerItem) { type = ISYNodeType.DIMMER; } else if (item instanceof DateTimeItem) { type = ISYNodeType.HEARTBEAT; } else { type = ISYNodeType.SWITCH; } String[] arr = bindingConfig.split(","); for (String str : arr) { String[] pair = str.split("="); String key = pair[0]; String value = pair[1]; switch (key) { case "ctrl": controller = value.replace('.', ' '); break; case "addr": address = value.replace('.', ' '); break; case "type": if ("thermostat".equalsIgnoreCase(value)) { type = ISYNodeType.THERMOSTAT; } <START> if ("lock".equalsIgnoreCase(value)) { <END> type = ISYNodeType.LOCK; } if ("heartbeat".equalsIgnoreCase(value)) { type = ISYNodeType.HEARTBEAT; } break; case "cmd": try { command = ISYControl.valueOf(value.toUpperCase()); } catch (IllegalArgumentException ie) { throw new BindingConfigParseException("Unsupported cmd " + value.toString()); } break; } } if (address == null) { address = controller; } return new ISYBindingConfig(item, type, controller, address, command); }</code><technical_language>else if</technical_language>

Target:
private ISYBindingConfig parseConfig(final Item item, final String bindingConfig) throws BindingConfigParseException { ISYNodeType type; String controller = null; String address = null; ISYControl command = null; if (item instanceof GroupItem) { type = ISYNodeType.GROUP; } else if (item instanceof ContactItem) { type = ISYNodeType.CONTACT; } else if (item instanceof NumberItem) { type = ISYNodeType.NUMBER; } else if (item instanceof StringItem) { type = ISYNodeType.STRING; } else if (item instanceof DimmerItem) { type = ISYNodeType.DIMMER; } else if (item instanceof DateTimeItem) { type = ISYNodeType.HEARTBEAT; } else { type = ISYNodeType.SWITCH; } String[] arr = bindingConfig.split(","); for (String str : arr) { String[] pair = str.split("="); String key = pair[0]; String value = pair[1]; switch (key) { case "ctrl": controller = value.replace('.', ' '); break; case "addr": address = value.replace('.', ' '); break; case "type": if ("thermostat".equalsIgnoreCase(value)) { type = ISYNodeType.THERMOSTAT; } else if ("lock".equalsIgnoreCase(value)) { type = ISYNodeType.LOCK; } else if ("heartbeat".equalsIgnoreCase(value)) { type = ISYNodeType.HEARTBEAT; } break; case "cmd": try { command = ISYControl.valueOf(value.toUpperCase()); } catch (IllegalArgumentException ie) { throw new BindingConfigParseException("Unsupported cmd " + value.toString()); } break; } } if (address == null) { address = controller; } return new ISYBindingConfig(item, type, controller, address, command); }
Source:
<code>public String getAppEngineVersion() { <START> return APP_ENGINE_RUNTIME_VERSION; <END> }</code><technical_language>do return, if AppEngine</technical_language>

Target:
public String getAppEngineVersion() { return appEngineRuntimeVersion; }
Source:
<code>public List<TestFitnessFunction> getCoverageGoals() { String className = Properties.TARGET_CLASS; <START> Class<?> targetClass = Properties.getInitializedTargetClass(); END> BranchPool bpinstance = BranchPool.getInstance(TestGenerationContext.getInstance().getClassLoaderForSUT()); List<TestFitnessFunction> goals = new ArrayList<TestFitnessFunction>(); if (targetClass != null) { for (String methodName : bpinstance.getBranchlessMethods(className)) { goals.add(createRootBranchTestFitness(className, methodName)); } for (String methodName : bpinstance.knownMethods(className)) { for (Branch b : bpinstance.retrieveBranchesInMethod(className, methodName)) { if (!(b.getInstruction().isForcedBranch())) { goals.add(createBranchCoverageTestFitness(b, true)); goals.add(createBranchCoverageTestFitness(b, false)); } } } } goals.add(new UnreachableBranchCoverageTestFitness()); return goals; }</code><technical_language>Remove //modified harsh</technical_language>

Target:
public List<TestFitnessFunction> getCoverageGoals() { String className = Properties.TARGET_CLASS; Class<?> targetClass = Properties.getInitializedTargetClass(); BranchPool bpinstance = BranchPool.getInstance(TestGenerationContext.getInstance().getClassLoaderForSUT()); List<TestFitnessFunction> goals = new ArrayList<TestFitnessFunction>(); if (targetClass != null) { for (String methodName : bpinstance.getBranchlessMethods(className)) { goals.add(createRootBranchTestFitness(className, methodName)); } for (String methodName : bpinstance.knownMethods(className)) { for (Branch b : bpinstance.retrieveBranchesInMethod(className, methodName)) { if (!b.isInstrumented()) { goals.add(createBranchCoverageTestFitness(b, true)); goals.add(createBranchCoverageTestFitness(b, false)); } } } } goals.add(new UnreachableBranchCoverageTestFitness()); return goals; }
Source:
<code>TableMetaStore createTableMetaStore() throws Exception; interface TableMetaStore extends Closeable { Path getLocationPath(); Optional<Path> getPartition(LinkedHashMap<String, String> partitionSpec) throws Exception; void createPartition(LinkedHashMap<String, String> partitionSpec, Path partitionPath) throws Exception; <START> default void alterPartition(LinkedHashMap<String, String> partitionSpec, Path partitionPath) throws Exception { <END> } }</code><technical_language>introduce a createOrAlterPartition</technical_language>

Target:
TableMetaStore createTableMetaStore() throws Exception; interface TableMetaStore extends Closeable { Path getLocationPath(); Optional<Path> getPartition(LinkedHashMap<String, String> partitionSpec) throws Exception; void createOrAlterPartition(LinkedHashMap<String, String> partitionSpec, Path partitionPath) throws Exception; }
Source:
<code>public void setLabel(String label) { <START> if (!label.isEmpty()) { <END> this.label = label; } }</code><technical_language>NPE if label is null</technical_language>

Target:
public void setLabel(String label) { if (label != null && !label.isEmpty()) { this.label = label; } }
Source:
<code>public void writeGuestbookAndStartDownload(GuestbookResponse guestbookResponse) { <START> boolean valid = validateGuestbookResponse(guestbookResponse); <END> if (!valid) { JH.addMessage(FacesMessage.SEVERITY_ERROR, BundleUtil.getStringFromBundle("dataset.message.validationError")); } else { PrimeFaces.current().executeScript("PF('downloadPopup').hide()"); guestbookResponse.setDownloadtype("Download"); if (guestbookResponse.getSelectedFileIds() != null) { fileDownloadService.writeGuestbookAndStartBatchDownload(guestbookResponse); } else if (guestbookResponse.getDataFile() != null) { fileDownloadService.writeGuestbookAndStartFileDownload(guestbookResponse); } } }</code><technical_language>I this method is needed anymore</technical_language>

Target:
public void writeGuestbookAndStartDownload(GuestbookResponse guestbookResponse) { PrimeFaces.current().executeScript("PF('downloadPopup').hide()"); guestbookResponse.setDownloadtype("Download"); if (guestbookResponse.getSelectedFileIds() != null) { fileDownloadService.writeGuestbookAndStartBatchDownload(guestbookResponse); } else if (guestbookResponse.getDataFile() != null) { fileDownloadService.writeGuestbookAndStartFileDownload(guestbookResponse); } }
Source:
<code>public void setBandwidth(long bandwidth) { this.bandwidthLimit = bandwidth; <START> LOG.info("Bandwidth limit is set to: " + bandwidth + " bytes/sec"); <END> }</code><technical_language>Is INFO level necessary changed DEBUG</technical_language>

Target:
public void setBandwidth(long bandwidth) { this.bandwidthLimit = bandwidth; LOG.debug("Bandwidth limit is set to: " + bandwidth + " bytes/sec"); }
Source:
<code>public boolean isAppLauncherEmpty() { <START> return view.isAppLauncherEmpty(); <END> }</code><technical_language>Is correct maintain state in view? presenter logic view is empty</technical_language>

Target:
public boolean isAppLauncherEmpty() { return appLauncherAddEvents.isEmpty(); }
Source:
<code>public void testSavesIterations() throws Exception { Bundle b = new Bundle(); b.putString("include-ui-xml", "true"); mListener = initListener(b); mListener.testRunStarted(mRunDesc); verify(mListener).createAndEmptyDirectory(ScreenshotOnFailureCollector.DEFAULT_DIR); for (int i = 1; i <= NUM_TEST_CASE; i++) { mListener.testStarted(mTestDesc); mListener.testFailure(new Failure(mTestDesc, new RuntimeException("I failed"))); mListener.testFinished(mTestDesc); } mListener.testRunFinished(new Result()); InOrder screenshotSaveVerifier = inOrder(mListener); for (int i = 0; i < NUM_TEST_CASE; i++) { screenshotSaveVerifier .verify(mListener) .takeScreenshot(endsWith(String.format("%d.png", i + 1))); } InOrder xmlSaveVerifier = inOrder(mListener); for (int i = 0; i < NUM_TEST_CASE; i++) { <START> xmlSaveVerifier.verify(mListener).collectUiXml(endsWith(String.valueOf(i + 1))); <END> } }</code><technical_language>this moved screenshotSaveVerifier checks for simplicity</technical_language>

Target:
public void testSavesIterations() throws Exception { Bundle b = new Bundle(); b.putString("include-ui-xml", "true"); mListener = initListener(b); mListener.testRunStarted(mRunDesc); verify(mListener).createAndEmptyDirectory(ScreenshotOnFailureCollector.DEFAULT_DIR); for (int i = 1; i <= NUM_TEST_CASE; i++) { mListener.testStarted(mTestDesc); mListener.testFailure(new Failure(mTestDesc, new RuntimeException("I failed"))); mListener.testFinished(mTestDesc); } mListener.testRunFinished(new Result()); InOrder screenshotSaveVerifier = inOrder(mListener); screenshotSaveVerifier.verify(mListener).takeScreenshot(matches("^.*[^1].png$")); for (int i = 1; i < NUM_TEST_CASE; i++) { screenshotSaveVerifier .verify(mListener) .takeScreenshot(endsWith(String.format("%d.png", i + 1))); } InOrder xmlSaveVerifier = inOrder(mListener); xmlSaveVerifier.verify(mListener).takeScreenshot(matches("^.*[^1]$")); for (int i = 1; i < NUM_TEST_CASE; i++) { xmlSaveVerifier.verify(mListener).collectUiXml(endsWith(String.valueOf(i + 1))); } }
Source:
<code>private void saveSubModulePOMs() throws IOException, XmlPullParserException { <START> if (content.isMultiModule() && <END> content.getModules() != null) { for (final String module : content.getModules()) { final org.uberfire.java.nio.file.Path childPath = Paths.convert(path).getParent().resolve(module).resolve("pom.xml"); if (ioService.exists(childPath)) { final POM child = load(Paths.convert(childPath)); if (child != null) { child.setParent(content.getGav()); child.getGav().setGroupId(content.getGav().getGroupId()); child.getGav().setVersion(content.getGav().getVersion()); savePOM(Paths.convert(childPath), child, null); } } } } }</code><technical_language>nice a test for this "recursively rename submodules" functionality too</technical_language>

Target:
private void saveSubModulePOMs() throws IOException, XmlPullParserException { if (pom.isMultiModule() && pom.getModules() != null) { for (final String childModuleName : pom.getModules()) { saveGAVChange(pom.getGav(), childModuleName); } } }
Source:
<code>public void createOrUpdateCounter(String classSimpleName, String key, String metricName, long value) { validateArguments(classSimpleName, metricName); Counter counter = (Counter) checkCache(classSimpleName, key, metricName).orElseGet(() -> _metricRegistry.counter(MetricRegistry.name(classSimpleName, key, metricName))); counter.inc(value); <START> updateCache(classSimpleName, key, metricName, counter); <END> }</code><technical_language>This is a suggestion remove unnecessary updateCache call: do updateCache lambda function orElseGet(...) I is part of this change, a small additional optimization. (The in other methods)</technical_language>

Target:
public void createOrUpdateCounter(String classSimpleName, String key, String metricName, long value) { validateArguments(classSimpleName, metricName); Counter counter = (Counter) checkCache(classSimpleName, key, metricName).orElseGet(() -> { Counter newCounter = _metricRegistry.counter(MetricRegistry.name(classSimpleName, key, metricName)); updateCache(classSimpleName, key, metricName, newCounter); return newCounter; }); counter.inc(value); }
Source:
<code>public User addUserCreatedOnBuddyRequest(UserDTO buddyUser, String tempPassword) { UUID savedUserID = CryptoSession.execute(Optional.of(tempPassword), null, () -> tempEncryptionContextExecutor.addUserCreatedOnBuddyRequest(buddyUser).getID()); User userEntity = getEntityByID(savedUserID); <START> sendMobileNumberConfirmationMessage(userEntity); <END> return userEntity; }</code><technical_language>a SMS template here? user read email yet, SMS unexpected</technical_language>

Target:
public User addUserCreatedOnBuddyRequest(UserDTO buddyUser, String tempPassword) { UUID savedUserID = CryptoSession.execute(Optional.of(tempPassword), null, () -> tempEncryptionContextExecutor.addUserCreatedOnBuddyRequest(buddyUser).getID()); User userEntity = getEntityByID(savedUserID); sendMobileNumberConfirmationMessage(userEntity, SmsService.TemplateName_InviteBuddyNumberConfirmation); return userEntity; }
Source:
<code>public Expression getFullExpr() { Pair<Expression, Set<Block>> pair = this.getLocalExpr(); LetExpression fullExpr = new LetExpression(pair.a, false); Set<Block> surroundingBlocks = pair.b; block.container.ifPresent(container -> extendExprGraph(fullExpr, container, surroundingBlocks)); extendExprGraph(fullExpr, null, surroundingBlocks); surroundingBlocks.forEach(block -> block.extendExprGraph(fullExpr, null, new HashSet<>())); <START> return fullExpr; <END> }</code><technical_language>This duplicate getFullExpr Block</technical_language>

Target:
public Expression getFullExpr() { Pair<Expression, Set<Block>> pair = this.getLocalExpr(); LetExpression fullExpr = new LetExpression(pair.a, false); Set<Block> surroundingBlocks = pair.b; block.container.ifPresent(c -> extendExprGraph(fullExpr, block.container, surroundingBlocks)); extendExprGraph(fullExpr, Optional.empty(), surroundingBlocks); surroundingBlocks.forEach(block -> block.extendExprGraph(fullExpr, Optional.empty(), new HashSet<>())); return fullExpr; }
Source:
<code>public String paymentOverview(Model model, RedirectAttributes redirect, @PathVariable String key) { try { Order order = this.getOrderAndCheck(key); model.addAttribute(MODEL_ATTR_ORDER, order); model.addAttribute(MODEL_ATTR_CUSTOMER, authenticationService.getCurrentCustomer()); <START> model.addAttribute("containsOnlyReservable", orderService.containsOnlyReservable(order)); <END> if (order.getAmount() == 0.d) { order.setPaymentMethod(PaymentMethod.OTHER); orderService.updateOrderStatus(order, OrderStatus.PAID); return "redirect:/return/" + order.getPublicReference(); } if (order.getOwner().getRfidToken() == null || order.getOwner().getRfidToken().equals("")) { model.addAttribute( MODEL_ATTR_MESSAGE, "No card linked to your account! Link a card to your account, for an easier and faster check-in at the event(s)." ); } return "webshop/payment/index"; } catch (EventsException e) { redirect.addFlashAttribute(MODEL_ATTR_ERROR, e.getMessage()); return REDIRECT_EVENTS_HOME; } }</code><technical_language>create a constant for containsOnlyReservable</technical_language>

Target:
public String paymentOverview(Model model, RedirectAttributes redirect, @PathVariable String key) { try { Order order = this.getOrderAndCheck(key); model.addAttribute(MODEL_ATTR_ORDER, order); model.addAttribute(MODEL_ATTR_CUSTOMER, authenticationService.getCurrentCustomer()); model.addAttribute(MODEL_ATTR_RESERVABLE, orderService.containsOnlyReservable(order)); if (order.getAmount() == 0.d) { order.setPaymentMethod(PaymentMethod.OTHER); orderService.updateOrderStatus(order, OrderStatus.PAID); return "redirect:/return/" + order.getPublicReference(); } if (order.getOwner().getRfidToken() == null || order.getOwner().getRfidToken().equals("")) { model.addAttribute( MODEL_ATTR_MESSAGE, "No card linked to your account! Link a card to your account, for an easier and faster check-in at the event(s)." ); } return "webshop/payment/index"; } catch (EventsException e) { redirect.addFlashAttribute(MODEL_ATTR_ERROR, e.getMessage()); return REDIRECT_EVENTS_HOME; } }
Source:
<code>public double convertAltitude(double value) { if (this == DEFAULT_UNIT_SYSTEM) { return value; } <START> return value * 3.2808399; <END> }</code><technical_language>double BigDecimal</technical_language>

Target:
public double convertAltitude(double value) { if (this == DEFAULT_UNIT_SYSTEM) { return value; } return value * METERS_TO_FEET; }
Source:
<code>public void dateFormatFunctionExtension11() throws InterruptedException { log.info("DateFormatFunctionExtensionTestCaseInvalidParameterTypeFirstArgumentLenghtTwo"); SiddhiManager siddhiManager = new SiddhiManager(); String inStreamDefinition = "define stream inputStream (symbol string," + "dateValue int,sourceFormat string,timestampInMilliseconds long,targetFormat string);"; String query = ("@info(name = 'query1') from inputStream select symbol , " + "time:dateFormat(dateValue,targetFormat) as formattedDate," + "time:dateFormat(timestampInMilliseconds," + "targetFormat) as formattedUnixDate insert into outputStream;"); ExecutionPlanRuntime executionPlanRuntime = siddhiManager .createExecutionPlanRuntime(inStreamDefinition + query); <START> executionPlanRuntime.start(); <END> executionPlanRuntime.shutdown(); }</code><technical_language>remove executionplanRuntime start shutdown in attribute validation cases .Please change in others</technical_language>

Target:
public void dateFormatFunctionExtension11() throws InterruptedException { log.info("DateFormatFunctionExtensionTestCaseInvalidParameterTypeFirstArgumentLenghtTwo"); SiddhiManager siddhiManager = new SiddhiManager(); String inStreamDefinition = "define stream inputStream (symbol string," + "dateValue int,sourceFormat string,timestampInMilliseconds long,targetFormat string);"; String query = ("@info(name = 'query1') from inputStream select symbol , " + "time:dateFormat(dateValue,targetFormat) as formattedDate," + "time:dateFormat(timestampInMilliseconds," + "targetFormat) as formattedUnixDate insert into outputStream;"); siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query); }