auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>DraftBox addReplyBox() { <START> DraftBox box = getDiffScreen().addDraftBox(getDiffScreen().createReply(comment), getSide()); <END> registerReplyBox(box); return box; }</code><technical_language>Wrap this line</technical_language>

Target:
void addReplyBox() { getCommentManager().addDraftBox( getCm().side(), CommentInfo.createReply(comment)).setEdit(true); }
Source:
<code>static Collection<TagNameDefinition> getProjectVICDefaultDefinitions() { return PROJECT_VIC_TAG_DEFINITIONS.values(); <START> } <END></code><technical_language>hand out a reference internal data structure. TagName objects immutable, collections not</technical_language>

Target:
static Collection<TagNameDefinition> getProjectVICDefaultDefinitions() { return Collections.unmodifiableCollection(PROJECT_VIC_TAG_DEFINITIONS.values()); }
Source:
<code>public InstallModel() { setUserPassword(new EntityModel()); setOVirtISO(new ListModel()); setHostVersion(new EntityModel()); setOverrideIpTables(new EntityModel()); getOverrideIpTables().setEntity(false); setUserName(new EntityModel()); <START> getUserName().setEntity("root"); END> getUserName().setIsChangable(false); setPublicKey(new EntityModel()); getPublicKey().setEntity(constants.empty()); fetchPublicKey(); setNetworkProviderModel(new HostNetworkProviderModel()); }</code><technical_language>fix formatting (some redundant spaces...)</technical_language>

Target:
public InstallModel() { setUserPassword(new EntityModel()); setOVirtISO(new ListModel()); setHostVersion(new EntityModel()); setOverrideIpTables(new EntityModel()); getOverrideIpTables().setEntity(false); setUserName(new EntityModel()); getUserName().setEntity(RootUserName); getUserName().setIsChangable(false); setPublicKey(new EntityModel()); getPublicKey().setEntity(constants.empty()); fetchPublicKey(); setNetworkProviderModel(new HostNetworkProviderModel()); }
Source:
<code>public Task update(UpdateTaskPayload updateTaskPayload) { <START> TaskUpdater taskUpdater= new TaskUpdater(taskService,taskConverter,securityManager,userGroupManager); <END> return taskUpdater.applyUpdateTaskPayload(false, updateTaskPayload); }</code><technical_language>inject TaskUpdater constructor</technical_language>

Target:
public Task update(UpdateTaskPayload updateTaskPayload) { return taskRuntimeHelper.applyUpdateTaskPayload(false, updateTaskPayload); }
Source:
<code><START> public StorageDomain <END> recoverStorageDomain(String sdUUID) { log.info("about to recover SD {}", sdUUID); StorageDomain storageDomain = new StorageDomain(); storageDomain.setId(sdUUID); updateStorageDomain(storageDomain); return storageDomain; }</code><technical_language>public? planning of this class</technical_language>

Target:
private StorageDomain recoverStorageDomain(String sdUUID) { log.info("about to recover SD {}", sdUUID); StorageDomain storageDomain = new StorageDomain(); storageDomain.setId(sdUUID); updateStorageDomain(storageDomain); return storageDomain; }
Source:
<code>public static boolean dialogCancellable(IEditCommandRequest request) { Object value = request.getParameter(RequestParameterConstants.DIALOG_CANCELLABLE); if (value instanceof Boolean) { return (Boolean) value; } else if (value instanceof String) { Boolean booleanObject = Boolean.valueOf((String) value); return booleanObject.booleanValue(); } <START> return true; END> }</code><technical_language>Default is false existing behavior for Mars dialogs</technical_language>

Target:
public static boolean dialogCancellable(IEditCommandRequest request) { Object value = request.getParameter(RequestParameterConstants.DIALOG_CANCELLABLE); if (value instanceof Boolean) { return (Boolean) value; } else if (value instanceof String) { Boolean booleanObject = Boolean.valueOf((String) value); return booleanObject.booleanValue(); } return false; }
Source:
<code>public void showFinishOperation(String url, String body, final String injectedJs) { if (webView != null) { webView.getSettings().setJavaScriptEnabled(true); webView.addJavascriptInterface(new PortletDisplayInterface(), "android"); webView.postUrl(url, body.getBytes()); webView.setWebViewClient(new WebViewClient() { boolean isLoaded = false; @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); <START> if (!isLoaded && !url.contains("/c/portal/login")) { <END> render(view, injectedJs); isLoaded = true; } } }); } }</code><technical_language>extract this a constant</technical_language>

Target:
public void showFinishOperation(String url, String body, final String injectedJs) { if (webView != null) { webView.getSettings().setJavaScriptEnabled(true); webView.addJavascriptInterface(new PortletDisplayInterface(), "android"); webView.postUrl(url, body.getBytes()); webView.setWebViewClient(new WebViewClient() { boolean isLoaded = false; @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); if (!isLoaded && !url.contains(URL_LOGIN)) { render(view, injectedJs); isLoaded = true; } } }); } }
Source:
<code>public ImageLicense processPage(int pageId, PageTitle pageTitle, JSONObject result) { try { <START> if (result.optJSONArray("imageinfo") != null) { <END> JSONObject imageInfo = (JSONObject) result.optJSONArray("imageinfo").get(0); ImageLicense license = parseImageLicenseMetadata(imageInfo.getJSONObject("extmetadata")); return license; } return null; } catch (JSONException e) { Log.d(TAG, "Caught exception: " + e.getMessage(), e); return null; } }</code><technical_language>getJSONArray() handle exception</technical_language>

Target:
public ImageLicense processPage(int pageId, PageTitle pageTitle, JSONObject result) { try { if (result.getJSONArray("imageinfo") != null) { JSONObject imageInfo = (JSONObject) result.getJSONArray("imageinfo").get(0); ImageLicense license = parseImageLicenseMetadata(imageInfo.getJSONObject("extmetadata")); return license; } return null; } catch (JSONException e) { Log.w(TAG, e); return null; } }
Source:
<code>static FEEL newInstance() { <START> return new FEELImpl(Thread.currentThread().getContextClassLoader()); <END> }</code><technical_language>here, wrap classloader creation a method</technical_language>

Target:
static FEEL newInstance() { return new FEELImpl(); }
Source:
<code>public void startWatching(Collection<File> paths) { <START> closeLock.readLock().lock(); <END> try { ensureOpen(); startWatching0(server, toAbsolutePaths(paths)); } finally { closeLock.readLock().unlock(); } }</code><technical_language>I need FileWatcher thread safe. I is perfectly fine if thread safe</technical_language>

Target:
public void startWatching(Collection<File> paths) { ensureOpen(); startWatching0(server, toAbsolutePaths(paths)); }
Source:
<code>public Status(Map<String, Object> innerMap) { code = (Integer) innerMap.get(CODE); if (innerMap.get(MESSAGE) == null) { message = ""; } else if (innerMap.get(MESSAGE) instanceof Object[]) { message = Arrays.toString((Object[]) <START> innerMap.get(MESSAGE)); <END> } else { message = innerMap.get(MESSAGE).toString(); } }</code><technical_language>if reached here, means executed 'innerMap.get(MESSAGE)' times :-) pls extract a local variable replace occurrences</technical_language>

Target:
public Status(Map<String, Object> innerMap) { code = (Integer) innerMap.get(CODE); Object obj = innerMap.get(MESSAGE); if (obj == null) { message = ""; } else if (obj instanceof Object[]) { message = Arrays.toString((Object[]) obj); } else { message = obj.toString(); } }
Source:
<code>protected void executeCommand() { if (getVmTemplate() != null) { getVmStaticDAO().incrementDbGeneration(getVmTemplate().getId()); <START> VmHandler.LockVm(getVm().getDynamicData(), getCompensationContext()); <END> freeLock(); UpdateVmTemplate(); setSucceeded(true); } }</code><technical_language>wrong lock - this is UpdateVmTemplateCommand.. LockVm is wrong call</technical_language>

Target:
protected void executeCommand() { if (getVmTemplate() != null) { getVmStaticDAO().incrementDbGeneration(getVmTemplate().getId()); UpdateVmTemplate(); setSucceeded(true); } }
Source:
<code>private boolean cloneIsInvalid(File gitBaseDir) { if (Files.isRegularFile(gitBaseDir.toPath().resolve(".git/objects/info/alternates"))) { <START> LOG.warn("This repository references another local repository which is not well supported. SCM information might be missing for some files. " <END> + "You can avoid borrow objects from another local repository by not using --reference or --shared when cloning it."); } if (Files.isRegularFile(gitBaseDir.toPath().resolve(".git/shallow"))) { LOG.warn("Shallow clone detected, no blame information will be provided. " + "You can convert to non-shallow with 'git fetch --unshallow'."); analysisWarnings.addUnique("Shallow clone detected during the analysis. " + "Some files will miss SCM information. This will affect features like auto-assignment of issues. " + "Please configure your build to disable shallow clone."); return true; } return false; }</code><technical_language>warn a bit strong? info is enough</technical_language>

Target:
private boolean cloneIsInvalid(File gitBaseDir) { if (Files.isRegularFile(gitBaseDir.toPath().resolve(".git/objects/info/alternates"))) { LOG.info("This git repository references another local repository which is not well supported. SCM information might be missing for some files. " + "You can avoid borrow objects from another local repository by not using --reference or --shared when cloning it."); } if (Files.isRegularFile(gitBaseDir.toPath().resolve(".git/shallow"))) { LOG.warn("Shallow clone detected, no blame information will be provided. " + "You can convert to non-shallow with 'git fetch --unshallow'."); analysisWarnings.addUnique("Shallow clone detected during the analysis. " + "Some files will miss SCM information. This will affect features like auto-assignment of issues. " + "Please configure your build to disable shallow clone."); return true; } return false; }
Source:
<code>public String call() throws Exception { String msg = "Found the following problems with your installation: "; if (hasOptifine) { msg += "\"Optifine is installed. This is NOT supported.\" "; } if (hasBadAE2) { msg += "\"AE2 rv1 is installed. Ender IO is no longer compatible with rv1, please update to rv2.\" "; } if (hasUnknownAE2) { msg += "\"An unknwon AE2 API is installed. Ender IO was build against API version rv2.\" "; } <START> msg += "This may have caused the error. Try reproducing the crash WITHOUT this/these mods before reportin it."; <END> return msg; }</code><technical_language>"reportin".......</technical_language>

Target:
public String call() throws Exception { String msg = "Found the following problems with your installation: "; if (hasOptifine) { msg += "\"Optifine is installed. This is NOT supported.\" "; } if (hasUnknownAE2) { msg += "\"An unknown AE2 API is installed. Ender IO was build against API version rv2.\" "; } msg += "This may have caused the error. Try reproducing the crash WITHOUT this/these mods before reporting it."; return msg; }
Source:
<code>protected ActivationKey fetchActivationKey(String keyId) { if (keyId == null || keyId.isEmpty()) { throw new BadRequestException(i18n.tr("Activation key ID is null or empty")); } ActivationKey key = this.activationKeyCurator.secureGet(keyId); if (key == null) { <START> throw new BadRequestException(i18n.tr("Activation key with id {0} could not be found.", keyId)); <END> } return key; }</code><technical_language>correct capitalization ID here, properly quote parameter: Activation key ID \"{0}\"</technical_language>

Target:
protected ActivationKey fetchActivationKey(String keyId) { if (keyId == null || keyId.isEmpty()) { throw new BadRequestException(i18n.tr("Activation key ID is null or empty")); } ActivationKey key = this.activationKeyCurator.secureGet(keyId); if (key == null) { throw new BadRequestException(i18n.tr("Activation key with ID \"{0}\" could not be found.", keyId)); } return key; }
Source:
<code>public void onDialogResult(int requestCode, int resultCode, Bundle arguments) { if (RESULT_OK != resultCode) { return; } switch (requestCode) { case COMMENT_DELETE: final GitHubComment comment = arguments.getParcelable(EXTRA_COMMENT); ServiceGenerator.createService(getActivity(), GistCommentService.class) .deleteGistComment(gistId, comment.id()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .compose(RxProgress.bindToLifecycle(getActivity(), R.string.deleting_comment)) .as(AutoDisposeUtils.bindToLifecycle(this)) .subscribe(response -> { if (comments != null) { int position = Collections.binarySearch(comments, <START> comment, (lhs, rhs) -> Integer.valueOf(lhs.id().intValue()) <END> .compareTo(rhs.id().intValue())); comments.remove(position); updateList(gist, comments); } else { refreshGist(); } }, e -> { Log.d(TAG, "Exception deleting comment on gist", e); ToastUtils.show((Activity) getContext(), e.getMessage()); }); break; } }</code><technical_language>compare Long instead</technical_language>

Target:
public void onDialogResult(int requestCode, int resultCode, Bundle arguments) { if (RESULT_OK != resultCode) { return; } switch (requestCode) { case COMMENT_DELETE: final GitHubComment comment = arguments.getParcelable(EXTRA_COMMENT); ServiceGenerator.createService(getActivity(), GistCommentService.class) .deleteGistComment(gistId, comment.id()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .compose(RxProgress.bindToLifecycle(getActivity(), R.string.deleting_comment)) .as(AutoDisposeUtils.bindToLifecycle(this)) .subscribe(response -> { if (comments != null) { int position = Collections.binarySearch(comments, comment, (lhs, rhs) -> lhs.id().compareTo(rhs.id())); comments.remove(position); updateList(gist, comments); } else { refreshGist(); } }, e -> { Log.d(TAG, "Exception deleting comment on gist", e); ToastUtils.show((Activity) getContext(), e.getMessage()); }); break; } }
Source:
<code>private MenuItem updateCloseReopenIssueMenuItem() { Optional<GuiElement> item = listView.getSelectedItem(); if (item.isPresent()) { closeReopenIssueMenuItem.setDisable(false); TurboIssue selectedIssue = item.get().getIssue(); if (selectedIssue.isOpen()) { closeReopenIssueMenuItem.setText(closeIssueMenuItemText); } else { closeReopenIssueMenuItem.setText(reopenIssueMenuItemText); } } else { <START> closeReopenIssueMenuItem.setDisable(true); <END> } return closeReopenIssueMenuItem; }</code><technical_language>This else clause first, return reduce nesting if/else</technical_language>

Target:
private MenuItem updateCloseReopenIssueMenuItem() { Optional<GuiElement> item = listView.getSelectedItem(); if (!item.isPresent()) { closeReopenIssueMenuItem.setDisable(true); return closeReopenIssueMenuItem; } closeReopenIssueMenuItem.setDisable(false); TurboIssue selectedIssue = item.get().getIssue(); if (selectedIssue.isOpen()) { closeReopenIssueMenuItem.setText(closeIssueMenuItemText); } else { closeReopenIssueMenuItem.setText(reopenIssueMenuItemText); } return closeReopenIssueMenuItem; }
Source:
<code>public PlanNode optimize(PlanNode plan, Session session, TypeProvider types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, WarningCollector warningCollector) { requireNonNull(plan, "plan is null"); requireNonNull(session, "session is null"); <START> requireNonNull(symbolAllocator, "symbolAllocator is null"); <END> requireNonNull(types, "types is null"); return SimplePlanRewriter.rewriteWith(new Rewriter(), plan); }</code><technical_language>nit: plan parameter is used. I need check plan requireNonNull</technical_language>

Target:
public PlanNode optimize(PlanNode plan, Session session, TypeProvider types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, WarningCollector warningCollector) { requireNonNull(plan, "plan is null"); return SimplePlanRewriter.rewriteWith(new Rewriter(), plan); }
Source:
<code>public WorkflowFilePersistenceBackendService(WorkflowRepresentationConverter marshaller) { <START> super(); <END> this.converter = marshaller; String persistenceFolder = System.getProperty("karaf.data") + PERSISTENCE_FOLDER; folder = new File(persistenceFolder); if (!folder.exists()) { folder.mkdirs(); } }</code><technical_language>is this required</technical_language>

Target:
public WorkflowFilePersistenceBackendService(WorkflowRepresentationConverter marshaller) { this.converter = marshaller; String persistenceFolder = System.getProperty("karaf.data") + PERSISTENCE_FOLDER; folder = new File(persistenceFolder); if (!folder.exists()) { LOGGER.info("Creating Persistence Folder"); folder.mkdirs(); } }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == IMPORT_FILE_REQUEST_CODE) { <START> maybeOpenImportFileActivity(resultCode,data,true); <END> } else if (requestCode == IMPORT_CSV_REQUEST_CODE) { maybeOpenImportFileActivity(resultCode,data,false); } }</code><technical_language>Small spacing thing. suggestion maybeOpenImportFileActivity(resultCode, data, true);</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == IMPORT_TXT_REQUEST_CODE) { maybeOpenImportFileActivity(resultCode, data, FileImportType.TEXT); } else if (requestCode == IMPORT_CSV_REQUEST_CODE) { maybeOpenImportFileActivity(resultCode, data, FileImportType.CSV); } }
Source:
<code>public void testNotSortedSerialization() throws Exception { final String[] strings = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "k", "j", "l"}; GenericIndexed<String> deserialized = serializeAndDeserialize( GenericIndexed.fromArray( strings, GenericIndexed.STRING_STRATEGY ) ); <START> checkBasicAPIs(strings, deserialized, deserialized.isAllowReverseLookup()); <END> }</code><technical_language>this checkBasicAPIs(strings, deserialized, false);</technical_language>

Target:
public void testNotSortedSerialization() throws Exception { final String[] strings = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "k", "j", "l"}; GenericIndexed<String> deserialized = serializeAndDeserialize( GenericIndexed.fromArray( strings, GenericIndexed.STRING_STRATEGY ) ); checkBasicAPIs(strings, deserialized, false); }
Source:
<code>public int compare(ItemStack o1, ItemStack o2) { List<Property<?, ?>> properties = Lists.newArrayList(o2.getApplicableProperties()); <START> for (Property<?, ?> property : o1.getApplicableProperties()) { <END> if (properties.contains(property)) { properties.remove(property); } else { return -1; } } return properties.size(); }</code><technical_language>call contains remove, change properties a Set</technical_language>

Target:
public int compare(ItemStack o1, ItemStack o2) { Set<Property<?, ?>> properties = new HashSet<>(o2.getApplicableProperties()); for (Property<?, ?> property : o1.getApplicableProperties()) { if (properties.contains(property)) { properties.remove(property); } else { return -1; } } return properties.size(); }
Source:
<code>private void startGeoTagging() { <START> File folder = getApplicationContext().getExternalFilesDir(null); <END> File tlogFile = new File(folder.getPath() + "/camera_msgs.tlog"); Timber.d("path: " + tlogFile.getPath()); geoTagImages(getApplicationContext(), tlogFile); }</code><technical_language>@chaviw able call getExternalFilesDir(null) directly</technical_language>

Target:
private void startGeoTagging() { File folder = getExternalFilesDir(null); File tlogFile = new File(folder.getPath() + "/camera_msgs.tlog"); Timber.d("path: " + tlogFile.getPath()); geoTagImages(tlogFile); }
Source:
<code>public String fetchStore(int nodeId, String storeName, String storeDir, long pushVersion, long timeoutMs) { VAdminProto.FetchStoreRequest.Builder fetchStoreRequest = VAdminProto.FetchStoreRequest.newBuilder() .setStoreName(storeName) .setStoreDir(storeDir); if(pushVersion > 0) { fetchStoreRequest.setPushVersion(pushVersion); } VAdminProto.VoldemortAdminRequest adminRequest = VAdminProto.VoldemortAdminRequest.newBuilder() .setFetchStore(fetchStoreRequest) .setType(VAdminProto.AdminRequestType.FETCH_STORE) .build(); VAdminProto.AsyncOperationStatusResponse.Builder response = rpcOps.sendAndReceive(nodeId, adminRequest, <START> VAdminProto.AsyncOperationStatusResponse.newBuilder()); <END> if(response.hasError()) { helperOps.throwException(response.getError()); } int asyncId = response.getRequestId(); try { return rpcOps.waitForCompletion(nodeId, asyncId, timeoutMs, TimeUnit.MILLISECONDS); } catch (AsyncOperationTimeoutException aote) { logger.error("Got an AsyncOperationTimeoutException for nodeId " + nodeId + ", asyncId " + asyncId + ". Will attempt to kill the job and rethrow the original exception afterwards."); try { rpcOps.stopAsyncRequest(nodeId, asyncId); logger.info("Successfully killed async job " + asyncId); } catch (Exception e) { logger.error("Failed to kill async job " + asyncId, e); } throw aote; } }</code><technical_language>I prefer this log error nodeId in logs. lack debugging information</technical_language>

Target:
public String fetchStore(int nodeId, String storeName, String storeDir, long pushVersion, long timeoutMs) { VAdminProto.FetchStoreRequest.Builder fetchStoreRequest = VAdminProto.FetchStoreRequest.newBuilder() .setStoreName(storeName) .setStoreDir(storeDir); if(pushVersion > 0) { fetchStoreRequest.setPushVersion(pushVersion); } VAdminProto.VoldemortAdminRequest adminRequest = VAdminProto.VoldemortAdminRequest.newBuilder() .setFetchStore(fetchStoreRequest) .setType(VAdminProto.AdminRequestType.FETCH_STORE) .build(); VAdminProto.AsyncOperationStatusResponse.Builder response = rpcOps.sendAndReceive(nodeId, adminRequest, VAdminProto.AsyncOperationStatusResponse.newBuilder()); if(response.hasError()) { helperOps.throwException(response.getError()); } int asyncId = response.getRequestId(); try { return rpcOps.waitForCompletion(nodeId, asyncId, timeoutMs, TimeUnit.MILLISECONDS); } catch (AsyncOperationTimeoutException aote) { logger.error("Got an AsyncOperationTimeoutException for nodeId " + nodeId + " while waiting for" + " completion of Async Operation ID " + asyncId + ". Will attempt to kill the job" + " and rethrow the original exception afterwards."); try { rpcOps.stopAsyncRequest(nodeId, asyncId); logger.info("Successfully killed Async Operation ID " + asyncId); } catch (Exception e) { logger.error("Failed to kill Async Operation ID " + asyncId, e); } throw aote; } catch (VoldemortException ve) { logger.error("Got a " + ve.getClass().getSimpleName() + " for nodeId " + nodeId + " while waiting for" + " completion of Async Operation ID " + asyncId + ". Bubbling up."); throw ve; } }
Source:
<code>public void testTimerEventListenerOccurExecution(){ CaseInstance ci = createCaseInstanceByKey("case"); assertNotNull(ci); List<JobDefinition> allJobs = managementService.createJobDefinitionQuery().list(); assertNotNull(allJobs); assertTrue(!allJobs.isEmpty()); assertTrue(allJobs.size()==1); <START> executeAvailableJobs(); <END> CaseExecution exe = processEngine.getCaseService().createCaseExecutionQuery().caseInstanceId(ci.getCaseInstanceId()).singleResult(); assertNotNull(exe); Map<String, Object> vars = processEngine.getCaseService().getVariables(exe.getId()); assertNotNull(vars); assertTrue(vars.containsKey("occur")); }</code><technical_language>do following: // Set clock fixed Date startTime = new Date(); // setting clock time '1 hour 5 seconds', timer fire ClockUtil.setCurrentTime(new Date(startTime.getTime() + ((60 * 60 * 1000) + 5000))); waitForJobExecutorToProcessAllJobs(5000L); assertEquals(0L, managementService.createJobQuery().count());</technical_language>

Target:
public void testTimerEventListenerOccurExecution(){ CaseInstance ci = createCaseInstanceByKey("case"); assertNotNull(ci); List<JobDefinition> allJobs = managementService.createJobDefinitionQuery().list(); assertNotNull(allJobs); assertTrue(!allJobs.isEmpty()); assertTrue(allJobs.size()==1); Date startTime = new Date(); ClockUtil.setCurrentTime(new Date(startTime.getTime() + ((60 * 60 * 1000) + 5000))); waitForJobExecutorToProcessAllJobs(5000L); assertEquals(0L, managementService.createJobQuery().count()); CaseExecution exe = processEngine.getCaseService().createCaseExecutionQuery().caseInstanceId(ci.getCaseInstanceId()).singleResult(); assertNotNull(exe); Map<String, Object> vars = processEngine.getCaseService().getVariables(exe.getId()); assertNotNull(vars); assertTrue(vars.containsKey("occur")); }
Source:
<code>protected TextAnnotation parseLines(ArrayList<String> lines) throws AnnotatorException { StringBuilder sb = new StringBuilder(); int numParen = 0; int currentLineId = 0; ArrayList<String[]> sentences = new ArrayList<> (); ArrayList<Tree<String>> trees = new ArrayList<> (); while (currentLineId < lines.size()) { String line = lines.get(currentLineId++); if (line.length() == 0) continue; numParen += countUnclosedParens(line); sb.append(line); if (numParen == 0) { Tree<String> tree = TreeParserFactory.getStringTreeParser().parse( sb.toString().replaceAll("\\\\/", "/")); String[] text = ParseUtils.getTerminalStringSentence(tree); if (text.length != 0) { sentences.add(text); trees.add(tree); treesProduced++; } else { System.err.println("This tree produced no sentence text:\n"+tree); System.err.println("from file:\n"+this.currentfile); System.err.flush(); return null; } sb = new StringBuilder(); } } TextAnnotation ta = BasicTextAnnotationBuilder.createTextAnnotationFromTokens( VIEW_NAME, currentfile, sentences); <START> TreeView parse = new TreeView(VIEW_NAME, "Ontonotes-5-GOLD", ta, 1.0); <END> int treecount = 0; for (Tree<String> tree : trees) { parse.setParseTree(treecount++, tree); } ta.addView(VIEW_NAME, parse); POSFromParse pos = new POSFromParse(VIEW_NAME); ta.addView(pos); return ta; }</code><technical_language>for ViewGenerator constructor arg in TreeView, please full class name generated <class>.getCanonicalName</technical_language>

Target:
protected TextAnnotation parseLines(ArrayList<String> lines) throws AnnotatorException { StringBuilder sb = new StringBuilder(); int numParen = 0; int currentLineId = 0; ArrayList<String[]> sentences = new ArrayList<> (); ArrayList<Tree<String>> trees = new ArrayList<> (); while (currentLineId < lines.size()) { String line = lines.get(currentLineId++); if (line.length() == 0) continue; numParen += countUnclosedParens(line); sb.append(line); if (numParen == 0) { Tree<String> tree = TreeParserFactory.getStringTreeParser().parse( sb.toString().replaceAll("\\\\/", "/")); String[] text = ParseUtils.getTerminalStringSentence(tree); if (text.length != 0) { sentences.add(text); trees.add(tree); treesProduced++; } else { System.err.println("This tree produced no sentence text:\n"+tree); System.err.println("from file:\n"+this.currentfile); System.err.flush(); return null; } sb = new StringBuilder(); } } TextAnnotation ta = BasicTextAnnotationBuilder.createTextAnnotationFromTokens( VIEW_NAME, currentfile, sentences); TreeView parse = new TreeView(VIEW_NAME, this.getClass().getCanonicalName(), ta, 1.0); int treecount = 0; for (Tree<String> tree : trees) { parse.setParseTree(treecount++, tree); } ta.addView(VIEW_NAME, parse); POSFromParse pos = new POSFromParse(VIEW_NAME); ta.addView(pos); return ta; }
Source:
<code>private void pullFromRemoteStream() { try { LOG.debug("Pull latest changed from remote stream"); PullCommand pullCommand = git.pull(); pullCommand.setCredentialsProvider( new UsernamePasswordCredentialsProvider( zeppelinConfiguration.getZeppelinNotebookGitUsername(), zeppelinConfiguration.getZeppelinNotebookGitAccessToken() ) ); pullCommand.call(); } catch (GitAPIException e) { LOG.error("Error when pulling latest changes from remote repository"); <START> e.printStackTrace(); <END> } }</code><technical_language>LOG.error("Error pulling latest changes remote repository", e);</technical_language>

Target:
private void pullFromRemoteStream() { try { LOG.debug("Pull latest changed from remote stream"); PullCommand pullCommand = git.pull(); pullCommand.setCredentialsProvider( new UsernamePasswordCredentialsProvider( zeppelinConfiguration.getZeppelinNotebookGitUsername(), zeppelinConfiguration.getZeppelinNotebookGitAccessToken() ) ); pullCommand.call(); } catch (GitAPIException e) { LOG.error("Error when pulling latest changes from remote repository", e); } }
Source:
<code>public void onReceive(Context context, Intent intent) { String action = intent.getAction(); WifiHelper wifiHelper = new WifiHelper(context); if (action.equals("android.net.wifi.SCAN_RESULTS")) { List<String> nearbyBSSIDs = wifiHelper.getNearbyBSSIDs(); observableHelper.notifyObservers(new WifiBSSIDChangeEvent(nearbyBSSIDs)); } else if (intent.getAction().equals("android.net.wifi.WIFI_STATE_CHANGED")) { int wifiState = intent.getIntExtra("wifi_state", -1); if (wifiState == WifiManager.WIFI_STATE_ENABLED || wifiState == WifiManager.WIFI_STATE_DISABLED) { boolean wifiEnabled = wifiHelper.isWifiEnabled(); observableHelper.notifyObservers(new WifiBSSIDChangeEvent(new ArrayList<String>())); <START> observableHelper.notifyObservers(new WifiStateChangeEvent(wifiEnabled)); <END> } } }</code><technical_language>double events? send empty list of scan results? if-statement issue results arrive, instead of sending empty list</technical_language>

Target:
public void onReceive(Context context, Intent intent) { String action = intent.getAction(); WifiHelper wifiHelper = new WifiHelper(context); if (action.equals("android.net.wifi.SCAN_RESULTS")) { List<String> nearbyBSSIDs = wifiHelper.getNearbyBSSIDs(); observableHelper.notifyObservers(new WifiBSSIDChangeEvent(nearbyBSSIDs)); } else if (intent.getAction().equals("android.net.wifi.WIFI_STATE_CHANGED")) { int wifiState = intent.getIntExtra("wifi_state", -1); if (wifiState == WifiManager.WIFI_STATE_ENABLED || wifiState == WifiManager.WIFI_STATE_DISABLED) { boolean wifiEnabled = wifiHelper.isWifiEnabled(); observableHelper.notifyObservers(new WifiStateChangeEvent(wifiEnabled)); } } }
Source:
<code>private void writeXml(BinaryContent content, HierarchicalStreamWriter writer) { try (InputStreamReader inputStreamReader = new InputStreamReader(content.getInputStream(), StandardCharsets.UTF_8)) { XmlPullParser parser = XppFactory.createDefaultParser(); <START> new HierarchicalStreamCopier().copy(new XppReader(inputStreamReader, parser), writer); <END> } catch (IOException | XmlPullParserException e) { throw new ConversionException("Unable to copy metadata to XML Output.", e); } }</code><technical_language>XppReader need closed well</technical_language>

Target:
private void writeXml(BinaryContent content, HierarchicalStreamWriter writer) { try { XmlPullParser parser = XppFactory.createDefaultParser(); InputStreamReader inputStreamReader = new InputStreamReader(content.getInputStream(), StandardCharsets.UTF_8); try { new HierarchicalStreamCopier().copy(new XppReader(inputStreamReader, parser), writer); } finally { IOUtils.closeQuietly(inputStreamReader); } } catch (XmlPullParserException e) { throw new ConversionException("Unable to copy metadata to XML Output.", e); } }
Source:
<code>protected ConfigurationBuilder getDefaultHotRodConfig() { ConfigurationBuilder config = super.getDefaultHotRodConfig(); if (transactionManagerLookup != null) { try { config.transaction().transactionManagerLookup((TransactionManagerLookup) Class.forName(transactionManagerLookup).newInstance()); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Cannot find " + transactionManagerLookup + " in the classpath", e); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Cannot initialize " + transactionManagerLookup, e); } catch (InstantiationException e) { throw new IllegalArgumentException("Cannot initialize " + transactionManagerLookup, e); } } if (transactionMode != null) { config.transaction().transactionMode(TransactionMode.valueOf(transactionMode)); } config.maxRetries(maxRetries).socketTimeout(connectionTimeout).connectionTimeout(connectionTimeout); if (propertiesPath != null) { Properties p = new Properties(); try (Reader r = new FileReader(propertiesPath)) { p.load(r); config.withProperties(p); } catch (FileNotFoundException e) { <START> e.printStackTrace(); <END> } catch (IOException e) { e.printStackTrace(); } } return config; }</code><technical_language>throw IllegalStateException</technical_language>

Target:
protected ConfigurationBuilder getDefaultHotRodConfig() { ConfigurationBuilder config = super.getDefaultHotRodConfig(); if (transactionManagerLookup != null) { try { config.transaction().transactionManagerLookup((TransactionManagerLookup) Class.forName(transactionManagerLookup).newInstance()); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Cannot find " + transactionManagerLookup + " in the classpath", e); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Cannot initialize " + transactionManagerLookup, e); } catch (InstantiationException e) { throw new IllegalArgumentException("Cannot initialize " + transactionManagerLookup, e); } } if (transactionMode != null) { config.transaction().transactionMode(TransactionMode.valueOf(transactionMode)); } config.maxRetries(maxRetries).socketTimeout(connectionTimeout).connectionTimeout(connectionTimeout); if (propertiesPath != null) { Properties p = new Properties(); try (Reader r = new FileReader(propertiesPath)) { p.load(r); config.withProperties(p); } catch (IOException e) { throw new IllegalStateException("Something went wrong with provided properties file:" + propertiesPath, e); } } return config; }
Source:
<code>public static Annotation getAnnotationPlusStrand(TranscriptModel kgl, int frame_s, String wtnt3, String ref, String var, int refvarstart, int refvarend, int exonNumber) throws AnnotationException { <START> String canno = null; END> String panno = null; int refcdsstart = kgl.getRefCDSStart(); int startPosMutationInCDS = refvarstart - refcdsstart + 1; if (frame_s == 1) { } else if (frame_s == 2) { } else { } canno = String.format("c.%d_%ddelins%s", refvarstart - refcdsstart + 1, refvarend - refcdsstart + 1, var); if ((refvarend - refvarstart + 1 - var.length()) % 3 == 0) { panno = String.format("%s:%s:exon:%d:%s", kgl.getGeneSymbol(), kgl.getName(), exonNumber, canno); Annotation ann = new Annotation(kgl, panno, VariantType.NON_FS_SUBSTITUTION, refvarstart); return ann; } else { panno = String.format("%s:exon:%d:%s", kgl.getName(), exonNumber, canno); Annotation ann = new Annotation(kgl, panno, VariantType.FS_SUBSTITUTION, startPosMutationInCDS); return ann; } }</code><technical_language>refactor complete function. if () else if () else sense</technical_language>

Target:
public static Annotation getAnnotationPlusStrand(TranscriptModel kgl, int frame_s, String wtnt3, String ref, String var, int refvarstart, int refvarend, int exonNumber) throws AnnotationException { String annotation = null; Translator translator = Translator.getTranslator(); String canno = null; String panno = null; String varnt3 = null; int refcdsstart = kgl.getRefCDSStart(); int startPosMutationInCDS = refvarstart - refcdsstart + 1; if (frame_s == 1) { varnt3 = String.format("%c%s%c", wtnt3.charAt(0), var, wtnt3.charAt(2)); } else if (frame_s == 2) { varnt3 = String.format("%c%c%s", wtnt3.charAt(0), wtnt3.charAt(1), var); } else { varnt3 = String.format("%s%c%c", var, wtnt3.charAt(1), wtnt3.charAt(2)); } canno = String.format("c.%d_%ddelins%s", refvarstart - refcdsstart + 1, refvarend - refcdsstart + 1, var); if ((refvarend - refvarstart + 1 - var.length()) % 3 == 0) { panno = String.format("%s:%s:exon:%d:%s", kgl.getGeneSymbol(), kgl.getName(), exonNumber, canno); Annotation ann = new Annotation(kgl, panno, VariantType.NON_FS_SUBSTITUTION, refvarstart); return ann; } else { panno = String.format("%s:exon:%d:%s", kgl.getName(), exonNumber, canno); Annotation ann = new Annotation(kgl, panno, VariantType.FS_SUBSTITUTION, startPosMutationInCDS); return ann; } }
Source:
<code>public void append(byte[] buffer, int length) throws IOException { if (writer == null) { writer = new FSWALWriter(bfs, new HDHTLogEntry.HDHTLogSerializer(), walKey, WAL_FILE_PREFIX + walFileId); } <START> ((FSWALWriter)writer).append(buffer, length); <END> stats.totalBytes += length; }</code><technical_language>This a preexisting issue, point of a WAL abstraction cast a specific implementation here</technical_language>

Target:
public void append(byte[] buffer, int length) throws IOException { if (writer == null) { writer = new FSWALWriter<HDHTLogEntry.HDHTWalEntry>(bfs, new HDHTLogEntry.HDHTLogSerializer(), walKey, WAL_FILE_PREFIX + walFileId); } writer.append(buffer, length); stats.totalBytes += length; }
Source:
<code>public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws IOException, InterruptedException { try { String version = module.getVersion(); String path = StorageUtil.replaceMacro(getBucketUri(), run, listener); BucketPath bucketPath = new BucketPath(path); if (bucketPath.error()) { throw new IOException("Invalid bucket path: " + getBucketUri()); } String dirName = StorageUtil .replaceMacro(getLocalDirectory(), run, listener); FilePath dirPath = workspace.child(dirName); List<StorageObjectId> objects = resolveBucketPath(bucketPath, getCredentials(), version); listener.getLogger() .println(module.prefix( Messages.Download_FoundForPattern(objects.size(), path))); DownloadSpec spec = new DownloadSpec(objects); String resolvedPrefix = StorageUtil .replaceMacro(pathPrefix, run, listener); <START> initiateDownloadsAtWorkspace(getCredentials(), run, spec, dirPath, listener, <END> version, resolvedPrefix); } catch (ExecutorException e) { throw new IOException(Messages.Download_DownloadException(), e); } }</code><technical_language>This line (plus a others in this file) generates a checkstyle error (longer 80 chars)</technical_language>

Target:
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws IOException, InterruptedException { try { String version = module.getVersion(); String path = StorageUtil.replaceMacro(getBucketUri(), run, listener); BucketPath bucketPath = new BucketPath(path); if (bucketPath.error()) { throw new IOException("Invalid bucket path: " + getBucketUri()); } String dirName = StorageUtil .replaceMacro(getLocalDirectory(), run, listener); FilePath dirPath = workspace.child(dirName); List<StorageObjectId> objects = resolveBucketPath(bucketPath, getCredentials(), version); listener.getLogger() .println(module.prefix( Messages.Download_FoundForPattern(objects.size(), path))); String resolvedPrefix = StorageUtil .replaceMacro(pathPrefix, run, listener); initiateDownloadsAtWorkspace(getCredentials(), run, objects, dirPath, listener, version, resolvedPrefix); } catch (ExecutorException e) { throw new IOException(Messages.Download_DownloadException(), e); } }
Source:
<code>protected void ProceedVGLunsInDb() { final ArrayList<LUNs> luns = (ArrayList<LUNs>) Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GetVGInfo, new GetVGInfoVDSCommandParameters(getVds().getId(), getStorageDomain().getstorage())) .getReturnValue(); storage_server_connections sdConn = getStorageDomain().getStorageStaticData().getConnection(); <START> if (sdConn != null && sdConn.getuser_name() != null && sdConn.getpassword() != null) { <END> for (LUNs lun : luns) { for (storage_server_connections lunConn : lun.getLunConnections()) { lunConn.setuser_name(sdConn.getuser_name()); lunConn.setpassword(sdConn.getpassword()); } } } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { for (LUNs lun : luns) { proceedLUNInDb(lun, getStorageDomain().getstorage_type()); } return null; } }); }</code><technical_language>chap supports shared secret (no username) be: sdConn != null && (sdConn.getuser_name() != null || sdConn.getpassword() != null) is this managed lun level though? if so, credentials for luns? multiple sets of credentials luns targets</technical_language>

Target:
protected void ProceedVGLunsInDb() { final ArrayList<LUNs> luns = (ArrayList<LUNs>) Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GetVGInfo, new GetVGInfoVDSCommandParameters(getVds().getId(), getStorageDomain().getstorage())) .getReturnValue(); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { for (LUNs lun : luns) { proceedLUNInDb(lun, getStorageDomain().getstorage_type()); } return null; } }); }
Source:
<code>public void testNowPlusOneDay() throws Exception { Collection<CompoundVariable> params = makeParams("YYYY-MM-dd", "", "1d", ""); function.setParameters(params); value = function.execute(result, null); LocalDate tomorrow = LocalDate.now().plusDays(1); <START> LocalDate tomorrowFromFunction = LocalDate.parse(value); <END> assertThat(tomorrowFromFunction, sameDay(tomorrow)); }</code><technical_language>Is this code locale-dependent? LocalDate.parse format use</technical_language>

Target:
public void testNowPlusOneDay() throws Exception { Collection<CompoundVariable> params = makeParams("YYYY-MM-dd", "", "P1d", ""); function.setParameters(params); value = function.execute(result, null); LocalDate tomorrow = LocalDate.now().plusDays(1); LocalDate tomorrowFromFunction = LocalDate.parse(value); assertThat(tomorrowFromFunction, sameDay(tomorrow)); }
Source:
<code>public Priority getPriority() { final String priorityString = this.getOptionValue(PRIORITY.getLongOpt()); try { if (priorityString == null) { return null; } else { return Priority.valueOf(priorityString.toUpperCase()); } <START> } catch (final IllegalArgumentException e) { <END> System.err.printf("Error: Unknown priority: %s", priorityString); System.exit(1); } return null; }</code><technical_language>This follow normal exception handling path caller handle printing of exception</technical_language>

Target:
public Priority getPriority() throws BadArgumentException { final String priorityString = this.getOptionValue(PRIORITY.getLongOpt()); try { if (priorityString == null) { return null; } else { return Priority.valueOf(priorityString.toUpperCase()); } } catch (final IllegalArgumentException e) { throw new BadArgumentException("Unknown priority: " + priorityString, e); } }
Source:
<code>private String getPathFromSourceText(Set<String> paths, String sourceText) { <START> if (paths != null && sourceText != null) { <END> for (String path : paths) { if (sourceText.contains(path)) { return path; } } } return null; }</code><technical_language>do if (paths != null && !StringUtils.isBlank(sourceText))</technical_language>

Target:
private String getPathFromSourceText(Set<String> paths, String sourceText) { if (paths != null && !StringUtils.isBlank(sourceText)) { for (String path : paths) { if (sourceText.contains(path)) { return path; } } } return null; }
Source:
<code>private void checkHitPolicy() { if (dtable.getHitPolicy() != GuidedDecisionTable52.HitPolicy.NONE) { <START> throw new UnsupportedOperationException("Migrating Hit Policies is supported."); <END> } }</code><technical_language>'... is supported'</technical_language>

Target:
private void checkHitPolicy() { if (dtable.getHitPolicy() != GuidedDecisionTable52.HitPolicy.NONE) { throw new UnsupportedOperationException("Migrating Hit Policies is not supported."); } }
Source:
<code>public <START> int <END> hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((lun == null) ? 0 : lun.hashCode()); return result; }</code><technical_language>hashcode equals, need regenerated new boolean</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + (usingScsiReservation ? 1231 : 1237); result = prime * result + ((lun == null) ? 0 : lun.hashCode()); return result; }
Source:
<code>public boolean isOnSameHierarchyChainInternal( MemberBase member2 ) { for ( List<Member> subList : tupleList ) { for ( Member m : subList ) { <START> if ( member2.isOnSameHierarchyChainInternal( (MemberBase) m ) ) { <END> return true; } } } return false; }</code><technical_language>original FunUtil.isOnSameHierarchyChainInternal assumed members checked hierarchy. In this new function, check members hierarchies is pretty unnecessary work. need do this isOnSameHierarchyChainInternal check members hierarchy. design, order of hierarchies in a tupleList is fixed a lot more efficient find member2's hierarchy position in tupleList's list of members. subsequent checks get hierarchy member subList. This avoid iterating list of members for tuple</technical_language>

Target:
public boolean isOnSameHierarchyChainInternal( MemberBase member2 ) { int index = -1; for ( List<mondrian.olap.Member> subList : tupleList ) { if ( index == -1 ) { for ( int i = 0; i < subList.size(); i++ ) { if ( member2.getHierarchy().equals( subList.get( i ).getHierarchy() ) ) { index = i; } break; } if ( index == -1 ) { return false; } } if ( member2.isOnSameHierarchyChainInternal( (MemberBase) subList.get( index ) ) ) { return true; } } return false; }
Source:
<code>private Scope selectExchangeScopeForPartitionedRemoteExchange(PlanNode exchangeSource, boolean nullsAndAnyReplicated) { <START> boolean streamMarkDistinct = SystemSessionProperties.isStreamMarkDistinctWithMaterializedExchangeEnabled(session); <END> if (nullsAndAnyReplicated || exchangeSource.getOutputVariables().isEmpty() || streamMarkDistinct) { return REMOTE_STREAMING; } switch (exchangeMaterializationStrategy) { case ALL: return REMOTE_MATERIALIZED; case NONE: return REMOTE_STREAMING; default: throw new IllegalStateException("Unexpected exchange materialization strategy: " + exchangeMaterializationStrategy); } }</code><technical_language>nit: useStreamExchangeForMarkDitinct variable name ? :)</technical_language>

Target:
private Scope selectExchangeScopeForPartitionedRemoteExchange(PlanNode exchangeSource, boolean nullsAndAnyReplicated) { if (nullsAndAnyReplicated || exchangeSource.getOutputVariables().isEmpty()) { return REMOTE_STREAMING; } switch (exchangeMaterializationStrategy) { case ALL: return REMOTE_MATERIALIZED; case NONE: return REMOTE_STREAMING; default: throw new IllegalStateException("Unexpected exchange materialization strategy: " + exchangeMaterializationStrategy); } }
Source:
<code>private void showInstructions(final int messageIndex){ String positiveString = messageIndex < MESSAGEIDS.length-1? "Next" : "Done"; <START> String negativeString = messageIndex > 0 ? "Back" : "Skip"; <END> new AlertDialog.Builder(activity) .setMessage(MESSAGEIDS[messageIndex]) .setPositiveButton(positiveString, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int which) { if(messageIndex < MESSAGEIDS.length-1){ showInstructions(messageIndex+1); } } }) .setNegativeButton(negativeString, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if(messageIndex > 0 ){ showInstructions(messageIndex-1); } } }).show(); }</code><technical_language>I some magic numbers (mostly - zero). do from</technical_language>

Target:
private void showInstructions(final int messageIndex){ String positiveString = messageIndex < MESSAGEIDS.length-1? "Next" : "Done"; String negativeString = messageIndex > WELCOME_INDEX ? "Back" : "Skip"; new AlertDialog.Builder(activity) .setMessage(MESSAGEIDS[messageIndex]) .setPositiveButton(positiveString, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int which) { if(messageIndex < MESSAGEIDS.length-1){ showInstructions(messageIndex+1); } } }) .setNegativeButton(negativeString, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if(messageIndex > WELCOME_INDEX ){ showInstructions(messageIndex-1); } } }).show(); }