auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void get_NullSafe() { assertThat(new ReportFeatureMergerFactory().get(null)).isInstanceOf(ReportFeatureAppendableMerger.class); }

Target:
public void get_NullSafe() { ReportFeatureMerger merger = new ReportFeatureMergerFactory().get(null); assertThat(merger).isInstanceOf(ReportFeatureAppendableMerger.class); }
Source:
private TableOperatorWrapper<?> visit(Transformation<?> transform) { if (!(transform instanceof UnionTransformation)) { calcParallelismAndResource(transform); } final TableOperatorWrapper<?> wrapper; if (visitedTransforms.containsKey(transform)) { wrapper = visitedTransforms.get(transform); } else { wrapper = visitTransformation(transform); visitedTransforms.put(transform, wrapper); } return wrapper; }

Target:
private TableOperatorWrapper<?> visit(Transformation<?> transform) { if (!(transform instanceof UnionTransformation)) { calcParallelismAndResource(transform); } return visitedTransforms.computeIfAbsent(transform, this::visitTransformation); }
Source:
@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) { if (!env.processingOver()) { for (Element e : env.getElementsAnnotatedWith(Module.class)) { if (!(e instanceof TypeElement)) { error("@Module applies to a type, " + e.getSimpleName() + " is a " + e.getKind(), e); continue; } delayedModuleNames.add(((TypeElement) e).getQualifiedName().toString()); } return true; } Set<Element> modules = new LinkedHashSet<Element>(); for (String moduleName : delayedModuleNames) { modules.add(processingEnv.getElementUtils().getTypeElement(moduleName)); } for (Element element : modules) { Map<String, Object> annotation = CodeGen.getAnnotation(Module.class, element); if (!annotation.get("complete").equals(Boolean.TRUE)) { continue; } TypeElement moduleType = (TypeElement) element; Map<String, Binding<?>> bindings = processCompleteModule(moduleType); try { new ProblemDetector().detectProblems(bindings.values()); } catch (IllegalStateException e) { error("Graph validation failed: " + e.getMessage(), moduleType); } try { writeDotFile(moduleType, bindings); } catch (IOException e) { error("Graph visualization failed: " + e, moduleType); } } return true; }

Target:
@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) { if (!env.processingOver()) { for (Element e : env.getElementsAnnotatedWith(Module.class)) { if (!(e instanceof TypeElement)) { error("@Module applies to a type, " + e.getSimpleName() + " is a " + e.getKind(), e); continue; } delayedModuleNames.add(((TypeElement) e).getQualifiedName().toString()); } return true; } Set<Element> modules = new LinkedHashSet<Element>(); for (String moduleName : delayedModuleNames) { modules.add(processingEnv.getElementUtils().getTypeElement(moduleName)); } for (Element element : modules) { Map<String, Object> annotation = CodeGen.getAnnotation(Module.class, element); if (!annotation.get("complete").equals(Boolean.TRUE)) { continue; } TypeElement moduleType = (TypeElement) element; Map<String, Binding<?>> bindings = processCompleteModule(moduleType); try { new ProblemDetector().detectProblems(bindings.values()); } catch (IllegalStateException e) { error("Graph validation failed: " + e.getMessage(), moduleType); continue; } try { writeDotFile(moduleType, bindings); } catch (IOException e) { error("Graph visualization failed: " + e, moduleType); } } return true; }
Source:
private Promise<Optional<Resource>> findResource(final Path absolutePath, boolean quiet) { String[] segments = absolutePath.segments(); Promise<Optional<Resource>> chain = promises.resolve(null); for (int i = 0; i <= segments.length; i++) { Path pathToRetrieve = absolutePath.removeLastSegments(segments.length - i); chain = chain.thenPromise(__ -> doFindResource(pathToRetrieve)); } return chain; }

Target:
private Promise<Optional<Resource>> findResource(final Path absolutePath, boolean quiet) { String[] segments = absolutePath.segments(); Promise<Optional<Resource>> chain = promises.resolve(null); for (int i = 0; i <= segments.length; i++) { Path pathToRetrieve = absolutePath.removeLastSegments(segments.length - i); chain = chain.thenPromise(ignored -> doFindResource(pathToRetrieve)); } return chain; }
Source:
public void onEvent(SetInstanceHeaderEvent event) { if (context.getModel().getSelectedColumn() == null) { return; } if (context.getModel().isSameInstanceType(event.getClassName())) { return; } context.getStatus().setFullPackage(event.getFullPackage()); context.getStatus().setClassName(event.getClassName()); if (((ScenarioGridColumn) context.getModel().getSelectedColumn()).isInstanceAssigned()) { org.uberfire.mvp.Command okPreserveCommand = () -> commonExecution(context, new SetInstanceHeaderCommand(), true); deletePopupPresenter.show(ScenarioSimulationEditorConstants.INSTANCE.changeTypeMainTitle(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeMainQuestion(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeText1(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeTextQuestion(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeTextDanger(), ScenarioSimulationEditorConstants.INSTANCE.changeType(), okPreserveCommand); } else { commonExecution(context, new SetInstanceHeaderCommand(), true); } }

Target:
public void onEvent(SetInstanceHeaderEvent event) { if (context.getModel().isSameInstanceType(event.getClassName())) { return; } context.getStatus().setFullPackage(event.getFullPackage()); context.getStatus().setClassName(event.getClassName()); if (((ScenarioGridColumn) context.getModel().getSelectedColumn()).isInstanceAssigned()) { org.uberfire.mvp.Command okPreserveCommand = () -> commonExecution(context, new SetInstanceHeaderCommand(), true); deletePopupPresenter.show(ScenarioSimulationEditorConstants.INSTANCE.changeTypeMainTitle(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeMainQuestion(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeText1(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeTextQuestion(), ScenarioSimulationEditorConstants.INSTANCE.changeTypeTextDanger(), ScenarioSimulationEditorConstants.INSTANCE.changeType(), okPreserveCommand); } else { commonExecution(context, new SetInstanceHeaderCommand(), true); } }
Source:
public void process(Element elm, JID actor, IQ reqIQ, Element rsm) throws InterruptedException, NodeStoreException { element = elm; request = reqIQ; response = IQ.createResultIQ(request); node = element.attributeValue("node"); this.actor = actor; if (null == this.actor) this.actor = request.getFrom(); if (!channelManager.isLocalNode(node)) { makeRemoteRequest(); return; } try { if (!validNodeProvided() || !nodeExists() || !itemIdProvided() || !itemExists() || !validPayload() || !canDelete()) { outQueue.put(response); return; } deleteItem(); outQueue.put(response); deleteReplies(); sendNotifications(node, itemId); return; } catch (NodeStoreException e) { logger.error(e); setErrorCondition(PacketError.Type.wait, PacketError.Condition.internal_server_error); } catch (NullPointerException e) { logger.error(e); setErrorCondition(PacketError.Type.modify, PacketError.Condition.bad_request); } catch (IllegalArgumentException e) { logger.error(e); setErrorCondition(PacketError.Type.modify, PacketError.Condition.bad_request); } outQueue.put(response); }

Target:
public void process(Element elm, JID actor, IQ reqIQ, Element rsm) throws InterruptedException, NodeStoreException { element = elm; request = reqIQ; response = IQ.createResultIQ(request); node = element.attributeValue("node"); this.actor = actor; if (null == this.actor) { this.actor = request.getFrom(); } if (!channelManager.isLocalNode(node)) { makeRemoteRequest(); return; } try { if (!validNodeProvided() || !nodeExists() || !itemIdProvided() || !itemExists() || !validPayload() || !canDelete()) { outQueue.put(response); return; } deleteItem(); outQueue.put(response); deleteReplies(); sendNotifications(node, itemId); return; } catch (NodeStoreException e) { logger.error(e); setErrorCondition(PacketError.Type.wait, PacketError.Condition.internal_server_error); } catch (NullPointerException e) { logger.error(e); setErrorCondition(PacketError.Type.modify, PacketError.Condition.bad_request); } catch (IllegalArgumentException e) { logger.error(e); setErrorCondition(PacketError.Type.modify, PacketError.Condition.bad_request); } outQueue.put(response); }
Source:
public BillTrade withPrice(double price) { return BillTrade.builder().info(info).product(product).quantity(quantity).price(price).build(); }

Target:
public BillTrade withPrice(double price) { return new BillTrade(info, product, quantity, price); }
Source:
protected Listcell renderOwner(final SummaryType summaryType) { Boolean isMakePublic = summaryType.isMakePublic(); String owner; if (isMakePublic != null && isMakePublic == true) { owner = "public"; } else { owner = summaryType.getOwner(); } Label label = new Label(owner); label.setClientAttribute("title", owner); return wrapIntoListCell(label); }

Target:
protected Listcell renderOwner(final SummaryType summaryType) { Boolean isMakePublic = summaryType.isMakePublic(); String owner = summaryType.getOwnerName(); Label label = new Label(owner); label.setClientAttribute("title", owner); return wrapIntoListCell(label); }
Source:
public void testCompareBasic() throws Exception { for (AvailableGitTestRepo testRepo : AvailableGitTestRepo.values()) { if (testRepo == AvailableGitTestRepo.GIT_COMMIT_ID) { continue; } mavenSandbox.withParentProject("my-basic-project", "jar").withNoChildProject().withGitRepoInParent(testRepo).create(); MavenProject targetProject = mavenSandbox.getParentProject(); verifyNativeAndJGit(testRepo, targetProject, DEFAULT_FORMAT_STRING); } }

Target:
public void testCompareBasic() throws Exception { for (AvailableGitTestRepo testRepo : AvailableGitTestRepo.values()) { if (testRepo != AvailableGitTestRepo.GIT_COMMIT_ID) { mavenSandbox.withParentProject("my-basic-project", "jar").withNoChildProject().withGitRepoInParent(testRepo).create(); MavenProject targetProject = mavenSandbox.getParentProject(); verifyNativeAndJGit(testRepo, targetProject, DEFAULT_FORMAT_STRING); } } }
Source:
protected void ensureValuesCapacity() { if (!outputChannelSet) { return; } int capacity = numValues + inputQualifyingSet.getPositionCount(); if (values == null) { values = new long[capacity]; } else if (values.length < capacity) { values = Arrays.copyOf(values, capacity); } }

Target:
protected void ensureValuesCapacity() { if (!outputChannelSet) { return; } int capacity = numValues + inputQualifyingSet.getPositionCount(); if (values == null || values.length < capacity) { values = resize(values, capacity); } }
Source:
public void createTest() throws Exception { context.turnOffAuthorisationSystem(); ObjectMapper mapper = new ObjectMapper(); EPersonRest data = new EPersonRest(); MetadataRest metadataRest = new MetadataRest(); data.setEmail("createtest@fake-email.com"); data.setCanLogIn(true); MetadataValueRest surname = new MetadataValueRest(); surname.setValue("Doe"); metadataRest.put("eperson.lastname", surname); MetadataValueRest firstname = new MetadataValueRest(); firstname.setValue("John"); metadataRest.put("eperson.firstname", firstname); data.setMetadata(metadataRest); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform(post("/api/eperson/epersons") .content(mapper.writeValueAsBytes(data)) .contentType(contentType)) .andExpect(status().isCreated()) .andExpect(jsonPath("$", Matchers.allOf( hasJsonPath("$.uuid", not(empty())), hasJsonPath("$.email", is("createtest@fake-email.com")), hasJsonPath("$.type", is("eperson")), hasJsonPath("$.canLogIn", is(true)), hasJsonPath("$.requireCertificate", is(false)), hasJsonPath("$._links.self.href", not(empty())), hasJsonPath("$.metadata", Matchers.allOf( matchMetadata("eperson.firstname", "John"), matchMetadata("eperson.lastname", "Doe") ))))); }

Target:
public void createTest() throws Exception { context.turnOffAuthorisationSystem(); ObjectMapper mapper = new ObjectMapper(); EPersonRest data = new EPersonRest(); MetadataRest metadataRest = new MetadataRest(); data.setEmail("createtest@fake-email.com"); data.setCanLogIn(true); MetadataValueRest surname = new MetadataValueRest(); surname.setValue("Doe"); metadataRest.put("eperson.lastname", surname); MetadataValueRest firstname = new MetadataValueRest(); firstname.setValue("John"); metadataRest.put("eperson.firstname", firstname); data.setMetadata(metadataRest); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform(post("/api/eperson/epersons") .content(mapper.writeValueAsBytes(data)) .contentType(contentType)) .andExpect(status().isCreated()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$", Matchers.allOf( hasJsonPath("$.uuid", not(empty())), hasJsonPath("$.email", is("createtest@fake-email.com")), hasJsonPath("$.type", is("eperson")), hasJsonPath("$.canLogIn", is(true)), hasJsonPath("$.requireCertificate", is(false)), hasJsonPath("$._links.self.href", not(empty())), hasJsonPath("$.metadata", Matchers.allOf( matchMetadata("eperson.firstname", "John"), matchMetadata("eperson.lastname", "Doe") ))))); }
Source:
private String getPushErrors() { StringBuilder messages = new StringBuilder(); for (URIish uri : result.getURIs()) { String errorMessage = result.getErrorMessage(uri); if (errorMessage != null && errorMessage.length() > 0) { if (messages.length() > 0) messages.append(System.lineSeparator()); messages.append(errorMessage); } } return messages.toString(); }

Target:
private String getPushErrors() { StringBuilder messages = new StringBuilder(); for (URIish uri : result.getURIs()) { String errorMessage = result.getErrorMessage(uri); if (errorMessage != null && errorMessage.length() > 0) { if (messages.length() > 0) { messages.append(System.lineSeparator()); } messages.append(errorMessage); } } return messages.toString(); }
Source:
public void testKeyEncryption() throws InvalidParametersException { String msg = "Test decryption"; String decrptedMsg; decrptedMsg = StringHelper.decrypt(StringHelper.encrypt(msg)); assertEquals(msg, decrptedMsg); try { StringHelper.decrypt("ABC"); signalFailureToDetectException("Decryption of invalid ciphertext should throw"); } catch (InvalidParametersException e) { ignoreExpectedException(); } }

Target:
public void testKeyEncryption() throws InvalidParametersException { String msg = "Test decryption"; String decrptedMsg; decrptedMsg = StringHelper.decrypt(StringHelper.encrypt(msg)); assertEquals(msg, decrptedMsg); }
Source:
public void defaultAuthenticationFailureEventIsPublished() { publisher = new DefaultAuthenticationEventPublisher(); Properties p = new Properties(); p.put(MockAuthenticationException.class.getName(), AuthenticationFailureDisabledEvent.class.getName()); publisher.setAdditionalExceptionMappings(p); publisher.setDefaultAuthenticationFailureEvent(AuthenticationFailureBadCredentialsEvent.class); ApplicationEventPublisher appPublisher = mock(ApplicationEventPublisher.class); publisher.setApplicationEventPublisher(appPublisher); publisher.publishAuthenticationFailure(new AuthenticationException("") { }, mock(Authentication.class)); verify(appPublisher).publishEvent(isA(AuthenticationFailureBadCredentialsEvent.class)); }

Target:
public void defaultAuthenticationFailureEventIsPublished() { publisher = new DefaultAuthenticationEventPublisher(); publisher.setDefaultAuthenticationFailureEvent(AuthenticationFailureBadCredentialsEvent.class); ApplicationEventPublisher appPublisher = mock(ApplicationEventPublisher.class); publisher.setApplicationEventPublisher(appPublisher); publisher.publishAuthenticationFailure(new AuthenticationException("") { }, mock(Authentication.class)); verify(appPublisher).publishEvent(isA(AuthenticationFailureBadCredentialsEvent.class)); }
Source:
private boolean downloadImages(Process process, URI userHome, URI destinationDirectory) { try { if (this.exportWithImages) { imageDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); fulltextDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); } else if (this.exportFullText) { fulltextDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); } directoryDownload(process, destinationDirectory); return true; } catch (Exception e) { if (exportDmsTask != null) { exportDmsTask.setException(e); } else { logger.error(e.getMessage(), e); Helper.setFehlerMeldung("Export canceled, Process: " + process.getTitle(), e); } return false; } }

Target:
private boolean downloadImages(Process process, URI userHome, URI destinationDirectory) { try { if (this.exportWithImages) { imageDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); fulltextDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); } else if (this.exportFullText) { fulltextDownload(process, userHome, atsPpnBand, DIRECTORY_SUFFIX); } directoryDownload(process, destinationDirectory); return true; } catch (IOException | InterruptedException | RuntimeException e) { if (exportDmsTask != null) { exportDmsTask.setException(e); } else { Helper.setErrorMessage("Export canceled, Process: " + process.getTitle(), logger, e); } return false; } }
Source:
public boolean visitSchemaRuleCommand( SchemaRuleCommand command ) throws IOException { closeCountsUpdaterIfOpen(); return false; }

Target:
public boolean visitSchemaRuleCommand( SchemaRuleCommand command ) throws IOException { assert !haveUpdates : "Assumed that a schema transaction wouldn't also contain data commands affecting " + "counts store, but was proven wrong with this transaction"; closeCountsUpdaterIfOpen(); return false; }
Source:
public void moveUnpluggedDiskVmUp() { command.getParameters().setParametersList(createMoveDisksParameters()); initDiskImage(diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageId, false); command.updateParameters(); assertTrue(command.getMoveDiskParametersList().size() == 1); }

Target:
public void moveUnpluggedDiskVmUp() { command.getParameters().setParametersList(createMoveDisksParameters()); initDiskImage(diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageId, false); command.updateParameters(); assertEquals(command.getMoveDiskParametersList().size(), 1); }
Source:
public void impl(@Nonnull CorfuRuntime runtime) throws Exception { runtime.invalidateLayout(); Layout layout = runtime.getLayoutView().getLayout(); if (layout.getUnresponsiveServers().contains(currentNode)) { throw new IllegalStateException("The node is in the unresponsive list."); } LogUnitClient logUnitClient = runtime.getLayoutView().getRuntimeLayout(layout).getLogUnitClient(currentNode); ProtocolBatchProcessor protocolBatchProcessor = ProtocolBatchProcessor .builder() .addressSpaceView(runtime.getAddressSpaceView()) .logUnitClient(logUnitClient) .build(); BasicTransferProcessor basicTransferProcessor = new BasicTransferProcessor(protocolBatchProcessor); CommittedBatchProcessor committedBatchProcessor = CommittedBatchProcessor .builder() .currentNode(currentNode) .runtimeLayout(runtime.getLayoutView().getRuntimeLayout(layout)) .build(); ParallelTransferProcessor parallelTransferProcessor = new ParallelTransferProcessor (committedProcessorNumConsumers, committedBatchProcessor); StateTransferManager transferManager = StateTransferManager .builder() .logUnitClient(logUnitClient) .batchSize(runtime.getParameters().getBulkReadSize()) .basicTransferProcessor(basicTransferProcessor) .parallelTransferProcessor(parallelTransferProcessor) .build(); while (RedundancyCalculator.canRestoreRedundancyOrMergeSegments(layout, currentNode)) { layout = restore(runtime, transferManager); } log.info("State transfer on {}: Restored.", currentNode); }

Target:
public void impl(@Nonnull CorfuRuntime runtime) throws Exception { Layout layout = runtime.getLayoutView().getLayout(); if (layout.getUnresponsiveServers().contains(currentNode)) { throw new IllegalStateException("The node is in the unresponsive list."); } LogUnitClient logUnitClient = runtime.getLayoutView().getRuntimeLayout(layout).getLogUnitClient(currentNode); ProtocolBatchProcessor protocolBatchProcessor = ProtocolBatchProcessor .builder() .addressSpaceView(runtime.getAddressSpaceView()) .logUnitClient(logUnitClient) .build(); BasicTransferProcessor basicTransferProcessor = new BasicTransferProcessor(protocolBatchProcessor); CommittedBatchProcessor committedBatchProcessor = CommittedBatchProcessor .builder() .currentNode(currentNode) .runtimeLayout(runtime.getLayoutView().getRuntimeLayout(layout)) .build(); ParallelTransferProcessor parallelTransferProcessor = new ParallelTransferProcessor(committedBatchProcessor); StateTransferManager transferManager = StateTransferManager .builder() .logUnitClient(logUnitClient) .batchSize(runtime.getParameters().getBulkReadSize()) .basicTransferProcessor(basicTransferProcessor) .parallelTransferProcessor(parallelTransferProcessor) .build(); while (RedundancyCalculator.canRestoreRedundancyOrMergeSegments(layout, currentNode)) { layout = restore(runtime, transferManager); } log.info("State transfer on {}: Restored.", currentNode); }
Source:
public void setUp() throws Exception { TheFlintstones d = docker.get(); ActiveDirectoryDomain activeDirectoryDomain = new ActiveDirectoryDomain(AD_DOMAIN, d.ipBound(3268)+ ":" + d.port(3268) , null, AD_MANAGER_DN, AD_MANAGER_DN_PASSWORD); List<ActiveDirectoryDomain> domains = new ArrayList<ActiveDirectoryDomain>(1); domains.add(activeDirectoryDomain); ActiveDirectorySecurityRealm activeDirectorySecurityRealm = new ActiveDirectorySecurityRealm(null, domains, null, null, null, null, GroupLookupStrategy.RECURSIVE, false, true, null, false, null, null); j.getInstance().setSecurityRealm(activeDirectorySecurityRealm); while(!FileUtils.readFileToString(d.getLogfile()).contains("custom (exit status 0; expected)")) { Thread.sleep(1000); } UserDetails userDetails = null; int i = 0; while (i < MAX_RETRIES && userDetails == null) { try { userDetails = j.jenkins.getSecurityRealm().loadUserByUsername("Fred"); } catch (AuthenticationServiceException e) { Thread.sleep(1000); } i ++; } DOCKER_IP = d.ipBound(3268); DOCKER_PORT = d.port(3268); }

Target:
public void setUp() throws Exception { TheFlintstones d = docker.get(); dockerIp = d.ipBound(3268); dockerPort = d.port(3268); ActiveDirectoryDomain activeDirectoryDomain = new ActiveDirectoryDomain(AD_DOMAIN, dockerIp + ":" + dockerPort , null, AD_MANAGER_DN, AD_MANAGER_DN_PASSWORD); List<ActiveDirectoryDomain> domains = new ArrayList<ActiveDirectoryDomain>(1); domains.add(activeDirectoryDomain); ActiveDirectorySecurityRealm activeDirectorySecurityRealm = new ActiveDirectorySecurityRealm(null, domains, null, null, null, null, GroupLookupStrategy.RECURSIVE, false, true, null, false, null, null); j.getInstance().setSecurityRealm(activeDirectorySecurityRealm); while(!FileUtils.readFileToString(d.getLogfile()).contains("custom (exit status 0; expected)")) { Thread.sleep(1000); } UserDetails userDetails = null; int i = 0; while (i < MAX_RETRIES && userDetails == null) { try { userDetails = j.jenkins.getSecurityRealm().loadUserByUsername("Fred"); } catch (AuthenticationServiceException e) { Thread.sleep(1000); } i ++; } }
Source:
private void requestReadMoreItems(final LayoutInflater layoutInflater, final HistoryEntry entry) { if (entry == null || TextUtils.isEmpty(entry.getTitle().getPrefixedText())) { hideReadMore(); layoutContent(); return; } final long timeMillis = System.currentTimeMillis(); new FullTextSearchClient().request(entry.getTitle().getWikiSite(), entry.getTitle().getPrefixedText(), null, null, Constants.MAX_SUGGESTION_RESULTS * 2, new FullTextSearchClient.Callback() { @Override public void success(@NonNull Call<MwQueryResponse<MwQueryResponse.Pages>> call, @NonNull SearchResults results) { Collections.sort(results.getResults(), new Comparator<SearchResult>() { @Override public int compare(SearchResult result, SearchResult t1) { int ret = ((Integer)result.getPageTitle().getIndex()).compareTo(t1.getPageTitle().getIndex()); return ret; } }); funnel.setLatency(System.currentTimeMillis() - timeMillis); readMoreItems = SearchResults.filter(new SearchResults(results.getResults(), results.getContinuation(), null), entry.getTitle().getPrefixedText(), true); if (!readMoreItems.getResults().isEmpty()) { setUpReadMoreSection(layoutInflater, readMoreItems); showReadMore(); } else { hideReadMore(); } layoutContent(); } @Override public void failure(@NonNull Call<MwQueryResponse<MwQueryResponse.Pages>> call, @NonNull Throwable caught) { Log.w(TAG, "Error while fetching Read More titles.", caught); layoutContent(); } } ); }

Target:
private void requestReadMoreItems(final LayoutInflater layoutInflater, final HistoryEntry entry) { if (entry == null || TextUtils.isEmpty(entry.getTitle().getPrefixedText())) { hideReadMore(); layoutContent(); return; } final long timeMillis = System.currentTimeMillis(); new FullTextSearchClient().request(entry.getTitle().getWikiSite(), entry.getTitle().getPrefixedText(), null, null, Constants.MAX_SUGGESTION_RESULTS * 2, new FullTextSearchClient.Callback() { @Override public void success(@NonNull Call<MwQueryResponse<MwQueryResponse.Pages>> call, @NonNull SearchResults results) { funnel.setLatency(System.currentTimeMillis() - timeMillis); Collections.sort(results.getResults(), new Comparator<SearchResult>() { @Override public int compare(SearchResult result, SearchResult t1) { int ret = ((Integer)result.getPageTitle().getIndex()).compareTo(t1.getPageTitle().getIndex()); return ret; } }); readMoreItems = SearchResults.filter(new SearchResults(results.getResults(), results.getContinuation(), null), entry.getTitle().getPrefixedText(), true); if (!readMoreItems.getResults().isEmpty()) { setUpReadMoreSection(layoutInflater, readMoreItems); showReadMore(); } else { hideReadMore(); } layoutContent(); } @Override public void failure(@NonNull Call<MwQueryResponse<MwQueryResponse.Pages>> call, @NonNull Throwable caught) { Log.w(TAG, "Error while fetching Read More titles.", caught); layoutContent(); } } ); }
Source:
private void checkComments(DetailAST token) { if (!allowMultipleEmptyLines) { if (Arrays.asList(TokenTypes.PACKAGE_DEF, TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT, TokenTypes.STATIC_INIT) .contains(token.getType())) { DetailAST previousNode = token.getPreviousSibling(); while (isCommentInBeginningOfLine(previousNode)) { if (hasEmptyLineBefore(previousNode) && isPrePreviousLineEmpty(previousNode)) { log(previousNode.getLineNo(), MSG_MULTIPLE_LINES, previousNode.getText()); } previousNode = previousNode.getPreviousSibling(); } } else { checkCommentsInsideToken(token); } } }

Target:
private void checkComments(DetailAST token) { if (!allowMultipleEmptyLines) { if (TOKEN_TYPES_WITHOUT_COMMENTS_TO_CHECK_INSIDE.contains(token.getType())) { DetailAST previousNode = token.getPreviousSibling(); while (isCommentInBeginningOfLine(previousNode)) { if (hasEmptyLineBefore(previousNode) && isPrePreviousLineEmpty(previousNode)) { log(previousNode, MSG_MULTIPLE_LINES, previousNode.getText()); } previousNode = previousNode.getPreviousSibling(); } } else { checkCommentsInsideToken(token); } } }
Source:
private void copyFileToDestination(Path exportPath) { Optional<Path> fileToExport = linkedFile.findIn(databaseContext, Globals.prefs.getFilePreferences()); Optional<Path> newPath = OptionalUtil.combine(Optional.of(exportPath), fileToExport, resolvePathFilename); if (newPath.isPresent()) { Path newFile = newPath.get(); boolean success = FileUtil.copyFile(fileToExport.get(), newFile, false); if (success) { dialogService.showInformationDialogAndWait(Localization.lang("Copy linked file"), Localization.lang("Sucessfully copied file to %0", newPath.map(Path::getParent).map(Path::toString).orElse(""))); } else { dialogService.showErrorDialogAndWait(Localization.lang("Copy linked file"), Localization.lang("Could not copy file to %0, maybe the file is already existing?", newPath.map(Path::getParent).map(Path::toString).orElse(""))); } } }

Target:
private void copyFileToDestination(Path exportPath) { Optional<Path> fileToExport = linkedFile.findIn(databaseContext, Globals.prefs.getFilePreferences()); Optional<Path> newPath = OptionalUtil.combine(Optional.of(exportPath), fileToExport, resolvePathFilename); if (newPath.isPresent()) { Path newFile = newPath.get(); boolean success = FileUtil.copyFile(fileToExport.get(), newFile, false); if (success) { dialogService.showInformationDialogAndWait(Localization.lang("Copy linked file"), Localization.lang("Sucessfully copied file to %0", newPath.map(Path::getParent).map(Path::toString).orElse(""))); } else { dialogService.showErrorDialogAndWait(Localization.lang("Copy linked file"), Localization.lang("Could not copy file to %0, maybe the file is already existing?", newPath.map(Path::getParent).map(Path::toString).orElse(""))); } } else { dialogService.showErrorDialogAndWait(Localization.lang("Could not resolve the file %0", fileToExport.map(Path::getParent).map(Path::toString).orElse(""))); } }
Source:
public Optional<ExerciseDesc> scanExercise(Path path, String exerciseName) { ProcessRunner runner = new ProcessRunner(this.getAvailablePointsCommand(), path); try { runner.call(); } catch (Exception e) { log.error(CANNOT_SCAN_EXERCISE_MESSAGE, e); } try { ImmutableList<TestDesc> testDescs = new RExerciseDescParser(path).parse(); return Optional.of(new ExerciseDesc(exerciseName, testDescs)); } catch (IOException e) { log.error(CANNOT_PARSE_EXERCISE_DESCRIPTION_MESSAGE, e); } return Optional.absent(); }

Target:
public Optional<ExerciseDesc> scanExercise(Path path, String exerciseName) { ProcessRunner runner = new ProcessRunner(this.getAvailablePointsCommand(), path); try { runner.call(); } catch (Exception e) { log.error(CANNOT_SCAN_EXERCISE_MESSAGE, e); return Optional.absent(); } try { ImmutableList<TestDesc> testDescs = new RExerciseDescParser(path).parse(); return Optional.of(new ExerciseDesc(exerciseName, testDescs)); } catch (IOException e) { log.error(CANNOT_PARSE_EXERCISE_DESCRIPTION_MESSAGE, e); } return Optional.absent(); }
Source:
private ACUser findUser(String name) throws ESException { ACUser result = null; for (final ACUser user : adminBroker.getUsers()) { if (user.getName().equals(name)) { result = user; } } return result; }

Target:
private ACUser findUser(String name) throws ESException { for (final ACUser user : adminBroker.getUsers()) { if (user.getName().equals(name)) { return user; } } return null; }
Source:
public String renderExternalContent(Model model, @SiteParam Site site, @PathVariable String pageName) throws IOException { String repoKeyPrefix = "c"; String repoKey = repoKeyPrefix.concat(".").concat(pageName); try { model.addAttribute("externalServiceName", "ember"); model.addAttribute("externalData", editorialContentService.getJson("externalContent", repoKey)); } catch (EntityNotFoundException e) { throw new NotFoundException(e); } return site + "/ftl/externalContent/container"; }

Target:
public String renderExternalContent(Model model, @SiteParam Site site, @PathVariable String pageName) throws IOException { String repoKey = REPO_KEY_PREFIX.concat(".").concat(pageName); model.addAttribute("externalServiceName", "ember"); try { model.addAttribute("externalData", editorialContentService.getJson("externalContent", repoKey)); } catch (EntityNotFoundException e) { throw new NotFoundException(e); } return site + "/ftl/externalContent/container"; }
Source:
static public void downloadAptDependencies(String packet) { Process proc; final Runtime rt = Runtime.getRuntime(); final String cmd = "apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances --no-pre-depends " + packet + " | grep \"^\\w\")"; System.out.println("Command: " + cmd); try { proc = rt.exec(new String[] {"bash", "-c", cmd}); proc.waitFor(); } catch (Exception e) { e.printStackTrace(); } }

Target:
static public void downloadAptDependencies(String packet) { Runtime rt = Runtime.getRuntime(); String cmd = "apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances --no-pre-depends " + packet + " | grep \"^\\w\")"; LOGGER.info("Executing command: " + cmd); try { rt.exec(new String[] {"bash", "-c", cmd}) .waitFor(); } catch (Exception e) { LOGGER.error("Error while downloading artifacts...", e); } }
Source:
private boolean validateDiskOnBackupDomain(StorageDomainValidator storageDomainValidator) { if (!validate(storageDomainValidator.isBackupStorageDomainUpdatedWithRunningVm())) { return false; } return true; }

Target:
private boolean validateDiskOnBackupDomain(StorageDomainValidator storageDomainValidator) { return validate(storageDomainValidator.isBackupStorageDomainUpdatedWithRunningVm()); }
Source:
protected ArtifactRepository getLocalRepository() throws Exception { ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" ); ArtifactRepository r = repositorySystem.createArtifactRepository( "local", "file://" + getLocalRepositoryPath().getAbsolutePath(), repoLayout, null, null ); return r; }

Target:
protected ArtifactRepository getLocalRepository() throws Exception { ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class ); ArtifactRepository r = repositorySystem.createArtifactRepository( "local", "file://" + getLocalRepositoryPath().getAbsolutePath(), repoLayout, null, null ); return r; }
Source:
public void testExecutionInfo_withPrefixBlock() throws Exception { scratch.file( "tests/BUILD", "sh_binary(name = 'with-prefix-block', srcs=['sh.sh'], tags=['block-some-feature', 'block-network', 'wrong-tag'])", "sh_binary(name = 'with-prefix-cpu', srcs=['sh.sh'], tags=['cpu:123', 'wrong-tag'])", "sh_binary(name = 'with-local-tag', srcs=['sh.sh'], tags=['local', 'some-tag'])" ); Rule withBlockPrefix = (Rule) getTarget(" Map<String, String> execInfo = TargetUtils.getExecutionInfo(withBlockPrefix); assertThat(execInfo).containsExactly("block-network", "", "block-some-feature", ""); }

Target:
public void testExecutionInfo_withPrefixBlock() throws Exception { scratch.file( "tests/BUILD", "sh_binary(name = 'with-prefix-block', srcs=['sh.sh'], tags=['block-some-feature', 'block-network', 'wrong-tag'])" ); Rule withBlockPrefix = (Rule) getTarget(" Map<String, String> execInfo = TargetUtils.getExecutionInfo(withBlockPrefix); assertThat(execInfo).containsExactly("block-network", "", "block-some-feature", ""); }
Source:
private Block roundTrip(final Block in, final Version version) { byte[] written; try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) { in.write(version.major, os); written = os.toByteArray(); } catch (final IOException e) { throw new RuntimeIOException(e); } try (final InputStream is = new ByteArrayInputStream(written)) { return Block.read(version.major, is); } catch (final IOException e) { throw new RuntimeIOException(e); } }

Target:
private Block roundTrip(final Block in, final Version version) throws IOException { byte[] written; try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) { in.write(version.major, os); written = os.toByteArray(); } try (final InputStream is = new ByteArrayInputStream(written)) { return Block.read(version.major, is); } }
Source:
public void test_evaluate_array_mixedTypes () { final AtomicReferenceArray<Object> atomicArray = new AtomicReferenceArray<>(3); atomicArray.set(0, "executing"); browser.addProgressListener(new ProgressListener() { @Override public void changed(ProgressEvent event) { } @Override public void completed(ProgressEvent event) { Object[] evalResult = (Object[]) browser.evaluate("return new Array(\"str1\", 2, true)"); atomicArray.set(0, evalResult[0]); atomicArray.set(1, evalResult[1]); atomicArray.set(2, evalResult[2]); if (browser_debug) System.out.println("Node value: "+ evalResult); } }); browser.setText("<html><body><p id='myid'>HelloWorld</p></body></html>"); shell.open(); for (int i = 0; i < (loopMultipier * secondsToWaitTillFail); i++) { runLoopTimer(waitMS); if (! "executing".equals(atomicArray.get(0))) { if (atomicArray.get(0).equals("str1") && ((Double) atomicArray.get(1)) == 2 && ((Boolean) atomicArray.get(2))) { return; } else { System.err.println("ERROR: test_evaluate_array_mixedTypes, resulting strings not as expected"); } } } fail(name.getMethodName() + " failed. Expected evaluate to return an array of mixed types. But didn't receive a return value or return values didn't match."); }

Target:
public void test_evaluate_array_mixedTypes () { assumeFalse(webkit1SkipMsg(), isWebkit1); final AtomicReferenceArray<Object> atomicArray = new AtomicReferenceArray<>(3); atomicArray.set(0, "executing"); browser.addProgressListener(new ProgressListener() { @Override public void changed(ProgressEvent event) { } @Override public void completed(ProgressEvent event) { Object[] evalResult = (Object[]) browser.evaluate("return new Array(\"str1\", 2, true)"); atomicArray.set(0, evalResult[0]); atomicArray.set(1, evalResult[1]); atomicArray.set(2, evalResult[2]); if (browser_debug) System.out.println("Node value: "+ evalResult); } }); browser.setText("<html><body><p id='myid'>HelloWorld</p></body></html>"); shell.open(); for (int i = 0; i < (loopMultipier * secondsToWaitTillFail); i++) { runLoopTimer(waitMS); if (! "executing".equals(atomicArray.get(0))) { if (atomicArray.get(0).equals("str1") && ((Double) atomicArray.get(1)) == 2 && ((Boolean) atomicArray.get(2))) { return; } else { fail("Resulting strings not as expected"); } } } fail("Expected evaluate to return an array of mixed types. But didn't receive a return value or return values didn't match."); }
Source:
public ValueExtractorDescriptor getMaximallySpecificAndContainerElementCompliantValueExtractor(Class<?> declaredType, TypeVariable<?> typeParameter) { Set<ValueExtractorDescriptor> maximallySpecificContainerElementCompliantValueExtractors = getMaximallySpecificValueExtractors( declaredType, getTypeCompliantAndContainerElementCompliantValueExtractors( declaredType, typeParameter ) ); if ( maximallySpecificContainerElementCompliantValueExtractors.isEmpty() ) { return null; } else if ( maximallySpecificContainerElementCompliantValueExtractors.size() == 1 ) { return maximallySpecificContainerElementCompliantValueExtractors.iterator().next(); } else { throw LOG.getUnableToGetMostSpecificValueExtractorDueToSeveralMaximallySpecificValueExtractorsDeclaredException( declaredType, ValueExtractorHelper.toValueExtractorClasses( maximallySpecificContainerElementCompliantValueExtractors ) ); } }

Target:
public ValueExtractorDescriptor getMaximallySpecificAndContainerElementCompliantValueExtractor(Class<?> declaredType, TypeVariable<?> typeParameter) { return valueExtractorResolver.getMaximallySpecificAndContainerElementCompliantValueExtractor( declaredType, typeParameter ); }
Source:
private Expression readAggregateExpression(int tokenT) { int type = ParserDQL.getExpressionType(tokenT); boolean distinct = false; boolean all = false; switch (tokenT) { case Tokens.RANK: case Tokens.DENSE_RANK: return null; } if (token.tokenType == Tokens.DISTINCT) { distinct = true; read(); } else if (token.tokenType == Tokens.ALL) { all = true; read(); } Expression e = XreadValueExpression(); switch (type) { case OpTypes.COUNT : if (e.getType() == OpTypes.MULTICOLUMN) { if (((ExpressionColumn) e).tableName != null) { throw unexpectedToken(); } e.opType = OpTypes.ASTERISK; break; } else { break; } case OpTypes.STDDEV_POP : case OpTypes.STDDEV_SAMP : case OpTypes.VAR_POP : case OpTypes.VAR_SAMP : case OpTypes.APPROX_COUNT_DISTINCT : if (all || distinct) { throw Error.error(ErrorCode.X_42582, all ? Tokens.T_ALL : Tokens .T_DISTINCT); } break; default : if (e.getType() == OpTypes.ASTERISK) { throw unexpectedToken(); } } Expression aggregateExp = new ExpressionAggregate(type, distinct, e); return aggregateExp; }

Target:
private Expression readAggregateExpression(int tokenT) { int type = ParserDQL.getExpressionType(tokenT); boolean distinct = false; boolean all = false; switch (tokenT) { case Tokens.RANK: case Tokens.DENSE_RANK: if (token.tokenType != Tokens.CLOSEBRACKET) { throw Error.error("Expected a right parenthesis (')') here.", "", -1); } return null; } if (token.tokenType == Tokens.DISTINCT) { distinct = true; read(); } else if (token.tokenType == Tokens.ALL) { all = true; read(); } Expression e = XreadValueExpression(); switch (type) { case OpTypes.COUNT : if (e.getType() == OpTypes.MULTICOLUMN) { if (((ExpressionColumn) e).tableName != null) { throw unexpectedToken(); } e.opType = OpTypes.ASTERISK; break; } else { break; } case OpTypes.STDDEV_POP : case OpTypes.STDDEV_SAMP : case OpTypes.VAR_POP : case OpTypes.VAR_SAMP : case OpTypes.APPROX_COUNT_DISTINCT : if (all || distinct) { throw Error.error(ErrorCode.X_42582, all ? Tokens.T_ALL : Tokens .T_DISTINCT); } break; default : if (e.getType() == OpTypes.ASTERISK) { throw unexpectedToken(); } } Expression aggregateExp = new ExpressionAggregate(type, distinct, e); return aggregateExp; }
Source:
public void setTransportTypes(Set<TransportType> transportTypes) { Translator transportTypeTranslator = EnumTranslator.Create(TransportType.class); StringBuilder transportTypesBuilder = new StringBuilder(); Iterator<TransportType> iterator = transportTypes.iterator(); while (iterator.hasNext()) { TransportType transportType = iterator.next(); if (transportTypeTranslator.containsKey(transportType)) { transportTypesBuilder.append(transportTypeTranslator.get(transportType)); } else { transportTypesBuilder.append(transportType.toString()); } if (iterator.hasNext()) { transportTypesBuilder.append(", "); } } this.transportTypes = new String(transportTypesBuilder.toString()); }

Target:
public void setTransportTypes(Set<TransportType> transportTypes) { this.transportTypes = transportTypes; }
Source:
private void processRecords(ConsumerRecords<String, String> records) { for (ConsumerRecord<String, String> record : records) { String featureName = record.key(); String featureStateAsString = record.value(); try { LOG.info("Starting to process state of feature {}.", featureName); FeatureStateStorageWrapper storageWrapper = deserialize(featureStateAsString); LOG.info("Successfully deserialized state of feature {}.", featureName); updateHandler.accept(featureName, storageWrapper); LOG.info("Successfully processed state of feature {}.", featureName); updatePartitionOffset(record.partition(), record.offset()); } catch (Exception e) { throw new RuntimeException("An error occurred while processing state of feature " + featureName + ".", e); } } }

Target:
private void processRecords(ConsumerRecords<String, String> records) { for (ConsumerRecord<String, String> record : records) { String featureName = record.key(); String featureStateAsString = record.value(); try { LOG.debug("Starting to process state of feature {}.", featureName); FeatureStateStorageWrapper storageWrapper = deserialize(featureStateAsString); LOG.debug("Successfully deserialized state of feature {}.", featureName); updateHandler.accept(featureName, storageWrapper); LOG.debug("Successfully processed state of feature {}.", featureName); updatePartitionOffset(record.partition(), record.offset()); } catch (Exception e) { throw new RuntimeException("An error occurred while processing state of feature " + featureName + ".", e); } } }
Source:
public DatabaseTestResult testStatus() { if (verifyConnection()) { if (verifyDatabaseExists()) { if (verifyDatabaseSchema()) { return DatabaseTestResult.TESTEDOK; } else { return DatabaseTestResult.SCHEMA_INVALID; } } else { return DatabaseTestResult.DB_DOES_NOT_EXIST; } } else { return DatabaseTestResult.CONNECTION_FAILED; } }

Target:
public DatabaseTestResult testStatus() { if (verifyConnection()) { if (verifyDatabaseExists()) { if (verifyDatabaseSchema()) { return DatabaseTestResult.TESTED_OK; } else { return DatabaseTestResult.SCHEMA_INVALID; } } else { return DatabaseTestResult.DB_DOES_NOT_EXIST; } } else { return DatabaseTestResult.CONNECTION_FAILED; } }
Source:
public Date getDateModified() { return getMetadata().get(PublishedInfo.TIME_MODIFIED, Date.class); }

Target:
public Date getDateModified() { return this.dateModified; }
Source:
public Set<Plugin> getAllDependencies(){ Map<Plugin,List<Plugin>> allDependencies = new HashMap<Plugin,List<Plugin>>(); return addMissingDependencies(allDependencies); }

Target:
public Set<Plugin> getAllDependencies(){ Map<Plugin,List<Plugin>> dependencyMap = new HashMap<Plugin,List<Plugin>>(); addMissingDependencies(dependencyMap); dependencyMap.remove(this); return dependencyMap.keySet(); }
Source:
private void replaceRuleIdsByRuleKeys(@Nullable Facets facets, List<RuleDefinitionDto> alreadyLoadedRules) { if (facets == null || facets.get(PARAM_RULES) == null) { return; } LinkedHashMap<String, Long> rulesFacet = facets.get(PARAM_RULES); try (DbSession dbSession = dbClient.openSession(false)) { Set<String> ruleKeysToLoad = new HashSet<>(); ruleKeysToLoad.addAll(rulesFacet.keySet()); ruleKeysToLoad.removeAll( alreadyLoadedRules .stream() .map(r -> r.getKey().toString()) .collect(Collectors.toList())); Set<RuleDefinitionDto> requiredRules = new HashSet<>(); requiredRules.addAll(alreadyLoadedRules); requiredRules.addAll(dbClient.ruleDao().selectDefinitionByIds(dbSession, Collections2.transform(ruleKeysToLoad, Integer::parseInt))); Map<Integer, RuleKey> idToRuleKey = requiredRules.stream() .collect(Collectors.toMap(RuleDefinitionDto::getId, RuleDefinitionDto::getKey)); LinkedHashMap<String, Long> newRulesFacet = new LinkedHashMap<>(); rulesFacet.forEach((k, v) -> { RuleKey ruleKey = idToRuleKey.get(Integer.parseInt(k)); if (ruleKey != null) { newRulesFacet.put(ruleKey.toString(), v); } else { LOGGER.error("Rule with id is not available in database", k); } }); rulesFacet.clear(); rulesFacet.putAll(newRulesFacet); } }

Target:
private void replaceRuleIdsByRuleKeys(@Nullable Facets facets, List<RuleDefinitionDto> alreadyLoadedRules) { if (facets == null || facets.get(PARAM_RULES) == null) { return; } LinkedHashMap<String, Long> rulesFacet = facets.get(PARAM_RULES); try (DbSession dbSession = dbClient.openSession(false)) { Set<String> ruleKeysToLoad = new HashSet<>(rulesFacet.keySet()); ruleKeysToLoad.removeAll( alreadyLoadedRules .stream() .map(r -> r.getKey().toString()) .collect(Collectors.toList())); Map<Integer, RuleKey> idToRuleKey = Stream.concat( alreadyLoadedRules.stream(), dbClient.ruleDao().selectDefinitionByIds(dbSession, Collections2.transform(ruleKeysToLoad, Integer::parseInt)).stream()) .collect(Collectors.toMap(RuleDefinitionDto::getId, RuleDefinitionDto::getKey)); LinkedHashMap<String, Long> newRulesFacet = new LinkedHashMap<>(); rulesFacet.forEach((k, v) -> { RuleKey ruleKey = idToRuleKey.get(Integer.parseInt(k)); if (ruleKey != null) { newRulesFacet.put(ruleKey.toString(), v); } else { LOGGER.error("Rule with id is not available in database", k); } }); rulesFacet.clear(); rulesFacet.putAll(newRulesFacet); } }