auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); if (savedInstanceState == null){ try { fragment = new CourseOutlineFragment(); fragment.setTaskProcessCallback(this); if (courseData != null) { Bundle bundle = new Bundle(); bundle.putSerializable(Router.EXTRA_ENROLLMENT, courseData); bundle.putString(Router.EXTRA_COURSE_COMPONENT_ID, courseComponentId); <START> if (getIntent() != null) { <END> bundle.putString(Router.EXTRA_LAST_ACCESSED_ID , getIntent().getStringExtra(Router.EXTRA_LAST_ACCESSED_ID)); } fragment.setArguments(bundle); } fragment.setRetainInstance(true); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.add(R.id.fragment_container, fragment, CourseOutlineFragment.TAG); fragmentTransaction.disallowAddToBackStack(); fragmentTransaction.commit(); } catch (Exception e) { logger.error(e); } } else { fragment = (CourseOutlineFragment) getSupportFragmentManager().findFragmentByTag(CourseOutlineFragment.TAG); } if (!isOnCourseOutline()) { CourseComponent courseComponent = courseManager.getComponentById(courseData.getCourse().getId(), courseComponentId); String prefName = PrefManager.getPrefNameForLastAccessedBy(getProfile() .username, courseComponent.getCourseId()); final PrefManager prefManager = new PrefManager(MainApplication.instance(), prefName); prefManager.putLastAccessedSubsection(courseComponent.getId(), false); } }</code><technical_language>I Intent null in normal of things, this check is needed</technical_language>

Target:
protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); if (savedInstanceState == null){ try { fragment = new CourseOutlineFragment(); fragment.setTaskProcessCallback(this); if (courseData != null) { Bundle bundle = new Bundle(); bundle.putSerializable(Router.EXTRA_ENROLLMENT, courseData); bundle.putString(Router.EXTRA_COURSE_COMPONENT_ID, courseComponentId); bundle.putString(Router.EXTRA_LAST_ACCESSED_ID , getIntent().getStringExtra(Router.EXTRA_LAST_ACCESSED_ID)); fragment.setArguments(bundle); } fragment.setRetainInstance(true); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.add(R.id.fragment_container, fragment, CourseOutlineFragment.TAG); fragmentTransaction.disallowAddToBackStack(); fragmentTransaction.commit(); } catch (Exception e) { logger.error(e); } } else { fragment = (CourseOutlineFragment) getSupportFragmentManager().findFragmentByTag(CourseOutlineFragment.TAG); } if (!isOnCourseOutline()) { CourseComponent courseComponent = courseManager.getComponentById(courseData.getCourse().getId(), courseComponentId); String prefName = PrefManager.getPrefNameForLastAccessedBy(getProfile() .username, courseComponent.getCourseId()); final PrefManager prefManager = new PrefManager(MainApplication.instance(), prefName); prefManager.putLastAccessedSubsection(courseComponent.getId(), false); } }
Source:
<code>public int getRetries() { final String retryString = this.getOptionValueWithDefault(RETRIES.getOpt(), DEFAULT_RETRIES).toString(); try { return Integer.parseInt(retryString); } catch (final NumberFormatException e) { <START> System.err.printf("Error: Argument (%s) to '-r' was not a number\n", retryString); <END> System.exit(1); } return -1; }</code><technical_language>This follow normal exception handling path caller handle printing of exception</technical_language>

Target:
public int getRetries() throws BadArgumentException { final String retryString = this.getOptionValueWithDefault(RETRIES.getOpt(), DEFAULT_RETRIES).toString(); try { return Integer.parseInt(retryString); } catch (final NumberFormatException e) { throw new BadArgumentException("Argument to '-r' was not a number", e); } }
Source:
<code>public String toString() { <START> return String.format("byte@0x%x=0x%x (%d)", Pointer.nativeValue(getPointer()), getValue(), getValue()); <END> }</code><technical_language>getValue needs called (nitpick): return String.format("byte@0x%1$x=0x%2$x (%4$d)", Pointer.nativeValue(getPointer()), getValue());</technical_language>

Target:
public String toString() { return String.format("byte@0x%1$x=0x%2$x (%2$d)", Pointer.nativeValue(getPointer()), getValue()); }
Source:
<code>private boolean matchNamePattern(String value, String namePattern) { boolean match = true; <START> if (value != null && StringUtils.isNotBlank(value)) { <END> match = value.matches(namePattern); } return match; }</code><technical_language>StringUtils.isNotBlank compare for null</technical_language>

Target:
private boolean matchNamePattern(String value, String namePattern) { boolean match = true; if (StringUtils.isNotBlank(value)) { match = value.matches(namePattern); } return match; }
Source:
<code>private static void handlePlatformJar(@NotNull PathsList classPath, @NotNull AndroidPlatform platform, @NotNull JavaArtifact artifact) { String androidJarPath = platform.getTarget().getPath(IAndroidTarget.ANDROID_JAR); for (String entry : classPath.getPathList()) { if (pathsEqual(androidJarPath, entry)) { classPath.remove(entry); } } List<String> mockableJars = ContainerUtil.newSmartList(); for (String path : classPath.getPathList()) { if (new File(toSystemDependentName(path)).getName().startsWith("mockable-")) { mockableJars.add(path); } } for (String mockableJar : mockableJars) { classPath.remove(mockableJar); } File mockableJar = getMockableJarFromModel(artifact); if (mockableJar != null) { classPath.addTail(mockableJar.getPath()); } else { for (String mockableJarPath : mockableJars) { if (mockableJarPath.endsWith("-" + platform.getApiLevel() + ".jar")) { classPath.addTail(mockableJarPath); return; } } throw new IllegalStateException(String.format("Could not find matching mockable platform jar. Found %d total mockable jars.", <START> mockableJars.size())); <END> } }</code><technical_language>size, contents of list useful</technical_language>

Target:
private static void handlePlatformJar(@NotNull PathsList classPath, @NotNull AndroidPlatform platform, @NotNull JavaArtifact artifact) { String androidJarPath = platform.getTarget().getPath(IAndroidTarget.ANDROID_JAR); for (String entry : classPath.getPathList()) { if (pathsEqual(androidJarPath, entry)) { classPath.remove(entry); } } List<String> mockableJars = ContainerUtil.newSmartList(); for (String path : classPath.getPathList()) { if (new File(toSystemDependentName(path)).getName().startsWith("mockable-")) { mockableJars.add(path); } } for (String mockableJar : mockableJars) { classPath.remove(mockableJar); } File mockableJar = getMockableJarFromModel(artifact); if (mockableJar != null) { classPath.addTail(mockableJar.getPath()); } else { for (String mockableJarPath : mockableJars) { if (mockableJarPath.endsWith("-" + platform.getApiLevel() + ".jar")) { classPath.addTail(mockableJarPath); return; } } throw new IllegalStateException(String.format("Could not find matching mockable platform jar. Mockable jars found: [%s].", Joiner.on(',').join(mockableJars))); } }
Source:
<code>private void checkWhereArguments(WhereClauses whereClauses, List<byte[]> expectedArgs) { List<Object> actualArgs = whereClauses.getArguments(); for (int i = 0; i < actualArgs.size(); i++) { <START> assertThat((byte[]) actualArgs.get(i)).isEqualTo(expectedArgs.get(i)); <END> } assertThat(actualArgs.size()).isEqualTo(expectedArgs.size()); }</code><technical_language>This feels implode,</technical_language>

Target:
private void checkWhereArguments(WhereClauses whereClauses, List<byte[]> expectedArgs) { List<Object> actualArgs = whereClauses.getArguments(); for (int i = 0; i < actualArgs.size(); i++) { assertThat((byte[]) actualArgs.get(i)).isEqualTo(expectedArgs.get(i)); } assertThat(actualArgs).hasSameSizeAs(expectedArgs); }
Source:
<code>public static boolean isTCCPacket(ByteArrayBuffer baf) { int rc = RTCPHeaderUtils.getReportCount(baf); <START> return isRTPFBPacket(baf) && rc == FMT; <END> }</code><technical_language>wondering...is worth putting rc == FMT check for a short-circuiting efficiency improvement</technical_language>

Target:
public static boolean isTCCPacket(ByteArrayBuffer baf) { int rc = RTCPHeaderUtils.getReportCount(baf); return rc == FMT && isRTPFBPacket(baf); }
Source:
<code>private static boolean shouldShowChooserDialog(long siteId, String serviceId, JSONObject jsonObject) { JSONArray jsonConnectionList = jsonObject.optJSONArray("connections"); if (jsonConnectionList == null || jsonConnectionList.length() <= 1) { return false; } int totalAccounts = 0; int totalExternalAccounts = 0; try { for (int i = 0; i < jsonConnectionList.length(); i++) { JSONObject connectionObject = jsonConnectionList.getJSONObject(i); PublicizeConnection publicizeConnection = PublicizeConnection.fromJson(connectionObject); if (publicizeConnection.getService().equals(serviceId) && !publicizeConnection.isInSite(siteId)) { totalAccounts++; JSONArray externalJsonArray = connectionObject.getJSONArray("additional_external_users"); for (int j = 0; j < externalJsonArray.length(); j++) { totalExternalAccounts++; } } } if (PublicizeTable.onlyExternalConnections(serviceId)) { <START> return totalAccounts > 0; <END> } else { return totalAccounts > 0 || totalExternalAccounts > 0; } } catch (JSONException e) { return false; } }</code><technical_language>this return totalExternalAccounts > 0</technical_language>

Target:
private static boolean shouldShowChooserDialog(long siteId, String serviceId, JSONObject jsonObject) { JSONArray jsonConnectionList = jsonObject.optJSONArray("connections"); if (jsonConnectionList == null || jsonConnectionList.length() <= 1) { return false; } int totalAccounts = 0; int totalExternalAccounts = 0; try { for (int i = 0; i < jsonConnectionList.length(); i++) { JSONObject connectionObject = jsonConnectionList.getJSONObject(i); PublicizeConnection publicizeConnection = PublicizeConnection.fromJson(connectionObject); if (publicizeConnection.getService().equals(serviceId) && !publicizeConnection.isInSite(siteId)) { totalAccounts++; JSONArray externalJsonArray = connectionObject.getJSONArray("additional_external_users"); for (int j = 0; j < externalJsonArray.length(); j++) { totalExternalAccounts++; } } } if (PublicizeTable.onlyExternalConnections(serviceId)) { return totalExternalAccounts > 0; } else { return totalAccounts > 0 || totalExternalAccounts > 0; } } catch (JSONException e) { return false; } }
Source:
<code>void seal() throws IOException, StoreException { <START> if (sealed.compareAndSet(false, true)) { <END> if (!config.storeKeepIndexInMemory) { map(); } persistBloomFilter(); } }</code><technical_language>is compareAndSet() necessary? this method called more once</technical_language>

Target:
void seal() throws IOException, StoreException { sealed.set(true); if (!config.storeKeepIndexInMemory) { mmap(); } persistBloomFilter(); }
Source:
<code>protected boolean validate() { List<Pair<VM, VmDevice>> vmsForDisk = vmDao.getVmsWithPlugInfo(getDiskImage().getId()); DiskValidator diskValidator = new DiskValidator(getDiskImage()); if (!validate(diskValidator.isDiskPluggedToVmsThatAreNotDown(false, vmsForDisk))) { StorageDomainStatic destDomain = storageDomainStaticDao.get(getParameters().getStorageDomainId()); if <START> (destDomain.isBackup() == true) { <END> return false; } } return true; }</code><technical_language>need, simply : if (destDomain.isBackup()) {</technical_language>

Target:
protected boolean validate() { List<Pair<VM, VmDevice>> vmsForDisk = vmDao.getVmsWithPlugInfo(getDiskImage().getId()); DiskValidator diskValidator = new DiskValidator(getDiskImage()); if (!validate(diskValidator.isDiskPluggedToVmsThatAreNotDown(false, vmsForDisk))) { StorageDomainStatic destDomain = storageDomainStaticDao.get(getParameters().getStorageDomainId()); if (destDomain.isBackup()) { new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_RUNNING_VM_DISK_CANNOT_MOVE_TO_BACKUP_DOMAIN); return false; } } return true; }
Source:
<code>public SurfaceGenerator() { <START> super( <END> new LakePopulator(), new DesertPopulator(), new TreePopulator(), new MushroomPopulator(), new SnowPopulator(), new FlowerPopulator(), new DungeonPopulator(), new OrePopulator() ); }</code><technical_language><LINK_0></technical_language>

Target:
public SurfaceGenerator() { super( new LakePopulator(), new DesertPopulator(), new TreePopulator(), new MushroomPopulator(), new SnowPopulator(), new FlowerPopulator(), new BiomePopulator(), new DungeonPopulator(), new OrePopulator() ); }
Source:
<code>private void prepare(ControlWidget screen) { InjectionHelper.inject(screen); <START> translator.updateWidget(screen); <END> screen.onOpened(); }</code><technical_language>Suggest retaining untranslated strings translating rendering</technical_language>

Target:
private void prepare(ControlWidget screen) { InjectionHelper.inject(screen); screen.onOpened(); }
Source:
<code>public boolean doPostAddIdP(IdentityProvider identityProvider, String tenantDomain) throws IdentityProviderManagementException { <START> if (isEnable()) { <END> audit.info(String.format(AUDIT_MESSAGE, getUser(), "add", UserCoreUtil.addTenantDomainToEntry(identityProvider .getDisplayName(), tenantDomain), identityProvider.getIdentityProviderName(), SUCCESS)); } return true; }</code><technical_language>need check isEnable() here. checked in IdentityProviderManager invoking listener. contract of interface - listener is enabled not. UserOperationEventListeners need check this in implementation method is part of interface contract. in abstract class. This is interface in kernel add method in kernel</technical_language>

Target:
public boolean doPostAddIdP(IdentityProvider identityProvider, String tenantDomain) throws IdentityProviderManagementException { String displayName = "Undefined"; String IDPName = "Undefined"; if (identityProvider != null) { displayName = identityProvider.getDisplayName(); IDPName = identityProvider.getIdentityProviderName(); } audit.info(String.format(AUDIT_MESSAGE, getUser(), "add", UserCoreUtil.addTenantDomainToEntry(displayName, tenantDomain), IDPName, SUCCESS)); return true; }
Source:
<code>public void setUp() throws URIException, HttpMalformedHeaderException { <START> Logger rootLogger = Logger.getRootLogger(); rootLogger.setLevel(Level.OFF); <END> FrontEndScannerAPI api = mock(FrontEndScannerAPI.class); FrontEndScannerOptions options = mock(FrontEndScannerOptions.class); when(options.isEnabled()).thenReturn(true); HistoryReference ref = mock(HistoryReference.class); when(ref.getHistoryId()).thenReturn(42); frontEndScannerProxyListener = new FrontEndScannerProxyListener(api, options); msg = new HttpMessage(new URI("https", HOSTNAME, "/", "")); msg.getResponseHeader().setHeader(HttpResponseHeader.CONTENT_TYPE, "text/html"); msg.setHistoryRef(ref); }</code><technical_language>turn off, this affects tests</technical_language>

Target:
public void setUp() throws URIException, HttpMalformedHeaderException { FrontEndScannerAPI api = mock(FrontEndScannerAPI.class); options = mock(FrontEndScannerOptions.class); HistoryReference ref = mock(HistoryReference.class, withSettings().lenient()); when(ref.getHistoryId()).thenReturn(42); frontEndScannerProxyListener = new FrontEndScannerProxyListener(api, options); msg = new HttpMessage(new URI("https", HOSTNAME, "/", "")); msg.getResponseHeader().setHeader(HttpResponseHeader.CONTENT_TYPE, "text/html"); msg.setHistoryRef(ref); }
Source:
<code>public void shouldCreateOrderWithGivenParameters() { Location location = new Location(); <START> location.setName("testLocation"); <END> Patient patient = new Patient(); patient.setUuid("10"); Provider provider = new Provider(); provider.setUuid("20"); Visit visit = new Visit(); visit.setUuid("40"); Encounter encounter = new Encounter(); encounter.setUuid("50"); Concept concept = createTestConcept("testConcept"); Order order = new Order("testType", encounter, provider, patient, concept, Order.CareSetting.INPATIENT); openMRSActionProxyService.createOrder(CONFIG_NAME, "testType", encounter.getUuid(), patient.getUuid(), concept.getUuid(), provider.getUuid(), Order.CareSetting.INPATIENT.toString()); verify(orderService).createOrder(eq(CONFIG_NAME), orderCaptor.capture()); assertEquals(order, orderCaptor.getValue()); }</code><technical_language>remove setting location</technical_language>

Target:
public void shouldCreateOrderWithGivenParameters() { Patient patient = new Patient(); patient.setUuid("10"); Provider provider = new Provider(); provider.setUuid("20"); Encounter encounter = new Encounter(); encounter.setUuid("50"); Concept concept = createTestConcept("60"); Order order = new Order("order", encounter, provider, patient, concept, Order.CareSetting.INPATIENT); doReturn(order).when(orderService).createOrder(eq(CONFIG_NAME), eq(order)); Order orderCreated = openMRSActionProxyService.createOrder(CONFIG_NAME, "order", encounter.getUuid(), patient.getUuid(), concept.getUuid(), provider.getUuid(), Order.CareSetting.INPATIENT.toString()); assertEquals(order, orderCreated); }
Source:
<code>public List<ResourceGroupSelector> getSelectors() { if (lastRefresh.get() == 0) { <START> throw new PrestoException(CONFIGURATION_UNAVAILABLE, "Selectors could not be fetched from database"); <END> } if (this.selectors.get().isEmpty()) { throw new PrestoException(CONFIGURATION_INVALID, "No selectors are configured"); } return this.selectors.get(); }</code><technical_language>Selectors fetched database</technical_language>

Target:
public List<ResourceGroupSelector> getSelectors() { if (lastRefresh.get() == 0) { throw new PrestoException(CONFIGURATION_UNAVAILABLE, "Selectors cannot be fetched from database"); } if (this.selectors.get().isEmpty()) { throw new PrestoException(CONFIGURATION_INVALID, "No selectors are configured"); } return this.selectors.get(); }
Source:
<code>public void run() { File file = new File(directory, getLibrary()); if (!checksum(file, checksum)) { GlowServer.logger.info("Downloading " + library + ' ' + version + "..."); try { URL downloadUrl = new URL(repository + group.replace('.', '/') + '/' + library + '/' + version + '/' + library + '-' + version + ".jar"); HttpsURLConnection connection = (HttpsURLConnection) downloadUrl.openConnection(); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); try (ReadableByteChannel input = Channels.newChannel(connection.getInputStream()); FileOutputStream output = new FileOutputStream(file)) { output.getChannel().transferFrom(input, 0, Long.MAX_VALUE); GlowServer.logger.info("Downloaded " + library + ' ' + version + '.'); } } catch (IOException e) { GlowServer.logger.log(Level.WARNING, "Failed to download: " + library + ' ' + version, e); file.delete(); return; } } try { String[] javaVersion = System.getProperty("java.version").split("\\."); if (Integer.parseInt(javaVersion[0]) >= 9) { <START> ClassPathAgent.addJarFile(new JarFile(file)); <END> } else { Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); method.setAccessible(true); method.invoke(ClassLoader.getSystemClassLoader(), file.toURI().toURL()); } } catch (ReflectiveOperationException | IOException e) { GlowServer.logger.log(Level.WARNING, "Failed to add to classpath: " + library + " " + version, e); } }</code><technical_language>specific instrumentation method ClassPathAgent Java 8 below. there</technical_language>

Target:
public void run() { File file = new File(directory, getLibrary()); if (!checksum(file, checksum)) { GlowServer.logger.info("Downloading " + library + ' ' + version + "..."); try { URL downloadUrl = new URL(repository + group.replace('.', '/') + '/' + library + '/' + version + '/' + library + '-' + version + ".jar"); HttpsURLConnection connection = (HttpsURLConnection) downloadUrl.openConnection(); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); try (ReadableByteChannel input = Channels.newChannel(connection.getInputStream()); FileOutputStream output = new FileOutputStream(file)) { output.getChannel().transferFrom(input, 0, Long.MAX_VALUE); GlowServer.logger.info("Downloaded " + library + ' ' + version + '.'); } } catch (IOException e) { GlowServer.logger.log(Level.WARNING, "Failed to download: " + library + ' ' + version, e); file.delete(); return; } } try { String[] javaVersion = System.getProperty("java.version").split("-")[0].split("\\."); if (Integer.parseInt(javaVersion[0]) >= 9) { ClassPathAgent.addJarFile(new JarFile(file)); } else { Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); method.setAccessible(true); method.invoke(ClassLoader.getSystemClassLoader(), file.toURI().toURL()); } } catch (ReflectiveOperationException | IOException e) { GlowServer.logger.log(Level.WARNING, "Failed to add to classpath: " + library + " " + version, e); } }
Source:
<code>protected IContributionItem[] getContributionItems() { Set<Pair<String, String>> selectedTraceTypes = new HashSet<>(getParam()); Pair<String, String> launchConfiguration = getLaunchConfigurationParam(); if (launchConfiguration != null) { selectedTraceTypes.add(launchConfiguration); } List<IContributionItem> list = new LinkedList<>(); for (Pair<String, String> item : selectedTraceTypes) { Map<String, String> params = new HashMap<>(); params.put(TYPE_PARAMETER, item.getFirst()); params.put(MODE_PARAMETER, getLaunchMode()); CommandContributionItemParameter param = new CommandContributionItemParameter( PlatformUI.getWorkbench().getActiveWorkbenchWindow(), <START> "my.parameterid", END> getContributionItemCommandId(), CommandContributionItem.STYLE_PUSH ); param.parameters = params; param.label = item.getSecond(); param.visibleEnabled = true; list.add(new CommandContributionItem(param)); } Collections.sort(list, ITEM_COMPARATOR); return list.toArray(new IContributionItem[list.size()]); }</code><technical_language>create a constant a meaningful string</technical_language>

Target:
protected IContributionItem[] getContributionItems() { Set<Pair<String, String>> availableShortcuts = new HashSet<>(getParam()); Pair<String, String> launchConfiguration = getLaunchConfigurationParam(); if (launchConfiguration != null) { availableShortcuts.add(launchConfiguration); } List<IContributionItem> list = new LinkedList<>(); for (Pair<String, String> item : availableShortcuts) { Map<String, String> params = new HashMap<>(); params.put(TYPE_PARAMETER, item.getFirst()); params.put(MODE_PARAMETER, getLaunchMode()); CommandContributionItemParameter param = new CommandContributionItemParameter( PlatformUI.getWorkbench().getActiveWorkbenchWindow(), LAUNCH_COMMAND_CONTRIBUTION_ITEM_ID, getContributionItemCommandId(), CommandContributionItem.STYLE_PUSH ); param.parameters = params; param.label = item.getSecond(); param.visibleEnabled = true; list.add(new CommandContributionItem(param)); } Collections.sort(list, ITEM_COMPARATOR); return list.toArray(new IContributionItem[list.size()]); }
Source:
<code>private boolean isAnnotationAllowed(Annotation annotationToCheck, Set<Annotation> processedAnnotations) { if ( !processedAnnotations.add( annotationToCheck ) ) { return false; } Class<? extends Annotation> annotationType = annotationToCheck.annotationType(); return ALLOWED_ANNOTATIONS.contains( annotationType ) || Arrays.stream( annotationType.getDeclaredAnnotations() ) <START> .anyMatch( annotation -> isAnnotationAllowed( annotation, processedAnnotations ) ); <END> }</code><technical_language>here, this construct buys much</technical_language>

Target:
private boolean isAnnotationAllowed(Annotation annotationToCheck, Set<Annotation> processedAnnotations) { if ( !processedAnnotations.add( annotationToCheck ) ) { return false; } Class<? extends Annotation> annotationType = annotationToCheck.annotationType(); if ( ALLOWED_ANNOTATIONS.contains( annotationType ) ) { return true; } for ( Annotation annotation : annotationType.getDeclaredAnnotations() ) { if ( isAnnotationAllowed( annotation, processedAnnotations ) ) { return true; } } return false; }
Source:
<code>public String getCanonicalName() { return getPackage() + "." + getSimpleName().replaceAll("$", "\\."); <START> } <END></code><technical_language>"replace"</technical_language>

Target:
public String getCanonicalName() { return getPackage() + "." + getSimpleName().replace("$", "\\."); }
Source:
<code>public QueryDetail explain(EntityProjection projection, RequestScope scope) { Class<?> entityClass = projection.getType(); String modelName = entityClass.getName(); <START> List<String> queryTextList = getQueryText(); <END> this.queryText = new ArrayList<>(); return new QueryDetail(modelName, queryTextList); }</code><technical_language>I this is correct. explain interface wants explain _only_ this entity projection. getQueryText function is returning date happened this projection</technical_language>

Target:
public QueryDetail explain(EntityProjection projection, RequestScope scope) { Class<?> entityClass = projection.getType(); Pagination pagination = projection.getPagination(); FilterExpression filterExpression = projection.getFilterExpression(); Sorting sorting = projection.getSorting(); List<String> queryTextList = new ArrayList<>(); if (pagination != null && pagination.returnPageTotals()) { pagination.setPageTotals(getTotalRecords(entityClass, Optional.ofNullable(filterExpression), scope.getDictionary())); queryTextList.add(explainTotalRecords(projection, scope)); } RootCollectionFetchQueryBuilder queryBuilder = new RootCollectionFetchQueryBuilder(entityClass, scope.getDictionary(), sessionWrapper); queryBuilder .withPossibleFilterExpression(Optional.ofNullable(filterExpression)) .withPossibleSorting(Optional.ofNullable(sorting)) .withPossiblePagination(Optional.ofNullable(pagination)) .build(); queryTextList.add(queryBuilder.getQueryString()); return new QueryDetail(entityClass.getName(), queryTextList); }
Source:
<code>public boolean filterRow(Project project, int rowIndex, Row row) { Cell cell = _cellIndex < 0 ? null : row.getCell(_cellIndex); Properties bindings = ExpressionUtils.createBindings(project); ExpressionUtils.bind(bindings, row, rowIndex, _columnName, cell); Boolean invert = _invert; Object value = _evaluable.evaluate(bindings); if (value != null) { if (value.getClass().isArray()) { Object[] a = (Object[]) value; for (Object v : a) { if (checkValue(v instanceof String ? ((String) v) : v.toString())) { <START> return (invert) ? false : true; <END> } } } else if (value instanceof Collection<?>) { for (Object v : ExpressionUtils.toObjectCollection(value)) { if (checkValue(v.toString())) { return (invert) ? false : true; } } return (invert) ? true : false; } else if (value instanceof JSONArray) { JSONArray a = (JSONArray) value; int l = a.length(); for (int i = 0; i < l; i++) { try { if (checkValue(a.get(i).toString())) { return (invert) ? false : true; } } catch (JSONException e) { } } return (invert) ? true : false; } else { if (checkValue(value instanceof String ? ((String) value) : value.toString())) { return (invert) ? false : true; } } } return (invert) ? true : false; }</code><technical_language>replace !invert</technical_language>

Target:
public boolean filterRow(Project project, int rowIndex, Row row) { Cell cell = _cellIndex < 0 ? null : row.getCell(_cellIndex); Properties bindings = ExpressionUtils.createBindings(project); ExpressionUtils.bind(bindings, row, rowIndex, _columnName, cell); Boolean invert = _invert; Object value = _evaluable.evaluate(bindings); if (value != null) { if (value.getClass().isArray()) { Object[] a = (Object[]) value; for (Object v : a) { if (checkValue(v instanceof String ? ((String) v) : v.toString())) { return !invert; } } } else if (value instanceof Collection<?>) { for (Object v : ExpressionUtils.toObjectCollection(value)) { if (checkValue(v.toString())) { return !invert; } } return invert; } else if (value instanceof JSONArray) { JSONArray a = (JSONArray) value; int l = a.length(); for (int i = 0; i < l; i++) { try { if (checkValue(a.get(i).toString())) { return !invert; } } catch (JSONException e) { } } return invert; } else { if (checkValue(value instanceof String ? ((String) value) : value.toString())) { return !invert; } } } return invert; }
Source:
<code><START> public void merge() throws MergeException { <END> try { schema = mArguments.schemaFactory.open(); openRepository(); submitted = schema.changes().submitted(destBranch).toList(); preMerge(); updateBranch(); updateChangeStatus(); } catch (OrmException e) { throw new MergeException("Cannot open database", e); } finally { if (rw != null) { rw.release(); } if (db != null) { db.close(); } schema.close(); schema = null; } }</code><technical_language>this method final</technical_language>

Target:
public final void merge() throws MergeException { try { schema = mArguments.schemaFactory.open(); openRepository(); submitted = schema.changes().submitted(destBranch).toList(); preMerge(); updateBranch(); updateChangeStatus(); } catch (OrmException e) { throw new MergeException("Cannot open database", e); } finally { if (rw != null) { rw.release(); } if (db != null) { db.close(); } schema.close(); schema = null; } }
Source:
<code>public void saveOrderType_shouldAddNewOrderTypeToTheDatabase() { OrderService orderService = Context.getOrderService(); OrderType orderType = new OrderType(); orderType.setName("New Order"); orderType.setJavaClassName("org.openmrs.NewTestOrder"); orderType.setDescription("New order type for testing"); orderType.setRetired(false); orderType = orderService.saveOrderType(orderType); assertNotNull(orderType); <START> assertEquals("New Order", orderType.getName()); <END> }</code><technical_language>This is a good assertion, instead check count get call getOrderTypes(true) increased 1 new item orderTypeId</technical_language>

Target:
public void saveOrderType_shouldAddNewOrderTypeToTheDatabase() { OrderService orderService = Context.getOrderService(); int orderTypeCount = orderService.getOrderTypes(true).size(); OrderType orderType = new OrderType(); orderType.setName("New Order"); orderType.setJavaClassName("org.openmrs.NewTestOrder"); orderType.setDescription("New order type for testing"); orderType.setRetired(false); orderType = orderService.saveOrderType(orderType); assertNotNull(orderType); assertEquals("New Order", orderType.getName()); assertNotNull(orderType.getId()); assertEquals((orderTypeCount + 1), orderService.getOrderTypes(true).size()); }
Source:
<code>public boolean hasNext() { if (throwable != null) throw throwable; try { if (nextElement != null && nextElement != terminator) { return true; } else if(nextElement == terminator) return false; nextElement = buffer.take(); if (nextElement == terminator) return false; return true; } catch (Exception e) { <START> log.error("Premature end of loop!"); <END> return false; } }</code><technical_language>Exception logged for debugging purposes</technical_language>

Target:
public boolean hasNext() { if (throwable != null) throw throwable; try { if (nextElement != null && nextElement != terminator) { return true; } else if(nextElement == terminator) return false; nextElement = buffer.take(); if (nextElement == terminator) return false; return true; } catch (Exception e) { log.error("Premature end of loop!"); throw new RuntimeException(e); } }
Source:
<code>public void sessionClosed(IoSession session) throws Exception { if (sync && !messageReceived) { LOG.debug("Session closed but no message received from address: {}", address); countDown(); } <START> closeLatch.countDown(); <END> }</code><technical_language>if session is closed remotely producer is able close it? closeLatch uninitialised</technical_language>

Target:
public void sessionClosed(IoSession session) throws Exception { if (sync && !messageReceived) { LOG.debug("Session closed but no message received from address: {}", address); notifyResultAvailable(); } notifySessionClosed(); }
Source:
<code>public void addPages() { <START> setWindowTitle("Run SWT Recorder"); <END> firstPage = new SWTRecorderWizardPage(); addPage(firstPage); }</code><technical_language>Labels externalized internationalized (by creating a class extends NLS a messages.properties)</technical_language>

Target:
public void addPages() { setWindowTitle(Messages.recorderDialogTitle); firstPage = new SWTRecorderWizardPage(); addPage(firstPage); }
Source:
<code>public void onUserSetScaleDenominator(PropertyChangeEvent pce) throws PropertyVetoException { long newScale = (Long)pce.getNewValue(); if(newScale<1) { throw new PropertyVetoException(I18N.tr("The value of the scale denominator must be equal or greater than 1"),pce); } <START> mapControl.getMapTransform().setScaleDenominator((double)newScale); <END> }</code><technical_language>useless cast long double</technical_language>

Target:
public void onUserSetScaleDenominator(PropertyChangeEvent pce) throws PropertyVetoException { long newScale = (Long)pce.getNewValue(); if(newScale<1) { throw new PropertyVetoException(I18N.tr("The value of the scale denominator must be equal or greater than 1"),pce); } mapControl.getMapTransform().setScaleDenominator(newScale); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 47.495052, -121.786863, 12); mMapView.setMap(map); mFab = findViewById(R.id.floatingActionButton); mFab.setOnClickListener(v -> Snackbar.make(v, "Button responds to attribution bar", Snackbar.LENGTH_LONG) .setAction("Action", null).show()); mMapView.addAttributionViewLayoutChangeListener( (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { int heightDelta = oldBottom - bottom; mFab.animate().translationYBy(heightDelta); <START> Toast.makeText(MainActivity.this, "new bounds [" + left + "," + top + "," + right + "," + bottom + "]" + <END> " old bounds [" + oldLeft + "," + oldTop + "," + oldRight + "," + oldBottom + "]", Toast.LENGTH_SHORT) .show(); }); }</code><technical_language>single characters represented ','. slightly easier read</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 47.495052, -121.786863, 12); mMapView.setMap(map); FloatingActionButton mFab = findViewById(R.id.floatingActionButton); mFab.setOnClickListener(v -> Snackbar.make(v, "Button responds to attribution bar", Snackbar.LENGTH_LONG) .setAction("Action", null).show()); mMapView.addAttributionViewLayoutChangeListener( (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { int heightDelta = oldBottom - bottom; mFab.animate().translationYBy(heightDelta); Toast.makeText(MainActivity.this, "new bounds [" + left + ',' + top + ',' + right + ',' + bottom + ']' + " old bounds [" + oldLeft + ',' + oldTop + ',' + oldRight + ',' + oldBottom + ']', Toast.LENGTH_SHORT) .show(); }); }
Source:
<code>public boolean getDataConsistentOnStandby() { ReplicationStatusKey key = ReplicationStatusKey.newBuilder().setKey( ReplicationStatusKey.Status.IS_DATA_CONSISTENT).build(); CorfuRecord record = corfuStore.query(NAMESPACE).getRecord(REPLICATION_STATUS_TABLE, key); if (record == null) { <START> return false; <END> } ReplicationStatusVal val = (ReplicationStatusVal)record.getPayload(); return val.getDataConsistent(); }</code><technical_language>print some warning message for persisted</technical_language>

Target:
public Map<String, ReplicationStatusVal> getDataConsistentOnStandby() { ReplicationStatusKey key = ReplicationStatusKey.newBuilder().setClusterId(localClusterId).build(); CorfuRecord record = corfuStore.query(NAMESPACE).getRecord(REPLICATION_STATUS_TABLE, key); ReplicationStatusVal statusVal; if (record == null) { log.warn("No Key for Data Consistent found. DataConsistent Status is not set."); statusVal = ReplicationStatusVal.newBuilder().setDataConsistent(false).build(); } else { statusVal = (ReplicationStatusVal)record.getPayload(); } Map<String, ReplicationStatusVal> dataConsistentMap = new HashMap<>(); dataConsistentMap.put(localClusterId, statusVal); return dataConsistentMap; }
Source:
<code>public boolean getUserHasPermissions(String userName, String domain) throws SQLException { Connection connection = null; PreparedStatement prepareStatement = null; ResultSet resultSet = null; try { log.info("getPermissionsForUser username: " + userName + " domain: " + domain); connection = ds.getConnection(); prepareStatement = connection.prepareStatement(selectQuery); prepareStatement.setString(1, userName); prepareStatement.setString(2, domain); resultSet = prepareStatement.executeQuery(); if (resultSet.next()) { return true; } } finally { <START> if (resultSet != null) { <END> resultSet.close(); } if (prepareStatement != null) { prepareStatement.close(); } if (connection != null) { connection.close(); } } return false; }</code><technical_language>Please closeQuietly methods DbUtils</technical_language>

Target:
public boolean getUserHasPermissions(String userName, String domain) throws SQLException { Connection connection = null; PreparedStatement prepareStatement = null; ResultSet resultSet = null; try { log.info("getPermissionsForUser username: " + userName + " domain: " + domain); connection = ds.getConnection(); prepareStatement = connection.prepareStatement(selectQuery); prepareStatement.setString(1, userName); prepareStatement.setString(2, domain); resultSet = prepareStatement.executeQuery(); if (resultSet.next()) { return true; } } finally { DbUtils.closeQuietly(resultSet, prepareStatement, connection); } return false; }
Source:
<code>private void postInstalledEvent(String extensionId) { <START> if (eventPublisher != null) { <END> Event event = ExtensionEventFactory.createExtensionInstalledEvent(extensionId); eventPublisher.post(event); } }</code><technical_language>I assume this function called if service is activated. EventPublisher is a mandatory reference, need check for nullness</technical_language>

Target:
private void postInstalledEvent(String extensionId) { Event event = ExtensionEventFactory.createExtensionInstalledEvent(extensionId); eventPublisher.post(event); }
Source:
<code>private OutputStream decorate(OutputStream os) { for (ConsoleLogFilter f : ConsoleLogFilter.all()) { try { os = f.decorateLogger(this,os); } catch (IOException|InterruptedException e) { <START> logger.log(Level.WARNING, "Failed to filter log with "+f, e); <END> } } return os; }</code><technical_language>I LOGGER legitimate in this case, is related slave logs</technical_language>

Target:
private OutputStream decorate(OutputStream os) { for (ConsoleLogFilter f : ConsoleLogFilter.all()) { try { os = f.decorateLogger(this,os); } catch (IOException|InterruptedException e) { LOGGER.log(Level.WARNING, "Failed to filter log with "+f, e); } } return os; }
Source:
<code>public boolean isRecord() throws JavaModelException { IBinaryType info = (IBinaryType) getElementInfo(); if( TypeDeclaration.kind(info.getModifiers()) == TypeDeclaration.CLASS_DECL) { <START> return CharOperation.equals(info.getSuperclassName(), RecordDeclaration.super_class); <END> } return false; }</code><technical_language>change this TypeConstants.JAVA_LANG_RECORD</technical_language>

Target:
public boolean isRecord() throws JavaModelException { IBinaryType info = (IBinaryType) getElementInfo(); if( TypeDeclaration.kind(info.getModifiers()) == TypeDeclaration.CLASS_DECL) { return CharOperation.equals(info.getSuperclassName(), TypeConstants.CharArray_JAVA_LANG_RECORD); } return false; }
Source:
<code>public long saveProjectOverview(ProjectOverview overview) throws IOException { if (projectStore != null) { if (overview.getId() != ProjectOverview.UNSAVED_ID) { ProjectOverview original = projectStore.getProjectOverviewById(overview.getId()); original.setAllLibrariesQcPassed(overview.getAllLibrariesQcPassed()); original.setAllPoolsConstructed(overview.getAllPoolsConstructed()); original.setAllRunsCompleted(overview.getAllRunsCompleted()); original.setLocked(overview.getLocked()); original.setPrimaryAnalysisCompleted(overview.getPrimaryAnalysisCompleted()); original.setPrincipalInvestigator(overview.getPrincipalInvestigator()); original.setStartDate(overview.getStartDate()); original.setEndDate(overview.getEndDate()); original.setNumProposedSamples(overview.getNumProposedSamples()); original.setAllSampleQcPassed(overview.getAllSampleQcPassed()); original.setLastUpdated(new Date()); overview = original; } <START> overview.setLastUpdated(new Date()); <END> return projectStore.saveOverview(overview); } else { throw new IOException("No projectStore available. Check that it has been declared in the Spring config."); } }</code><technical_language>Please remove set 1065</technical_language>

Target:
public long saveProjectOverview(ProjectOverview overview) throws IOException { if (projectStore != null) { if (overview.getId() != ProjectOverview.UNSAVED_ID) { ProjectOverview original = projectStore.getProjectOverviewById(overview.getId()); original.setAllLibrariesQcPassed(overview.getAllLibrariesQcPassed()); original.setAllPoolsConstructed(overview.getAllPoolsConstructed()); original.setAllRunsCompleted(overview.getAllRunsCompleted()); original.setLocked(overview.getLocked()); original.setPrimaryAnalysisCompleted(overview.getPrimaryAnalysisCompleted()); original.setPrincipalInvestigator(overview.getPrincipalInvestigator()); original.setStartDate(overview.getStartDate()); original.setEndDate(overview.getEndDate()); original.setNumProposedSamples(overview.getNumProposedSamples()); original.setAllSampleQcPassed(overview.getAllSampleQcPassed()); overview = original; } overview.setLastUpdated(new Date()); return projectStore.saveOverview(overview); } else { throw new IOException("No projectStore available. Check that it has been declared in the Spring config."); } }
Source:
<code>public void populateAvatar(ChatChannelUser chatChannelUser) { if (chatChannelUser.isDisplayed()) { <START> if (chatChannelUser.getAvatar().isEmpty()) { <END> chatChannelUser.getPlayer() .ifPresent(player -> { Image avatar; if (!Strings.isNullOrEmpty(player.getAvatarUrl())) { avatar = avatarService.loadAvatar(player.getAvatarUrl()); } else { avatar = null; } Platform.runLater(() -> { chatChannelUser.setAvatar(avatar); }); }); } } else { chatChannelUser.setAvatar(null); } }</code><technical_language>suggestion if (!chatChannelUser.getAvatar().isEmpty()) { return; }</technical_language>

Target:
public void populateAvatar(ChatChannelUser chatChannelUser) { if (chatChannelUser.isDisplayed()) { if (!chatChannelUser.getAvatar().isEmpty()) { return; } chatChannelUser.getPlayer() .ifPresent(player -> { Image avatar; if (!Strings.isNullOrEmpty(player.getAvatarUrl())) { avatar = avatarService.loadAvatar(player.getAvatarUrl()); } else { avatar = null; } Platform.runLater(() -> { chatChannelUser.setAvatar(avatar); }); }); } else { chatChannelUser.setAvatar(null); } }
Source:
<code>private void handleBlockchainStateNotification(BlockchainState blockchainState) { final Intent broadcast = new Intent(ACTION_BLOCKCHAIN_STATE); broadcast.setPackage(getPackageName()); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && blockchainState != null && blockchainState.getBestChainDate() != null) { boolean syncing = blockchainState.getBestChainDate().getTime() < (Utils.currentTimeMillis() - DateUtils.HOUR_IN_MILLIS); if (!syncing && blockchainState.getBestChainHeight() == config.getBestChainHeightEver()) { stopForeground(true); nm.cancel(Constants.NOTIFICATION_ID_BLOCKCHAIN_SYNC); } else if (blockchainState.getReplaying() || syncing) { <START> Notification notification = createNetworkSyncNotification(); <END> nm.notify(Constants.NOTIFICATION_ID_BLOCKCHAIN_SYNC, notification); } } }</code><technical_language>need pass blockchainState notification updated sync state</technical_language>

Target:
private void handleBlockchainStateNotification(BlockchainState blockchainState) { final Intent broadcast = new Intent(ACTION_BLOCKCHAIN_STATE); broadcast.setPackage(getPackageName()); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && blockchainState != null && blockchainState.getBestChainDate() != null) { boolean syncing = blockchainState.getBestChainDate().getTime() < (Utils.currentTimeMillis() - DateUtils.HOUR_IN_MILLIS); if (!syncing && blockchainState.getBestChainHeight() == config.getBestChainHeightEver()) { stopForeground(true); nm.cancel(Constants.NOTIFICATION_ID_BLOCKCHAIN_SYNC); } else if (blockchainState.getReplaying() || syncing) { Notification notification = createNetworkSyncNotification(blockchainState); nm.notify(Constants.NOTIFICATION_ID_BLOCKCHAIN_SYNC, notification); } } }
Source:
<code>private void setDisplayHeight() { displayDensity = DimenUtil.getDensityScalar(); <START> displayHeight = (int) (DimenUtil.getDisplayMetrics().heightPixels / displayDensity); <END> }</code><technical_language>displayHeight is 0 running in API 10. need fall original method of height</technical_language>

Target:
private void setDisplayHeight() { displayDensity = DimenUtil.getDensityScalar(); displayHeight = DimenUtil.getDisplayHeight( parentFragment.getActivity().getWindowManager().getDefaultDisplay(), displayDensity); }
Source:
<code>public boolean addPassenger(Entity passenger) { Preconditions.checkArgument(passenger != this, "Entity cannot ride itself."); if (passenger == null || passengers.contains(passenger)) return false; if (!(passenger instanceof GlowEntity)) { return false; } GlowEntity glowPassenger = (GlowEntity) passenger; if (glowPassenger.vehicle != null) { glowPassenger.vehicle.removePassenger(passenger); } EntityMountEvent event = new EntityMountEvent(passenger, this); EventFactory.callEvent(event); if (event.isCancelled()) { return false; } this.passengers.add(passenger); glowPassenger.vehicle = this; this.passengerChanged = true; Location onTopOfVehicle = this.location.clone().add(0, this.getHeight(), 0); <START> glowPassenger.teleport(onTopOfVehicle); <END> return true; }</code><technical_language>I need teleport passenger dismounting, no</technical_language>

Target:
public boolean addPassenger(Entity passenger) { Preconditions.checkArgument(!this.equals(passenger), "Entity cannot ride itself."); if (passenger == null || passengers.contains(passenger)) return false; if (!(passenger instanceof GlowEntity)) { return false; } GlowEntity glowPassenger = (GlowEntity) passenger; if (glowPassenger.vehicle != null) { glowPassenger.vehicle.removePassenger(passenger); } EntityMountEvent event = new EntityMountEvent(passenger, this); EventFactory.callEvent(event); if (event.isCancelled()) { return false; } passengerChanged = true; glowPassenger.vehicle = this; glowPassenger.teleport(getMountLocation()); return this.passengers.add(passenger); }
Source:
<code>public void saveUserLocation_shouldSaveAUserLocation() throws Exception { MohCoreService cservice = Context.getService(MohCoreService.class); User sysUser = new User(); sysUser.setUserId(2); Location userLoc = new Location(); userLoc.setLocationId(3); UserLocation userlocation = new UserLocation(); userlocation.setUserLocationId(3); userlocation.setSysUser(sysUser); userlocation.setUserLoc(userLoc); cservice.saveUserLocation(userlocation); <START> <END> }</code><technical_language>here, add some assertions. I set a variable result of saveUserLocation, assert ID a UUID assigned</technical_language>

Target:
public void saveUserLocation_shouldSaveAUserLocation() throws Exception { MohCoreService cservice = Context.getService(MohCoreService.class); User sysUser = new User(); sysUser.setUserId(501); Location userLoc = new Location(); userLoc.setLocationId(1); UserLocation userlocation = new UserLocation(); userlocation.setSysUser(sysUser); userlocation.setUserLoc(userLoc); Assert.assertNull(userlocation.getUserLocationId()); UserLocation uloc=cservice.saveUserLocation(userlocation); Assert.assertNotNull(uloc.getUserLocationId()); }