auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private List<org.atlasapi.media.entity.simple.TopicRef> topicRefToSimple(final Content content, List<TopicRef> contentTopics, final Set<Annotation> annotations, final Application application) { final Map<Long, Topic> topics = Maps.uniqueIndex(res(Iterables.transform(contentTopics, TOPICREF_TO_TOPIC_ID), annotations), TOPIC_TO_TO_TOPIC_ID); return Lists.transform(contentTopics, topicRef -> { <START> org.atlasapi.media.entity.simple.TopicRef tr = new org.atlasapi.media.entity.simple.TopicRef(); <END> tr.setSupervised(topicRef.isSupervised()); tr.setWeighting(topicRef.getWeighting()); tr.setRelationship(topicRef.getRelationship().toString()); tr.setOffset(topicRef.getOffset()); tr.setTopic(topicSimplifier.simplify(topics.get(topicRef.getTopic()), annotations, application)); if (annotations.contains(Annotation.PUBLISHER)) { tr.setPublisher(toPublisherDetails(topicRef.getPublisher())); } return tr; }); }</code><technical_language>Avoid initialising variable names tr -> ref</technical_language>

Target:
private List<org.atlasapi.media.entity.simple.TopicRef> topicRefToSimple( final Content content, List<TopicRef> contentTopics, final Set<Annotation> annotations, final Application application ) { final Map<Long, Topic> topics = Maps.uniqueIndex(res(contentTopics.stream() .map(TopicRef::getTopic) .collect(Collectors.toList()), annotations), Identified::getId); return Lists.transform(contentTopics, topicRef -> { org.atlasapi.media.entity.simple.TopicRef simpleTopicRef = new org.atlasapi.media.entity.simple.TopicRef(); simpleTopicRef.setSupervised(topicRef.isSupervised()); simpleTopicRef.setWeighting(topicRef.getWeighting()); simpleTopicRef.setRelationship(topicRef.getRelationship().toString()); simpleTopicRef.setOffset(topicRef.getOffset()); simpleTopicRef.setTopic(topicSimplifier.simplify(topics.get(topicRef.getTopic()), annotations, application)); if (annotations.contains(Annotation.PUBLISHER)) { simpleTopicRef.setPublisher(toPublisherDetails(topicRef.getPublisher())); } return simpleTopicRef; }); }
Source:
<code>public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(NoWhitespaceBeforeCheck.class); final String[] expected = { "30:15: " + getCheckMessage(MSG_KEY, "++"), "30:22: " + getCheckMessage(MSG_KEY, "--"), "176:19: " + getCheckMessage(MSG_KEY, ";"), "178:24: " + getCheckMessage(MSG_KEY, ";"), "185:19: " + getCheckMessage(MSG_KEY, ";"), "187:28: " + getCheckMessage(MSG_KEY, ";"), "195:27: " + getCheckMessage(MSG_KEY, ";"), "211:16: " + getCheckMessage(MSG_KEY, ";"), "266:1: " + getCheckMessage(MSG_KEY, ";"), "270:16: " + getCheckMessage(MSG_KEY, ";"), "284:1: " + getCheckMessage(MSG_KEY, ";"), <START> }; <END> verify(checkConfig, getPath("InputNoWhitespaceBeforeDefault.java"), expected); }</code><technical_language>please add google style Inputs bunch of code combinations of ... annotations</technical_language>

Target:
public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(NoWhitespaceBeforeCheck.class); final String[] expected = { "30:15: " + getCheckMessage(MSG_KEY, "++"), "30:22: " + getCheckMessage(MSG_KEY, "--"), "176:19: " + getCheckMessage(MSG_KEY, ";"), "178:24: " + getCheckMessage(MSG_KEY, ";"), "185:19: " + getCheckMessage(MSG_KEY, ";"), "187:28: " + getCheckMessage(MSG_KEY, ";"), "195:27: " + getCheckMessage(MSG_KEY, ";"), "211:16: " + getCheckMessage(MSG_KEY, ";"), "266:1: " + getCheckMessage(MSG_KEY, ";"), "270:16: " + getCheckMessage(MSG_KEY, ";"), "284:1: " + getCheckMessage(MSG_KEY, ";"), "287:62: " + getCheckMessage(MSG_KEY, "..."), "291:16: " + getCheckMessage(MSG_KEY, ":"), }; verify(checkConfig, getPath("InputNoWhitespaceBeforeDefault.java"), expected); }
Source:
<code><START> public void localhostOnlyFlagResultsInConnectableFitnesseOnLocalHost() throws Exception { <END> String[] args = {"-p", "1999", "-lh"}; new FitNesseMain().launchFitNesse(new Arguments(args)); URL url = new URL("http://localhost:1999"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); con.disconnect(); assertEquals(200, responseCode); }</code><technical_language>Locally, a ./gradlew test fails tests. work for you? I this test a server running. Is case? If so, please ensure is cleaned test completes..</technical_language>

Target:
public void localhostOnlyFlagResultsInConnectableFitnesseOnLocalHost() throws Exception { String[] args = {"-p", "1999", "-lh"}; new FitNesseMain().launchFitNesse(new Arguments(args)); URL url = new URL("http://localhost:1999/?shutdown"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); con.disconnect(); assertEquals(200, responseCode); }
Source:
<code>public AccountCreationPolicy setVerificationEmailStatus(EmailStatus accountVerificationEmailStatus) { <START> Assert.notNull(accountVerificationEmailStatus, "verificationEmailStatus cannot be null."); <END> setProperty(ACCOUNT_VERIFICATION_EMAIL_STATUS, accountVerificationEmailStatus.name()); return this; }</code><technical_language>accountVerificationEmailStatus null</technical_language>

Target:
public AccountCreationPolicy setVerificationEmailStatus(EmailStatus accountVerificationEmailStatus) { Assert.notNull(accountVerificationEmailStatus, "accountVerificationEmailStatus cannot be null."); setProperty(ACCOUNT_VERIFICATION_EMAIL_STATUS, accountVerificationEmailStatus.name()); return this; }
Source:
<code>protected int getDeviceZoom() { long screen = OS.gdk_screen_get_default(); final String <START> schemaId = <END> "com.ubuntu.user-interface"; byte[] schema_id = Converter.wcsToMbcs (null, schemaId, true); long schemaSource = OS.g_settings_schema_source_get_default (); if (OS.g_settings_schema_source_lookup(schemaSource, schema_id, false) != 0) { displaySettings = OS.g_settings_new (schema_id); if (!isConnected) { gsettingsCallback = new Callback (this, "gsettingsProc", 3); gsettingsProc = gsettingsCallback.getAddress (); if (gsettingsProc == 0) { SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); } int retVal = OS.g_signal_connect (displaySettings, OS.changed, gsettingsProc, CHANGE_SCALEFACTOR); if (retVal > 0) { isConnected = true; } } scaleFactor = (int)OS.gdk_screen_get_resolution (screen); return DPIUtil.mapDPIToZoom(scaleFactor); } else { int monitor = OS.gdk_screen_get_monitor_at_point(screen, 0, 0); GdkRectangle dest = new GdkRectangle (); OS.gdk_screen_get_monitor_geometry(screen, monitor, dest); int widthMM = OS.gdk_screen_get_monitor_width_mm(screen, monitor); return (DPIUtil.mapDPIToZoom(Compatibility.round (254 * dest.width, widthMM * 10))); } }</code><technical_language>get rid of this Ubuntu-specific setting. try signals added in OS.java</technical_language>

Target:
protected int getDeviceZoom() { long screen = OS.gdk_screen_get_default(); int scaleFactor = (int) OS.gdk_screen_get_resolution (screen); if (OS.GTK_VERSION > OS.VERSION(3, 9, 0)) { Rectangle rect = getBounds(); int monitor_num = OS.gdk_screen_get_monitor_at_point(screen, rect.x, rect.y); int scale = (int) OS.gdk_screen_get_monitor_scale_factor(screen, monitor_num); scaleFactor = Math.max(scaleFactor, scale * 96); } return DPIUtil.mapDPIToZoom(scaleFactor); }
Source:
<code>public final Object createDirectory(final String dir, final SBlock fail) { try { Files.createDirectories(Paths.get(dir), new FileAttribute<?>[0]); } catch (IOException e) { <START> fail.getMethod().invoke(new Object[] {fail, e.toString()}); <END> } return Nil.nilObject; }</code><technical_language>block dispatch node for block things</technical_language>

Target:
public final Object createDirectory(final String dir, final SBlock fail) { try { Files.createDirectories(Paths.get(dir), new FileAttribute<?>[0]); } catch (IOException e) { dispatchHandler.executeDispatch(new Object[] {fail, e.toString()}); } return Nil.nilObject; }
Source:
<code>public void should_CatchSubProcessBoundaryErrorEvent_When_ErrorEndEvenThrown(){ securityUtil.logInAs("user"); ProcessInstance processInstance = processRuntime.start( ProcessPayloadBuilder .start() .withProcessDefinitionKey(ERROR_BOUNDARY_EVENT_SUBPROCESS) .build()); assertNotNull(processInstance); <START> Page<ProcessInstance> processInstancePage = processRuntime.processInstances(Pageable.of(0, <END> 50), ProcessPayloadBuilder .processInstances().withProcessDefinitionKey(ERROR_BOUNDARY_EVENT_SUBPROCESS) .build()); assertThat(processInstancePage).isNotNull(); assertThat(processInstancePage.getContent()).hasSize(0); assertThat(listener.getErrorReceivedEvents()) .isNotEmpty() .extracting(BPMNErrorReceivedEvent::getEventType, BPMNErrorReceivedEvent::getProcessDefinitionId, BPMNErrorReceivedEvent::getProcessInstanceId, event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId(), event -> event.getEntity().getElementId(), event -> event.getEntity().getActivityName(), event -> event.getEntity().getActivityType(), event -> event.getEntity().getErrorId(), event -> event.getEntity().getErrorCode() ) .contains(Tuple.tuple(BPMNErrorReceivedEvent.ErrorEvents.ERROR_RECEIVED, processInstance.getProcessDefinitionId(), processInstance.getId(), processInstance.getProcessDefinitionId(), processInstance.getId(), "catchError", null, null, "errorId", "123" )); }</code><technical_language>Here, in tests, I interesting a user task error catch event, test process is running pointing user task</technical_language>

Target:
public void should_CatchSubProcessBoundaryErrorEvent_When_ErrorEndEvenThrown(){ securityUtil.logInAs("user"); ProcessInstance processInstance = processRuntime.start( ProcessPayloadBuilder .start() .withProcessDefinitionKey(ERROR_BOUNDARY_EVENT_SUBPROCESS) .build()); assertNotNull(processInstance); checkProcessAndTask(processInstance.getId(), "Task"); assertThat(listener.getErrorReceivedEvents()) .isNotEmpty() .extracting(BPMNErrorReceivedEvent::getEventType, BPMNErrorReceivedEvent::getProcessDefinitionId, BPMNErrorReceivedEvent::getProcessInstanceId, event -> event.getEntity().getProcessDefinitionId(), event -> event.getEntity().getProcessInstanceId(), event -> event.getEntity().getElementId(), event -> event.getEntity().getActivityName(), event -> event.getEntity().getActivityType(), event -> event.getEntity().getErrorId(), event -> event.getEntity().getErrorCode() ) .contains(Tuple.tuple(BPMNErrorReceivedEvent.ErrorEvents.ERROR_RECEIVED, processInstance.getProcessDefinitionId(), processInstance.getId(), processInstance.getProcessDefinitionId(), processInstance.getId(), "catchError", null, null, "errorId", "123" )); }
Source:
<code>private String determinePlayerListText() { Iterable<EntityRef> allClients = entityManager.getEntitiesWith(ClientComponent.class); StringBuilder sb = new StringBuilder(); boolean first = true; for (EntityRef clientEntity : allClients) { if (!first) { sb.append("\n"); } ClientComponent clientComp = clientEntity.getComponent(ClientComponent.class); <START> sb.append(PlayerUtil.getColoredPlayerName(clientComp.clientInfo) + <END> " "+ FontColor.getColored(clientComp.ping, Color.GREEN)); first = false; } return sb.toString(); }</code><technical_language>real need line break here. is 138 characters, code style max line length. fixing pre-existing inspection warning String concatenation a StringBuffer (could append calls). missing a space " + (super tiny issue)</technical_language>

Target:
private String determinePlayerListText() { Iterable<EntityRef> allClients = entityManager.getEntitiesWith(ClientComponent.class); StringBuilder sb = new StringBuilder(); boolean first = true; for (EntityRef clientEntity : allClients) { if (!first) { sb.append("\n"); } ClientComponent clientComp = clientEntity.getComponent(ClientComponent.class); sb.append(PlayerUtil.getColoredPlayerName(clientComp.clientInfo)); first = false; } return sb.toString(); }
Source:
<code>public CommitCommand setAuthor(String name, String email) { <START> this.author = new PersonIdent(name, email); <END> return this; }</code><technical_language>Style-nit: setCommitter(name, email) overload</technical_language>

Target:
public CommitCommand setAuthor(String name, String email) { return setAuthor(new PersonIdent(name, email)); }
Source:
<code>public void setUp() { SimpleDependecyInjector.getInstance().bind(OsRepository.class, osRepository); final int osId = 0; <START> Map<Integer, Map<Version, List<DisplayType>>> displayTypeMap = new HashMap<Integer, Map<Version, List<DisplayType>>>(); <END> displayTypeMap.put(osId, new HashMap<Version, List<DisplayType>>()); displayTypeMap.get(osId).put(null, Arrays.asList(DisplayType.qxl)); when(osRepository.getDisplayTypes()).thenReturn(displayTypeMap); }</code><technical_language>new HashMap<> is enough thanks jdk7. I forget well</technical_language>

Target:
public void setUp() { SimpleDependecyInjector.getInstance().bind(OsRepository.class, osRepository); final int osId = 0; Map<Integer, Map<Version, List<DisplayType>>> displayTypeMap = new HashMap<>(); displayTypeMap.put(osId, new HashMap<Version, List<DisplayType>>()); displayTypeMap.get(osId).put(null, Arrays.asList(DisplayType.qxl)); when(osRepository.getDisplayTypes()).thenReturn(displayTypeMap); }
Source:
<code>private List<VdsNetworkInterface> getLabeledNics(Network network) { <START> List<NetworkCluster> clusters = getNetworkClusterDao().getAllForNetwork(network.getId()); <END> List<VdsNetworkInterface> labeledNics = new ArrayList<>(); for (NetworkCluster networkCluster : clusters) { labeledNics.addAll(getDbFacade().getInterfaceDao() .getAllInterfacesByLabelForCluster(networkCluster.getClusterId(), network.getLabel())); } return labeledNics; }</code><technical_language>dao present in class field of superclass</technical_language>

Target:
private List<VdsNetworkInterface> getLabeledNics(Network network) { List<NetworkCluster> clusters = networkClusterDao.getAllForNetwork(network.getId()); List<VdsNetworkInterface> labeledNics = new ArrayList<>(); for (NetworkCluster networkCluster : clusters) { labeledNics.addAll(interfaceDao.getAllInterfacesByLabelForCluster(networkCluster.getClusterId(), network.getLabel())); } return labeledNics; }
Source:
<code>public void dispose() { getSelectionService().removeSelectionListener(this.selectionListener); final IWorkbenchWindow[] windows = PlatformUI.getWorkbench() .getWorkbenchWindows(); for (IWorkbenchWindow window : windows) { <START> window.addPageListener(this.wListener); <END> for (IWorkbenchPage page : window.getPages()) { page.removePartListener(this.wListener); } } super.dispose(); }</code><technical_language>I assume 'removePageLsitener' expected</technical_language>

Target:
public void dispose() { getSelectionService().removeSelectionListener(this.selectionListener); final IWorkbenchWindow[] windows = PlatformUI.getWorkbench() .getWorkbenchWindows(); for (IWorkbenchWindow window : windows) { window.removePageListener(this.wListener); for (IWorkbenchPage page : window.getPages()) { page.removePartListener(this.wListener); } } super.dispose(); }
Source:
<code>public JsonElement serialize(Date date, Type typeOfSrc, JsonSerializationContext context) { String dateString = format.format(date); <START> return new JsonPrimitive(dateString); <END> }</code><technical_language>[...] getFormat().format(date). need create a new instance of SimpleDateFormat thread-safe</technical_language>

Target:
public JsonElement serialize(Date date, Type typeOfSrc, JsonSerializationContext context) { String dateString = getFormat().format(date); return new JsonPrimitive(dateString); }
Source:
<code><START> public Optional<String> getMetadata(String id) { <END> GetRequestBuilder request = esClient.prepareGet(MetadataIndexDefinition.INDEX_TYPE_METADATA, id) .setStoredFields(MetadataIndexDefinition.FIELD_VALUE); GetResponse response = request.get(); if (response.isExists()) { GetField field = response.getField(MetadataIndexDefinition.FIELD_VALUE); String value = String.valueOf(field.getValue()); return Optional.of(value); } return Optional.empty(); }</code><technical_language>I a slight preference metadata keys defined here, more easily manage metadata index is for</technical_language>

Target:
private Optional<String> getMetadata(String id) { GetRequestBuilder request = esClient.prepareGet(MetadataIndexDefinition.INDEX_TYPE_METADATA, id) .setStoredFields(MetadataIndexDefinition.FIELD_VALUE); GetResponse response = request.get(); if (response.isExists()) { GetField field = response.getField(MetadataIndexDefinition.FIELD_VALUE); String value = String.valueOf(field.getValue()); return Optional.of(value); } return Optional.empty(); }
Source:
<code>public void modified(final Map<String, Object> configuration) { <START> logger.debug("modified"); <END> logger.debug("Cardio2e binding will be deactivated and reactivated to apply new configuration..."); purgeCardio2eBinding(); initializeCardio2eBinding(configuration); }</code><technical_language>Do need logger.debug() lines in this method</technical_language>

Target:
public void modified(final Map<String, Object> configuration) { logger.info("Configuration was been modified. Cardio2e binding will be deactivated and reactivated to apply new configuration..."); purgeCardio2eBinding(); initializeCardio2eBinding(configuration); }
Source:
<code>public void postsPullComment() throws Exception { final MkStorage storage = new MkStorage.InFile(); <START> final String body = "body"; <END> final String commit = "commit_id"; final String path = "path"; MkPullCommentsTest.repo(storage).pulls() .create("pullrequest1", "head", "base").comments() .post(body, commit, path, 1); final String[] fields = {body, commit, path}; for (final String element : fields) { MkPullCommentsTest.assertFieldContains(storage, element); } final List<String> xpath = storage.xml().xpath( "/github/repos/repo[@coords='test/test']/pulls/pull/comments/comment/position/text()" ); MatcherAssert.assertThat( xpath.get(0), Matchers.notNullValue() ); }</code><technical_language>"some text a body" instead</technical_language>

Target:
public void postsPullComment() throws Exception { final MkStorage storage = new MkStorage.InFile(); final String commit = "commit_id"; final String path = "path"; final String bodytext = "some text as a body"; MkPullCommentsTest.repo(storage).pulls() .create("pullrequest1", "head", "base").comments() .post(bodytext, commit, path, 1); final String[] fields = {commit, path}; for (final String element : fields) { MkPullCommentsTest.assertFieldContains(storage, element); } final List<String> position = storage.xml().xpath( "/github/repos/repo[@coords='test/test']/pulls/pull/comments/comment/position/text()" ); MatcherAssert.assertThat( position.get(0), Matchers.notNullValue() ); final List<String> body = storage.xml().xpath( "/github/repos/repo[@coords='test/test']/pulls/pull/comments/comment/body/text()" ); MatcherAssert.assertThat(body.get(0), Matchers.equalTo(bodytext)); }
Source:
<code>private static void computeInterfaceOrder(Class[] interfaces, Collection classes, Set seen) { List newInterfaces = new ArrayList(interfaces.length); for (Class <START> aInterface : <END> interfaces) { if (seen.add(aInterface)) { classes.add(aInterface); newInterfaces.add(aInterface); } } for (Iterator it = newInterfaces.iterator(); it.hasNext();) computeInterfaceOrder(((Class) it.next()).getInterfaces(), classes, seen); }</code><technical_language>I 'interfaze' more, in line clazz naming 'convention'</technical_language>

Target:
private static void computeInterfaceOrder(Class[] interfaces, Collection classes, Set seen) { List newInterfaces = new ArrayList(interfaces.length); for (Class interfaze : interfaces) { if (seen.add(interfaze)) { classes.add(interfaze); newInterfaces.add(interfaze); } } for (Iterator it = newInterfaces.iterator(); it.hasNext();) computeInterfaceOrder(((Class) it.next()).getInterfaces(), classes, seen); }
Source:
<code><START> public @Nullable ITimeGraphEntry[] getElements(@Nullable Object inputElement) { <END> if (inputElement != null) { try { List<?> list = (List<?>) inputElement; if (list.size() == 0) { return new ITimeGraphEntry[0]; } Object obj = list.get(0); if (!(obj instanceof CriticalPathBaseEntry)) { return new ITimeGraphEntry[0]; } Object worker = ((CriticalPathBaseEntry) obj).getWorker(); fCurrentObject = worker; Map<Object, CriticalPathEntry> entries = workerMaps.get(worker); if (entries != null) { return entries.values().toArray(new ITimeGraphEntry[entries.size()]); } entries = buildEntryList(worker); if (entries == null) { return new ITimeGraphEntry[0]; } workerMaps.put(worker, entries); return entries.values().toArray(new ITimeGraphEntry[entries.size()]); } catch (ClassCastException e) { } } return new ITimeGraphEntry[0]; }</code><technical_language>This part uncheckable, a class encapsulating list<CriticalPathEntries> generics molyporphism get</technical_language>

Target:
public @Nullable ITimeGraphEntry[] getElements(@Nullable Object inputElement) { if (inputElement != null) { try { List<?> list = (List<?>) inputElement; if (list.size() == 0) { return new ITimeGraphEntry[0]; } Object obj = list.get(0); if (!(obj instanceof CriticalPathBaseEntry)) { return new ITimeGraphEntry[0]; } IGraphWorker worker = ((CriticalPathBaseEntry) obj).getWorker(); fCurrentObject = worker; List<TimeGraphEntry> entries = workerEntries.get(worker); if (entries == null) { buildEntryList(worker); entries = workerEntries.get(worker); } if (entries == null) { return new ITimeGraphEntry[0]; } return entries.toArray(new ITimeGraphEntry[entries.size()]); } catch (ClassCastException e) { } } return new ITimeGraphEntry[0]; }
Source:
<code><START> public static void assertHasCodeReviewLabels(ChangeInfo changeInfo) { <END> assertThat(changeInfo, notNullValue()); Map<String, LabelInfo> labels = changeInfo.getLabels(); assertThat(labels, not(empty())); assertThat(labels.size(), is(1)); assertThat(labels, Matchers.<String, LabelInfo> hasKey("Code-Review")); Map<String, String> values = labels.get("Code-Review").getValues(); assertThat(values, not(empty())); assertThat(values.size(), is(5)); assertThat(values, Matchers.<String, String> hasKey("-2")); assertThat(values, Matchers.<String, String> hasKey("-1")); assertThat(values, Matchers.<String, String> hasKey(" 0")); assertThat(values, Matchers.<String, String> hasKey("+1")); assertThat(values, Matchers.<String, String> hasKey("+2")); assertThat(values.get("-2"), equalTo(CRVW.getValue((short) -2).getName())); assertThat(values.get("-1"), equalTo(CRVW.getValue((short) -1).getName())); assertThat(values.get(" 0"), equalTo(CRVW.getValue((short) 0).getName())); assertThat(values.get("+1"), equalTo(CRVW.getValue((short) 1).getName())); assertThat(values.get("+2"), equalTo(CRVW.getValue((short) 2).getName())); }</code><technical_language>delegate method below</technical_language>

Target:
public static void assertHasCodeReviewLabels(ChangeInfo changeInfo) { assertHasCodeReviewLabels(changeInfo, false); }
Source:
<code>public File captureWebElement(WebElement element, WebDriver driver) { <START> File screen = capturePage(driver); <END> Point start = element.getLocation(); int width = element.getSize().getWidth(); return cropImage(start, element.getSize(), screen); }</code><technical_language>capturePageScreenshot is more - capturePage a lot of meanings</technical_language>

Target:
public File captureWebElement(WebElement element, WebDriver driver) { File screen = capturePage(driver); Point start = element.getLocation(); return cropImage(start, element.getSize(), screen); }
Source:
<code>protected RequestTemplate resolve(Object[] argv, RequestTemplate mutable, Map<String, Object> variables) { if ("POST".equals(metadata.template().method()) && argv == null) { <START> encoder.encode("", String.class, mutable); <END> } return mutable.resolve(variables); }</code><technical_language>other clients? this work</technical_language>

Target:
protected RequestTemplate resolve(Object[] argv, RequestTemplate mutable, Map<String, Object> variables) { return mutable.resolve(variables); }
Source:
<code>public String toString() { StringBuilder builder = new StringBuilder(StringUtil.simpleClassName(this)).append('['); <START> for (String subscription : topics) { <END> builder.append("topicName = ").append(subscription).append(", "); } if (!topics.isEmpty()) { builder.setLength(builder.length() - 2); } return builder.append("]").toString(); }</code><technical_language>Please "for loop" style reduce GC</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(StringUtil.simpleClassName(this)).append('['); for (int i = 0; i < topics.size(); i++) { builder.append("topicName = ").append(topics.get(i)).append(", "); } if (!topics.isEmpty()) { builder.setLength(builder.length() - 2); } return builder.append("]").toString(); }
Source:
<code>protected void executeQueryCommand() { List<Disk> diskList = DbFacade.getInstance() .getDiskDao() .getAllAttachableDisksByPoolId(getParameters().getStoragePoolId(), getParameters().getVmId(), getUserID(), getParameters().isFiltered()); if (CollectionUtils.isEmpty(diskList)) { <START> setReturnValue(Collections.emptyList()); <END> return; } VM vm = DbFacade.getInstance().getVmDao().get(getParameters().getVmId(), getUserID(), getParameters().isFiltered()); if (vm == null) { setReturnValue(Collections.emptyList()); return; } List<String> supportedDiskInterfaceNames = getOsRepository().getDiskInterfaces(vm.getOs(), vm.getVdsGroupCompatibilityVersion()); Collection<DiskInterface> supportedDiskInterfaces = new HashSet<DiskInterface>(); for (String interfaceName : supportedDiskInterfaceNames) { try { supportedDiskInterfaces.add(DiskInterface.valueOf(interfaceName)); } catch (IllegalArgumentException e) { LOG.errorFormat("Can't find the value {0} in the enum DiskInterface. Error: {1}", ((interfaceName == null) ? "null" : interfaceName), e.toString()); } } List<Disk> filteredDiskList = new ArrayList<Disk>(); for (Disk disk : diskList) { if (supportedDiskInterfaces.contains(disk.getDiskInterface())) { filteredDiskList.add(disk); } } setReturnValue(filteredDiskList); }</code><technical_language>if this problems GWT on. set return "diskList" if empty</technical_language>

Target:
protected void executeQueryCommand() { List<Disk> diskList = DbFacade.getInstance() .getDiskDao() .getAllAttachableDisksByPoolId(getParameters().getStoragePoolId(), getParameters().getVmId(), getUserID(), getParameters().isFiltered()); if (CollectionUtils.isEmpty(diskList)) { setReturnValue(new ArrayList<>()); return; } VM vm = DbFacade.getInstance().getVmDao().get(getParameters().getVmId(), getUserID(), getParameters().isFiltered()); if (vm == null) { setReturnValue(new ArrayList<>()); return; } List<Disk> filteredDiskList = new ArrayList<Disk>(); for (Disk disk : diskList) { if (DiskValidator.isDiskInterfaceSupportedByOs(disk.getDiskInterface(), vm.getOs(), vm.getVdsGroupCompatibilityVersion())) { filteredDiskList.add(disk); } } setReturnValue(filteredDiskList); }
Source:
<code>protected void compareStoreConfiguration(String name, StoreConfiguration beforeStore, StoreConfiguration afterStore) { if (beforeStore instanceof AbstractStoreConfiguration) { AbstractStoreConfiguration beforeASC = (AbstractStoreConfiguration) beforeStore; AbstractStoreConfiguration afterASC = (AbstractStoreConfiguration) afterStore; compareAttributeSets(name, beforeASC.attributes(), afterASC.attributes()); <START> } else { <END> throw new IllegalArgumentException("Cannot compare stores of type: "+beforeStore.getClass().getName()); } }</code><technical_language>missing: compareAttributeSets(name, beforeASC.singletonStore().attributes(), afterASC.singletonStore().attributes()); compareAttributeSets(name, beforeASC.async().attributes(), afterASC.async().attributes());</technical_language>

Target:
protected void compareStoreConfiguration(String name, StoreConfiguration beforeStore, StoreConfiguration afterStore) { if (beforeStore instanceof AbstractStoreConfiguration) { AbstractStoreConfiguration beforeASC = (AbstractStoreConfiguration) beforeStore; AbstractStoreConfiguration afterASC = (AbstractStoreConfiguration) afterStore; compareAttributeSets(name, beforeASC.attributes(), afterASC.attributes()); compareAttributeSets(name, beforeASC.singletonStore().attributes(), afterASC.singletonStore().attributes()); compareAttributeSets(name, beforeASC.async().attributes(), afterASC.async().attributes()); } else { throw new IllegalArgumentException("Cannot compare stores of type: "+beforeStore.getClass().getName()); } }
Source:
<code>public String getTypeImage() { if (isTypeInferred()) { <START> return getImage(); <END> } ASTClassOrInterfaceType refType = getFirstDescendantOfType(ASTClassOrInterfaceType.class); if (refType != null) { return refType.getImage(); } return getFirstDescendantOfType(ASTPrimitiveType.class).getImage(); }</code><technical_language>is this ok? return null / empty string here</technical_language>

Target:
public String getTypeImage() { ASTClassOrInterfaceType refType = getFirstDescendantOfType(ASTClassOrInterfaceType.class); if (refType != null) { return refType.getImage(); } return getFirstDescendantOfType(ASTPrimitiveType.class).getImage(); }
Source:
<code>public void convertSemVerToAvailableVersion() { Assert.assertEquals("1.10.0", PipHelper.convertSemVerToAvailableVersion(PipHelper.DEV_SEM_VER)); <START> Assert.assertEquals("1.10.0", PipHelper.convertSemVerToAvailableVersion(null)); <END> Assert.assertEquals("1.7.0", PipHelper.convertSemVerToAvailableVersion("1.7.0-snapshot")); Assert.assertEquals("1.7.0", PipHelper.convertSemVerToAvailableVersion("1.7.0")); Assert.assertEquals("1.6.0", PipHelper.convertSemVerToAvailableVersion("1.6.0-snapshot")); Assert.assertEquals("1.6.0", PipHelper.convertSemVerToAvailableVersion("1.6.0")); Assert.assertEquals("1.5.0", PipHelper.convertSemVerToAvailableVersion("1.5.0-snapshot")); Assert.assertEquals("1.5.0", PipHelper.convertSemVerToAvailableVersion("1.5.0")); Assert.assertEquals("1.4.0", PipHelper.convertSemVerToAvailableVersion("1.4.0-snapshot")); Assert.assertEquals("1.4.0", PipHelper.convertSemVerToAvailableVersion("1.4.0")); Assert.assertEquals("1.4.0", PipHelper.convertSemVerToAvailableVersion("1.3.0-snapshot")); Assert.assertEquals("1.4.0", PipHelper.convertSemVerToAvailableVersion("1.3.0")); }</code><technical_language>Ideally tests for PipHelper.convertSemVerToAvailableVersion("1.10.0") PipHelper.convertSemVerToAvailableVersion("1.10.1) if I understand parameters passed in</technical_language>

Target:
public void convertSemVerToAvailableVersion() { Assert.assertEquals("1.10.0", PipHelper.convertSemVerToAvailableVersion(PipHelper.DEV_SEM_VER)); Assert.assertEquals("1.10.0", PipHelper.convertSemVerToAvailableVersion(null)); Assert.assertEquals("1.10.0", PipHelper.convertSemVerToAvailableVersion("9000.9000.9000")); Assert.assertEquals("1.10.0", PipHelper.convertSemVerToAvailableVersion("1.10.0-snapshot")); Assert.assertEquals("1.10.0", PipHelper.convertSemVerToAvailableVersion("1.10.1")); Assert.assertEquals("1.10.0", PipHelper.convertSemVerToAvailableVersion("1.10.0")); Assert.assertEquals("1.7.0", PipHelper.convertSemVerToAvailableVersion("1.7.0-snapshot")); Assert.assertEquals("1.7.0", PipHelper.convertSemVerToAvailableVersion("1.7.0")); Assert.assertEquals("1.6.0", PipHelper.convertSemVerToAvailableVersion("1.6.0-snapshot")); Assert.assertEquals("1.6.0", PipHelper.convertSemVerToAvailableVersion("1.6.0")); Assert.assertEquals("1.5.0", PipHelper.convertSemVerToAvailableVersion("1.5.0-snapshot")); Assert.assertEquals("1.5.0", PipHelper.convertSemVerToAvailableVersion("1.5.0")); Assert.assertEquals("1.4.0", PipHelper.convertSemVerToAvailableVersion("1.4.0-snapshot")); Assert.assertEquals("1.4.0", PipHelper.convertSemVerToAvailableVersion("1.4.0")); Assert.assertEquals("1.4.0", PipHelper.convertSemVerToAvailableVersion("1.3.0-snapshot")); Assert.assertEquals("1.4.0", PipHelper.convertSemVerToAvailableVersion("1.3.0")); }
Source:
<code>static void validateTagUniqueness(String type, List<Value> values) { <START> BitSet tags = new BitSet(); <END> for (Value value : values) { int tag = value.getTag(); if (tags.get(tag)) { throw new IllegalStateException("Duplicate tag " + tag + " in " + type); } tags.set(tag); } }</code><technical_language>if BitSet is a good choice here. _most_ code tags starting zero, written code creates a tag 2,000,000 so. BitSets sparse that</technical_language>

Target:
static void validateTagUniqueness(String type, List<Value> values) { Set<Integer> tags = new LinkedHashSet<Integer>(); for (Value value : values) { int tag = value.getTag(); if (!tags.add(tag)) { throw new IllegalStateException("Duplicate tag " + tag + " in " + type); } } }
Source:
<code>public Repo<Master> call(long tid, Master master) throws Exception { UniqueNameAllocator namer = master.getContext().getUniqueNameAllocator(); Path exportDir = new Path(tableInfo.exportDir); Set<String> tableDirs = ServerConstants.getTablesDirs(master.getContext()); <START> log.info("Looking for matching filesystem for " + exportDir + " from options " + tableDirs); <END> Path base = master.getFileSystem().matchingFileSystem(exportDir, tableDirs); if (base == null) { throw new IOException(tableInfo.exportDir + " is not in a volume configured for Accumulo"); } log.info("Chose base table directory of " + base); Path directory = new Path(base, tableInfo.tableId.canonical()); Path newBulkDir = new Path(directory, Constants.BULK_PREFIX + namer.getNextName()); tableInfo.importDir = newBulkDir.toString(); log.info("Using import dir: " + tableInfo.importDir); return new MapImportFileNames(tableInfo); }</code><technical_language>sl4j parameterized log statement. suggestion log.info("Looking for matching filesystem for options {}", exportDir, tableDirs);</technical_language>

Target:
public Repo<Master> call(long tid, Master master) throws Exception { UniqueNameAllocator namer = master.getContext().getUniqueNameAllocator(); Path exportDir = new Path(tableInfo.exportDir); Set<String> tableDirs = ServerConstants.getTablesDirs(master.getContext()); log.info("Looking for matching filesystem for from options {}", exportDir, tableDirs); Path base = master.getFileSystem().matchingFileSystem(exportDir, tableDirs); if (base == null) { throw new IOException(tableInfo.exportDir + " is not in a volume configured for Accumulo"); } log.info("Chose base table directory of " + base); Path directory = new Path(base, tableInfo.tableId.canonical()); Path newBulkDir = new Path(directory, Constants.BULK_PREFIX + namer.getNextName()); tableInfo.importDir = newBulkDir.toString(); log.info("Using import dir: " + tableInfo.importDir); return new MapImportFileNames(tableInfo); }
Source:
<code>public String toString() { <START> return "StatusOnlyReturnForXmlRpc [mStatus" + mStatus + "]"; <END> }</code><technical_language>missing "=" mStatus (comparing similar change in StatusReturnForXmlRpc) Also, generic get class' name instead of hardcoding it? require extra work if class renamed some day</technical_language>

Target:
public String toString() { return getClass().getSimpleName() + " [mStatus=" + mStatus + "]"; }
Source:
<code>protected CtfTmfEvent getEvent(int rank) { <START> ITmfContext ctx = fTrace.getTrace().seekEvent(0); <END> for (int i = 0; i < rank; i++) { fTrace.getTrace().getNext(ctx); } final CtfTmfEvent next = fTrace.getTrace().getNext(ctx); ctx.dispose(); return next; }</code><technical_language>seekEvent(rank)</technical_language>

Target:
protected CtfTmfEvent getEvent(int rank) { ITmfContext ctx = fTrace.getTrace().seekEvent(rank); final CtfTmfEvent next = fTrace.getTrace().getNext(ctx); ctx.dispose(); return next; }
Source:
<code>@Override public void enqueue(final Callback<T> callback) { synchronized (this) { if (executed) throw new IllegalStateException("Already executed"); executed = true; } task = backgroundExecutor.submit(new Runnable() { private void callFailure(final Throwable throwable) { callbackExecutor.execute(new Runnable() { @Override public void run() { try { callback.failure(throwable); } catch (Throwable t) { <START> t.printStackTrace(); <END> } } }); } private void callSuccess(final Response<T> response) { callbackExecutor.execute(new Runnable() { @Override public void run() { try { callback.success(response); } catch (Throwable t) { t.printStackTrace(); } } }); } @Override public void run() { Response<T> response; try { response = getResponse(); } catch (IOException e) { callFailure(e); return; } callSuccess(response); } }); }</code><technical_language>Lame</technical_language>

Target:
@Override public void enqueue(final Callback<T> callback) { synchronized (this) { if (executed) throw new IllegalStateException("Already executed"); executed = true; } task = backgroundExecutor.submit(new Runnable() { private void callFailure(final Throwable throwable) { callbackExecutor.execute(new Runnable() { @Override public void run() { try { callback.onFailure(throwable); } catch (Throwable t) { Thread thread = Thread.currentThread(); thread.getUncaughtExceptionHandler().uncaughtException(thread, t); } } }); } private void callSuccess(final Response<T> response) { callbackExecutor.execute(new Runnable() { @Override public void run() { try { callback.onResponse(response); } catch (Throwable t) { Thread thread = Thread.currentThread(); thread.getUncaughtExceptionHandler().uncaughtException(thread, t); } } }); } @Override public void run() { Response<T> response; try { response = getResponse(); } catch (IOException e) { callFailure(e); return; } catch (InterruptedException e) { callFailure(new InterruptedIOException("canceled")); return; } callSuccess(response); } }); }
Source:
<code>public void clear() throws StoreAccessException { <START> createBackend(); <END> }</code><technical_language>this map = map.clear();</technical_language>

Target:
public void clear() { this.map = map.clear(); }
Source:
<code>public boolean isConstexpr() { ICPPASTDeclSpecifier declSpec = getDeclSpecifier(); <START> if (declSpec == null) { <END> ICPPASTFunctionDeclarator dtor = getPreferredDtor(); return dtor != null ? dtor.isConstexpr() : false; } return declSpec.isConstexpr(); }</code><technical_language>Is this reached? a lambda declarator CPPImplicitFunctions, CPPImplicitFunction overrides isConstexpr()</technical_language>

Target:
public boolean isConstexpr() { ICPPASTDeclSpecifier declSpec = getDeclSpecifier(); if (declSpec == null) { return false; } return declSpec.isConstexpr(); }
Source:
<code>private static int getAccessibleListenersSize(Accessible accessible) throws Exception { Method m = <START> Accessible.class.getDeclaredMethod("accessibleListenersSize"); <END> m.setAccessible(true); return (Integer) m.invoke(accessible); }</code><technical_language>accessibleListenersSize method is defined in GTK version of Accessible</technical_language>

Target:
private static int getAccessibleListenersSize(Accessible accessible) throws Exception { Field f = Accessible.class.getDeclaredField("accessibleListeners"); f.setAccessible(true); Vector accessibleListeners = (Vector) f.get(accessible); return accessibleListeners == null ? 0 : accessibleListeners.size(); }
Source:
<code>protected static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) { if(extension == null) { extension = ""; } if(containerFullPath == null) { containerFullPath = new Path(""); } if(fileName == null || fileName.trim().length() == 0) { fileName = DEFAULT_NAME; } if(fileName.contains(".")) { fileName = fileName.substring(0, fileName.lastIndexOf(".")); } <START> if(fileName.contains(".profile")) { END> fileName = fileName.substring(0, fileName.lastIndexOf(".profile")); } IPath filePath = containerFullPath.append(fileName); filePath = containerFullPath.append(fileName); filePath = filePath.addFileExtension(extension); int i = 1; while(ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) { i++; filePath = containerFullPath.append(fileName + i); if(extension != null) { filePath = filePath.addFileExtension(extension); } } return filePath.lastSegment(); }</code><technical_language>I this is necessary, change a lines 'indexOf(".")' 'lastIndexOf(".")'. However, I it: * about, say, "model.profile.profile.di" ? (granted, unlikely, handled previous version of this code) * more seriously, this hard-codes extension is defined in a <diagramCategory> contributed some plug-in org.eclipse.papyrus.infra.core.papyrusDiagram extension point. Other plug-ins define additional extensions enumerated, here. hard-coding this, extensions need trimmed in DiagramCategoryRegistry</technical_language>

Target:
protected static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) { if(extension == null) { extension = ""; } if(containerFullPath == null) { containerFullPath = new Path(""); } if(fileName == null || fileName.trim().length() == 0) { fileName = DEFAULT_NAME; } if(fileName.contains(".")) { fileName = fileName.substring(0, fileName.lastIndexOf(".")); } List<String> extensionPrefixes = new ArrayList<String>(); for (DiagramCategoryDescriptor diagramCategoryDescriptor : DiagramCategoryRegistry.getInstance().getDiagramCategories()) { String extensionPrefix = diagramCategoryDescriptor.getExtensionPrefix(); if (extensionPrefix == null) continue; extensionPrefixes.add(extensionPrefix); } String[] segments = fileName.split("\\."); for (int i = segments.length-1; i >= 0; i--) { String segment = segments[i]; if (extensionPrefixes.contains(segment)) { fileName = fileName.substring(0, fileName.lastIndexOf("."+segment)); } } IPath filePath = containerFullPath.append(fileName); filePath = filePath.addFileExtension(extension); int i = 1; while(ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) { i++; filePath = containerFullPath.append(fileName + i); if(extension != null) { filePath = filePath.addFileExtension(extension); } } return filePath.lastSegment(); }
Source:
<code>public void testRebalance() throws IOException, HelixRebalanceException { _metadataStore.clearMetadataStore(); WagedRebalancer rebalancer = <START> new WagedRebalancer(_metadataStore, _algorithm, new DelayedAutoRebalancer(), null); <END> ResourceControllerDataProvider clusterData = setupClusterDataCache(); Map<String, Resource> resourceMap = clusterData.getIdealStates().entrySet().stream() .collect(Collectors.toMap(entry -> entry.getKey(), entry -> { Resource resource = new Resource(entry.getKey()); entry.getValue().getPartitionSet().stream() .forEach(partition -> resource.addPartition(partition)); return resource; })); Map<String, IdealState> newIdealStates = rebalancer.computeNewIdealStates(clusterData, resourceMap, new CurrentStateOutput()); Map<String, ResourceAssignment> algorithmResult = _algorithm.getRebalanceResult(); validateRebalanceResult(resourceMap, newIdealStates, algorithmResult); }</code><technical_language>Create a constructor field</technical_language>

Target:
public void testRebalance() throws IOException, HelixRebalanceException { _metadataStore.clearMetadataStore(); WagedRebalancer rebalancer = new WagedRebalancer(_metadataStore, _algorithm, new DelayedAutoRebalancer()); ResourceControllerDataProvider clusterData = setupClusterDataCache(); Map<String, Resource> resourceMap = clusterData.getIdealStates().entrySet().stream() .collect(Collectors.toMap(entry -> entry.getKey(), entry -> { Resource resource = new Resource(entry.getKey()); entry.getValue().getPartitionSet().stream() .forEach(partition -> resource.addPartition(partition)); return resource; })); Map<String, IdealState> newIdealStates = rebalancer.computeNewIdealStates(clusterData, resourceMap, new CurrentStateOutput()); Map<String, ResourceAssignment> algorithmResult = _algorithm.getRebalanceResult(); validateRebalanceResult(resourceMap, newIdealStates, algorithmResult); }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; <START> if ((req.getHeader("Authorization") != null)) { <END> HttpSession session = req.getSession(false); if (session != null) { session.invalidate(); session = null; } } chain.doFilter(request, response); }</code><technical_language>FiltersHelper.Constants.HEADER_AUTHORIZATION here</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; if ((req.getHeader(FiltersHelper.Constants.HEADER_AUTHORIZATION) != null)) { HttpSession session = req.getSession(false); if (session != null) { session.invalidate(); session = null; } } chain.doFilter(request, response); }
Source:
<code>private void extractCredentialsFromUrl() { String uriInput = mHostUrlInput.getText().toString().trim(); if(uriInput.length() != 0) { Uri uri = Uri.parse(uriInput); String userInfo = uri.getUserInfo(); if(userInfo != null) { String username = userInfo.split(":", 2)[0]; if(username.length() != 0) { mUsernameInput.setText(username); } String password = userInfo.split(":", 2)[1]; <START> if(password.length() != 0) { <END> mPasswordInput.setText(password); } } } }</code><technical_language>NPE for: <LINK_0></technical_language>

Target:
private void extractCredentialsFromUrl() { String uriInput = mHostUrlInput.getText().toString().trim(); if(uriInput.length() != 0) { Uri uri = Uri.parse(uriInput); String userInfo = uri.getUserInfo(); if(userInfo != null) { String[] userInfoParts = userInfo.split(":", 2); if(userInfoParts.length > 0 && userInfoParts[0].length() > 0) { mUsernameInput.setText(userInfoParts[0]); } if(userInfoParts.length > 1 && userInfoParts[1].length() > 0) { mPasswordInput.setText(userInfoParts[1]); } } } }
Source:
<code>protected void showIndicatorsForComponent(final List<Diagnostic> diags, final int severity) { FieldIndicatorModel model = getComponentModel(); if (model != null) { <START> model.diagnostics.clear(); <END> } if (diags != null && !diags.isEmpty()) { model = getOrCreateComponentModel(); UIContext uic = UIContextHolder.getCurrent(); for (int i = 0; i < diags.size(); i++) { Diagnostic diagnostic = diags.get(i); if (diagnostic.getSeverity() == severity && uic == diagnostic.getContext() && relatedField == diagnostic.getComponent()) { model.diagnostics.add(diagnostic); } } } }</code><technical_language>This model.diagnostic.clear() potentially update default model retrieved getComponentModel instead of getOrCreateComponentModel. other changes, determine if list changed get model update it</technical_language>

Target:
protected void showIndicatorsForComponent(final List<Diagnostic> diags, final int severity) { FieldIndicatorModel model = getComponentModel(); if (model != null && !model.diagnostics.isEmpty()) { model = getOrCreateComponentModel(); model.diagnostics.clear(); } if (diags != null && !diags.isEmpty()) { model = getOrCreateComponentModel(); UIContext uic = UIContextHolder.getCurrent(); for (int i = 0; i < diags.size(); i++) { Diagnostic diagnostic = diags.get(i); if (diagnostic.getSeverity() == severity && uic == diagnostic.getContext() && relatedField == diagnostic.getComponent()) { model.diagnostics.add(diagnostic); } } } }