auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void removeAllCacheManagers(String tenantDomain) { Map<String, CacheManager> cacheManagers = globalCacheManagerMap.get(tenantDomain); <START> for (CacheManager cacheManager : cacheManagers.values()) { <END> if (((CarbonCacheManager) cacheManager).removeLocalCaches()) { cacheManagers.remove(cacheManager.getName()); } } }</code><technical_language>Potential NPE, check for null "cacheManagers"</technical_language>

Target:
public void removeAllCacheManagers(String tenantDomain) { Map<String, CacheManager> cacheManagers = globalCacheManagerMap.get(tenantDomain); if (cacheManagers != null) { for (CacheManager cacheManager : cacheManagers.values()) { if (((CarbonCacheManager) cacheManager).removeLocalCaches()) { cacheManagers.remove(cacheManager.getName()); } } } }
Source:
<code>public static boolean deleteRealm(RealmConfiguration configuration) { if (configuration.isSyncConfiguration()) { <START> throw new IllegalStateException("'deleteRealm() is not supported for sync for now."); <END> } return BaseRealm.deleteRealm(configuration); }</code><technical_language>supported for synchronized Realms for now</technical_language>

Target:
public static boolean deleteRealm(RealmConfiguration configuration) { return BaseRealm.deleteRealm(configuration); }
Source:
<code>public static JwtClaimsSet.Builder jwtClaimsSet() { String issuer = "<LINK_0>"; Instant issuedAt = Instant.now(); Instant expiresAt = issuedAt.plus(1, ChronoUnit.HOURS); return JwtClaimsSet.withClaims() .issuer(issuer) .subject("subject") .audience(Collections.singletonList("client-1")) .issuedAt(issuedAt) .notBefore(issuedAt) .expiresAt(expiresAt) <START> .id(UUID.randomUUID().toString()) <END> .claim("custom-claim-name", "custom-claim-value"); }</code><technical_language>Avoid of random generating test objects. is costly in terms of performance errors difficult track</technical_language>

Target:
public static JwtClaimsSet.Builder jwtClaimsSet() { String issuer = "<LINK_0>"; Instant issuedAt = Instant.now(); Instant expiresAt = issuedAt.plus(1, ChronoUnit.HOURS); return JwtClaimsSet.builder() .issuer(issuer) .subject("subject") .audience(Collections.singletonList("client-1")) .issuedAt(issuedAt) .notBefore(issuedAt) .expiresAt(expiresAt) .id("jti") .claim("custom-claim-name", "custom-claim-value"); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } HistogramBucket other = (HistogramBucket) obj; if (fNbEvents != other.fNbEvents) { return false; } <START> return (fNbEvents == 0 && Arrays.equals(fEvents, other.fEvents)); <END> }</code><technical_language>This is equivalent. && ||</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } HistogramBucket other = (HistogramBucket) obj; if (fNbEvents != other.fNbEvents) { return false; } return !(fNbEvents != 0 && !Arrays.equals(fEvents, other.fEvents)); }
Source:
<code>public TaskStatesPage getTaskPaginated(String jobId, int offset, int limit) <START> throws NotConnectedException, UnknownJobException, PermissionException { <END> TaskStatesPage taskStatesPage = null; try { List<TaskState> taskStates = restApi().getJobTaskStatesPaginated(sid, jobId, offset, limit) .getList() .stream() .map(taskStateData -> taskState(taskStateData)) .collect(Collectors.toList()); taskStatesPage = new TaskStatesPage(); taskStatesPage.setSize(limit); taskStatesPage.setTaskStates(taskStates); } catch (Exception e) { throwUJEOrNCEOrPE(e); } return taskStatesPage; }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Remove redundant '!unknownSymbol!' thrown exception declaration(s). [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
public TaskStatesPage getTaskPaginated(String jobId, int offset, int limit) throws NotConnectedException, UnknownJobException, PermissionException { TaskStatesPage taskStatesPage = null; try { final int size = restApi().getJobTaskStates(sid, jobId).getList().size(); List<TaskState> taskStates = restApi().getJobTaskStatesPaginated(sid, jobId, offset, limit) .getList() .stream() .map(DataUtility::taskState) .collect(Collectors.toList()); taskStatesPage = new TaskStatesPage(); taskStatesPage.setSize(size); taskStatesPage.setTaskStates(taskStates); } catch (Exception e) { throwUJEOrNCEOrPE(e); } return taskStatesPage; }
Source:
<code>protected void testExecute() throws Exception { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); CourseAttributes courseAttributes = logic.getCourse(instructor1OfCourse1.getCourseId()); loginAsInstructor(instructor1OfCourse1.googleId); ______TS("Not enough parameters"); verifyHttpParameterFailure(); ______TS("typical success case for instructor"); String[] params = { Const.ParamsNames.COURSE_ID, instructor1OfCourse1.getCourseId(), }; GetCourseAction getCourseAction = getAction(params); JsonResult response = getJsonResult(getCourseAction); assertEquals(HttpStatus.SC_OK, response.getStatusCode()); CourseData courseData = (CourseData) response.getOutput(); <START> assertEquals(courseAttributes.getId(), courseData.getCourseId()); <END> assertEquals(courseAttributes.getName(), courseData.getCourseName()); assertEquals(courseAttributes.getTimeZone().getId(), courseData.getTimeZone()); }</code><technical_language>Suggest change courseAttributes expectedCourse</technical_language>

Target:
protected void testExecute() throws Exception { }
Source:
<code><START> public void registerHandler(HandlerRegistration reg) { <END> if (reg != null && !handlerRegistrations.contains(reg)) { handlerRegistrations.add(reg); } }</code><technical_language>I this final</technical_language>

Target:
public final void registerHandler(HandlerRegistration reg) { if (reg != null && !handlerRegistrations.contains(reg)) { handlerRegistrations.add(reg); } }
Source:
<code>public void startEditingCellPointCoordinateWithinGridBounds() { final ArgumentCaptor<GridBodyCellRenderContext> contextArgumentCaptor = ArgumentCaptor.forClass(GridBodyCellRenderContext.class); final ArgumentCaptor<GridBodyCellEditContext> editContextArgumentCaptor = ArgumentCaptor.forClass(GridBodyCellEditContext.class); <START> cellSelectionManager.startEditingCell(new Point2D(150, <END> 42)); verify(col2, times(1)).edit(any(GridCell.class), contextArgumentCaptor.capture(), any(Callback.class)); verify(col2, times(1)).edit(any(GridCell.class), editContextArgumentCaptor.capture(), any(Callback.class)); final GridBodyCellRenderContext context = contextArgumentCaptor.getValue(); assertEquals(0, context.getRowIndex()); assertEquals(1, context.getColumnIndex()); final GridBodyCellEditContext editContext = editContextArgumentCaptor.getValue(); assertTrue(editContext.getRelativeLocation().isPresent()); assertEquals(150, editContext.getRelativeLocation().get().getX(), 0.0); assertEquals(42, editContext.getRelativeLocation().get().getY(), 0.0); }</code><technical_language>please extract point: java final Point2D editedAtPoint = new Point2D(150, 42);</technical_language>

Target:
public void startEditingCellPointCoordinateWithinGridBounds() { final ArgumentCaptor<GridBodyCellRenderContext> contextArgumentCaptor = ArgumentCaptor.forClass(GridBodyCellRenderContext.class); final ArgumentCaptor<GridBodyCellEditContext> editContextArgumentCaptor = ArgumentCaptor.forClass(GridBodyCellEditContext.class); final Point2D editedAtPoint = new Point2D(150, 42); cellSelectionManager.startEditingCell(editedAtPoint); verify(col2, times(1)).edit(any(GridCell.class), contextArgumentCaptor.capture(), any(Callback.class)); verify(col2, times(1)).edit(any(GridCell.class), editContextArgumentCaptor.capture(), any(Callback.class)); final GridBodyCellRenderContext context = contextArgumentCaptor.getValue(); assertEquals(0, context.getRowIndex()); assertEquals(1, context.getColumnIndex()); final GridBodyCellEditContext editContext = editContextArgumentCaptor.getValue(); assertTrue(editContext.getRelativeLocation().isPresent()); assertEquals(editedAtPoint, editContext.getRelativeLocation().get()); }
Source:
<code>public void shiftColumns(int startColumn, int endColumn, int n){ <START> throw new RuntimeException("NotImplemented"); <END> }</code><technical_language>UnsupportedOperationException</technical_language>

Target:
public void shiftColumns(int startColumn, int endColumn, int n){ throw new UnsupportedOperationException("NotImplemented"); }
Source:
<code>public DocumentModelList getRegistrationsForUser(final String docId, final String username, final String configurationName) { final DocumentModelList registrationDocs = new DocumentModelListImpl(); new UnrestrictedSessionRunner(getTargetRepositoryName()) { @Override public void run() { String query = "SELECT * FROM Document WHERE ecm:currentLifeCycleState != 'validated' AND" + " ecm:mixinType = '" + getConfiguration(configurationName).getRequestDocType() <START> + "' AND docinfo:documentId = '%s' AND " <END> + getConfiguration(configurationName).getUserInfoUsernameField() + " = '%s' AND ecm:isVersion = 0"; query = String.format(query, docId, username); registrationDocs.addAll(session.query(query)); } }.runUnrestricted(); return registrationDocs; }</code><technical_language>While modifying query, interesting rework %s instead of a mix of concatenation %s</technical_language>

Target:
public DocumentModelList getRegistrationsForUser(final String docId, final String username, final String configurationName) { final DocumentModelList registrationDocs = new DocumentModelListImpl(); new UnrestrictedSessionRunner(getTargetRepositoryName()) { @Override public void run() { String query = "SELECT * FROM Document WHERE ecm:currentLifeCycleState != 'validated'" + " AND ecm:mixinType = '%s' AND docinfo:documentId = '%s'" + " AND %s = '%s' AND ecm:isVersion = 0"; UserRegistrationConfiguration configuration = getConfiguration(configurationName); query = String.format(query, configuration.getRequestDocType(), docId, configuration.getUserInfoUsernameField(), username); registrationDocs.addAll(session.query(query)); } }.runUnrestricted(); return registrationDocs; }
Source:
<code>public void verifyDisablingOfTracker() throws Exception { AbfsPerfTracker abfsPerfTracker = new AbfsPerfTracker(accountName, filesystemName, false); String latencyDetails = abfsPerfTracker.getClientLatency(); assertThat(latencyDetails).describedAs("AbfsPerfTracker should be empty").isNull(); try (AbfsPerfInfo tracker = new AbfsPerfInfo(abfsPerfTracker, "disablingCaller", "disablingCallee")) { <START> tracker.registerResult(new AbfsHttpOperation(url, "GET", new ArrayList<>())).registerSuccess(true); <END> } latencyDetails = abfsPerfTracker.getClientLatency(); assertThat(latencyDetails).describedAs("AbfsPerfTracker should return no record").isNull(); }</code><technical_language>Extract</technical_language>

Target:
public void verifyDisablingOfTracker() throws Exception { AbfsPerfTracker abfsPerfTracker = new AbfsPerfTracker(accountName, filesystemName, false); String latencyDetails = abfsPerfTracker.getClientLatency(); assertThat(latencyDetails).describedAs("AbfsPerfTracker should be empty").isNull(); try (AbfsPerfInfo tracker = new AbfsPerfInfo(abfsPerfTracker, "disablingCaller", "disablingCallee")) { AbfsHttpOperation op = new AbfsHttpOperation(url, "GET", new ArrayList<>()); tracker.registerResult(op).registerSuccess(true); } latencyDetails = abfsPerfTracker.getClientLatency(); assertThat(latencyDetails).describedAs("AbfsPerfTracker should return no record").isNull(); }
Source:
<code><START> public void visitMethod(MethodTree tree) { <END> if (!isEquals(tree)) { super.visitMethod(tree); } }</code><technical_language>final. want classes extending override this, driving analysis</technical_language>

Target:
public final void visitMethod(MethodTree tree) { if (!isEquals(tree)) { super.visitMethod(tree); } }
Source:
<code><START> public String getPasswordFormat() { <END> return passwordFormat; }</code><technical_language>mentioned before, Enum here</technical_language>

Target:
public PasswordFormat getPasswordFormat() { return passwordFormat; }
Source:
<code>public static String getDebugStringFromDRId(long drId) { if (drId == Long.MAX_VALUE) { return "QUEUE EMPTY"; } if (drId < 0) { <START> return String.format("%d", drId); <END> } return String.format("%d:%d", getClusterIdFromDRId(drId), getSequenceNumberFromDRId(drId)); }</code><technical_language>empty DRID in this case, it? interested in cluster ID if empty</technical_language>

Target:
public static String getDebugStringFromDRId(long drId) { if (drId == Long.MAX_VALUE) { return "QUEUE EMPTY"; } if (isEmptyDRId(drId)) { return String.format("%d:Empty DR ID", getClusterIdFromDRId(drId)); } if (isInitialAckDRId(drId)) { if (drId == -1) { return "0:Init Ack ID"; } return String.format("%d:Init Ack ID", getClusterIdFromDRId(drId) + 1); } return String.format("%d:%d", getClusterIdFromDRId(drId), getSequenceNumberFromDRId(drId)); }
Source:
<code>public void onProcessSelectionEvent(@Observes ProcessInstanceSelectionEvent event) { <START> boolean resetTabs = (processInstanceId != event.getProcessInstanceId()); <END> deploymentId = event.getDeploymentId(); processId = event.getProcessDefId(); processInstanceId = event.getProcessInstanceId(); serverTemplateId = event.getServerTemplateId(); selectedDeploymentId = event.getDeploymentId(); selectedProcessInstanceStatus = event.getProcessInstanceStatus(); selectedProcessDefName = event.getProcessDefName(); setIsForLog(event.isForLog()); changeTitleWidgetEvent.fire(new ChangeTitleWidgetEvent(this.place, String.valueOf(processInstanceId) + " - " + selectedProcessDefName)); boolean signalAbortVisible = false; if (isForLog()) { view.displayOnlyLogTab(); } else { if (selectedProcessInstanceStatus == ProcessInstance.STATE_ACTIVE) { signalAbortVisible = true; } view.displayAllTabs(); } setSignalAbortActionsVisible(signalAbortVisible); if (resetTabs) { view.resetTabs(event.isForLog()); } }</code><technical_language>@nmirasch this needs fixed</technical_language>

Target:
public void onProcessSelectionEvent(@Observes ProcessInstanceSelectionEvent event) { boolean refreshDetails = (event != null && event.getProcessInstanceId() != null && event.getProcessInstanceId().equals(processInstanceId)); deploymentId = event.getDeploymentId(); processId = event.getProcessDefId(); processInstanceId = event.getProcessInstanceId(); serverTemplateId = event.getServerTemplateId(); selectedDeploymentId = event.getDeploymentId(); selectedProcessInstanceStatus = event.getProcessInstanceStatus(); selectedProcessDefName = event.getProcessDefName(); setIsForLog(event.isForLog()); changeTitleWidgetEvent.fire(new ChangeTitleWidgetEvent(this.place, String.valueOf(processInstanceId) + " - " + selectedProcessDefName)); boolean signalAbortVisible = false; if (isForLog()) { view.displayOnlyLogTab(); } else { if (selectedProcessInstanceStatus == ProcessInstance.STATE_ACTIVE) { signalAbortVisible = true; } view.displayAllTabs(); } setSignalAbortActionsVisible(signalAbortVisible); if (!refreshDetails) { view.resetTabs(event.isForLog()); } }
Source:
<code>public TaskConfig convertJsonToTaskConfig(String configJson) { Map<String, Object> configMap = (Map) new GsonBuilder().create().fromJson(configJson, Object.class); TaskConfig taskConfig = new TaskConfig(); for (Map.Entry<String, Object> entry : configMap.entrySet()) { TaskConfigProperty property = new TaskConfigProperty(entry.getKey(), null); Map propertyValue = (Map) entry.getValue(); if (propertyValue != null) { property.withDefault((String) propertyValue.get("default-value")); property.with(Property.SECURE, (Boolean) propertyValue.get("secure")); property.with(Property.REQUIRED, (Boolean) propertyValue.get("required")); <START> property.with(Property.DISPLAY_NAME, (String) propertyValue.get("display-name")); <END> if (!StringUtil.isBlank((String) propertyValue.get("display-order"))) { property.with(Property.DISPLAY_ORDER, Integer.parseInt((String) propertyValue.get("display-order"))); } } taskConfig.add(property); } return taskConfig; }</code><technical_language>i understand need for display-name & display-order</technical_language>

Target:
public TaskConfig convertJsonToTaskConfig(String configJson) { Map<String, Object> configMap = (Map) new GsonBuilder().create().fromJson(configJson, Object.class); TaskConfig taskConfig = new TaskConfig(); for (Map.Entry<String, Object> entry : configMap.entrySet()) { TaskConfigProperty property = new TaskConfigProperty(entry.getKey(), null); Map propertyValue = (Map) entry.getValue(); if (propertyValue != null) { property.withDefault((String) propertyValue.get("default-value")); property.with(Property.SECURE, (Boolean) propertyValue.get("secure")); property.with(Property.REQUIRED, (Boolean) propertyValue.get("required")); } taskConfig.add(property); } return taskConfig; }
Source:
<code>private List<Service> getServices(String serviceClass, String serviceFilter, boolean ocdRequired) throws InvalidSyntaxException { List<Service> serviceList = new ArrayList<>(); String newFilter = null; if (serviceFilter != null) { newFilter = serviceFilter.replace("service.factoryPid", "service.pid"); } ServiceReference[] refs = this.getBundleContext().getAllServiceReferences(serviceClass, newFilter); for (int i = 0; refs != null && i < refs.length; i++) { Object pidObject = refs[i].getProperty(SERVICE_PID); if (pidObject instanceof String && isAllowedPid((String) pidObject)) { String pid = (String) pidObject; String name = pid; boolean haveOcd = !ocdRequired; final ObjectClassDefinition ocd = getObjectClassDefinition(refs[i].getBundle(), pid); if (ocd != null) { name = ocd.getName(); haveOcd = true; } if (haveOcd) { Service service = new ServiceImpl(); service.setId(pid); <START> if(StringUtils.isNotEmpty(ocd.getDescription())) { <END> service.setDescription(ocd.getDescription()); } service.setName(name); serviceList.add(service); } } } return serviceList .stream() .filter(service -> isPermittedToViewService(service.getId())) .collect(Collectors.toList()); }</code><technical_language>Avoid retrieving description twice. Call ocd.getDescription() cache</technical_language>

Target:
private List<Service> getServices(String serviceClass, String serviceFilter, boolean ocdRequired) throws InvalidSyntaxException { List<Service> serviceList = new ArrayList<>(); String newFilter = null; if (serviceFilter != null) { newFilter = serviceFilter.replace("service.factoryPid", "service.pid"); } ServiceReference[] refs = this.getBundleContext().getAllServiceReferences(serviceClass, newFilter); for (int i = 0; refs != null && i < refs.length; i++) { Object pidObject = refs[i].getProperty(SERVICE_PID); if (pidObject instanceof String && isAllowedPid((String) pidObject)) { String pid = (String) pidObject; String name = pid; boolean haveOcd = !ocdRequired; final ObjectClassDefinition ocd = getObjectClassDefinition(refs[i].getBundle(), pid); if (ocd != null) { name = ocd.getName(); haveOcd = true; } if (haveOcd) { Service service = new ServiceImpl(); String description = ocd.getDescription(); service.setId(pid); if (StringUtils.isNotEmpty(description)) { service.setDescription(description); } service.setName(name); serviceList.add(service); } } } return serviceList .stream() .filter(service -> isPermittedToViewService(service.getId())) .collect(Collectors.toList()); }
Source:
<code>EventHubProperties( final String name, final Instant createdAt, final String[] partitionIds) { this.name = name; this.createdAt = createdAt; <START> this.partitionIds = partitionIds != null <END> ? new IterableStream<>(Arrays.asList(partitionIds)) : new IterableStream<>(Collections.emptyList()); }</code><technical_language>partitionIds null if is, bubble error</technical_language>

Target:
EventHubProperties(final String name, final Instant createdAt, final String[] partitionIds) { this.name = Objects.requireNonNull(name, "'name' cannot be null."); this.createdAt = Objects.requireNonNull(createdAt, "'createdAt' cannot be null."); this.partitionIds = new IterableStream<>(Arrays.asList( Objects.requireNonNull(partitionIds, "'partitionIds' cannot be null."))); }
Source:
<code>public void warmup() { <START> log.info("===WARMUP==="); <END> values = new String[valueCount]; for (int k = 0; k < values.length; k++) { values[k] = makeString(valueLength); } for (int i = 0; i < maxMaps; i++) { IMap map = targetInstance.getMap(basename + i); for (int count = 0; count < mapEntryListenerCount; count++) { EntryListenerImpl l = new EntryListenerImpl(mapEntryListenerDelayMills); listeners.add(l); map.addEntryListener(l, true); } for (int count = 0; count < localMapEntryListenerCount; count++) { EntryListenerImpl l = new EntryListenerImpl(localMapEntryListenerDelayMills); listeners.add(l); map.addLocalEntryListener(l); } int v = 0; for (int k = 0; k < keyCount; k++) { map.put(k, values[v]); v = (v + 1 == values.length ? 0 : v + 1); } } log.info("===WARMUP==="); }</code><technical_language>Logging needed; provided worker</technical_language>

Target:
public void warmup() { values = new String[valueCount]; for (int k = 0; k < values.length; k++) { values[k] = makeString(valueLength); } for (int i = 0; i < maxMaps; i++) { IMap map = targetInstance.getMap(basename + i); for (int count = 0; count < mapEntryListenerCount; count++) { EntryListenerImpl l = new EntryListenerImpl(mapEntryListenerDelayMills); listeners.add(l); map.addEntryListener(l, true); } for (int count = 0; count < localMapEntryListenerCount; count++) { EntryListenerImpl l = new EntryListenerImpl(localMapEntryListenerDelayMills); listeners.add(l); map.addLocalEntryListener(l); } int v = 0; for (int k = 0; k < keyCount; k++) { map.put(k, values[v]); v = (v + 1 == values.length ? 0 : v + 1); } } }
Source:
<code>public FeatureScenario[] getFeatureDetails() { <START> List<Feature> features = Features.getFeatures(); <END> FeatureScenario[] list_tfs = new FeatureScenario[0]; for (Feature feature : features){ String featureName = feature.getName(); String deviceName = feature.getDeviceName(); Element[] scenarios = feature.getElements(); for (Element scenario : scenarios){ if(scenario.isScenario()){ String scenarioName = scenario.getName(); String scenarioStatus = scenario.getStatus().toString(); String line = scenario.getLine(); FeatureScenario trendFeatureScenario = new FeatureScenario(deviceName, featureName, scenarioName, scenarioStatus,line); list_tfs = (FeatureScenario[]) ArrayUtils.add(list_tfs, trendFeatureScenario); } } } return list_tfs; }</code><technical_language>static class, static methods</technical_language>

Target:
public FeatureScenario[] getFeatureDetails() { FeatureScenario[] featureScenarios = new FeatureScenario[0]; for (Feature feature : features){ String featureName = feature.getName(); String deviceName = feature.getDeviceName(); Element[] scenarios = feature.getElements(); for (Element scenario : scenarios){ if(scenario.isScenario()){ String scenarioName = scenario.getName(); String scenarioStatus = scenario.getStatus().toString(); String line = scenario.getLine(); FeatureScenario trendFeatureScenario = new FeatureScenario(deviceName, featureName, scenarioName, scenarioStatus,line); featureScenarios = (FeatureScenario[]) ArrayUtils.add(featureScenarios, trendFeatureScenario); } } } return featureScenarios; }
Source:
<code>public void contextInitialized(ServletContextEvent sce) { servletContext = sce.getServletContext(); final JGitFileSystemProvider fsProvider = resolveProvider(); <START> if (fsProvider != null && fsProvider.getConfig().isHttpEnabled()) { <END> if (fsProvider.getConfig().isHttpEnabled()) { fsProvider.addHostName("http", fsProvider.getConfig().getHttpHostName() + ":" + fsProvider.getConfig().getHttpPort() + servletContext.getContextPath() + "/" + GIT_PATH); } if (fsProvider.getConfig().isHttpsEnabled()) { fsProvider.addHostName("https", fsProvider.getConfig().getHttpsHostName() + ":" + fsProvider.getConfig().getHttpsPort() + servletContext.getContextPath() + "/" + GIT_PATH); } final GitServlet gitServlet = new GitServlet(); gitServlet.setRepositoryResolver(fsProvider.getRepositoryResolver()); gitServlet.setAsIsFileService(null); gitServlet.setReceivePackFactory((req, db) -> fsProvider.getReceivePack("http", req, db)); ServletRegistration.Dynamic sd = servletContext.addServlet("GitServlet", gitServlet); sd.addMapping("/" + GIT_PATH + "/*"); sd.setLoadOnStartup(1); sd.setAsyncSupported(false); } }</code><technical_language>suggestion if (fsProvider != null) { this removed</technical_language>

Target:
public void contextInitialized(ServletContextEvent sce) { servletContext = sce.getServletContext(); final JGitFileSystemProvider fsProvider = resolveProvider(); if (fsProvider != null && (fsProvider.getConfig().isHttpEnabled() || fsProvider.getConfig().isHttpsEnabled())) { if (fsProvider.getConfig().isHttpEnabled()) { fsProvider.addHostName("http", fsProvider.getConfig().getHttpHostName() + ":" + fsProvider.getConfig().getHttpPort() + servletContext.getContextPath() + "/" + GIT_PATH); } if (fsProvider.getConfig().isHttpsEnabled()) { fsProvider.addHostName("https", fsProvider.getConfig().getHttpsHostName() + ":" + fsProvider.getConfig().getHttpsPort() + servletContext.getContextPath() + "/" + GIT_PATH); } final GitServlet gitServlet = new GitServlet(); gitServlet.setRepositoryResolver(fsProvider.getRepositoryResolver()); gitServlet.setAsIsFileService(null); gitServlet.setReceivePackFactory((req, db) -> fsProvider.getReceivePack("http", req, db)); ServletRegistration.Dynamic sd = servletContext.addServlet("GitServlet", gitServlet); sd.addMapping("/" + GIT_PATH + "/*"); sd.setLoadOnStartup(1); sd.setAsyncSupported(false); } }
Source:
<code>public boolean onContextItemSelected(final MenuItem item) { <START> BitmapDrawable currentDrawable = (BitmapDrawable) currentView.getDrawable(); <END> switch (item.getItemId()) { case R.id.image_open_file: viewImageInStandardApp(currentImage, currentDrawable); return true; case R.id.image_open_browser: if (currentImage != null) { currentImage.openInBrowser(activity); } return true; case R.id.menu_navigate: final Geopoint geopoint = geoPoints.get(currentView.getId()); if (geopoint != null) { NavigationAppFactory.showNavigationMenu(activity, null, null, geopoint); } return true; default: return false; } }</code><technical_language>Missing final</technical_language>

Target:
public boolean onContextItemSelected(final MenuItem item) { final BitmapDrawable currentDrawable = (BitmapDrawable) currentView.getDrawable(); switch (item.getItemId()) { case R.id.image_open_file: viewImageInStandardApp(currentImage, currentDrawable); return true; case R.id.image_open_browser: if (currentImage != null) { currentImage.openInBrowser(activity); } return true; case R.id.menu_navigate: final Geopoint geopoint = geoPoints.get(currentView.getId()); if (geopoint != null) { NavigationAppFactory.showNavigationMenu(activity, null, null, geopoint); } return true; default: return false; } }
Source:
<code>public void startSchedulingTasks() { Thread taskSchedulingThread = new Thread(taskScheduler); <START> taskSchedulingThread.start(); <END> }</code><technical_language>wondering, if a exception handling. know, if thread is stopped, some kind of fixed exception is thrown logged in perun-dispatcher.log, check nagios thread stopped why. deduce 5 exceptions. @licehammer suggest TaskSchedulerImpl if ok. Thank you</technical_language>

Target:
public void startSchedulingTasks() { Thread.UncaughtExceptionHandler h = new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable throwable) { log.error("Unknow exception was caught in TaskScheduler", throwable); } }; Thread t = new Thread(taskScheduler); t.setUncaughtExceptionHandler(h); t.start(); }
Source:
<code>public List<CatalogPartitionSpec> listPartitionsByFilter(ObjectPath tablePath, List<Expression> filters) throws TableNotExistException, TableNotPartitionedException, CatalogException { if (!supportListPartitionByFilter) { throw new UnsupportedOperationException("TestValuesCatalog doesn't support list partition by filters"); } List<CatalogPartitionSpec> partitions = listPartitions(tablePath); if (partitions.isEmpty()) { return partitions; } CatalogBaseTable table = this.getTable(tablePath); TableSchema schema = table.getSchema(); TestValuesTableFactory.FilterUtil util = TestValuesTableFactory.FilterUtil.INSTANCE; List<CatalogPartitionSpec> remainingPartitions = new ArrayList<>(); for (CatalogPartitionSpec partition : partitions) { boolean isRetained = true; <START> Function<String, Comparable<?>> gettter = getGetter(partition.getPartitionSpec(), schema); <END> for (Expression predicate : filters) { isRetained = util.isRetainedAfterApplyingFilterPredicates((ResolvedExpression) predicate, gettter); if (!isRetained) { break; } } if (isRetained) { remainingPartitions.add(partition); } } return remainingPartitions; }</code><technical_language>typo</technical_language>

Target:
public List<CatalogPartitionSpec> listPartitionsByFilter(ObjectPath tablePath, List<Expression> filters) throws TableNotExistException, TableNotPartitionedException, CatalogException { if (!supportListPartitionByFilter) { throw new UnsupportedOperationException("TestValuesCatalog doesn't support list partition by filters"); } List<CatalogPartitionSpec> partitions = listPartitions(tablePath); if (partitions.isEmpty()) { return partitions; } CatalogBaseTable table = this.getTable(tablePath); TableSchema schema = table.getSchema(); List<ResolvedExpression> resolvedExpressions = filters.stream() .map(filter -> { if (filter instanceof ResolvedExpression) { return (ResolvedExpression) filter; } throw new UnsupportedOperationException( String.format("TestValuesCatalog only works with resolved expressions. Get unresolved expression: %s", filter)); }) .collect(Collectors.toList()); return partitions.stream() .filter( partition -> { Function<String, Comparable<?>> getter = getValueGetter(partition.getPartitionSpec(), schema); return FilterUtils.isRetainedAfterApplyingFilterPredicates(resolvedExpressions, getter); }) .collect(Collectors.toList()); }
Source:
<code>public UpdateStackRequest createUpdateStackRequest(AuthenticatedContext ac, CloudStack stack, String cFStackName, String subnet, String cfTemplate) { return new UpdateStackRequest() .withStackName(cFStackName) .withTemplateBody(cfTemplate) .withTags(awsTaggingService.prepareCloudformationTags(ac, stack.getTags())) .withCapabilities(CAPABILITY_IAM) <START> .withParameters(getStackParameters(ac, stack, cFStackName, subnet)); <END> }</code><technical_language>Do want rename subnet newSubnetCidr match in getStackParameters. I assuming this is CIDR for subnet</technical_language>

Target:
public UpdateStackRequest createUpdateStackRequest(AuthenticatedContext ac, CloudStack stack, String cFStackName, String subnet, String cfTemplate) { return new UpdateStackRequest() .withStackName(cFStackName) .withParameters(getStackParameters(ac, stack, cFStackName, subnet)) .withTemplateBody(cfTemplate) .withTags(awsTaggingService.prepareCloudformationTags(ac, stack.getTags())) .withCapabilities(CAPABILITY_IAM); }
Source:
<code>public void validateParam(Object obj) throws Exception { ProxiesParamProxy mainProxy = getMainProxyPanel().getProxy(); String newAddress = mainProxy.getAddress(); int newPort = mainProxy.getPort(); if (!this.currentAddress.equals(newAddress) || this.currentPort != newPort) { if (!extension.canListenOn(newAddress, newPort) || extension.getAdditionalProxy(newAddress, newPort) != null) { <START> throw new Exception(Constant.messages.getString("options.proxy.dialog.proxy.warning.fail.message")); <END> } } }</code><technical_language>included address/port, hard problems</technical_language>

Target:
public void validateParam(Object obj) throws Exception { getSecurityProtocolsPanel().validateSecurityProtocols(); ProxiesParamProxy mainProxy = getMainProxyPanel().getProxy(); String newAddress = mainProxy.getAddress(); int newPort = mainProxy.getPort(); if (!this.currentAddress.equals(newAddress) || this.currentPort != newPort) { if (!extension.canListenOn(newAddress, newPort) || extension.getAdditionalProxy(newAddress, newPort) != null) { throw new Exception( Constant.messages.getString("options.proxy.dialog.proxy.warning.fail.message", newAddress, newPort)); } } }
Source:
<code>public ClientNettyPipelineBuilder addFraming() { add( "frame_encoder", new LengthFieldPrepender( 4 ) ); <START> add( "frame_decoder", new LengthFieldBasedFrameDecoder( Integer.MAX_VALUE, 0, 4, 0, 4 ) ); <END> return this; }</code><technical_language>4 a constant somewhere. Do need encoder decoder server client</technical_language>

Target:
public ClientNettyPipelineBuilder addFraming() { add( "frame_encoder", new LengthFieldPrepender( LENGTH_FIELD_BYTES ) ); add( "frame_decoder", new LengthFieldBasedFrameDecoder( Integer.MAX_VALUE, 0, LENGTH_FIELD_BYTES, 0, LENGTH_FIELD_BYTES ) ); return this; }
Source:
<code>public CallBatcher<Void, E> forArgsGenerator(CallArgsGenerator<E> generator, String forestName) { <START> return new CallBatcherImpl(client, caller, Void.class, generator, forestName); <END> }</code><technical_language>For consistency, move finishConstruction() call out of constructor line 110 chain call line 618</technical_language>

Target:
public CallBatcher<Void, E> forArgsGenerator(CallArgsGenerator<E> generator, String forestName) { return new CallBatcherImpl(client, caller, Void.class, generator, forestName).finishConstruction(); }
Source:
<code>public void deliver(final VoltMessage message) { if (SCHEDULE_IN_SITE_THREAD) { this.m_scheduler.getQueue().offer(new SiteTasker.SiteTaskerRunnable() { private String taskInfo = ""; @Override void run() { synchronized (InitiatorMailbox.this) { deliverInternal(message); } } <START> private SiteTasker.SiteTaskerRunnable init(VoltMessage message){ <END> taskInfo = message.getMessageInfo(); return this; } @Override public String getTaskInfo() { return taskInfo; } }.init(message)); } else { synchronized (this) { deliverInternal(message); } } }</code><technical_language>move init() getTaskInfo() base class SiteTaskerRunnable? If a wider picture of blocks site task queue, e.g. Iv2 volt messages, durability checks, repair log truncate messages some DR messages running site task queue</technical_language>

Target:
public void deliver(final VoltMessage message) { if (SCHEDULE_IN_SITE_THREAD) { this.m_scheduler.getQueue().offer(new SiteTasker.SiteTaskerRunnable() { @Override void run() { synchronized (InitiatorMailbox.this) { deliverInternal(message); } } private SiteTasker.SiteTaskerRunnable init(VoltMessage message){ taskInfo = message.getMessageInfo(); return this; } }.init(message)); } else { synchronized (this) { deliverInternal(message); } } }
Source:
<code>public @ResponseBody ObjectSpecification initializeMultipartUpload( @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = true) final String accessToken, @PathVariable(value = "object-id") String objectId, @RequestParam(value = "overwrite", required = false, defaultValue = "false") boolean overwrite, @RequestParam(value = "fileSize", required = true) long fileSize, @RequestParam(value = "md5", required = false) String md5, @RequestHeader(value = "User-Agent", defaultValue = "unknown") String userAgent, HttpServletRequest request) { log.info("Request received from client {}", userAgent); <START> String ipAddress = request.getHeader(com.google.common.net.HttpHeaders.X_FORWARDED_FOR); <END> if (ipAddress == null) { ipAddress = request.getRemoteAddr(); } log.info( "Initiating upload of object id with access token (MD5) having size of from using client version {}", objectId, TokenHasher.hashToken(accessToken), Long.toString(fileSize), ipAddress, userAgent); return uploadService.initiateUpload(objectId, fileSize, md5, overwrite); }</code><technical_language>Please lets repeat (seen 3 times). a utility put in a base class. Thanks</technical_language>

Target:
public @ResponseBody ObjectSpecification initializeMultipartUpload( @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = true) final String accessToken, @PathVariable(value = "object-id") String objectId, @RequestParam(value = "overwrite", required = false, defaultValue = "false") boolean overwrite, @RequestParam(value = "fileSize", required = true) long fileSize, @RequestParam(value = "md5", required = false) String md5, @RequestHeader(value = "User-Agent", defaultValue = "unknown") String userAgent, HttpServletRequest request) { log.info("Request received from client {}", userAgent); val ipAddress = RequestHeaderUtils.getIpAddress(request); log.info( "Initiating upload of object id with access token (MD5) having size of from using client version {}", objectId, TokenHasher.hashToken(accessToken), Long.toString(fileSize), ipAddress, userAgent); return uploadService.initiateUpload(objectId, fileSize, md5, overwrite); }
Source:
<code>public void destroy() throws Exception { for (ConnectionFactory connectionFactory : this.nodeFactories.values()) { <START> ((DisposableBean) connectionFactory).destroy(); <END> } if (this.defaultConnectionFactory instanceof DisposableBean) { ((DisposableBean) this.defaultConnectionFactory).destroy(); } }</code><technical_language>I for safety clear code instanceof DisposableBean</technical_language>

Target:
public void destroy() throws Exception { for (ConnectionFactory connectionFactory : this.nodeFactories.values()) { if (connectionFactory instanceof DisposableBean) { ((DisposableBean) connectionFactory).destroy(); } } if (this.defaultConnectionFactory instanceof DisposableBean) { ((DisposableBean) this.defaultConnectionFactory).destroy(); } }
Source:
<code>public void refreshableIsRepopulatedWithNewSupplierValuesAfterTheRefreshIntervalPasses() { AtomicLong atomicLong = new AtomicLong(); PollingRefreshable<Long> pollingRefreshable = PollingRefreshable.createWithSpecificPoller( atomicLong::incrementAndGet, scheduler); Refreshable<Long> refreshable = pollingRefreshable.getRefreshable(); <START> assertThat(refreshable.getAndClear()).isPresent().contains(1L); <END> scheduler.tick(PollingRefreshable.POLL_INTERVAL.toMillis() + 1, TimeUnit.MILLISECONDS); assertThat(refreshable.getAndClear()).isPresent().contains(2L); scheduler.tick(PollingRefreshable.POLL_INTERVAL.toMillis() + 1, TimeUnit.MILLISECONDS); assertThat(refreshable.getAndClear()).isPresent().contains(3L); }</code><technical_language>This occurs enough extract a method assertRefreshableContains(Refreshable, long)</technical_language>

Target:
public void refreshableIsRepopulatedWithNewSupplierValuesAfterTheRefreshIntervalPasses() { AtomicLong atomicLong = new AtomicLong(); PollingRefreshable<Long> pollingRefreshable = createPollingRefreshableWithTestScheduler( atomicLong::incrementAndGet); Refreshable<Long> refreshable = pollingRefreshable.getRefreshable(); assertRefreshableContainsAndClear(refreshable, 1L); scheduler.tick(REFRESH_INTERVAL.toMillis() + 1, TimeUnit.MILLISECONDS); assertRefreshableContainsAndClear(refreshable, 2L); scheduler.tick(REFRESH_INTERVAL.toMillis() + 1, TimeUnit.MILLISECONDS); assertRefreshableContainsAndClear(refreshable, 3L); }
Source:
<code>private void crawling() { try { <START> URL url = new URL("<LINK_0>"); <END> HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setConnectTimeout(10000); connection.setDoInput(true); connection.setRequestMethod("GET"); int respCode = connection.getResponseCode(); if (respCode == 200) { InputStream inputStream = connection.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len; while ((len = inputStream.read(buffer, 0, buffer.length)) != -1) { out.write(buffer, 0, len); } String jsonStr = new String(out.toByteArray()); recentContestList = JSON.parseArray(jsonStr, RecentContestDTO.class); } } catch (IOException ignored) { } }</code><technical_language>URL constant field</technical_language>

Target:
private void crawling() { try { URL url = new URL(REQUEST_URL); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setConnectTimeout(10000); connection.setDoInput(true); connection.setRequestMethod("GET"); int respCode = connection.getResponseCode(); if (respCode == 200) { InputStream inputStream = connection.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length; while ((length = inputStream.read(buffer, 0, buffer.length)) != -1) { out.write(buffer, 0, length); } String jsonStr = new String(out.toByteArray()); recentContestList = JSON.parseArray(jsonStr, RecentContestDTO.class); } } catch (IOException ignored) { } }
Source:
<code>protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { String sentence = (String) msg; int typeIndex = sentence.indexOf(":GT"); if (typeIndex < 0) { return null; } Object result; String type = sentence.substring(typeIndex + 3, typeIndex + 6); <START> if (typeIndex >= 4 && sentence.startsWith("+ACK", typeIndex - 4)) { <END> result = decodeAck(channel, remoteAddress, sentence, type); } else { switch (type) { case "INF": result = decodeInf(channel, remoteAddress, sentence); break; case "OBD": result = decodeObd(channel, remoteAddress, sentence); break; case "FRI": result = decodeFri(channel, remoteAddress, sentence); break; case "IGN": case "IGF": result = decodeIgn(channel, remoteAddress, sentence); break; case "IDA": result = decodeIda(channel, remoteAddress, sentence); break; default: result = decodeOther(channel, remoteAddress, sentence, type); break; } if (result == null) { result = decodeBasic(channel, remoteAddress, sentence); } if (result != null) { if (result instanceof Position) { ((Position) result).set(Position.KEY_TYPE, type); } else { for (Position p : (List<Position>) result) { p.set(Position.KEY_TYPE, type); } } } } return result; }</code><technical_language>check sentence.startsWith("+ACK")</technical_language>

Target:
protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { String sentence = (String) msg; int typeIndex = sentence.indexOf(":GT"); if (typeIndex < 0) { return null; } Object result; String type = sentence.substring(typeIndex + 3, typeIndex + 6); if (sentence.startsWith("+ACK")) { result = decodeAck(channel, remoteAddress, sentence, type); } else { switch (type) { case "INF": result = decodeInf(channel, remoteAddress, sentence); break; case "OBD": result = decodeObd(channel, remoteAddress, sentence); break; case "FRI": result = decodeFri(channel, remoteAddress, sentence); break; case "IGN": case "IGF": result = decodeIgn(channel, remoteAddress, sentence); break; case "IDA": result = decodeIda(channel, remoteAddress, sentence); break; default: result = decodeOther(channel, remoteAddress, sentence, type); break; } if (result == null) { result = decodeBasic(channel, remoteAddress, sentence); } if (result != null) { if (result instanceof Position) { ((Position) result).set(Position.KEY_TYPE, type); } else { for (Position p : (List<Position>) result) { p.set(Position.KEY_TYPE, type); } } } } return result; }
Source:
<code>public <A extends Annotation> boolean attributeOrRelationAnnotationExists( Class<?> cls, String fieldName, Class<A> annotationClass ) { ConcurrentHashMap<String, AccessibleObject> fieldOrMethods = getEntityBinding(cls).fieldsToValues; if (fieldOrMethods == null) { return false; } AccessibleObject fieldOrMethod = fieldOrMethods.get(fieldName); if (fieldOrMethod == null) { return false; } <START> return getAttributeOrRelationAnnotation(cls, annotationClass, EntityBinding.getFieldName(fieldOrMethod)) <END> != null; }</code><technical_language>This method collapsed just: java return getAttributeOrRelationAnnotation(cls, annotationClass, EntityBinding.getFieldName(fieldOrMethod)) != null</technical_language>

Target:
public <A extends Annotation> boolean attributeOrRelationAnnotationExists( Class<?> cls, String fieldName, Class<A> annotationClass ) { return getAttributeOrRelationAnnotation(cls, annotationClass, fieldName) != null; }
Source:
<code>private static boolean isImperativeExpressionVisible(MImperativeExpression exp, final ExpressionContext eContext) { Object imperativeExpressionObject = exp.getObject(); if (imperativeExpressionObject == null) { IContributionFactory contributionFactory = eContext.eclipseContext.get(IContributionFactory.class); Object newImperativeExpression = contributionFactory.create(exp.getContributionURI(), eContext.eclipseContext); exp.setObject(newImperativeExpression); imperativeExpressionObject = newImperativeExpression; } <START> if (imperativeExpressionObject == null) <END> return false; Object result = null; if (exp.isTracking()) { result = invoke(imperativeExpressionObject, Evaluate.class, eContext.eclipseContext, null, missingEvaluate); } else { result = ContextInjectionFactory.invoke(imperativeExpressionObject, Evaluate.class, eContext.eclipseContext, null, missingEvaluate); } if (result == missingEvaluate) { String className="null"; if (imperativeExpressionObject != null) { className = imperativeExpressionObject.getClass().getName(); } throw new IllegalStateException( "There is no method annotated with @Evaluate in the " + className + " imperative expression class " ); } return (boolean) result; }</code><technical_language>please put body block {}</technical_language>

Target:
private static boolean isImperativeExpressionVisible(MImperativeExpression exp, final ExpressionContext eContext) { Object imperativeExpressionObject = exp.getObject(); if (imperativeExpressionObject == null) { IContributionFactory contributionFactory = eContext.eclipseContext.get(IContributionFactory.class); Object newImperativeExpression = contributionFactory.create(exp.getContributionURI(), eContext.eclipseContext); exp.setObject(newImperativeExpression); imperativeExpressionObject = newImperativeExpression; } if (imperativeExpressionObject == null) { return false; } Object result = null; if (exp.isTracking()) { result = invoke(imperativeExpressionObject, Evaluate.class, eContext.eclipseContext, null, missingEvaluate); } else { result = ContextInjectionFactory.invoke(imperativeExpressionObject, Evaluate.class, eContext.eclipseContext, null, missingEvaluate); } if (result == missingEvaluate) { String className="null"; if (imperativeExpressionObject != null) { className = imperativeExpressionObject.getClass().getName(); } throw new IllegalStateException( "There is no method annotated with @Evaluate in the " + className + " imperative expression class " ); } return (boolean) result; }
Source:
<code>private void stressTestCreating(MotechDataService service, Class clazz) throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, ClassNotFoundException { EntityDto entityDto = entityService.getEntityByClassName(FOO_CLASS); for (int i = 0 ; i < TEST_INSTANCES; i++) { testInstances.add(generator.makeDummyInstance(entityDto.getId())); } Long startTime = System.nanoTime(); for (Object instance : testInstances) { service.create(instance); } <START> double endTime = (System.nanoTime() - startTime) / 1000000; <END> LOGGER.info("MDS Service: Creating " + TEST_INSTANCES + " instances took " + endTime + "ms."); logToFile(endTime); }</code><technical_language>this values Long</technical_language>

Target:
private void stressTestCreating(MotechDataService service, Class clazz) throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, ClassNotFoundException { EntityDto entityDto = entityService.getEntityByClassName(FOO_CLASS); for (int i = 0 ; i < TEST_INSTANCES; i++) { testInstances.add(generator.makeDummyInstance(entityDto.getId())); } Long startTime = System.nanoTime(); for (Object instance : testInstances) { service.create(instance); } Long endTime = (System.nanoTime() - startTime) / 1000000; LOGGER.info("MDS Service: Creating " + TEST_INSTANCES + " instances took " + endTime + "ms."); logToFile((double) endTime); }