auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void verifyNoInteractions(Object... mocks) { assertMocksNotEmpty(mocks); mockingProgress().validateState(); for (Object mock : mocks) { try { if (mock == null) { throw nullPassedToVerifyNoMoreInteractions(); } InvocationContainer invocations = getMockHandler(mock).getInvocationContainer(); VerificationDataImpl data = new VerificationDataImpl(invocations, null); noInteractions().verify(data); <START> } catch (NotAMockException e) { <END> throw notAMockPassedToVerifyNoMoreInteractions(); } } }</code><technical_language>@ffissore avoid this catch block calling MockUtil.isMock(..)</technical_language>

Target:
public void verifyNoInteractions(Object... mocks) { assertMocksNotEmpty(mocks); mockingProgress().validateState(); for (Object mock : mocks) { if (mock == null) { throw nullPassedToVerifyNoMoreInteractions(); } if (!isMock(mock)) { throw notAMockPassedToVerifyNoMoreInteractions(); } InvocationContainer invocations = getMockHandler(mock).getInvocationContainer(); VerificationDataImpl data = new VerificationDataImpl(invocations, null); noInteractions().verify(data); } }
Source:
<code>public void create() { createInternalAAAConfigurations(); createKerberosLdapAAAConfigurations(); <START> EngineExtensionsManager.getInstance().dump(); <END> AuthenticationProfileRepository.getInstance(); DbUserCacheManager.getInstance().init(); AsyncTaskManager.getInstance().initAsyncTaskManager(); ResourceManager.getInstance().init(); OvfDataUpdater.getInstance().initOvfDataUpdater(); SchedulingManager.getInstance().setMigrationHandler(new MigrationHandler() { @Override public void migrateVM(List<Guid> initialHosts, Guid vmToMigrate) { MigrateVmParameters parameters = new MigrateVmParameters(false, vmToMigrate); parameters.setInitialHosts(new ArrayList<Guid>(initialHosts)); Backend.getInstance().runInternalAction(VdcActionType.MigrateVm, parameters, ExecutionHandler.createInternalJobContext()); } }); ThreadPoolUtil.execute(new Runnable() { @Override public void run() { MacPoolManager.getInstance().initialize(); } }); StoragePoolStatusHandler.init(); GlusterJobsManager.init(); ExternalTrustStoreInitializer.init(); try { log.info("Init VM custom properties utilities"); VmPropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of vm custom properties failed.", e); } try { log.info("Init device custom properties utilities"); DevicePropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of device custom properties failed.", e); } SchedulingManager.getInstance().init(); new DwhHeartBeat().init(); PmHealthCheckManager.getInstance().initialize(); }</code><technical_language>hmmm... idea... move EngineExtensionsManager? initialize builtins well</technical_language>

Target:
public void create() { EngineExtensionsManager.getInstance().dump(); AuthenticationProfileRepository.getInstance(); DbUserCacheManager.getInstance().init(); AsyncTaskManager.getInstance().initAsyncTaskManager(); ResourceManager.getInstance().init(); OvfDataUpdater.getInstance().initOvfDataUpdater(); SchedulingManager.getInstance().setMigrationHandler(new MigrationHandler() { @Override public void migrateVM(List<Guid> initialHosts, Guid vmToMigrate) { MigrateVmParameters parameters = new MigrateVmParameters(false, vmToMigrate); parameters.setInitialHosts(new ArrayList<Guid>(initialHosts)); Backend.getInstance().runInternalAction(VdcActionType.MigrateVm, parameters, ExecutionHandler.createInternalJobContext()); } }); ThreadPoolUtil.execute(new Runnable() { @Override public void run() { MacPoolManager.getInstance().initialize(); } }); StoragePoolStatusHandler.init(); GlusterJobsManager.init(); ExternalTrustStoreInitializer.init(); try { log.info("Init VM custom properties utilities"); VmPropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of vm custom properties failed.", e); } try { log.info("Init device custom properties utilities"); DevicePropertiesUtils.getInstance().init(); } catch (InitializationException e) { log.error("Initialization of device custom properties failed.", e); } SchedulingManager.getInstance().init(); new DwhHeartBeat().init(); PmHealthCheckManager.getInstance().initialize(); }
Source:
<code>public final void fetchesDecoded() throws Exception { final Content content = Mockito.mock(Content.class); final String prop = "dGVzdCBlbmNvZGU="; Mockito.doReturn( Json.createObjectBuilder() .add("content", prop) .build() ).when(content).json(); MatcherAssert.assertThat( <START> new String(new Content.Smart(content).decoded()), <END> Matchers.is("test encode") ); }</code><technical_language>a good practice character encoding reconstructing a String bytes. do here, UTF-8</technical_language>

Target:
public final void fetchesDecoded() throws Exception { final Content content = Mockito.mock(Content.class); final String prop = "dGVzdCBlbmNvZGXigqw="; Mockito.doReturn( Json.createObjectBuilder() .add("content", prop) .build() ).when(content).json(); MatcherAssert.assertThat( new String(new Content.Smart(content).decoded(), Charsets.UTF_8), Matchers.is("test encode\u20ac") ); }
Source:
<code>public void testRecursiveAutoMap() { RecursionMapper.Root root = RecursionMapper.INSTANCE.mapRoot( new RecursionMapper.RootDto( new RecursionMapper.ChildDto( "Sub Root", new RecursionMapper.ChildDto( "Sub child", null ) ) ) ); <START> Assert.assertEquals( <END> new RecursionMapper.Root( new RecursionMapper.Child( "Sub Root", new RecursionMapper.Child( "Sub child", null ) ) ), root ); }</code><technical_language>object accessors instead of equals method for checks? a latest NestedSimpleBeansMappingTest. need equals hashCode methods in objects class smaller :)</technical_language>

Target:
public void testRecursiveAutoMap() { RecursionMapper.RootDto rootDto = new RecursionMapper.RootDto( new RecursionMapper.ChildDto( "Sub Root", new RecursionMapper.ChildDto( "Sub child", null ) ) ); RecursionMapper.Root root = RecursionMapper.INSTANCE.mapRoot( rootDto ); assertRootEquals( rootDto, root ); }
Source:
<code>public void testElementTypeStringToString() throws ParseException { <START> Element testElement = new Element("stringElement", "java.lang.String", null, null); <END> assertThat(ElementHelper.getDs3Type(testElement), is("ds3_str*")); }</code><technical_language>Missing finals for tests in this file</technical_language>

Target:
public void testElementTypeStringToString() throws ParseException { final Element testElement = new Element("stringElement", "java.lang.String", null, null); assertThat(ElementHelper.getDs3Type(testElement), is("ds3_str*")); }
Source:
<code>public String loginPhase2(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpPost post = null; post = new HttpPost(config.gitHubOAuthAccessTokenUrl); post.setHeader("Accept", "application/json"); List<NameValuePair> nvps = new <START> ArrayList<NameValuePair>(); <END> nvps.add(new BasicNameValuePair("client_id", config.gitHubClientId)); nvps.add(new BasicNameValuePair("client_secret", config.gitHubClientSecret)); nvps.add(new BasicNameValuePair("code", request.getParameter("code"))); post.setEntity(new UrlEncodedFormEntity(nvps, Charsets.UTF_8)); try { HttpResponse postResponse = http.execute(post); if (postResponse.getStatusLine().getStatusCode() != HttpURLConnection.HTTP_OK) { LOG.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed with status " + postResponse.getStatusLine()); response.sendError(HttpURLConnection.HTTP_UNAUTHORIZED, "Request for access token not authorised"); EntityUtils.consume(postResponse.getEntity()); return null; } JsonObject accessTokenJson = getAccessTokenJson(postResponse); if (accessTokenJson != null) { return getAccessToken(accessTokenJson); } else { LOG.error("Invalid response received from GitHub: {}", postResponse.toString()); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return null; } } catch (IOException e) { LOG.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed", e); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Request for access token not authorised"); return null; } }</code><technical_language>Java7: type inference</technical_language>

Target:
public String loginPhase2(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpPost post = null; post = new HttpPost(config.gitHubOAuthAccessTokenUrl); post.setHeader("Accept", "application/json"); List<NameValuePair> nvps = new ArrayList<>(3); nvps.add(new BasicNameValuePair("client_id", config.gitHubClientId)); nvps.add(new BasicNameValuePair("client_secret", config.gitHubClientSecret)); nvps.add(new BasicNameValuePair("code", request.getParameter("code"))); post.setEntity(new UrlEncodedFormEntity(nvps, Charsets.UTF_8)); try { HttpResponse postResponse = http.execute(post); if (postResponse.getStatusLine().getStatusCode() != HttpURLConnection.HTTP_OK) { LOG.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed with status " + postResponse.getStatusLine()); response.sendError(HttpURLConnection.HTTP_UNAUTHORIZED, "Request for access token not authorised"); EntityUtils.consume(postResponse.getEntity()); return null; } JsonObject accessTokenJson = getAccessTokenJson(postResponse); if (accessTokenJson != null) { return getAccessToken(accessTokenJson); } else { LOG.error("Invalid response received from GitHub: {}", postResponse.toString()); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return null; } } catch (IOException e) { LOG.error("POST " + config.gitHubOAuthAccessTokenUrl + " request for access token failed", e); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Request for access token not authorised"); return null; } }
Source:
<code>public static boolean isCandidateClass(Class<?> clazz, String annotationName) { if (AnnotationsScanner.hasPlainJavaAnnotationsOnly(clazz)) { return false; <START> } <END> return true; }</code><technical_language>This check is redundant. This checks annotation type; whereas, subsequent hasPlainJavaAnnotationsOnly() invocation checks candidate class. Thus, please revert this change</technical_language>

Target:
public static boolean isCandidateClass(Class<?> clazz, String annotationName) { if (annotationName.startsWith("java.")) { return true; } if (AnnotationsScanner.hasPlainJavaAnnotationsOnly(clazz)) { return false; } return true; }
Source:
<code>public LoginStateGetter getLoginStateGetter() { <START> return retrieveLoginNavFragment().getLoginStateGetter(); <END> }</code><technical_language>retrieveLoginNavFragment return null, this throw NPE</technical_language>

Target:
public LoginStateGetter getLoginStateGetter() { return getLoginNavFragmentOrThrow().getLoginStateGetter(); }
Source:
<code>private long getTransferSize(DiskImage image, Guid domainId) { if (getParameters().getTransferType() == TransferType.Download) { DiskImage imageInfoFromVdsm = imagesHandler.getVolumeInfoFromVdsm( image.getStoragePoolId(), domainId, image.getId(), image.getImageId()); return imageInfoFromVdsm.getApparentSizeInBytes(); } else { if (getParameters().getTransferSize() <START> != 0) <END> { return getParameters().getTransferSize(); } else { boolean isOnBlock = getDiskImage().getStorageTypes().get(0).isBlockDomain(); return isOnBlock ? getDiskImage().getActualSizeInBytes() : getDiskImage().getSize(); } } }</code><technical_language>Suggestion: > 0</technical_language>

Target:
private long getTransferSize(DiskImage image, Guid domainId) { if (getParameters().getTransferType() == TransferType.Download) { DiskImage imageInfoFromVdsm = imagesHandler.getVolumeInfoFromVdsm( image.getStoragePoolId(), domainId, image.getId(), image.getImageId()); return imageInfoFromVdsm.getApparentSizeInBytes(); } if (getParameters().getTransferSize() != 0) { return getParameters().getTransferSize(); } else { boolean isOnBlock = getDiskImage().getStorageTypes().get(0).isBlockDomain(); return isOnBlock ? getDiskImage().getActualSizeInBytes() : getDiskImage().getSize(); } }
Source:
<code>public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> parameterValues, PatientCalculationContext context) { Program mchmsProgram = MetadataUtils.getProgram(Metadata.Program.MCHMS); Set<Integer> alive = alivePatients(cohort, context); Set<Integer> inMchmsProgram = CalculationUtils.patientsThatPass(Calculations.activeEnrollment(mchmsProgram, alive, context)); CalculationResultMap partnerHivStatusObs = Calculations.lastObs(getConcept(Dictionary.PARTNER_HIV_STATUS), inMchmsProgram, context); CalculationResultMap ret = new CalculationResultMap(); for (Integer ptId : cohort) { boolean partnerHivStatusUnknown = false; if (inMchmsProgram.contains(ptId)) { Concept partnerHivStatus = EmrCalculationUtils.codedObsResultForPatient(partnerHivStatusObs, ptId); if (partnerHivStatus != null) { <START> partnerHivStatusUnknown = partnerHivStatus.equals(Dictionary.getConcept(Dictionary.UNKNOWN)); <END> } } ret.put(ptId, new BooleanResult(partnerHivStatusUnknown, this, context)); } return ret; }</code><technical_language>Store unknown concept in variable of loop re-fetched time</technical_language>

Target:
public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> parameterValues, PatientCalculationContext context) { Program mchmsProgram = MetadataUtils.getProgram(Metadata.Program.MCHMS); Set<Integer> alive = alivePatients(cohort, context); Set<Integer> inMchmsProgram = CalculationUtils.patientsThatPass(Calculations.activeEnrollment(mchmsProgram, alive, context)); CalculationResultMap partnerHivStatusObs = Calculations.lastObs(getConcept(Dictionary.PARTNER_HIV_STATUS), inMchmsProgram, context); Concept unknownConcept = Dictionary.getConcept(Dictionary.UNKNOWN); CalculationResultMap ret = new CalculationResultMap(); for (Integer ptId : cohort) { boolean partnerHivStatusUnknown = false; if (inMchmsProgram.contains(ptId)) { Concept partnerHivStatus = EmrCalculationUtils.codedObsResultForPatient(partnerHivStatusObs, ptId); if (partnerHivStatus != null) { partnerHivStatusUnknown = partnerHivStatus.equals(unknownConcept); } } ret.put(ptId, new BooleanResult(partnerHivStatusUnknown, this, context)); } return ret; }
Source:
<code>public void testGetAllIpBlocks() { List<IpBlock> ipBlocks = api.ipBlockApi().getAllIpBlock(); <START> assertNotNull(ipBlocks); <END> }</code><technical_language>jclouds fallback returns a list (or empty one). add some assertion verify list expected elements</technical_language>

Target:
public void testGetAllIpBlocks() { List<IpBlock> ipBlocks = api.ipBlockApi().getAllIpBlock(); assertNotNull(ipBlocks); assertFalse(ipBlocks.isEmpty()); }
Source:
<code><START> public V get(final String key) { <END> return super.get(key.toLowerCase()); }</code><technical_language>Missing @Override annotations</technical_language>

Target:
public V get(final String key) { return this.map.get(key.toLowerCase()); }
Source:
<code>private synchronized Pair<Item, Boolean> getItem( @NonNull File inputFile, @NonNull File outFile, @NonNull BuildToolInfo buildToolInfo) throws IOException { Key itemKey = Key.of(inputFile, buildToolInfo.getRevision()); Item item = mMap.get(itemKey); boolean newItem = <START> false; <END> if (item == null) { item = new Item(inputFile, outFile, Files.hash(inputFile, Hashing.sha1()), new CountDownLatch(1)); mMap.put(itemKey, item); newItem = true; } return Pair.of(item, newItem); }</code><technical_language>replace boolean newItem = item == null delete assignment below, clarifies intent</technical_language>

Target:
private synchronized Pair<Item, Boolean> getItem( @NonNull File inputFile, @NonNull File outFile, @NonNull BuildToolInfo buildToolInfo) throws IOException { Key itemKey = Key.of(inputFile, buildToolInfo.getRevision()); Item item = mMap.get(itemKey); boolean newItem = (item == null); if (item == null) { item = new Item(inputFile, outFile, Files.hash(inputFile, Hashing.sha1()), new CountDownLatch(1)); mMap.put(itemKey, item); } return Pair.of(item, newItem); }
Source:
<code>public boolean repeatUntilResponseIsNot(final String expectedResponse) { RepeatCompletion completion; if (expectedResponse == null) { completion = new RepeatLastCall() { @Override public boolean isFinished() { <START> return response() == null; <END> } }; } else { completion = new RepeatLastCall() { @Override public boolean isFinished() { Object actual = response(); return !compareActualToExpected(expectedResponse, actual); } }; } return repeatUntil(completion); }</code><technical_language>this !=</technical_language>

Target:
public boolean repeatUntilResponseIsNot(final String expectedResponse) { return repeatUntilNot(createResponseIsCompletion(expectedResponse)); }
Source:
<code>private List<NameValuePair> buildCommonParams(Site site, int start, int rows, SearchCriterion sortOrder, SearchCriterion dateRange, boolean forHomePage, Map<String, String> rawQueryParams) { List<NameValuePair> params = buildCommonParams(site, start,rows,sortOrder, dateRange, forHomePage); <START> Iterator it = rawQueryParams.entrySet().iterator(); <END> while (it.hasNext()) { Map.Entry<String, String> entry = (Map.Entry<String, String>)it.next(); params.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } return params; }</code><technical_language>do this Iterator: for (Map.Entry<String, String> entry : rawQueryParams.entrySet()) {</technical_language>

Target:
private List<NameValuePair> buildCommonParams(Site site, int start, int rows, SearchCriterion sortOrder, SearchCriterion dateRange, boolean forHomePage, Map<String, String> rawQueryParams) { List<NameValuePair> params = buildCommonParams(site, start,rows,sortOrder, dateRange, forHomePage); for (Map.Entry<String, String> entry: rawQueryParams.entrySet()) { params.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } return params; }
Source:
<code>public void inflateDisbursementDate() { mfDatePicker = MFDatePicker.newInsance(this); loanDisbursementDates.setText(MFDatePicker.getDatePickedAsString()); <START> loanDisbursementDates.setOnClickListener(new View.OnClickListener() { <END> @Override public void onClick(View view) { mfDatePicker.show(getActivity().getSupportFragmentManager(), FragmentConstants .DFRAG_DATE_PICKER); } }); }</code><technical_language>ButterKnife @onClick annotation instead of implementing OnClickListener</technical_language>

Target:
public void inflateDisbursementDate() { mfDatePicker = MFDatePicker.newInsance(this); tvLoanDisbursementDates.setText(MFDatePicker.getDatePickedAsString()); }
Source:
<code>private int readOneBlock(final byte[] b, final int off, final int len) throws IOException { int validation = validate(b, off, len); if (validation < 1) { <START> return validation; <END> } if (bCursor == limit) { if (fCursor >= contentLength) { return -1; } long bytesRead = 0; bCursor = 0; limit = 0; if (buffer == null) { LOG.debug("created new buffer size {}", bufferSize); buffer = new byte[bufferSize]; } if (-1 == fCursorAfterLastRead || fCursorAfterLastRead == fCursor || b.length >= bufferSize) { bytesRead = readInternal(fCursor, buffer, 0, bufferSize, false); } else { bytesRead = readInternal(fCursor, buffer, 0, b.length, true); } if (bytesRead == -1) { return -1; } limit += bytesRead; fCursor += bytesRead; fCursorAfterLastRead = fCursor; } return copyToUserBuffer(b, off, len); }</code><technical_language>validate return a boolean , true if validation is successful false if not. For cases needs throw exception is present, if check wont hit. Change to: if (!validate(b, off, len)) { return -1; }</technical_language>

Target:
private int readOneBlock(final byte[] b, final int off, final int len) throws IOException { if (len == 0) { return 0; } if (!validate(b, off, len)) { return -1; } if (bCursor == limit) { if (fCursor >= contentLength) { return -1; } long bytesRead = 0; bCursor = 0; limit = 0; if (buffer == null) { LOG.debug("created new buffer size {}", bufferSize); buffer = new byte[bufferSize]; } if (alwaysReadBufferSize) { bytesRead = readInternal(fCursor, buffer, 0, bufferSize, false); } else { if (-1 == fCursorAfterLastRead || fCursorAfterLastRead == fCursor || b.length >= bufferSize) { bytesRead = readInternal(fCursor, buffer, 0, bufferSize, false); } else { bytesRead = readInternal(fCursor, buffer, 0, b.length, true); } } if (firstRead) { firstRead = false; } if (bytesRead == -1) { return -1; } limit += bytesRead; fCursor += bytesRead; fCursorAfterLastRead = fCursor; } return copyToUserBuffer(b, off, len); }
Source:
<code>Optional<VintageTestDescriptor> lookupTestDescriptor(Description description) { List<VintageTestDescriptor> descriptors = descriptionToDescriptors.get(description); if (descriptors == null) { return Optional.empty(); } if (descriptors.size() == 1) { return Optional.of(getOnlyElement(descriptors)); } return descriptors.stream() .filter(testDescriptor -> { @SuppressWarnings("ReferenceEquality") boolean result = (description == testDescriptor.getDescription()); return result; }) <START> .findFirst(); <END> }</code><technical_language>Good question! @marcphilipp ??</technical_language>

Target:
Optional<VintageTestDescriptor> lookupTestDescriptor(Description description) { List<VintageTestDescriptor> descriptors = descriptionToDescriptors.get(description); if (descriptors == null) { return Optional.empty(); } if (descriptors.size() == 1) { return Optional.of(getOnlyElement(descriptors)); } return descriptors.stream() .filter(testDescriptor -> description == testDescriptor.getDescription()) .findFirst(); }
Source:
<code><START> public Condition createCondition(Condition condition) { <END> List<String> errors = new ArrayList<>(); if (condition.isEmpty()) { errors.add("Condition resource is null"); return null; } if (condition.getSubject().isEmpty()) { errors.add("No subject"); return null; } org.openmrs.Condition openMrsCondition = Context.getService(org.openmrs.api.ConditionService.class) .saveCondition(generateOpenMrsCondition(condition)); FHIRUtils.checkGeneratorErrorList(errors); return generateFHIRCondition(openMrsCondition); }</code><technical_language>throw exception instead of returning null</technical_language>

Target:
public Condition createCondition(Condition condition) { if (condition.isEmpty()) { throw new UnprocessableEntityException("condition resource cannot be null"); } if (condition.getSubject().isEmpty()) { throw new UnprocessableEntityException("condition subject cannot be null"); } org.openmrs.Condition openMrsCondition = Context.getService(org.openmrs.api.ConditionService.class) .saveCondition(generateOpenMrsCondition(condition)); return generateFHIRCondition(openMrsCondition); }
Source:
<code><START> protected void handleCleanStatefulCheckpointRequest( <END> REQID rid, SocketChannel channel, CheckpointManager.CleanStatefulCheckpointRequest request ) { LOG.info("Got a clean request from " + request.toString() + " host:port " + channel.socket().getRemoteSocketAddress()); boolean res = checkpointsBackend.dispose(request, topologyName); Common.StatusCode statusCode = res ? Common.StatusCode.OK : Common.StatusCode.NOTOK; CheckpointManager.CleanStatefulCheckpointResponse.Builder responseBuilder = CheckpointManager.CleanStatefulCheckpointResponse.newBuilder(); responseBuilder.setStatus(Common.Status.newBuilder().setStatus(statusCode)); if (res) { LOG.info("Dispose checkpoint successful"); } else { LOG.info("Dispose checkpoint not successful"); } sendResponse(rid, channel, responseBuilder.build()); }</code><technical_language>instead create a CheckpointRequestHandler interface a single method a class for of these? approach more OO allow share more of copied code in methods in abstract handler superclass. interface this: interface CheckpointRequestHandler<T extends CheckpointManagerRequest> { protected void handleRequest( REQID rid, SocketChannel channel, T request); This means requests types need part of proto enum (or oneof) a common hierarchy</technical_language>

Target:
protected void handleCleanStatefulCheckpointRequest( REQID rid, SocketChannel channel, CheckpointManager.CleanStatefulCheckpointRequest request ) { LOG.info(String.format("Got a clean request from %s running at host:port %s", request.toString(), channel.socket().getRemoteSocketAddress())); boolean deleteAll = request.hasCleanAllCheckpoints() && request.getCleanAllCheckpoints(); Common.StatusCode statusCode = Common.StatusCode.OK; String errorMessage = ""; try { statefulStorage.dispose(topologyName, request.getOldestCheckpointPreserved(), deleteAll); LOG.info("Dispose checkpoint successful"); } catch (StatefulStorageException e) { errorMessage = String.format("Request to dispose checkpoint failed for oldest Checkpoint " + "%s and deleteAll? %b", request.getOldestCheckpointPreserved(), deleteAll); statusCode = Common.StatusCode.NOTOK; LOG.log(Level.WARNING, errorMessage, e); } CheckpointManager.CleanStatefulCheckpointResponse.Builder responseBuilder = CheckpointManager.CleanStatefulCheckpointResponse.newBuilder(); responseBuilder.setStatus(Common.Status.newBuilder().setStatus(statusCode) .setMessage(errorMessage)); sendResponse(rid, channel, responseBuilder.build()); }
Source:
<code>private void throwIfInvalidGroupMetadata(ConsumerGroupMetadata groupMetadata) { if (groupMetadata == null) { throw new IllegalStateException("Consumer group metadata could not be null"); <START> } else if (groupMetadata.groupId() == null) { <END> throw new IllegalStateException("Passed in group metadata " + groupMetadata + " has empty group.id"); } else if (groupMetadata.generationId() > 0 && JoinGroupRequest.UNKNOWN_MEMBER_ID.equals(groupMetadata.memberId())) { throw new IllegalStateException("Passed in group metadata " + groupMetadata + " has generationId > 0 but member.id "); } }</code><technical_language>nit: move this check ConsumerGroupMetadata some other null checks there</technical_language>

Target:
private void throwIfInvalidGroupMetadata(ConsumerGroupMetadata groupMetadata) { if (groupMetadata == null) { throw new IllegalArgumentException("Consumer group metadata could not be null"); } else if (groupMetadata.generationId() > 0 && JoinGroupRequest.UNKNOWN_MEMBER_ID.equals(groupMetadata.memberId())) { throw new IllegalArgumentException("Passed in group metadata " + groupMetadata + " has generationId > 0 but member.id "); } }
Source:
<code>public Set<Command> getCommands() { <START> Set<Command> commands = new HashSet<>(); <END> commands.add(new ActivateCommand()); commands.add(new DeprecatedActivateCommand()); commands.add(new AttachCommand()); commands.add(new DeprecatedAttachCommand()); commands.add(new DetachCommand()); commands.add(new DeprecatedDetachCommand()); commands.add(new ImportCommand()); commands.add(new DeprecatedImportCommand()); commands.add(new ExportCommand()); commands.add(new DeprecatedExportCommand()); commands.add(new GetCommand()); commands.add(new DeprecatedGetCommand()); commands.add(new SetCommand()); commands.add(new DeprecatedSetCommand()); commands.add(new UnsetCommand()); commands.add(new DeprecatedUnsetCommand()); commands.add(new DiagnosticCommand()); commands.add(new DeprecatedDiagnosticCommand()); commands.add(new RepairCommand()); commands.add(new DeprecatedRepairCommand()); commands.add(new LogCommand()); commands.add(new DeprecatedLogCommand()); commands.add(new LockConfigCommand()); commands.add(new DeprecatedLockConfigCommand()); commands.add(new UnlockConfigCommand()); commands.add(new DeprecatedUnlockConfigCommand()); return commands; }</code><technical_language>I thinking yesterday extensibility of this I do that. a bag of items defining a flavour harder need copy/paste of this again, manipulate collection try find right item remove... I wondering if instead extract methods (like is done in OssServiceProvider: 1 method for service), return a Map key action for example ? command</technical_language>

Target:
public Map<String, Command> getCommands() { Map<String, Command> commands = new HashMap<>(); commands.put("activate", new ActivateCommand()); commands.put("attach", new AttachCommand()); commands.put("detach", new DetachCommand()); commands.put("import", new ImportCommand()); commands.put("export", new ExportCommand()); commands.put("get", new GetCommand()); commands.put("set", new SetCommand()); commands.put("unset", new UnsetCommand()); commands.put("diagnostic", new DiagnosticCommand()); commands.put("repair", new RepairCommand()); commands.put("log", new LogCommand()); commands.put("lock-config", new LockConfigCommand()); commands.put("unlock-config", new UnlockConfigCommand()); return unmodifiableMap(commands); }
Source:
<code>protected String getValue(Environment env, Map params) throws TemplateModelException, IOException { String path = getStringValue(params.get("path")); String targetJournal = getStringValue(params.get("journalKey")); String handlerName = getStringValue(params.get("handlerName")); boolean absoluteLink = getBoolValue(params.get("absoluteLink")); <START> boolean urlDecodeLink = getBoolValue(params.get("urlDecodeLink")); <END> SitePageContext sitePageContext = new SitePageContext(siteResolver, env); Site site = sitePageContext.getSite(); Link.Factory linkFactory = (targetJournal == null) ? (absoluteLink ? Link.toAbsoluteAddress(site) : Link.toLocalSite(site)) : Link.toForeignSite(site, targetJournal, siteSet); final Link link; if (handlerName != null) { Map<String, ?> variables = TemplateModelUtil.getAsMap((TemplateModel) params.get("pathVariables")); ListMultimap<String, ?> queryParameters = TemplateModelUtil.getAsMultimap((TemplateModel) params.get("queryParameters")); List<?> wildcardValues = TemplateModelUtil.getAsList((TemplateModel) params.get("wildcardValues")); link = linkFactory.toPattern(requestMappingContextDictionary, handlerName, variables, queryParameters, wildcardValues); } else if (path != null) { link = linkFactory.toPath(path); } else { throw new RuntimeException("Either a path or handlerName parameter is required"); } String url = link.get(sitePageContext.getRequest()); if (urlDecodeLink) { url = URLDecoder.decode(url, "UTF-8"); } return url; }</code><technical_language>need handle encoding for characters other '/', in DOI. nice (at minimum for aesthetic purposes, for SEO) handle '/' consistently else. handling '/' exceptionally, globally instead of LOCKSS page</technical_language>

Target:
protected String getValue(Environment env, Map params) throws TemplateModelException, IOException { String path = getStringValue(params.get("path")); String targetJournal = getStringValue(params.get("journalKey")); String handlerName = getStringValue(params.get("handlerName")); boolean absoluteLink = getBoolValue(params.get("absoluteLink")); SitePageContext sitePageContext = new SitePageContext(siteResolver, env); Site site = sitePageContext.getSite(); Link.Factory linkFactory = (targetJournal == null) ? (absoluteLink ? Link.toAbsoluteAddress(site) : Link.toLocalSite(site)) : Link.toForeignSite(site, targetJournal, siteSet); final Link link; if (handlerName != null) { Map<String, ?> variables = TemplateModelUtil.getAsMap((TemplateModel) params.get("pathVariables")); ListMultimap<String, ?> queryParameters = TemplateModelUtil.getAsMultimap((TemplateModel) params.get("queryParameters")); List<?> wildcardValues = TemplateModelUtil.getAsList((TemplateModel) params.get("wildcardValues")); link = linkFactory.toPattern(requestMappingContextDictionary, handlerName, variables, queryParameters, wildcardValues); } else if (path != null) { link = linkFactory.toPath(path); } else { throw new RuntimeException("Either a path or handlerName parameter is required"); } return link.get(sitePageContext.getRequest()); }
Source:
<code>public boolean deleteCertificate(String alias) throws CertificateManagerException { final Map<String, String> trustStoreProperties = getTrustStoreSystemProperties(); String storeType = trustStoreProperties.get(TRUST_STORE_TYPE_KEY); final String storeLoc = trustStoreProperties.get(TRUST_STORE_KEY); final String passkey = trustStoreProperties.get(TRUST_STORE_PASSWORD_KEY); FileInputStream is = null; FileOutputStream os = null; boolean isDeleteSuccessful = false; try { KeyStore tstore = KeyStore.getInstance(storeType); if (!PKCS11_TYPE.equalsIgnoreCase(storeType)) { is = new FileInputStream(storeLoc); } tstore.load(is, passkey.toCharArray()); <START> X509Certificate publicCert = getDefaultCertificate(null); <END> String publicAlias = tstore.getCertificateAlias(publicCert); if (StringUtils.equalsIgnoreCase(alias, publicAlias)) { throw new CertificateManagerException("System cannot remove its own public cert"); } if (tstore.containsAlias(alias)) { tstore.deleteEntry(alias); os = new FileOutputStream(storeLoc); tstore.store(os, passkey.toCharArray()); isDeleteSuccessful = true; } } catch (final IOException | NoSuchAlgorithmException | CertificateException | KeyStoreException ex) { LOG.error("Unable to delete the Certifiate: ", ex.getLocalizedMessage(), ex); throw new CertificateManagerException(ex.getMessage(), ex); } finally { closeStream(is, os); } return isDeleteSuccessful; }</code><technical_language>is alias null for this getDefaultCertificate() call</technical_language>

Target:
public boolean deleteCertificate(String alias) throws CertificateManagerException { final Map<String, String> trustStoreProperties = getTrustStoreSystemProperties(); String storeType = trustStoreProperties.get(TRUST_STORE_TYPE_KEY); final String storeLoc = trustStoreProperties.get(TRUST_STORE_KEY); final String passkey = trustStoreProperties.get(TRUST_STORE_PASSWORD_KEY); FileInputStream is = null; FileOutputStream os = null; boolean isDeleteSuccessful = false; try { KeyStore tstore = KeyStore.getInstance(storeType); if (!PKCS11_TYPE.equalsIgnoreCase(storeType)) { is = new FileInputStream(storeLoc); } tstore.load(is, passkey.toCharArray()); List<X509Certificate> publicCerts = getDefaultCertificates(); for (X509Certificate publicCert : publicCerts) { String publicAlias = tstore.getCertificateAlias(publicCert); if (StringUtils.equalsIgnoreCase(alias, publicAlias)) { throw new CertificateManagerException("System cannot remove its own public cert"); } } if (tstore.containsAlias(alias)) { tstore.deleteEntry(alias); os = new FileOutputStream(storeLoc); tstore.store(os, passkey.toCharArray()); isDeleteSuccessful = true; } } catch (final IOException | NoSuchAlgorithmException | CertificateException | KeyStoreException ex) { throw new CertificateManagerException(ex.getMessage(), ex); } finally { closeStream(is, os); } return isDeleteSuccessful; }
Source:
<code>default void updateChannelIfNotExist(String loginName, String channel) { UserPointModel userPointModel = findByLoginName(loginName); <START> if (userPointModel != null && (userPointModel.getChannel() == null || "".equals(userPointModel.getChannel()))) { <END> updateChannel(loginName, channel, new Date()); } }</code><technical_language>userPointModel != null && StringUtils.isBlank(userPointModel.getChannel())</technical_language>

Target:
default void updateChannelIfNotExist(String loginName, String channel) { UserPointModel userPointModel = findByLoginName(loginName); if (userPointModel != null && StringUtils.isEmpty(userPointModel.getChannel())) { updateChannel(loginName, channel, new Date()); } }
Source:
<code>private BoundedMetricsQuery applyTimeRange(final MetricsQuery query, final Instant scheduled, final ChronoUnit period) { <START> final ZonedDateTime latest = ZonedDateTime.ofInstant(scheduled, ZoneOffset.UTC).truncatedTo(period); <END> final ZonedDateTime previous = latest.minus(1, period); return new DefaultBoundedMetricsQuery.Builder() .setStartTime(previous) .setEndTime(latest) .setQuery(query.getQuery()) .setFormat(query.getQueryFormat()) .build(); }</code><technical_language>want this end-time _exclusive_, right? IIRC, KairosDB's semantics end_time is _inclusive_, I want subtract 1ns 1ms this value. do here, if want alerting code convention endTime is inclusive; [here](<LINK_0>, if want convention exclusive</technical_language>

Target:
private BoundedMetricsQuery applyTimeRange(final MetricsQuery query, final Instant scheduled, final ChronoUnit period) { final ZonedDateTime adjustedScheduled = scheduled.minus(_queryOffset).atZone(ZoneOffset.UTC); final ZonedDateTime latest = adjustedScheduled.truncatedTo(period); final ZonedDateTime previous = latest.minus(1, period); return new DefaultBoundedMetricsQuery.Builder() .setStartTime(previous) .setEndTime(latest) .setQuery(query.getQuery()) .setFormat(query.getQueryFormat()) .build(); }
Source:
<code>protected final void commitContextEntries(InvocationContext ctx, FlagAffectedCommand command, Metadata metadata) { final Flag stateTransferFlag = extractStateTransferFlag(ctx, command); final boolean isClear = isClearKeys(ctx, command); if (stateTransferFlag == null && isClear) { if (stateConsumer != null) { stateConsumer.stopApplyingState(); } if (xSiteStateConsumer != null) { xSiteStateConsumer.endStateTransfer(); } <START> } <END> if (ctx instanceof SingleKeyNonTxInvocationContext) { SingleKeyNonTxInvocationContext singleKeyCtx = (SingleKeyNonTxInvocationContext) ctx; commitEntryIfNeeded(ctx, command, singleKeyCtx.getCacheEntry(), stateTransferFlag, metadata); } else { Set<Map.Entry<Object, CacheEntry>> entries = ctx.getLookedUpEntries().entrySet(); Iterator<Map.Entry<Object, CacheEntry>> it = entries.iterator(); final Log log = getLog(); while (it.hasNext()) { Map.Entry<Object, CacheEntry> e = it.next(); CacheEntry entry = e.getValue(); if (!commitEntryIfNeeded(ctx, command, entry, stateTransferFlag, metadata)) { if (trace) { if (entry == null) log.tracef("Entry for key %s is null : not calling commitUpdate", e.getKey()); else log.tracef("Entry for key %s is not changed(%s): not calling commitUpdate", e.getKey(), entry); } } } } }</code><technical_language>stopApplyingState/endStateTransfer code is kind of big, extracting in a separate method</technical_language>

Target:
protected final void commitContextEntries(InvocationContext ctx, FlagAffectedCommand command, Metadata metadata) { final Flag stateTransferFlag = extractStateTransferFlag(ctx, command); if (stateTransferFlag == null) { stopStateTransferIfNeeded(ctx, command); } if (ctx instanceof SingleKeyNonTxInvocationContext) { SingleKeyNonTxInvocationContext singleKeyCtx = (SingleKeyNonTxInvocationContext) ctx; commitEntryIfNeeded(ctx, command, singleKeyCtx.getCacheEntry(), stateTransferFlag, metadata); } else { Set<Map.Entry<Object, CacheEntry>> entries = ctx.getLookedUpEntries().entrySet(); Iterator<Map.Entry<Object, CacheEntry>> it = entries.iterator(); final Log log = getLog(); while (it.hasNext()) { Map.Entry<Object, CacheEntry> e = it.next(); CacheEntry entry = e.getValue(); if (!commitEntryIfNeeded(ctx, command, entry, stateTransferFlag, metadata)) { if (trace) { if (entry == null) log.tracef("Entry for key %s is null : not calling commitUpdate", e.getKey()); else log.tracef("Entry for key %s is not changed(%s): not calling commitUpdate", e.getKey(), entry); } } } } }
Source:
<code>public Object start(IApplicationContext context) throws Exception { String[] arguments = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS); List<String> <START> asList = <END> Arrays.asList(arguments); if (asList.contains("-help") || Arrays.asList(arguments).contains("--help")) { System.out.println(Messages.bind(Messages.CommandLineUsage)); return IApplication.EXIT_OK; } try { ResourcesPlugin.getWorkspace(); } catch (NoClassDefFoundError noClassError) { if (noClassError.getCause() instanceof ClassNotFoundException) { ClassNotFoundException classNotFoundException = (ClassNotFoundException) noClassError.getCause(); if (classNotFoundException.getException() instanceof BundleException) { BundleException bundleException = (BundleException) classNotFoundException.getException(); if (bundleException.getCause() instanceof IllegalStateException) { System.out.println(Messages.bind(Messages.WorkspaceRequired)); return 1; } } } throw noClassError; } return new CodeFormatterApplication().start(context); }</code><technical_language>Strange name, I "args"</technical_language>

Target:
public Object start(IApplicationContext context) throws Exception { String[] arguments = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS); List<String> args = Arrays.asList(arguments); if (args.isEmpty() || args.contains("-help") || Arrays.asList(arguments).contains("--help")) { System.out.println(Messages.bind(Messages.CommandLineUsage)); return IApplication.EXIT_OK; } try { ResourcesPlugin.getWorkspace(); } catch (NoClassDefFoundError noClassError) { if (noClassError.getCause() instanceof ClassNotFoundException) { ClassNotFoundException classNotFoundException = (ClassNotFoundException) noClassError.getCause(); if (classNotFoundException.getException() instanceof BundleException) { BundleException bundleException = (BundleException) classNotFoundException.getException(); if (bundleException.getCause() instanceof IllegalStateException) { System.err.println(Messages.bind(Messages.WorkspaceRequired)); System.out.println(Messages.bind(Messages.CommandLineUsage)); return 1; } } } throw noClassError; } return new CodeFormatterApplication().start(context); }
Source:
<code>private boolean readAndConsumeFile() throws IOException { <START> if (this.fileBytesLeft <= 0 && inputBuffer.size() >= SIZE_LEN) { <END> this.fileBytesLeft = readAndConsumeLength(); openRandomInFile(); } boolean readComplete = isInFileComplete(); int available = inputBuffer.size(); if (!readComplete && isInFileBufferFilled()) { byte[] bytes = inputBuffer.toByteArray(); int read = Math.min(available, this.fileBytesLeft); writeInFileData(bytes, read); available -= read; inputBuffer.reset(); if (available > 0) { inputBuffer.write(bytes, read, available); } readComplete = isInFileComplete(); } if (readComplete) { closeInFile(); } return readComplete; }</code><technical_language>progressing of fileBytesLeft</technical_language>

Target:
private boolean readAndConsumeFile() throws IOException { if (isWaitingForFile()) { this.fileBytesLeft = readAndConsumeLength(); openRandomInFile(); } boolean readComplete = isInFileComplete(); int available = inputBuffer.size(); if (!readComplete && isInFileBufferFilled()) { byte[] bytes = inputBuffer.toByteArray(); int read = Math.min(available, this.fileBytesLeft); writeInFileData(bytes, read); available -= read; inputBuffer.reset(); if (available > 0) { inputBuffer.write(bytes, read, available); } readComplete = isInFileComplete(); } if (readComplete) { closeInFile(); } return readComplete; }
Source:
<code>public void closeForm() { if (refactor.isWidgetOpened()) { refactor.clickCancelButtonRefactorForm(); } <START> if (editor.anyTabIsOpen()) { <END> editor.closeAllTabs(); } }</code><technical_language>Empty row if's increase readability of code</technical_language>

Target:
public void closeForm() { if (refactor.isWidgetOpened()) { refactor.clickCancelButtonRefactorForm(); } if (editor.isAnyTabsOpened()) { editor.closeAllTabs(); } }
Source:
<code>private void updateCopyAndMoveCommandAvailability(List<Disk> disks) { boolean isCopyAllowed = true; boolean isMoveAllowed = true; Disk firstDisk = disks.get(0); if (disks == null || disks.isEmpty() || firstDisk.getDiskStorageType() != DiskStorageType.IMAGE) { disableMoveAndCopyCommands(); return; } NGuid datacenterId = ((DiskImage) firstDisk).getStoragePoolId(); for (Disk disk : disks) <START> { <END> if (!isCopyAllowed && !isMoveAllowed || disk.getDiskStorageType() != DiskStorageType.IMAGE) { disableMoveAndCopyCommands(); return; } DiskImage diskImage = (DiskImage) disk; if (diskImage.getImageStatus() != ImageStatus.OK || !datacenterId.equals(diskImage.getStoragePoolId())) { disableMoveAndCopyCommands(); return; } if (disk.getVmEntityType() == VmEntityType.TEMPLATE) { isMoveAllowed = false; } else { isCopyAllowed = false; } } getCopyCommand().setIsExecutionAllowed(isCopyAllowed); getMoveCommand().setIsExecutionAllowed(isMoveAllowed); }</code><technical_language>formatter</technical_language>

Target:
private void updateCopyAndMoveCommandAvailability(List<Disk> disks) { boolean isCopyAllowed = true; boolean isMoveAllowed = true; Disk firstDisk = disks.get(0); if (disks == null || disks.isEmpty() || firstDisk.getDiskStorageType() != DiskStorageType.IMAGE) { disableMoveAndCopyCommands(); return; } NGuid datacenterId = ((DiskImage) firstDisk).getStoragePoolId(); for (Disk disk : disks) { if ((!isCopyAllowed && !isMoveAllowed) || disk.getDiskStorageType() != DiskStorageType.IMAGE) { disableMoveAndCopyCommands(); return; } DiskImage diskImage = (DiskImage) disk; if (diskImage.getImageStatus() != ImageStatus.OK || !datacenterId.equals(diskImage.getStoragePoolId())) { disableMoveAndCopyCommands(); return; } if (disk.getVmEntityType() == VmEntityType.TEMPLATE) { isMoveAllowed = false; } else { isCopyAllowed = false; } } getCopyCommand().setIsExecutionAllowed(isCopyAllowed); getMoveCommand().setIsExecutionAllowed(isMoveAllowed); }
Source:
<code>public static void deletePaths(final Iterable<Path> paths) { for (final Path p : paths) { boolean deleted; try { deleted = Files.deleteIfExists(p); } catch (IOException e) { deleted = false; } <START> if (!deleted) System.err.println("Could not delete file " + p); <END> } }</code><technical_language>Files.delete() if want log stderr in case file exist</technical_language>

Target:
public static void deletePaths(final Iterable<Path> paths) { for (final Path p : paths) { try { Files.delete(p); } catch (IOException e) { System.err.println("Could not delete file " + p); } } }
Source:
<code>public static boolean isMemoryDeviceHotUnpluggable(VmDevice memoryDevice) { if (!isMemory(memoryDevice)) { <START> throw new RuntimeException("Memory device expected but device " + memoryDevice + " obtained."); <END> } return getSpecParamsIntValue(memoryDevice, SPEC_PARAM_SIZE).isPresent() && getSpecParamsIntValue(memoryDevice, SPEC_PARAM_NODE).isPresent(); }</code><technical_language>IllegalArgumentException sounds here</technical_language>

Target:
public static boolean isMemoryDeviceHotUnpluggable(VmDevice memoryDevice) { if (!isMemory(memoryDevice)) { throw new IllegalArgumentException("Memory device expected but device " + memoryDevice + " obtained."); } return getSpecParamsIntValue(memoryDevice, SPEC_PARAM_SIZE).isPresent() && getSpecParamsIntValue(memoryDevice, SPEC_PARAM_NODE).isPresent(); }
Source:
<code>public void shouldConvertAvroToJson() throws IOException { byte json = avroToJsonConverter.convert(avroUser.create("Bob", 50, "blue")); assertThat(new String(json)).isEqualTo("{\"name\":\"Bob\",\"age\":50,\"favoriteColor\":\"blue\"}"); <START> } <END></code><technical_language>compare contents of JSON objects instead of String serialized form a comparison is sensitive field ordering white symbols... modern object mapper able do that. is a library dedicated for this: <LINK_0></technical_language>

Target:
public void shouldConvertAvroToJson() throws IOException { byte json = avroToJsonConverter.convert(avroUser.create("Bob", 50, "blue")); assertThatJson(new String(json)).isEqualTo("{\"name\": \"Bob\",\"age\": 50,\"favoriteColor\": \"blue\"}"); }
Source:
<code>private static Map<Class<? extends Entity>, ControllerFactory> setDefaultControllerFactories() { Map<Class<? extends Entity>, ControllerFactory> factories = new HashMap<>(); factories.put(Tank.class, new ControllerFactory() { <START> private static final long serialVersionUID = 1L; <END> @Override public void create(Entity entity) { entity.addController(new KeyboardTankController((Tank)entity)); } }); return factories; }</code><technical_language>I serialization code works, is this supposed a 1, instead of a unique serial? guessing matter factories serialized</technical_language>

Target:
private static Map<Class<? extends Entity>, ControllerFactory> setDefaultControllerFactories() { Map<Class<? extends Entity>, ControllerFactory> factories = new HashMap<>(); factories.put(Tank.class, new ControllerFactory() { private static final long serialVersionUID = 1L; @Override public void create(Entity entity) { entity.addController(new KeyboardTankController((Tank)entity)); } }); factories.put(Pillbox.class, new ControllerFactory() { private static final long serialVersionUID = 1L; @Override public void create(Entity entity) { entity.addController(new AIPillboxController((Pillbox)entity)); } }); return factories; }