auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shouldDoNothingOnWriteLineIfAllSubConsumersAreClosed() throws Exception { final String message = "Test line"; <START> for (int i = 0; i < subConsumers.length; i++) { <END> LineConsumer closedConsumer = mock(LineConsumer.class); doThrow(ConsumerAlreadyClosedException.class).when(closedConsumer).writeLine(anyString()); subConsumers[i] = closedConsumer; } compositeLineConsumer = new CompositeLineConsumer(subConsumers); compositeLineConsumer.writeLine("Error"); compositeLineConsumer.writeLine(message); for (LineConsumer subConsumer : subConsumers) { verify(subConsumer, never()).writeLine(eq(message)); } }</code><technical_language>existing consumers part in this code? unrelated</technical_language>

Target:
public void shouldDoNothingOnWriteLineIfAllSubConsumersAreClosed() throws Exception { final String message = "Test line"; LineConsumer[] closedConsumers = subConsumers; for (LineConsumer consumer : closedConsumers) { doThrow(ConsumerAlreadyClosedException.class).when(consumer).writeLine(anyString()); } compositeLineConsumer = new CompositeLineConsumer(closedConsumers); compositeLineConsumer.writeLine("Error"); compositeLineConsumer.writeLine(message); for (LineConsumer subConsumer : closedConsumers) { verify(subConsumer, never()).writeLine(eq(message)); } }
Source:
<code>public static void main(String[] args) { ServerBuilder sb = new ServerBuilder(); sb.http(8080) .annotatedService("/", new HelloService()) .annotatedService("/", new PostgresDbService()) .annotatedService("/", new PostgresFortunesService()) .decorator((delegate, ctx, req) -> { ctx.addAdditionalResponseHeader(HttpHeaderNames.SERVER, "armeria"); ctx.addAdditionalResponseHeader(HttpHeaderNames.DATE, DateTimeFormatter.RFC_1123_DATE_TIME.format( <START> ZonedDateTime.now(ZoneOffset.UTC))); <END> return delegate.serve(ctx, req); }); Server server = sb.build(); server.start().join(); }</code><technical_language>I improve Armeria add headers default</technical_language>

Target:
public static void main(String[] args) { ServerBuilder sb = new ServerBuilder(); sb.http(8080) .annotatedService(new HelloService()) .annotatedService(new PostgresDbService()) .annotatedService(new PostgresFortunesService()) .decorator((delegate, ctx, req) -> { ctx.addAdditionalResponseHeader(HttpHeaderNames.SERVER, "armeria"); ctx.addAdditionalResponseHeader(HttpHeaderNames.DATE, DateTimeFormatter.RFC_1123_DATE_TIME.format( ZonedDateTime.now(ZoneOffset.UTC))); return delegate.serve(ctx, req); }); Server server = sb.build(); server.start().join(); }
Source:
<code>public void writeScopedState(ScopedPersistentState state) { File stateFile = getStateFile(state.getScope()); try (PrintWriter w = new PrintWriter(stateFile)) { state.forEach((key, value) -> { <START> w.printf("%s=%s%n", key, Util.unicodeEscapeString(value)); <END> }); } catch (IOException e) { throw log.failedWritingGlobalState(e, stateFile); } }</code><technical_language>I key escaped well</technical_language>

Target:
public void writeScopedState(ScopedPersistentState state) { File stateFile = getStateFile(state.getScope()); try (PrintWriter w = new PrintWriter(stateFile)) { state.forEach((key, value) -> { w.printf("%s=%s%n", Util.unicodeEscapeString(key), Util.unicodeEscapeString(value)); }); } catch (IOException e) { throw log.failedWritingGlobalState(e, stateFile); } }
Source:
<code>Row getEmbeddedObjectRow(final String className, final RealmObjectProxy parentProxy, final String parentProperty, final RealmSchema schema, final RealmObjectSchema parentObjectSchema) { final long parentPropertyColKey = parentObjectSchema.getColumnKey(parentProperty); final RealmFieldType parentPropertyType = parentObjectSchema.getFieldType(parentProperty); final String linkedType = parentObjectSchema.getLinkedType(parentProperty); final Row row = parentProxy.realmGet$proxyState().getRow$realm(); Row embeddedObject; switch (parentPropertyType) { case OBJECT: case LIST: if (linkedType.equals(className)) { long objKey = row.createEmbeddedObject(parentPropertyColKey, parentPropertyType); embeddedObject = schema.getTable(className).getCheckedRow(objKey); } else { throw new IllegalArgumentException(String.format("Parent type %s expects that property '%s' be of type %s but was %s.", parentObjectSchema.getClassName(), parentProperty, linkedType, className)); } break; default: <START> throw new IllegalArgumentException("Parent property is not a reference to embedded objects of the appropriate type: " + parentPropertyType); <END> } return embeddedObject; }</code><technical_language>I suspect hit this parentObjectSchema.getLinkedType(parentProperty); throw first. move linkedType property switch</technical_language>

Target:
Row getEmbeddedObjectRow(final String className, final RealmObjectProxy parentProxy, final String parentProperty, final RealmSchema schema, final RealmObjectSchema parentObjectSchema) { final long parentPropertyColKey = parentObjectSchema.getColumnKey(parentProperty); final RealmFieldType parentPropertyType = parentObjectSchema.getFieldType(parentProperty); final Row row = parentProxy.realmGet$proxyState().getRow$realm(); final RealmFieldType fieldType = parentObjectSchema.getFieldType(parentProperty); boolean propertyAcceptable = parentObjectSchema.isPropertyAcceptableForEmbeddedObject(fieldType); if (!propertyAcceptable) { throw new IllegalArgumentException(String.format("Field '%s' does not contain a valid link", parentProperty)); } final String linkedType = parentObjectSchema.getPropertyClassName(parentProperty); Row embeddedObject; if (linkedType.equals(className)) { long objKey = row.createEmbeddedObject(parentPropertyColKey, parentPropertyType); embeddedObject = schema.getTable(className).getCheckedRow(objKey); } else { throw new IllegalArgumentException(String.format("Parent type %s expects that property '%s' be of type %s but was %s.", parentObjectSchema.getClassName(), parentProperty, linkedType, className)); } return embeddedObject; }
Source:
<code>private void nameSpaceStrategyValidation() throws ValidationException { <START> if (!"<username>-che".equals(defaultNamespaceName)) { <END> String message = format( "Workspace configuration not valid: Asynchronous storage available only for 'per-user' namespace strategy"); LOG.warn(message); throw new ValidationException(message); } }</code><technical_language>@vparfonov starts <username>-</technical_language>

Target:
private void nameSpaceStrategyValidation() throws ValidationException { if (Strings.isNullOrEmpty(defaultNamespaceName) || !defaultNamespaceName.contains("<username>")) { String message = "Workspace configuration not valid: Asynchronous storage available only for 'per-user' namespace strategy"; LOG.warn(message); throw new ValidationException(message); } }
Source:
<code>public void testRemoteService() throws Exception { <START> assertInjectedService(remoteService); <END> }</code><technical_language>this is remove Service a local service injected ? test return for service I is missing check is a remove service</technical_language>

Target:
public void testRemoteService() throws Exception { assertInjectedService(remoteService, Access.REMOTE); }
Source:
<code>public static ExtensionsManager getInstance() { if (instance == null) { synchronized (EngineExtensionsManager.class) { if (instance == null) { instance = new ExtensionsManager(); instance.getGlobalContext().put(Base.GlobalContextKeys.APPLICATION_NAME, Base.ApplicationNames.OVIRT_ENGINE); createInternalAAAConfigurations(); createKerberosLdapAAAConfigurations(); for (File directory : EngineLocalConfig.getInstance().getExtensionsDirectories()) { if (!directory.exists()) { log.warn(String.format("The directory '%1$s' cotaning configuration files does not exist.", directory.getAbsolutePath())); } else { File[] files = directory.listFiles(); if (files != null) { sort(files); for (File file : files) { if (file.getName().endsWith(".properties")) { instance.load(file); } } } } } for (ExtensionProxy extension : instance.getLoadedExtensions()) { if (EngineLocalConfig.getInstance().getBoolean( ENGINE_EXTENSION_ENABLED + extension.getContext().<String> get(Base.ContextKeys.INSTANCE_NAME), Boolean.parseBoolean( extension.getContext().<Properties>get(Base.ContextKeys.CONFIGURATION).getProperty(Base.ConfigKeys.ENABLED, "true") ) )) { <START> instance.initialize(extension.getContext().<String> get(Base.ContextKeys.INSTANCE_NAME)); <END> } } } } } instance.dump(); return instance; }</code><technical_language>ok, is ok... indentation help.... if ( EngineLocalConfig.getInstance().getBoolean( ( ENGINE_EXTENSION_ENABLED + extension.getContext().<String> get(Base.ContextKeys.INSTANCE_NAME) ), Boolean.parseBoolean( extension.getContext().<Properties>get( Base.ContextKeys.CONFIGURATION ).getProperty(Base.ConfigKeys.ENABLED, "true") ) ) ) { instance.initialize(extension.getContext().<String> get(Base.ContextKeys .INSTANCE_NAME)); } notice, parameter line indented (). I IDE cope :)</technical_language>

Target:
public static ExtensionsManager getInstance() { if (instance == null) { synchronized (EngineExtensionsManager.class) { if (instance == null) { instance = new ExtensionsManager(); instance.getGlobalContext().put(Base.GlobalContextKeys.APPLICATION_NAME, Base.ApplicationNames.OVIRT_ENGINE); createInternalAAAConfigurations(); createKerberosLdapAAAConfigurations(); for (File directory : EngineLocalConfig.getInstance().getExtensionsDirectories()) { if (!directory.exists()) { log.warn(String.format("The directory '%1$s' cotaning configuration files does not exist.", directory.getAbsolutePath())); } else { File[] files = directory.listFiles(); if (files != null) { sort(files); for (File file : files) { if (file.getName().endsWith(".properties")) { instance.load(file); } } } } } for (ExtensionProxy extension : instance.getLoadedExtensions()) { if ( EngineLocalConfig.getInstance().getBoolean( ( ENGINE_EXTENSION_ENABLED + extension.getContext() .<String> get(Base.ContextKeys.INSTANCE_NAME) ), Boolean.parseBoolean( extension.getContext().<Properties> get( Base.ContextKeys.CONFIGURATION ).getProperty(Base.ConfigKeys.ENABLED, "true") ) ) ) { instance.initialize(extension.getContext().<String> get(Base.ContextKeys.INSTANCE_NAME)); } } } } } instance.dump(); return instance; }
Source:
<code>public List<DruidServerMetadata> getCandidates(final int numCandidates) { <START> List<DruidServerMetadata> candidates = new ArrayList<>(); <END> synchronized (this) { if (numCandidates > 0) { candidates.addAll( strategy.pick(historicalServers, segment.get(), numCandidates) .stream() .map(server -> server.getServer().getMetadata()) .collect(Collectors.toList()) ); if (candidates.size() < numCandidates) { candidates.addAll( strategy.pick(realtimeServers, segment.get(), numCandidates - candidates.size()) .stream() .map(server -> server.getServer().getMetadata()) .collect(Collectors.toList()) ); } } else { candidates.addAll( historicalServers.values() .stream() .flatMap(Collection::stream) .map(server -> server.getServer().getMetadata()) .collect(Collectors.toList()) ); candidates.addAll( realtimeServers.values() .stream() .flatMap(Collection::stream) .map(server -> server.getServer().getMetadata()) .collect(Collectors.toList()) ); } return candidates; } }</code><technical_language>Add numCandidates arg, if numCandidates > 0</technical_language>

Target:
public List<DruidServerMetadata> getCandidates(final int numCandidates) { List<DruidServerMetadata> candidates; synchronized (this) { if (numCandidates > 0) { candidates = new ArrayList<>(numCandidates); strategy.pick(historicalServers, segment.get(), numCandidates) .stream() .map(server -> server.getServer().getMetadata()) .forEach(candidates::add); if (candidates.size() < numCandidates) { strategy.pick(realtimeServers, segment.get(), numCandidates - candidates.size()) .stream() .map(server -> server.getServer().getMetadata()) .forEach(candidates::add); } return candidates; } else { return getAllServers(); } } }
Source:
<code>public void setDetails(Map<String, Object> details) { <START> this.details.putAll(details); <END> }</code><technical_language>well</technical_language>

Target:
public void setDetails(Map<String, Object> details) { this.details = details; }
Source:
<code>private JCheckBox getButtonUseCsrf() { if (useCsrf == null) { <START> useCsrf = new JCheckBox(); <END> useCsrf.setToolTipText(Constant.messages.getString("manReq.checkBox.useCSRF")); } return useCsrf; }</code><technical_language>suggest a toggle button icon, :)</technical_language>

Target:
private JToggleButton getButtonUseCsrf() { if (useCsrf == null) { useCsrf = new JToggleButton( new ImageIcon( HttpPanelSender.class.getResource( "/resource/icon/csrf-button.png"))); useCsrf.setToolTipText(Constant.messages.getString("manReq.checkBox.useCSRF")); } return useCsrf; }
Source:
<code>private Response performCreate(ImageTransfer imageTransfer, TransferDiskImageParameters params) { updateTransferType(imageTransfer, params); <START> if (imageTransfer.isSetHost()) { <END> params.setVdsId(Guid.createGuidFromString(imageTransfer.getHost().getId())); } return performCreate(ActionType.TransferDiskImage, params, new QueryIdResolver<Guid>(QueryType.GetImageTransferById, IdQueryParameters.class)); }</code><technical_language>check if id is set: if (imageTransfer.isSetHost() && imageTransfer.getHost().isSetId()) { ... }</technical_language>

Target:
private Response performCreate(ImageTransfer imageTransfer, TransferDiskImageParameters params) { updateTransferType(imageTransfer, params); if (imageTransfer.isSetHost() && imageTransfer.getHost().isSetId()) { params.setVdsId(Guid.createGuidFromString(imageTransfer.getHost().getId())); } return performCreate(ActionType.TransferDiskImage, params, new QueryIdResolver<Guid>(QueryType.GetImageTransferById, IdQueryParameters.class)); }
Source:
<code>private void send(String destination, Serializable message, String propertyName, String propertValue, boolean transacted, boolean useTopic) { Connection connection = null; try { if (transacted) { connection = xaConnectionFactory.createConnection(); } else { connection = connectionFactory.createConnection(); } Session session = connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE); <START> MessageProducer messageProducer; <END> if (useTopic) { messageProducer = session.createProducer(session.createTopic(destination)); } else { messageProducer = session.createProducer(session.createQueue(destination)); } logger.debug("Destination is " + destination.toString()); connection.start(); ObjectMessage objectMessage = session.createObjectMessage(message); if (propertyName != null) { objectMessage.setStringProperty(propertyName, propertValue); } messageProducer.send(objectMessage); logger.debug("Sending complete"); } catch (JMSException e) { logger.error("Error sending", e.getMessage(), e); throw new MessageDeliveryException("Failed to queue push message for further processing", e); } finally { if (connection != null) { try { connection.close(); } catch (JMSException e) { logger.error("Failed to close JMS connection: ", e); } } } }</code><technical_language>Making this final ensure, for future developer, a is assigned this variable</technical_language>

Target:
private void send(String destination, Serializable message, String propertyName, String propertValue, boolean transacted, boolean useTopic) { Connection connection = null; try { if (transacted) { connection = xaConnectionFactory.createConnection(); } else { connection = connectionFactory.createConnection(); } Session session = connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE); final MessageProducer messageProducer; if (useTopic) { messageProducer = session.createProducer(session.createTopic(destination)); } else { messageProducer = session.createProducer(session.createQueue(destination)); } logger.debug("Destination is {}", destination); connection.start(); ObjectMessage objectMessage = session.createObjectMessage(message); if (propertyName != null) { objectMessage.setStringProperty(propertyName, propertValue); } messageProducer.send(objectMessage); logger.debug("Sending complete"); } catch (JMSException e) { logger.error("Error sending", e.getMessage(), e); throw new MessageDeliveryException("Failed to queue push message for further processing", e); } finally { if (connection != null) { try { connection.close(); } catch (JMSException e) { logger.error("Failed to close JMS connection: ", e); } } } }
Source:
<code>public void setHighlighted(String name) { <START> for (MenuRow item : mMenuItems) item.setSelected(item.getMenuText().equals(name)); <END> notifyDataSetChanged(); }</code><technical_language>charles pls</technical_language>

Target:
public void setHighlighted(String name) { for (MenuRow item : mMenuItems) { item.setSelected(item.getMenuText().equals(name)); } notifyDataSetChanged(); }
Source:
<code>private void edit(String key, Object value) throws IOException { root.retrieve() <START> .method("POST") <END> .withPreview(INERTIA) .with(key, value) .method("PATCH") .withUrlPath(getApiRoute()) .to(); }</code><technical_language>Multiple method(*) methods</technical_language>

Target:
private void edit(String key, Object value) throws IOException { root.createRequest().method("PATCH").withPreview(INERTIA).with(key, value).withUrlPath(getApiRoute()).send(); }
Source:
<code>public URL getFileUrl() { <START> String fileURLString = String.format("%s/%s/%s", azureFileStorageClient.getUrl(), shareName, filePath); <END> if (snapshot != null) { fileURLString = String.format("%s?snapshot=%s", fileURLString, snapshot); } try { return new URL(fileURLString); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new RuntimeException( String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), fileURLString), e)); } }</code><technical_language>question</technical_language>

Target:
public URL getFileUrl() { StringBuilder fileURLString = new StringBuilder(azureFileStorageClient.getUrl()).append("/") .append(shareName).append("/").append(filePath); if (snapshot != null) { fileURLString.append("?snapshot=").append(snapshot); } try { return new URL(fileURLString.toString()); } catch (MalformedURLException e) { throw logger.logExceptionAsError(new RuntimeException( String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), fileURLString), e)); } }
Source:
<code>public List<String> pollerPluginIds() { <START> return Collections.singletonList(GERRIT_CS_POLLER_PLUGIN_ID); <END> }</code><technical_language>Please static import where-ever</technical_language>

Target:
public List<String> pollerPluginIds() { return singletonList(GERRIT_CS_POLLER_PLUGIN_ID); }
Source:
<code>public void detectBubbleEnemy(Level level, double delta) { ArrayList<NPC> enemies = level.getNPCs(); ArrayList<Fruit> fruits = level.getFruits(); ArrayList<Bubble> bubbles = level.getBubbles(); if (bubbles.size() > 0 && enemies.size() > 0) { for (int i = 0; i < enemies.size(); i++) { for (int j = 0; j < bubbles.size(); j++) { if (enemies.size() != i && enemies.get(i).inBoxRangeOf(bubbles.get(j), Constants.COLLISION_RADIUS) && new Collision(bubbles.get(j), enemies.get(i), delta).colliding()) { enemies.remove(i); <START> bubbles.get(j).setHasNPC(true); <END> bubbles.get(j).setLifetime(1.5 * Constants.BUBBLE_LIFETIME); } } } } }</code><technical_language>I check this Bubble NPC, currently this implementation allows for a Bubble encapsulate multiple enemies. <bug</technical_language>

Target:
public void detectBubbleEnemy(Level level, double delta) { ArrayList<NPC> enemies = level.getNPCs(); ArrayList<Bubble> bubbles = level.getBubbles(); ArrayList<Bubble> enemyBubbles = level.getEnemyBubbles(); if (bubbles.size() > 0 && enemies.size() > 0) { for (int i = 0; i < enemies.size(); i++) { for (int j = 0; j < bubbles.size(); j++) { if (!(bubbles.get(j).hasNPC()) && enemies.size() != i && enemies.get(i).inBoxRangeOf(bubbles.get(j), Constants.COLLISION_RADIUS) && new Collision(bubbles.get(j), enemies.get(i), delta).colliding()) { enemies.remove(i); enemyBubbles.add(bubbles.get(j)); bubbles.get(j).setHasNPC(true); bubbles.get(j).setLifetime(1.5 * Constants.BUBBLE_LIFETIME); } } } } }
Source:
<code>public Subscriber(Publisher pub, String remote, String dir) throws IOException, ConfigInvalidException, URISyntaxException { publisher = pub; directory = dir; this.remote = remote; <START> load(); <END> }</code><technical_language>this entire class immutable. fields final. need refactor load() return RemoteConfig set fields</technical_language>

Target:
public Subscriber(Publisher pub, String remote, String dir) throws IOException, ConfigInvalidException, URISyntaxException { publisher = pub; directory = dir; this.remote = remote; RemoteConfig rc = load(); subscribeSpecs = rc.getFetchRefSpecs(); if (rc.getURIs().size() == 0) throw new ConfigInvalidException(MessageFormat.format( JGitText.get().invalidRemote, remote)); name = rc.getURIs().get(0).getPath().substring(1); }
Source:
<code>public void testExecuteScriptResources() throws IOException, InterruptedException { TestApplicationTemplate app = new TestApplicationTemplate(); Instance instance = app.getTomcatVm(); List<ExecutionResult> result1 = AgentUtils.executeScriptResources(instance, app.getName(), instance.getName()); Assert.assertEquals(0,result1.size()); File dir = InstanceHelpers.findInstanceDirectoryOnAgent( instance ); Utils.createDirectory( dir ); <START> File script1 = new File( dir, "toto.script" ); <END> File script2 = new File( dir, "titi.script" ); Utils.writeStringInto( "#!/bin/bash\necho Bonjour le monde cruel", script1); Utils.writeStringInto( "#!/bin/bash\necho titiiii > titi.txt", script2); List<ExecutionResult> result2 = AgentUtils.executeScriptResources(instance, app.getName(), instance.getName()); Assert.assertEquals(2,result2.size()); Assert.assertEquals(0, result2.get(0).getExitValue()); Assert.assertEquals(0, result2.get(1).getExitValue()); String s = Utils.readFileContent(new File( dir, "titi.txt")); Assert.assertEquals("titiiii",s.trim()); }</code><technical_language>This works Linux system. work Windows? suggest JUnit assumtions. java Assume( functionThatReturnsTrueIfWeAreOnLinux());</technical_language>

Target:
public void testExecuteScriptResources() throws IOException, InterruptedException { Assume.assumeTrue( isUnix()); File scriptsDir = this.folder.newFolder(); AgentUtils.executeScriptResources( scriptsDir ); Assert.assertEquals(0, scriptsDir.listFiles().length); File script = new File( scriptsDir, "toto-script.sh" ); Utils.writeStringInto( "#!/bin/bash\necho totototototo > toto.txt", script); AgentUtils.executeScriptResources( scriptsDir ); File toto = new File(scriptsDir,"toto.txt"); Assert.assertTrue( toto.exists() ); Assert.assertEquals( 2,scriptsDir.listFiles().length ); String s = Utils.readFileContent( toto ); Assert.assertEquals("totototototo",s.trim()); }
Source:
<code><START> public void delete(ProcessDTO processDTO){ <END> try { ProcessForm processForm = new ProcessForm(); processForm.setProcess(ServiceManager.getProcessService().getById(processDTO.getId())); processForm.delete(); } catch (DAOException e) { Helper.setErrorMessage("errorOnSearch", searchQuery); } filteredList.remove(processDTO); }</code><technical_language>Missing white space ) {</technical_language>

Target:
public void delete(ProcessDTO processDTO) { try { ProcessForm processForm = new ProcessForm(); processForm.setProcess(ServiceManager.getProcessService().getById(processDTO.getId())); processForm.delete(); filteredList.remove(processDTO); } catch (DAOException e) { Helper.setErrorMessage("errorOnSearch", searchQuery); } }
Source:
<code>public void waitingForVisibilityOfAllElementsLocatedByReturnsListOfElements() { List<WebElement> webElements = new ArrayList<WebElement>(); <START> webElements.add(mockElement); <END> String testSelector = "testSelector"; when(mockDriver.findElements(By.cssSelector(testSelector))).thenReturn(webElements); when(mockElement.isDisplayed()).thenReturn(true); List<WebElement> returnedElements = wait.until(visibilityOfAllElementsLocatedBy(By.cssSelector(testSelector))); assertEquals(webElements, returnedElements); }</code><technical_language>List<WebElement> els = Lists.of(mockElement) web elements of strong typing</technical_language>

Target:
public void waitingForVisibilityOfAllElementsLocatedByReturnsListOfElements() { List webElements = Lists.newArrayList(mockElement); String testSelector = "testSelector"; when(mockDriver.findElements(By.cssSelector(testSelector))).thenReturn(webElements); when(mockElement.isDisplayed()).thenReturn(true); List returnedElements = wait.until(visibilityOfAllElementsLocatedBy(By.cssSelector(testSelector))); assertEquals(webElements, returnedElements); }
Source:
<code>public String getCaptchaUrl(Site site) { <START> return site.getScriptPath("index.php") + "?title=Special:Captcha/image&wpCaptchaId=\" + captchaId"; <END> }</code><technical_language>Needs getFullUrl(). Also, captchaId end is a variable name, part of string</technical_language>

Target:
public String getCaptchaUrl(Site site) { return site.getFullPath("index.php") + "?title=Special:Captcha/image&wpCaptchaId=" + captchaId; }
Source:
<code>public void setOnsetDate(Date onsetDate) { <START> this.onsetDate = new Date(onsetDate.getTime()); <END> }</code><technical_language>happens, if onsetDate is null</technical_language>

Target:
public void setOnsetDate(Date onsetDate) { this.onsetDate = onsetDate != null ? new Date(onsetDate.getTime()) : null; }
Source:
<code>public void setImage(@Nullable SystemImageDescription image) { myImageDescription = image; myHaxmAlert.setSystemImageDescription(image); ((CardLayout)myRootPanel.getLayout()).show(myRootPanel, NO_IMAGE_CONTENT); if (image != null) { ((CardLayout)myRootPanel.getLayout()).show(myRootPanel, MAIN_CONTENT); int apiLevel = image.getVersion().getApiLevel(); myApiLevelListener.setApiLevel(apiLevel); String codeName = getCodeName(myImageDescription); if (codeName != null) { myReleaseName.setText(codeName); } Icon icon = getIcon(codeName); if (icon != null) { myReleaseIcon.setIcon(icon); } myApiLevel.setText(image.getVersion().getApiString()); myAndroidVersion.setVisible(!image.getVersion().isPreview()); myAndroidVersion.setText(SdkVersionInfo.getVersionString(apiLevel)); String vendorName; <START> IdDisplay tag = myImageDescription.getTag() == null ? SystemImage.DEFAULT_TAG : myImageDescription.getTag(); <END> if (tag.getId().equals("android-wear") || tag.getId().equals("android-tv")) { vendorName = "Android"; } else { vendorName = myImageDescription.getVendor(); } myVendor.setText("<html>" + vendorName + "</html>"); myAbi.setText(myImageDescription.getAbiType()); } }</code><technical_language>Ah, I hoping this change to: IdDisplay tag = myImageDescription.getTag(); If possible, myImageDescription returning a null tag means something, suggestion change getTag return SystemImage.DEFAULT_TAG incorrect</technical_language>

Target:
public void setImage(@Nullable SystemImageDescription image) { myImageDescription = image; myHaxmAlert.setSystemImageDescription(image); ((CardLayout)myRootPanel.getLayout()).show(myRootPanel, NO_IMAGE_CONTENT); if (image != null) { ((CardLayout)myRootPanel.getLayout()).show(myRootPanel, MAIN_CONTENT); int apiLevel = image.getVersion().getApiLevel(); myApiLevelListener.setApiLevel(apiLevel); String codeName = getCodeName(myImageDescription); if (codeName != null) { myReleaseName.setText(codeName); } Icon icon = getIcon(codeName); if (icon != null) { myReleaseIcon.setIcon(icon); } myApiLevel.setText(image.getVersion().getApiString()); myAndroidVersion.setVisible(!image.getVersion().isPreview()); myAndroidVersion.setText(SdkVersionInfo.getVersionString(apiLevel)); String vendorName; IdDisplay tag = myImageDescription.getTag(); if (tag.getId().equals("android-wear") || tag.getId().equals("android-tv")) { vendorName = "Android"; } else { vendorName = myImageDescription.getVendor(); } myVendor.setText("<html>" + vendorName + "</html>"); myAbi.setText(myImageDescription.getAbiType()); } }
Source:
<code>public Feed getFeedForManuallyUploadedData(String feedName, boolean isGoldStandard) { initialiseProvenanceFeeds(); String provenanceName = isGoldStandard ? ProvenanceNames.MANUAL_GOLD_STANDARD : ProvenanceNames.MANUAL; Feed feed = getExistingFeed(provenanceName, feedName); <START> if (feed == null) { <END> feed = addNewFeed(provenanceName, feedName); } return feed; }</code><technical_language>In HealthMap conversion code HealthMapAlertConverter's responsibility create a new feed if necessary, HealthMapLookupData. I of obvious benefit of putting there, happy leave this!..</technical_language>

Target:
public Feed getFeedForManuallyUploadedData(String feedName, boolean isGoldStandard) { initialiseProvenanceFeedsMap(); String provenanceName = isGoldStandard ? ProvenanceNames.MANUAL_GOLD_STANDARD : ProvenanceNames.MANUAL; Feed feed = getExistingFeed(provenanceName, feedName); if (feed == null) { feed = addNewFeed(provenanceName, feedName); } return feed; }
Source:
<code>V addIfNotExists(K key, String name) { <START> List<V> list = getDataMap().get(key); <END> if (list == null) { list = new ArrayList<>(); } for (V data : list) { if (getDataName(data).equals(name)) { return data; } } V addedData = newInstance(name); list.add(addedData); getDataMap().put(key, list); return addedData; }</code><technical_language>find method</technical_language>

Target:
V addIfNotExists(K key, String name) { List<V> list = getOrCreate(key); V data = find(key, name); if (data != null) { return data; } V addedData = newInstance(name); list.add(addedData); getDataMap().put(key, list); return addedData; }
Source:
<code>static void registerTransformers_1_3_0(ResourceTransformationDescriptionBuilder parentBuilder) { <START> ResourceTransformationDescriptionBuilder builder = parentBuilder.addChildResource(PATH_AUDIT); <END> MappingProviderModuleDefinition.registerTransformers_1_3_0(builder); }</code><technical_language>I PATH_AUDIT_CLASSIC if works</technical_language>

Target:
static void registerTransformers_1_3_0(ResourceTransformationDescriptionBuilder parentBuilder) { ResourceTransformationDescriptionBuilder builder = parentBuilder.addChildResource(SecurityExtension.PATH_AUDIT_CLASSIC); MappingProviderModuleDefinition.registerTransformers_1_3_0(builder); }
Source:
<code>public void withoutInitialTokenShouldCallFresherOnlyOnceWhileRefreshingIsInProgress() throws InterruptedException, ExecutionException, IOException { longRunningRefresher.resetCallCount(); <START> CommunicationTokenCredential userCredential = new CommunicationTokenCredential(longRunningRefresher); <END> userCredential.getToken(); assertEquals(1, longRunningRefresher.numCalls()); for (int i = 0; i < 3; i++) { userCredential.getToken(); assertEquals(1, longRunningRefresher.numCalls(), "No additional calls made by getToken call"); } userCredential.close(); }</code><technical_language>rename variables</technical_language>

Target:
public void withoutInitialTokenShouldCallFresherOnlyOnceWhileRefreshingIsInProgress() throws InterruptedException, ExecutionException, IOException { longRunningRefresher.resetCallCount(); CommunicationTokenCredential tokenCredential = new CommunicationTokenCredential(longRunningRefresher); tokenCredential.getToken(); assertEquals(1, longRunningRefresher.numCalls()); for (int i = 0; i < 3; i++) { tokenCredential.getToken(); assertEquals(1, longRunningRefresher.numCalls(), "No additional calls made by getToken call"); } tokenCredential.close(); }
Source:
<code>public void initGui() { acrossX = this.width * 6 / 8 - 2 * tileSize; acrossY = this.height * 6 / 8 - 2 * tileSize; leftX = this.width * 1 / 8; topY = this.height * 1 / 8; rightX = this.width * 7 / 8 - tileSize; bottomY = (topY + tileSize) + (acrossY); sliderTopY = topY + borderSize; sliderBotY = bottomY + borderSize - sliderHeight; maxLength = acrossX + 3 / 2 * borderSize - sliderWidth; textX = leftX + 24; textY = topY + 24; maxLines = (acrossY + borderSize) / 10; book = mc.player.inventory.getStackInSlot(itemSlot); if (book.hasTagCompound()) { <START> System.out.println("Book has nbt"); <END> NBTTagCompound nbtTagCompound = book.getTagCompound(); this.page = nbtTagCompound.getInteger("page"); this.sliderProgress = nbtTagCompound.getFloat("sliderProgress"); } else { System.out.println("Book doesn't have NBT"); this.page = 1; this.sliderProgress = 0.0F; } this.buttonList.clear(); this.nextPageBtn = this.addButton(new GuiButton(0, this.width / 2 + 100, this.height - 30, 20, 20, ">")); this.prevPageBtn = this.addButton(new GuiButton(1, this.width / 2 - 120, this.height - 30, 20, 20, "<")); this.slider = this.addButton(new GuiButton(2, rightX + borderSize - sliderHeight, sliderTopY + (int) ((sliderBotY - sliderTopY) * sliderProgress), sliderWidth, sliderHeight, "|||")); splitLines(); }</code><technical_language>debug prints? Remove merging</technical_language>

Target:
public void initGui() { acrossX = this.width * 6 / 8 - 2 * tileSize; acrossY = this.height * 6 / 8 - 2 * tileSize; leftX = this.width * 1 / 8; topY = this.height * 1 / 8; rightX = (leftX + tileSize) + (acrossX); bottomY = (topY + tileSize) + (acrossY); sliderTopY = topY + borderSize; sliderBotY = bottomY + borderSize - sliderHeight; maxLength = acrossX + 3 / 2 * borderSize - sliderWidth; textX = leftX + 24; textY = topY + 24; maxLines = (acrossY + borderSize) / 10; if (hand == EnumHand.MAIN_HAND) book = mc.player.getHeldItemMainhand(); else book = mc.player.getHeldItemOffhand(); if (book.hasTagCompound()) { NBTTagCompound nbtTagCompound = book.getTagCompound(); this.page = nbtTagCompound.getInteger("page"); this.sliderProgress = nbtTagCompound.getFloat("sliderProgress"); } else { this.page = 1; this.sliderProgress = 0.0F; } this.buttonList.clear(); this.nextPageBtn = this.addButton(new GuiButton(0, this.width / 2 + 100, this.height - 30, 20, 20, ">")); this.nextPageBtn.enabled = page != pageMax; this.prevPageBtn = this.addButton(new GuiButton(1, this.width / 2 - 120, this.height - 30, 20, 20, "<")); this.prevPageBtn.enabled = page != 1; this.slider = this.addButton(new GuiButton(2, rightX + borderSize - sliderHeight, sliderTopY + (int) ((sliderBotY - sliderTopY) * sliderProgress), sliderWidth, sliderHeight, "|||")); text = splitLines(StringUtils.translate("book.quickstart." + page), fontRenderer, maxLength); }
Source:
<code>public Optional<World> getLoadedWorld() { <START> return Optional.ofNullable((World) world); <END> }</code><technical_language>this</technical_language>

Target:
public Optional<World> getLoadedWorld() { return Optional.ofNullable((World) this.world); }
Source:
<code><START> protected Map<String, Pair<String, String>> getExclusiveLocks() { <END> if (!isInternalExecution()) { return Collections.singletonMap(getGeoRepSession().getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.GLUSTER_GEOREP, VdcBllMessages.ACTION_TYPE_FAILED_GEOREP_SESSION_LOCKED)); } return super.getExclusiveLocks(); }</code><technical_language>get lock georep session in case. in else case, get lock cluster level. Is expected behavior</technical_language>

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { if (!isInternalExecution()) { return Collections.singletonMap(getGeoRepSession().getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.GLUSTER_GEOREP, VdcBllMessages.ACTION_TYPE_FAILED_GEOREP_SESSION_LOCKED)); } return null; }
Source:
<code>private Map<String, String> userMappingStrToMap(String userMappingStr) { userMappingStr = userMappingStr.trim(); if (userMappingStr.isEmpty()) { return Collections.emptyMap(); } <START> Map<String, String> ret = new HashMap<>(); <END> String[] mappings = userMappingStr.split(";"); Arrays.stream(mappings).forEach(mapping -> { String[] entry = mapping.split("="); String key = entry[0]; String val = entry[1]; ret.put(key, val); }); return ret; }</code><technical_language>give this variable a meaningful name</technical_language>

Target:
private Map<String, String> userMappingStrToMap(String userMappingStr) { Map<String, String> userMappingMap = new HashMap<>(); userMappingStr = userMappingStr.trim(); if (userMappingStr.isEmpty()) { LOGGER.info("Existing azure cloud mappings are empty"); } else { String[] mappings = userMappingStr.split(";"); Arrays.stream(mappings).forEach(mapping -> { String[] entry = mapping.split("="); if (entry.length == 2) { String key = entry[0]; String val = entry[1]; userMappingMap.put(key, val); } else { LOGGER.warn("Skipping malformed azure cloud mapping entry: {}", mapping); } }); } return userMappingMap; }
Source:
<code>public void allHostNTProcedureCallback(ClientResponse clientResponse) { synchronized(m_allHostCallbackLock) { int hostId = Integer.parseInt(clientResponse.getAppStatusString()); <START> if (m_outstandingAllHostProcedureHostIds == null) { <END> return; } boolean removed = m_outstandingAllHostProcedureHostIds.remove(hostId); if (!removed) { tmLog.error(String.format( "ProcedureRunnerNT.allHostNTProcedureCallback for procedure %s received late or unexepected response from hostID %d.", m_procedureName, hostId)); return; } m_allHostResponses.put(hostId, clientResponse); if (m_outstandingAllHostProcedureHostIds.size() == 0) { m_outstandingAllHostProc.set(false); m_allHostFut.complete(m_allHostResponses); } } }</code><technical_language>I this error if this occurs. In this case system expecting responses in progress NT procedure</technical_language>

Target:
public void allHostNTProcedureCallback(ClientResponse clientResponse) { synchronized(m_allHostCallbackLock) { int hostId = Integer.parseInt(clientResponse.getAppStatusString()); assert (m_outstandingAllHostProcedureHostIds != null); boolean removed = m_outstandingAllHostProcedureHostIds.remove(hostId); if (!removed) { tmLog.error(String.format( "ProcedureRunnerNT.allHostNTProcedureCallback for procedure %s received late or unexepected response from hostID %d.", m_procedureName, hostId)); return; } m_allHostResponses.put(hostId, clientResponse); if (m_outstandingAllHostProcedureHostIds.size() == 0) { m_outstandingAllHostProc.set(false); m_allHostFut.complete(m_allHostResponses); } } }
Source:
<code>public void initializeUI(final UIBuilder builder) throws Exception { UIContext uiContext = builder.getUIContext(); Project project = getSelectedProject(uiContext); JPAFacet<PersistenceCommonDescriptor> persistenceFacet = project.getFacet(JPAFacet.class); targets.setValueChoices(persistenceFacet.getAllEntities()); targets.setItemLabelConverter(new Converter<JavaClassSource, String>() { @Override public String convert(JavaClassSource source) { return source == null ? null : source.getQualifiedName(); } }); builder.add(targets); if (uiContext.getProvider().isGUI()) { useCustomTemplate.setDefaultValue(false); pageTemplate.setEnabled(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return useCustomTemplate.getValue(); } }); builder.add(useCustomTemplate).add(pageTemplate); } else { builder.add(pageTemplate); } generateEqualsAndHashCode.setEnabled(new Callable<Boolean>() { @Override public Boolean call() throws Exception { <START> for (JavaClassSource klass : targets.getValue()) <END> { if (!klass.hasMethodSignature("hashCode") || !klass.hasMethodSignature("equals", Object.class)) { return true; } } return false; } }); builder.add(generateEqualsAndHashCode); }</code><technical_language>typically call "source" "javaSource" - "klass" is before</technical_language>

Target:
public void initializeUI(final UIBuilder builder) throws Exception { UIContext uiContext = builder.getUIContext(); Project project = getSelectedProject(uiContext); JPAFacet<PersistenceCommonDescriptor> persistenceFacet = project.getFacet(JPAFacet.class); targets.setValueChoices(persistenceFacet.getAllEntities()); targets.setItemLabelConverter(new Converter<JavaClassSource, String>() { @Override public String convert(JavaClassSource source) { return source == null ? null : source.getQualifiedName(); } }); builder.add(targets); if (uiContext.getProvider().isGUI()) { useCustomTemplate.setDefaultValue(false); pageTemplate.setEnabled(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return useCustomTemplate.getValue(); } }); builder.add(useCustomTemplate).add(pageTemplate); } else { builder.add(pageTemplate); } generateEqualsAndHashCode.setEnabled(new Callable<Boolean>() { @Override public Boolean call() throws Exception { for (JavaClassSource javaSource : targets.getValue()) { if (!javaSource.hasMethodSignature("hashCode") || !javaSource.hasMethodSignature("equals", Object.class)) { return true; } } return false; } }); builder.add(generateEqualsAndHashCode); }
Source:
<code>void logRenamedEntity() { if (this instanceof RenamedEntityInfoProvider) { RenamedEntityInfoProvider renameable = (RenamedEntityInfoProvider) this; String entityType = renameable.getEntityType(); String oldEntityName = renameable.getEntityOldName(); <START> String newEntityName = renameable.getEntityNewName(); <END> if (!StringUtils.equals(oldEntityName, newEntityName)) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("EntityType", entityType); logable.AddCustomValue("OldEntityName", oldEntityName); logable.AddCustomValue("NewEntityName", newEntityName); renameable.setEntityId(logable); auditLog(logable, AuditLogType.ENTITY_RENAMED); } } }</code><technical_language>please run a formatter for if block. is properly indented</technical_language>

Target:
void logRenamedEntity() { if (this instanceof RenamedEntityInfoProvider) { RenamedEntityInfoProvider renameable = (RenamedEntityInfoProvider) this; String oldEntityName = renameable.getEntityOldName(); String newEntityName = renameable.getEntityNewName(); if (!StringUtils.equals(oldEntityName, newEntityName)) { AuditLogableBase logable = new AuditLogableBase(); String entityType = renameable.getEntityType(); logable.addCustomValue("EntityType", entityType); logable.addCustomValue("OldEntityName", oldEntityName); logable.addCustomValue("NewEntityName", newEntityName); renameable.setEntityId(logable); auditLog(logable, AuditLogType.ENTITY_RENAMED); } } }
Source:
<code>public AmqpInboundChannelAdapter adapter() { AmqpInboundChannelAdapter adapter = new AmqpInboundChannelAdapter(container()); <START> adapter.setAutoStartup(false); <END> adapter.setOutputChannel(channels.output()); DefaultAmqpHeaderMapper headerMapper = new DefaultAmqpHeaderMapper(); headerMapper.setRequestHeaderNames( StringUtils.commaDelimitedListToStringArray(this.properties.getMappedRequestHeaders())); adapter.setHeaderMapper(headerMapper); return adapter; }</code><technical_language>Is this necessary? for container() above: this.messageListenerContainer = listenerContainer; this.messageListenerContainer.setAutoStartup(false); M-m-m. Minor, of course, if is cares Lifecycles..</technical_language>

Target:
public AmqpInboundChannelAdapter adapter() { AmqpInboundChannelAdapter adapter = new AmqpInboundChannelAdapter(container()); adapter.setOutputChannel(channels.output()); DefaultAmqpHeaderMapper headerMapper = new DefaultAmqpHeaderMapper(); headerMapper.setRequestHeaderNames( StringUtils.commaDelimitedListToStringArray(this.properties.getMappedRequestHeaders())); adapter.setHeaderMapper(headerMapper); return adapter; }
Source:
<code>@Override public void parseArguments(CommandArgIterator argIter) { <START> force = false; <END> if (argIter.hasNextArg()) { String arg = argIter.peekNextArg(); if (FORCE_COMMAND.equalsIgnoreCase(arg)) { force = true; argIter.nextArg(""); } } }</code><technical_language>Do need this line? Default force is false already</technical_language>

Target:
@Override public void parseArguments(CommandArgIterator argIter) { forceDeactivation = false; if (argIter.hasNextArg()) { String arg = argIter.peekNextArg(); if (FORCE_COMMAND.equalsIgnoreCase(arg)) { forceDeactivation = true; argIter.nextArg(""); } } }
Source:
<code>public Publisher<CoreEvent> apply(Publisher<CoreEvent> publisher) { return from(publisher) .doOnNext(event -> { <START> final DefaultFlowCallStack flowCallStack = (DefaultFlowCallStack) event.getFlowCallStack(); final ComponentIdentifier identifier = (ComponentIdentifier) getAnnotation(ANNOTATION_NAME); if (identifier.getNamespace() == null || "tns".equals(identifier.getNamespace())) { final String[] peekedWithNamespace = flowCallStack.peek().getFlowName().split("\\:"); String peekedNamespace = peekedWithNamespace[0]; flowCallStack.push(new FlowStackElement(peekedNamespace + ":" + identifier.getName(), null)); } else { flowCallStack.push(new FlowStackElement(identifier.getNamespace() + ":" + identifier.getName(), null)); } <END> }) .transform(eventPub -> applyWithChildContext(from(eventPub).map(this::createEventWithParameters), nestedChain, ofNullable(getLocation()), errorHandler())) .doOnNext(event -> ((DefaultFlowCallStack) event.getFlowCallStack()).pop()) .map(eventResult -> processResult(getInternalParameter(ORIGINAL_EVENT_KEY, eventResult), eventResult)); }</code><technical_language>Extract this, FlowStackElement creation part chain more readable</technical_language>

Target:
public Publisher<CoreEvent> apply(Publisher<CoreEvent> publisher) { return from(publisher) .doOnNext(this::pushFlowStackEntry) .transform(eventPub -> applyWithChildContext(from(eventPub).map(this::createEventWithParameters), nestedChain, ofNullable(getLocation()), errorHandler())) .doOnNext(event -> ((DefaultFlowCallStack) event.getFlowCallStack()).pop()) .map(eventResult -> processResult(getInternalParameter(ORIGINAL_EVENT_KEY, eventResult), eventResult)); }
Source:
<code>public void purgeCondition_shouldPurgeCondition() { int conditionId = 1; executeDataSet(CONDITION_XML); conditionService.purgeCondition(conditionService.getCondition(conditionId)); expectedException = ExpectedException.none(); Condition condition = conditionService.getCondition(conditionId); <START> Assert.assertNull(condition); <END> }</code><technical_language>this null purging</technical_language>

Target:
public void purgeCondition_shouldPurgeCondition() { Integer conditionId = 1; Condition existingCondition = conditionService.getCondition(conditionId); Assert.assertNotNull(existingCondition); conditionService.purgeCondition(conditionService.getCondition(conditionId)); Condition purgedCondition = conditionService.getCondition(conditionId); Assert.assertNull(purgedCondition); }
Source:
<code>public static Date convertEventTimestampToDate(String timestamp) throws ParseException { <START> timestamp = timestamp.replaceAll("[^\\d-:]", " ").trim(); <END> Date date = dateFormat.parse(timestamp); return date; }</code><technical_language>I is simplify parsing date format "yyyy-MM-dd'T'HH:mm:ssX" replacing anything</technical_language>

Target:
public static Date convertEventTimestampToDate(String timestamp) throws ParseException { return dateFormat.parse(timestamp); }
Source:
<code>private static void checkConfiguration() { if (!config.getBooleanProperty(CoreConfig.INGEST_MODE)) { log.error("Ingestion mode not enabled. Please check your configuration"); System.exit(StopReasons.INCORRECT_CONFIGURATION); } log.info("Configuration is good"); boolean useZookeeper = false; <START> log.info("Using zookeeper? " + useZookeeper); <END> }</code><technical_language>delete boolean this log statement? I of variable</technical_language>

Target:
private static void checkConfiguration() { if (!config.getBooleanProperty(CoreConfig.INGEST_MODE)) { log.error("Ingestion mode not enabled. Please check your configuration"); System.exit(StopReasons.INCORRECT_CONFIGURATION); } log.info("Configuration is good"); }
Source:
<code>public byte[] getAPIData() { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { <START> os.write(sourceAddress.getValue()); <END> os.write(rssi); os.write(receiveOptions); if (receivedData != null) os.write(receivedData); } catch (IOException e) { e.printStackTrace(); } return os.toByteArray(); }</code><technical_language>Check if address is null</technical_language>

Target:
public byte[] getAPIData() { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(sourceAddress.getValue()); os.write(rssi); os.write(receiveOptions); if (receivedData != null) os.write(receivedData); } catch (IOException e) { } return os.toByteArray(); }