auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void endToEndReplicationWithMultiNodeMultiPartitionTest() throws InterruptedException, IOException, InstantiationException { <START> DataNodeId firstDataNode = nonSSLCluster.getClusterMap().getDataNodeIds().get(0); <END> List<DataNodeId> dataNodes = nonSSLCluster.getThreeDataNodesFromDifferentDatacenters(); endToEndReplicationWithMultiNodeMultiPartitionTest(nonSSLCluster, firstDataNode.getPort(), new Port(dataNodes.get(0).getPort(), PortType.PLAINTEXT), new Port(dataNodes.get(1).getPort(), PortType.PLAINTEXT), new Port(dataNodes.get(2).getPort(), PortType.PLAINTEXT)); }</code><technical_language>missing something, node other firstDataNode, name so</technical_language>

Target:
public void endToEndReplicationWithMultiNodeMultiPartitionTest() throws InterruptedException, IOException, InstantiationException { cluster = new MockCluster(notificationSystem); DataNodeId dataNode = cluster.getClusterMap().getDataNodeIds().get(0); ArrayList<String> dataCenterList = Utils.splitString("DC1,DC2,DC3", ","); List<DataNodeId> dataNodes = cluster.getOneDataNodeFromEachDatacenter(dataCenterList); endToEndReplicationWithMultiNodeMultiPartitionTest(dataNode.getPort(), new Port(dataNodes.get(0).getPort(), PortType.PLAINTEXT), new Port(dataNodes.get(1).getPort(), PortType.PLAINTEXT), new Port(dataNodes.get(2).getPort(), PortType.PLAINTEXT)); }
Source:
<code>public void testGetEmptyBodyAndHeader() throws Exception { GreenMail greenMail = new GreenMail(ServerSetupTest.SMTP_IMAP); try { greenMail.start(); String subject = GreenMailUtil.random(); String body = ""; String to = "test@localhost"; final byte[] gifAttachment = {0, 1, 2}; GreenMailUtil.sendAttachmentEmail(to, "from@localhost", subject, body, gifAttachment, "image/gif", "testimage_filename", "testimage_description", greenMail.getSmtp().getServerSetup()); greenMail.waitForIncomingEmail(5000, 1); try (Retriever retriever = new Retriever(greenMail.getImap())) { MimeMultipart mp = (MimeMultipart) retriever.getMessages(to)[0].getContent(); BodyPart bp; bp = mp.getBodyPart(0); assertThat(GreenMailUtil.getBody(bp).trim()).isEqualTo(body); <START> assertThat( <END> "Content-Type: text/plain; charset=us-ascii\r\n" + "Content-Transfer-Encoding: 7bit").isEqualTo( GreenMailUtil.getHeaders(bp).trim()); bp = mp.getBodyPart(1); assertThat(GreenMailUtil.getBody(bp).trim()).isEqualTo("AAEC"); assertThat( "Content-Type: image/gif; name=testimage_filename\r\n" + "Content-Transfer-Encoding: base64\r\n" + "Content-Disposition: attachment; filename=testimage_filename\r\n" + "Content-Description: testimage_description").isEqualTo(GreenMailUtil.getHeaders(bp).trim()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); GreenMailUtil.copyStream(bp.getInputStream(), bout); assertThat(bout.toByteArray()).isEqualTo(gifAttachment); } } finally { greenMail.stop(); } }</code><technical_language>Switch 1st/2nd arg</technical_language>

Target:
public void testGetEmptyBodyAndHeader() throws Exception { GreenMail greenMail = new GreenMail(ServerSetupTest.SMTP_IMAP); try { greenMail.start(); String subject = GreenMailUtil.random(); String body = ""; String to = "test@localhost"; final byte[] gifAttachment = {0, 1, 2}; GreenMailUtil.sendAttachmentEmail(to, "from@localhost", subject, body, gifAttachment, "image/gif", "testimage_filename", "testimage_description", greenMail.getSmtp().getServerSetup()); greenMail.waitForIncomingEmail(5000, 1); try (Retriever retriever = new Retriever(greenMail.getImap())) { MimeMultipart mp = (MimeMultipart) retriever.getMessages(to)[0].getContent(); BodyPart bp; bp = mp.getBodyPart(0); assertThat(body).isEqualTo(GreenMailUtil.getBody(bp).trim()); assertThat( "Content-Type: text/plain; charset=us-ascii\r\n" + "Content-Transfer-Encoding: 7bit").isEqualTo( GreenMailUtil.getHeaders(bp).trim()); bp = mp.getBodyPart(1); assertThat("AAEC").isEqualTo(GreenMailUtil.getBody(bp).trim()); assertThat( "Content-Type: image/gif; name=testimage_filename\r\n" + "Content-Transfer-Encoding: base64\r\n" + "Content-Disposition: attachment; filename=testimage_filename\r\n" + "Content-Description: testimage_description").isEqualTo(GreenMailUtil.getHeaders(bp).trim()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); GreenMailUtil.copyStream(bp.getInputStream(), bout); assertThat(bout.toByteArray()).isEqualTo(gifAttachment); } } finally { greenMail.stop(); } }
Source:
<code>public String getCollectionOutput() { MultiInstanceLoopCharacteristics loopCharacteristics = getMultiInstanceLoopCharacteristics(); ItemAwareElement ieDataOutput = loopCharacteristics.getLoopDataOutputRef(); return process.getDataOutputAssociations().stream() .filter(doa -> doa.getSourceRef().get(0).equals(ieDataOutput)) .map(doa -> doa.getTargetRef().getId()) .findFirst() <START> .get(); <END> }</code><technical_language>question here: Is safe call get() isPresent() there</technical_language>

Target:
public String getCollectionOutput() { ItemAwareElement ieDataOutput = getMultiInstanceLoopCharacteristics() .map(MultiInstanceLoopCharacteristics::getLoopDataOutputRef) .orElse(null); return process.getDataOutputAssociations().stream() .filter(doa -> doa.getSourceRef().get(0).getId().equals(ieDataOutput.getId())) .map(doa -> ProcessVariableReader.getProcessVariableName((Property) doa.getTargetRef())) .findFirst() .orElse(null); }
Source:
<code>protected void onProgressUpdateInternal(final Integer status) { if (activity != null) { <START> setMessage(activity.getString(status == STATUS_UPLOAD ? R.string.export_fieldnotes_uploading : R.string.export_persnotes_creating) + " (" + persNotesCount + ')'); <END> } }</code><technical_language>R.string.export_fieldnotes_uploading reused for reason</technical_language>

Target:
protected void onProgressUpdateInternal(final Integer status) { if (activity != null) { setMessage(activity.getString(R.string.export_persnotes_uploading, persNotesCount)); } }
Source:
<code><START> public static Long getSplitsPerNode(ConnectorSession session) <END> { return session.getProperty(SPLITS_PER_NODE, Long.class); }</code><technical_language>Optional</technical_language>

Target:
public static Optional<Long> getSplitsPerNode(ConnectorSession session) { return Optional.ofNullable(session.getProperty(SPLITS_PER_NODE, Long.class)); }
Source:
<code>private JPanel getInstalledAddOnsPanel() { if (installedAddOnsPanel == null) { installedAddOnsPanel = new JPanel(); installedAddOnsPanel.setLayout(new GridBagLayout()); installedAddOnsPanel.setBorder( BorderFactory.createTitledBorder( null, Constant.messages.getString("cfu.label.addons.border"), TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black)); getInstalledAddOnsTable(); <START> <END> JScrollPane scrollPane = new JScrollPane(); scrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setViewportView(getInstalledAddOnsTable()); JPanel searchPanel = getSearchPanel(getInstalledAddOnsTable()); int row = 0; installedAddOnsPanel.add(searchPanel, LayoutHelper.getGBC(0, row++, 5, 0.0D)); installedAddOnsPanel.add(scrollPane, LayoutHelper.getGBC(0, row++, 5, 1.0D, 1.0D)); installedAddOnsPanel.add(new JLabel(""), LayoutHelper.getGBC(0, row++, 1, 1.0D)); installedAddOnsPanel.add(getUninstallButton(), LayoutHelper.getGBC(1, row, 1, 0.0D)); installedAddOnsPanel.add(getUpdateButton(), LayoutHelper.getGBC(2, row, 1, 0.0D)); installedAddOnsPanel.add(getUpdateAllButton(), LayoutHelper.getGBC(3, row, 1, 0.0D)); installedAddOnsPanel.add(getClose1Button(), LayoutHelper.getGBC(4, row, 1, 0.0D)); } return installedAddOnsPanel; }</code><technical_language>Unrelated indentation changes done in commit. [1] [1] <LINK_0></technical_language>

Target:
private JPanel getInstalledAddOnsPanel() { if (installedAddOnsPanel == null) { installedAddOnsPanel = new JPanel(); installedAddOnsPanel.setLayout(new GridBagLayout()); installedAddOnsPanel.setBorder( BorderFactory.createTitledBorder( null, Constant.messages.getString("cfu.label.addons.border"), TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black)); getInstalledAddOnsTable(); JScrollPane scrollPane = new JScrollPane(); scrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setViewportView(getInstalledAddOnsTable()); installedAddOnsFilterPanel = createFilterPanel(getInstalledAddOnsTable()); int row = 0; installedAddOnsPanel.add(installedAddOnsFilterPanel, LayoutHelper.getGBC(0, row++, 5, 0.0D)); installedAddOnsPanel.add(scrollPane, LayoutHelper.getGBC(0, row++, 5, 1.0D, 1.0D)); installedAddOnsPanel.add(new JLabel(""), LayoutHelper.getGBC(0, row, 1, 1.0D)); installedAddOnsPanel.add(getUninstallButton(), LayoutHelper.getGBC(1, row, 1, 0.0D)); installedAddOnsPanel.add(getUpdateButton(), LayoutHelper.getGBC(2, row, 1, 0.0D)); installedAddOnsPanel.add(getUpdateAllButton(), LayoutHelper.getGBC(3, row, 1, 0.0D)); installedAddOnsPanel.add(getClose1Button(), LayoutHelper.getGBC(4, row, 1, 0.0D)); } return installedAddOnsPanel; }
Source:
<code>public BeanValidatingItemProcessor(LocalValidatorFactoryBean localValidatorFactoryBean) throws Exception { super(); Assert.notNull(localValidatorFactoryBean, "localValidatorFactoryBean must not be null"); <START> localValidatorFactoryBean.afterPropertiesSet(); <END> Validator validator = localValidatorFactoryBean.getValidator(); SpringValidatorAdapter springValidatorAdapter = new SpringValidatorAdapter(validator); SpringValidator<T> springValidator = new SpringValidator<>(); springValidator.setValidator(springValidatorAdapter); springValidator.afterPropertiesSet(); setValidator(springValidator); }</code><technical_language>calling this here. is responsibility of container injected</technical_language>

Target:
public BeanValidatingItemProcessor(LocalValidatorFactoryBean localValidatorFactoryBean) { Assert.notNull(localValidatorFactoryBean, "localValidatorFactoryBean must not be null"); this.validator = localValidatorFactoryBean.getValidator(); }
Source:
<code>public Object getValueAt(int rowIdx, int colIdx) { <START> if (0 == nodeKeys.size()) { <END> return Bundle.OtherOccurrencesFilesTableModel_noData(); } return FilenameUtils.getName(((OtherOccurrenceNodeInstanceData) nodeMap.get(nodeKeys.get(rowIdx)).get(0)).getFilePath()); }</code><technical_language>Codacy isEmpty() instead</technical_language>

Target:
public Object getValueAt(int rowIdx, int colIdx) { if (nodeMap.isEmpty() || nodeKeys.isEmpty() || rowIdx < 0 || rowIdx >= nodeKeys.size() || nodeKeys.get(rowIdx) == null || nodeMap.get(nodeKeys.get(rowIdx)) == null || nodeMap.get(nodeKeys.get(rowIdx)).isEmpty()) { return Bundle.OtherOccurrencesFilesTableModel_noData(); } return FilenameUtils.getName(((OtherOccurrenceNodeInstanceData) nodeMap.get(nodeKeys.get(rowIdx)).get(0)).getFilePath()); }
Source:
<code>private void addSubmitRecordLabels(SubmitRecord submitRecord, <START> SubmitRecordAttribute sa) throws IllegalStateException <END> { if (submitRecord.labels != null && !submitRecord.labels.isEmpty()) { sa.labels = new ArrayList<SubmitLabelAttribute>(); for (SubmitRecord.Label lbl : submitRecord.labels) { SubmitLabelAttribute la = new SubmitLabelAttribute(); la.label = lbl.label; switch (lbl.status) { case OK: la.status = "OK"; break; case REJECT: la.status = "REJECT"; break; case NEED: la.status = "NEED"; break; case MAY: la.status = "MAY"; break; case IMPOSSIBLE: la.status = "IMPOSSIBLE"; break; default: throw new IllegalStateException( "Unsupported SubmitRecord.Label.status (" + lbl.status + ")"); } if(lbl.appliedBy != null) { Account a = accountCache.get(lbl.appliedBy).getAccount(); la.by = asAccountAttribute(a); } sa.labels.add(la); } } }</code><technical_language>remove throws IllegalStateException changes suggested applied</technical_language>

Target:
private void addSubmitRecordLabels(SubmitRecord submitRecord, SubmitRecordAttribute sa) { if (submitRecord.labels != null && !submitRecord.labels.isEmpty()) { sa.labels = new ArrayList<SubmitLabelAttribute>(); for (SubmitRecord.Label lbl : submitRecord.labels) { SubmitLabelAttribute la = new SubmitLabelAttribute(); la.label = lbl.label; la.status = lbl.status.name(); if(lbl.appliedBy != null) { Account a = accountCache.get(lbl.appliedBy).getAccount(); la.by = asAccountAttribute(a); } sa.labels.add(la); } } }
Source:
<code>private Path generateTempDir(IMethodInvocation invocation) throws IOException { <START> String prefix = TEMP_DIR_PREFIX + "_" + ((invocation.getIteration() == null) ? <END> invocation.getSpec().getName() : invocation.getIteration().getName()) .replaceAll("[^a-zA-Z0-9_.-]++", "_") + "_" + fieldInfo.getName(); if (parentDir == null) { return Files.createTempDirectory(prefix); } return Files.createTempDirectory(parentDir, prefix); }</code><technical_language>This lead some long names, dont a uuid currentTimeMillis</technical_language>

Target:
private Path generateTempDir(IMethodInvocation invocation) throws IOException { String prefix = dirPrefix(invocation); if (parentDir == null) { return Files.createTempDirectory(prefix); } return Files.createTempDirectory(parentDir, prefix); }
Source:
<code>public static FluidTagInput deserialize(JsonElement input) { Preconditions.checkArgument(input instanceof JsonObject, "FluidTagWithSize can only be deserialized from a JsonObject"); JsonObject jsonObject = input.getAsJsonObject(); ResourceLocation resourceLocation = new ResourceLocation(JSONUtils.getString(jsonObject, "tag")); if(!JSONUtils.hasField(jsonObject, "nbt")) return new FluidTagInput(resourceLocation, JSONUtils.getInt(jsonObject, "amount")); try { CompoundNBT nbt = JsonToNBT.getTagFromJson(JSONUtils.getString(jsonObject, "nbt")); return new FluidTagInput(resourceLocation, JSONUtils.getInt(jsonObject, "amount"), nbt); } catch(CommandSyntaxException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>IllegalArgumentException JsonParseException RecipeManager catches</technical_language>

Target:
public static FluidTagInput deserialize(JsonElement input) { Preconditions.checkArgument(input instanceof JsonObject, "FluidTagWithSize can only be deserialized from a JsonObject"); JsonObject jsonObject = input.getAsJsonObject(); ResourceLocation resourceLocation = new ResourceLocation(JSONUtils.getString(jsonObject, "tag")); if(!JSONUtils.hasField(jsonObject, "nbt")) return new FluidTagInput(resourceLocation, JSONUtils.getInt(jsonObject, "amount")); try { CompoundNBT nbt = ItemUtils.parseNbtFromJson(jsonObject.get("nbt")); return new FluidTagInput(resourceLocation, JSONUtils.getInt(jsonObject, "amount"), nbt); } catch(CommandSyntaxException e) { throw new JsonParseException(e); } }
Source:
<code>public void networkNull() throws Exception { <START> validator = spy(new NetworkValidator(null)); END> assertEquals(new ValidationResult(VdcBllMessages.NETWORK_NOT_EXISTS), validator.networkExists()); }</code><technical_language>spy is redundant</technical_language>

Target:
public void networkNull() throws Exception { validator = new NetworkValidator(null); assertEquals(new ValidationResult(VdcBllMessages.NETWORK_NOT_EXISTS), validator.networkExists()); }
Source:
<code>public TextureAtlas(FileHandle packFile, FileHandle imagesDir){ <START> String[] lines; <END> try { lines = packFile.readAllLines(); } catch (IOException e) { throw new MdxException(e.toString()); } int i = 1; Texture packTexture; while (i < lines.length){ packTexture = Mdx.graphics.newTexture(imagesDir.child(lines[i])); i+=5; while (i < lines.length && !lines[i].isEmpty()){ int index, x, y, width, height, originalWidth, originalHeight, offsetX, offsetY; String name = lines[i]; boolean rotate = Boolean.parseBoolean(lines[i + 1].split(":")[1].trim()); int[] xyTuple = readTuple(lines[i + 2]); x = xyTuple[0]; y = xyTuple[1]; int[] whTuple = readTuple(lines[i + 3]); width = whTuple[0]; height = whTuple[1]; int[] originalWhTuple = readTuple(lines[i + 4]); originalWidth = originalWhTuple[0]; originalHeight = originalWhTuple[1]; int[] offsetTuple = readTuple(lines[i + 5]); offsetX = offsetTuple[0]; offsetY = offsetTuple[1]; index = Integer.parseInt(lines[i + 6].split(":")[1].trim()); atlasRegions.add(Mdx.graphics.newTextureAtlasRegion(packTexture, name, index, x, y, width, height, rotate, originalWidth, originalHeight, offsetX, offsetY)); i += 7; } i++; } }</code><technical_language>this constructor re-use config parsing somehow</technical_language>

Target:
public TextureAtlas(FileHandle packFile, FileHandle imagesDir){ TextureAtlasConfig config = new TextureAtlasConfig(packFile, imagesDir); for (String texturePath : config.getDependencies()){ config.textures.replace(texturePath, Mdx.graphics.newTexture(Mdx.files.internal(texturePath))); } initFromConfig(config); }
Source:
<code>public void onSubscribe(Subscription inner) { <START> SubscriptionHelper.setOnce(this, inner); <END> o.onSubscribe(this); inner.request(Long.MAX_VALUE); }</code><technical_language>set a plain field, need for atomics: java this.inner = inner; o.onSubscribe(this); inner.request(Long.MAX_VALUE);</technical_language>

Target:
public void onSubscribe(Subscription inner) { this.inner = inner; o.onSubscribe(this); inner.request(Long.MAX_VALUE); }
Source:
<code>public synchronized void doHandleClusterView(int viewId) { if (currentTopology == null) return; List<Address> newClusterMembers = transport.getMembers(); int newViewId = transport.getViewId(); <START> if (newViewId != viewId) { <END> log.debugf("Cache %s skipping members update for view %d after receiving view %d", cacheName, viewId, newViewId); return; } if (trace) log.tracef("Cache %s updating members for view %d: %s", cacheName, viewId, newClusterMembers); boolean cacheMembersModified = retainMembers(newClusterMembers); availabilityStrategy.onClusterViewChange(this, newClusterMembers); if (cacheMembersModified) { updateMembers(); } }</code><technical_language>Is get a viewId coordinator transport updated own</technical_language>

Target:
public synchronized void doHandleClusterView(int viewId) { if (currentTopology == null) return; List<Address> newClusterMembers = transport.getMembers(); int newViewId = transport.getViewId(); if (newViewId != viewId) { log.debugf("Cache %s skipping members update for view %d, newer view received: %d", cacheName, viewId, newViewId); return; } if (trace) log.tracef("Cache %s updating members for view %d: %s", cacheName, viewId, newClusterMembers); boolean cacheMembersModified = retainMembers(newClusterMembers); availabilityStrategy.onClusterViewChange(this, newClusterMembers); if (cacheMembersModified) { updateMembers(); } }
Source:
<code>public void session_should_detect_cluster_close() { ScassandraCluster scassandraCluster = ScassandraCluster.builder().withIpPrefix(TestUtils.IP_PREFIX).build(); Cluster cluster = Cluster.builder() .addContactPoints(scassandraCluster.address(1).getAddress()) .withPort(scassandraCluster.getBinaryPort()) .withNettyOptions(nonQuietClusterCloseOptions) .build(); try { scassandraCluster.init(); Session session = cluster.connect(); cluster.close(); try { session.execute("SELECTS * FROM system.peers"); fail( <START> "This error when session.execute is called on session associated with closed cluster."); <END> } catch (IllegalStateException e) { assertThat( e.getMessage().equals("Parent cluster is closed. This session is no longer valid.")); } } finally { scassandraCluster.stop(); } }</code><technical_language>This is sort of awkwardly phrased, change like: "Should failed if session.execute called cluster closed."</technical_language>

Target:
public void session_should_detect_cluster_close() { ScassandraCluster scassandraCluster = ScassandraCluster.builder().withIpPrefix(TestUtils.IP_PREFIX).build(); Cluster cluster = Cluster.builder() .addContactPoints(scassandraCluster.address(1).getAddress()) .withPort(scassandraCluster.getBinaryPort()) .withNettyOptions(nonQuietClusterCloseOptions) .build(); try { scassandraCluster.init(); Session session = cluster.connect(); cluster.close(); try { session.execute("SELECTS * FROM system.peers"); fail("Should have failed when session.execute was called on cluster that was closed"); } catch (DriverInternalError e) { assertThat(e.getCause()).isInstanceOf(IllegalStateException.class); assertThat(e.getCause()).hasMessage("Could not send request, session is closed"); } } finally { scassandraCluster.stop(); } }
Source:
<code>PredicateArgs(String args) throws QueryParseException { positional = Lists.newArrayList(); keyValue = Maps.newHashMap(); String[] splitArgs = args.split(","); for (String arg : splitArgs) { <START> String splitKeyValue[] = arg.split("="); <END> if (splitKeyValue.length == 1) { positional.add(splitKeyValue[0]); } else if (splitKeyValue.length == 2) { if (!keyValue.containsKey(splitKeyValue[0])) { keyValue.put(splitKeyValue[0], splitKeyValue[1]); } else { throw new QueryParseException("Duplicate key " + splitKeyValue[0]); } } else { throw new QueryParseException("invalid arg " + arg); } } }</code><technical_language>s/String splitKeyValue[]/String[] splitKeyValue</technical_language>

Target:
PredicateArgs(String args) throws QueryParseException { positional = Lists.newArrayList(); keyValue = Maps.newHashMap(); String[] splitArgs = args.split(","); for (String arg : splitArgs) { String[] splitKeyValue = arg.split("="); if (splitKeyValue.length == 1) { positional.add(splitKeyValue[0]); } else if (splitKeyValue.length == 2) { if (!keyValue.containsKey(splitKeyValue[0])) { keyValue.put(splitKeyValue[0], splitKeyValue[1]); } else { throw new QueryParseException("Duplicate key " + splitKeyValue[0]); } } else { throw new QueryParseException("invalid arg " + arg); } } }
Source:
<code>private void checkOcServer() { String uri = mHostUrlInput.getText().toString().trim(); mServerIsValid = false; mServerIsChecked = false; mLoginButton.setVisibility(View.GONE); mServerInfo = new GetServerInfoOperation.ServerInfo(); showRefreshButton(false); if (uri.length() != 0) { uri = stripIndexPhpOrAppsFiles(uri, mHostUrlInput); uri = subdomainToLower(uri, mHostUrlInput); try { uri = DisplayUtils.convertIdn(uri, true); } catch (IllegalArgumentException ex) { } mServerStatusText = getResources().getString(R.string.auth_testing_connection); mServerStatusIcon = R.drawable.progress_small; showServerStatus(); SharedPreferences.Editor editor = PreferenceManager .getDefaultSharedPreferences(this).edit(); <START> editor.putString("server_url", normalizeUrlSuffix(uri)); <END> editor.apply(); Intent getServerInfoIntent = new Intent(); getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO); getServerInfoIntent.putExtra(OperationsService.EXTRA_SERVER_URL, normalizeUrlSuffix(uri)); if (mOperationsServiceBinder != null) { mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent); } else { Timber.e("Server check tried with OperationService unbound!"); } } else { mServerStatusText = ""; mServerStatusIcon = 0; showServerStatus(); } }</code><technical_language>put server_url in a constant somewhere, do think</technical_language>

Target:
private void checkOcServer() { String uri = mHostUrlInput.getText().toString().trim(); mServerIsValid = false; mServerIsChecked = false; mLoginButton.setVisibility(View.GONE); mServerInfo = new GetServerInfoOperation.ServerInfo(); showRefreshButton(false); if (uri.length() != 0) { uri = stripIndexPhpOrAppsFiles(uri, mHostUrlInput); uri = subdomainToLower(uri, mHostUrlInput); try { uri = DisplayUtils.convertIdn(uri, true); } catch (IllegalArgumentException ex) { } mServerStatusText = getResources().getString(R.string.auth_testing_connection); mServerStatusIcon = R.drawable.progress_small; showServerStatus(); Intent getServerInfoIntent = new Intent(); getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO); getServerInfoIntent.putExtra(OperationsService.EXTRA_SERVER_URL, normalizeUrlSuffix(uri)); if (mOperationsServiceBinder != null) { mWaitingForOpId = mOperationsServiceBinder.queueNewOperation(getServerInfoIntent); } else { Timber.e("Server check tried with OperationService unbound!"); } } else { mServerStatusText = ""; mServerStatusIcon = 0; showServerStatus(); } }
Source:
<code>public void testConstructorFailForUnsupportedRequireStable() { builder = new OffsetFetchRequest.Builder(groupId, true, null); for (short version = 0; version <= ApiKeys.OFFSET_FETCH.latestVersion(); version++) { <START> short finalVersion = version; <END> if (version < 2) { assertThrows(UnsupportedVersionException.class, () -> builder.build(finalVersion)); } else { OffsetFetchRequest request = builder.build(finalVersion); assertEquals(groupId, request.groupId()); assertNull(request.partitions()); assertTrue(request.isAllPartitions()); if (version < 7) { assertFalse(request.requireStable()); } else { assertTrue(request.requireStable()); } } } }</code><technical_language>above? do need finalVersion is this test</technical_language>

Target:
public void testConstructorFailForUnsupportedRequireStable() { for (short version = 0; version <= ApiKeys.OFFSET_FETCH.latestVersion(); version++) { builder = new OffsetFetchRequest.Builder(groupId, true, null); final short finalVersion = version; if (version < 2) { assertThrows(UnsupportedVersionException.class, () -> builder.build(finalVersion)); } else { OffsetFetchRequest request = builder.build(finalVersion); assertEquals(groupId, request.groupId()); assertNull(request.partitions()); assertTrue(request.isAllPartitions()); if (version < 7) { assertFalse(request.requireStable()); } else { assertTrue(request.requireStable()); } } } }
Source:
<code><START> private void notifyCallbackWithSuccess() { <END> callback.onSuccess(); activeTasks.remove(this); }</code><technical_language>Please this package protected, avoid expensive synthetic accessor</technical_language>

Target:
void notifyCallbackWithSuccess() { callback.onSuccess(); activeTasks.remove(this); }
Source:
<code>public void testCorrectDialogTitle() { openNewDataDialog(variableBrickPosition, R.id.set_variable_spinner); onView(withText(R.string.formula_editor_variable_dialog_title)) <START> .noActivity(); <END> clickCancel(); openNewDataDialog(listBrickPosition, R.id.add_item_to_userlist_spinner); onView(withText(R.string.formula_editor_list_dialog_title)) .noActivity(); }</code><technical_language>noActivity? this line doesnt do anything, doesnt assert anything. doesnt check if dialog title is displayed. if is view fitting matcher do perform it, is done. add .check(isDisplayed()) assert is there</technical_language>

Target:
public void testCorrectDialogTitle() { clickOnEmptySpinner(variableBrickPosition, R.id.set_variable_spinner); onView(withText(R.string.formula_editor_variable_dialog_title)) .check(matches(isDisplayed())); clickCancel(); clickOnEmptySpinner(listBrickPosition, R.id.add_item_to_userlist_spinner); onView(withText(R.string.formula_editor_list_dialog_title)) .check(matches(isDisplayed())); }
Source:
<code>public void testExplicitPropertyMappings() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("exchange.max-buffer-size", "1GB") .put("exchange.concurrent-request-multiplier", "13") .put("exchange.min-error-duration", "13s") .put("exchange.max-error-duration", "33s") .put("exchange.max-response-size", "1MB") .put("exchange.client-threads", "2") .put("exchange.page-buffer-client.max-callback-threads", "16") .put("exchange.acknowledge-pages", "false") <START> .put("exchange.initial-request-count", "42") <END> .build(); ExchangeClientConfig expected = new ExchangeClientConfig() .setMaxBufferSize(new DataSize(1, Unit.GIGABYTE)) .setConcurrentRequestMultiplier(13) .setMinErrorDuration(new Duration(33, TimeUnit.SECONDS)) .setMaxErrorDuration(new Duration(33, TimeUnit.SECONDS)) .setMaxResponseSize(new DataSize(1, Unit.MEGABYTE)) .setClientThreads(2) .setPageBufferClientMaxCallbackThreads(16) .setAcknowledgePages(false); assertFullMapping(properties, expected); }</code><technical_language>nit: need update this test</technical_language>

Target:
public void testExplicitPropertyMappings() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("exchange.max-buffer-size", "1GB") .put("exchange.concurrent-request-multiplier", "13") .put("exchange.min-error-duration", "13s") .put("exchange.max-error-duration", "33s") .put("exchange.max-response-size", "1MB") .put("exchange.client-threads", "2") .put("exchange.page-buffer-client.max-callback-threads", "16") .put("exchange.acknowledge-pages", "false") .put("exchange.response-size-exponential-moving-average-decaying-alpha", "0.42") .build(); ExchangeClientConfig expected = new ExchangeClientConfig() .setMaxBufferSize(new DataSize(1, Unit.GIGABYTE)) .setConcurrentRequestMultiplier(13) .setMinErrorDuration(new Duration(33, TimeUnit.SECONDS)) .setMaxErrorDuration(new Duration(33, TimeUnit.SECONDS)) .setMaxResponseSize(new DataSize(1, Unit.MEGABYTE)) .setClientThreads(2) .setPageBufferClientMaxCallbackThreads(16) .setAcknowledgePages(false) .setResponseSizeExponentialMovingAverageDecayingAlpha(0.42); assertFullMapping(properties, expected); }
Source:
<code>private void mergeAndPush() { final Granularity segmentGranularity = schema.getGranularitySpec().getSegmentGranularity(); final Period windowPeriod = config.getWindowPeriod(); final long windowMillis = windowPeriod.toStandardDuration().getMillis(); log.info("Starting merge and push."); DateTime minTimestampAsDate = segmentGranularity.truncate( new DateTime( Math.max( windowMillis, rejectionPolicy.getCurrMaxTime() .getMillis() ) - windowMillis ) ); long minTimestamp = minTimestampAsDate.getMillis(); log.info("Found [%,d] sinks. minTimestamp [%s]", sinks.size(), minTimestampAsDate); List<Map.Entry<Long, Sink>> sinksToPush = Lists.newArrayList(); for (Map.Entry<Long, Sink> entry : sinks.entrySet()) { final Long intervalStart = entry.getKey(); if (intervalStart < minTimestamp) { log.info("Adding entry [%s] for merge and push.", entry); sinksToPush.add(entry); } else { log.warn( <START> "[%s] >= [%s] Skipping persist and merge for entry [%s]", <END> new DateTime(intervalStart), minTimestampAsDate, entry ); } } log.info("Found [%,d] sinks to persist and merge", sinksToPush.size()); for (final Map.Entry<Long, Sink> entry : sinksToPush) { persistAndMerge(entry.getKey(), entry.getValue()); } }</code><technical_language>add a msg this entry persisted merged a time</technical_language>

Target:
private void mergeAndPush() { final Granularity segmentGranularity = schema.getGranularitySpec().getSegmentGranularity(); final Period windowPeriod = config.getWindowPeriod(); final long windowMillis = windowPeriod.toStandardDuration().getMillis(); log.info("Starting merge and push."); DateTime minTimestampAsDate = segmentGranularity.truncate( new DateTime( Math.max( windowMillis, rejectionPolicy.getCurrMaxTime() .getMillis() ) - windowMillis ) ); long minTimestamp = minTimestampAsDate.getMillis(); log.info("Found [%,d] segments. Attempting to hand off segments that start before [%s].", sinks.size(), minTimestampAsDate); List<Map.Entry<Long, Sink>> sinksToPush = Lists.newArrayList(); for (Map.Entry<Long, Sink> entry : sinks.entrySet()) { final Long intervalStart = entry.getKey(); if (intervalStart < minTimestamp) { log.info("Adding entry [%s] for merge and push.", entry); sinksToPush.add(entry); } else { log.info( "Skipping persist and merge for entry [%s] : Start time [%s] >= [%s] min timestamp required in this run. Segment will be picked up in a future run.", entry, new DateTime(intervalStart), minTimestampAsDate ); } } log.info("Found [%,d] sinks to persist and merge", sinksToPush.size()); for (final Map.Entry<Long, Sink> entry : sinksToPush) { persistAndMerge(entry.getKey(), entry.getValue()); } }
Source:
<code>boolean matches(DownloadFileId downloadFileId) { <START> return downloadFileStatus.downloadFileId().equals(downloadFileId); <END> }</code><technical_language>this class hold a downloadFileId</technical_language>

Target:
boolean matches(DownloadFileId downloadFileId) { return this.downloadFileId.equals(downloadFileId); }
Source:
<code>public void shouldThrow409_whenMandateStateInvalid(){ <START> Response response = mock(Response.class); <END> when(response.readEntity(ConnectorErrorResponse.class)) .thenReturn(new ConnectorErrorResponse( ErrorIdentifier.MANDATE_STATE_INVALID, null, null)); Response returnedResponse = mapper.toResponse(new CreateChargeException(response)); PaymentError returnedError = (PaymentError) returnedResponse.getEntity(); assertThat(returnedResponse.getStatus(), is(409)); assertThat(returnedError.getDescription(), is(aPaymentError(CREATE_PAYMENT_MANDATE_STATE_INVALID).getDescription())); assertThat(returnedError.getCode(), is(aPaymentError(CREATE_PAYMENT_MANDATE_STATE_INVALID).getCode())); }</code><technical_language>put a mock this in a field annotation: java @Mock private Response mockResponse; need add a class-level @RunWith(MockitoJUnitRunner.class) annotation for this work</technical_language>

Target:
public void shouldThrow409_whenMandateStateInvalid(){ when(mockResponse.readEntity(ConnectorErrorResponse.class)) .thenReturn(new ConnectorErrorResponse( ErrorIdentifier.MANDATE_STATE_INVALID, null, null)); Response returnedResponse = mapper.toResponse(new CreateChargeException(mockResponse)); PaymentError returnedError = (PaymentError) returnedResponse.getEntity(); PaymentError expectedError = aPaymentError(CREATE_PAYMENT_MANDATE_STATE_INVALID); assertThat(returnedResponse.getStatus(), is(409)); assertThat(returnedError.getDescription(), is(expectedError.getDescription())); assertThat(returnedError.getCode(), is(expectedError.getCode())); }
Source:
<code>public double getScore(Container container) { int totalComponentInstances = 0; int totalInstances = container.getInstances().size(); if (totalInstances == 0) { return 0; } for (PackingPlan.InstancePlan instancePlan : container.getInstances()) { if (componentName.equals(instancePlan.getComponentName())) { totalComponentInstances++; } } <START> return (double) totalComponentInstances / totalInstances; <END> }</code><technical_language>I lose opportunities for removing containers this scoring function. a container BBCD ABC want remove 1 B. is remove ABC BBCD maximize probability remove this container that. current scoring function remove BBCD. I need categorize containers total number of instances scoring function category. I another example in discussion thread. In general optimizing for imbalance remove containers easily. cover cases a two-step approach discussed in #1560</technical_language>

Target:
public double getScore(Container container) { int totalComponentInstances = 0; int totalInstances = container.getInstances().size(); if (totalInstances == 0) { return 0; } for (PackingPlan.InstancePlan instancePlan : container.getInstances()) { if (componentName.equals(instancePlan.getComponentName())) { totalComponentInstances++; } } if (binaryMode) { if (totalComponentInstances == totalInstances) { return 1; } else { return 0; } } else { return (double) totalComponentInstances / totalInstances; } }
Source:
<code>private static void close(Collection<Connection> list) throws SQLException { for (Connection conn : list) { <START> try { conn.close(); } catch (SQLException ignore) { } <END> } }</code><technical_language>IOUtils.closeSilently for this</technical_language>

Target:
private static void close(Collection<Connection> list) { for (Connection conn : list) { IOUtils.closeSilently(conn); } }
Source:
<code>public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { System.out.println("Channel heartBeat lost"); if (evt instanceof IdleStateEvent && IdleState.READER_IDLE == ((IdleStateEvent) evt).state()) { <START> ctx.channel().close(); <END> } }</code><technical_language>ctx.close();</technical_language>

Target:
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { System.out.println("Channel heartBeat lost"); if (evt instanceof IdleStateEvent && IdleState.READER_IDLE == ((IdleStateEvent) evt).state()) { ctx.close(); } }
Source:
<code>protected Integer calculateRecordsJSON(String jsonStr) { Integer rec = null; try { ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readTree(jsonStr); if (!jsonNode.isObject()) { return null; } jsonNode = jsonNode.get("data"); if (jsonNode.isArray()) { rec = jsonNode.size(); } <START> } catch (JsonMappingException e) { <END> e.printStackTrace(); } catch (JsonProcessingException e) { e.printStackTrace(); } return rec; }</code><technical_language>need catch exceptions. propagate</technical_language>

Target:
protected Integer calculateRecordsJSON(String jsonStr) { return JsonPath.read(jsonStr, "$.data.length()"); }
Source:
<code>public void testGetMcqOtherWeight_nullOtherWeight_exceptionThrown() { FeedbackMcqQuestionDetails mcqDetails = new FeedbackMcqQuestionDetails(); HashMap<String, String[]> requestParams = new HashMap<>(); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_TYPE, new String[] { "MCQ" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_TEXT, new String[] { "mcq question text" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_GENERATED_OPTIONS, new String[] { "NONE" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, new String[] { "2" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-0", new String[] { "Choice 1" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-1", new String[] { "Choice 2" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_HAS_WEIGHTS_ASSIGNED, new String[] { "on" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_WEIGHT + "-0", new String[] { "2.57" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_WEIGHT + "-1", new String[] { "1.12" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQOTHEROPTIONFLAG, new String[] { "on" }); <START> assertTrue(mcqDetails.extractQuestionDetails(requestParams, FeedbackQuestionType.MCQ)); <END> }</code><technical_language>assertTrue is redundant here</technical_language>

Target:
public void testGetMcqOtherWeight_nullOtherWeight_exceptionThrown() { FeedbackMcqQuestionDetails mcqDetails = new FeedbackMcqQuestionDetails(); HashMap<String, String[]> requestParams = new HashMap<>(); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_TYPE, new String[] { "MCQ" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_TEXT, new String[] { "mcq question text" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_GENERATED_OPTIONS, new String[] { "NONE" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, new String[] { "2" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-0", new String[] { "Choice 1" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQCHOICE + "-1", new String[] { "Choice 2" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_HAS_WEIGHTS_ASSIGNED, new String[] { "on" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_WEIGHT + "-0", new String[] { "2.57" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQ_WEIGHT + "-1", new String[] { "1.12" }); requestParams.put(Const.ParamsNames.FEEDBACK_QUESTION_MCQOTHEROPTIONFLAG, new String[] { "on" }); mcqDetails.extractQuestionDetails(requestParams, FeedbackQuestionType.MCQ); }
Source:
<code>public static Toast makeText(Context context, CharSequence s, int duration) { <START> if(VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) { <END> return Toast.makeText(context, s, duration); } IcsToast toast = new IcsToast(context); toast.setDuration(duration); TextView view = new TextView(context); view.setText(s); view.setTextColor(0xFFDADADA); view.setGravity(Gravity.CENTER); view.setBackgroundResource(R.drawable.abs__toast_frame); toast.setView(view); return toast; }</code><technical_language>Space if. name of class is IcsToast pre-Honeycomb. switch conditional compare ICS</technical_language>

Target:
public static Toast makeText(Context context, CharSequence s, int duration) { if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) { return Toast.makeText(context, s, duration); } IcsToast toast = new IcsToast(context); toast.setDuration(duration); TextView view = new TextView(context); view.setText(s); view.setTextColor(0xffffffff); view.setGravity(Gravity.CENTER); view.setBackgroundResource(R.drawable.abs__toast_frame); toast.setView(view); return toast; }
Source:
<code><START> public List<PermissionSubject> getPermissionCheckSubjects() { <END> return Collections.singletonList(new PermissionSubject(getParameters().getStorageDomainId(), VdcObjectType.Storage, getActionType().getActionGroup())); }</code><technical_language>return 'Collections.emptyList()' - permission check is unneeded command is executed internally</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { return Collections.emptyList(); }
Source:
<code>default void initializeSegment(TrackingToken token, String processorName, int segment) throws UnableToInitializeTokenException { <START> throw new UnsupportedOperationException(""); <END> }</code><technical_language>provide message here? default constructor..</technical_language>

Target:
default void initializeSegment(TrackingToken token, String processorName, int segment) throws UnableToInitializeTokenException { throw new UnsupportedOperationException("Explicit initialization is not supported by this TokenStore implementation"); }
Source:
<code>private void subscribeTopicUpdateChildren(@UIEventTopic(ElementContainer.TOPIC_CHILDREN) Event event) { if (!(event.getProperty(UIEvents.EventTags.ELEMENT) instanceof MToolBar)) { return; } MToolBar toolbarModel = (MToolBar) event.getProperty(UIEvents.EventTags.ELEMENT); ToolBarManager parentManager = getManager(toolbarModel); if (parentManager == null) { return; } if (UIEvents.isADD(event)) { for (Object o : UIEvents.asIterable(event, UIEvents.EventTags.NEW_VALUE)) { MToolBarElement added = (MToolBarElement) o; modelProcessSwitch(parentManager, added); } } else if (UIEvents.isREMOVE(event)) { for (Object o : UIEvents.asIterable(event, UIEvents.EventTags.OLD_VALUE)) { MToolBarElement removed = (MToolBarElement) o; disposeToolBarElement(parentManager, removed); } } else if (UIEvents.isMOVE(event)) { Object oldPos = event.getProperty(UIEvents.EventTags.OLD_VALUE); Object newPos = event.getProperty(UIEvents.EventTags.POSITION); IContributionItem ici = parentManager.getItems()[(Integer) oldPos]; parentManager.remove(ici); parentManager.insert((Integer) newPos, ici); } <START> parentManager.update(true); <END> ToolBar toolbar = getToolbarFrom(toolbarModel.getWidget()); if (toolbar != null) { toolbar.requestLayout(); } }</code><technical_language>Schouldn't this code called if changed before</technical_language>

Target:
private void subscribeTopicUpdateChildren(@UIEventTopic(ElementContainer.TOPIC_CHILDREN) Event event) { if (!(event.getProperty(UIEvents.EventTags.ELEMENT) instanceof MToolBar)) { return; } MToolBar toolbarModel = (MToolBar) event.getProperty(UIEvents.EventTags.ELEMENT); ToolBarManager parentManager = getManager(toolbarModel); if (parentManager == null) { return; } if (UIEvents.isADD(event)) { for (Object o : UIEvents.asIterable(event, UIEvents.EventTags.NEW_VALUE)) { MToolBarElement added = (MToolBarElement) o; modelProcessSwitch(parentManager, added); } updateWidget(parentManager); } else if (UIEvents.isREMOVE(event)) { for (Object o : UIEvents.asIterable(event, UIEvents.EventTags.OLD_VALUE)) { MToolBarElement removed = (MToolBarElement) o; disposeToolBarElement(parentManager, removed); } updateWidget(parentManager); } else if (UIEvents.isMOVE(event)) { Object oldPos = event.getProperty(UIEvents.EventTags.OLD_VALUE); Object newPos = event.getProperty(UIEvents.EventTags.POSITION); IContributionItem ici = parentManager.getItems()[(Integer) oldPos]; parentManager.remove(ici); parentManager.insert((Integer) newPos, ici); updateWidget(parentManager); } }
Source:
<code>public void deleteAllergy(RestApi restApi, String patientUuid, String allergyUuid, DefaultResponseCallback callback) { if (NetworkUtils.isOnline()) { restApi.deleteAllergy(patientUuid, allergyUuid).enqueue(new Callback<ResponseBody>() { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { if (response.isSuccessful()) { allergyRoomDAO.deleteAllergyByUUID(allergyUuid); ToastUtil.success(OpenMRS.getInstance().getString(R.string.delete_allergy_success)); callback.onResponse(); } } @Override public void onFailure(Call<ResponseBody> call, Throwable t) { callback.onErrorResponse(OpenMRS.getInstance().getString(R.string.delete_allergy_failure)); } }); } else { Data data = new Data.Builder() <START> .putString("patient_uuid", patientUuid) <END> .putString("allergy_uuid", allergyUuid) .build(); allergyRoomDAO.deleteAllergyByUUID(allergyUuid); callback.onResponse(); Constraints constraints = new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build(); workManager.enqueue(new OneTimeWorkRequest.Builder(DeleteAllergyWorker.class).setConstraints(constraints).setInputData(data).build()); ToastUtil.notify(OpenMRS.getInstance().getString(R.string.delete_allergy_offline)); } }</code><technical_language>Place patient_uuid allergy_uuid keys in ApplicationConstants</technical_language>

Target:
public void deleteAllergy(RestApi restApi, String patientUuid, String allergyUuid, DefaultResponseCallback callback) { if (NetworkUtils.isOnline()) { restApi.deleteAllergy(patientUuid, allergyUuid).enqueue(new Callback<ResponseBody>() { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { if (response.isSuccessful()) { allergyRoomDAO.deleteAllergyByUUID(allergyUuid); ToastUtil.success(OpenMRS.getInstance().getString(R.string.delete_allergy_success)); callback.onResponse(); } } @Override public void onFailure(Call<ResponseBody> call, Throwable t) { callback.onErrorResponse(OpenMRS.getInstance().getString(R.string.delete_allergy_failure)); } }); } else { Data data = new Data.Builder() .putString(PATIENT_UUID, patientUuid) .putString(ALLERGY_UUID, allergyUuid) .build(); allergyRoomDAO.deleteAllergyByUUID(allergyUuid); callback.onResponse(); Constraints constraints = new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build(); workManager.enqueue(new OneTimeWorkRequest.Builder(DeleteAllergyWorker.class).setConstraints(constraints).setInputData(data).build()); ToastUtil.notify(OpenMRS.getInstance().getString(R.string.delete_allergy_offline)); } }
Source:
<code>public Response move(Action action) { validateParameters(action, "storageDomain.id|name"); MoveDisksParameters params = new MoveDisksParameters(Collections.singletonList(new MoveDiskParameters( <START> asGuid(get().getImageId()), <END> Guid.Empty, getStorageDomainId(action)))); return doAction(VdcActionType.MoveDisks, params, action); }</code><technical_language>disk image_id property, do need run extra query fetch</technical_language>

Target:
public Response move(Action action) { validateParameters(action, "storageDomain.id|name"); MoveDisksParameters params = new MoveDisksParameters(Collections.singletonList(new MoveDiskParameters( asGuid(getDisk().getImageId()), Guid.Empty, getStorageDomainId(action)))); return doAction(VdcActionType.MoveDisks, params, action); }
Source:
<code>public SchemaMetadata getSchemaMetadata() { ImmutableSchemaMetadata.Builder builder = ImmutableSchemaMetadata.builder(); Map<TableReference, SchemaDependentTableMetadata> tableMetadatas = <START> Stream.of(tempTableDefinitions, tableDefinitions, indexDefinitions) <END> .map(Map::keySet) .map(Set::stream) .flatMap(x -> x) .collect(Collectors.toMap( tableName -> TableReference.create(namespace, tableName), this::constructSchemaDependentTableMetadata)); builder.putAllSchemaDependentTableMetadata(tableMetadatas); return builder.build(); }</code><technical_language>remove tempTableDefinitions place is accessed is empty</technical_language>

Target:
public SchemaMetadata getSchemaMetadata() { ImmutableSchemaMetadata.Builder builder = ImmutableSchemaMetadata.builder(); Map<TableReference, SchemaDependentTableMetadata> tableMetadatas = Stream.of(tableDefinitions, indexDefinitions) .map(Map::keySet) .map(Set::stream) .flatMap(x -> x) .collect(Collectors.toMap( tableName -> TableReference.create(namespace, tableName), this::constructSchemaDependentTableMetadata)); builder.putAllSchemaDependentTableMetadata(tableMetadatas); return builder.build(); }