auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(getActivity(), R.style.Calypso_Dialog_Alert)); builder.setTitle(R.string.plugin_install_custom_domain_required_dialog_title); builder.setMessage(R.string.plugin_install_custom_domain_required_dialog_message); builder.setPositiveButton(R.string.plugin_install_custom_domain_required_dialog_register_btn, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); builder.setCancelable(true); <START> builder.create(); <END> return builder.create(); }</code><technical_language>build.create call is duplicated</technical_language>

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(getActivity(), R.style.Calypso_Dialog_Alert)); builder.setTitle(R.string.plugin_install_custom_domain_required_dialog_title); builder.setMessage(R.string.plugin_install_custom_domain_required_dialog_message); builder.setPositiveButton(R.string.plugin_install_custom_domain_required_dialog_register_btn, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); builder.setCancelable(true); return builder.create(); }
Source:
<code>private BlockingAction<Void> copyInternal(String from, String to, CopyOptions options, Handler<AsyncResult<Void>> handler) { Objects.requireNonNull(from); Objects.requireNonNull(to); Objects.requireNonNull(options); Set<CopyOption> copyOptionSet = options.toCopyOptionSet(); CopyOption[] copyOptions = copyOptionSet.toArray(new CopyOption[copyOptionSet.size()]); <START> return new BlockingAction<Void>(handler) { <END> public Void perform() { try { Path source = vertx.resolveFile(from).toPath(); Path target = vertx.resolveFile(to).toPath(); Files.copy(source, target, copyOptions); } catch (IOException e) { throw new FileSystemException(e); } return null; } }; }</code><technical_language>a lambda</technical_language>

Target:
private BlockingAction<Void> copyInternal(String from, String to, CopyOptions options, Handler<AsyncResult<Void>> handler) { Objects.requireNonNull(from); Objects.requireNonNull(to); Objects.requireNonNull(options); Set<CopyOption> copyOptionSet = toCopyOptionSet(options); CopyOption[] copyOptions = copyOptionSet.toArray(new CopyOption[copyOptionSet.size()]); return new BlockingAction<Void>(handler) { public Void perform() { try { Path source = vertx.resolveFile(from).toPath(); Path target = vertx.resolveFile(to).toPath(); Files.copy(source, target, copyOptions); } catch (IOException e) { throw new FileSystemException(e); } return null; } }; }
Source:
<code>public PathBuilder<Object> get(String property) { SimpleEntry<String, Class<?>> entry = new SimpleEntry<String, Class<?>>(property, Object.class); PathBuilder<Object> path = (PathBuilder<Object>) properties.get(entry); if (path == null) { Class<?> vtype = validate(property, Object.class); path = new PathBuilder<Object>(vtype, forProperty(property), validator); <START> properties.putIfAbsent(entry, path); <END> } return path; }</code><technical_language>![image](<LINK_0></technical_language>

Target:
public PathBuilder<Object> get(String property) { SimpleEntry<String, Class<?>> entry = new SimpleEntry<String, Class<?>>(property, Object.class); PathBuilder<Object> path = (PathBuilder<Object>) properties.get(entry); PathBuilder<?> existingPath = null; if (path == null) { Class<?> vtype = validate(property, Object.class); path = new PathBuilder<Object>(vtype, forProperty(property), validator); existingPath = properties.putIfAbsent(entry, path); } return existingPath == null ? path : (PathBuilder<Object>) existingPath; }
Source:
<code>public Long getXmxValue(String javaChildOptsStr) { if (StringUtils.isBlank(javaChildOptsStr)) { LOG.error("Null/empty input argument to get xmxValue"); throw new ProcessingException("Null/Empty input to get xmxValue"); } Long retVal = 0L; String valueStr = extractXmxValueStr(javaChildOptsStr); char lastChar = valueStr.charAt(valueStr.length() - 1); try { if (Character.isLetter(lastChar)) { String xmxValStr = valueStr.substring(0, valueStr.length() - 1); retVal = Long.parseLong(xmxValStr); switch (lastChar) { case 'M': case 'm': break; case 'K': case 'k': retVal /= 1024; break; case 'G': case 'g': retVal *= 1024; <START> break; <END> } } else { retVal = Long.parseLong(valueStr); retVal /= (1024 * 1024); } } catch (NumberFormatException nfe) { LOG.error("Unable to get the Xmx value from " + javaChildOptsStr); nfe.printStackTrace(); throw new ProcessingException("Unable to get the Xmx value from " + javaChildOptsStr, nfe); } return retVal; }</code><technical_language>a good idea "default:" throw exception here, relying 0L represent error</technical_language>

Target:
public static Long getXmxValue(String javaChildOptsStr) { Long retVal = 0L; String valueStr = extractXmxValueStr(javaChildOptsStr); char lastChar = valueStr.charAt(valueStr.length() - 1); try { if (Character.isLetter(lastChar)) { String xmxValStr = valueStr.substring(0, valueStr.length() - 1); retVal = Long.parseLong(xmxValStr); switch (lastChar) { case 'M': case 'm': break; case 'K': case 'k': retVal /= 1024; break; case 'G': case 'g': retVal *= 1024; break; default: throw new ProcessingException("Unable to get the Xmx value from " + javaChildOptsStr + " invalid value for Xmx " + xmxValStr); } } else { retVal = Long.parseLong(valueStr); retVal /= (1024 * 1024); } } catch (NumberFormatException nfe) { LOG.error("Unable to get the Xmx value from " + javaChildOptsStr); nfe.printStackTrace(); throw new ProcessingException("Unable to get the Xmx value from " + javaChildOptsStr, nfe); } return retVal; }
Source:
<code>public ListenableFuture<?> setBytes(long bytes) { <START> return null; <END> }</code><technical_language>return a completed future; note pass null objects in codebase</technical_language>

Target:
public ListenableFuture<?> setBytes(long bytes) { return Futures.immediateFuture(null); }
Source:
<code>private int getDefaultIconResource(final BoxItem boxItem) { if (boxItem instanceof BoxFolder) { BoxFolder boxFolder = (BoxFolder) boxItem; if (boxFolder.getHasCollaborations() == Boolean.TRUE) { if (boxFolder.getIsExternallyOwned() == Boolean.TRUE) { return R.drawable.ic_box_browsesdk_locked; } return R.drawable.ic_box_browsesdk_folder_shared; } <START> return R.drawable.ic_box_browsesdk_personal; <END> } else if (boxItem instanceof BoxBookmark) { return R.drawable.ic_box_browsesdk_linked; } else { String name = boxItem.getName(); if (name != null) { String ext = name.substring(name.lastIndexOf('.') + 1).toLowerCase(); Integer resId = DEFAULT_ICON_RESORCE_MAP.get(ext); if (resId != null){ return resId; } } return R.drawable.ic_box_browsesdk_other; } }</code><technical_language>more descriptive icon names? locked -> folder_external personal -> folder_personal, linked-> weblink</technical_language>

Target:
private int getDefaultIconResource(final BoxItem boxItem) { if (boxItem instanceof BoxFolder) { BoxFolder boxFolder = (BoxFolder) boxItem; if (boxFolder.getHasCollaborations() == Boolean.TRUE) { if (boxFolder.getIsExternallyOwned() == Boolean.TRUE) { return R.drawable.ic_box_browsesdk_folder_external; } return R.drawable.ic_box_browsesdk_folder_shared; } return R.drawable.ic_box_browsesdk_folder_personal; } else if (boxItem instanceof BoxBookmark) { return R.drawable.ic_box_browsesdk_web_link; } else { String name = boxItem.getName(); if (name != null) { String ext = name.substring(name.lastIndexOf('.') + 1).toLowerCase(); Integer resId = DEFAULT_ICON_RESORCE_MAP.get(ext); if (resId != null){ return resId; } } return R.drawable.ic_box_browsesdk_other; } }
Source:
<code>public void verifyCommentRowContent(String commentRowIdSuffix, <START> String commentText, String giverName) { <END> WebDriverWait wait = new WebDriverWait(browser.driver, 30); WebElement commentRow; try { commentRow = wait.until(ExpectedConditions.presenceOfElementLocated(By.id("responseCommentRow" + commentRowIdSuffix))); } catch (TimeoutException e) { return; } try { wait.until(ExpectedConditions.textToBePresentInElement(commentRow.findElement(By.id("plainCommentText" + commentRowIdSuffix)), commentText)); } catch (TimeoutException e) { fail("Not expected message"); } try { assertTrue(commentRow.findElement(By.className("text-muted")).getText().contains(giverName)); } catch (AssertionError e) { assertTrue(commentRow.findElement(By.className("text-muted")).getText().contains("you")); } }</code><technical_language>original is shorter 110 chars</technical_language>

Target:
public void verifyCommentRowContent(String commentRowIdSuffix, String commentText, String giverName) { WebDriverWait wait = new WebDriverWait(browser.driver, 30); WebElement commentRow; try { commentRow = wait.until(ExpectedConditions.presenceOfElementLocated( By.id("responseCommentRow" + commentRowIdSuffix))); } catch (TimeoutException e) { fail("Timeout!"); commentRow = null; } try { wait.until(ExpectedConditions.textToBePresentInElement(commentRow.findElement(By.id("plainCommentText" + commentRowIdSuffix)), commentText)); } catch (TimeoutException e) { fail("Not expected message"); } try { assertTrue(commentRow.findElement(By.className("text-muted")).getText().contains(giverName)); } catch (AssertionError e) { assertTrue(commentRow.findElement(By.className("text-muted")).getText().contains("you")); } }
Source:
<code>protected String getConfiguredProtocols() { <START> return "AMQP,OPENWIRE,CORE"; <END> }</code><technical_language>This wrong place for this change. If a specific test wants enable CORE override method, exists for. (Same applies for OPENWIRE there, another time..)</technical_language>

Target:
protected String getConfiguredProtocols() { return "AMQP,OPENWIRE"; }
Source:
<code>public void canDoActionFailedUpdateReadOnly() { <START> VmDevice device = createVmDevice(diskImageGuid, vmId); <END> assertEquals(true, device.getIsPlugged()); when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage()); UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setReadOnly(true); initializeCommand(parameters, Collections.singletonList(createVm(VMStatus.Up))); CanDoActionTestUtils.runAndAssertCanDoActionFailure(command, VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); }</code><technical_language>completely remove this device now? unsued</technical_language>

Target:
public void canDoActionFailedUpdateReadOnly() { when(diskDao.get(diskImageGuid)).thenReturn(createDiskImage()); UpdateVmDiskParameters parameters = createParameters(); parameters.getDiskInfo().setReadOnly(true); initializeCommand(parameters, Collections.singletonList(createVm(VMStatus.Up))); CanDoActionTestUtils.runAndAssertCanDoActionFailure(command, VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); }
Source:
<code>public ColumnCapabilities getColumnCapabilities(String column) { <START> return ColumnCapabilitiesImpl.complete(index.getCapabilities(column), false); <END> }</code><technical_language>Yes, I thinking: HMV set time, including cap-fetch selector-creation. way, StringDimensionIndexer's handling of hasMultipleValues is thread-safe (it's updated indexing thread read querying threads locking). good fix too</technical_language>

Target:
public ColumnCapabilities getColumnCapabilities(String column) { return ColumnCapabilitiesImpl.snapshot(index.getCapabilities(column), true); }
Source:
<code>private void setRepoConfig() throws IOException { Map<String,Object> repoConfig = (Map<String, Object>) soaService.requestObject("config?type=repo", Map.class); if (repoConfig.containsKey("contentRepoAddress")){ try { contentRepoAddress = new URI(repoConfig.get("contentRepoAddress").toString()); } catch (URISyntaxException e) { throw new RuntimeException("Invalid content repo URI returned from service", e); } } else { <START> throw new RuntimeException("No content repo URI returned from service"); <END> } if (repoConfig.containsKey("repoBucketName")){ repoBucketName = repoConfig.get("repoBucketName").toString(); } }</code><technical_language>this consistent "No repository bucket name returned service" check? is in getter other is here</technical_language>

Target:
private void setRepoConfig() throws IOException { Map<String,Object> repoConfig = (Map<String, Object>) soaService.requestObject("config?type=repo", Map.class); Object address = repoConfig.get("contentRepoAddress"); if (address != null){ try { contentRepoAddress = new URI(address.toString()); } catch (URISyntaxException e) { throw new RuntimeException("Invalid content repo URI returned from service", e); } } Object bucket = repoConfig.get("repoBucketName"); if (bucket != null){ repoBucketName = bucket.toString(); } }
Source:
<code>protected Episode setAdditionalEpisodeFields(Entry entry, Map<String, String> lookup, Episode episode) { episode.addAliasUrl(C4AtomApi.canonicalizeEpisodeFeedId(entry)); episode.addAliasUrl(entry.getId()); String programmeId = lookup.get(C4AtomApi.DC_PROGRAMME_ID); if (programmeId != null) { <START> episode.addAlias(new Alias("gb:channel4:prod:pmlsd:programmeId", programmeId)); <END> } return episode; }</code><technical_language>Move namespace a common place a constant</technical_language>

Target:
protected Episode setAdditionalEpisodeFields(Entry entry, Map<String, String> lookup, Episode episode) { episode.addAliasUrl(C4AtomApi.canonicalizeEpisodeFeedId(entry)); episode.addAliasUrl(entry.getId()); String programmeId = lookup.get(C4AtomApi.DC_PROGRAMME_ID); if (programmeId != null) { episode.addAlias(new Alias(C4AtomApi.ALIAS, programmeId)); } return episode; }
Source:
<code>public Response<CommentInfo> apply(RevisionResource rsrc, Input in) throws AuthException, BadRequestException, ResourceConflictException, OrmException { if (Strings.isNullOrEmpty(in.path)) { throw new BadRequestException("path must be non-empty"); } else if (in.message == null || in.message.trim().isEmpty()) { throw new BadRequestException("message must be non-empty"); } else if (in.line != null && in.line <= 0) { throw new BadRequestException("line must be > 0"); <START> } else if (in.line != null && in.range != null && in.line != in.range.getEndLine()) { <END> throw new BadRequestException("range endLine must be on the same line as the comment"); } PatchLineComment c = new PatchLineComment( new PatchLineComment.Key( new Patch.Key(rsrc.getPatchSet().getId(), in.path), ChangeUtil.messageUUID(db.get())), in.line != null ? in.line : 0, rsrc.getAccountId(), Url.decode(in.inReplyTo)); c.setSide(in.side == Side.PARENT ? (short) 0 : (short) 1); c.setMessage(in.message.trim()); c.setRange(in.range); db.get().patchComments().insert(Collections.singleton(c)); return Response.created(new CommentInfo(c, null)); }</code><technical_language>If in.line == null in.line == 0 in.range null</technical_language>

Target:
public Response<CommentInfo> apply(RevisionResource rsrc, Input in) throws AuthException, BadRequestException, ResourceConflictException, OrmException { if (Strings.isNullOrEmpty(in.path)) { throw new BadRequestException("path must be non-empty"); } else if (in.message == null || in.message.trim().isEmpty()) { throw new BadRequestException("message must be non-empty"); } else if (in.line != null && in.line <= 0) { throw new BadRequestException("line must be > 0"); } else if (in.line != null && in.range != null && in.line != in.range.getEndLine()) { throw new BadRequestException("range endLine must be on the same line as the comment"); } else if ((in.line == null || in.line == 0) && in.range != null) { throw new BadRequestException("range must be null if line is null or 0"); } int line; if (in.range != null || in.line != null) { line = in.range != null ? in.range.getEndLine() : in.line; } else { line = 0; } PatchLineComment c = new PatchLineComment( new PatchLineComment.Key( new Patch.Key(rsrc.getPatchSet().getId(), in.path), ChangeUtil.messageUUID(db.get())), line, rsrc.getAccountId(), Url.decode(in.inReplyTo)); c.setSide(in.side == Side.PARENT ? (short) 0 : (short) 1); c.setMessage(in.message.trim()); c.setRange(in.range); db.get().patchComments().insert(Collections.singleton(c)); return Response.created(new CommentInfo(c, null)); }
Source:
<code>public void deleteAllById(Iterable<? extends ID> ids) { Assert.notNull(ids, "The given Iterable of ids must not be null"); <START> ids.forEach(id -> operations.deleteById(id, entityInformation.getJavaType())); <END> }</code><technical_language>semantics findAllById( ) query mechanism avoid individual database queries for ID</technical_language>

Target:
public void deleteAllById(Iterable<? extends ID> ids) { Assert.notNull(ids, "The given Iterable of ids must not be null"); if (!ids.iterator().hasNext()) { return; } this.operations.delete(createIdsInQuery(ids), this.entityInformation.getJavaType()); }
Source:
<code>public void testGetEmptyGzipResponse() throws Exception { client = new ContentEncodingHttpClient() { @Override protected ClientConnectionManager createClientConnectionManager() { return connectionManager; } }; Message message = new Message("HTTP/1.1 200 OK"); message.headers.add("Content-Length: 0"); message.headers.add("Content-Encoding: gzip"); message.headers.add("Connection: close"); testProxy.addResponse(message); HttpRequestBase request = new HttpGet(testProxy.getUrl()); HttpUtil.configureClient(client, null); HttpResponse response = HttpUtil.execute(client, null, request, null); <START> HttpUtil.release(request, response, null); <END> assertEquals(0, connectionManager.getConnectionsInPool()); }</code><technical_language>sense assertEquals(1,connectionManager.getConnectionsInPool()) releasing connection here</technical_language>

Target:
public void testGetEmptyGzipResponse() throws Exception { client = new ContentEncodingHttpClient() { @Override protected ClientConnectionManager createClientConnectionManager() { return connectionManager; } }; Message message = new Message("HTTP/1.1 200 OK"); message.headers.add("Content-Length: 0"); message.headers.add("Content-Encoding: gzip"); message.headers.add("Connection: close"); testProxy.addResponse(message); HttpRequestBase request = new HttpGet(testProxy.getUrl()); HttpUtil.configureClient(client, null); HttpResponse response = HttpUtil.execute(client, null, request, null); assertEquals(1, connectionManager.getConnectionsInPool()); HttpUtil.release(request, response, null); assertEquals(0, connectionManager.getConnectionsInPool()); }
Source:
<code>public void shouldBeAValidXSD() throws Exception { SchemaFactory factory = SchemaFactory.newInstance("<LINK_0>"); File schemaLocation = new File("resources/cruise-config.xsd"); <START> factory.newSchema(schemaLocation); <END> }</code><technical_language>Change factory.newSchema(new StreamSource(getClass().getResourceAsStream("/cruise-config.xsd"))); please. Files in resource directory in classpath</technical_language>

Target:
public void shouldBeAValidXSD() throws Exception { SchemaFactory factory = SchemaFactory.newInstance("<LINK_0>"); factory.newSchema(new StreamSource(getClass().getResourceAsStream("/cruise-config.xsd"))); }
Source:
<code>private boolean decodeNACK(Cardio2eTransaction receivedCardio2eTransaction, List<String> digestedTransaction) { boolean decodeComplete = false; if (digestedTransaction.size() == 3) { try { receivedCardio2eTransaction.setErrorCode(Integer.parseInt(digestedTransaction.get(2))); decodeComplete = true; } catch (IllegalArgumentException e1) { <START> e1.printStackTrace(); <END> } } if (digestedTransaction.size() == 4) { try { receivedCardio2eTransaction.setObjectNumber (Short.parseShort(digestedTransaction.get(2))); receivedCardio2eTransaction.setErrorCode(Integer.parseInt(digestedTransaction.get(3))); decodeComplete = true; } catch (IllegalArgumentException e1) { e1.printStackTrace(); } } return decodeComplete; }</code><technical_language>This needs a log statement</technical_language>

Target:
private boolean decodeNACK(Cardio2eTransaction receivedCardio2eTransaction, List<String> digestedTransaction) { boolean decodeComplete = false; if (digestedTransaction.size() == 3) { try { receivedCardio2eTransaction.setErrorCode(Integer .parseInt(digestedTransaction.get(2))); decodeComplete = true; } catch (IllegalArgumentException ex) { logger.warn( "Illegal argument in decoding NACK transaction: '{}'", ex.toString()); } } if (digestedTransaction.size() == 4) { try { receivedCardio2eTransaction.setObjectNumber(Short .parseShort(digestedTransaction.get(2))); receivedCardio2eTransaction.setErrorCode(Integer .parseInt(digestedTransaction.get(3))); decodeComplete = true; } catch (IllegalArgumentException ex) { logger.warn( "Illegal argument in decoding NACK transaction: '{}'", ex.toString()); } } return decodeComplete; }
Source:
<code>public void devModeInitializerToWebpackUpIsBelowThreshold() { getDriver().get(getRootURL()); waitForDevServer(); long timeoutTime = System.currentTimeMillis() + 20000; while (System.currentTimeMillis() < timeoutTime && !isElementPresent(By.id("performance-component"))) { getDriver().navigate().refresh(); } int startupTime = measureLogEntryTimeDistance( "- Starting dev-mode updaters in", "- (Started|Reusing) webpack-dev-server", true); int npmInstallTime = measureLogEntryTimeDistance( "- Running `pnpm install`", "- Frontend dependencies resolved successfully", false); int startupTimeWithoutNpmInstallTime = startupTime - npmInstallTime; final int thresholdMs = Boolean.getBoolean( System.getProperty("vaadin.useDeprecatedV14Bootstrapping")) ? 3000 <START> : 1000; <END> Assert.assertTrue( String.format("startup time expected <= %d but was %d", thresholdMs, startupTimeWithoutNpmInstallTime), startupTimeWithoutNpmInstallTime <= thresholdMs); }</code><technical_language>5500 ms for V14 (which progress plugin), I that. reason assume faster V15 bootstrap</technical_language>

Target:
public void devModeInitializerToWebpackUpIsBelowThreshold() { getDriver().get(getRootURL()); waitForDevServer(); long timeoutTime = System.currentTimeMillis() + 20000; while (System.currentTimeMillis() < timeoutTime && !isElementPresent(By.id("performance-component"))) { getDriver().navigate().refresh(); } int startupTime = measureLogEntryTimeDistance( "- Starting dev-mode updaters in", "- (Started|Reusing) webpack-dev-server", true); int npmInstallTime = measureLogEntryTimeDistance( "- Running `pnpm install`", "- Frontend dependencies resolved successfully", false); int startupTimeWithoutNpmInstallTime = startupTime - npmInstallTime; final int thresholdMs = Boolean.getBoolean( System.getProperty("vaadin.useDeprecatedV14Bootstrapping")) ? 5500 : 10000; Assert.assertTrue( String.format("startup time expected <= %d but was %d", thresholdMs, startupTimeWithoutNpmInstallTime), startupTimeWithoutNpmInstallTime <= thresholdMs); }
Source:
<code>public static void setAuthorText(@NonNull TextView textView, @NonNull IAuthorData authorData) { final CharSequence authorText; { final Context context = textView.getContext(); List<CharSequence> joinableStrings = new ArrayList<>(); final String author = authorData.getAuthor(); if (!TextUtils.isEmpty(author)) { final SpannableString authorSpan = new SpannableString(author); authorSpan.setSpan(new ForegroundColorSpan( context.getResources().getColor(R.color.edx_brand_primary_base)), 0, authorSpan.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); authorSpan.setSpan(new StyleSpan(Typeface.BOLD), 0, authorSpan.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); joinableStrings.add(authorSpan); <START> } <END> final String authorLabel = authorData.getAuthorLabel(); if (!TextUtils.isEmpty(authorLabel)) { joinableStrings.add(ResourceUtil.getFormattedString(context.getResources(), R.string.discussion_post_author_label_attribution, "text", authorLabel)); } authorText = org.edx.mobile.util.TextUtils.join(" ", joinableStrings); } if (TextUtils.isEmpty(authorText)) { textView.setVisibility(View.GONE); } else { textView.setText(authorText); } }</code><technical_language>this section is shared this method setAuthorAttributionText() method, sense create a local private utility method do it, invoked of methods</technical_language>

Target:
public static void setAuthorText(@NonNull TextView textView, @NonNull IAuthorData authorData) { final CharSequence authorText; { final Context context = textView.getContext(); List<CharSequence> joinableStrings = new ArrayList<>(); final String author = authorData.getAuthor(); if (!TextUtils.isEmpty(author)) { final SpannableString authorSpan = new SpannableString(author); applyColorAndStyle(context, authorSpan, R.color.edx_brand_primary_base, Typeface.BOLD); joinableStrings.add(authorSpan); } final String authorLabel = authorData.getAuthorLabel(); if (!TextUtils.isEmpty(authorLabel)) { joinableStrings.add(ResourceUtil.getFormattedString(context.getResources(), R.string.discussion_post_author_label_attribution, "text", authorLabel)); } authorText = org.edx.mobile.util.TextUtils.join(" ", joinableStrings); } if (TextUtils.isEmpty(authorText)) { textView.setVisibility(View.GONE); } else { textView.setText(authorText); } }
Source:
<code>public void addCluster(String clusterName, boolean overwritePrevious, CloudConfig cloudConfig) throws HelixException { if (cloudConfig != null) { if (cloudConfig.isCloudEnabled()) { String cloudID = cloudConfig.getCloudID(); String cloudProvider = cloudConfig.getCloudProvider(); List<String> cloudInfoSources = cloudConfig.getCloudInfoSources(); String cloudProcessorName = cloudConfig.getCloudInfoProcessorName(); CloudConfig.Builder builder = new CloudConfig.Builder(clusterName, true, CloudProvider.valueOf(cloudProvider), cloudID, cloudInfoSources, cloudProcessorName); CloudConfig validatedCloudConfig = builder.build(); <START> addCluster(clusterName, overwritePrevious); <END> _admin.addCloudConfig(clusterName, validatedCloudConfig); } else { addCluster(clusterName, overwritePrevious); } } else { throw new HelixException("Cannot add the cluster, cloudConfig is null!"); } }</code><technical_language>I mentioned above, if validation method, need 2 lines of addCluster, right</technical_language>

Target:
public void addCluster(String clusterName, boolean overwritePrevious, CloudConfig cloudConfig) throws HelixException { _admin.addCluster(clusterName, overwritePrevious); for (BuiltInStateModelDefinitions def : BuiltInStateModelDefinitions.values()) { addStateModelDef(clusterName, def.getStateModelDefinition().getId(), def.getStateModelDefinition(), overwritePrevious); } if (cloudConfig != null) { _admin.addCloudConfig(clusterName, cloudConfig); } }
Source:
<code>public Response get(@PathParam("path") String path, @QueryParam("command") String commandStr) { ZooKeeperCommand cmd = getZooKeeperCommandIfPresent(commandStr); if (cmd == null) { return badRequest("Invalid ZooKeeper command: " + commandStr); } ServerContext _serverContext = (ServerContext) _application.getProperties().get(ContextPropertyKeys.SERVER_CONTEXT.name()); _zkBaseDataAccessor = _serverContext.getByteArrayZkBaseDataAccessor(); path = "/" + path; if (!ZkValidationUtil.isPathValid(path)) { String errMsg = "The given path is not a valid ZooKeeper path: " + path; LOG.info(errMsg); return badRequest(errMsg); } switch (cmd) { case exists: return exists(_zkBaseDataAccessor, path); case getBinaryData: return getBinaryData(_zkBaseDataAccessor, path); case getStringData: return getStringData(_zkBaseDataAccessor, path); case getChildren: return getChildren(_zkBaseDataAccessor, path); case getStat: return getStat(_zkBaseDataAccessor, path); <START> case delete: <END> return delete(_zkBaseDataAccessor, path); default: String errMsg = "Unsupported command: " + commandStr; LOG.error(errMsg); return badRequest(errMsg); } }</code><technical_language>this a "DELETE" HTTP verb</technical_language>

Target:
public Response get(@PathParam("path") String path, @QueryParam("command") String commandStr) { ZooKeeperCommand cmd = getZooKeeperCommandIfPresent(commandStr); if (cmd == null) { return badRequest("Invalid ZooKeeper command: " + commandStr); } ServerContext _serverContext = (ServerContext) _application.getProperties().get(ContextPropertyKeys.SERVER_CONTEXT.name()); _zkBaseDataAccessor = _serverContext.getByteArrayZkBaseDataAccessor(); if (!ZkValidationUtil.isPathValid(path)) { String errMsg = "The given path is not a valid ZooKeeper path: " + path; LOG.info(errMsg); return badRequest(errMsg); } switch (cmd) { case exists: return exists(_zkBaseDataAccessor, path); case getBinaryData: return getBinaryData(_zkBaseDataAccessor, path); case getStringData: return getStringData(_zkBaseDataAccessor, path); case getChildren: return getChildren(_zkBaseDataAccessor, path); case getStat: return getStat(_zkBaseDataAccessor, path); default: String errMsg = "Unsupported command: " + commandStr; LOG.error(errMsg); return badRequest(errMsg); } }
Source:
<code>public boolean performNextOperation(int completedChildCount) { syncChildCommandList(getParameters().getCommandStep(), getParameters().getChildCommands()); Guid currentChildId = getCurrentChildId(getParameters().getCommandStep(), getParameters().getChildCommands()); if (currentChildId != null) { getParameters().setCommandStep(getParameters().getNextCommandStep()); } log.info("Executing Cold Merge command step '{}'", getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: nextCommand = new Pair<>(VdcActionType.PrepareMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.MERGE); break; case MERGE: nextCommand = new Pair<>(VdcActionType.ColdMerge, <START> buildColdMergeParameters(getImageId(), getDestinationImageId())); <END> getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.FINALIZE_MERGE); break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; case COMPLETE: getParameters().setDestroyImageCommandComplete(true); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommand(getParameters().getParentCommand(), true); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }</code><technical_language>fit in line</technical_language>

Target:
public boolean performNextOperation(int completedChildCount) { log.info("Executing Cold Merge command step '{}'", getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: nextCommand = new Pair<>(VdcActionType.PrepareMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.MERGE); break; case MERGE: nextCommand = new Pair<>(VdcActionType.ColdMerge, buildColdMergeParameters(getImageId(), getDestinationImageId())); getParameters().setNextCommandStep(RemoveSnapshotSingleDiskStep.FINALIZE_MERGE); break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; case COMPLETE: getParameters().setDestroyImageCommandComplete(true); setCommandStatus(CommandStatus.SUCCEEDED); break; } persistCommand(getParameters().getParentCommand(), true); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }
Source:
<code>public void removeEdge(Source source, Sink sink, String streamId, Stream.Grouping grouping) { Iterator<Edge> it = dag.get(source).iterator(); <START> Edge edge = new Edge(source, sink, streamId, grouping); <END> while (it.hasNext()) { Edge e = it.next(); if (e.getSink().equals(sink)) { e.removeStreamGrouping(new StreamGrouping(source.getStream(streamId), grouping)); if(e.getStreamGroupings().isEmpty()) { it.remove(); } break; } } }</code><technical_language>unused field</technical_language>

Target:
public void removeEdge(Source source, Sink sink, String streamId, Stream.Grouping grouping) { Iterator<Edge> it = dag.get(source).iterator(); while (it.hasNext()) { Edge e = it.next(); if (e.getSink().equals(sink)) { e.removeStreamGrouping(new StreamGrouping(source.getStream(streamId), grouping)); if(e.getStreamGroupings().isEmpty()) { it.remove(); } break; } } }
Source:
<code>public void setParameters(int commandId, Object[] args) { if (commandId != COMMAND_ID) throw new IllegalStateException("Unsupported command id:" + commandId); int i = 0; globalTx = (GlobalTransaction) args[i++]; unlock = (Boolean) args[i++]; keys = (List<Object>) args[i++]; <START> flags = (EnumSet<Flag>) args[i]; <END> }</code><technical_language>This change unneeded, want change declared type of flags well? I possibly passing in wrong set impl</technical_language>

Target:
public void setParameters(int commandId, Object[] args) { if (commandId != COMMAND_ID) throw new IllegalStateException("Unsupported command id:" + commandId); int i = 0; globalTx = (GlobalTransaction) args[i++]; unlock = (Boolean) args[i++]; keys = (List<Object>) args[i++]; flags = (Set<Flag>) args[i]; }
Source:
<code>public Response installExtensionByURL( final @PathParam("url") @ApiParam(value = "extension install URL", required = true) String url) { try { URI extensionURI = new URI(url); String extensionId = getExtensionId(extensionURI); installExtension(extensionId); <START> } catch (Exception e) { <END> logger.error("Exception while parsing the extension URL '{}': {}", url, e.getMessage()); return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "The given URL is malformed or not valid."); } return Response.ok().build(); }</code><technical_language>exception thrown code? non-runtime ones</technical_language>

Target:
public Response installExtensionByURL( final @PathParam("url") @ApiParam(value = "extension install URL", required = true) String url) { try { URI extensionURI = new URI(url); String extensionId = getExtensionId(extensionURI); installExtension(extensionId); } catch (URISyntaxException | IllegalArgumentException e) { logger.error("Exception while parsing the extension URL '{}': {}", url, e.getMessage()); return JSONResponse.createErrorResponse(Status.BAD_REQUEST, "The given URL is malformed or not valid."); } return Response.ok().build(); }
Source:
<code>private ExpressionNode doReplaceLiteral(@Transient ExpressionNode node, QueryModel translatingModel, QueryModel innerModel, QueryModel validatingModel) throws SqlException { final LowerCaseCharSequenceObjHashMap<CharSequence> map = translatingModel.getColumnNameToAliasMap(); int index = map.keyIndex(node.token); if (index > -1) { final int joinCount = validatingModel.getJoinModels().size(); if (joinCount > 1) { boolean found = false; final StringSink sink = Misc.getThreadLocalBuilder(); sink.clear(); for (int i = 0; i < joinCount; i++) { final QueryModel jm = validatingModel.getJoinModels().getQuick(i); if (jm.getAliasToColumnMap().keyIndex(node.token) < 0) { if (found) { throw SqlException.ambiguousColumn(node.position); } if (jm.getAlias() != null) { sink.put(jm.getAlias().token); } else { sink.put(jm.getTableName().token); } sink.put('.'); sink.put(node.token); if ((index = map.keyIndex(sink)) < 0) { found = true; } } } if (found) { <START> return nextLiteral(map.valueAt(index), node.position); <END> } } CharSequence alias = createColumnAlias(node, translatingModel); QueryColumn column = queryColumnPool.next().of(alias, node); addColumnToTranslatingModel(column, translatingModel, validatingModel); if (innerModel != null) { innerModel.addBottomUpColumn(column); } return nextLiteral(alias, node.position); } return nextLiteral(map.valueAt(index), node.position); }</code><technical_language>quick fine</technical_language>

Target:
private ExpressionNode doReplaceLiteral(@Transient ExpressionNode node, QueryModel translatingModel, QueryModel innerModel, QueryModel validatingModel) throws SqlException { final LowerCaseCharSequenceObjHashMap<CharSequence> map = translatingModel.getColumnNameToAliasMap(); int index = map.keyIndex(node.token); if (index > -1) { final int joinCount = validatingModel.getJoinModels().size(); if (joinCount > 1) { boolean found = false; final StringSink sink = Misc.getThreadLocalBuilder(); sink.clear(); for (int i = 0; i < joinCount; i++) { final QueryModel jm = validatingModel.getJoinModels().getQuick(i); if (jm.getAliasToColumnMap().keyIndex(node.token) < 0) { if (found) { throw SqlException.ambiguousColumn(node.position); } if (jm.getAlias() != null) { sink.put(jm.getAlias().token); } else { sink.put(jm.getTableName().token); } sink.put('.'); sink.put(node.token); if ((index = map.keyIndex(sink)) < 0) { found = true; } } } if (found) { return nextLiteral(map.valueAtQuick(index), node.position); } } CharSequence alias = createColumnAlias(node, translatingModel); QueryColumn column = queryColumnPool.next().of(alias, node); addColumnToTranslatingModel(column, translatingModel, validatingModel); if (innerModel != null) { innerModel.addBottomUpColumn(column); } return nextLiteral(alias, node.position); } return nextLiteral(map.valueAtQuick(index), node.position); }
Source:
<code>protected boolean validate() { if (isImagesAlreadyOnTarget()) { ImportValidator importValidator = getImportValidator(); if (!validate(importValidator.validateUnregisteredEntity(vmFromConfiguration, ovfEntityData))) { return false; } if (!validate(importValidator.validateStorageExistForUnregisteredEntity(getImages(), getParameters().isAllowPartialImport(), imageToDestinationDomainMap, failedDisksToImportForAuditLog))) { return false; } if (!validate(importValidator.validateStorageExistsForMemoryDisks(getVm().getSnapshots(), getParameters().isAllowPartialImport(), failedDisksToImportForAuditLog))) { return false; } setImagesWithStoragePoolId(getParameters().getStoragePoolId(), getVm().getImages()); } <START> if (!validateExternalVnicProfileMapping()) { return false; } <END> return super.validate(); }</code><technical_language>this is of if (isImagesAlreadyOnTarget()) scope. is purpose</technical_language>

Target:
protected boolean validate() { if (!super.validate()) { return false; } if (isImagesAlreadyOnTarget()) { if (!validateExternalVnicProfileMapping()) { return false; } ImportValidator importValidator = getImportValidator(); if (!validate(importValidator.validateUnregisteredEntity(ovfEntityData))) { return false; } if (!validate(importValidator.validateDiskNotAlreadyExistOnDB(getImages(), getParameters().isAllowPartialImport(), imageToDestinationDomainMap, failedDisksToImportForAuditLog))) { return false; } if (!validate(importValidator.validateStorageExistForUnregisteredEntity(getImages(), getParameters().isAllowPartialImport(), imageToDestinationDomainMap, failedDisksToImportForAuditLog))) { return false; } if (!validate(importValidator.validateStorageExistsForMemoryDisks(getVm().getSnapshots(), getParameters().isAllowPartialImport(), failedDisksToImportForAuditLog))) { return false; } setImagesWithStoragePoolId(getParameters().getStoragePoolId(), getVm().getImages()); } return true; }
Source:
<code>public boolean containsRepo(String projectName) { SWTBotTable table = bot.table(0); int repoCount = configuredRepoCount(); for (int i = 0; i < repoCount; i++) { String rowName = table.getTableItem(i).getText(); <START> if (rowName.contains(projectName)) { <END> return true; } } return false; }</code><technical_language>style nit: braces single line</technical_language>

Target:
public boolean containsRepo(String projectName) { SWTBotTable table = bot.table(0); int repoCount = configuredRepoCount(); for (int i = 0; i < repoCount; i++) { String rowName = table.getTableItem(i).getText(); if (rowName.contains(projectName)) return true; } return false; }
Source:
<code>protected Object execute(Object data) { if (data == null) { throw new ExecutionPlanRuntimeException("Data can not be null."); } if (data instanceof HashMap) { <START> log.info("hashmap checked"); <END> return Boolean.TRUE; } return Boolean.FALSE; }</code><technical_language>I do need this log here. requirement do so</technical_language>

Target:
protected Boolean execute(Object data) { if (data == null) { throw new ExecutionPlanRuntimeException("Data can not be null."); } if (data instanceof HashMap) { return Boolean.TRUE; } return Boolean.FALSE; }
Source:
<code>protected void validatePresenceOfAlert() { String browser = Grid.getWebTestSession().getBrowser(); <START> logger.finest("Validating presense of alert with browser " + browser); <END> if (doesNotHandleAlerts(browser)) { logger.info(ALERTS_ARE_NOT_SUPPORTED_ERR_MSG); return; } try { Grid.driver().switchTo().alert(); String errorMsg = "Encountered an alert. Cannot wait for an element when an operation triggers an alert."; throw new InvalidElementStateException(errorMsg); } catch (NoAlertPresentException exception) { } }</code><technical_language>spelling error</technical_language>

Target:
protected void validatePresenceOfAlert() { String browser = Grid.getWebTestSession().getBrowser(); logger.finest("Validating presence of alert with browser " + browser); if (doesNotHandleAlerts(browser)) { logger.info(ALERTS_ARE_NOT_SUPPORTED_ERR_MSG); return; } try { Grid.driver().switchTo().alert(); String errorMsg = "Encountered an alert. Cannot wait for an element when an operation triggers an alert."; throw new InvalidElementStateException(errorMsg); } catch (NoAlertPresentException exception) { } }
Source:
<code>public void register() { final ItemStack waterBottle = new ItemStack(Items.potionitem, 1, 0); GameRegistry.addShapelessRecipe(GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(), Items.water_bucket, GrowthCraftBees.items.honeyJar.getItem(), Items.bucket); GameRegistry.addShapelessRecipe(GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(), waterBottle, waterBottle, waterBottle, GrowthCraftBees.items.honeyJar.getItem(), Items.bucket); if (GrowthCraftBees.fluids.honey != null) { final ItemStack honeyBottleStack = GrowthCraftBees.fluids.honey.asBottleItemStack(); final ItemStack meadBucket = GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(); GameRegistry.addShapelessRecipe(meadBucket, Items.water_bucket, honeyBottleStack, honeyBottleStack, honeyBottleStack, Items.bucket); GameRegistry.addShapelessRecipe(meadBucket, waterBottle, waterBottle, waterBottle, honeyBottleStack, honeyBottleStack, honeyBottleStack, Items.bucket); } { GrowthCraftCellar.boozeBuilderFactory.create(beeWaste.fluid.getFluid()) <START> .brewsFrom(FluidRegistry.WATER(250), new ItemStack(GrowthCraftBees.ItemHoneyCombEmpty), TickUtils.minutes(1), new Residue(GrowthCraftBees.ItemBeesWax.asStack(1), 1.0f)); <END> } registerRecipes(); }</code><technical_language>java .brewsFrom(new FluidStack(FluidRegistry.WATER, 250), GrowthCraftBees.items.honeyCombEmpty.asStack(), TickUtils.minutes(1), new Residue(GrowthCraftBees.items.beesWax.asStack(1), 1.0f));</technical_language>

Target:
public void register() { final ItemStack waterBottle = new ItemStack(Items.potionitem, 1, 0); GameRegistry.addShapelessRecipe(GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(), Items.water_bucket, GrowthCraftBees.items.honeyJar.getItem(), Items.bucket); GameRegistry.addShapelessRecipe(GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(), waterBottle, waterBottle, waterBottle, GrowthCraftBees.items.honeyJar.getItem(), Items.bucket); if (GrowthCraftBees.fluids.honey != null) { final ItemStack honeyBottleStack = GrowthCraftBees.fluids.honey.asBottleItemStack(); final ItemStack meadBucket = GrowthCraftBees.fluids.honeyMeadBuckets[0].asStack(); GameRegistry.addShapelessRecipe(meadBucket, Items.water_bucket, honeyBottleStack, honeyBottleStack, honeyBottleStack, Items.bucket); GameRegistry.addShapelessRecipe(meadBucket, waterBottle, waterBottle, waterBottle, honeyBottleStack, honeyBottleStack, honeyBottleStack, Items.bucket); } { GrowthCraftCellar.boozeBuilderFactory.create(GrowthCraftBees.fluids.beeWaste.fluid.getFluid()) .brewsFrom(new FluidStack(FluidRegistry.WATER, 250), GrowthCraftBees.items.honeyCombEmpty.asStack(), TickUtils.minutes(1), new Residue(GrowthCraftBees.items.beesWax.asStack(1), 1.0f)); } registerRecipes(); }
Source:
<code>public void onSucceeded() { <START> TransactionSupport.executeInNewTransaction(() -> { <END> syncDbRecords(true); return null; }); log.info("Successfully merged snapshot '{}' images '{}'..'{}'", getDiskImage().getImage().getSnapshotId(), getDiskImage().getImageId(), getDestinationDiskImage() != null ? getDestinationDiskImage().getImageId() : "(n/a)"); }</code><technical_language>if a transaction is started in calls syncDbRecords(), sense move transaction method (and if unneeded avoid creating transaction), callers repeat remember instead of adding call</technical_language>

Target:
onSucceeded() { syncDbRecords(true); log.info("Successfully merged snapshot '{}' images '{}'..'{}'", getDiskImage().getImage().getSnapshotId(), getDiskImage().getImageId(), getDestinationDiskImage() != null ? getDestinationDiskImage().getImageId() : "(n/a)"); }
Source:
<code>protected boolean proceedVdsStats() { boolean returnValue = true; try { runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(getVds())); if (IrsBrokerCommand.isDomainsReportedAsProblematic(getVds().getstorage_pool_id(), getVds().getDomains())) { <START> log.errorFormat("One of the domains of host {0} in pool {1} is problematic", <END> getVds().getvds_name(), getStoragePool() .getname()); returnValue = false; } } catch (VdcBLLException e) { log.errorFormat("Could not get vds stats for vds {0} because of error {1}", getVds().getvds_name(), e); returnValue = false; } return returnValue; }</code><technical_language>Storage Domains</technical_language>

Target:
protected boolean proceedVdsStats() { boolean returnValue = true; try { runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(getVds())); if (IrsBrokerCommand.isDomainsReportedAsProblematic(getVds().getstorage_pool_id(), getVds().getDomains())) { log.errorFormat("One of the Storage Domains of host {0} in pool {1} is problematic", getVds().getvds_name(), getStoragePool() .getname()); returnValue = false; } } catch (VdcBLLException e) { log.errorFormat("Could not get Host statistics for Host {0}, Error is {1}", getVds().getvds_name(), e); returnValue = false; } return returnValue; }