auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int getNumOfMsqOptions(int qnNumber) { int numOfOptions = 0; if (isGenerateOptionsForMsqChecked(qnNumber)) { String selectedOption = getGenerateOptionsForMsqValue(qnNumber); switch (selectedOption) { case "students": numOfOptions = getNumOfStudentsForFs(); break; case "teams": numOfOptions = getNumOfTeamsForFs(); break; case "instructors": numOfOptions = getNumOfInstructorsForFs(); break; default: numOfOptions = 0; break; } } else { numOfOptions = browser.driver.findElements( By.cssSelector("#msqChoiceTable-" + qnNumber + " div[id*=\"msqOptionRow\"]")).size(); } return numOfOptions; }

Target:
public int getNumOfMsqOptions(int qnNumber) { if (isGenerateOptionsForMsqChecked(qnNumber)) { String selectedOption = getGenerateOptionsForMsqValue(qnNumber); switch (selectedOption) { case "students": return getNumOfStudentsForFs(); case "teams": return getNumOfTeamsForFs(); case "instructors": return getNumOfInstructorsForFs(); default: return 0; } } return browser.driver.findElements( By.cssSelector("#msqChoiceTable-" + qnNumber + " div[id*=\"msqOptionRow\"]")).size(); }
Source:
public void preClose(final ObserverContext<RegionCoprocessorEnvironment> c, boolean abortRequested) { executor.shutdownNow(); GlobalCache.getInstance(c.getEnvironment()).getMetaDataCache().invalidateAll(); }

Target:
public void preClose(final ObserverContext<RegionCoprocessorEnvironment> c, boolean abortRequested) { executor.shutdownNow(); }
Source:
public void testDeserialize() throws Exception { String data = getResourceAsString("/api_fixtures/usage_record.json"); UsageRecord resource = APIResource.GSON.fromJson(data, UsageRecord.class); assertNotNull(resource); assertNotNull(resource.getId()); }

Target:
public void testDeserialize() throws Exception { final String data = getResourceAsString("/api_fixtures/usage_record.json"); final UsageRecord record = APIResource.GSON.fromJson(data, UsageRecord.class); assertNotNull(record); assertNotNull(record.getId()); assertEquals("usage_record", record.getObject()); }
Source:
private boolean pingLeader(Optional<PaxosValue> maybeGreatestLearnedValue) { if (!maybeGreatestLearnedValue.isPresent()) { return false; } return leaderPinger.pingLeaderWithUuid(UUID.fromString(maybeGreatestLearnedValue.get().getLeaderUUID())); }

Target:
private boolean pingLeader(Optional<PaxosValue> maybeGreatestLearnedValue) { return maybeGreatestLearnedValue .map(PaxosValue::getLeaderUUID) .map(UUID::fromString) .map(leaderPinger::pingLeaderWithUuid) .orElse(false); }
Source:
public int getNumIdleInstances(ServiceEndPoint endPoint) { String uniqueId = buildUniqueId(endPoint); return _instancesPerEndpoint.get(uniqueId) == null ? 0 : 1; }

Target:
public int getNumIdleInstances(ServiceEndPoint endPoint) { checkNotNull(endPoint); return _instancesPerEndpoint.containsKey(endPoint) ? 1 : 0; }
Source:
int fillData(HSSFSheet sheet, int rowNum, HSSFCellStyle style) { logger.entering(new Object[] { sheet, rowNum, style }); HSSFRow row; HSSFCell col; for (List<String> dataString : this.getLstEntities()) { for (String output : dataString) { String[] outputLines = output.split(":", 2); String outputColumn = outputLines[0]; String outputValue = (outputLines.length > 1) ? outputLines[1].trim() : output.trim(); int colNum = iStartColNum; row = sheet.createRow(rowNum); col = row.createCell(colNum); col.setCellStyle(Styles.getSubHeading2StyleThinBorder()); if (outputLines.length > 1) { col.setCellValue(outputColumn); } else { col.setCellValue(""); } colNum += 1; col = row.createCell(colNum); HSSFCellStyle rightCellStyle = (0 == dataString.indexOf(output)) ? Styles .getSubHeading2StyleThinBorder() : Styles.getStyleBorderThinLeftTop(); col.setCellStyle(rightCellStyle); if (outputValue.startsWith("file:")) { Hyperlink link = new HSSFHyperlink(Hyperlink.LINK_FILE); link.setAddress(outputValue); col.setCellStyle(Styles.getHyperLinkStyle()); col.setCellValue(outputValue); col.setHyperlink(link); } else if (outputValue.startsWith("http:") || outputValue.startsWith("https:")) { Hyperlink link = new HSSFHyperlink(Hyperlink.LINK_URL); link.setAddress(outputValue); col.setCellStyle(Styles.getHyperLinkStyle()); col.setCellValue(outputValue); col.setHyperlink(link); } else { col.setCellValue(outputValue); } rowNum += 1; } rowNum += 1; } sheet.autoSizeColumn(iStartColNum); sheet.autoSizeColumn(iStartColNum + 1); logger.exiting(rowNum); return rowNum; }

Target:
int fillData(HSSFSheet sheet, int rowNum, HSSFCellStyle style) { logger.entering(new Object[] { sheet, rowNum, style }); HSSFRow row; HSSFCell col; for (List<String> dataString : this.getLstEntities()) { for (String output : dataString) { String[] outputLines = output.split(":", 2); String outputColumn = (outputLines.length > 1) ? outputLines[0] : ""; String outputValue = (outputLines.length > 1) ? outputLines[1].trim() : output.trim(); int colNum = iStartColNum; row = sheet.createRow(rowNum); col = row.createCell(colNum); col.setCellStyle(Styles.getSubHeading2StyleThinBorder()); col.setCellValue(outputColumn); colNum += 1; col = row.createCell(colNum); HSSFCellStyle rightCellStyle = (0 == dataString.indexOf(output)) ? Styles .getSubHeading2StyleThinBorder() : Styles.getStyleBorderThinLeftTop(); col.setCellStyle(rightCellStyle); if (outputValue.startsWith("file:") && (!SystemUtils.IS_OS_MAC)) { Hyperlink link = new HSSFHyperlink(Hyperlink.LINK_FILE); link.setAddress(outputValue); col.setCellStyle(Styles.getHyperLinkStyle()); col.setCellValue(outputValue); col.setHyperlink(link); } else if (outputValue.startsWith("http:") || outputValue.startsWith("https:")) { Hyperlink link = new HSSFHyperlink(Hyperlink.LINK_URL); link.setAddress(outputValue); col.setCellStyle(Styles.getHyperLinkStyle()); col.setCellValue(outputValue); col.setHyperlink(link); } else { col.setCellValue(outputValue); } rowNum += 1; } rowNum += 1; } sheet.autoSizeColumn(iStartColNum); sheet.autoSizeColumn(iStartColNum + 1); logger.exiting(rowNum); return rowNum; }
Source:
public FirebaseAuthAnonymousUpgradeException(@ErrorCodes.Code int code, @NonNull IdpResponse response) { super(ErrorCodes.toFriendlyMessage(code)); this.response = response; }

Target:
public FirebaseAuthAnonymousUpgradeException(@ErrorCodes.Code int code, @NonNull IdpResponse response) { super(ErrorCodes.toFriendlyMessage(code)); mResponse = response; }
Source:
public static void removeCallControlMucAccount(String id) { ConfigurationService config = JigasiBundleActivator.getConfigurationService(); ProtocolProviderFactory xmppProviderFactory = ProtocolProviderFactory.getProtocolProviderFactory( JigasiBundleActivator.osgiContext, ProtocolNames.JABBER); AccountManager accountManager = ProtocolProviderActivator.getAccountManager(); String accountIDStr = config.getString( accountManager.getFactoryImplPackageName(xmppProviderFactory) + "." + id + "." + ProtocolProviderFactory.ACCOUNT_UID); AccountID accountID = accountManager.getStoredAccounts().stream() .filter(a -> a.getAccountUniqueID().equals(accountIDStr)) .findFirst().orElse(null); if (accountID != null) { boolean result = xmppProviderFactory.uninstallAccount(accountID); logger.info("Removing muc control account: " + id + ", successful:" + result); } else { logger.warn("No muc control account found for removing"); } }

Target:
public static boolean removeCallControlMucAccount(String id) { ConfigurationService config = JigasiBundleActivator.getConfigurationService(); ProtocolProviderFactory xmppProviderFactory = ProtocolProviderFactory.getProtocolProviderFactory( JigasiBundleActivator.osgiContext, ProtocolNames.JABBER); AccountManager accountManager = ProtocolProviderActivator.getAccountManager(); String accountIDStr = config.getString( accountManager.getFactoryImplPackageName(xmppProviderFactory) + "." + id + "." + ProtocolProviderFactory.ACCOUNT_UID); AccountID accountID = accountManager.getStoredAccounts().stream() .filter(a -> a.getAccountUniqueID().equals(accountIDStr)) .findFirst().orElse(null); if (accountID != null) { boolean result = xmppProviderFactory.uninstallAccount(accountID); logger.info("Removing muc control account: " + id + ", successful:" + result); return result; } else { logger.warn("No muc control account found for removing"); return false; } }
Source:
public List<Option> getOptions() { return unmodifiableList(options); }

Target:
public List<Option> getOptions() { return options; }
Source:
public void openFile() { FileDialog fd = new FileDialog(viewer.getControl().getShell(), SWT.OK); String filePath = fd.open(); if (!filePath.isEmpty()) { parseFile(filePath, "-1"); } else { showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "Not an Excel or Word file."); } viewer.refresh(); }

Target:
public void openFile() { FileDialog fd = new FileDialog(viewer.getControl().getShell(), SWT.OK); String filePath = fd.open(); if (!filePath.isEmpty()) { parseFile(filePath, OBJECT_ID_NOT_SPECIFIED); } else { showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "Couldn't find the file."); } viewer.refresh(); }
Source:
public void start() { if (isStarted) { return; } thread = new IncrementThread(); thread.start(); isStarted = true; Log.i(TAG, "Background job started."); }

Target:
public void start() { synchronized (lock) { if (isStarted) { return; } thread = new IncrementThread(); thread.start(); isStarted = true; Log.i(TAG, "Background job started."); } }
Source:
public Text next() { if (toBeReturned!=null) { Text result = toBeReturned; toBeReturned = null; return result; } else { return getNext(); } }

Target:
public Text next() { if (toBeReturned != null) { Text result = toBeReturned; toBeReturned = null; return result; } else { Text resultCandidate = getNext(); if (resultCandidate!=null) { return resultCandidate; } else { throw new NoSuchElementException(); } } }
Source:
private void handleOffsetOutOfRange(FetchPosition fetchPosition, TopicPartition topicPartition) { String errorMessage = "Fetch position " + fetchPosition + " is out of range for partition " + topicPartition; if (subscriptions.hasDefaultOffsetResetPolicy()) { log.info("{}, resetting offset", errorMessage); subscriptions.requestOffsetReset(topicPartition); } else { log.info("{}, raising error to the application", errorMessage); throw new OffsetOutOfRangeException(errorMessage, Collections.singletonMap(topicPartition, fetchPosition.offset)); } }

Target:
private void handleOffsetOutOfRange(FetchPosition fetchPosition, TopicPartition topicPartition) { String errorMessage = "Fetch position " + fetchPosition + " is out of range for partition " + topicPartition; if (subscriptions.hasDefaultOffsetResetPolicy()) { log.info("{}, resetting offset", errorMessage); subscriptions.requestOffsetReset(topicPartition); } else { log.info("{}, raising error to the application since no reset policy is configured", errorMessage); throw new OffsetOutOfRangeException(errorMessage, Collections.singletonMap(topicPartition, fetchPosition.offset)); } }
Source:
public void testAllModulesWithDefaultConfiguration() throws Exception { final String inputFilePath = getPath("InputAllChecksDefaultConfig.java"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; for (Class<?> module : CheckUtil.getCheckstyleModules()) { if (ModuleReflectionUtil.isRootModule(module)) { continue; } final DefaultConfiguration moduleConfig = createModuleConfig(module); if (module.equals(ImportControlCheck.class)) { moduleConfig.addAttribute("file", getPath( "InputAllChecksImportControl.xml")); } else if (module.equals(NewlineAtEndOfFileCheck.class)) { moduleConfig.addAttribute("lineSeparator", "lf"); } final Checker checker = createChecker(moduleConfig); verify(checker, inputFilePath, expected); } }

Target:
public void testAllModulesWithDefaultConfiguration() throws Exception { final String inputFilePath = getPath("InputAllChecksDefaultConfig.java"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; for (Class<?> module : CheckUtil.getCheckstyleModules()) { if (ModuleReflectionUtil.isRootModule(module)) { continue; } final DefaultConfiguration moduleConfig = createModuleConfig(module); if (module.equals(ImportControlCheck.class)) { moduleConfig.addAttribute("file", getPath( "InputAllChecksImportControl.xml")); } final Checker checker = createChecker(moduleConfig); verify(checker, inputFilePath, expected); } }
Source:
private void initOpenVideoButton(View view, final EditText embedCodeEditText, final EditText pCodeEditText, final CheckBox imaCheckBox) { view.findViewById(R.id.open_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AdType adType = imaCheckBox.isChecked() ? AdType.IMA : AdType.VAST; String embedCode = embedCodeEditText.getText().toString(); String pCode = pCodeEditText.getText().toString(); if (embedCode.isEmpty()) { embedCode = "dyeW82ZDE6cFE2fW4sWqaOSmRHVWj8yp"; adType = AdType.IMA; } if (pCode.isEmpty()) { pCode = "BzY2syOq6kIK6PTXN7mmrGVSJEFj"; } VideoData data = new VideoData(VideoItemType.VIDEO, "Custom video", adType, embedCode, pCode); FragmentActivity activity = getActivity(); if (activity instanceof VideoChooseInterface) { ((VideoChooseInterface) activity).onVideoChoose(data); } dismiss(); } }); }

Target:
private void initOpenVideoButton(View view, final EditText embedCodeEditText, final EditText pCodeEditText, final CheckBox imaCheckBox) { view.findViewById(R.id.open_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AdType adType = imaCheckBox.isChecked() ? AdType.IMA : AdType.VAST; String embedCode = embedCodeEditText.getText().toString(); String pCode = pCodeEditText.getText().toString(); if (embedCode.isEmpty()) { Toast.makeText(getContext(), "Embed code can't be empty!", Toast.LENGTH_LONG).show(); dismiss(); return; } if (pCode.isEmpty()) { pCode = "BzY2syOq6kIK6PTXN7mmrGVSJEFj"; } VideoData data = new VideoData(VideoItemType.VIDEO, "Custom video", adType, embedCode, pCode); FragmentActivity activity = getActivity(); if (activity instanceof VideoChooseInterface) { ((VideoChooseInterface) activity).onVideoChoose(data); } dismiss(); } }); }
Source:
public GalleryBuilderComponentObject clickGalleryButton(){ waitForElementByElement(galleryButton); scrollAndClick(galleryButton); PageObjectLogging.log("clickGallery", "gallery button clicked", true); return new GalleryBuilderComponentObject(driver); }

Target:
public GalleryBuilderComponentObject clickGalleryButton(){ waitForElementByElement(galleryButton); scrollAndClick(galleryButton); PageObjectLogging.log("clickGalleryButton", "gallery button clicked", true); return new GalleryBuilderComponentObject(driver); }
Source:
static BlobReadOptions fromBytes(DataInputStream stream, StoreKeyFactory factory, Log log) throws IOException { short version = stream.readShort(); switch (version) { case 0: Offset offset = new Offset(log.getStartOffset().getName(), stream.readLong()); long size = stream.readLong(); long ttl = stream.readLong(); StoreKey key = factory.getStoreKey(stream); return new BlobReadOptions(log, offset, size, ttl, key); case 1: offset = Offset.fromBytes(stream); size = stream.readLong(); ttl = stream.readLong(); key = factory.getStoreKey(stream); return new BlobReadOptions(log, offset, size, ttl, key); default: throw new IOException("Unknown version encountered for BlobReadOptions"); } }

Target:
static BlobReadOptions fromBytes(DataInputStream stream, StoreKeyFactory factory, Log log) throws IOException { short version = stream.readShort(); switch (version) { case 0: Offset offset = new Offset(log.getFirstSegment().getName(), stream.readLong()); long size = stream.readLong(); long expiresAtMs = stream.readLong(); StoreKey key = factory.getStoreKey(stream); return new BlobReadOptions(log, offset, size, expiresAtMs, key); case 1: offset = Offset.fromBytes(stream); size = stream.readLong(); expiresAtMs = stream.readLong(); key = factory.getStoreKey(stream); return new BlobReadOptions(log, offset, size, expiresAtMs, key); default: throw new IOException("Unknown version encountered for BlobReadOptions"); } }
Source:
protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { LOG.debug("Metrics servlet called"); String response = prometheusRegistry.scrape(); resp.getOutputStream().write(response.getBytes()); }

Target:
protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { LOG.debug("Metrics servlet called"); final String response = prometheusRegistry.scrape(); resp.getOutputStream().write(response.getBytes()); }
Source:
private String getRequestBody(HttpServerExchange exchange) { exchange.startBlocking(); Scanner scanner = new Scanner(exchange.getInputStream()).useDelimiter("\\A"); String requestBody = scanner.hasNext() ? scanner.next() : ""; requestBody = requestBody.replaceAll("\\s+",""); return requestBody; }

Target:
private String getRequestBody(HttpServerExchange exchange) { exchange.startBlocking(); Scanner scanner = new Scanner(exchange.getInputStream()).useDelimiter("\\A"); String requestBody = scanner.hasNext() ? scanner.next() : ""; requestBody = requestBody.replaceAll(">\\s+<", "><"); return requestBody; }
Source:
public void testSIPreventsReadSkewUsingWritePredicate(ITestContext context) throws Exception { TransactionManager tm = newTransactionManager(context); TTable txTable = new TTable(hbaseConf, TEST_TABLE); Transaction tx1 = tm.begin(); Transaction tx2 = tm.begin(); Scan rowId1Scan = new Scan(rowId1, rowId1); rowId1Scan.addColumn(famName, colName); assertNumberOfRows(txTable, tx1, 2, new Scan()); assertNumberOfRows(txTable, tx2, 2, new Scan()); Put updateRow1Tx2 = new Put(rowId1); updateRow1Tx2.add(famName, colName, Bytes.toBytes(12)); Put updateRow2Tx2 = new Put(rowId2); updateRow2Tx2.add(famName, colName, Bytes.toBytes(18)); txTable.put(tx2, Arrays.asList(updateRow1Tx2, updateRow2Tx2)); tm.commit(tx2); Filter f = new SingleColumnValueFilter(famName, colName, CompareFilter.CompareOp.EQUAL, Bytes.toBytes(20)); Scan checkFor20 = new Scan(); checkFor20.setFilter(f); ResultScanner checkFor20Scanner = txTable.getScanner(tx1, checkFor20); Result res = checkFor20Scanner.next(); while (res != null) { LOG.info("RESSS {}", res); LOG.info("Deleting row id with value {}", Bytes.toString(res.getRow()), Bytes.toInt(res.getValue(famName, colName))); Delete delete20 = new Delete(res.getRow()); txTable.delete(tx1, delete20); res = checkFor20Scanner.next(); } try { tm.commit(tx1); fail("Should be aborted"); } catch (RollbackException e) { } }

Target:
public void testSIPreventsReadSkewUsingWritePredicate(ITestContext context) throws Exception { TransactionManager tm = newTransactionManager(context); TTable txTable = new TTable(hbaseConf, TEST_TABLE); Transaction tx1 = tm.begin(); Transaction tx2 = tm.begin(); assertNumberOfRows(txTable, tx1, 2, new Scan()); assertNumberOfRows(txTable, tx2, 2, new Scan()); Put updateRow1Tx2 = new Put(rowId1); updateRow1Tx2.add(famName, colName, Bytes.toBytes(12)); Put updateRow2Tx2 = new Put(rowId2); updateRow2Tx2.add(famName, colName, Bytes.toBytes(18)); txTable.put(tx2, Arrays.asList(updateRow1Tx2, updateRow2Tx2)); tm.commit(tx2); Filter f = new SingleColumnValueFilter(famName, colName, CompareFilter.CompareOp.EQUAL, Bytes.toBytes(20)); Scan checkFor20 = new Scan(); checkFor20.setFilter(f); ResultScanner checkFor20Scanner = txTable.getScanner(tx1, checkFor20); Result res = checkFor20Scanner.next(); while (res != null) { LOG.info("RESSS {}", res); LOG.info("Deleting row id with value {}", Bytes.toString(res.getRow()), Bytes.toInt(res.getValue(famName, colName))); Delete delete20 = new Delete(res.getRow()); txTable.delete(tx1, delete20); res = checkFor20Scanner.next(); } try { tm.commit(tx1); fail("Should be aborted"); } catch (RollbackException e) { } }
Source:
protected void init(final ImmutableMap<String, Object> execEnvVars) throws DbException, IOException { if (connectionInfo == null && execEnvVars != null) { connectionInfo = (ConnectionInfo) execEnvVars.get(MyriaConstants.EXEC_ENV_VAR_DATABASE_CONN_INFO); } if (lang == MyriaConstants.FunctionLanguage.PYTHON) { BASE64Decoder decoder = new BASE64Decoder(); if (binary != null) { byte[] decodedBytes = decoder.decodeBuffer(binary); ByteBuffer binaryFunction = ByteBuffer.wrap(decodedBytes); PythonFunctionRegistrar pyFunc = new PythonFunctionRegistrar(connectionInfo); pyFunc.addFunction(name, binaryFunction, outputSchema.toString()); } else { throw new DbException("Cannot register python UDF without binary"); } } }

Target:
protected void init(final ImmutableMap<String, Object> execEnvVars) throws DbException, IOException { if (connectionInfo == null && execEnvVars != null) { connectionInfo = (ConnectionInfo) execEnvVars.get(MyriaConstants.EXEC_ENV_VAR_DATABASE_CONN_INFO); } switch (lang) { case POSTGRES: Pattern pattern = Pattern.compile("(CREATE FUNCTION)([\\s\\S]*)(LANGUAGE SQL;)"); Matcher matcher = pattern.matcher(description); if (matcher.matches()) { String modifiedReplaceFunction = description.replace("CREATE FUNCTION", "CREATE OR REPLACE FUNCTION"); accessMethod.runCommand(modifiedReplaceFunction); } else { throw new DbException("Postgres function is invalid."); } break; case PYTHON: if (binary != null) { PythonFunctionRegistrar pyFunc = new PythonFunctionRegistrar(connectionInfo); pyFunc.addFunction(name, description, outputType, isMultiValued, binary); } else { throw new DbException("Cannot register python UDF without binary."); } break; default: throw new DbException("Function language not supported!"); } }
Source:
public void rolloverException() throws Exception { final IncrementingPrintableStringGenerator gen = new IncrementingPrintableStringGenerator(2, ATOC); gen.setThrowExceptionOnRollover(true); int i = 0; try { while(i < 11) { ++i; gen.nextValue(); } fail("Expected RuntimeException"); } catch (RuntimeException e) { assertEquals(i, 10); } }

Target:
public void rolloverException() throws Exception { final IncrementingPrintableStringGenerator gen = new IncrementingPrintableStringGenerator(2, ATOC); gen.setThrowExceptionOnRollover(true); int i = 0; try { while(i < 11) { ++i; gen.nextValue(); } fail("Expected NoSuchElementException"); } catch (NoSuchElementException e) { assertEquals(i, 10); } }
Source:
protected IsWidget createBodyPanel(String header, VmNetworkInterface networkInterface) { descriptionHeaderPanel.getElement().setInnerHTML(header); descriptionHeaderPanel.add(createLinkStatusPanel( networkInterface != null ? networkInterface.isLinked() : false)); descriptionHeaderPanel.add(createCardPluggedStatusPanel( networkInterface != null ? networkInterface.isPlugged() : false)); createAdditionalInfoPanel(); return bodyPanel; }

Target:
protected IsWidget createBodyPanel(String header, VmNetworkInterface networkInterface) { checkBoxPanel.add(createLinkStatusPanel(isInterfaceUp(networkInterface))); checkBoxPanel.add(createCardPluggedStatusPanel(isCardPlugged(networkInterface))); descriptionHeaderPanel.getElement().setInnerText(header); createAdditionalInfoPanel(); return bodyPanel; }
Source:
public void performSearchByQueryPaged_twoPagesNotEqual() throws Exception { Page<BibEntry> page = fetcher.performSearchPaged("author:\"A\"", 0); Page<BibEntry> page2 = fetcher.performSearchPaged("author:\"A\"", 1); assertNotEquals(page.getContent(), page2.getContent(), "Two conseecutive pages shouldn't be equal"); }

Target:
public void performSearchByQueryPaged_twoPagesNotEqual() throws Exception { Page<BibEntry> page = fetcher.performSearchPaged("author:\"A\"", 0); Page<BibEntry> page2 = fetcher.performSearchPaged("author:\"A\"", 1); assertNotEquals(page.getContent(), page2.getContent(), "Two consecutive pages shouldn't be equal"); }
Source:
private void addStorageResource() { String storageAccountName = name.replaceAll("[^A-Za-z0-9 ]", "") + "storage"; variables.put("storageAccountName", storageAccountName); ResourceDefinition storageAccount = ResourceDefinition.builder() .name("[variables('storageAccountName')]") .type("Microsoft.Storage/storageAccounts") .location(location) .apiVersion("2015-06-15") .properties( StorageServiceProperties.builder() .accountType(StorageService.AccountType.Standard_LRS) .build() ) .build(); resources.add(storageAccount); }

Target:
private void addStorageResource() { String storageAccountName = name.replaceAll("[^A-Za-z0-9 ]", "") + "storage"; variables.put("storageAccountName", storageAccountName); ResourceDefinition storageAccount = ResourceDefinition.builder() .name("[variables('storageAccountName')]") .type("Microsoft.Storage/storageAccounts") .location(location) .apiVersion(STORAGE_API_VERSION) .properties( StorageServiceProperties.builder() .accountType(StorageService.AccountType.Standard_LRS) .build() ) .build(); resources.add(storageAccount); }
Source:
public ActiveDirectorySecurityRealm(String domain, String site, String bindName, String bindPassword, String server, GroupLookupStrategy groupLookupStrategy, boolean removeIrrelevantGroups, Boolean customDomain, CacheConfiguration cache) { this(domain,site,bindName,bindPassword,server,groupLookupStrategy,removeIrrelevantGroups, customDomain, cache, "30000", "60000"); }

Target:
public ActiveDirectorySecurityRealm(String domain, String site, String bindName, String bindPassword, String server, GroupLookupStrategy groupLookupStrategy, boolean removeIrrelevantGroups, Boolean customDomain, CacheConfiguration cache) { if (customDomain!=null && !customDomain) domain = null; this.domain = fixEmpty(domain); this.site = fixEmpty(site); this.bindName = fixEmpty(bindName); this.bindPassword = Secret.fromString(fixEmpty(bindPassword)); this.groupLookupStrategy = groupLookupStrategy; this.removeIrrelevantGroups = removeIrrelevantGroups; server = fixEmpty(server); if (server != null) { String[] servers = server.split(","); for (int i = 0; i < servers.length; i++) { if (!servers[i].contains(":")) { servers[i] += ":3268"; } } server = StringUtils.join(servers, ","); } this.server = server; this.cache = cache; }
Source:
private Factory<? extends CacheEntryEventFilter> getFilterFactory(ClientConnectionContext ctx) { if (filter == null) return null; if (!(filter instanceof BinaryObject)) throw new IgniteClientException(ClientStatus.FAILED, "Filter must be a BinaryObject: " + filter.getClass()); BinaryObjectImpl bo = (BinaryObjectImpl) filter; switch (filterPlatform) { case ClientPlatform.JAVA: { if (bo.typeId() == GridBinaryMarshaller.PLATFORM_JAVA_OBJECT_FACTORY_PROXY) { PlatformJavaObjectFactoryProxy prx = bo.deserialize(); CacheEntryEventSerializableFilter rmtFilter = (CacheEntryEventSerializableFilter) prx.factory(ctx.kernalContext()).create(); return FactoryBuilder.factoryOf(rmtFilter); } return bo.deserialize(); } case ClientPlatform.DOTNET: { PlatformContext platformCtx = ctx.kernalContext().platform().context(); String curPlatform = platformCtx.platform(); if (!PlatformUtils.PLATFORM_DOTNET.equals(curPlatform)) throw new IgniteClientException(ClientStatus.FAILED, "ScanQuery filter platform is " + PlatformUtils.PLATFORM_DOTNET + ", current platform is " + curPlatform); return FactoryBuilder.factoryOf(platformCtx.createContinuousQueryFilter(filter)); } default: throw new IgniteClientException(ClientStatus.FAILED, "Unsupported filter platform: " + filterPlatform); } }

Target:
private Factory<? extends CacheEntryEventFilter> getFilterFactory(ClientConnectionContext ctx) { if (filter == null) return null; if (!(filter instanceof BinaryObject)) throw new IgniteClientException(ClientStatus.FAILED, "Filter must be a BinaryObject: " + filter.getClass()); BinaryObjectImpl bo = (BinaryObjectImpl) filter; switch (filterPlatform) { case ClientPlatform.JAVA: { if (bo.typeId() == GridBinaryMarshaller.PLATFORM_JAVA_OBJECT_FACTORY_PROXY) { PlatformJavaObjectFactoryProxy prx = bo.deserialize(); CacheEntryEventSerializableFilter rmtFilter = (CacheEntryEventSerializableFilter) prx.factory(ctx.kernalContext()).create(); return FactoryBuilder.factoryOf(rmtFilter); } return bo.deserialize(); } case ClientPlatform.DOTNET: { PlatformContext platformCtx = ctx.kernalContext().platform().context(); String curPlatform = platformCtx.platform(); if (!PlatformUtils.PLATFORM_DOTNET.equals(curPlatform)) throw new IgniteClientException(ClientStatus.FAILED, "ContinuousQuery filter platform is " + PlatformUtils.PLATFORM_DOTNET + ", current platform is " + curPlatform); return FactoryBuilder.factoryOf(platformCtx.createContinuousQueryFilter(filter)); } default: throw new IgniteClientException(ClientStatus.FAILED, "Unsupported filter platform: " + filterPlatform); } }
Source:
private void fetchRandomArticles() { new RandomFetchTask(getActivity(), site) { @Override public void onFinish(ArrayList<PageTitle> result) { if (!isAdded()) { return; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { adapter.addAll(result); } else { for (PageTitle page : result) { adapter.add(page); } } fetchThumbnails(result); fetchWikidataIds(result); } @Override public void onCatch(Throwable caught) { if (!isAdded()) { return; } if (caught instanceof ApiException) { Crouton.makeText(getActivity(), R.string.error_network_error, Style.ALERT, randomContainer).show(); } else if (caught instanceof RandomFetchException) { Log.e("Wikipedia", "Could not get list of random articles: " + caught.toString()); Crouton.makeText(getActivity(), R.string.random_server_error, Style.ALERT, randomContainer).show(); } else { super.onCatch(caught); } } }.execute(); }

Target:
private void fetchRandomArticles() { new RandomFetchTask(getActivity(), site, NUMBER_OF_PAGES) { @Override public void onFinish(ArrayList<RandomPage> result) { if (!isAdded()) { return; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { adapter.addAll(result); } else { for (RandomPage page : result) { adapter.add(page); } } fetchWikiDataDescriptions(result); } @Override public void onCatch(Throwable caught) { if (!isAdded()) { return; } if (caught instanceof ApiException) { Crouton.makeText(getActivity(), R.string.error_network_error, Style.ALERT, randomContainer).show(); } else if (caught instanceof RandomFetchException) { Log.e("Wikipedia", "Could not get list of random articles: " + caught.toString()); Crouton.makeText(getActivity(), R.string.random_server_error, Style.ALERT, randomContainer).show(); } else { super.onCatch(caught); } } }.execute(); }
Source:
protected boolean isAccountAdmin(HttpServletRequest request) { M_log.debug("isAdmin() call"); String courseId = request.getParameter(Utils.LTI_PARAM_CANVAS_COURSE_ID); int userId = Integer.parseInt(request.getParameter(Utils.LTI_PARAM_CANVAS_USER_ID)); int courseAccountId = getCourseAccountId(courseId); if (courseAccountId == 0) { return false; } M_log.debug("*** Course Account ID " + courseAccountId); return determineIfUserIsAdminInHierarchy(userId, courseAccountId); }

Target:
protected boolean isAccountAdmin(HttpServletRequest request) { M_log.debug("isAdmin() call"); String courseId = request.getParameter(Utils.LTI_PARAM_CANVAS_COURSE_ID); int userId = Integer.parseInt(request.getParameter(Utils.LTI_PARAM_CANVAS_USER_ID)); int courseAccountId = getCourseAccountId(courseId); if (courseAccountId == 0) { M_log.error("Couldn't get the course account id for course "+courseId); return false; } M_log.debug("*** Course Account ID " + courseAccountId); return determineIfUserIsAdminInHierarchy(userId, courseAccountId); }
Source:
private void registerVillagerSkin(int villagerId, ResourceLocation villagerSkin) { if (newVillagers == null) { newVillagers = Maps.newHashMap(); } newVillagers.put(villagerId, villagerSkin); }

Target:
private void registerVillagerSkin(int villagerId, ResourceLocation villagerSkin) { }
Source:
public Task load(Long id) throws EntityNotFoundException { Task task = taskDao.load(id); task.setHref(MessageFormat.format(systemPropertiesProvider.getProperty(SDC_MANAGER_URL)+ Configuration.TASK_BASE_PATH, Long.valueOf(task.getId()) .toString(), task.getVdc())); return task; }

Target:
public Task load(Long id) throws EntityNotFoundException { Task task = taskDao.load(id); task.setHref(getHrefUrl(task)); return task; }
Source:
private void uploadBlocking(String key, long length, InputStream in, boolean casUpload) throws IOException, InterruptedException { InputStream wrappedIn = new FilterInputStream(in) { @Override public void close() { } }; UploadCommand upload = new UploadCommand(uri, casUpload, key, wrappedIn, length); Channel ch = null; boolean success = false; if (storedBlobs.putIfAbsent((casUpload ? "cas/" : "ac/") + key, true) == null) { try { ch = acquireUploadChannel(); ChannelFuture uploadFuture = ch.writeAndFlush(upload); uploadFuture.sync(); success = true; } catch (Exception e) { if (e instanceof HttpException) { HttpResponse response = ((HttpException) e).response(); if (authTokenExpired(response)) { refreshCredentials(); if (!reset(in)) { throw e; } putAfterCredentialRefresh(upload); success = true; return; } } throw e; } finally { if (!success) { storedBlobs.remove(key); } in.close(); if (ch != null) { releaseUploadChannel(ch); } } } }

Target:
private void uploadBlocking(String key, long length, InputStream in, boolean casUpload) throws IOException, InterruptedException { InputStream wrappedIn = new FilterInputStream(in) { @Override public void close() { } }; UploadCommand upload = new UploadCommand(uri, casUpload, key, wrappedIn, length); Channel ch = null; boolean success = false; if (storedBlobs.putIfAbsent((casUpload ? CAS_PREFIX : AC_PREFIX) + key, true) == null) { try { ch = acquireUploadChannel(); ChannelFuture uploadFuture = ch.writeAndFlush(upload); uploadFuture.sync(); success = true; } catch (Exception e) { if (e instanceof HttpException) { HttpResponse response = ((HttpException) e).response(); if (authTokenExpired(response)) { refreshCredentials(); if (!reset(in)) { throw e; } putAfterCredentialRefresh(upload); success = true; return; } } throw e; } finally { if (!success) { storedBlobs.remove(key); } in.close(); if (ch != null) { releaseUploadChannel(ch); } } } }
Source:
public Set<TaskId> prevTasks() { return data.prevTasks() .stream() .map(t -> new TaskId(t.topicGroupId(), t.partition())) .collect(Collectors.toSet()); }

Target:
public Set<TaskId> prevTasks() { if (prevTasksCache == null) { prevTasksCache = Collections.unmodifiableSet( data.prevTasks() .stream() .map(t -> new TaskId(t.topicGroupId(), t.partition())) .collect(Collectors.toSet()) ); } return prevTasksCache; }
Source:
public void testDirectArenaOffsetCacheLine() throws Exception { int capacity = 5; int alignment = 128; for (int i = 0; i < 1000; i++) { ByteBuffer bb = PlatformDependent.useDirectBufferNoCleaner() ? PlatformDependent.allocateDirectNoCleaner(capacity + alignment) : ByteBuffer.allocateDirect(capacity + alignment); PoolArena.DirectArena arena = new PoolArena.DirectArena(null, 0, 0, 9, 9, alignment); Method offsetCacheLineMethod = arena.getClass().getDeclaredMethod("offsetCacheLine", ByteBuffer.class); offsetCacheLineMethod.setAccessible(true); int offset = (Integer) offsetCacheLineMethod.invoke(arena, bb); long address = PlatformDependent.directBufferAddress(bb); int expected = alignment - (int) (address & (alignment - 1)); Assert.assertEquals(expected, offset); PlatformDependent.freeDirectBuffer(bb); } }

Target:
public void testDirectArenaOffsetCacheLine() throws Exception { int capacity = 5; int alignment = 128; for (int i = 0; i < 1000; i++) { ByteBuffer bb = PlatformDependent.useDirectBufferNoCleaner() ? PlatformDependent.allocateDirectNoCleaner(capacity + alignment) : ByteBuffer.allocateDirect(capacity + alignment); PoolArena.DirectArena arena = new PoolArena.DirectArena(null, 0, 0, 9, 9, alignment); int offset = arena.offsetCacheLine(bb); long address = PlatformDependent.directBufferAddress(bb); Assert.assertEquals(0, (offset + address) & (alignment - 1)); PlatformDependent.freeDirectBuffer(bb); } }
Source:
public void currentThreadsBusyCountUpdates() throws InterruptedException { Meter meter = getMeter(ThreadPoolMonitor.CURRENT_THREADS_BUSY); Iterator<Measurement> measurements = meter.measure().iterator(); assertEquals(0.0, measurements.next().value(), 0.0); Cancellable command = new Cancellable(); threadPoolExecutor.execute(command); Thread.sleep(60); PolledMeter.update(registry); measurements = meter.measure().iterator(); assertEquals(1.0, measurements.next().value(), 0.0); command.canceled = true; Thread.sleep(60); PolledMeter.update(registry); measurements = meter.measure().iterator(); assertEquals(0.0, measurements.next().value(), 0.0); }

Target:
public void currentThreadsBusyCountUpdates() throws InterruptedException { final Gauge gauge = getGauge(ThreadPoolMonitor.CURRENT_THREADS_BUSY); assertEquals(0.0, gauge.value(), 0.0); final CountDownLatch synchronizer = new CountDownLatch(1); final CountDownLatch terminator = new CountDownLatch(1); final TestRunnable command = new TestRunnable(synchronizer, terminator); latchedExecutor.execute(command); synchronizer.await(6, TimeUnit.SECONDS); PolledMeter.update(registry); assertEquals(1.0, gauge.value(), 0.0); terminator.countDown(); latchedExecutor.getCompletedLatch().await(6, TimeUnit.SECONDS); PolledMeter.update(registry); assertEquals(0.0, gauge.value(), 0.0); }
Source:
public void removeAccounts() { new Thread(new Runnable() { @Override public void run() { Logger.v(TAG, "removeAccounts:"); Account[] accountList = mAcctManager .getAccountsByType(AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE); if (accountList != null) { for (Account targetAccount : accountList) { Logger.v(TAG, "remove tokens for:" + targetAccount.name); Bundle brokerOptions = new Bundle(); brokerOptions.putString(AuthenticationConstants.Broker.ACCOUNT_REMOVE_TOKENS, AuthenticationConstants.Broker.ACCOUNT_REMOVE_TOKENS_VALUE); mAcctManager.getAuthToken(targetAccount, AuthenticationConstants.Broker.AUTHTOKEN_TYPE, brokerOptions, false, null , mHandler); } } } }).start(); }

Target:
public void removeAccounts() { new Thread(new Runnable() { @Override public void run() { Logger.v(TAG, "removeAccounts:"); Account[] accountList = mAcctManager .getAccountsByType(AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE); if (accountList.length != 0) { for (Account targetAccount : accountList) { Logger.v(TAG, "remove tokens for:" + targetAccount.name); Bundle brokerOptions = new Bundle(); brokerOptions.putString(AuthenticationConstants.Broker.ACCOUNT_REMOVE_TOKENS, AuthenticationConstants.Broker.ACCOUNT_REMOVE_TOKENS_VALUE); mAcctManager.getAuthToken(targetAccount, AuthenticationConstants.Broker.AUTHTOKEN_TYPE, brokerOptions, false, null , mHandler); } } } }).start(); }
Source:
public void addObject(String uri, boolean isPrivateAccess){ String subjectId = ""; String fileName = ""; String uriPart = null; String paramsPart = null; int idx = uri.indexOf("?"); if(idx > 0){ uriPart = uri.substring(0, idx); if(idx + 1 < uri.length()) paramsPart = uri.substring(idx + 1); }else uriPart = uri; String[] parts = uriPart.substring(1).split("/"); if(parts.length >= 3 && parts.length <=5 && parts[2] !=null) subjectId = parts[2]; else{ System.out.println("DAMS stats unknown uri: " + uri); return; } if(parts.length >= 4 && parts[3] != null && parts[3].startsWith("_")) fileName = parts[3]; if(subjectId == null || subjectId.length()!= 10){ System.out.println("Invalid subject " + subjectId + ": " + uri); return; } Map<String, ObjectCounter> iMap = itemsMap; if (isPrivateAccess) iMap = itemsMapPrivate; ObjectCounter objCounter = iMap.get(subjectId); if(objCounter == null){ objCounter = new ObjectCounter(subjectId); iMap.put(subjectId, objCounter); } if (uri.endsWith("/download")) { fileDownload(objCounter, fileName); } else { objCounter.increaseCounter(fileName); } }

Target:
public void addObject(String uri, boolean isPrivateAccess){ String subjectId = ""; String fileName = ""; String uriPart = null; String paramsPart = null; int idx = uri.indexOf("?"); if(idx > 0){ uriPart = uri.substring(0, idx); if(idx + 1 < uri.length()) paramsPart = uri.substring(idx + 1); }else uriPart = uri; String[] parts = uriPart.substring(1).split("/"); if(parts.length >= 3 && parts.length <=5 && parts[2] !=null) subjectId = parts[2]; else{ log.warn("DAMS stats unknown uri: " + uri); return; } if(parts.length >= 4 && parts[3] != null && parts[3].startsWith("_")) fileName = parts[3]; if(subjectId == null || subjectId.length()!= 10){ log.warn("Invalid subject " + subjectId + ": " + uri); return; } Map<String, ObjectCounter> iMap = itemsMap; if (isPrivateAccess) iMap = itemsMapPrivate; ObjectCounter objCounter = iMap.get(subjectId); if(objCounter == null){ objCounter = new ObjectCounter(subjectId); iMap.put(subjectId, objCounter); } if (uri.endsWith("/download")) { fileDownload(objCounter, fileName); } else { objCounter.increaseCounter(fileName); } }
Source:
public void getCurrentTheme(String siteId, Listener listener, ErrorListener errorListener) { String path = String.format("sites/%s/themes/mine", siteId, 1, 0); get(path, listener, errorListener); }

Target:
public void getCurrentTheme(String siteId, Listener listener, ErrorListener errorListener) { String path = String.format("sites/%s/themes/mine", siteId); get(path, listener, errorListener); }
Source:
private static void createSubtitleLabel(Composite parent, String text) { final Label label = new Label(parent, SWT.WRAP); label.setText(text + ':'); final FontDescriptor boldDescriptor = FontDescriptor.createFrom(parent.getFont()).setStyle(SWT.BOLD); final Font boldFont = boldDescriptor.createFont(parent.getDisplay()); label.setFont(boldFont); }

Target:
private static void createSubtitleLabel(Composite parent, String text) { final Label label = new Label(parent, SWT.WRAP); label.setText(text + ':'); final FontDescriptor boldDescriptor = FontDescriptor.createFrom(parent.getFont()).setStyle(SWT.BOLD); final Font boldFont = boldDescriptor.createFont(parent.getDisplay()); label.setFont(boldFont); label.addDisposeListener(event -> boldFont.dispose()); }
Source:
public void start(final BundleContext context) throws Exception { super.start(context); pluginId = context.getBundle().getSymbolicName(); Dictionary<String, String> props = new Hashtable<String, String>(4); props.put(DebugOptions.LISTENER_SYMBOLICNAME, pluginId); context.registerService(DebugOptionsListener.class.getName(), this, props); repositoryCache = new RepositoryCache(); indexDiffCache = new IndexDiffCache(); try { GitProjectData.reconfigureWindowCache(); } catch (RuntimeException e) { logError(CoreText.Activator_ReconfigureWindowCacheError, e); } GitProjectData.attachToWorkspace(true); IEclipsePreferences node = InstanceScope.INSTANCE.getNode(Activator.getPluginId()); String gitPrefix = node.get(GitCorePreferences.core_gitPrefix, null); if (gitPrefix != null) FS.DETECTED.setGitPrefix(new File(gitPrefix)); repositoryUtil = new RepositoryUtil(); secureStore = new EGitSecureStore(SecurePreferencesFactory.getDefault()); registerAutoShareProjects(); if (preDeleteProjectListener == null) { preDeleteProjectListener = new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResource resource = event.getResource(); if (resource instanceof IProject) { IProject project = (IProject) resource; if (RepositoryProvider.getProvider(project) instanceof GitProvider) { IResource dotGit = project.findMember(Constants.DOT_GIT); if (dotGit != null && dotGit.getType() == IResource.FOLDER) GitProjectData.reconfigureWindowCache(); } } } }; ResourcesPlugin.getWorkspace().addResourceChangeListener(preDeleteProjectListener, IResourceChangeEvent.PRE_DELETE); } }

Target:
public void start(final BundleContext context) throws Exception { super.start(context); pluginId = context.getBundle().getSymbolicName(); Dictionary<String, String> props = new Hashtable<String, String>(4); props.put(DebugOptions.LISTENER_SYMBOLICNAME, pluginId); context.registerService(DebugOptionsListener.class.getName(), this, props); repositoryCache = new RepositoryCache(); indexDiffCache = new IndexDiffCache(); try { GitProjectData.reconfigureWindowCache(); } catch (RuntimeException e) { logError(CoreText.Activator_ReconfigureWindowCacheError, e); } GitProjectData.attachToWorkspace(true); IEclipsePreferences node = InstanceScope.INSTANCE.getNode(Activator.getPluginId()); String gitPrefix = node.get(GitCorePreferences.core_gitPrefix, null); if (gitPrefix != null) FS.DETECTED.setGitPrefix(new File(gitPrefix)); repositoryUtil = new RepositoryUtil(); secureStore = new EGitSecureStore(SecurePreferencesFactory.getDefault()); registerAutoShareProjects(); registerPreDeleteResourceChangeListener(); }
Source:
public void clickOnProjectsButton() { seleniumWebDriverHelper .waitVisibility(By.xpath(" .click(); }

Target:
public void clickOnProjectsButton() { seleniumWebDriverHelper.waitAndClick(By.xpath(" }
Source:
protected final void describeMismatchSafely(final T item, final Description description) { description.appendText("body was: ").appendText(this.itext); }

Target:
protected final void describeMismatchSafely(final T item, final Description description) { try { description.appendText("body was: ").appendText(this.text(item)); } catch (final IOException ex) { throw new IllegalStateException(ex); } }
Source:
private static Text formatNoChecks(Text template, Map<String, ?> replacements) { if (template instanceof Placeholder) { Object replacement = replacements.get(((Placeholder) template).getKey()); if (replacement != null) { return Texts.of(template.getColor(), template.getStyle(), replacement); } } TextBuilder builder = template.builder(); builder.removeAll(); for (Text child : template.getChildren()) { builder.append(formatNoChecks(child, replacements)); } return builder.build(); }

Target:
private static Text formatNoChecks(Text template, Map<String, ?> replacements) { if (template instanceof Placeholder) { Object replacement = replacements.get(((Placeholder) template).getKey()); if (replacement != null) { List<Object> formats = new ArrayList<Object>(); formats.add(template.getColor()); formats.add(template.getStyle()); Optional<HoverAction<?>> hoverAction = template.getHoverAction(); if (hoverAction.isPresent()) { formats.add(hoverAction.get()); } Optional<ClickAction<?>> clickAction = template.getClickAction(); if (clickAction.isPresent()) { formats.add(clickAction.get()); } Optional<ShiftClickAction<?>> shiftClickAction = template.getShiftClickAction(); if (shiftClickAction.isPresent()) { formats.add(shiftClickAction.get()); } formats.add(replacement); return Texts.of(formats.toArray()); } } TextBuilder builder = template.builder(); builder.removeAll(); for (Text child : template.getChildren()) { builder.append(formatNoChecks(child, replacements)); } return builder.build(); }
Source:
private void refreshCustomizedStateConfig(final HelixDataAccessor accessor) { if (_propertyDataChangedMap.get(HelixConstants.ChangeType.CUSTOMIZED_STATE_CONFIG) .getAndSet(false)) { CustomizedStateConfig customizedStateConfig = accessor.getProperty(accessor.keyBuilder().customizedStateConfig()); if (customizedStateConfig != null) { _aggregationEnabledTypes = new HashSet<>(customizedStateConfig.getAggregationEnabledTypes()); } else { _aggregationEnabledTypes.clear(); } _customizedStateCache.setAggregationEnabledTypes(_aggregationEnabledTypes); LogUtil.logInfo(logger, getClusterEventId(), String .format("Reloaded CustomizedStateConfig for cluster %s, %s pipeline.", getClusterName(), getPipelineName())); } else { LogUtil.logInfo(logger, getClusterEventId(), String .format("No customized state config change for %s cluster, %s pipeline", getClusterName(), getPipelineName())); } }

Target:
private void refreshCustomizedStateConfig(final HelixDataAccessor accessor) { if (_propertyDataChangedMap.get(HelixConstants.ChangeType.CUSTOMIZED_STATE_CONFIG) .getAndSet(false)) { CustomizedStateConfig customizedStateConfig = accessor.getProperty(accessor.keyBuilder().customizedStateConfig()); if (customizedStateConfig != null) { _aggregationEnabledTypes = new HashSet<>(customizedStateConfig.getAggregationEnabledTypes()); } else { _aggregationEnabledTypes.clear(); } LogUtil.logInfo(logger, getClusterEventId(), String .format("Reloaded CustomizedStateConfig for cluster %s, %s pipeline.", getClusterName(), getPipelineName())); } else { LogUtil.logInfo(logger, getClusterEventId(), String .format("No customized state config change for %s cluster, %s pipeline", getClusterName(), getPipelineName())); } }