auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void testAcceleratedGeometry(OGCGeometry geometry) { long initialSize = geometry.estimateMemorySize(); assertTrue(initialSize > 0); Envelope envelope = new Envelope(); geometry.getEsriGeometry().queryEnvelope(envelope); long withEnvelopeSize = geometry.estimateMemorySize(); assertTrue(withEnvelopeSize > initialSize); accelerate(geometry, GeometryAccelerationDegree.enumMild); long mildAcceleratedSize = geometry.estimateMemorySize(); assertTrue(mildAcceleratedSize > withEnvelopeSize); accelerate(geometry, GeometryAccelerationDegree.enumMedium); long mediumAcceleratedSize = geometry.estimateMemorySize(); assertTrue(mediumAcceleratedSize > mildAcceleratedSize); accelerate(geometry, GeometryAccelerationDegree.enumHot); long hotAcceleratedSize = geometry.estimateMemorySize(); assertTrue(hotAcceleratedSize > mediumAcceleratedSize); <START> System.out.println(String.format("%s, %s, %s, %s, %s", initialSize, withEnvelopeSize, mildAcceleratedSize, mediumAcceleratedSize, hotAcceleratedSize)); <END> }</code><technical_language>Do want println</technical_language>

Target:
private void testAcceleratedGeometry(OGCGeometry geometry) { long initialSize = geometry.estimateMemorySize(); assertTrue(initialSize > 0); Envelope envelope = new Envelope(); geometry.getEsriGeometry().queryEnvelope(envelope); long withEnvelopeSize = geometry.estimateMemorySize(); assertTrue(withEnvelopeSize > initialSize); accelerate(geometry, GeometryAccelerationDegree.enumMild); long mildAcceleratedSize = geometry.estimateMemorySize(); assertTrue(mildAcceleratedSize > withEnvelopeSize); accelerate(geometry, GeometryAccelerationDegree.enumMedium); long mediumAcceleratedSize = geometry.estimateMemorySize(); assertTrue(mediumAcceleratedSize > mildAcceleratedSize); accelerate(geometry, GeometryAccelerationDegree.enumHot); long hotAcceleratedSize = geometry.estimateMemorySize(); assertTrue(hotAcceleratedSize > mediumAcceleratedSize); }
Source:
<code>private void initialize() { ColorServer colorServer = new ColorServer(); fileOpenController.dbPathProperty().set(welcomeController.getListedPaths()); fileOpenController.doneProperty().addListener((obj, oldV, newV) -> <START> welcomeController.doneProperty().setValue(true)); <END> fileOpenController.graphProperty().addListener((obj, oldV, newV) -> { strainView = new StrainView(colorServer, newV); }); fileOpenController.treeProperty().addListener((obj, oldV, newV) -> { phyloView = new PhylogeneticView(colorServer); phyloView.rootProperty().set(newV); }); welcomeController.doneProperty().addListener((obj, oldV, newV) -> { SplitPane splitPane = new SplitPane(strainView, phyloView); splitPane.setOrientation(Orientation.VERTICAL); root.setCenter(splitPane); }); welcomeController.dbProperty().addListener((obj, oldV, newV) -> { strainView = new StrainView(colorServer, newV); phyloView = new PhylogeneticView(colorServer); }); }</code><technical_language>newV is true</technical_language>

Target:
private void initialize() { ColorServer colorServer = new ColorServer(); fileOpenController.dbPathProperty().set(welcomeController.getListedPaths()); fileOpenController.graphProperty().addListener((obj, oldV, newV) -> { strainView = new StrainView(colorServer, newV); constructView(); }); fileOpenController.treeProperty().addListener((obj, oldV, newV) -> { phyloView = new PhylogeneticView(colorServer); phyloView.rootProperty().set(newV); }); welcomeController.dbProperty().addListener((obj, oldV, newV) -> { strainView = new StrainView(colorServer, newV); phyloView = new PhylogeneticView(colorServer); constructView(); }); }
Source:
<code>public boolean matches(byte[] buf, int off, int len) { long ssrc = RawPacket.getSSRCAsLong(buf, off, len); if (primarySSRC != ssrc && rtxSSRC != ssrc) { return false; } int tid = track.getMediaStreamTrackReceiver() <START> .getStream().getTemporalID(buf, off, len); <END> return (tid == -1 && ArrayUtils.isNullOrEmpty(dependencyEncodings)) || tid == temporalId; }</code><technical_language>stream's getTemporalID RTX, return -1 for RTX packets. if I reading this correctly, in case of simulcast TS, retransmitted packets end accepted RTPEncoding for base temporal layer</technical_language>

Target:
public boolean matches(byte[] buf, int off, int len) { long ssrc = RawPacket.getSSRCAsLong(buf, off, len); if (primarySSRC != ssrc && rtxSSRC != ssrc) { return false; } if (temporalId == -1) { return true; } int tid = track.getMediaStreamTrackReceiver() .getStream().getTemporalID(buf, off, len); return tid == -1 && idx == 0 || tid == temporalId; }
Source:
<code>@Override void bind(Layer layer, boolean isVisible) { mParentCheckbox.setOnCheckedChangeListener(null); mParentCheckbox.setChecked(isVisible); mParentTextView.setText(layer.getName()); mParentCheckbox.setOnCheckedChangeListener( (buttonView, isChecked) -> mOnLayerCheckedChangedListener.layerCheckedChanged(layer, isChecked)); if (((GroupLayer) layer).isShowChildrenInLegend()) { for (Layer childLayer : ((GroupLayer) layer).getLayers()) { if (childLayer.getLoadStatus() != LoadStatus.LOADED) { childLayer.addDoneLoadingListener(() -> { <START> addChildLayer(childLayer); <END> }); childLayer.loadAsync(); } else { addChildLayer(childLayer); } } } }</code><technical_language>moved a line expression</technical_language>

Target:
@Override void bind(Layer layer, boolean isVisible) { mParentCheckbox.setOnCheckedChangeListener(null); mParentCheckbox.setChecked(isVisible); mParentTextView.setText(layer.getName()); mParentCheckbox.setOnCheckedChangeListener( (buttonView, isChecked) -> mOnLayerCheckedChangedListener.layerCheckedChanged(layer, isChecked)); if (((GroupLayer) layer).isShowChildrenInLegend()) { for (Layer childLayer : ((GroupLayer) layer).getLayers()) { if (childLayer.getLoadStatus() != LoadStatus.LOADED) { childLayer.addDoneLoadingListener(() -> addChildLayer(childLayer)); childLayer.loadAsync(); } else { addChildLayer(childLayer); } } } }
Source:
<code>public void testDisplaySampleList(){ <START> SampleList sampleList = Mockito.mock(SampleList.class); <END> Mockito.when(sampleList.getListName()).thenReturn(SampleListControllerTest.TEST_LIST_NAME); Mockito.when(sampleList.getNotes()).thenReturn(SampleListControllerTest.TEST_LIST_NAME); Mockito.when(sampleList.getType()).thenReturn(SampleListType.SAMPLE_LIST); Mockito.doReturn(sampleList).when(this.sampleListService).getSampleList(SampleListControllerTest.TEST_SAMPLE_LIST_ID); List<SampleDetailsDTO> sampleDetailsDTOs = GenerateASampleDetails(10); Mockito.doReturn(sampleDetailsDTOs).when(this.sampleListService).getSampleDetailsDTOs(SampleListControllerTest.TEST_SAMPLE_LIST_ID); Model model = Mockito.mock(Model.class); this.slc.displaySampleList(SampleListControllerTest.TEST_SAMPLE_LIST_ID, Mockito.mock(HttpServletRequest.class), model); Mockito.verify(model).addAttribute(SampleListController.SAMPLE_LIST, sampleDetailsDTOs); Mockito.verify(model).addAttribute(SampleListController.TOTAL_NUMBER_OF_GERMPLASMS, sampleDetailsDTOs.size()); Mockito.verify(model).addAttribute(Matchers.eq(SampleListController.TABLE_HEADER_LIST), Matchers.anyListOf(TableHeader.class)); Mockito.verify(model).addAttribute("listId", SampleListControllerTest.TEST_SAMPLE_LIST_ID); Mockito.verify(model).addAttribute("listName", sampleList.getListName()); Mockito.verify(model).addAttribute("listNotes", sampleList.getNotes()); Mockito.verify(model).addAttribute("listType", sampleList.getType().name()); }</code><technical_language>review finals</technical_language>

Target:
public void testDisplaySampleList(){ final SampleList sampleList = Mockito.mock(SampleList.class); Mockito.when(sampleList.getListName()).thenReturn(SampleListControllerTest.TEST_LIST_NAME); Mockito.when(sampleList.getNotes()).thenReturn(SampleListControllerTest.TEST_LIST_NAME); Mockito.when(sampleList.getType()).thenReturn(SampleListType.SAMPLE_LIST); Mockito.doReturn(sampleList).when(this.sampleListService).getSampleList(SampleListControllerTest.TEST_SAMPLE_LIST_ID); final List<SampleDetailsDTO> sampleDetailsDTOs = buildSampleDetailsList(10); Mockito.doReturn(sampleDetailsDTOs).when(this.sampleListService).getSampleDetailsDTOs(SampleListControllerTest.TEST_SAMPLE_LIST_ID); final Model model = Mockito.mock(Model.class); this.slc.displaySampleList(SampleListControllerTest.TEST_SAMPLE_LIST_ID, Mockito.mock(HttpServletRequest.class), model); Mockito.verify(model).addAttribute(SampleListController.SAMPLE_LIST, sampleDetailsDTOs); Mockito.verify(model).addAttribute(SampleListController.TOTAL_NUMBER_OF_GERMPLASMS, sampleDetailsDTOs.size()); Mockito.verify(model).addAttribute(Matchers.eq(SampleListController.TABLE_HEADER_LIST), Matchers.anyListOf(TableHeader.class)); Mockito.verify(model).addAttribute("listId", SampleListControllerTest.TEST_SAMPLE_LIST_ID); Mockito.verify(model).addAttribute("listName", sampleList.getListName()); Mockito.verify(model).addAttribute("listNotes", sampleList.getNotes()); Mockito.verify(model).addAttribute("listType", sampleList.getType().name()); }
Source:
<code>private void clickClearInputButton() { if (clearInputButton.isDisplayed()) { clearInputButton.click(); PageObjectLogging.log("clickClearInputButton", "'x' button clicked to clear search", true); <START> } <END> }</code><technical_language>if button is displayed clickable</technical_language>

Target:
private void clickClearInputButton() { if (clearInputButton.isDisplayed()) { waitForElementClickableByElement(clearInputButton); clearInputButton.click(); PageObjectLogging.log("clickClearInputButton", "'x' button clicked to clear search", true); } }
Source:
<code>protected <T> Property<T> propertyFor(Class<? extends T> targetClass, String property) { <START> Iterable<Field> fields = fieldsOf(targetClass); <END> for(Field field : fields) { if (field.getName().equals(property) && ((field.getModifiers() & Modifier.PUBLIC) == Modifier.PUBLIC)) { return new DirectlyAccessedProperty<>(field, property); } } return null; }</code><technical_language>targetClass.getFields() public (incl. declared parent classes). removes need for checking public modifier on. check modifiers using: Modifiers.isPublic(field.getModifiers())</technical_language>

Target:
protected <T> Property<T> propertyFor(Class<? extends T> targetClass, String property) { Field[] fields = targetClass.getFields(); for(Field field : fields) { if (field.getName().equals(property)) { return new DirectlyAccessedProperty<>(field, property); } } return null; }
Source:
<code>private static String getKeyColumnName(ConfigurationService configurationService) { String driverClass = configurationService.getConfiguration().getStorageConfiguration().get("driver")!= null ? configurationService.getConfiguration().getStorageConfiguration().get("driver").asText() : null; if (!Strings.isNullOrEmpty(driverClass) && driverClass.contains("mysql")) { <START> return "`key`"; <END> } return "key"; }</code><technical_language>if MySQL meant return obj_key, ? (if key is allowed)</technical_language>

Target:
private static String getKeyColumnName(ConfigurationService configurationService) { JsonNode driverNode = configurationService.getConfiguration().getStorageConfiguration().get("driver"); String driverClass = driverNode != null ? driverNode.asText() : null; if (!Strings.isNullOrEmpty(driverClass) && driverClass.contains("mysql")) { return "`key`"; } return "key"; }
Source:
<code>public <T> T newInstance(Target<T> target) { Map<String, MethodHandler> nameToHandler = targetToHandlersByName.apply(target); Map<Method, MethodHandler> methodToHandler = new LinkedHashMap<Method, MethodHandler>(); Promise<Object> proxyPromise = new Promise<Object>(); for (Method method : target.type().getMethods()) { if (method.getDeclaringClass() == Object.class) { continue; } else if(Util.isDefault(method)) { <START> methodToHandler.put(method, new DefaultMethodHandler(method, proxyPromise)); <END> } else { methodToHandler.put(method, nameToHandler.get(Feign.configKey(target.type(), method))); } } InvocationHandler handler = factory.create(target, methodToHandler); T proxy = (T) Proxy.newProxyInstance(target.type().getClassLoader(), new Class<?>[]{target.type()}, handler); proxyPromise.set(proxy); return proxy; }</code><technical_language>another idea.. this is mutable, skip promise/ref thing. create handler, loop methodToHandler bind proxy returning. this more thread safe. ex. java boolean supportsDefault = false; for (Method method : ... ... } else if(Util.isDefault(method)) { supportsDefault = true; ... T proxy = ... if (supportsDefault) { // guards execution in JREs for (MethodHandler handler: methodToHandler.values()) { if (handler instanceof DefaultMethodHandler) { ((DefaultMethodHandler)handler).bindTo(proxy); } } }</technical_language>

Target:
public <T> T newInstance(Target<T> target) { Map<String, MethodHandler> nameToHandler = targetToHandlersByName.apply(target); Map<Method, MethodHandler> methodToHandler = new LinkedHashMap<Method, MethodHandler>(); List<DefaultMethodHandler> defaultMethodHandlers = new LinkedList<DefaultMethodHandler>(); for (Method method : target.type().getMethods()) { if (method.getDeclaringClass() == Object.class) { continue; } else if(Util.isDefault(method)) { DefaultMethodHandler handler = new DefaultMethodHandler(method); defaultMethodHandlers.add(handler); methodToHandler.put(method, handler); } else { methodToHandler.put(method, nameToHandler.get(Feign.configKey(target.type(), method))); } } InvocationHandler handler = factory.create(target, methodToHandler); T proxy = (T) Proxy.newProxyInstance(target.type().getClassLoader(), new Class<?>[]{target.type()}, handler); for(DefaultMethodHandler defaultMethodHandler : defaultMethodHandlers) { defaultMethodHandler.bindTo(proxy); } return proxy; }
Source:
<code>private void exportAnalysis() { FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE); dialog.setText(NLS.bind(Messages.ManageXMLAnalysisDialog_SelectFileExport, fAnalysesList.getSelection()[0])); <START> dialog.setFilterExtensions(new String[] { XML_FILTER_EXTENSION, "*" }); END> String path = dialog.open(); if (path != null) { String selection = fAnalysesList.getSelection()[0]; if (!XmlUtils.exportXmlFile(selection + XmlUtils.XML_EXTENSION, path).isOK()) { Activator.logError(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToExport, selection + XmlUtils.XML_EXTENSION)); } } }</code><technical_language>File name initialized file export</technical_language>

Target:
private void exportAnalysis() { FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE); dialog.setText(NLS.bind(Messages.ManageXMLAnalysisDialog_SelectFileExport, fAnalysesList.getSelection()[0])); dialog.setFilterExtensions(new String[] { XML_FILTER_EXTENSION, "*" }); dialog.setFileName(fAnalysesList.getSelection()[0] + XmlUtils.XML_EXTENSION); String path = dialog.open(); if (path != null) { String selection = fAnalysesList.getSelection()[0]; if (!XmlUtils.exportXmlFile(selection + XmlUtils.XML_EXTENSION, path).isOK()) { Activator.logError(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToExport, selection + XmlUtils.XML_EXTENSION)); } } }
Source:
<code>public static void main(String[] args) { post("/books", (request, response) -> { String author = request.queryParams("author"); String title = request.queryParams("title"); Book book = new Book(author, title); Random random = new Random(); int id = random.nextInt(Integer.MAX_VALUE); books.put(String.valueOf(id), book); response.status(201); return id; }); get("/books/:id", (request, response) -> { Book book = books.get(request.params(":id")); if (book != null) { return "Title: " + book.getTitle() + ", Author: " + book.getAuthor(); } <START> response.status(404); END> return "Book not found"; }); put("/books/:id", (request, response) -> { String id = request.params(":id"); Book book = books.get(id); if (book != null) { String newAuthor = request.queryParams("author"); String newTitle = request.queryParams("title"); if (newAuthor != null) { book.setAuthor(newAuthor); } if (newTitle != null) { book.setTitle(newTitle); } return "Book with id '" + id + "' updated"; } response.status(404); return "Book not found"; }); delete("/books/:id", (request, response) -> { String id = request.params(":id"); Book book = books.remove(id); if (book != null) { return "Book with id '" + id + "' deleted"; } response.status(404); return "Book not found"; }); get("/books", (request, response) -> { String ids = ""; for (String id : books.keySet()) { ids += id + " "; } return ids; }); }</code><technical_language>indention is in places</technical_language>

Target:
public static void main(String[] args) { post("/books", (request, response) -> { String author = request.queryParams("author"); String title = request.queryParams("title"); Book book = new Book(author, title); Random random = new Random(); int id = random.nextInt(Integer.MAX_VALUE); books.put(String.valueOf(id), book); response.status(201); return id; }); get("/books/:id", (request, response) -> { Book book = books.get(request.params(":id")); if (book != null) { return "Title: " + book.getTitle() + ", Author: " + book.getAuthor(); } else { response.status(404); return "Book not found"; } }); put("/books/:id", (request, response) -> { String id = request.params(":id"); Book book = books.get(id); if (book != null) { String newAuthor = request.queryParams("author"); String newTitle = request.queryParams("title"); if (newAuthor != null) { book.setAuthor(newAuthor); } if (newTitle != null) { book.setTitle(newTitle); } return "Book with id '" + id + "' updated"; } else { response.status(404); return "Book not found"; } }); delete("/books/:id", (request, response) -> { String id = request.params(":id"); Book book = books.remove(id); if (book != null) { return "Book with id '" + id + "' deleted"; } else { response.status(404); return "Book not found"; } }); get("/books", (request, response) -> { String ids = ""; for (String id : books.keySet()) { ids += id + " "; } return ids; }); }
Source:
<code>@Override protected void prepareCluster() throws Exception { Ignite srv = startGrid("srv", ALLOW_ALL, false); Permissions perms = new Permissions(); perms.add(new RuntimePermission("accessClassInPackage.org.apache.ignite.internal")); perms.add(new RuntimePermission("accessClassInPackage.org.apache.ignite.internal.*")); <START> startGrid(CLNT_ALLOWED, ALLOW_ALL, perms, false); <END> startGrid(CLNT_FORBIDDEN, ALLOW_ALL, false); srv.cluster().active(true); }</code><technical_language>named "clnt", a server node</technical_language>

Target:
@Override protected void prepareCluster() throws Exception { Ignite srv = startGrid("srv", ALLOW_ALL, false); Permissions perms = new Permissions(); perms.add(new RuntimePermission("accessClassInPackage." + IGNITE_INTERNAL_PACKAGE)); perms.add(new RuntimePermission("accessClassInPackage." + IGNITE_INTERNAL_PACKAGE + ".*")); startGrid(ALLOWED, ALLOW_ALL, perms, false); startGrid(FORBIDDEN, ALLOW_ALL, false); srv.cluster().active(true); }
Source:
<code>public Matrix getTransform( Matrix transform, Rect parentBounds, int childWidth, int childHeight, float focusX, float focusY) { if (mMatrixValuesFrom == null) { mMatrixValuesFrom = new float[9]; <START> mScaleTypeFrom.getTransform(transform, mBoundsFrom, childWidth, childHeight, focusX, focusY); <END> transform.getValues(mMatrixValuesFrom); } if (mMatrixValuesTo == null) { mMatrixValuesTo = new float[9]; mScaleTypeTo.getTransform(transform, mBoundsTo, childWidth, childHeight, focusX, focusY); transform.getValues(mMatrixValuesTo); } for (int i = 0; i < 9; i++) { mMatrixValuesInterpolated[i] = mMatrixValuesFrom[i] * (1 - mInterpolatingValue) + mMatrixValuesTo[i] * mInterpolatingValue; } transform.setValues(mMatrixValuesInterpolated); return transform; }</code><technical_language>parentBounds in case mBoundsFrom is null. for mBoundsTo below. Rect boundsFrom = (mBoundsFrom != null) ? mBoundsFrom : parentBounds; Rect boundsTo = (mBoundsTo != null) ? mBoundsTo : parentBounds;</technical_language>

Target:
public Matrix getTransform( Matrix transform, Rect parentBounds, int childWidth, int childHeight, float focusX, float focusY) { Rect boundsFrom = (mBoundsFrom != null) ? mBoundsFrom : parentBounds; Rect boundsTo = (mBoundsTo != null) ? mBoundsTo : parentBounds; mScaleTypeFrom.getTransform(transform, boundsFrom, childWidth, childHeight, focusX, focusY); transform.getValues(mMatrixValuesFrom); mScaleTypeTo.getTransform(transform, boundsTo, childWidth, childHeight, focusX, focusY); transform.getValues(mMatrixValuesTo); for (int i = 0; i < 9; i++) { mMatrixValuesInterpolated[i] = mMatrixValuesFrom[i] * (1 - mInterpolatingValue) + mMatrixValuesTo[i] * mInterpolatingValue; } transform.setValues(mMatrixValuesInterpolated); return transform; }
Source:
<code><START> private boolean isUserRoleChanged(User posted, User existing) { <END> return posted.getRole().equals(existing.getRole()); }</code><technical_language>this isUserRoleNotChanged</technical_language>

Target:
private boolean isUserRoleChanged(User posted, User existing) { return !posted.getRole().equals(existing.getRole()); }
Source:
<code>public Stream<Node> stream() { return <START> Arrays.stream(getComposite().getChildren()).map(control -> getElement(control)); <END> }</code><technical_language>method reference here</technical_language>

Target:
public Stream<Node> stream() { return Arrays.stream(getComposite().getChildren()).map(this::getElement); }
Source:
<code>public void init(List<TransformFunction> arguments, Map<String, DataSource> dataSourceMap) { Preconditions .checkArgument(arguments.size() == 1, "Exactly 1 argument is required for transform function: %s", getName()); TransformFunction transformFunction = arguments.get(0); Preconditions.checkArgument(transformFunction.getResultMetadata().isSingleValue(), <START> "The argument must be single-valued for transform function: %s", getName()); <END> _transformFunction = transformFunction; _reader = new WKBReader(getGeometryFactory()); }</code><technical_language>check data type, BYTES</technical_language>

Target:
public void init(List<TransformFunction> arguments, Map<String, DataSource> dataSourceMap) { Preconditions .checkArgument(arguments.size() == 1, "Exactly 1 argument is required for transform function: %s", getName()); TransformFunction transformFunction = arguments.get(0); Preconditions.checkArgument(transformFunction.getResultMetadata().isSingleValue(), "The argument must be single-valued for transform function: %s", getName()); Preconditions.checkArgument(transformFunction.getResultMetadata().getDataType() == FieldSpec.DataType.BYTES, "The argument must be of bytes type"); _transformFunction = transformFunction; _reader = new WKBReader(getGeometryFactory()); }
Source:
<code>public static Timestamp checkIsPositive(Timestamp timestamp, String nameToLog) { checkNotNull(timestamp, nameToLog + " is null."); <START> checkArgument(timestamp.getSeconds() > 0, nameToLog + " must have positive seconds."); <END> checkArgument(timestamp.getNanos() >= 0, nameToLog + " must have positive nanoseconds."); return timestamp; }</code><technical_language>"... positive number of seconds..."</technical_language>

Target:
public static Timestamp checkIsPositive(Timestamp timestamp, String nameToLog) { checkNotNull(timestamp, nameToLog + " is null."); checkArgument(timestamp.getSeconds() > 0, nameToLog + " must have a positive number of seconds."); checkArgument(timestamp.getNanos() >= 0, nameToLog + " must not have a negative number of nanoseconds."); return timestamp; }
Source:
<code>public boolean vdsUpEvent(final VDS vds) { HostStoragePoolParametersBase params = new HostStoragePoolParametersBase(vds); boolean isSucceeded = Backend.getInstance().runInternalAction(VdcActionType.InitVdsOnUp, params).getSucceeded(); if (isSucceeded) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { try { List<VmStatic> vmsToMigrate = DbFacade.getInstance().getVmStaticDao().getAllWithFailbackByVds(vds.getId()); if (!vmsToMigrate.isEmpty()) { ExecutionContext executionContext = new ExecutionContext(); executionContext.setMonitored(true); Backend.getInstance().runInternalMultipleActions(VdcActionType.MigrateVmToServer, new ArrayList<>(createMigrateVmToServerParametersList(vmsToMigrate, vds)), <START> new CommandContext(executionContext)); <END> } } catch (RuntimeException e) { log.errorFormat("Failed to initialize Vds on up. Error: {0}", e); } } }); } return isSucceeded; }</code><technical_language>new CommandContext().setExecutionContext()</technical_language>

Target:
public boolean vdsUpEvent(final VDS vds) { HostStoragePoolParametersBase params = new HostStoragePoolParametersBase(vds); boolean isSucceeded = Backend.getInstance().runInternalAction(VdcActionType.InitVdsOnUp, params).getSucceeded(); if (isSucceeded) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { try { List<VmStatic> vmsToMigrate = DbFacade.getInstance().getVmStaticDao().getAllWithFailbackByVds(vds.getId()); if (!vmsToMigrate.isEmpty()) { ExecutionContext executionContext = new ExecutionContext(); executionContext.setMonitored(true); Backend.getInstance().runInternalMultipleActions(VdcActionType.MigrateVmToServer, new ArrayList<>(createMigrateVmToServerParametersList(vmsToMigrate, vds)), new CommandContext().setExecutionContext(executionContext)); } } catch (RuntimeException e) { log.errorFormat("Failed to initialize Vds on up. Error: {0}", e); } } }); } return isSucceeded; }
Source:
<code>protected static void importDeltaspikeProject(String projectName, ServerRequirement sr) { try { importMavenProject(projectName); } catch (IOException e) { e.printStackTrace(); fail("Unable to import " + projectName); } ProjectExplorer pe = new ProjectExplorer(); pe.open(); pe.getProject(projectName).select(); new ContextMenu("Properties").select(); new DefaultShell("Properties for " + projectName); new DefaultTreeItem("Targeted Runtimes").select(); for (TableItem i : new DefaultTable().getItems()) { if (i.getText().equals(sr.getRuntimeNameLabelText(sr.getConfig()))) { i.setChecked(true); } else { i.setChecked(false); } } boolean needValidation = false; <START> new DefaultTreeItem("CDI (Contexts and Dependency Injection) Settings").select(); <END> LabeledCheckBox cdiSupportCheckBox = new LabeledCheckBox("CDI support:"); if (!cdiSupportCheckBox.isChecked()) { log.warn("CDI support is disabled! CDI should be enabled automatically after project import."); log.warn("Enabling CDI support for '%s' project.", projectName); cdiSupportCheckBox.toggle(true); needValidation = true; } new PushButton("OK").click(); new WaitWhile(new ShellWithTextIsAvailable("Properties for " + projectName)); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); if (needValidation) { pe.getProject(projectName).select(); new ContextMenu("Validate").select(); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); } }</code><technical_language>implement & CDI Settings property page</technical_language>

Target:
protected static void importDeltaspikeProject(String projectName, ServerRequirement sr) { try { importMavenProject(projectName); } catch (IOException e) { e.printStackTrace(); fail("Unable to import " + projectName); } ProjectExplorer pe = new ProjectExplorer(); pe.open(); Project explorerItem = pe.getProject(projectName); PropertyDialog dialog = new ExplorerItemPropertyDialog(explorerItem); RuntimesPropertyPage runtimePage = new RuntimesPropertyPage(); CDISettingsPreferencePage cdiPage = new CDISettingsPreferencePage(); String targetRuntime = sr.getRuntimeNameLabelText(sr.getConfig()); dialog.open(); dialog.select(runtimePage); runtimePage.selectRuntime(targetRuntime); dialog.select(cdiPage); if (!cdiPage.isCDISupport()) { log.warn("CDI support is disabled! CDI should be enabled automatically after project import."); log.warn("Enabling CDI support for '%s' project.", projectName); cdiPage.toggleCDISupport(true); } dialog.ok(); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); pe.getProject(projectName).select(); new ContextMenu("Validate").select(); new WaitWhile(new JobIsRunning(), TimePeriod.LONG); }
Source:
<code>protected void waitJob() { AtomicBoolean removed = new AtomicBoolean(false); <START> while (true) { <END> mSubmittedJobAttempts = mSubmittedJobAttempts.stream().filter((jobAttempt) -> { Status check = jobAttempt.check(); switch (check) { case CREATED: case RUNNING: return true; case CANCELED: case COMPLETED: removed.set(true); return false; case FAILED: removed.set(true); return false; default: throw new IllegalStateException(String.format("Unexpected Status: %s", check)); } }).collect(Collectors.toList()); if (removed.get()) { return; } } }</code><technical_language>Is intentional this while loop is tight? add a sleep in avoid unnecessary cpu</technical_language>

Target:
protected void waitJob() { AtomicBoolean removed = new AtomicBoolean(false); while (true) { mSubmittedJobAttempts = mSubmittedJobAttempts.stream().filter((jobAttempt) -> { Status check = jobAttempt.check(); switch (check) { case CREATED: case RUNNING: return true; case CANCELED: case COMPLETED: removed.set(true); return false; case FAILED: removed.set(true); return false; default: throw new IllegalStateException(String.format("Unexpected Status: %s", check)); } }).collect(Collectors.toList()); if (removed.get()) { return; } CommonUtils.sleepMs(5); } }
Source:
<code>public static Collection<Mutation> genDomainMutations(DomainUpdate update, long seq) { Map<RowColumn, Bytes> oldData = genDomainData(update.getDomain(), update.getOldPageCount()); Map<RowColumn, Bytes> newData = genDomainData(update.getDomain(), update.getNewPageCount()); <START> return AccumuloExportQueue.generateMutations(seq, oldData, newData); <END> }</code><technical_language>I realize this while recipes PR, this PR realize generateMutations is a generic name</technical_language>

Target:
public static Collection<Mutation> genDomainMutations(DomainUpdate update, long seq) { Map<RowColumn, Bytes> oldData = genDomainData(update.getDomain(), update.getOldPageCount()); Map<RowColumn, Bytes> newData = genDomainData(update.getDomain(), update.getNewPageCount()); return AccumuloExporter.generateMutations(seq, oldData, newData); }
Source:
<code>public void register(ExtensionBuilder builder) { builder.service(TestEnricher.class, DroneTestEnricher.class); builder.observer(DroneCore.class); builder.observer(DroneRegistrar.class); builder.observer(DroneExecutorService.class); builder.observer(DroneConfigurator.class); builder.observer(DroneEnhancer.class); builder.observer(DroneDestructor.class); <START> builder.service(Configurator.class, DroneCore.GlobalDroneFactory.class); <END> builder.service(Instantiator.class, DroneCore.GlobalDroneFactory.class); builder.service(Destructor.class, DroneCore.GlobalDroneFactory.class); }</code><technical_language>GlobalDroneFactory is longer loaded SPI, I registered</technical_language>

Target:
public void register(ExtensionBuilder builder) { builder.service(TestEnricher.class, DroneTestEnricher.class); builder.observer(DroneLifecycleManager.class); builder.observer(DroneRegistrar.class); builder.observer(DroneExecutorService.class); builder.observer(DroneConfigurator.class); builder.observer(DroneEnhancer.class); builder.observer(DroneDestructor.class); }
Source:
<code>public Graph() { mSeries = new Vector<>(); mConfiguration = new Hashtable<>(); <START> mAnnotations = new Vector<>(); <END> }</code><technical_language>Leaving out type annotations commcare level break J2ME builds :(</technical_language>

Target:
public Graph() { mSeries = new Vector<XYSeries>(); mConfiguration = new Hashtable<String, Text>(); mAnnotations = new Vector<Annotation>(); }
Source:
<code>public void testExperimentLinkBackwardCompatibility() { fBot.closeAllEditors(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); final IProject project = root.getProject(TRACE_PROJECT_NAME); assertTrue(project.exists()); TmfProjectElement projectElement = TmfProjectRegistry.getProject(project); TmfExperimentFolder experimentsFolder = projectElement.getExperimentsFolder(); assertNotNull("Experiment folder should exist", experimentsFolder); IFolder experimentsFolderResource = experimentsFolder.getResource(); String <START> experiementName = <END> "exp"; IFolder expFolder = experimentsFolderResource.getFolder(experiementName); assertFalse(expFolder.exists()); try { expFolder.create(true, true, null); IFile file = expFolder.getFile(TRACE_NAME); file.createLink(Path.fromOSString(fTestFile.getAbsolutePath()), IResource.REPLACE, new NullProgressMonitor()); } catch (CoreException e) { fail("Failed to create the experiment"); } fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus(); SWTBotTreeItem experimentsItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME), "Experiments"); experimentsItem.expand(); fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable("exp [1]", experimentsItem)); SWTBotTreeItem expItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "exp [1]"); expItem.contextMenu().menu("Open").click(); fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, experiementName)); expItem.expand(); expItem.getNode(TRACE_NAME); }</code><technical_language>experimentName</technical_language>

Target:
public void testExperimentLinkBackwardCompatibility() { fBot.closeAllEditors(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); final IProject project = root.getProject(TRACE_PROJECT_NAME); assertTrue(project.exists()); TmfProjectElement projectElement = TmfProjectRegistry.getProject(project); TmfExperimentFolder experimentsFolder = projectElement.getExperimentsFolder(); assertNotNull("Experiment folder should exist", experimentsFolder); IFolder experimentsFolderResource = experimentsFolder.getResource(); String experimentName = "exp"; IFolder expFolder = experimentsFolderResource.getFolder(experimentName); assertFalse(expFolder.exists()); try { expFolder.create(true, true, null); IFile file = expFolder.getFile(TRACE_NAME); file.createLink(Path.fromOSString(fTestFile.getAbsolutePath()), IResource.REPLACE, new NullProgressMonitor()); } catch (CoreException e) { fail("Failed to create the experiment"); } fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus(); SWTBotTreeItem experimentsItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME), "Experiments"); SWTBotTreeItem expItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "exp"); expItem.expand(); expItem.getNode(TRACE_NAME); expItem.contextMenu().menu("Open").click(); fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, experimentName)); }
Source:
<code>@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.text); ButterKnife.bind(this); measurement = (Measurement) getIntent().getSerializableExtra(TEST); webView.setWebChromeClient(new WebChromeClient()); setProgressBarVisibility(View.VISIBLE); webView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); <START> setProgressBarVisibility(View.VISIBLE); <END> } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); setProgressBarVisibility(View.GONE); } @Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { super.onReceivedError(view, request, error); new MessageDialogFragment.Builder() .withTitle(getString(R.string.Modal_Error)) .withMessage(error.toString()) .build().show(getSupportFragmentManager(), null); setProgressBarVisibility(View.GONE); } }); showText(); }</code><technical_language>this redundant a similar call above</technical_language>

Target:
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.text); ButterKnife.bind(this); measurement = (Measurement) getIntent().getSerializableExtra(TEST); showText(); }
Source:
<code>private String getLocalFilePath(ImageRequest imageRequest) { Uri uri = imageRequest.getSourceUri(); if (UriUtil.isLocalFileUri(uri)) { return imageRequest.getSourceFile().getPath(); } else if (UriUtil.isLocalContentUri(uri)) { Cursor cursor = mContentResolver.query(uri, new String[] {MediaStore.Video.Media.DATA}, null, null, null); try { if (cursor.moveToFirst()) { return cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA)); } } finally { cursor.close(); } } <START> return ""; <END> }</code><technical_language>Return null instead pls, handle correctly road (add @Nullable etc.)</technical_language>

Target:
@Nullable private String getLocalFilePath(ImageRequest imageRequest) { Uri uri = imageRequest.getSourceUri(); if (UriUtil.isLocalFileUri(uri)) { return imageRequest.getSourceFile().getPath(); } else if (UriUtil.isLocalContentUri(uri)) { Cursor cursor = mContentResolver.query(uri, new String[] {MediaStore.Video.Media.DATA}, null, null, null); try { if (cursor.moveToFirst()) { return cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA)); } } finally { cursor.close(); } } return null; }
Source:
<code>public ITmfTimestamp transform(ITmfTimestamp timestamp) { <START> return new TmfNanoTimestamp(fOffset).normalize(timestamp.getValue(), timestamp.getScale()); <END> }</code><technical_language>discussion, this offset a timestamp more precision scale, desired. alternative is transformed timestamps in nanoseconds, large timestamps overflow, assumption caller scale of returned timestamp</technical_language>

Target:
public ITmfTimestamp transform(ITmfTimestamp timestamp) { return timestamp.normalize(fOffset, ITmfTimestamp.NANOSECOND_SCALE); }
Source:
<code>public boolean isValid() throws CrafterException { try { if (state == State.CREATED) { logger.debug("Waiting for initialization of {}", this); <START> initializationLatch.await(); <END> } return state == State.INITIALIZED && storeService.validate(context); } catch (InterruptedException e) { throw new CrafterException("Error while waiting for initialization of " + this); } }</code><technical_language>I this await a 5 min timeout, want leave threads stuck if initialization takes long</technical_language>

Target:
public boolean isValid() throws CrafterException { try { if (state == State.CREATED) { logger.debug("Waiting for initialization of {}", this); initializationLatch.await(initTimeout, TimeUnit.MILLISECONDS); } return state == State.INITIALIZED && storeService.validate(context); } catch (InterruptedException e) { throw new CrafterException("Error while waiting for initialization of " + this); } }
Source:
<code>public void onLongPress(@NonNull MotionEvent e) { if (!mDetailsLookup.overItemWithSelectionKey(e)) { if (DEBUG) Log.d(TAG, "Ignoring LongPress on non-model-backed item."); return; } ItemDetails<K> item = mDetailsLookup.getItemDetails(e); if (item == null) { return; } boolean handled = false; if <START> (isRangeExtension(e)) <END> { extendSelectionRange(item); mHapticPerformer.run(); } else { if (mSelectionTracker.isSelected(item.getSelectionKey())) { mOnDragInitiatedListener.onDragInitiated(e); mHapticPerformer.run(); } else if (mSelectionPredicate.canSetStateForKey(item.getSelectionKey(), true) && selectItem(item)) { if (mSelectionPredicate.canSelectMultiple() && mSelectionTracker.isRangeActive()) { mGestureStarter.run(); } mHapticPerformer.run(); } } }</code><technical_language>change this "isRequestingRangeExtension"? I method understand "Is this MotionEvent a range extension" sense me</technical_language>

Target:
public void onLongPress(@NonNull MotionEvent e) { if (!mDetailsLookup.overItemWithSelectionKey(e)) { if (DEBUG) Log.d(TAG, "Ignoring LongPress on non-model-backed item."); return; } ItemDetails<K> item = mDetailsLookup.getItemDetails(e); if (item == null) { return; } boolean handled = false; if (shouldExtendRange(e)) { extendSelectionRange(item); mHapticPerformer.run(); } else { if (mSelectionTracker.isSelected(item.getSelectionKey())) { mOnDragInitiatedListener.onDragInitiated(e); mHapticPerformer.run(); } else if (mSelectionPredicate.canSetStateForKey(item.getSelectionKey(), true) && selectItem(item)) { if (mSelectionPredicate.canSelectMultiple() && mSelectionTracker.isRangeActive()) { mGestureStarter.run(); } mHapticPerformer.run(); } } }
Source:
<code>public boolean onUploadItemClick(OCUpload file) { <START> File f = new File(file.getLocalUri().getLastPathSegment()); <END> if(!f.exists()) { Toast.makeText(this, "Cannot open. Local file does not exist.", Toast.LENGTH_SHORT).show(); } else { openFileWithDefault(f.getAbsolutePath()); } return true; }</code><technical_language>Bad smell here; .getPath()</technical_language>

Target:
public boolean onUploadItemClick(OCUpload file) { File f = new File(file.getLocalPath()); if(!f.exists()) { Toast.makeText(this, "Cannot open. Local file does not exist.", Toast.LENGTH_SHORT).show(); } else { openFileWithDefault(file.getLocalPath()); } return true; }
Source:
<code>public void testCreateNewNotification() { Notification notification = testNotification(); Notification result = curationApiAdmin.createNotification(notification); assertNotNull(result); Assert.assertTrue(result.getId() > 0); boolean userCanCreate = true; try { curationApiUser.createNotification(notification); } catch (ApiException e) { <START> userCanCreate = false; END> } assertFalse(userCanCreate); }</code><technical_language>Check for 401</technical_language>

Target:
public void testCreateNewNotification() { Notification notification = testNotification(); Notification result = curationApiAdmin.createNotification(notification); assertNotNull(result); Assert.assertTrue(result.getId() > 0); boolean userCanCreate = true; try { curationApiUser.createNotification(notification); } catch (ApiException e) { userCanCreate = false; assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), e.getCode()); } assertFalse(userCanCreate); }
Source:
<code><START> private boolean calcAreaAspectRatioScaleMeasure() { <END> if (this.drawingWidth > 0 && this.drawingHeight > 0) { this.area = this.drawingWidth * this.drawingHeight; this.aspectRatio = this.drawingWidth / this.drawingHeight; this.scaleMeasure = DrawingUtil.computeScaleMeasure(this.drawingWidth, this.drawingHeight, this.dar); return true; } else { return false; } }</code><technical_language>return a if call method</technical_language>

Target:
private void calcAreaAspectRatioScaleMeasure() { if (this.drawingWidth > 0 && this.drawingHeight > 0) { this.area = this.drawingWidth * this.drawingHeight; this.aspectRatio = this.drawingWidth / this.drawingHeight; this.scaleMeasure = DrawingUtil.computeScaleMeasure(this.drawingWidth, this.drawingHeight, this.dar); } }
Source:
<code>public void testConnection() { try { getClient().execute(new OpenStackRequest<>(getClient(), HttpMethod.GET, "", null, ApiRootResponse.class)); } catch (OpenStackResponseException e) { StringBuilder builder = new StringBuilder(); builder.append(e.getMessage()).append("(").append(e.getStatus()).append(")"); <START> log.error(builder.toString(), e); <END> throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); }catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }</code><technical_language>enough stacktrace in DEBUG? error code in INFO enough? If I prefer: log.error("{} ({})", e.getMessage(), e.getStatus()); log.debug("Exception", e);</technical_language>

Target:
public void testConnection() { try { getClient().execute(new OpenStackRequest<>(getClient(), HttpMethod.GET, "", null, ApiRootResponse.class)); } catch (OpenStackResponseException e) { log.error("{} (OpenStack response error code: {})", e.getMessage(), e.getStatus()); log.debug("Exception", e); throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); }catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }
Source:
<code>public String getPreview() { StringBuilder bld= new StringBuilder(); if (isEnabled(CleanUpConstants.USE_OBJECTS_EQUALS)) { bld.append("if (!Objects.equals(aText, other.aText)) {\n"); bld.append(" return false;\n"); bld.append("}\n"); } else { <START> bld.append("if (aText == null) {\n"); bld.append(" if (other.aText != null)\n"); bld.append(" return false;\n"); bld.append("} else if (!aText.equals(other.aText))\n"); bld.append(" return false;\n"); END> } return bld.toString(); }</code><technical_language>In this sample of brackets is consistent. brackets</technical_language>

Target:
public String getPreview() { if (isEnabled(CleanUpConstants.USE_OBJECTS_EQUALS)) { return "" + "if (!Objects.equals(aText, other.aText)) {\n" + " return false;\n" + "}\n"; } else { return "" + "if (aText == null)\n" + " if (other.aText != null)\n" + " return false;\n" + "else if (!aText.equals(other.aText))\n" + " return false;\n"; } }
Source:
<code>default int readInt() throws IOException { <START> final byte[] buf = new byte[4]; <END> final int read = read(buf, 0, 4); if (read < 4) throw new EOFException(); return Bytes.toInt(buf, isLittleEndian()); }</code><technical_language>Same: performance tank. Need a small reusable byte[] instance field. This OK, methods thread-safe</technical_language>

Target:
default int readInt() throws IOException { final byte[] buf = conversionBuffer(); final int read = read(buf, 0, 4); if (read < 4) throw new EOFException(); return Bytes.toInt(buf, isLittleEndian()); }
Source:
<code>protected IResource getResource(IPath path) { if (path != null) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); if <START> (path.getDevice() == null) { <END> IResource member = root.findMember(path); if (member != null) { return member; } } IFile file = root.getFileForLocation(path); if (file != null) { return file; } if (getType() != ARCHIVE) { IContainer container = root.getContainerForLocation(path); if (container != null) { return container; } } @SuppressWarnings("deprecation") IFile[] files = root.findFilesForLocation(path); if (files.length > 0) { return files[0]; } if (getType() != ARCHIVE) { @SuppressWarnings("deprecation") IContainer[] containers = root.findContainersForLocation(path); if (containers.length > 0) { return containers[0]; } } } return null; }</code><technical_language>some thinking I I skip this if completely one, done before. Rationale: for non-Windows systems this condition is true, independently if path is absolute relative workspace, this lead false positives behavior change, compared current code. path /tmp/libs/hello.jar located in project "tmp" earth in /tmp root directory in local file system. Original code try one, new code prefer workspace one</technical_language>

Target:
protected IResource getResource(IPath path) { if (path != null) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); if (getType() == PROJECT) { return root.findMember(path); } IFile file = root.getFileForLocation(path); if (file != null) { return file; } if (getType() != ARCHIVE) { IContainer container = root.getContainerForLocation(path); if (container != null) { return container; } } @SuppressWarnings("deprecation") IFile[] files = root.findFilesForLocation(path); if (files.length > 0) { return files[0]; } if (getType() != ARCHIVE) { @SuppressWarnings("deprecation") IContainer[] containers = root.findContainersForLocation(path); if (containers.length > 0) { return containers[0]; } } return root.findMember(path); } return null; }