auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private List<BaseProjectNode> createTopLevelProjectNodes(List<OmniEclipseProject> projects, List<IProject> faultyProjects) { List<BaseProjectNode> allProjectNodes = Lists.newArrayList(); <START> if(this.taskView.getState().isGroupProjects()) { <END> for (OmniEclipseProject project : projects) { if (project.getParent() == null) { OmniGradleProject gradleProject = project.getGradleProject(); Optional<IProject> workspaceProject = CorePlugin.workspaceOperations().findProjectByName(project.getName()); allProjectNodes.add(new ProjectNode(null,project,gradleProject, workspaceProject, isIncludedProject(workspaceProject, project))); } } } else { for (OmniEclipseProject project : projects) { if (project.getParent() == null) { collectProjectNodesRecursively(project, null, allProjectNodes); } } } for (IProject faultyProject : faultyProjects) { allProjectNodes.add(new FaultyProjectNode(faultyProject)); } return allProjectNodes; }</code><technical_language>I a naming here. express project hierarchy is (or is not) flattened in Tasks view. TaskViewState.isProjectHierarchyFlattened()</technical_language>

Target:
private List<BaseProjectNode> createTopLevelProjectNodes(List<OmniEclipseProject> projects, List<IProject> faultyProjects) { List<BaseProjectNode> allProjectNodes = Lists.newArrayList(); if (this.taskView.getState().isProjectHierarchyFlattened()) { for (OmniEclipseProject project : projects) { if (project.getParent() == null) { collectProjectNodesRecursively(project, null, allProjectNodes); } } } else { for (OmniEclipseProject project : projects) { if (project.getParent() == null) { OmniGradleProject gradleProject = project.getGradleProject(); Optional<IProject> workspaceProject = CorePlugin.workspaceOperations().findProjectByName(project.getName()); allProjectNodes.add(new ProjectNode(null,project,gradleProject, workspaceProject, isIncludedProject(workspaceProject, project))); } } } for (IProject faultyProject : faultyProjects) { allProjectNodes.add(new FaultyProjectNode(faultyProject)); } return allProjectNodes; }
Source:
<code>void getFormRecognizerClientAndValidate(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { FormRecognizerAsyncClient formRecognizerClient = getFormTrainingAsyncClient(httpClient, serviceVersion) .getFormRecognizerAsyncClient(); blankPdfDataRunner(data -> { SyncPoller<OperationResult, List<RecognizedReceipt>> syncPoller = formRecognizerClient.beginRecognizeReceipts( new RecognizeOptions(toFluxByteBuffer(data), BLANK_FORM_FILE_LENGTH) .setFormContentType(FormContentType.APPLICATION_PDF).setIncludeTextContent(false)) .getSyncPoller(); syncPoller.waitForCompletion(); <START> validateBlankPdfResultData(syncPoller.getFinalResult()); <END> }); }</code><technical_language>validateBlankPdfResultData() is this method is specific Receipt result lets update validateBlankReceiptResult()</technical_language>

Target:
void getFormRecognizerClientAndValidate(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { FormRecognizerAsyncClient formRecognizerClient = getFormTrainingAsyncClient(httpClient, serviceVersion) .getFormRecognizerAsyncClient(); blankPdfDataRunner(data -> { SyncPoller<OperationResult, List<RecognizedReceipt>> syncPoller = formRecognizerClient.beginRecognizeReceipts( new RecognizeOptions(toFluxByteBuffer(data), BLANK_FORM_FILE_LENGTH) .setFormContentType(FormContentType.APPLICATION_PDF).setPollInterval(durationTestMode)) .getSyncPoller(); syncPoller.waitForCompletion(); validateBlankPdfResultData(syncPoller.getFinalResult()); }); }
Source:
<code>public void DeleteAndRestoreMapTests_003_DeleteMapByNotOwner() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName2, credentials.password2, wikiURL); <START> InteractiveMapPageObject selectedMap = base.openInteractiveMapById(wikiURL, InteractiveMapsContent.mapToDeleteAndRestore); <END> String tryDeleteMapId = selectedMap.getEmbedMapID(); DeleteAMapComponentObject deleteMapModal = selectedMap.deleteMap(); deleteMapModal.clickDeleteMap(); deleteMapModal.verifyDeleteMapError(); }</code><technical_language>suggest another MapID for 003 break dependency 001 002 successful</technical_language>

Target:
public void DeleteAndRestoreMapTests_003_DeleteMapByNotOwner() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName2, credentials.password2, wikiURL); InteractiveMapPageObject selectedMap = base.openInteractiveMapById(wikiURL, InteractiveMapsContent.mapToDeleteAndRestore[1]); DeleteAMapComponentObject deleteMapModal = selectedMap.deleteMap(); deleteMapModal.clickDeleteMap(); Assertion.assertEquals(InteractiveMapsContent.mapDeleteError, deleteMapModal.getDeleteMapError()); }
Source:
<code>public static ObjectMapper getMsbJsonObjectMapper() { ObjectMapper mapper = new ObjectMapper() .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .setSerializationInclusion(JsonInclude.Include.NON_NULL) .registerModule(new JSR310Module()); <START> mapper.setVisibilityChecker(mapper.getSerializationConfig().getDefaultVisibilityChecker() <END> .withFieldVisibility(JsonAutoDetect.Visibility.ANY) .withGetterVisibility(JsonAutoDetect.Visibility.NONE) .withSetterVisibility(JsonAutoDetect.Visibility.NONE)); return mapper; }</code><technical_language>chain setting in previous statement</technical_language>

Target:
public static ObjectMapper getMsbJsonObjectMapper() { return new ObjectMapper() .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .setSerializationInclusion(JsonInclude.Include.NON_NULL) .registerModule(new JSR310Module()) .setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); }
Source:
<code>protected <T> T parseResponseStreamAndClose(InputStream inputStream, Class<T> clazz) throws IOException { try (InputStreamReader reader = new InputStreamReader(inputStream)) { T objectFromJson = GSON.fromJson(reader, clazz); if (objectFromJson == null) { <START> throw new IOException("Docker responded with an empty stream."); <END> } return objectFromJson; } catch (JsonParseException e) { throw new IOException(e.getLocalizedMessage(), e); } }</code><technical_language>Empty stream a user I suppose. in cases, e.g. 301 201, empty body is OK, this message frustrating a bit. WDYT next code instead: LOG.error("Docker response data, expected some. Stack trace: {}", Thread.currentThread().getStackTrace()); throw new IOException("Internal server error. Unexpected response body Docker daemon received.");</technical_language>

Target:
protected <T> T parseResponseStreamAndClose(InputStream inputStream, Class<T> clazz) throws IOException { try (InputStreamReader reader = new InputStreamReader(inputStream)) { T objectFromJson = GSON.fromJson(reader, clazz); if (objectFromJson == null) { LOG.error("Docker response doesn't contain any data, though it was expected to contain some."); throw new IOException("Internal server error. Unexpected response body received from Docker."); } return objectFromJson; } catch (JsonParseException e) { throw new IOException(e.getLocalizedMessage(), e); } }
Source:
<code>public Trigger getTrigger( @NonNull String triggerID) throws ThingIFException { if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } if (TextUtils.isEmpty(triggerID)) { throw new IllegalArgumentException("triggerID is null or empty"); } String path = MessageFormat.format("/thing-if/apps/{0}/targets/{1}/triggers/{2}", this.app.getAppID(), this.target.getTypedID().toString(), triggerID); String url = Path.combine(this.app.getBaseUrl(), path); Map<String, String> headers = this.newHeader(); IoTRestRequest request = new IoTRestRequest(url, IoTRestRequest.Method.GET, headers); JSONObject responseBody = this.restClient.sendRequest(request); try { Trigger trigger = this.gson.fromJson(responseBody.toString(), Trigger.class); <START> TriggerUtils.setTargetID(trigger, this.target.getTypedID()); <END> return trigger; }catch (JsonParseException ex) { if (ex.getCause() instanceof ThingIFException) { throw (ThingIFException) ex.getCause(); } else { throw ex; } } }</code><technical_language>@yongpingchen do adding target id responseBody? I reflection is good in this situation</technical_language>

Target:
public Trigger getTrigger( @NonNull String triggerID) throws ThingIFException { if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } if (TextUtils.isEmpty(triggerID)) { throw new IllegalArgumentException("triggerID is null or empty"); } String path = MessageFormat.format("/thing-if/apps/{0}/targets/{1}/triggers/{2}", this.app.getAppID(), this.target.getTypedID().toString(), triggerID); String url = Path.combine(this.app.getBaseUrl(), path); Map<String, String> headers = this.newHeader(); IoTRestRequest request = new IoTRestRequest(url, IoTRestRequest.Method.GET, headers); JSONObject responseBody = this.restClient.sendRequest(request); JsonObject triggerJson = new JsonParser().parse(responseBody.toString()).getAsJsonObject(); triggerJson.add("targetID", gson.toJsonTree(this.target.getTypedID())); try { return this.gson.fromJson(triggerJson, Trigger.class); }catch (JsonParseException ex) { if (ex.getCause() instanceof ThingIFException) { throw (ThingIFException) ex.getCause(); } else { throw ex; } } }
Source:
<code>public void testAllColumns(String searchTerm) throws DAOException { final String filter = ALL_COLUMNS.getFilterName(); HomePage homePage = new HomePage(driver); User admin = DBUtility.getAdmin(); UserInfoPage userInfoPage = homePage.logIn(admin.getLogin(), admin.getPassword()); AdministrationPage administrationPage = userInfoPage.clickAdministrationTab(); <START> for (SearchConditions conditions : SearchConditions.values()) { <END> administrationPage.setFilters(filter) .setCondition(conditions) .fillSearchField(searchTerm) .clickSearchButton(); usersListFromView = administrationPage.getTableFromView(); administrationPage.clearSearchField(); usersListFromDB = DBUtility.getUserDao().getFilteredUsers(conditions, searchTerm); Comparator<User> userComparator = Comparator.comparing(User::getLogin); Comparator<UserFromView> userFromViewComparator = Comparator.comparing(UserFromView::getLogin); usersListFromDB.sort(userComparator); usersListFromView.sort(userFromViewComparator); loggingSoftAssert.assertTrue(areListsEqual(usersListFromView, usersListFromDB), filter + " " + conditions + " " + searchTerm); loggingSoftAssert.assertAll(); } administrationPage.clickLogOutButton(); }</code><technical_language>conditions -> condition</technical_language>

Target:
public void testAllColumns(String searchTerm) throws DAOException { final SearchFilters filter = ALL_COLUMNS; HomePage homePage = new HomePage(driver); User admin = DBUtility.getAdmin(); UserInfoPage userInfoPage = homePage.logIn(admin.getLogin(), admin.getPassword()); AdministrationPage administrationPage = userInfoPage.clickAdministrationTab(); for (SearchConditions conditions : SearchConditions.values()) { administrationPage.setFilters(filter) .setCondition(conditions) .fillSearchField(searchTerm) .clickSearchButton(); usersListFromView = administrationPage.getTableFromView(); administrationPage.clearSearchField(); usersListFromDB = DBUtility.getUserDao().getFilteredUsers(conditions, searchTerm); Comparator<User> userComparator = Comparator.comparing(User::getLogin); Comparator<UserFromView> userFromViewComparator = Comparator.comparing(UserFromView::getLogin); usersListFromDB.sort(userComparator); usersListFromView.sort(userFromViewComparator); loggingSoftAssert.assertTrue(areListsEqual(usersListFromView, usersListFromDB), filter + " " + conditions + " " + searchTerm); loggingSoftAssert.assertAll(); } administrationPage.clickLogOutButton(); }
Source:
<code>public void tearDown() { try (Closer closer = Closer.create()) { closer.register(clients::clear); for (Entry<String, TransportClient> entry : clients.entrySet()) { closer.register(entry.getValue()); } <START> closer.register(() -> executor.shutdown()); <END> } catch (IOException e) { throw new UncheckedIOException(e); } }</code><technical_language>closer.register(executor::shutdown);</technical_language>

Target:
public void tearDown() { try (Closer closer = Closer.create()) { closer.register(clients::clear); for (Entry<String, TransportClient> entry : clients.entrySet()) { closer.register(entry.getValue()); } closer.register(executor::shutdown); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
<code>public void rawPredicate_invalidFieldName() { try { <START> realm.where(AllTypes.class).rawPredicate(("foo = 'test data 0'"); <END> fail(); } catch (IllegalStateException e) { assertEquals("No property 'foo' on object of type 'AllTypes'", e.getMessage()); } }</code><technical_language>syntax error extra (</technical_language>

Target:
public void rawPredicate_invalidFieldName() { try { realm.where(AllTypes.class).rawPredicate("foo = 'test data 0'"); fail(); } catch (IllegalStateException e) { assertEquals("No property 'foo' on object of type 'AllTypes'", e.getMessage()); } }
Source:
<code>public void test_call_java_objects() throws Throwable { Class<?> moduleClass = compileAndLoadGoloModule(SRC, "call-java-objects.golo"); Method new_integer = moduleClass.getMethod("new_integer"); assertThat((Integer) new_integer.invoke(null), is(666)); Method new_integer_from_imports = moduleClass.getMethod("new_integer_from_imports"); assertThat((Integer) new_integer_from_imports.invoke(null), is(666)); Method make_a_list = moduleClass.getMethod("make_a_list"); List<Integer> resultList = (List<Integer>) make_a_list.invoke(null); assertThat(resultList.size(), is(3)); assertThat(resultList, hasItems(1, 2, 3)); Method make_another_list = moduleClass.getMethod("make_another_list"); resultList = (List<Integer>) make_another_list.invoke(null); assertThat(resultList.size(), is(3)); assertThat(resultList, hasItems(1, 2, 3)); Method make_another_list_from_array = moduleClass.getMethod("make_another_list_from_array"); resultList = (List<Integer>) make_another_list_from_array.invoke(null); assertThat(resultList.size(), is(3)); assertThat(resultList, hasItems(1, 2, 3)); <START> <END> Method banged_singleton = moduleClass.getMethod("banged_singleton"); assertThat(banged_singleton.invoke(null),equalTo(banged_singleton.invoke(null))); }</code><technical_language>extract test lines a separate test case for _banged_ calls</technical_language>

Target:
public void test_call_java_objects() throws Throwable { Class<?> moduleClass = compileAndLoadGoloModule(SRC, "call-java-objects.golo"); Method new_integer = moduleClass.getMethod("new_integer"); assertThat((Integer) new_integer.invoke(null), is(666)); Method new_integer_from_imports = moduleClass.getMethod("new_integer_from_imports"); assertThat((Integer) new_integer_from_imports.invoke(null), is(666)); Method make_a_list = moduleClass.getMethod("make_a_list"); List<Integer> resultList = (List<Integer>) make_a_list.invoke(null); assertThat(resultList.size(), is(3)); assertThat(resultList, hasItems(1, 2, 3)); Method make_another_list = moduleClass.getMethod("make_another_list"); resultList = (List<Integer>) make_another_list.invoke(null); assertThat(resultList.size(), is(3)); assertThat(resultList, hasItems(1, 2, 3)); Method make_another_list_from_array = moduleClass.getMethod("make_another_list_from_array"); resultList = (List<Integer>) make_another_list_from_array.invoke(null); assertThat(resultList.size(), is(3)); assertThat(resultList, hasItems(1, 2, 3)); }
Source:
<code>protected Reader getContentReader( String mid, IResource resource, HttpServletRequest request, List<ICacheKeyGenerator> keyGens) throws IOException { String less = readToString(resource.getReader()); LessEngine engine = new LessEngine(); try { return new StringReader(engine.compile(less, resource.getURI().toString (), compress)); } catch (LessException e) { <START> e.printStackTrace(); <END> } return new StringReader(" \n" + less); }</code><technical_language>logging instead of printStackTrace. Also, handle exception. Instead, convert IOException RuntimeException (if necessary) exception propagate. handled a higher level</technical_language>

Target:
protected Reader getContentReader(String mid, IResource resource, HttpServletRequest request, List<ICacheKeyGenerator> keyGens) throws IOException { String less = readToString(resource.getReader()); try { return processCss(resource, request, LESS_ENGINE.compile(less, resource.getURI().toString())); } catch (LessException e) { throw new RuntimeException(e); } }
Source:
<code><START> public RuleMatch[] match(AnalyzedSentence sentence) { <END> List<RuleMatch> matches = new ArrayList<>(); AnalyzedTokenReadings[] tokens = sentence.getTokensWithoutWhitespace(); for (int i = 0; i < tokens.length; i++) { List<String> l = new ArrayList<>(); int j = 0; while (l.size() < maxLen && i+j < tokens.length) { l.add(tokens[i+j].getToken()); j++; String phrase = String.join(" ", l); String lcPhrase = phrase.toLowerCase(); String properSpelling = lcToProperSpelling.get(lcPhrase); if (properSpelling != null && !Utils.isAllUppercase(phrase) && !phrase.equals(properSpelling)) { if (i > 0 && tokens[i-1].isSentenceStart() && !Utils.startsWithUppercase(properSpelling)) { continue; } String msg; if (allWordsUppercase(properSpelling)) { msg = "If the term is a proper noun, use initial capitals."; } else { msg = "If the term is a proper noun, use the suggested capitalization."; } RuleMatch match = new RuleMatch(this, sentence, tokens[i].getStartPos(), tokens[i].getStartPos() + phrase.length(), msg); match.setSuggestedReplacement(properSpelling); matches.add(match); } } } return toRuleMatchArray(matches); }</code><technical_language>Is this a 1:1 copy? In case, introduce a class in core languages derive from, avoid duplication</technical_language>

Target:
public RuleMatch[] match(AnalyzedSentence sentence) { List<RuleMatch> matches = new ArrayList<>(); AnalyzedTokenReadings[] tokens = sentence.getTokensWithoutWhitespace(); for (int i = 0; i < tokens.length; i++) { List<String> l = new ArrayList<>(); int j = 0; while (l.size() < maxLen && i+j < tokens.length) { l.add(tokens[i+j].getToken()); j++; String phrase = String.join(" ", l); String lcPhrase = phrase.toLowerCase(); String properSpelling = lcToProperSpelling.get(lcPhrase); if (properSpelling != null && !Utils.isAllUppercase(phrase) && !phrase.equals(properSpelling)) { if (i > 0 && tokens[i-1].isSentenceStart() && !Utils.startsWithUppercase(properSpelling)) { continue; } String msg; if (allWordsUppercase(properSpelling)) { msg = "Más ainmfhocal dílis é, scríobh é i gceannlitreacha."; } else { msg = "If the term is a proper noun, use the suggested capitalization."; } RuleMatch match = new RuleMatch(this, sentence, tokens[i].getStartPos(), tokens[i].getStartPos() + phrase.length(), msg); match.setSuggestedReplacement(properSpelling); matches.add(match); } } } return toRuleMatchArray(matches); }
Source:
<code>private List<FeatureCollection> execute(GetFeatureInfoRequest request) throws Exception { final List<MapLayerInfo> requestedLayers = request.getQueryLayers(); FeatureInfoRequestParameters requestParams = new FeatureInfoRequestParameters(request); <START> if (!ClipWMSGetMapCallBack.validateClipParam(requestParams)) { <END> return Collections.EMPTY_LIST; } List<FeatureCollection> results = new ArrayList<FeatureCollection>(requestedLayers.size()); int maxFeatures = request.getFeatureCount(); List<LayerIdentifier> identifiers = GeoServerExtensions.extensions(LayerIdentifier.class); for (int i = 0; i < requestedLayers.size(); i++) { final MapLayerInfo layer = requestedLayers.get(i); try { LayerIdentifier identifier = getLayerIdentifier(layer, identifiers); List<FeatureCollection> identifiedCollections = identifier.identify(requestParams, maxFeatures); if (identifiedCollections != null) { for (FeatureCollection identifierCollection : identifiedCollections) { FeatureCollection fc = selectProperties(requestParams, identifierCollection); maxFeatures = addToResults(fc, results, layer, request, maxFeatures); } if (maxFeatures <= 0) { break; } } } catch (Exception e) { throw new ServiceException( "Failed to run GetFeatureInfo on layer " + layer.getName(), e); } requestParams.nextLayer(); } return results; }</code><technical_language>I this is right. A GetFeatureInfo a search buffer default a full rendering figure out _depicted_ point clicked. "Depicted" is key, a large point symbolizer, a small offset, source point is of clip. Conversely, a large point symbolizer allow render of clip a symbol origin is clip (you in WMS states sample, large square boxes of clip). this test is ineffective, data clipped in GetMap instead. roll a super-interface of GetMapCallback allows do this job, callback implement it? GetFeatureInfo.java call callbacks of course</technical_language>

Target:
private List<FeatureCollection> execute(GetFeatureInfoRequest request) throws Exception { final List<MapLayerInfo> requestedLayers = request.getQueryLayers(); FeatureInfoRequestParameters requestParams = new FeatureInfoRequestParameters(request); List<FeatureCollection> results = new ArrayList<FeatureCollection>(requestedLayers.size()); int maxFeatures = request.getFeatureCount(); List<LayerIdentifier> identifiers = GeoServerExtensions.extensions(LayerIdentifier.class); for (int i = 0; i < requestedLayers.size(); i++) { final MapLayerInfo layer = requestedLayers.get(i); try { LayerIdentifier identifier = getLayerIdentifier(layer, identifiers); List<FeatureCollection> identifiedCollections = identifier.identify(requestParams, maxFeatures); if (identifiedCollections != null) { for (FeatureCollection identifierCollection : identifiedCollections) { FeatureCollection fc = selectProperties(requestParams, identifierCollection); maxFeatures = addToResults(fc, results, layer, request, maxFeatures); } if (maxFeatures <= 0) { break; } } } catch (Exception e) { throw new ServiceException( "Failed to run GetFeatureInfo on layer " + layer.getName(), e); } requestParams.nextLayer(); } return results; }
Source:
<code>void assertParamValues(List<String> expectedValues, String paramName) throws URISyntaxException, InterruptedException { if (this.params == null) { this.params = this.actualParams(); } int paramsFound = 0; for (NameValuePair pair : params) { if (pair.getName().equals(paramName)) { assertEquals(expectedValues.get(paramsFound), pair.getValue()); paramsFound++; } } <START> assertTrue(paramsFound == expectedValues.size()); <END> }</code><technical_language>assertEquals</technical_language>

Target:
void assertParamValues(List<String> expectedValues, String paramName) throws URISyntaxException, InterruptedException { if (this.params == null) { this.params = this.actualParams(); } int paramsFound = 0; for (NameValuePair pair : params) { if (pair.getName().equals(paramName)) { assertEquals(expectedValues.get(paramsFound), pair.getValue()); paramsFound++; } } assertEquals(paramsFound, expectedValues.size()); }
Source:
<code>public void mergePatients_shouldChangeUserRecordsOfNonPreferredPersonToPreferredPerson() throws Exception { executeDataSet(USERS_WHO_ARE_PATIENTS_XML); Patient notPreferred = patientService.getPatient(2); voidOrders(Collections.singleton(notPreferred)); Calendar calendar = Calendar.getInstance(); calendar.set(1950, Calendar.FEBRUARY, 2); <START> patientService.getPatient(6).setBirthdate(calendar.getTime()); <END> Context.getPatientService().mergePatients(patientService.getPatient(6), notPreferred); User user = Context.getUserService().getUser(2); Assert.assertEquals(6, user.getPerson().getId().intValue()); }</code><technical_language>set birthdate in test dataset</technical_language>

Target:
public void mergePatients_shouldChangeUserRecordsOfNonPreferredPersonToPreferredPerson() throws Exception { executeDataSet(USERS_WHO_ARE_PATIENTS_XML); Patient notPreferred = patientService.getPatient(2); voidOrders(Collections.singleton(notPreferred)); Context.getPatientService().mergePatients(patientService.getPatient(6), notPreferred); User user = Context.getUserService().getUser(2); Assert.assertEquals(6, user.getPerson().getId().intValue()); }
Source:
<code>public void testTenantContextUnLoadInTenantIdle() throws LazyLoadingTestException { assertEquals(getTenantStatus(TENANT_DOMAIN_1).isTenantContextLoaded(), true, "Tenant context is not loaded after tenant loginTenantUser"); log.info("Waiting for Tenant context to un-load :" + TENANT_DOMAIN_1); <START> assertEquals(checkTenantAutoUnloading(TENANT_DOMAIN_1), true, "Tenant context is not unloaded after idle time"); <END> }</code><technical_language>assertTrue</technical_language>

Target:
public void testTenantContextUnLoadInTenantIdle() throws LazyLoadingTestException { assertTrue(getTenantStatus(tenantDomain1).isTenantContextLoaded(), "Tenant context is not loaded after tenant loginTenantUser"); log.info("Waiting for Tenant context to un-load :" + tenantDomain1); assertTrue(checkTenantAutoUnloading(tenantDomain1), "Tenant context is not unloaded after idle time"); }
Source:
<code>public void hashFirstNRowComponents(int numberOfComponents) { Preconditions.checkState(state == State.DEFINING_ROW_COMPONENTS); <START> Preconditions.checkState(rowComponents.isEmpty(), "hashRowComponent must be the first row component"); <END> numberOfComponentsHashed = numberOfComponents; ignoreHotspottingChecks = true; }</code><technical_language>"hashFirstNRowComponents row component"</technical_language>

Target:
public void hashFirstNRowComponents(int numberOfComponents) { Preconditions.checkState(numberOfComponents >= 0, "Need to specify a non-negative number of components to hash."); checkHashRowComponentsPreconditions("hashFirstNRowComponents"); numberOfComponentsHashed = numberOfComponents; ignoreHotspottingChecks = true; }
Source:
<code>private Connection openConnection() <START> { <END> try { MysqlDataSource dataSource = new MysqlDataSource(); dataSource.setServerName(data.get(0)); dataSource.setPort(Integer.parseInt(data.get(1))); dataSource.setDatabaseName(data.get(2)); dataSource.setUser(data.get(3)); dataSource.setPassword(data.get(4)); conn = dataSource.getConnection(); stat = conn.createStatement(); } catch (SQLException e) { e.printStackTrace(); } return conn; }</code><technical_language>Brace next class definition please</technical_language>

Target:
private Connection openConnection() { try { connection = dataSource.getConnection(); statement = connection.createStatement(); } catch (SQLException e) { e.printStackTrace(); } return connection; }
Source:
<code>public void powerDown() { rest(); purgeTasks(); disable(); if (ear != null) { <START> ear.lockOutAllGrammarExcept("wake up"); <END> } startSleep = System.currentTimeMillis(); python.execMethod("power_down"); }</code><technical_language>is hard coded ? bad. hard code lock out words... also.. change ? "power up" .. ask for changed</technical_language>

Target:
public void powerDown() { rest(); purgeTasks(); disable(); if (ear != null) { ear.lockOutAllGrammarExcept("power up"); } startSleep = System.currentTimeMillis(); python.execMethod("power_down"); }
Source:
<code>public static void main(String[] args) throws Exception { if (args.length < 5) { System.err.println("Usage: SimpePageRank <DOP> <pageWithRankInputPath> <adjacencyListInputPath> <outputPath> <numIterations>"); return; } final int dop = Integer.parseInt(args[0]); final String pageWithRankInputPath = args[1]; final String adjacencyListInputPath = args[2]; final String outputPath = args[3]; <START> final int numIterations = Integer.parseInt(args[4]); <END> run(dop, pageWithRankInputPath, adjacencyListInputPath, outputPath, numIterations, true); }</code><technical_language>call this maxIterations, actual number is determined termination criterion</technical_language>

Target:
public static void main(String[] args) throws Exception { if (args.length < 5) { System.err.println("Usage: SimpePageRank <DOP> <pageWithRankInputPath> <adjacencyListInputPath> <outputPath> <numIterations>"); return; } final int dop = Integer.parseInt(args[0]); final String pageWithRankInputPath = args[1]; final String adjacencyListInputPath = args[2]; final String outputPath = args[3]; final int maxIterations = Integer.parseInt(args[4]); run(dop, pageWithRankInputPath, adjacencyListInputPath, outputPath, maxIterations, true); }
Source:
<code>private TypeSubstitution inferTypeSubstitutionRec(MethodJavaSymbol method, List<JavaType> formals, List<JavaType> argTypes) { boolean isVarArgs = method.isVarArgs(); int numberFormals = formals.size(); int numberArgs = argTypes.size(); int numberParamToCheck = Math.min(numberFormals, numberArgs); List<JavaType> newArgTypes = new ArrayList<>(argTypes); TypeSubstitution substitution = new TypeSubstitution(); if (isVarArgs && numberFormals == numberArgs + 1) { numberParamToCheck += 1; newArgTypes.add(symbols.objectType); } for (int i = 0; i < numberParamToCheck; i++) { JavaType formalType = formals.get(i); JavaType argType = newArgTypes.get(i); boolean variableArity = isVarArgs && i == (numberFormals - 1); List<JavaType> remainingArgTypes = new ArrayList<>(newArgTypes.subList(i, newArgTypes.size())); substitution = inferTypeSubstitution(method, substitution, formalType, argType, variableArity, remainingArgTypes); <START> if (substitution.unchecked || (!method.isConstructor() && substitution.typeVariables().containsAll(method.typeVariableTypes))) { <END> break; } } return substitution; }</code><technical_language>substitution.isUnchecked()</technical_language>

Target:
private TypeSubstitution inferTypeSubstitutionRec(MethodJavaSymbol method, List<JavaType> formals, List<JavaType> argTypes) { boolean isVarArgs = method.isVarArgs(); int numberFormals = formals.size(); int numberArgs = argTypes.size(); int numberParamToCheck = Math.min(numberFormals, numberArgs); List<JavaType> newArgTypes = new ArrayList<>(argTypes); TypeSubstitution substitution = new TypeSubstitution(); if (isVarArgs && numberFormals == numberArgs + 1) { numberParamToCheck += 1; newArgTypes.add(symbols.objectType); } for (int i = 0; i < numberParamToCheck; i++) { JavaType formalType = formals.get(i); JavaType argType = newArgTypes.get(i); boolean variableArity = isVarArgs && i == (numberFormals - 1); List<JavaType> remainingArgTypes = new ArrayList<>(newArgTypes.subList(i, newArgTypes.size())); substitution = inferTypeSubstitution(method, substitution, formalType, argType, variableArity, remainingArgTypes); if (substitution.isUnchecked() || (!method.isConstructor() && substitution.typeVariables().containsAll(method.typeVariableTypes))) { break; } } return substitution; }
Source:
<code>protected void initClusterInvalidator(DBSRepositoryDescriptor descriptor) { String nodeId = descriptor.clusterNodeId; if (StringUtils.isBlank(nodeId)) { <START> nodeId = String.valueOf(RANDOM.nextInt(32768)); <END> log.warn("Missing cluster node id configuration, please define it explicitly " + "(usually through repository.clustering.id). Using random cluster node id instead: " + nodeId); } else { nodeId = nodeId.trim(); } clusterInvalidator = createClusterInvalidator(descriptor); clusterInvalidator.initialize(nodeId, this); }</code><technical_language>Please a bigger max value. limited small integers for VCS for historical reasons, limit here</technical_language>

Target:
protected void initClusterInvalidator(DBSRepositoryDescriptor descriptor) { String nodeId = descriptor.clusterNodeId; if (StringUtils.isBlank(nodeId)) { nodeId = String.valueOf(RANDOM.nextInt(Integer.MAX_VALUE)); log.warn("Missing cluster node id configuration, please define it explicitly " + "(usually through repository.clustering.id). Using random cluster node id instead: " + nodeId); } else { nodeId = nodeId.trim(); } clusterInvalidator = createClusterInvalidator(descriptor); clusterInvalidator.initialize(nodeId, this); }
Source:
<code>void saveEventType(EventType eventType) throws InternalNakadiException, DuplicatedEventTypeNameException; EventType findByName(String name) throws InternalNakadiException, NoSuchEventTypeException; void update(EventType eventType) throws InternalNakadiException, NoSuchEventTypeException; List<EventType> list(); void removeEventType(String name) throws InternalNakadiException, NoSuchEventTypeException; <START> void setEventTypeDeleted(String name) throws InternalNakadiException, NoSuchEventTypeException; <END> default Optional<EventType> findByNameO(final String eventTypeName) throws InternalNakadiException { try { return Optional.of(findByName(eventTypeName)); } catch (final NoSuchEventTypeException e) { return Optional.empty(); } catch (final InternalNakadiException e) { throw e; } }</code><technical_language>a client code perspective (invoking this method in a controller, for example) difficult difference removeEventType. thing. read implementation understand difference. Also, true deletion "stored deletion" time</technical_language>

Target:
void saveEventType(EventType eventType) throws InternalNakadiException, DuplicatedEventTypeNameException; EventType findByName(String name) throws InternalNakadiException, NoSuchEventTypeException; void update(EventType eventType) throws InternalNakadiException, NoSuchEventTypeException; List<EventType> list(); void archiveEventType(String name) throws InternalNakadiException, NoSuchEventTypeException; default Optional<EventType> findByNameO(final String eventTypeName) throws InternalNakadiException { try { return Optional.of(findByName(eventTypeName)); } catch (final NoSuchEventTypeException e) { return Optional.empty(); } catch (final InternalNakadiException e) { throw e; } }
Source:
<code>public int hashCode() { return set.hashCode(); <START> } <END></code><technical_language>Yeah this return set.get();</technical_language>

Target:
public int hashCode() { return set.get() * 3559; }
Source:
<code>public String getShareUrl(String id, String title) { <START> return null; <END> }</code><technical_language>URL in getResultById here</technical_language>

Target:
public String getShareUrl(String id, String title) { return getApiUrl() + "&view=detail&id=" + id; }
Source:
<code>void retry() throws JMSConnectorException { <START> logger.error("Re-connection will be attempted after " + retryInterval + " milli-seconds."); <END> try { TimeUnit.MILLISECONDS.sleep(retryInterval); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } while (retryCount < maxRetryCount) { try { retryCount++; jmsServerConnector.createMessageListener(); logger.info("Connected to the message broker after retrying for " + retryCount + " time(s)"); return; } catch (JMSConnectorException ex) { if (null != jmsServerConnector.getConnection()) { jmsServerConnector.closeAll(); throw new JMSConnectorException("JMS Connection succeeded but exception has occurred while " + "creating, session or consumer from the connection"); } jmsServerConnector.closeAll(); if (retryCount < maxRetryCount) { logger.error("Retry connection attempt " + retryCount + " to JMS Provider failed. Retry will be " + "attempted "); retryInterval = retryInterval * 2; try { TimeUnit.MILLISECONDS.sleep(retryInterval); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } } throw new JMSConnectorException( "Connection to the jms provider failed after retrying for " + retryCount + " times"); }</code><technical_language>This is "error" level. debug</technical_language>

Target:
void retry() throws JMSConnectorException { if (logger.isDebugEnabled()) { logger.debug("Re-connection will be attempted after " + retryInterval + " milli-seconds."); } try { TimeUnit.MILLISECONDS.sleep(retryInterval); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } while (retryCount < maxRetryCount) { try { retryCount++; jmsServerConnector.createMessageListener(); logger.info("Connected to the message broker after retrying for " + retryCount + " time(s)"); return; } catch (JMSConnectorException ex) { if (null != jmsServerConnector.getConnection()) { jmsServerConnector.closeAll(); throw new JMSConnectorException("JMS Connection succeeded but exception has occurred while " + "creating, session or consumer from the connection"); } jmsServerConnector.closeAll(); if (retryCount < maxRetryCount) { logger.error("Retry connection attempt " + retryCount + " to JMS Provider failed. Retry will be " + "attempted "); retryInterval = retryInterval * 2; try { TimeUnit.MILLISECONDS.sleep(retryInterval); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } } throw new JMSConnectorException( "Connection to the jms provider failed after retrying for " + retryCount + " times"); }
Source:
<code>private void addBondOptionIfMissing(String candidateOption, boolean doesBondHaveVmNetworkAttached) { <START> if (doesBondHaveVmNetworkAttached && BondMode.isBondModeValidForVmNetwork(candidateOption)){ <END> return; } if (!pairForBondOption.containsKey(candidateOption)) { EntityModel<String> entityModel = new EntityModel<String>(); entityModel.setEntity(candidateOption); Entry<String, EntityModel<String>> newPair = new KeyValuePairCompat<String, EntityModel<String>>("custom", entityModel); bondOptions.add(newPair); pairForBondOption.put(candidateOption, newPair); } }</code><technical_language>I lost '!'. Please fix in master (in master in new patch is merged)</technical_language>

Target:
private void addBondOptionIfMissing(String candidateOption, boolean doesBondHaveVmNetworkAttached) { if (doesBondHaveVmNetworkAttached && !BondMode.isBondModeValidForVmNetwork(candidateOption)){ return; } if (!pairForBondOption.containsKey(candidateOption)) { EntityModel<String> entityModel = new EntityModel<String>(); entityModel.setEntity(candidateOption); Entry<String, EntityModel<String>> newPair = new KeyValuePairCompat<String, EntityModel<String>>("custom", entityModel); bondOptions.add(newPair); pairForBondOption.put(candidateOption, newPair); } }
Source:
<code>private <T> T queryStringWithParameters(Map<String, Object> params, boolean singleResult, LockModeType lockMode, Class<T> clazz, Query query) { <START> ; <END> if (lockMode != null) { query.setLockMode(lockMode); } if (params != null && !params.isEmpty()) { for (String name : params.keySet()) { if (FIRST_RESULT.equals(name)) { query.setFirstResult((Integer) params.get(name)); continue; } else if (MAX_RESULTS.equals(name)) { if (((Integer) params.get(name)) > -1) { query.setMaxResults((Integer) params.get(name)); } continue; } else if (QueryManager.ASCENDING_KEY.equals(name) || QueryManager.DESCENDING_KEY.equals(name) || QueryManager.ORDER_BY_KEY.equals(name) || QueryManager.FILTER.equals(name)) { continue; } query.setParameter(name, params.get(name)); } } if (singleResult) { return (T) query.getSingleResult(); } return (T) query.getResultList(); }</code><technical_language>Unnecessary semicolon</technical_language>

Target:
private <T> T queryStringWithParameters(Map<String, Object> params, boolean singleResult, LockModeType lockMode, Class<T> clazz, Query query) { if (lockMode != null) { query.setLockMode(lockMode); } if (params != null && !params.isEmpty()) { for (String name : params.keySet()) { if (FIRST_RESULT.equals(name)) { query.setFirstResult((Integer) params.get(name)); continue; } else if (MAX_RESULTS.equals(name)) { if (((Integer) params.get(name)) > -1) { query.setMaxResults((Integer) params.get(name)); } continue; } else if (QueryManager.ASCENDING_KEY.equals(name) || QueryManager.DESCENDING_KEY.equals(name) || QueryManager.ORDER_BY_KEY.equals(name) || QueryManager.FILTER.equals(name)) { continue; } query.setParameter(name, params.get(name)); } } if (singleResult) { return (T) query.getSingleResult(); } return (T) query.getResultList(); }
Source:
<code>public Gauge registerOrGet(Class clazz, String metricName, Gauge gauge, Map<String, String> tag) { MetricName metricToAdd = MetricName.builder() .safeName(MetricRegistry.name(clazz, metricName)) .safeTags(tag) .build(); try { return taggedMetricRegistry.gauge(metricToAdd, gauge); } catch (IllegalArgumentException ex) { log.warn("Tried to add a gauge to a metric name that has non-gauge metrics associated with it." + " This indicates a product bug.", SafeArg.of("metricName", metricName), ex); <START> return gauge; <END> } }</code><technical_language>return if is registered</technical_language>

Target:
public Gauge registerOrGet(Class clazz, String metricName, Gauge gauge, Map<String, String> tag) { MetricName metricToAdd = MetricName.builder() .safeName(MetricRegistry.name(clazz, metricName)) .safeTags(tag) .build(); try { return taggedMetricRegistry.gauge(metricToAdd, gauge); } catch (IllegalArgumentException ex) { log.error("Tried to add a gauge to a metric name that has non-gauge metrics associated with it." + " This indicates a product bug.", SafeArg.of("metricName", metricName), ex); throw ex; } }
Source:
<code>private void attachRecyclerViewAdapter() { mAdapter = new FirebaseIndexRecyclerAdapter<Chat, ChatHolder>( Chat.class, R.layout.message, ChatHolder.class, mChatIndicesRef.limitToLast(50), mChatRef) { @Override public void populateViewHolder(final ChatHolder holder, Chat chat, int position) { holder.bind(chat); holder.itemView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.add("Delete") <START> .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { <END> @Override public boolean onMenuItemClick(MenuItem item) { DatabaseReference ref = getRef(holder.getAdapterPosition()); mChatIndicesRef.child(ref.getKey()).removeValue(); ref.removeValue(); return true; } }); } }); } @Override public void onChildChanged(EventType type, DataSnapshot snapshot, int index, int oldIndex) { super.onChildChanged(type, snapshot, index, oldIndex); onDataChanged(); } @Override public void onDataChanged() { mEmptyListMessage.setVisibility(getItemCount() == 0 ? View.VISIBLE : View.GONE); } }; mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onItemRangeInserted(int positionStart, int itemCount) { mManager.smoothScrollToPosition(mMessages, null, mAdapter.getItemCount()); } }); mMessages.setAdapter(mAdapter); }</code><technical_language>I idea ratio of "lines of code" "how teaches FirebaseUI" here. If a strong preference remove ChatActivity short possible</technical_language>

Target:
private void attachRecyclerViewAdapter() { mAdapter = getAdapter(); mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onItemRangeInserted(int positionStart, int itemCount) { mManager.smoothScrollToPosition(mMessages, null, mAdapter.getItemCount()); } }); mMessages.setAdapter(mAdapter); }
Source:
<code>public SegmentReader(String cursorId) { <START> m_cursorId = cursorId; <END> }</code><technical_language>precondition checks for null assert for tests please</technical_language>

Target:
public SegmentReader(String cursorId) { assert(cursorId != null); m_cursorId = cursorId; }
Source:
<code>public void handleRemoveEvent(CatalogRemoveEvent event) throws CatalogException { String resourceWorkSpaceName = null; CatalogInfo resourceInfo = event.getSource(); String resourceName = null; if (resourceInfo != null && resourceInfo instanceof LayerInfo) { resourceWorkSpaceName = ((LayerInfo) resourceInfo).getResource().getStore().getWorkspace().getName(); resourceName = ((LayerInfo) resourceInfo).getName(); } else if (resourceInfo != null && event.getSource() instanceof LayerGroupInfo) { resourceWorkSpaceName = ((LayerGroupInfo) resourceInfo).getWorkspace().getName(); resourceName = ((LayerGroupInfo) resourceInfo).getName(); } if (resourceWorkSpaceName != null && resourceInfo != null) { if (layerHasSecurityRule(resourceWorkSpaceName, resourceName)) { <START> LOGGER.info( <END> String.format( "Removing Security Rules for removed layer: %s", resourceName)); List<DataAccessRule> rulesToRemove = getDataAccessRule(resourceInfo, resourceName); for (DataAccessRule r : rulesToRemove) { dao.removeRule(r); } } } }</code><technical_language>Nice touch</technical_language>

Target:
public void handleRemoveEvent(CatalogRemoveEvent event) throws CatalogException { String resourceWorkSpaceName = null; CatalogInfo resourceInfo = event.getSource(); String resourceName = null; if (resourceInfo instanceof LayerInfo) { resourceWorkSpaceName = ((LayerInfo) resourceInfo).getResource().getStore().getWorkspace().getName(); resourceName = ((LayerInfo) resourceInfo).getName(); } else if (event.getSource() instanceof LayerGroupInfo) { resourceWorkSpaceName = ((LayerGroupInfo) resourceInfo).getWorkspace().getName(); resourceName = ((LayerGroupInfo) resourceInfo).getName(); } if (resourceWorkSpaceName != null && resourceInfo != null) { if (layerHasSecurityRule(resourceWorkSpaceName, resourceName)) { LOGGER.info( String.format( "Removing Security Rules for removed layer: %s", resourceName)); List<DataAccessRule> rulesToRemove = getDataAccessRule(resourceInfo, resourceName); for (DataAccessRule r : rulesToRemove) { dao.removeRule(r); } } } }
Source:
<code>private boolean sendWants(final Collection<Ref> want) throws IOException { final PacketLineOut p = statelessRPC ? pckState : pckOut; boolean first = true; for (final Ref r : want) { ObjectId objectId = r.getObjectId(); <START> if (objectId == null) { throw new TransportException(MessageFormat .format(JGitText.get().cannotRead, r.getName())); } <END> try { if (walk.parseAny(objectId).has(REACHABLE)) { continue; } } catch (IOException err) { } final StringBuilder line = new StringBuilder(46); line.append("want "); line.append(objectId.name()); if (first) { line.append(enableCapabilities()); first = false; } line.append('\n'); p.writeString(line.toString()); } if (first) return false; p.end(); outNeedsEnd = false; return true; }</code><technical_language>wants doFetch(), passed FetchConnection#fetch(). ref advertisement, point object id, in call chain validated us. People call Transport#fetch instead of protocol directly. Transport#fetch builds list of wants refs obtained Connection. objectId --- 0{40} --- in "dumb http" path HEAD a symref unborn branch. this code path is check object pointed this remote ref if fetch it, do if (objectId == null) { continue; } is fetch in case</technical_language>

Target:
private boolean sendWants(final Collection<Ref> want) throws IOException { final PacketLineOut p = statelessRPC ? pckState : pckOut; boolean first = true; for (final Ref r : want) { ObjectId objectId = r.getObjectId(); if (objectId == null) { continue; } try { if (walk.parseAny(objectId).has(REACHABLE)) { continue; } } catch (IOException err) { } final StringBuilder line = new StringBuilder(46); line.append("want "); line.append(objectId.name()); if (first) { line.append(enableCapabilities()); first = false; } line.append('\n'); p.writeString(line.toString()); } if (first) return false; p.end(); outNeedsEnd = false; return true; }
Source:
<code>public AccurevSCM(String serverName, String depot, String stream) { this.depot = depot; this.stream = stream; AccurevServer server = getDescriptor().getServer(serverName); if (server != null) { setServerName(server.getName()); setServerUUID(server.getUuid()); } <START> updateMode(); <END> }</code><technical_language>is this change needed? if deprecated method call this one</technical_language>

Target:
public AccurevSCM(String serverName, String depot, String stream) { this(serverName, null, depot, stream); }
Source:
<code><START> public void updatePartitionsConfiguration(final Partition[] partitions) { <END> try { final Topology topology = readTopology(); final Topology newTopology = topology.withUpdatedPartitions(partitions); getCurator().setData().forPath( getSubscriptionPath(NODE_TOPOLOGY), objectMapper.writeValueAsBytes(newTopology)); } catch (final Exception ex) { throw new NakadiRuntimeException(ex); } }</code><technical_language>throws NakadiRuntimeException</technical_language>

Target:
public void updatePartitionsConfiguration(final Partition[] partitions) throws NakadiRuntimeException { try { final Topology topology = readTopology(); final Topology newTopology = topology.withUpdatedPartitions(partitions); getCurator().setData().forPath( getSubscriptionPath(NODE_TOPOLOGY), objectMapper.writeValueAsBytes(newTopology)); } catch (final Exception ex) { throw new NakadiRuntimeException(ex); } }