auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void addTopic(boolean internal, String name, List<TopicPartitionInfo> partitions, Map<String, String> configs) { if (allTopics.containsKey(name)) { throw new IllegalArgumentException(String.format("Topic %s was already added.", name)); } List<Node> replicas = null; for (TopicPartitionInfo partition : partitions) { if (!brokers.contains(partition.leader())) { throw new IllegalArgumentException("Leader broker unknown"); } if (!brokers.containsAll(partition.replicas())) { throw new IllegalArgumentException("Unknown brokers in replica list"); } if (!brokers.containsAll(partition.isr())) { throw new IllegalArgumentException("Unknown brokers in isr list"); } } allTopics.put(name, new TopicMetadata(internal, partitions, configs)); }

Target:
public void addTopic(boolean internal, String name, List<TopicPartitionInfo> partitions, Map<String, String> configs) { if (allTopics.containsKey(name)) { throw new IllegalArgumentException(String.format("Topic %s was already added.", name)); } List<Node> replicas = null; for (TopicPartitionInfo partition : partitions) { if (!brokers.contains(partition.leader())) { throw new IllegalArgumentException("Leader broker unknown"); } if (!brokers.containsAll(partition.replicas())) { throw new IllegalArgumentException("Unknown brokers in replica list"); } if (!brokers.containsAll(partition.isr())) { throw new IllegalArgumentException("Unknown brokers in isr list"); } if (replicas == null) { replicas = partition.replicas(); } else if (!replicas.equals(partition.replicas())) { throw new IllegalArgumentException("All partitions need to have the same replica nodes."); } } allTopics.put(name, new TopicMetadata(internal, partitions, configs)); }
Source:
public boolean determineApplyLimitPushDown() { final boolean forceLimitPushDown = validateAndGetForceLimitPushDown(); if (limitSpec instanceof DefaultLimitSpec) { DefaultLimitSpec defaultLimitSpec = (DefaultLimitSpec) limitSpec; if (defaultLimitSpec.getLimit() == Integer.MAX_VALUE) { return false; } if (forceLimitPushDown) { return true; } boolean sortHasNonGroupingFields = DefaultLimitSpec.sortingOrderHasNonGroupingFields( limitSpec, getDimensions() ); return !sortHasNonGroupingFields; } return false; }

Target:
public boolean determineApplyLimitPushDown() { final boolean forceLimitPushDown = validateAndGetForceLimitPushDown(); if (limitSpec instanceof DefaultLimitSpec) { DefaultLimitSpec defaultLimitSpec = (DefaultLimitSpec) limitSpec; if (defaultLimitSpec.getLimit() == Integer.MAX_VALUE) { return false; } if (forceLimitPushDown) { return true; } boolean sortHasNonGroupingFields = DefaultLimitSpec.sortingOrderHasNonGroupingFields( (DefaultLimitSpec) limitSpec, getDimensions() ); return !sortHasNonGroupingFields; } return false; }
Source:
void onAdd(InventoryScreen inventoryScreen) { inventoryScreen.setInteractText("---"); inventoryScreen.getInteractButton().setAction(uiElement -> { }); inventoryScreen.getInteractButton().setEnabled(false); }

Target:
void onAdd(InventoryScreen inventoryScreen) { inventoryScreen.setInteractText("---"); inventoryScreen.getInteractButton().setEnabled(false); }
Source:
public List<F> filterFiles(F[] files) { if (files.length < 2) { return Collections.emptyList(); } final Set<String> candidates = Arrays.asList(files).stream() .map(f -> getFilename(f)) .collect(Collectors.toSet()); List<F> results = new ArrayList<>(); for (F file : files) { if (this.filtersAndFunctions.entrySet().stream().anyMatch(entry -> { F[] fileToCheck = (F[]) Array.newInstance(file.getClass(), 1); fileToCheck[0] = file; if (entry.getKey().filterFiles(fileToCheck).size() > 0) { String markerName = entry.getValue().apply(getFilename(file)); return markerName != null && candidates.contains(markerName); } return false; })) { results.add(file); } } return results; }

Target:
public List<F> filterFiles(F[] files) { if (files.length < 2) { return Collections.emptyList(); } final Set<String> candidates = Arrays.stream(files) .map(this::getFilename) .collect(Collectors.toSet()); List<F> results = new ArrayList<>(); for (F file : files) { boolean anyMatch = this.filtersAndFunctions.entrySet().stream().anyMatch(entry -> { F[] fileToCheck = (F[]) Array.newInstance(file.getClass(), 1); fileToCheck[0] = file; if (entry.getKey().filterFiles(fileToCheck).size() > 0) { String markerName = entry.getValue().apply(getFilename(file)); return markerName != null && candidates.contains(markerName); } return false; }); if (anyMatch) { results.add(file); } } return results; }
Source:
public void consume(MentionsData data) throws XWikiException { try { DocumentReference author = this.documentReferenceResolver.resolve(data.getAuthorReference()); this.initContext(author, data.getWikiId()); DocumentReference dr = this.documentReferenceResolver.resolve(data.getDocumentReference()); XWikiDocument doc = this.documentRevisionProvider.getRevision(dr, data.getVersion()); if (doc != null) { Syntax syntax = doc.getSyntax(); XWikiDocument oldDoc; if (doc.getPreviousVersion() != null) { oldDoc = this.documentRevisionProvider.getRevision(dr, doc.getPreviousVersion()); } else { oldDoc = null; } DocumentReference documentReference = doc.getDocumentReference(); DocumentReference authorReference = doc.getAuthorReference(); if (oldDoc == null) { handleOnCreate(doc.getXDOM(), documentReference, authorReference, MentionLocation.DOCUMENT); traverseXObjectsOnCreate(doc.getXObjects(), documentReference, authorReference, syntax); } else { handleOnUpdate(oldDoc.getXDOM(), doc.getXDOM(), documentReference, authorReference, MentionLocation.DOCUMENT); traverseXObjectsOnUpdate(oldDoc.getXObjects(), doc.getXObjects(), documentReference, authorReference, syntax); } } } catch (ExecutionContextException e) { this.logger.warn("Failed to initalize the context of the mention update runnable. Cause [{}]", getRootCauseMessage(e)); } finally { this.execution.removeContext(); } }

Target:
public void consume(MentionsData data) throws XWikiException { try { DocumentReference author = this.documentReferenceResolver.resolve(data.getAuthorReference()); this.initContext(author, data.getWikiId()); DocumentReference dr = this.documentReferenceResolver.resolve(data.getDocumentReference()); XWikiDocument doc = this.documentRevisionProvider.getRevision(dr, data.getVersion()); if (doc != null) { Syntax syntax = doc.getSyntax(); DocumentReference documentReference = doc.getDocumentReference(); DocumentReference authorReference = doc.getAuthorReference(); if (doc.getPreviousVersion() == null) { handleOnCreate(doc.getXDOM(), documentReference, authorReference, DOCUMENT); traverseXObjectsOnCreate(doc.getXObjects(), documentReference, authorReference, syntax); } else { XWikiDocument oldDoc = this.documentRevisionProvider.getRevision(dr, doc.getPreviousVersion()); handleOnUpdate(oldDoc.getXDOM(), doc.getXDOM(), documentReference, authorReference, DOCUMENT); traverseXObjectsOnUpdate(oldDoc.getXObjects(), doc.getXObjects(), documentReference, authorReference, syntax); } } } catch (ExecutionContextException e) { this.logger.warn("Failed to initalize the context of the mention update runnable. Cause [{}]", getRootCauseMessage(e)); } finally { this.execution.removeContext(); } }
Source:
public DaemonReloadPage open() { m_driver.get(baseURI + "opennms/admin/daemons/index.jsp"); new WebDriverWait(m_driver, 5).until((Predicate<WebDriver>) (driver) -> getDaemonRows().size() == expectedDaemonCount); return this; }

Target:
public DaemonReloadPage open() { m_driver.get(getBaseUrl() + "opennms/admin/daemons/index.jsp"); return this; }
Source:
protected boolean validate() { boolean valid = true; if (getVm() == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (getVm().getStatus() != VMStatus.Up) { valid = failVmStatusIllegal(); } if (getParameters().getVm().getCpuPerSocket() > Config.<Integer>getValue( ConfigValues.MaxNumOfCpuPerSocket, getVm().getCompatibilityVersion().getValue())) { valid = failValidation(EngineMessage.ACTION_TYPE_FAILED_MAX_CPU_PER_SOCKET); } if (getParameters().getVm().getThreadsPerCpu() > Config.<Integer>getValue( ConfigValues.MaxNumOfThreadsPerCpu, getVm().getClusterCompatibilityVersion().getValue())) { valid = failValidation(EngineMessage.ACTION_TYPE_FAILED_MAX_THREADS_PER_CPU); } if (getParameters().getVm().getNumOfSockets() > Config.<Integer>getValue( ConfigValues.MaxNumOfVmSockets, getVm().getCompatibilityVersion().getValue())) { valid = failValidation(EngineMessage.ACTION_TYPE_FAILED_MAX_NUM_SOCKETS); } if (getParameters().getPlugAction() == PlugAction.PLUG) { if (!FeatureSupported.hotPlugCpu(getVm().getCompatibilityVersion(), getVm().getClusterArch())) { valid = failValidation(EngineMessage.HOT_PLUG_CPU_IS_NOT_SUPPORTED); } else { OsRepository osRepository = SimpleDependencyInjector.getInstance().get(OsRepository.class); if (!osRepository.isCpuHotplugSupported(getVm().getVmOsId())) { valid = failValidation(EngineMessage.HOT_PLUG_CPU_IS_NOT_SUPPORTED_FOR_GUEST_OS); } } } else if (!FeatureSupported.hotUnplugCpu(getVm().getCompatibilityVersion(), getVm().getClusterArch())) { valid = failValidation(EngineMessage.HOT_UNPLUG_CPU_IS_NOT_SUPPORTED); } return valid; }

Target:
protected boolean validate() { boolean valid = true; if (getVm() == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (getVm().getStatus() != VMStatus.Up) { valid = failVmStatusIllegal(); } if (getParameters().getVm().getCpuPerSocket() > Config.<Integer>getValue( ConfigValues.MaxNumOfCpuPerSocket, getVm().getCompatibilityVersion().getValue())) { valid = failValidation(EngineMessage.ACTION_TYPE_FAILED_MAX_CPU_PER_SOCKET); } if (getParameters().getVm().getThreadsPerCpu() > Config.<Integer>getValue( ConfigValues.MaxNumOfThreadsPerCpu, getVm().getClusterCompatibilityVersion().getValue())) { valid = failValidation(EngineMessage.ACTION_TYPE_FAILED_MAX_THREADS_PER_CPU); } if (getParameters().getVm().getNumOfSockets() > Config.<Integer>getValue( ConfigValues.MaxNumOfVmSockets, getVm().getCompatibilityVersion().getValue())) { valid = failValidation(EngineMessage.ACTION_TYPE_FAILED_MAX_NUM_SOCKETS); } if (getParameters().getPlugAction() == PlugAction.PLUG) { if (!FeatureSupported.hotPlugCpu(getVm().getCompatibilityVersion(), getVm().getClusterArch())) { valid = failValidation(EngineMessage.HOT_PLUG_CPU_IS_NOT_SUPPORTED); } else if (!osRepository.isCpuHotplugSupported(getVm().getVmOsId())) { valid = failValidation(EngineMessage.HOT_PLUG_CPU_IS_NOT_SUPPORTED_FOR_GUEST_OS); } } else if (!FeatureSupported.hotUnplugCpu(getVm().getCompatibilityVersion(), getVm().getClusterArch())) { valid = failValidation(EngineMessage.HOT_UNPLUG_CPU_IS_NOT_SUPPORTED); } return valid; }
Source:
boolean isCountryMatch(ChatChannelUser chatUser) { var fieldValue = countryFilterField.getEditor().getText(); if(fieldValue.isEmpty()) return true; Optional<Player> playerOptional = chatUser.getPlayer(); if(!playerOptional.isPresent()) return false; Player player = playerOptional.get(); var country = player.getCountry(); return country.toLowerCase().startsWith(fieldValue.toLowerCase()); }

Target:
boolean isCountryMatch(ChatChannelUser chatUser) { Optional<Player> playerOptional = chatUser.getPlayer(); if (!playerOptional.isPresent()) { return false; } String country = playerOptional.get().getCountry(); return currentSelectedCountries.contains(country); }
Source:
private String buildQueryString(Operator op, List<String> predicateValues) { switch (op) { case IN_INSENSITIVE: case IN: { return predicateValues.stream() .map((str) -> "\"" + str + "\"") .collect(Collectors.joining(" | ")); } case NOT_INSENSITIVE: case NOT: { return predicateValues.stream() .map((str) -> "-\"" + str + "\"") .collect(Collectors.joining(" + ")); } case INFIX_CASE_INSENSITIVE: case PREFIX_CASE_INSENSITIVE: case PREFIX: case INFIX: { return predicateValues.stream() .map((str) -> str + "*") .collect(Collectors.joining(" | ")); } default: throw new IllegalArgumentException("Unsupported Predicate Operator: " + op); } }

Target:
private String buildQueryString(Operator op, List<String> predicateValues) { switch (op) { case INFIX_CASE_INSENSITIVE: case PREFIX_CASE_INSENSITIVE: case PREFIX: case INFIX: { return predicateValues.stream() .map((str) -> str + "*") .collect(Collectors.joining(" | ")); } default: throw new IllegalArgumentException("Unsupported Predicate Operator: " + op); } }
Source:
public void close() throws IOException { super.close(); exportJob.close(); }

Target:
public void close() throws IOException { try (Closeable c = exportJob) { super.close(); } }
Source:
public boolean updateWithAccuCheckerReport(IoCAccuCheckerReport report) throws ArchiveException, IoCValidationException { if (report.getSource() == null || report.getSource().getId() == null || report.getSource().getId().getValue() == null) { throw new IoCValidationException("Accuchecker report doesn't have required field source.id.value."); } if (report.getAccuracy() == null) { throw new IoCValidationException("Accuchecker report doesn't have required field accuracy."); } boolean response = true; final HashMap<String, Integer> report_accuracy = report.getAccuracy(); String source_id_value = report.getSource().getId().getValue(); List<IoCRecord> iocs = archiveService.getMatchingEntries("source.id.value", source_id_value); for (IoCRecord ioc : iocs) { HashMap<String, Integer> combined_accuracy = new HashMap<>(); if (ioc.getAccuracy() != null) { combined_accuracy.putAll(ioc.getAccuracy()); } combined_accuracy.putAll(report_accuracy); ioc.setAccuracy(combined_accuracy); archiveService.setReportToIoCRecord(report, ioc.getDocumentId()); boolean cache_response = blacklistCacheService.addToCache(ioc); if (!cache_response) { response = false; } } return response; }

Target:
public boolean updateWithAccuCheckerReport(IoCAccuCheckerReport report) throws ArchiveException, IoCValidationException { if (report.getSource() == null || report.getSource().getId() == null || report.getSource().getId().getValue() == null) { throw new IoCValidationException("Accuchecker report doesn't have required field source.id.value."); } if (report.getAccuracy() == null) { throw new IoCValidationException("Accuchecker report doesn't have required field accuracy."); } boolean response = true; final HashMap<String, Integer> report_accuracy = report.getAccuracy(); String source_id_value = report.getSource().getId().getValue(); List<IoCRecord> iocs = archiveService.getMatchingActiveEnries("source.id.value", source_id_value); for (IoCRecord ioc : iocs) { HashMap<String, Integer> combined_accuracy = new HashMap<>(); if (ioc.getAccuracy() != null) { combined_accuracy.putAll(ioc.getAccuracy()); } combined_accuracy.putAll(report_accuracy); ioc.setAccuracy(combined_accuracy); archiveService.setReportToIoCRecord(report, ioc.getDocumentId()); boolean cache_response = blacklistCacheService.addToCache(ioc); if (!cache_response) { response = false; } } return response; }
Source:
private void getRegisters(final IFrameDMContext frameDmc, final MIRegisterGroupDMC groupDmc, IContainerDMContext containerDmc, final DataRequestMonitor<IRegisterDMContext[]> rm) { fRegisterNameCache.execute(fCommandFactory.createMIDataListRegisterNames(containerDmc), new DataRequestMonitor<MIDataListRegisterNamesInfo>(getExecutor(), rm) { @Override protected void handleSuccess() { String[] regNames = getData().getRegisterNames(); if (regNames.length == 0) { rm.done(); return; } if (frameDmc == null) rm.setData(makeRegisterDMCs(groupDmc, regNames)); else rm.setData(makeRegisterDMCs(groupDmc, frameDmc, regNames)); rm.done(); } }); }

Target:
private void getRegisters(final IFrameDMContext frameDmc, final MIRegisterGroupDMC groupDmc, IContainerDMContext containerDmc, final DataRequestMonitor<IRegisterDMContext[]> rm) { fRegisterNameCache.execute(fCommandFactory.createMIDataListRegisterNames(containerDmc), new ImmediateDataRequestMonitor<MIDataListRegisterNamesInfo>(rm) { @Override protected void handleSuccess() { String[] regNames = getData().getRegisterNames(); if (regNames.length == 0) { rm.done(); return; } if (frameDmc == null) rm.setData(makeRegisterDMCs(groupDmc, regNames)); else rm.setData(makeRegisterDMCs(groupDmc, frameDmc, regNames)); rm.done(); } }); }
Source:
private Query buildQuery(final Message<?> requestMessage) { Assert.isTrue(this.mongoDbQuery != null || this.mongoDbQueryExpression != null, "no query specified"); Query query; if (this.mongoDbQuery != null) { query = new BasicQuery(this.mongoDbQuery); } else { Object expressionValue = this.mongoDbQueryExpression.getValue(this.evaluationContext, requestMessage, Object.class); if (expressionValue instanceof String) { query = new BasicQuery((String) expressionValue); } else if (expressionValue instanceof Query) { query = ((Query) expressionValue); } else { throw new IllegalStateException("'queryExpression' must evaluate to String or org.springframework.data.mongodb.core.query.Query"); } } return query; }

Target:
private Query buildQuery(final Message<?> requestMessage) { Query query; Object expressionValue = this.queryExpression.getValue(this.evaluationContext, requestMessage, Object.class); if (expressionValue instanceof String) { query = new BasicQuery((String) expressionValue); } else if (expressionValue instanceof Query) { query = ((Query) expressionValue); } else { throw new IllegalStateException("'queryExpression' must evaluate to " + "String or org.springframework.data.mongodb.core.query.Query"); } return query; }
Source:
public boolean intersects(Interval1D that, double reciprocalRatio, int wiggle) { if (wiggle == 0) { return intersects(that, reciprocalRatio); } long len_this = reciprocalRatio == 1.0 ? this.length() : (long) Math.max(Math.ceil(this.length() * reciprocalRatio), 1l); long len_that = reciprocalRatio == 1.0 ? that.length() : (long) Math.max(Math.ceil(that.length() * reciprocalRatio), 1l); long maxOverlap = 0; long rightLim; long leftLim; if (getRight() < that.getRight()) { rightLim = Math.min(that.getRight(), getRight() + wiggle); } else { rightLim = Math.max(that.getRight(), getRight() - wiggle); } leftLim = rightLim - length() + 1l; long overlap = Math.min(rightLim, that.getRight()) - Math.max(leftLim, that.getLeft()) + 1l; maxOverlap = Math.max(maxOverlap, overlap); if (getLeft() < that.getLeft()) { leftLim = Math.min(that.getLeft(), getLeft() + wiggle); } else { leftLim = Math.max(that.getLeft(), getLeft() - wiggle); } rightLim = leftLim + length() - 1l; overlap = Math.min(rightLim, that.getRight()) - Math.max(leftLim, that.getLeft()) + 1l; maxOverlap = Math.max(maxOverlap, overlap); if (maxOverlap >= Math.max(len_this, len_that)) { return true; } return false; }

Target:
public boolean intersects(Interval1D that, double reciprocalRatio, int wiggle) { reciprocalRatio = Math.max(reciprocalRatio, ((double)1/Long.MAX_VALUE)); long maxAllowedShift = Math.max(-wiggle, Math.min(wiggle, that.getLeft() - this.getLeft())); long maxOverlap = Math.min(this.getRight() + maxAllowedShift, that.getRight()) - Math.max(this.getLeft() + maxAllowedShift, that.getLeft()) + 1l; return maxOverlap >= Math.max(this.length(), that.length()) * reciprocalRatio; }
Source:
public void issue1321() { CompilationUnit compilationUnit = JavaParser.parse("class X { X() private void testme() }"); LexicalPreservingPrinter.setup(compilationUnit); ClassOrInterfaceDeclaration type = compilationUnit.getClassByName("X").get(); type.getConstructors().get(0).setBody(new BlockStmt().addStatement("testme();")); assertEquals("class X { X() {\n testme();\n} private void testme() }", LexicalPreservingPrinter.print(compilationUnit)); }

Target:
public void issue1321() { CompilationUnit compilationUnit = JavaParser.parse("class X { X() private void testme() }"); LexicalPreservingPrinter.setup(compilationUnit); ClassOrInterfaceDeclaration type = compilationUnit.getClassByName("X").get(); type.getConstructors().get(0).setBody(new BlockStmt().addStatement("testme();")); assertEqualsNoEol("class X { X() {\n testme();\n} private void testme() }", LexicalPreservingPrinter.print(compilationUnit)); }
Source:
public void handleAnalysisStarted(TmfStartAnalysisSignal signal) { IAnalysisModule module = signal.getAnalysisModule(); if (module instanceof ITmfAnalysisModuleWithStateSystems && !module.isAutomatic()) { fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module); if (Iterables.contains(allModules(getTrace()), module)) { rebuild(); } else { for (ITmfTrace trace : TmfTraceManager.getInstance().getOpenedTraces()) { if (Iterables.contains(allModules(trace), module)) { resetView(trace); break; } } } } }

Target:
public void handleAnalysisStarted(TmfStartAnalysisSignal signal) { IAnalysisModule module = signal.getAnalysisModule(); if (module instanceof ITmfAnalysisModuleWithStateSystems && !module.isAutomatic()) { if (Iterables.contains(allModules(getTrace()), module)) { fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module); rebuild(); } else { for (ITmfTrace trace : TmfTraceManager.getInstance().getOpenedTraces()) { if (Iterables.contains(allModules(trace), module)) { fStartedAnalysis.add((ITmfAnalysisModuleWithStateSystems) module); resetView(trace); break; } } } } }
Source:
public static void main(String[] args) { System.out.println("to run the example use the following commands: " + "start -> this command will initiate " + "seed node join <index> -> this command will join a node (seed) from the list list -> " + "will list the current cluster state and leaders selected kill<index> -> " + "will shutdown a node"); Scanner scanner = new Scanner(System.in); boolean notExitCLI = true; while (notExitCLI) { System.out.print("ScaleCube: "); String command = scanner.next(); if (command.equals("start")) { createNode(-1); list(); } else if (command.startsWith("join")) { String index = scanner.next(); int i=-2; try{ i = Integer.valueOf(index); }catch(NumberFormatException ex){ System.out.println("invalid input value must be valid index number"); }; if(i>=0 && i<nodes.size()){ createNode(i); list(); } } else if (command.startsWith("list")) { list(); } else if (command.startsWith("kill")) { String index = scanner.next(); int i = Integer.valueOf(index); ICluster nodeA = nodes.get(i); nodeA.shutdown(); ICluster addr = nodes.remove(i); leaders.remove(addr); list(); } } }

Target:
public static void main(String[] args) { System.out.println("to run the example use the following commands: " + "start -> this command will initiate " + "seed node join <index> -> this command will join a node (seed) from the list list -> " + "will list the current cluster state and leaders selected kill<index> -> " + "will shutdown a node"); Scanner scanner = new Scanner(System.in); boolean notExitCLI = true; while (notExitCLI) { System.out.print("ScaleCube: "); String command = scanner.next(); if (command.equals("start")) { createNode(-1); list(); } else if (command.startsWith("join")) { String index = scanner.next(); int i = -2; try { i = Integer.valueOf(index); } catch (NumberFormatException ex) { System.out.println("invalid input value must be valid index number"); } ; if (i >= 0 && i < nodes.size()) { createNode(i); list(); } } else if (command.startsWith("list")) { list(); } else if (command.startsWith("kill")) { String index = scanner.next(); int i = Integer.valueOf(index); ICluster nodeA = nodes.get(i); nodeA.shutdown(); ICluster addr = nodes.remove(i); leaders.remove(addr); list(); } } scanner.close(); }
Source:
private void initializePresenter() { mainExecutor= new UIThreadExecutor(); IAsyncExecutor asyncExecutor = new AsyncExecutor(); IMediaRepository mediaRepository = new MediaRepository(); GetMediaUseCase getMediaUseCase = new GetMediaUseCase(mainExecutor, asyncExecutor, mediaRepository); settingsDataSource = new SettingsDataSource(); mPresenter = new MediaPresenter(getMediaUseCase, settingsDataSource.getSettings()); mPresenter.attachView(this); }

Target:
private void initializePresenter() { mainExecutor= new UIThreadExecutor(); IAsyncExecutor asyncExecutor = new AsyncExecutor(); IMediaRepository mediaRepository = new MediaRepository(); ISettingsRepository settingsDataSource = new SettingsDataSource(getActivity().getBaseContext()); GetMediaUseCase getMediaUseCase = new GetMediaUseCase(mainExecutor, asyncExecutor, mediaRepository); GetSettingsUseCase getSettingsUseCase = new GetSettingsUseCase(mainExecutor, asyncExecutor, settingsDataSource); SaveSettingsUseCase saveSettingsUseCase = new SaveSettingsUseCase(mainExecutor, asyncExecutor, settingsDataSource); mPresenter = new MediaPresenter(getMediaUseCase, getSettingsUseCase, saveSettingsUseCase); mPresenter.attachView(this); }
Source:
public PushCommand setRefSpecs(RefSpec... specs) { checkCallable(); this.refSpecs.clear(); for (RefSpec spec : specs) refSpecs.add(spec); return this; }

Target:
public PushCommand setRefSpecs(RefSpec... specs) { checkCallable(); this.refSpecs.clear(); Collections.addAll(refSpecs, specs); return this; }
Source:
public RebalanceTask(HelixManager manager, ClusterEventType clusterEventType, long nextRebalanceTime) { this(manager, clusterEventType, nextRebalanceTime, true); }

Target:
public RebalanceTask(HelixManager manager, ClusterEventType clusterEventType, long nextRebalanceTime) { this(manager, clusterEventType, nextRebalanceTime, Optional.empty()); }
Source:
public void copyPreviewToClipBoard() { StringBuilder previewStringContent = new StringBuilder(); Document document = previewView.getEngine().getDocument(); NodeList nodeList = document.getElementsByTagName("html"); for (int i = 0; i < nodeList.getLength(); i++) { Element element = (Element) nodeList.item(i); previewStringContent.append(element.getTextContent()); } String previewStringContentString = previewStringContent.toString().replaceAll("function highlight[\\w\\W]*\\}", ""); ClipboardContent content = new ClipboardContent(); content.putString(previewStringContentString); content.putHtml((String) previewView.getEngine().executeScript("document.documentElement.outerHTML")); clipBoardManager.setContent(content); }

Target:
public void copyPreviewToClipBoard() { StringBuilder previewStringContent = new StringBuilder(); Document document = previewView.getEngine().getDocument(); ClipboardContent content = new ClipboardContent(); content.putString(document.getElementById("content").getTextContent()); content.putHtml((String) previewView.getEngine().executeScript("document.documentElement.outerHTML")); clipBoardManager.setContent(content); }
Source:
public static void removeApplicationBeanFromSession(HttpSession session, String spName) { Map<String, UUID> spUniqueIdMap = (HashMap<String, UUID>) session.getAttribute("spUniqueIdMap"); if (spUniqueIdMap.get(spName) == null) { return; } session.removeAttribute(spUniqueIdMap.get(spName).toString()); spUniqueIdMap.remove(spName); }

Target:
public static void removeApplicationBeanFromSession(HttpSession session, String spName) { if(session.getAttribute("spUniqueIdMap") == null) { return; } Map<String, UUID> spUniqueIdMap = (HashMap<String, UUID>) session.getAttribute("spUniqueIdMap"); if (spUniqueIdMap.get(spName) == null) { return; } session.removeAttribute(spUniqueIdMap.get(spName).toString()); spUniqueIdMap.remove(spName); }
Source:
protected Node loadXMLNode() { try { File XMLFile = fFilePath.toFile(); if (XMLFile == null || !XMLFile.exists() || !XMLFile.isFile()) { return null; } DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder; dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(XMLFile); doc.getDocumentElement().normalize(); NodeList stateproviderNodes = doc.getElementsByTagName(TmfXmlStrings.STATE_PROVIDER); Element stateproviderNode = null; for (int i = 0; i < stateproviderNodes.getLength(); i++) { Element node = (Element) stateproviderNodes.item(i); String analysisid = node.getAttribute(TmfXmlStrings.ANALYSIS_ID); if (analysisid.equals(fStateId)) { stateproviderNode = node; } } if (stateproviderNode == null) { return null; } NodeList definedStateNodes = stateproviderNode.getElementsByTagName(TmfXmlStrings.STATE_VALUE); for (int i = 0; i < definedStateNodes.getLength(); i++) { Element node = (Element) definedStateNodes.item(i); fStateValues.put(node.getAttribute(TmfXmlStrings.NAME), node.getAttribute(TmfXmlStrings.VALUE)); } NodeList locationNodes = stateproviderNode.getElementsByTagName(TmfXmlStrings.LOCATION); fLocations = new ArrayList<>(); for (int i = 0; i < locationNodes.getLength(); i++) { Node node = locationNodes.item(i); TmfXmlLocation location = new TmfXmlLocation(node, fStateValues); fLocations.add(location); } return stateproviderNode; } catch (ParserConfigurationException e) { Activator.logError("Error loading XML file", e); } catch (SAXException e) { Activator.logError(NLS.bind(Messages.XmlUtils_XmlValidationError, e.getLocalizedMessage()), e); } catch (IOException e) { Activator.logError("Error loading XML file", e); } return null; }

Target:
private Element loadXMLNode() { try { File XMLFile = fFilePath.toFile(); if (XMLFile == null || !XMLFile.exists() || !XMLFile.isFile()) { return null; } DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder; dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(XMLFile); doc.getDocumentElement().normalize(); NodeList stateproviderNodes = doc.getElementsByTagName(TmfXmlStrings.STATE_PROVIDER); Element stateproviderNode = null; for (int i = 0; i < stateproviderNodes.getLength(); i++) { Element node = (Element) stateproviderNodes.item(i); String analysisid = node.getAttribute(TmfXmlStrings.ANALYSIS_ID); if (analysisid.equals(fStateId)) { stateproviderNode = node; } } return stateproviderNode; } catch (ParserConfigurationException | IOException e) { Activator.logError("Error loading XML file", e); } catch (SAXException e) { Activator.logError(NLS.bind(Messages.XmlUtils_XmlValidationError, e.getLocalizedMessage()), e); } return null; }
Source:
public List<String> getResourceCrnListByResourceNameList(List<String> resourceNames) { return resourceNames.stream() .map(resourceName -> blueprintRepository.findResourceCrnByNameAndAccountId(resourceName, ThreadBasedUserCrnProvider.getAccountId()).orElse(null)) .collect(Collectors.toList()); }

Target:
public List<String> getResourceCrnListByResourceNameList(List<String> resourceNames) { return resourceNames.stream() .map(resourceName -> blueprintRepository.findResourceCrnByNameAndAccountId(resourceName, ThreadBasedUserCrnProvider.getAccountId()) .orElseThrow(NotFoundException.notFound("Blueprint", resourceName))) .collect(Collectors.toList()); }
Source:
public void applyState(ShapeState shapeState) { if (!this.state.equals(shapeState)) { this.state = shapeState; if (ShapeState.SELECTED.equals(shapeState)) { applyActiveState(ShapeState.SELECTED.getColor()); } else if (ShapeState.HIGHLIGHT.equals(shapeState)) { applyActiveState(ShapeState.HIGHLIGHT.getColor()); } else if (ShapeState.INVALID.equals(shapeState)) { applyActiveState(ShapeState.INVALID.getColor()); } else { applyNoneState(); } } }

Target:
public void applyState(ShapeState shapeState) { if (!this.state.equals(shapeState)) { this.state = shapeState; switch (this.state) { case NONE: applyNoneState(); break; default: applyActiveState(shapeState.getColor()); } } }
Source:
public static String normaliseName(final String name) { if (name == null) { return ""; } if (isEscaped(name)) { return name.substring(1,name.length() - 1).replace("\"\"", "\""); } return dbfit.util.NameNormaliser.normaliseName(name); }

Target:
public static String normaliseName(final String name) { if (name == null || name.isEmpty()) { return ""; } if (isEscaped(name)) { return name.substring(1, name.length() - 1).replace("\"\"", "\""); } return dbfit.util.NameNormaliser.normaliseName(name); }
Source:
public void setRuleConfigValue(String key, String value) { for (RuleConfig token : rcs) { if (token.getKey().equals(key)) { token.setValue(value); return; } } }

Target:
public void setRuleConfigValue(String key, String value) { int row = 0; for (RuleConfig token : rcs) { if (token.getKey().equals(key)) { token.setValue(value); this.fireTableCellUpdated(row, 2); return; } row++; } }
Source:
public void scalarSubQueryInClause2() { this.query() .select(employee) .from(employee) .where( SQLExpressions .select(employee.firstname) .from(employee) .orderBy(employee.salary.asc()) .limit(1) .in("Mike", "Mary") ) .fetch(); }

Target:
public void scalarSubQueryInClause2() { SQLSerializer serializer = new SQLSerializer(Configuration.DEFAULT); serializer.handle( this.query() .from(employee) .where( SQLExpressions .select(employee.firstname) .from(employee) .orderBy(employee.salary.asc()) .limit(1) .in("Mike", "Mary") )); expectedQuery = "(\nfrom EMPLOYEE e\n" + "where (select e.FIRSTNAME\n" + "from EMPLOYEE e\n" + "order by e.SALARY asc\n" + "limit ?) in (?, ?))"; assertEquals(expectedQuery, serializer.toString()); }
Source:
public void getObjectWithSync() throws Exception { final String bucketName = "test_get_object_with_sync"; final String objectName = "beowulf.txt"; try { Util.copyFile(objectName, Util.RESOURCE_BASE_NAME, Util.DOWNLOAD_BASE_NAME); File file = new File(Util.DOWNLOAD_BASE_NAME + "/" + objectName); DateTime modTime = new DateTime().minusHours(1); file.setLastModified(modTime.getMillis()); Util.createBucket(client, bucketName); Util.loadBookTestData(client, bucketName); final Arguments args = new Arguments(new String[]{"--http", "-c", "get_object", "-b", bucketName, "-o", objectName, "-d", Util.DOWNLOAD_BASE_NAME, "--sync"}); CommandResponse response = Util.command(client, args); assertThat(response.getMessage(), is("SUCCESS: Finished syncing object.")); } finally { Util.deleteBucket(client, bucketName); Util.deleteLocalFile(objectName); } }

Target:
public void getObjectWithSync() throws Exception { final String bucketName = "test_get_object_with_sync"; final String objectName = "beowulf.txt"; try { Util.copyFile(objectName, Util.RESOURCE_BASE_NAME, Util.DOWNLOAD_BASE_NAME); final File file = new File(Util.DOWNLOAD_BASE_NAME + File.separator + objectName); final DateTime modTime = new DateTime().minusHours(1); file.setLastModified(modTime.getMillis()); Util.createBucket(client, bucketName); Util.loadBookTestData(client, bucketName); final Arguments args = new Arguments(new String[]{"--http", "-c", "get_object", "-b", bucketName, "-o", objectName, "-d", Util.DOWNLOAD_BASE_NAME, "--sync"}); final CommandResponse response = Util.command(client, args); assertThat(response.getMessage(), is("SUCCESS: Finished syncing object.")); } finally { Util.deleteBucket(client, bucketName); Util.deleteLocalFile(objectName); } }
Source:
public Node visitCreateTable(SqlBaseParser.CreateTableContext context) { Optional<String> comment = Optional.empty(); if (context.COMMENT() != null) { comment = Optional.of(((StringLiteral) visit(context.string())).getValue()); } TableProperties properties; if (context.tableProperties() != null) { properties = (TableProperties) visit(context.tableProperties()); } else { properties = new TableProperties(); } return new CreateTable( getLocation(context), getQualifiedName(context.qualifiedName()), visit(context.tableElement(), TableElement.class), context.EXISTS() != null, properties, comment); }

Target:
public Node visitCreateTable(SqlBaseParser.CreateTableContext context) { Optional<String> comment = Optional.empty(); if (context.COMMENT() != null) { comment = Optional.of(((StringLiteral) visit(context.string())).getValue()); } List<Property> properties = ImmutableList.of(); if (context.properties() != null) { properties = visit(context.properties().property(), Property.class); } return new CreateTable( getLocation(context), getQualifiedName(context.qualifiedName()), visit(context.tableElement(), TableElement.class), context.EXISTS() != null, properties, comment); }
Source:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper( (HttpServletRequest) servletRequest) { @Override public String getRequestURI() { String newNormal = URI.create(super.getRequestURI()).normalize().toString(); while(newNormal.indexOf(" newNormal = newNormal.replace(" } return newNormal; } }; filterChain.doFilter(requestWrapper, servletResponse); }

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper( (HttpServletRequest) servletRequest) { @Override public String getRequestURI() { try { String newNormal = URI.create(super.getRequestURI()).normalize().toString(); newNormal = newNormal.startsWith(DOUBLEPEROIDS) ? newNormal.replace(DOUBLEPEROIDS, "") : newNormal; newNormal = newNormal.startsWith(SLASH) ? newNormal : SLASH + newNormal; newNormal = newNormal.indexOf(QUESTION )>-1 ? newNormal.substring(0,newNormal.indexOf(StringPool.QUESTION)) : newNormal; while(newNormal.indexOf(DOUBLESLASH)>-1) { newNormal = newNormal.replace(DOUBLESLASH, SLASH); } return newNormal; } catch(IllegalArgumentException ill) { Logger.warnAndDebug(this.getClass(),ill); HttpServletResponse response= (HttpServletResponse) servletResponse; try { response.sendError(HttpServletResponse.SC_FORBIDDEN); response.flushBuffer(); } catch(Exception e) return "/"; } } }; filterChain.doFilter(requestWrapper, servletResponse); }
Source:
public void execute() throws RuntimeException, InterruptedException { Session session = initSession(); session.execute("USE " + keyspace); session.execute(TRUNCATE_TAGS_IDX_QUERY); session.execute(TRUNCATE_METRICS_IDX_QUERY); session.close(); }

Target:
public void execute() throws RuntimeException, InterruptedException { try { initSession(); session.execute(TRUNCATE_TAGS_IDX_QUERY); session.execute(TRUNCATE_METRICS_IDX_QUERY); } finally { this.shutdown(); } }
Source:
protected ImmutableValue<Boolean> constructImmutableValue(Boolean value) { return ImmutableSpongeValue.cachedOf(Keys.ENTITY_HAS_GRAVITY, DataConstants.DEFAULT_HAS_GRAVITY, value); }

Target:
protected ImmutableValue<Boolean> constructImmutableValue(Boolean value) { return ImmutableSpongeValue.cachedOf(this.key, DataConstants.DEFAULT_HAS_GRAVITY, value); }
Source:
void validateBarcode(final LabelsGeneratorInput labelsGeneratorInput, final LabelsData labelsData) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); if(!labelsGeneratorInput.isAutomaticBarcode()){ for (Map<Integer, String> data:labelsData.getData()){ List<Integer> barcodeIds = labelsGeneratorInput.getBarcodeFields().stream().filter(labelId -> data.get(labelId) == null).collect( Collectors.toList()); if(!barcodeIds.isEmpty()){ errors.reject("label.fields.barcodes.selected.empty.value",""); throw new ApiRequestValidationException(errors.getAllErrors()); } } } }

Target:
void validateBarcode(final LabelsGeneratorInput labelsGeneratorInput, final LabelsData labelsData) { final BindingResult errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); if(!labelsGeneratorInput.isAutomaticBarcode()){ for (final Map<Integer, String> data:labelsData.getData()){ List<Integer> barcodeIds = labelsGeneratorInput.getBarcodeFields().stream().filter(labelId -> data.get(labelId) == null).collect( Collectors.toList()); if(!barcodeIds.isEmpty()){ errors.reject("label.fields.barcodes.selected.empty.value",""); throw new ApiRequestValidationException(errors.getAllErrors()); } } } }
Source:
private SearchRow getSearchRow(SearchRow row, int columnId, Value v, boolean max) { Column column = columnId == SearchRow.ROWID_INDEX ? table.getRowIdColumn() : table.getColumn(columnId); int vType = v.getType(); int resType = Value.getHigherOrder(column.getType(), vType); if(vType != resType) { v = column.convert(v, session.getDatabase().getMode()); } if (row == null) { row = table.getTemplateRow(); } else { v = getMax(row.getValue(columnId), v, max); } if (columnId == SearchRow.ROWID_INDEX) { row.setKey(v.getLong()); } else { row.setValue(columnId, v); } return row; }

Target:
private SearchRow getSearchRow(SearchRow row, int columnId, Value v, boolean max) { if (row == null) { row = table.getTemplateRow(); } else { v = getMax(row.getValue(columnId), v, max); } if (columnId == SearchRow.ROWID_INDEX) { row.setKey(v.getLong()); } else { row.setValue(columnId, v); } return row; }
Source:
private static <T extends InputSplit> T deserializeInputSplitInternal( Configuration conf, DataInputStream in, Class<T> clazz) throws IOException { T split = ReflectionUtils.newInstance(clazz, conf); SerializationFactory factory = new SerializationFactory(conf); Deserializer<T> deserializer = factory.getDeserializer(clazz); deserializer.open(new UncloseableDataInputStream((DataInputStream) in)); return deserializer.deserialize(split); }

Target:
private static <T extends InputSplit> T deserializeInputSplitInternal( Configuration conf, DataInputStream in, Class<T> clazz) throws IOException { T split = ReflectionUtils.newInstance(clazz, conf); SerializationFactory factory = new SerializationFactory(conf); Deserializer<T> deserializer = factory.getDeserializer(clazz); deserializer.open(in instanceof UncloseableDataInputStream ? in : new UncloseableDataInputStream(in)); return deserializer.deserialize(split); }
Source:
public List<Pair<Guid, Integer>> score(Cluster cluster, List<VDS> hosts, VM vm, Map<String, String> parameters) { if (!vm.isDown()) { return Collections.emptyList(); } List<Pair<Guid, Integer>> weights = new ArrayList<>(); Set<Guid> preferredHosts = new HashSet<>(vm.getDedicatedVmForVdsList()); boolean isAnyPreferredHost = preferredHosts.size() > 0; for (VDS host: hosts) { if (isAnyPreferredHost && !preferredHosts.contains(host.getId())) { log.info("Penalizing host '{}' because it is not preferred.", host.getName()); weights.add(new Pair<Guid, Integer>(host.getId(), 10000)); } else { weights.add(new Pair<Guid, Integer>(host.getId(), 0)); } } return weights; }

Target:
public List<Pair<Guid, Integer>> score(Cluster cluster, List<VDS> hosts, VM vm, Map<String, String> parameters) { if (!vm.isDown()) { return Collections.emptyList(); } List<Pair<Guid, Integer>> weights = new ArrayList<>(); Set<Guid> preferredHosts = new HashSet<>(vm.getDedicatedVmForVdsList()); boolean isAnyPreferredHost = preferredHosts.size() > 0; for (VDS host: hosts) { if (isAnyPreferredHost && !preferredHosts.contains(host.getId())) { log.debug("Penalizing host '{}' because it is not preferred.", host.getName()); weights.add(new Pair<Guid, Integer>(host.getId(), 10000)); } else { weights.add(new Pair<Guid, Integer>(host.getId(), 0)); } } return weights; }
Source:
private void processBulkIndexIngestRequest(Task task, BulkRequest original, ActionListener<BulkResponse> listener) { final long ingestStartTimeInNanos = System.nanoTime(); final BulkRequestModifier bulkRequestModifier = new BulkRequestModifier(original); ingestService.executeBulkRequest( original.numberOfActions(), () -> bulkRequestModifier, bulkRequestModifier::markItemAsFailed, (originalThread, exception) -> { if (exception != null) { logger.debug("failed to execute pipeline for a bulk request", exception); listener.onFailure(exception); } else { long ingestTookInMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - ingestStartTimeInNanos); BulkRequest bulkRequest = bulkRequestModifier.getBulkRequest(); ActionListener<BulkResponse> actionListener = bulkRequestModifier.wrapActionListenerIfNeeded(ingestTookInMillis, listener); if (bulkRequest.requests().isEmpty()) { actionListener.onResponse(new BulkResponse(new BulkItemResponse[0], 0)); } else { if (originalThread == Thread.currentThread()) { assert Thread.currentThread().getName().contains(ThreadPool.Names.WRITE); doDispatchedExecute(task, bulkRequest, actionListener); } else { threadPool.executor(ThreadPool.Names.WRITE).execute(new AbstractRunnable() { @Override public void onFailure(Exception e) { listener.onFailure(e); } @Override protected void doRun() throws Exception { doDispatchedExecute(task, bulkRequest, actionListener); } @Override public boolean isForceExecution() { return true; } }); } } } }, bulkRequestModifier::markItemAsDropped ); }

Target:
private void processBulkIndexIngestRequest(Task task, BulkRequest original, ActionListener<BulkResponse> listener) { final long ingestStartTimeInNanos = System.nanoTime(); final BulkRequestModifier bulkRequestModifier = new BulkRequestModifier(original); ingestService.executeBulkRequest( original.numberOfActions(), () -> bulkRequestModifier, bulkRequestModifier::markItemAsFailed, (originalThread, exception) -> { if (exception != null) { logger.debug("failed to execute pipeline for a bulk request", exception); listener.onFailure(exception); } else { long ingestTookInMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - ingestStartTimeInNanos); BulkRequest bulkRequest = bulkRequestModifier.getBulkRequest(); ActionListener<BulkResponse> actionListener = bulkRequestModifier.wrapActionListenerIfNeeded(ingestTookInMillis, listener); if (bulkRequest.requests().isEmpty()) { actionListener.onResponse(new BulkResponse(new BulkItemResponse[0], 0)); } else { if (originalThread == Thread.currentThread()) { assert Thread.currentThread().getName().contains(ThreadPool.Names.WRITE); doInternalExecute(task, bulkRequest, actionListener); } else { threadPool.executor(ThreadPool.Names.WRITE).execute(new AbstractRunnable() { @Override public void onFailure(Exception e) { listener.onFailure(e); } @Override protected void doRun() throws Exception { doInternalExecute(task, bulkRequest, actionListener); } @Override public boolean isForceExecution() { return true; } }); } } } }, bulkRequestModifier::markItemAsDropped ); }
Source:
public void cleanUp() { try { this.featuresCache.close(); } catch (IOException e) { LOG.error("Could not close features cache", e); } }

Target:
public void cleanUp() { try { this.featuresCache.close(); } catch (final IOException e) { LOG.error("Could not close features cache", e); } }
Source:
public static void existsBranch(final Git git, final String branch) { if (git.getRef(branch) == null) { throw new GitException(String.format("Branch <<%s>> does not exists", branch)); } }

Target:
public static void existsBranch(final Git git, final String branch) { if (git.getRef(branch) == null) { throw new GitException(String.format("Branch <<%s>> does not exist", branch)); } }
Source:
@Override public Object instantiateItem(ViewGroup container, int position) { LayoutInflater inflater = LayoutInflater.from(context); DescriptionEditTutorialPage tutorialPage = DescriptionEditTutorialPage.of(position); ViewGroup layout = (ViewGroup) inflater.inflate(tutorialPage.getLayout(), container, false); container.addView(layout); return layout; }

Target:
@Override public Object instantiateItem(ViewGroup container, int position) { LayoutInflater inflater = LayoutInflater.from(container.getContext()); DescriptionEditTutorialPage tutorialPage = DescriptionEditTutorialPage.of(position); View layout = inflater.inflate(tutorialPage.getLayout(), container, false); ButterKnife.bind(layout); container.addView(layout); ((DescriptionEditTutorialView) layout).setCallback(cb); return layout; }
Source:
public static String getServicePrincipal(String serviceName) throws UnknownHostException { requireNonNull(serviceName, "serviceName is null"); String fqdn = InetAddress.getLocalHost().getCanonicalHostName(); checkState(!fqdn.equalsIgnoreCase("localhost"), "Fully qualified host name for localhost is not retrieved"); return String.format("%s/%s", serviceName, fqdn.toLowerCase(Locale.US)); }

Target:
public static String getServicePrincipal(String serviceName) throws UnknownHostException { requireNonNull(serviceName, "serviceName is null"); String fqdn = InetAddress.getLocalHost().getCanonicalHostName(); checkState(!fqdn.equalsIgnoreCase("localhost"), "Fully qualified host name for localhost is not retrieved"); return format("%s/%s", serviceName, fqdn.toLowerCase(Locale.US)); }