auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean processSyncPath(AlluxioURI path) { if (path == null) { return false; } LockingScheme scheme; if (mShouldSync) { scheme = new LockingScheme(path, LockPattern.READ, true); } else { scheme = new LockingScheme(path, LockPattern.READ, mSyncOptions, mUfsSyncPathCache, mIsGetFileInfo); } if (!scheme.shouldSync() && !mShouldSync) { return false; } try (LockedInodePath inodePath = mInodeTree.tryLockInodePath(scheme)) { if (Thread.currentThread().isInterrupted()) { LOG.warn("Thread syncing was interrupted before completion", inodePath.getUri()); return false; } syncInodeMetadata(inodePath); return true; } catch (AccessControlException | BlockInfoException | FileAlreadyCompletedException | FileDoesNotExistException | InvalidFileSizeException | InvalidPathException | IOException e) { <START> LOG.warn("FAILED TO SYNC METADATA: {}", e.getMessage(), e); <END> } finally { mStatusCache.remove(path); } return false; }</code><technical_language>caps</technical_language>

Target:
private boolean processSyncPath(AlluxioURI path) { if (path == null) { return false; } LockingScheme scheme; if (mForceSync) { scheme = new LockingScheme(path, LockPattern.READ, true); } else { scheme = new LockingScheme(path, LockPattern.READ, mSyncOptions, mUfsSyncPathCache, mIsGetFileInfo); } if (!scheme.shouldSync() && !mForceSync) { return false; } try (LockedInodePath inodePath = mInodeTree.tryLockInodePath(scheme)) { if (Thread.currentThread().isInterrupted()) { LOG.warn("Thread syncing was interrupted before completion", inodePath.getUri()); return false; } syncInodeMetadata(inodePath); return true; } catch (AccessControlException | BlockInfoException | FileAlreadyCompletedException | FileDoesNotExistException | InterruptedException | InvalidFileSizeException | InvalidPathException | IOException e) { LogUtils.warnWithException(LOG, "Failed to process sync path: {}", path, e); } finally { mStatusCache.remove(path); } return false; }
Source:
<code>public void testTooManyRequests() { ActionFactory factory = new ActionFactory(); WebRequestAction action = (WebRequestAction) factory.createWebRequestAction(testSprite, new Formula(TEST_URL), userVariable); action.setWebConnectionFactory(webConnectionFactory); Mockito.when(webConnectionFactory.getWebConnection(Mockito.anyString(), Mockito.any())).thenReturn(webConnection); Mockito.when(StageActivity.webConnectionHolder.addConnectionToList(Mockito.any(WebConnection.class))) .thenReturn(false); <START> boolean isActionFinished = action.act(0f); <END> assertTrue(isActionFinished); assertEquals(ERROR_TOO_MANY_REQUESTS, userVariable.getValue()); assertThat(action.getTime(), is(lessThan(60f))); }</code><technical_language>remove this variable call inline</technical_language>

Target:
public void testTooManyRequests() { WebRequestAction action = (WebRequestAction) testSprite.getActionFactory().createWebRequestAction( testSprite, new Formula(TEST_URL), userVariable ); action.setWebConnectionFactory(webConnectionFactory); when(webConnectionFactory.createWebConnection(anyString(), any())).thenReturn(webConnection); when(StageActivity.stageListener.webConnectionHolder.addConnection(any())).thenReturn(false); assertTrue(action.act(0f)); assertEquals(ERROR_TOO_MANY_REQUESTS, userVariable.getValue()); }
Source:
<code>protected void validate(CommonHttpResponse response, int expected, IOperationMonitor monitor) throws BugzillaRestException { int statusCode = response.getStatusCode(); <START> if (statusCode != expected && statusCode != 400) { <END> if (statusCode == HttpStatus.SC_NOT_FOUND) { throw new BugzillaRestResourceNotFoundException( NLS.bind("Requested resource ''{0}'' does not exist", response.getRequestPath())); } throw new BugzillaRestException(NLS.bind("Unexpected response from Bugzilla REST server for ''{0}'': {1}", response.getRequestPath(), HttpUtil.getStatusText(statusCode))); } }</code><technical_language>this added</technical_language>

Target:
protected void validate(CommonHttpResponse response, int expected, IOperationMonitor monitor) throws BugzillaRestException { int statusCode = response.getStatusCode(); if (statusCode != expected && statusCode != HttpStatus.SC_BAD_REQUEST) { if (statusCode == HttpStatus.SC_NOT_FOUND) { throw new BugzillaRestResourceNotFoundException( NLS.bind("Requested resource ''{0}'' does not exist", response.getRequestPath())); } throw new BugzillaRestException(NLS.bind("Unexpected response from Bugzilla REST server for ''{0}'': {1}", response.getRequestPath(), HttpUtil.getStatusText(statusCode))); } }
Source:
<code>private void validateInput() { if (getShell() == null) { return; } String tagNameMessage = tagNameValidator.isValid(tagNameText.getText()); if (tagNameErrorText != null && !tagNameErrorText.isDisposed()) tagNameErrorText .setText(tagNameMessage == null ? "\n" : tagNameMessage); String tagMessageVal = tagMessageText.getText().trim(); Control button = getButton(IDialogConstants.OK_ID); if (button != null) { boolean containsTagNameAndMessage = (tagNameMessage == null || tagMessageVal <START> .isEmpty()) <END> && !tagMessageVal.isEmpty(); boolean shouldOverwriteTag = (overwriteButton.getSelection() && Repository .isValidRefName(Constants.R_TAGS + tagNameText.getText())); button.setEnabled(containsTagNameAndMessage || shouldOverwriteTag); } }</code><technical_language>isEmpty is in Java 1.5</technical_language>

Target:
private void validateInput() { if (getShell() == null) { return; } String tagNameMessage = tagNameValidator.isValid(tagNameText.getText()); if (tagNameErrorText != null && !tagNameErrorText.isDisposed()) tagNameErrorText .setText(tagNameMessage == null ? "\n" : tagNameMessage); String tagMessageVal = tagMessageText.getText().trim(); Control button = getButton(IDialogConstants.OK_ID); if (button != null) { boolean containsTagNameAndMessage = (tagNameMessage == null || tagMessageVal .length() == 0) && tagMessageVal.length() != 0; boolean shouldOverwriteTag = (overwriteButton.getSelection() && Repository .isValidRefName(Constants.R_TAGS + tagNameText.getText())); button.setEnabled(containsTagNameAndMessage || shouldOverwriteTag); } }
Source:
<code>void correctUrlIsAccessedAfterLogin(TestUtils setup, TestReference testReference) { setup.deletePage(testReference); setup.createPage(testReference, "whatever"); setup.setRights(testReference, "XWiki.XWikiAllGroup", "", "view", true); setup.forceGuestUser(); setup.gotoPage(testReference); LoginPage loginPage = new LoginPage(); <START> setup.getDriver().waitUntilPageIsReloaded(); <END> loginPage.assertOnPage(); assertFalse(loginPage.isAuthenticated()); loginPage.loginAsAdmin(); setup.assertOnPage(testReference); }</code><technical_language>(I I repeating this important), explain code does, useful. Instead explain do it. In this case some JS executed in between? If wan't write a proper explanation means understand doing! mention others knew ;) is put stuff understand explain why</technical_language>

Target:
void correctUrlIsAccessedAfterLogin(TestUtils setup, TestReference testReference) { setup.loginAsAdmin(); setup.deletePage(testReference); setup.createPage(testReference, "whatever"); setup.setRights(testReference, null, "XWiki.XWikiGuest", "view", false); setup.forceGuestUser(); setup.gotoPage(testReference); LoginPage loginPage = new LoginPage(); loginPage.assertOnPage(); assertFalse(loginPage.isAuthenticated()); loginPage.loginAsAdmin(); setup.assertOnPage(testReference); }
Source:
<code>private File createArtifact() throws MojoExecutionException { try { File payload = getPayload(); File newArtifact = new File(outputDirectory, project.getArtifactId() + "-" + project.getVersion() + ".zip"); if (newArtifact.exists()) { newArtifact.delete(); } if (payload.exists()) { DefaultFileSet fs = new DefaultFileSet(); fs.setDirectory(payload); zipArchiver.addFileSet(fs); } else { <START> zipArchiver.addFile(new File(outputDirectory, IU.P2_IU), "emptyArtifact.xml"); <END> } zipArchiver.setDestFile(newArtifact); zipArchiver.setCompress(true); zipArchiver.createArchive(); return newArtifact; } catch (IOException e) { throw new MojoExecutionException("Error assembling ZIP", e); } catch (ArchiverException e) { throw new MojoExecutionException("Error assembling ZIP", e); } }</code><technical_language>I need this bogus file here</technical_language>

Target:
private File createArtifact() throws MojoExecutionException { try { File payload = getPayloadDir(); File newArtifact = new File(outputDirectory, project.getArtifactId() + "-" + project.getVersion() + ".zip"); if (newArtifact.exists()) { newArtifact.delete(); } if (hasPayload()) { DefaultFileSet fs = new DefaultFileSet(); fs.setDirectory(payload); zipArchiver.addFileSet(fs); zipArchiver.setDestFile(newArtifact); zipArchiver.setCompress(true); zipArchiver.createArchive(); } else { newArtifact.createNewFile(); } return newArtifact; } catch (IOException e) { throw new MojoExecutionException("Error assembling ZIP", e); } catch (ArchiverException e) { throw new MojoExecutionException("Error assembling ZIP", e); } }
Source:
<code>public void run() { try { while (running.get()) { try { if (!hardDelete(true)) { isCaughtUp = true; synchronized (hardDeleteThread) { if (!running.get()) { break; } <START> isWaiting = true; <END> hardDeleteThread.wait(hardDeleterSleepTimeWhenCaughtUpMs); isWaiting = false; } } else if (isCaughtUp) { isCaughtUp = false; logger.info("Resumed hard deletes for after having caught up", dataDir); } } catch (StoreException e) { if (e.getErrorCode() != StoreErrorCodes.Store_Shutting_Down) { logger.error("Caught store exception: ", e); } else { logger.trace("Caught exception during hard deletes", e); } } catch (InterruptedException e) { logger.trace("Caught exception during hard deletes", e); } } } finally { close(); } }</code><technical_language>need isWaiting. notify called long is synchronized object</technical_language>

Target:
public void run() { try { while (running.get()) { try { if (!hardDelete(true)) { isCaughtUp = true; synchronized (hardDeleteThread) { if (!running.get()) { break; } hardDeleteThread.wait(hardDeleterSleepTimeWhenCaughtUpMs); } } else if (isCaughtUp) { isCaughtUp = false; logger.info("Resumed hard deletes for after having caught up", dataDir); } } catch (StoreException e) { if (e.getErrorCode() != StoreErrorCodes.Store_Shutting_Down) { logger.error("Caught store exception: ", e); } else { logger.trace("Caught exception during hard deletes", e); } } catch (InterruptedException e) { logger.trace("Caught exception during hard deletes", e); } } } finally { close(); } }
Source:
<code>public void reset() { <START> initSlabs(max(size / 7, initialSize)); <END> }</code><technical_language>do want this? do want start again? this means 1 large column chunk trigger more mem overhead right? if 1 out of small ones</technical_language>

Target:
public void reset() { this.initialSlabSize = max(bytesUsed / 7, initialSlabSize); if (Log.DEBUG) LOG.debug(String.format("initial slab of size %d", initialSlabSize)); this.slabs.clear(); this.bytesAllocated = 0; this.bytesUsed = 0; this.currentSlab = EMPTY_SLAB; this.currentSlabIndex = 0; }
Source:
<code>public void tearDown() { <START> dbClient.shutdown(); <END> }</code><technical_language>do need if null check</technical_language>

Target:
public void tearDown() { if(dbClient != null) { dbClient.shutdown(); } }
Source:
<code>public void onSessionReady(@NonNull Session session) { lock.writeLock().lock(); try { <START> sessionReady = true; <END> delegate.onSessionReady(session); if (replayInitEvents) { for (InitEvent event : initEvents) { event.invoke(delegate); } } } finally { lock.writeLock().unlock(); } }</code><technical_language>check sessionReady prevent multiple invocations of delegate's methods (especially double delivery of init events)? I driver do this, application code might</technical_language>

Target:
public void onSessionReady(@NonNull Session session) { lock.writeLock().lock(); try { if (!sessionReady) { sessionReady = true; delegate.onSessionReady(session); if (replayInitEvents) { for (InitEvent event : initEvents) { event.invoke(delegate); } } } } finally { lock.writeLock().unlock(); } }
Source:
<code>public static Object[][] testGetReplicasCountDataProvider() { <START> return new Object[][] {{null, true, AUTOWIRE, 0, "false"}, {null, false, STATIC, 1, "false"}, <END> {"0-all", false, BOUNDED, -1, "0-all"}, {"5", true, STATIC, 5, "false"}, {"5", false, STATIC, 5, "false"}, }; }</code><technical_language>I case is missing here, esIndexReplicas=autowire</technical_language>

Target:
public static Object[][] testGetReplicasCountDataProvider() { return new Object[][] {{null, true, AUTOWIRE, 0, "false"}, {null, false, STATIC, 1, "false"}, {"0-all", false, BOUNDED, -1, "0-all"}, {"5", true, STATIC, 5, "false"}, {"5", false, STATIC, 5, "false"}, {"autowire", true, AUTOWIRE, 0, "false"}}; }
Source:
<code>public List<ToolVersionV1> getVersionsV1() { List<ToolVersion> toolVersions = this.tool.getVersions(); <START> return toolVersions.parallelStream().map(toolVersion -> new ToolVersionV1(toolVersion)).collect(Collectors.toList()); <END> }</code><technical_language>BTW, I agree @coverbeck this, parallelStream is more complex needed here. a normal stream templating this V2 version, thanks</technical_language>

Target:
public List<ToolVersionV1> getVersionsV1() { List<ToolVersion> toolVersions = this.tool.getVersions(); return toolVersions.stream().map(toolVersion -> new ToolVersionV1(toolVersion)).collect(Collectors.toList()); }
Source:
<code><START> public static void reset() { <END> FACADE.reset(); }</code><technical_language>Maybe, a solution wrt visibility move LanguageMetricsProvider out of ApexHandler, this package. ApexMetrics change for 7.0 (apart this method), while LanguageMetricsProvider is experimental remove new API freely in 7.0</technical_language>

Target:
static void reset() { FACADE.reset(); }
Source:
<code>public void endOfAnalysis() { <START> if (!(context instanceof AnalyzerMessageReporter)) { <END> return; } AnalyzerMessageReporter reporter = (AnalyzerMessageReporter) context; messagesPerPackage.entrySet().stream() .filter(entry -> scannedPackages.stream().noneMatch(entry.getKey()::contains)) .forEach(entry -> entry.getValue().forEach(reporter::reportIssue)); }</code><technical_language>need want condition : !(context instanceof AnalyzerMessageReporter), soon introduce concept. Pretty code cover in tests. I it, a hidden feature analyzer. feel comfortable casting context AnalyzerMessageReporter. (and want explode if change behavior on)</technical_language>

Target:
public void endOfAnalysis() { DefaultJavaFileScannerContext defaultContext = (DefaultJavaFileScannerContext) context; messagesPerPackage.entrySet().stream() .filter(entry -> packagesScannedBySpring.stream().noneMatch(entry.getKey()::contains)) .forEach(entry -> entry.getValue().forEach(defaultContext::reportIssue)); }
Source:
<code>void testRepositoryAccessModelFormInvalidEmptyPrivileges() { RepositoryAccessModelForm repositoryAccessModelForm = new RepositoryAccessModelForm(); repositoryAccessModelForm.setStorageId(STORAGE_ID_VALID); repositoryAccessModelForm.setRepositoryId(REPOSITORY_ID_VALID); repositoryAccessModelForm.setPrivileges(Collections.emptyList()); Set<ConstraintViolation<RepositoryAccessModelForm>> violations = validator.validate(repositoryAccessModelForm); <START> assertThat(violations.isEmpty()).as("Violations are empty!").isFalse(); <END> assertThat(violations.size()).isEqualTo(1); assertThat(violations).extracting("message").containsAnyOf("A collection of privileges must be specified."); }</code><technical_language>isEmpty(), .size()</technical_language>

Target:
void testRepositoryAccessModelFormInvalidEmptyPrivileges() { RepositoryAccessModelForm repositoryAccessModelForm = new RepositoryAccessModelForm(); repositoryAccessModelForm.setStorageId(STORAGE_ID_VALID); repositoryAccessModelForm.setRepositoryId(REPOSITORY_ID_VALID); repositoryAccessModelForm.setPrivileges(Collections.emptyList()); Set<ConstraintViolation<RepositoryAccessModelForm>> violations = validator.validate(repositoryAccessModelForm); assertThat(violations).as("Violations are empty!").hasSize(1); assertThat(violations).extracting("message").containsAnyOf("A collection of privileges must be specified."); }
Source:
<code>public static <T> T last(Class<T>type){ <START> return findById(type, count(type)); <END> }</code><technical_language>above, item id equal total number of records record if some objects deleted database. nice capture of failing cases in tests, solve in implementations of last. If need writing test cases, throw in a commit</technical_language>

Target:
public static <T> T last(Class<T>type){ List<T> list = findWithQuery(type, "SELECT * FROM " + NamingHelper.toSQLName(type) + " ORDER BY ROWID DESC LIMIT 1"); if (list.isEmpty()) return null; return list.get(0); }
Source:
<code>public void selectionChanged(IWorkbenchPart part, ISelection sel) { List<IReview> lastServers = reviews; <START> if (part instanceof TaskEditor) { <END> TaskEditor editor = (TaskEditor) part; IFormPage page = editor.getActivePageInstance(); if (page instanceof AbstractReviewTaskEditorPage) { IReview review = ((AbstractReviewTaskEditorPage) page).getReview(); if (review != null) { reviews = Collections.singletonList(review); } else { reviews = Collections.emptyList(); } lastPartHint = part; if (!reviews.equals(lastServers)) { update(); } } } updateContentDescription(); refreshAction.setEnabled(!reviews.isEmpty()); }</code><technical_language>in a specialized derived class? relevant for R4E no</technical_language>

Target:
public void selectionChanged(IWorkbenchPart part, ISelection sel) { List<IReview> lastReviews = reviews; if (part instanceof TaskEditor) { TaskEditor editor = (TaskEditor) part; IFormPage page = editor.getActivePageInstance(); if (page instanceof AbstractReviewTaskEditorPage) { IReview review = ((AbstractReviewTaskEditorPage) page).getReview(); if (review != null) { reviews = Collections.singletonList(review); } else { reviews = Collections.emptyList(); } lastPartHint = part; if (!reviews.equals(lastReviews)) { update(); } } } updateContentDescription(); refreshAction.setEnabled(!reviews.isEmpty()); }
Source:
<code>public void init(final GatewayConfig config, final Map<String, String> options) throws ServiceLifecycleException { tokenEvictionInterval = config.getKnoxTokenEvictionInterval(); <START> if (tokenEvictionInterval > 0) { <END> evictionScheduler.scheduleAtFixedRate(() -> evictExpiredTokens(), tokenEvictionInterval, tokenEvictionInterval, TimeUnit.SECONDS); } }</code><technical_language>Yea agreed in start</technical_language>

Target:
public void init(final GatewayConfig config, final Map<String, String> options) throws ServiceLifecycleException { tokenEvictionInterval = config.getKnoxTokenEvictionInterval(); tokenEvictionGracePeriod = config.getKnoxTokenEvictionGracePeriod(); }
Source:
<code>public List<FlowLog> getFlowLogsByFlowIdsCreatedDesc(Set<String> flowIds) { LOGGER.info("Getting flow logs by these flow ids: {}", Joiner.on(",").join(flowIds)); <START> if (flowIds.size() > 0) { <END> return flowLogRepository.findAllByFlowIdsCreatedDesc(flowIds); } else { return Collections.emptyList(); } }</code><technical_language>isEmpty() please</technical_language>

Target:
public List<FlowLog> getFlowLogsByFlowIdsCreatedDesc(Set<String> flowIds) { LOGGER.info("Getting flow logs by these flow ids: {}", Joiner.on(",").join(flowIds)); if (!flowIds.isEmpty()) { return flowLogRepository.findAllByFlowIdsCreatedDesc(flowIds); } else { return Collections.emptyList(); } }
Source:
<code>public SearchResponseData saveIssueAndPreloadSearchResponseData(DbSession dbSession, DefaultIssue issue, IssueChangeContext context, @Nullable String comment, boolean refreshMeasures) { <START> Optional<RuleDefinitionDto> rule = getRuleByKey(dbSession, issue.getRuleKey()); <END> ComponentDto project = dbClient.componentDao().selectOrFailByUuid(dbSession, issue.projectUuid()); ComponentDto component = dbClient.componentDao().selectOrFailByUuid(dbSession, issue.componentUuid()); IssueDto issueDto = doSaveIssue(dbSession, issue, context, comment, rule, project, component); if (refreshMeasures) { issueChangePostProcessor.process(dbSession, singleton(component)); } SearchResponseData preloadedSearchResponseData = new SearchResponseData(issueDto); rule.ifPresent(r -> preloadedSearchResponseData.setRules(singletonList(r))); preloadedSearchResponseData.addComponents(singleton(project)); preloadedSearchResponseData.addComponents(singleton(component)); return preloadedSearchResponseData; }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Provide multiple methods instead of "refreshMeasures" determine action take. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public SearchResponseData saveIssueAndPreloadSearchResponseData(DbSession dbSession, DefaultIssue issue, IssueChangeContext context, @Nullable String comment, boolean refreshMeasures) { Optional<RuleDefinitionDto> rule = getRuleByKey(dbSession, issue.getRuleKey()); ComponentDto project = dbClient.componentDao().selectOrFailByUuid(dbSession, issue.projectUuid()); ComponentDto component = dbClient.componentDao().selectOrFailByUuid(dbSession, issue.componentUuid()); IssueDto issueDto = doSaveIssue(dbSession, issue, context, comment, rule, project, component); SearchResponseData result = new SearchResponseData(issueDto); rule.ifPresent(r -> result.setRules(singletonList(r))); result.addComponents(singleton(project)); result.addComponents(singleton(component)); if (refreshMeasures) { List<DefaultIssue> changedIssues = result.getIssues().stream().map(IssueDto::toDefaultIssue).collect(MoreCollectors.toList(result.getIssues().size())); issueChangePostProcessor.process(dbSession, changedIssues, singleton(component)); } return result; }
Source:
<code>private void setObjectManagers(Set<String> affectedNamespaces, IObjectManager manager) { for (String <START> string : <END> affectedNamespaces) { getDelta(string).setObjectManager(manager); } if (eventDelta != null) eventDelta.setObjectManager(manager); }</code><technical_language>rename namespace</technical_language>

Target:
private void setObjectManagers(Set<String> affectedNamespaces, IObjectManager manager) { for (String namespace : affectedNamespaces) { getDelta(namespace).setObjectManager(manager); } if (eventDelta != null) eventDelta.setObjectManager(manager); }
Source:
<code>protected MutableBoundedValue<Short> constructValue(Short actualValue) { return SpongeValueFactory.boundedBuilder(Keys.SPAWNER_MINIMUM_DELAY) <START> .minimum((short) 0) <END> .maximum(Short.MAX_VALUE) .defaultValue((short) 200) .actualValue(actualValue) .build(); }</code><technical_language>Data Constants</technical_language>

Target:
protected MutableBoundedValue<Short> constructValue(Short actualValue) { return SpongeValueFactory.boundedBuilder(Keys.SPAWNER_MINIMUM_DELAY) .minimum((short) 0) .maximum(Short.MAX_VALUE) .defaultValue(DataConstants.DEFAULT_SPAWNER_MINIMUM_SPAWN_DELAY) .actualValue(actualValue) .build(); }
Source:
<code>public void process() { PerformanceMonitor.startActivity("rendering/backdrop"); <START> sceneOpaque = dynamicFBM.getFBO(DefaultDynamicFBOs.ReadOnlyGBuffer.getResourceUrn()); <END> initialClearing(); sceneOpaque.bind(); setRenderBufferMask(sceneOpaque, true, true, true); playerCamera.lookThroughNormalized(); setRenderBufferMask(sceneOpaque, true, false, false); backdropRenderer.render(playerCamera); PerformanceMonitor.endActivity(); }</code><technical_language>Also, this sceneOpaque connected WriteOnlyGBuffer</technical_language>

Target:
public void process() { PerformanceMonitor.startActivity("rendering/backdrop"); initialClearing(); READ_ONLY_GBUFFER.bind(); READ_ONLY_GBUFFER.setRenderBufferMask(true, true, true); playerCamera.lookThroughNormalized(); READ_ONLY_GBUFFER.setRenderBufferMask(true, false, false); backdropRenderer.render(playerCamera); PerformanceMonitor.endActivity(); }
Source:
<code>public static void init() { <START> registerLoader(new ResourceLocation("forge:obj"), OBJLoader2.INSTANCE); <END> registerLoader(new ResourceLocation("forge:bucket"), ModelDynBucket.Loader.INSTANCE); registerLoader(new ResourceLocation("forge:composite"), CompositeModel.Loader.INSTANCE); registerLoader(new ResourceLocation("minecraft:elements"), VanillaProxy.Loader.INSTANCE); registerLoader(new ResourceLocation("forge:b3d"), new ModelLoaderAdapter(B3DLoader.INSTANCE)); registerLoader(new ResourceLocation("forge:fluid"), new ModelLoaderAdapter(ModelFluid.FluidLoader.INSTANCE)); registerLoader(new ResourceLocation("forge:multi-layer"), new ModelLoaderAdapter(MultiLayerModel.Loader.INSTANCE)); }</code><technical_language>separated constructor, hardcode colon</technical_language>

Target:
public static void init() { registerLoader(new ResourceLocation("minecraft","elements"), VanillaProxy.Loader.INSTANCE); registerLoader(new ResourceLocation("forge","obj"), OBJLoader2.INSTANCE); registerLoader(new ResourceLocation("forge","bucket"), ModelDynBucket.Loader.INSTANCE); registerLoader(new ResourceLocation("forge","composite"), CompositeModel.Loader.INSTANCE); registerLoader(new ResourceLocation("forge","b3d"), new ModelLoaderAdapter(B3DLoader.INSTANCE)); registerLoader(new ResourceLocation("forge","fluid"), new ModelLoaderAdapter(ModelFluid.FluidLoader.INSTANCE)); registerLoader(new ResourceLocation("forge","multi-layer"), new ModelLoaderAdapter(MultiLayerModel.Loader.INSTANCE)); }
Source:
<code>protected void mapFileDomain(StorageDomain model, org.ovirt.engine.core.common.businessentities.StorageDomain entity) { final Storage storage = model.getStorage(); StorageServerConnections cnx = getStorageServerConnection(entity.getStorage()); if (cnx.getconnection().contains(":")) { String[] parts = cnx.getconnection().split(":"); model.getStorage().setAddress(parts[0]); model.getStorage().setPath(parts[1]); } else { model.getStorage().setPath(cnx.getconnection()); } storage.setMountOptions(cnx.getMountOptions()); storage.setVfsType(cnx.getVfsType()); if (entity.getStorageType() == StorageType.NFS) { if (cnx.getNfsRetrans() != null) { model.getStorage().setNfsRetrans(cnx.getNfsRetrans().intValue()); } if (cnx.getNfsTimeo() != null) { model.getStorage().setNfsTimeo(cnx.getNfsTimeo().intValue()); } if (cnx.getNfsVersion() != null) { <START> model.getStorage().setNfsVersion(StorageDomainMapper.map(cnx.getNfsVersion(), null)); <END> } } }</code><technical_language>"model.getStorage()" instead of "storage"</technical_language>

Target:
protected void mapFileDomain(StorageDomain model, org.ovirt.engine.core.common.businessentities.StorageDomain entity) { final Storage storage = model.getStorage(); StorageServerConnections cnx = getStorageServerConnection(entity.getStorage()); if (cnx.getconnection().contains(":")) { String[] parts = cnx.getconnection().split(":"); storage.setAddress(parts[0]); storage.setPath(parts[1]); } else { storage.setPath(cnx.getconnection()); } storage.setMountOptions(cnx.getMountOptions()); storage.setVfsType(cnx.getVfsType()); if (entity.getStorageType() == StorageType.NFS) { if (cnx.getNfsRetrans() != null) { storage.setNfsRetrans(cnx.getNfsRetrans().intValue()); } if (cnx.getNfsTimeo() != null) { storage.setNfsTimeo(cnx.getNfsTimeo().intValue()); } if (cnx.getNfsVersion() != null) { storage.setNfsVersion(StorageDomainMapper.map(cnx.getNfsVersion(), null)); } } }
Source:
<code>public void shouldNotUpdateTimelineEntriesAndEntriesForRollbackUponFailureDuringRetrieval() throws Exception { Object[] pipelineRow1 = {"p1", new BigInteger("1"), new BigInteger("1"), new Date(), "fingerprint", 1.0, "r1", null, new BigInteger("1"), new BigInteger("1")}; <START> Object[] pipelineRow2 = {"p1", "2abcd", new BigInteger("2"), new Date(), "fingerprint", 2.0, "r2", null, new BigInteger("1"), new BigInteger("1")}; <END> stubPipelineInstancesInDb(pipelineRow1, pipelineRow2); ArrayList<PipelineTimelineEntry> tempEntries = new ArrayList<>(); PipelineTimeline pipelineTimeline = new PipelineTimeline(pipelineRepository, transactionTemplate, transactionSynchronizationManager); try { pipelineRepository.updatePipelineTimeline(pipelineTimeline, tempEntries); fail("Should fail to retrieve pipeline."); } catch (ClassCastException e) { assertThat(tempEntries.size(), is(0)); assertThat(pipelineTimeline.instanceCount(new CaseInsensitiveString("p1")), is(0)); } }</code><technical_language>change "2abcd" describes happening? "CAUSE-A-FAILURE-DURING-RETRIEVAL"</technical_language>

Target:
public void shouldNotUpdateTimelineEntriesAndEntriesForRollbackUponFailureDuringRetrieval() throws Exception { Object[] pipelineRow1 = {"p1", new BigInteger("1"), new BigInteger("1"), new Date(), "fingerprint", 1.0, "r1", null, new BigInteger("1"), new BigInteger("1")}; Object[] pipelineRow2 = {"p1", "cause-failure-during-retrieval", new BigInteger("2"), new Date(), "fingerprint", 2.0, "r2", null, new BigInteger("1"), new BigInteger("1")}; stubPipelineInstancesInDb(pipelineRow1, pipelineRow2); ArrayList<PipelineTimelineEntry> tempEntries = new ArrayList<>(); PipelineTimeline pipelineTimeline = new PipelineTimeline(pipelineRepository, transactionTemplate, transactionSynchronizationManager); try { pipelineRepository.updatePipelineTimeline(pipelineTimeline, tempEntries); fail("Should fail to retrieve pipeline."); } catch (ClassCastException e) { assertThat(tempEntries.size(), is(0)); assertThat(pipelineTimeline.instanceCount(new CaseInsensitiveString("p1")), is(0)); } }
Source:
<code>public boolean callAllPartitionProcedure(AllPartitionProcedureCallback callback, String procedureName, Object... params) throws IOException, NoConnectionsException, ProcCallException { Object[] args = new Object[params.length + 1]; System.arraycopy(params, 0, args, 1, params.length); setPartitions(); int partitionCount = m_partitionKeys.size(); PartitionClientResponse[] responses = new PartitionClientResponse[partitionCount]; CountDownLatch responseWaiter = new CountDownLatch(partitionCount); for (int key : m_partitionKeys) { args[0] = key; partitionCount--; PartitionProcedureCallback cb = new PartitionProcedureCallback(responseWaiter, key, partitionCount, responses); if(!callProcedure(cb, procedureName, args)){ return false; } } try { responseWaiter.await(); <START> callback.clientCallback(responses); <END> } catch (Exception e) { throw new IOException (e); } return true; }</code><technical_language>This asynchronous. blocking here. want a specialized callback for call aggregates responses, calls users callback if one</technical_language>

Target:
public boolean callAllPartitionProcedure(AllPartitionProcedureCallback callback, String procedureName, Object... params) throws IOException, NoConnectionsException, ProcCallException { if (callback == null) { throw new IOException("AllPartitionProcedureCallback can not be null"); } Object[] args = new Object[params.length + 1]; System.arraycopy(params, 0, args, 1, params.length); int partitionCount = getPartitionIntegerKeys().size(); assert(partitionCount > 0); ClientResponseWithPartitionKey[] responses = new ClientResponseWithPartitionKey[partitionCount]; AtomicInteger counter = new AtomicInteger(partitionCount); for (Integer key : getPartitionIntegerKeys()) { args[0] = key; partitionCount--; OnePartitionProcedureCallback cb = new OnePartitionProcedureCallback(counter, key, partitionCount, responses, callback); try { if (callback instanceof SyncAllPartitionProcedureCallback) { ClientResponse response = callProcedure(procedureName, args); cb.clientCallback(response); } else { if (!callProcedure(cb, procedureName, args)) { cb.clientCallback(null); } } } catch(Exception ex){ try { cb.exceptionCallback(ex); } catch (Exception e) { throw new IOException(e); } } } return true; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_style_line); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { GeoJsonSource linesSource = new GeoJsonSource("lines", loadGeoJsonFromAsset("golden_gate_lines.geojson")); <START> mapboxMap.getStyle().addSource(linesSource); <END> LineLayer linesLayer = new LineLayer("finalLines", "lines").withProperties( PropertyFactory.lineColor( match(get("color"), rgb(0, 0, 0), stop("red", rgb(247, 69, 93)), stop("blue", rgb(51, 201, 235)))), PropertyFactory.visibility(Property.VISIBLE), PropertyFactory.lineWidth(3f) ); mapboxMap.getStyle().addLayer(linesLayer); } }); } }); }</code><technical_language>callback style instead</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_style_line); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { style.addSource(new GeoJsonSource("lines", loadGeoJsonFromAsset("golden_gate_lines.geojson"))); style.addLayer(new LineLayer("finalLines", "lines").withProperties( PropertyFactory.lineColor( match(get("color"), rgb(0, 0, 0), stop("red", rgb(247, 69, 93)), stop("blue", rgb(51, 201, 235)))), PropertyFactory.visibility(Property.VISIBLE), PropertyFactory.lineWidth(3f) )); } }); } }); }
Source:
<code>private UploadItem getUploadItem(UploadableFile uploadableFile, Place place, String source, SimilarImageInterface similarImageInterface) { fileProcessor.initFileDetails(Objects.requireNonNull(uploadableFile.getFilePath()), context.getContentResolver()); UploadableFile.DateTimeWithSource dateTimeWithSource = uploadableFile .getFileCreatedDate(context); long fileCreatedDate = -1; String createdTimestampSource = ""; if (dateTimeWithSource != null) { fileCreatedDate = dateTimeWithSource.getEpochDate(); createdTimestampSource = dateTimeWithSource.getSource(); } Timber.d("File created date is %d", fileCreatedDate); GPSExtractor gpsExtractor = fileProcessor .processFileCoordinates(similarImageInterface, context); UploadItem uploadItem = new UploadItem(uploadableFile.getContentUri(), Uri.parse(uploadableFile.getFilePath()), uploadableFile.getMimeType(context), source, gpsExtractor, place, fileCreatedDate, createdTimestampSource); if (place != null) { uploadItem.title.setTitleText(place.name); <START> if(uploadItem.descriptions.isEmpty()) { <END> uploadItem.descriptions.add(new Description()); } uploadItem.descriptions.get(0).setDescriptionText(place.getLongDescription()); uploadItem.descriptions.get(0).setLanguageCode("en"); } if (!items.contains(uploadItem)) { items.add(uploadItem); } return uploadItem; }</code><technical_language>update descriptions if empty, instead of creating a new object</technical_language>

Target:
private UploadItem getUploadItem(UploadableFile uploadableFile, Place place, String source, SimilarImageInterface similarImageInterface) { fileProcessor.initFileDetails(Objects.requireNonNull(uploadableFile.getFilePath()), context.getContentResolver()); UploadableFile.DateTimeWithSource dateTimeWithSource = uploadableFile .getFileCreatedDate(context); long fileCreatedDate = -1; String createdTimestampSource = ""; if (dateTimeWithSource != null) { fileCreatedDate = dateTimeWithSource.getEpochDate(); createdTimestampSource = dateTimeWithSource.getSource(); } Timber.d("File created date is %d", fileCreatedDate); GPSExtractor gpsExtractor = fileProcessor .processFileCoordinates(similarImageInterface, context); UploadItem uploadItem = new UploadItem(uploadableFile.getContentUri(), Uri.parse(uploadableFile.getFilePath()), uploadableFile.getMimeType(context), source, gpsExtractor, place, fileCreatedDate, createdTimestampSource); if (place != null) { uploadItem.title.setTitleText(place.name); uploadItem.descriptions.get(0).setDescriptionText(place.getLongDescription()); uploadItem.descriptions.get(0).setLanguageCode("en"); } if (!items.contains(uploadItem)) { items.add(uploadItem); } return uploadItem; }
Source:
<code>public void privateConstructorTest() { try { <START> WeldContainer container = new Weld().initialize(); <END> } catch (DeploymentException e) { Assert.assertTrue(e.getMessage().contains("Bean class which has decorators should declare at least one non private constructor")); } }</code><technical_language>I add Assert.fail()</technical_language>

Target:
public void privateConstructorTest() { WeldContainer container = new Weld() .property("org.jboss.weld.construction.relaxed", true) .initialize(); Assert.fail(); }
Source:
<code>private Boolean hasActiveContainerPlacementAction(String processorId) { Optional<ContainerPlacementMetadata> metadata = getPlacementActionMetadata(processorId); if (metadata.isPresent()) { <START> ContainerPlacementMessage.StatusCode actionStatus = metadata.get().getActionStatus(); return (actionStatus == ContainerPlacementMessage.StatusCode.CREATED) || (actionStatus == ContainerPlacementMessage.StatusCode.ACCEPTED) || (actionStatus == ContainerPlacementMessage.StatusCode.IN_PROGRESS); <END> } return false; }</code><technical_language>switch()</technical_language>

Target:
private boolean hasActiveContainerPlacementAction(String processorId) { Optional<ContainerPlacementMetadata> metadata = getPlacementActionMetadata(processorId); if (metadata.isPresent()) { switch (metadata.get().getActionStatus()) { case ACCEPTED: case CREATED: case IN_PROGRESS: return true; default: return false; } } return false; }
Source:
<code>private <T extends Rule> Set<UniqueSetting> register(RuleRegistry<T> registry, Class<T> ruleType, EObject domainObject, final EObject viewModel) { final Set<UniqueSetting> result = new HashSet<UniqueSetting>(); if (hasRule(ruleType, viewModel)) { final VElement renderable = (VElement) viewModel; <START> @SuppressWarnings("unchecked") <END> final Collection<T> rules = (Collection<T>) getRules(renderable); for (final T rule : rules) { result.addAll(registry.register(renderable, rule, rule.getCondition(), domainObject)); } } return result; }</code><technical_language>please remove warning suppress unnecessary casting</technical_language>

Target:
private <T extends Rule> Set<UniqueSetting> register(RuleRegistry<T> registry, Class<T> ruleType, EObject domainObject, final EObject viewModel) { final Set<UniqueSetting> result = new HashSet<UniqueSetting>(); if (viewModel instanceof VElement) { final VElement renderable = (VElement) viewModel; final T rule = getRule(ruleType, renderable); if (rule != null) { result.addAll(registry.register(renderable, rule, rule.getCondition(), domainObject)); } } return result; }
Source:
<code><START> public String getMessageLevel() { <END> return message.getMessageLevel(); }</code><technical_language>MessageLevel type</technical_language>

Target:
public Message.MessageLevel getMessageLevel() { return message.getMessageLevel(); }
Source:
<code>protected RemoteOperationResult run(WebdavClient client) { RemoteOperationResult result = null; int status = -1; <START> GetMethod get = new GetMethod(mUrl + TAG_OCS_ROUTE); <END> Log.d(TAG, "URL ------> " + mUrl + TAG_OCS_ROUTE); get.addRequestHeader(TAG_HEADER_CONTENT, TAG_HEADER_CONTENT_VALUE); get.addRequestHeader(TAG_HEADER_OCS_API, TAG_HEADER_OCS_API_VALUE); get.setRequestHeader(TAG_HEADER_COOKIE, mSessionCookie); try { status = client.executeMethod(get); if(isSuccess(status)) { Log.d(TAG, "Obtain RESPONSE"); String response = get.getResponseBodyAsString(); Log.d(TAG, "GET RESPONSE.................... " + response); JSONObject respJSON = new JSONObject(response); JSONObject respOCS = respJSON.getJSONObject(TAG_OCS); JSONObject respData = respOCS.getJSONObject(TAG_DATA); String id = respData.getString(TAG_ID); String displayName = respData.getString(TAG_DISPLAY_NAME); String email = respData.getString(TAG_EMAIL); result = new RemoteOperationResult(isSuccess(status), status, (get != null ? get.getResponseHeaders() : null)); result.setUserName(displayName); Log.d(TAG, "Response: " + id + " - " + displayName + " - " + email); } } catch (HttpException e) { result = new RemoteOperationResult(e); e.printStackTrace(); } catch (IOException e) { result = new RemoteOperationResult(e); e.printStackTrace(); } catch (JSONException e) { result = new RemoteOperationResult(e); e.printStackTrace(); } finally { get.releaseConnection(); } return result; }</code><technical_language>consistency operations, beginning of URL client.getBaseUrl() , a saved member. responsability for server-wide data is in WebdavClient object, in individual operations</technical_language>

Target:
protected RemoteOperationResult run(WebdavClient client) { RemoteOperationResult result = null; int status = -1; GetMethod get = new GetMethod(client.getBaseUri() + OCS_ROUTE); Log.d(TAG, "URL ------> " + client.getBaseUri() + OCS_ROUTE); get.addRequestHeader(HEADER_OCS_API, HEADER_OCS_API_VALUE); try { status = client.executeMethod(get); if(isSuccess(status)) { Log.d(TAG, "Obtain RESPONSE"); String response = get.getResponseBodyAsString(); Log.d(TAG, "GET RESPONSE.................... " + response); JSONObject respJSON = new JSONObject(response); JSONObject respOCS = respJSON.getJSONObject(NODE_OCS); JSONObject respData = respOCS.getJSONObject(NODE_DATA); String id = respData.getString(NODE_ID); String displayName = respData.getString(NODE_DISPLAY_NAME); String email = respData.getString(NODE_EMAIL); result = new RemoteOperationResult(isSuccess(status), status, (get != null ? get.getResponseHeaders() : null)); mUserName = displayName; Log.d(TAG, "Response: " + id + " - " + displayName + " - " + email); } } catch (HttpException e) { result = new RemoteOperationResult(e); e.printStackTrace(); } catch (IOException e) { result = new RemoteOperationResult(e); e.printStackTrace(); } catch (JSONException e) { result = new RemoteOperationResult(e); e.printStackTrace(); } finally { get.releaseConnection(); } return result; }
Source:
<code>private boolean extractChatStateMUC(Conversation conversation, final MessagePacket packet) { ChatState state = ChatState.parse(packet); Jid FROM=packet.getFrom(); if (state != null && conversation != null) { final Account account = conversation.getAccount(); Jid from = packet.getFrom(); if (from.toBareJid().equals(account.getJid().toBareJid())) { conversation.setOutgoingChatState(state); if (state == ChatState.ACTIVE || state == ChatState.COMPOSING) { mXmppConnectionService.markRead(conversation); activateGracePeriod(account); } return false; } else { if(conversation.getMucOptions().findUserByFullJid(FROM)!=null) conversation.getMucOptions().findUserByFullJid(FROM).setChatState(state); <START> return conversation.setIncomingChatState(state); <END> } } return false; }</code><technical_language>set chatsate for entire conversations. set chatstate for user</technical_language>

Target:
private boolean extractChatStateMUC(Conversation conversation, final MessagePacket packet) { ChatState state = ChatState.parse(packet); Jid FROM=packet.getFrom(); if (state != null && conversation != null) { MucOptions.User user = conversation.getMucOptions().findUserByFullJid(FROM); if(user!=null) { return user.setChatState(state); } } return false; }
Source:
<code>private DiskImage getDiskForVolumeInfo(DiskImage disk) { if (getParameters().getCopyCollapse()) { <START> DiskImage ancestor = DbFacade.getInstance().getDiskImageDao().getAncestor(disk.getImageId()); <END> if (ancestor == null) { log.warnFormat("Can't find ancestor of Disk with ID {0}, using original disk for volume info.", disk.getImageId()); ancestor = disk; } return ancestor; } else { return disk; } }</code><technical_language>Sharad, I changed code a bit getDiskImageDao - care refactor replace DbFacade.getInstance().getDiskImageDao() a "getDiskImageDao()" call</technical_language>

Target:
private DiskImage getDiskForVolumeInfo(DiskImage disk) { if (getParameters().getCopyCollapse()) { DiskImage ancestor = getDiskImageDao().getAncestor(disk.getImageId()); if (ancestor == null) { log.warnFormat("Can't find ancestor of Disk with ID {0}, using original disk for volume info.", disk.getImageId()); ancestor = disk; } return ancestor; } else { return disk; } }
Source:
<code>public void testDynamicItem_AddOne() { contextRule.createAndRunWorkbench(window); ToolBarManager tbm = getManager(toolBar); <START> assertTrue(tbm.getSize() == 0); <END> MToolItem toolItem1 = ems.createModelElement(MDirectToolItem.class); toolBar.getChildren().add(toolItem1); assertTrue(tbm.getSize() == 1); }</code><technical_language>sense assertEquals below, actual in failing case</technical_language>

Target:
public void testDynamicItem_AddOne() { contextRule.createAndRunWorkbench(window); ToolBarManager tbm = getManager(toolBar); assertEquals(tbm.getSize(), 0); MToolItem toolItem1 = ems.createModelElement(MDirectToolItem.class); toolBar.getChildren().add(toolItem1); assertEquals(tbm.getSize(), 1); }
Source:
<code>private String removeVisualEditorProgressTag(String originalText) { if (originalText != null && originalText.contains("<progress")) { <START> String regex = "<progress.*?><\\/progress>|<span id=\"img_container.*?>"; <END> return originalText.replaceAll(regex, ""); } else { return originalText; } }</code><technical_language>I for a user type <span id="img_container">, removed this regex. a more precise <progress.*?><\/progress>|<span id="img_container.*? class="img_container" contenteditable="false"></technical_language>

Target:
private String removeVisualEditorProgressTag(String originalText) { if (originalText != null && originalText.contains("<progress")) { String regex = "<progress.*?><\\/progress>|<span id=\"img_container.*? class=\"img_container\" contenteditable=\"false\">"; return originalText.replaceAll(regex, ""); } else { return originalText; } }
Source:
<code>private void initRuleQueryBasedOnVersion(final String version) { <START> if (XPATH_1_0.equals(version)) { <END> xpathRuleQuery = new JaxenXPathRuleQuery(); } else { xpathRuleQuery = new SaxonXPathRuleQuery(); } }</code><technical_language>a ternary expression</technical_language>

Target:
private void initRuleQueryBasedOnVersion(final String version) { xpathRuleQuery = XPATH_1_0.equals(version) ? new JaxenXPathRuleQuery() : new SaxonXPathRuleQuery(); }
Source:
<code>public Change perform(IProgressMonitor pm) throws CoreException { try { pm.beginTask(getName(), 1); if (makeWrittable) { <START> WriteAccessChecker.setWritable(recource); <END> } else { WriteAccessChecker.setReadable(recource); } return new ResourceAccessChange(recource, false); } finally { pm.done(); } }</code><technical_language>A modal dialog is unacceptable perfrom stage of refactoring</technical_language>

Target:
public Change perform(IProgressMonitor pm) throws CoreException { try { pm.beginTask(getName(), 1); if (makeWrittable) { WriteAccessChecker.setWritable(recource, true); return new ResourceAccessChange(recource, false); } else { WriteAccessChecker.setWritable(recource, false); return new ResourceAccessChange(recource, true); } } finally { pm.done(); } }