auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Dialog onCreateDialog(Bundle savedInstanceState) { View view = View.inflate(getActivity(), R.layout.site_settings_format_dialog, null); TextView txtTitle = view.findViewById(R.id.text_title); TextView txtHelp = view.findViewById(R.id.text_help); mEditCustomFormat = view.findViewById(R.id.edit_custom); mRadioGroup = view.findViewById(R.id.radio_group); Bundle args = getArguments(); FormatType formatType = (FormatType) args.getSerializable(KEY_FORMAT_TYPE); mFormatValue = args.getString(KEY_FORMAT_VALUE); mEntries = formatType.getEntries(getActivity()); mValues = formatType.getValues(getActivity()); createRadioButtons(); boolean isCustomFormat = isCustomFormatValue(mFormatValue); mEditCustomFormat.setEnabled(isCustomFormat); if (isCustomFormat) { mEditCustomFormat.setText(mFormatValue); } @StringRes int titleRes = formatType == FormatType.DATE_FORMAT ? R.string.site_settings_date_format_title : R.string.site_settings_time_format_title; txtTitle.setText(titleRes); txtHelp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ActivityLauncher.openUrlExternal(v.getContext(), Constants.URL_DATETIME_FORMAT_HELP); } }); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.Calypso_AlertDialog); builder.setPositiveButton(android.R.string.ok, this); builder.setNegativeButton(R.string.cancel, this); builder.setView(view); return builder.create(); }

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { View view = View.inflate(getActivity(), R.layout.site_settings_format_dialog, null); TextView txtTitle = view.findViewById(R.id.text_title); TextView txtHelp = view.findViewById(R.id.text_help); mEditCustomFormat = view.findViewById(R.id.edit_custom); mRadioGroup = view.findViewById(R.id.radio_group); Bundle args = getArguments(); FormatType formatType = (FormatType) args.getSerializable(KEY_FORMAT_TYPE); if (formatType == null) { formatType = FormatType.DATE_FORMAT; } mFormatValue = args.getString(KEY_FORMAT_VALUE); mEntries = formatType.getEntries(getActivity()); mValues = formatType.getValues(getActivity()); createRadioButtons(); boolean isCustomFormat = isCustomFormatValue(mFormatValue); mEditCustomFormat.setEnabled(isCustomFormat); if (isCustomFormat) { mEditCustomFormat.setText(mFormatValue); } @StringRes int titleRes = formatType == FormatType.DATE_FORMAT ? R.string.site_settings_date_format_title : R.string.site_settings_time_format_title; txtTitle.setText(titleRes); txtHelp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ActivityLauncher.openUrlExternal(v.getContext(), Constants.URL_DATETIME_FORMAT_HELP); } }); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.Calypso_AlertDialog); builder.setPositiveButton(android.R.string.ok, this); builder.setNegativeButton(R.string.cancel, this); builder.setView(view); return builder.create(); }
Source:
private static Iterable<Artifact> getProducedRuntimeJars( ConfiguredTarget base, RuleContext ruleContext) { JavaInfo javaInfo = JavaInfo.getJavaInfo(base); if (javaInfo != null) { return javaInfo.getDirectRuntimeJars(); } else if (isProtoLibrary(ruleContext)) { if (!ruleContext.getPrerequisites("srcs", Mode.TARGET).isEmpty()) { JavaRuleOutputJarsProvider outputJarsProvider = base.getProvider(JavaRuleOutputJarsProvider.class); if (outputJarsProvider != null) { return outputJarsProvider .getOutputJars() .stream() .map(OutputJar::getClassJar) .collect(toImmutableList()); } } } return null; }

Target:
private static Iterable<Artifact> getProducedRuntimeJars( ConfiguredTarget base, RuleContext ruleContext) { if (isProtoLibrary(ruleContext)) { if (!ruleContext.getPrerequisites("srcs", Mode.TARGET).isEmpty()) { JavaRuleOutputJarsProvider outputJarsProvider = base.getProvider(JavaRuleOutputJarsProvider.class); if (outputJarsProvider != null) { return outputJarsProvider .getOutputJars() .stream() .map(OutputJar::getClassJar) .collect(toImmutableList()); } else { JavaInfo javaInfo = JavaInfo.getJavaInfo(base); if (javaInfo != null) { return javaInfo.getDirectRuntimeJars(); } } } } else { JavaInfo javaInfo = JavaInfo.getJavaInfo(base); if (javaInfo != null) { return javaInfo.getDirectRuntimeJars(); } } return null; }
Source:
public CredentialSupport getCredentialSupport(Class<?> credentialType) throws RealmUnavailableException { for (QueryConfiguration configuration : this.queryConfiguration) { for (ColumnMapper mapper : configuration.getColumnMappers()) { if (KeyMapper.class.isInstance(mapper)) { KeyMapper credentialMapper = (KeyMapper) mapper; if (credentialType.equals(credentialMapper.getCredentialType())) { return CredentialSupport.FULLY_SUPPORTED; } } } } return CredentialSupport.UNSUPPORTED; }

Target:
public CredentialSupport getCredentialSupport(Class<?> credentialType) throws RealmUnavailableException { for (QueryConfiguration configuration : this.queryConfiguration) { for (ColumnMapper mapper : configuration.getColumnMappers()) { if (KeyMapper.class.isInstance(mapper)) { KeyMapper keyMapper = (KeyMapper) mapper; if (credentialType.equals(keyMapper.getKeyType())) { return CredentialSupport.UNKNOWN; } } } } return CredentialSupport.UNSUPPORTED; }
Source:
public void onLocationChanged(Location location) { User user = User.getCurrentUser(); if (user == null) return; if (lastLatitude == location.getLatitude()) if (lastLongitude == location.getLongitude()) return; user.setLocation( lastLatitude = location.getLatitude(), lastLongitude = location.getLongitude() ); user.saveEventually(); try { UserUpdateChannel.publish(user); } catch (JSONException e) { onLocationTrackingFailed(e); } }

Target:
public void onLocationChanged(Location location) { User user = User.getCurrentUser(); if (user == null) return; ParseGeoPoint last = user.getLocation(); if (last.getLatitude() == location.getLatitude() && last.getLongitude() == location.getLongitude()) return; user.setLocation(location.getLatitude(), location.getLongitude()); user.saveEventually(); try { UserUpdateChannel.publish(user); } catch (JSONException e) { onLocationTrackingFailed(e); } }
Source:
protected final boolean credentialsRetryable(Function<Credentials, Access> getAccess) { return CredentialTypes.isRetryable(getAccess); }

Target:
protected final CredentialType credentialsRetryable(Function<Credentials, Access> getAccess) { return CredentialTypes.credentialTypeObjectOf(getAccess); }
Source:
private void deployUnallocatedJobModules() throws Exception { List<ModuleDeploymentRequestsPath> requestedModulesPaths = getAllModuleDeploymentRequests(); CuratorFramework client = getClient(); boolean delay = true; for (ChildData data : jobDeployments.getCurrentData()) { String jobName = ZooKeeperUtils.stripPathConverter.convert(data); Job job = DeploymentLoader.loadJob(client, jobName, this.jobFactory); if (job != null) { List<ModuleDeploymentRequestsPath> requestedModules = ModuleDeploymentRequestsPath.getModulesForDeploymentUnit( requestedModulesPaths, jobName); Set<String> previouslyDeployed = new HashSet<String>(); try { for (String deployedModule : client.getChildren().forPath(Paths.build(data.getPath(), Paths.MODULES))) { previouslyDeployed.add(Paths.stripPath(new JobDeploymentsPath(Paths.build(data.getPath(), Paths.MODULES, deployedModule)).getModuleInstanceAsString())); } } catch (KeeperException.NoNodeException e) { } for (ModuleDeploymentRequestsPath path : requestedModules) { ModuleDescriptor moduleDescriptor = job.getJobModuleDescriptor(); if (shouldDeploy(moduleDescriptor, path, previouslyDeployed)) { if (delay) { Thread.sleep(3000); delay = false; } RuntimeModuleDeploymentProperties moduleDeploymentProperties = new RuntimeModuleDeploymentProperties(); moduleDeploymentProperties.putAll(ZooKeeperUtils.bytesToMap( moduleDeploymentRequests.getCurrentData(path.build()).getData())); redeployModule(new ModuleDeployment(job, moduleDescriptor, moduleDeploymentProperties), true); } } } } }

Target:
private void deployUnallocatedJobModules() throws Exception { List<ModuleDeploymentRequestsPath> requestedModulesPaths = getAllModuleDeploymentRequests(); CuratorFramework client = getClient(); boolean delay = true; for (ChildData data : jobDeployments.getCurrentData()) { String jobName = ZooKeeperUtils.stripPathConverter.convert(data); Job job = DeploymentLoader.loadJob(client, jobName, this.jobFactory); if (job != null) { List<ModuleDeploymentRequestsPath> requestedModules = ModuleDeploymentRequestsPath.getModulesForDeploymentUnit( requestedModulesPaths, jobName); Set<String> previouslyDeployed = new HashSet<String>(); for (String deployedModule : client.getChildren().forPath(Paths.build(data.getPath(), Paths.MODULES))) { previouslyDeployed.add(Paths.stripPath(new JobDeploymentsPath(Paths.build(data.getPath(), Paths.MODULES, deployedModule)).getModuleInstanceAsString())); } for (ModuleDeploymentRequestsPath path : requestedModules) { ModuleDescriptor moduleDescriptor = job.getJobModuleDescriptor(); if (shouldDeploy(moduleDescriptor, path, previouslyDeployed)) { if (delay) { Thread.sleep(3000); delay = false; } RuntimeModuleDeploymentProperties moduleDeploymentProperties = new RuntimeModuleDeploymentProperties(); moduleDeploymentProperties.putAll(ZooKeeperUtils.bytesToMap( moduleDeploymentRequests.getCurrentData(path.build()).getData())); redeployModule(new ModuleDeployment(job, moduleDescriptor, moduleDeploymentProperties), true); } } } } }
Source:
public Collection<Order> getOrder(String... orderIds) throws IOException { Collection<Order> orders = new ArrayList<>(); for (String orderId : orderIds) { CoingiGetOrderRequest request = new CoingiGetOrderRequest().setOrderId(orderId); CoingiOrder coingiOrder; try { coingiOrder = getCoingiOrder(request); } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } CurrencyPair currencyPair = CoingiAdapters.adaptCurrency(coingiOrder.getCurrencyPair()); Date date = new Date(coingiOrder.getTimestamp() * 1000); Order order = new LimitOrder( coingiOrder.getType() == 0 ? Order.OrderType.BID : Order.OrderType.ASK, coingiOrder.getOriginalBaseAmount(), currencyPair, coingiOrder.getId(), date, coingiOrder.getPrice()); order.setOrderStatus(CoingiAdapters.adaptOrderStatus(coingiOrder.getStatus())); orders.add(order); } return orders; }

Target:
public Collection<Order> getOrder(String... orderIds) throws IOException { try { Collection<Order> orders = new ArrayList<>(); for (String orderId : orderIds) { CoingiGetOrderRequest request = new CoingiGetOrderRequest().setOrderId(orderId); CoingiOrder coingiOrder; coingiOrder = getCoingiOrder(request); CurrencyPair currencyPair = CoingiAdapters.adaptCurrency(coingiOrder.getCurrencyPair()); Date date = new Date(coingiOrder.getTimestamp() * 1000); Order order = new LimitOrder( coingiOrder.getType() == 0 ? Order.OrderType.BID : Order.OrderType.ASK, coingiOrder.getOriginalBaseAmount(), currencyPair, coingiOrder.getId(), date, coingiOrder.getPrice()); order.setOrderStatus(CoingiAdapters.adaptOrderStatus(coingiOrder.getStatus())); orders.add(order); } return orders; } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } }
Source:
public QosMetrics() { readRequestCount = metricsManager.registerMeter(QosMetrics.class, "numReadRequests"); writeRequestCount = metricsManager.registerMeter(QosMetrics.class, "numWriteRequests"); bytesRead = metricsManager.registerHistogram(QosMetrics.class, "bytesRead"); bytesWritten = metricsManager.registerHistogram(QosMetrics.class, "bytesWritten"); }

Target:
public QosMetrics() { readRequestCount = metricsManager.registerMeter(QosMetrics.class, "numReadRequests"); writeRequestCount = metricsManager.registerMeter(QosMetrics.class, "numWriteRequests"); bytesRead = metricsManager.registerMeter(QosMetrics.class, "bytesRead"); bytesWritten = metricsManager.registerMeter(QosMetrics.class, "bytesWritten"); }
Source:
public static Case getOpenCase() throws NoCurrentCaseException { try { Case openCase = new Case(currentCase.getCaseType(), currentCase.getCacheDirectory(), new CaseDetails(currentCase.getDisplayName(), currentCase.getNumber(), currentCase.getExaminer(), currentCase.getExaminerPhone(), currentCase.getExaminerEmail(), currentCase.getCaseNotes())); return openCase; } catch (NullPointerException ex) { throw new NoCurrentCaseException(); } }

Target:
public static Case getOpenCase() throws NoCurrentCaseException { Case openCase = currentCase; if (null != openCase) { return openCase; } else { throw new NoCurrentCaseException(); } }
Source:
private IndexManager indexManager() { graphDatabase().beginTx(); return graphDatabase().index(); }

Target:
private IndexManager indexManager() { return graphDatabase().index(); }
Source:
public void setAttribute(String name, List<String> values) { removeAttribute(name); List<String> nonNullValues = values.stream().filter(Objects::nonNull).collect(Collectors.toList()); for (String value : nonNullValues) { persistAttributeValue(name, value); } }

Target:
public void setAttribute(String name, List<String> values) { removeAttribute(name); for (Iterator<String> it = values.stream().filter(Objects::nonNull).iterator(); it.hasNext();) { persistAttributeValue(name, it.next()); } }
Source:
void process(Content dataSource, IngestJobContext context) { this.dataSource = dataSource; this.context = context; dataFound = false; this.processWebCache(); this.getBookmark(); }

Target:
void process(Content dataSource, IngestJobContext context) { this.dataSource = dataSource; this.context = context; this.setFoundData(false); List<AbstractFile> webCacheFiles = null; List<AbstractFile> spartanFiles = null; try { webCacheFiles = fetchWebCacheFiles(); } catch (TskCoreException ex) { this.addErrorMessage(Bundle.ExtractEdge_process_errMsg_errGettingWebCacheFiles()); logger.log(Level.SEVERE, "Error fetching 'WebCacheV01.dat' files for Microsoft Edge", ex); } try { spartanFiles = fetchSpartanFiles(); } catch (TskCoreException ex) { this.addErrorMessage(Bundle.ExtractEdge_process_errMsg_spartanFail()); logger.log(Level.SEVERE, "Error fetching 'spartan.edb' files for Microsoft Edge", ex); } if (webCacheFiles == null && spartanFiles == null) { return; } this.setFoundData(true); if (!PlatformUtil.isWindowsOS()) { logger.log(Level.WARNING, "Microsoft Edge files found, unable to parse on Non-Windows system"); return; } final String esedumper = getPathForESEDumper(); if (esedumper == null) { this.addErrorMessage(Bundle.ExtractEdge_process_errMsg_unableFindESEViewer()); logger.log(Level.SEVERE, "Error finding ESEDatabaseViewer program"); return; } if (context.dataSourceIngestIsCancelled()) { return; } try { this.processWebCache(esedumper, webCacheFiles); } catch (IOException ex) { this.addErrorMessage(Bundle.ExtractEdge_process_errMsg_webcacheFail()); logger.log(Level.SEVERE, "Error returned from processWebCach", ex); } if (context.dataSourceIngestIsCancelled()) { return; } this.getBookmark(); }
Source:
public BoundedConcurrentHashMap(int capacity, int concurrencyLevel, Eviction evictionStrategy, EvictionListener<K, V> evictionListener, Equivalence<K> keyEquivalence, Equivalence<V> valueEquivalence) { this.keyEquivalence = keyEquivalence; this.valueEquivalence = valueEquivalence; if (capacity < 0 || concurrencyLevel <= 0) { throw new IllegalArgumentException(); } concurrencyLevel = Math.min(capacity / 2, concurrencyLevel); concurrencyLevel = Math.max(concurrencyLevel, 1); if (capacity < concurrencyLevel * 2 && capacity != 1) { throw new IllegalArgumentException("Maximum capacity has to be at least twice the concurrencyLevel"); } if (evictionStrategy == null || evictionListener == null) { throw new IllegalArgumentException(); } Properties p = new Properties(); p.put("maxThreads", Runtime.getRuntime().availableProcessors()); p.put("coreThreads", 0); p.put("queueSize", 100); p.put("threadNamePrefix", "BCHM"); ExecutorFactory ef = new DefaultExecutorFactory(); executor = ef.getExecutor(p); this.evictionListener = evictionListener; if (concurrencyLevel > MAX_SEGMENTS) { concurrencyLevel = MAX_SEGMENTS; } int sshift = 0; int ssize = 1; while (ssize < concurrencyLevel) { ++sshift; ssize <<= 1; } segmentShift = 32 - sshift; segmentMask = ssize - 1; this.segments = Segment.newArray(ssize); if (capacity > MAXIMUM_CAPACITY) { capacity = MAXIMUM_CAPACITY; } int c = capacity / ssize; int cap = 1; while (cap < c) { cap <<= 1; } this.evictCap = c; for (int i = 0; i < this.segments.length; ++i) { this.segments[i] = new Segment<K, V>(cap, DEFAULT_LOAD_FACTOR, evictionStrategy, this); } }

Target:
public BoundedConcurrentHashMap(int capacity, int concurrencyLevel, Eviction evictionStrategy, EvictionListener<K, V> evictionListener, Equivalence<K> keyEquivalence, Equivalence<V> valueEquivalence) { this.keyEquivalence = keyEquivalence; this.valueEquivalence = valueEquivalence; if (capacity < 0 || concurrencyLevel <= 0) { throw new IllegalArgumentException(); } concurrencyLevel = Math.min(capacity / 2, concurrencyLevel); concurrencyLevel = Math.max(concurrencyLevel, 1); if (capacity < concurrencyLevel * 2 && capacity != 1) { throw new IllegalArgumentException("Maximum capacity has to be at least twice the concurrencyLevel"); } if (evictionStrategy == null || evictionListener == null) { throw new IllegalArgumentException(); } executor = ForkJoinPool.commonPool(); this.evictionListener = evictionListener; if (concurrencyLevel > MAX_SEGMENTS) { concurrencyLevel = MAX_SEGMENTS; } int sshift = 0; int ssize = 1; while (ssize < concurrencyLevel) { ++sshift; ssize <<= 1; } segmentShift = 32 - sshift; segmentMask = ssize - 1; this.segments = Segment.newArray(ssize); if (capacity > MAXIMUM_CAPACITY) { capacity = MAXIMUM_CAPACITY; } int c = capacity / ssize; int cap = 1; while (cap < c) { cap <<= 1; } this.evictCap = c; for (int i = 0; i < this.segments.length; ++i) { this.segments[i] = new Segment<K, V>(cap, DEFAULT_LOAD_FACTOR, evictionStrategy, this); } }
Source:
public HelixHealthReportAggregationTaskTest(boolean enableAggregatedMonthlyAccountReport) throws IOException { this.enableAggregatedMonthlyAccountReport = enableAggregatedMonthlyAccountReport; File tempDir = Files.createTempDirectory("HelixHealthReportAggregationTask-" + new Random().nextInt(1000)).toFile(); String tempDirPath = tempDir.getAbsolutePath(); int zkPort = 13188; int maxRetries = 1000; int numRetries = 0; while (true) { if (numRetries > maxRetries) { throw new IOException("No ports are available to start zookeeper server"); } try { zkInfo = new TestUtils.ZkInfo(tempDirPath, "DC1", (byte) 0, zkPort, true); break; } catch (Exception e) { if (e instanceof BindException || e.getCause() instanceof BindException) { System.out.println("Port " + zkPort + " already in use, try " + (zkPort + 1) + " instead"); zkPort++; numRetries++; } else { throw new RuntimeException(e); } } } String zkAddr = "localhost:" + String.valueOf(zkInfo.getPort()); mockHelixAdmin = new MockHelixAdminFactory().getHelixAdmin(zkAddr); mockHelixManager = new MockHelixManager(INSTANCE_NAME, InstanceType.PARTICIPANT, zkAddr, CLUSTER_NAME, mockHelixAdmin, null, null); mockTime = new MockTime(SystemTime.getInstance().milliseconds()); }

Target:
public HelixHealthReportAggregationTaskTest(boolean enableAggregatedMonthlyAccountReport) throws IOException { this.enableAggregatedMonthlyAccountReport = enableAggregatedMonthlyAccountReport; File tempDir = Files.createTempDirectory("HelixHealthReportAggregationTask-" + new Random().nextInt(1000)).toFile(); String tempDirPath = tempDir.getAbsolutePath(); int zkPort = 13188; int maxRetries = 1000; int numRetries = 0; while (true) { if (numRetries > maxRetries) { throw new IOException("No ports are available to start zookeeper server"); } try { zkInfo = new TestUtils.ZkInfo(tempDirPath, "DC1", (byte) 0, zkPort, true); break; } catch (Exception e) { if (e.getCause() instanceof BindException) { System.out.println("Port " + zkPort + " already in use, try " + (zkPort + 1) + " instead"); zkPort++; numRetries++; } else { throw new RuntimeException(e); } } } String zkAddr = "localhost:" + zkInfo.getPort(); mockHelixAdmin = new MockHelixAdminFactory().getHelixAdmin(zkAddr); mockHelixManager = new MockHelixManager(INSTANCE_NAME, InstanceType.PARTICIPANT, zkAddr, CLUSTER_NAME, mockHelixAdmin, null, null); mockTime = new MockTime(SystemTime.getInstance().milliseconds()); clusterMapConfig = makeClusterMapConfig(); }
Source:
private ActionItem findActionItem(ActionItemNoteDetailDto detailDto) { QueryByCriteria query = QueryByCriteria.Builder.fromPredicates( PredicateFactory.equal(KFSPropertyConstants.PRINCIPAL_ID, detailDto.getPrincipalId()), PredicateFactory.equal(CUKFSConstants.DOCUMENT_ID, detailDto.getDocHeaderId())); List<ActionItem> items = KRADServiceLocator.getDataObjectService().findMatching(ActionItem.class, query).getResults(); ActionListBuilder actionListBuilder = new ActionListBuilder(); ActionItem selectedActionItem = null; Comparator<ActionItemContract> priorityComparator = new ActionListPriorityComparator(); for (ActionItem currentItem : items) { if (ObjectUtils.isNull(selectedActionItem)) { selectedActionItem = currentItem; } else { selectedActionItem = (priorityComparator.compare(selectedActionItem, currentItem) >= 0) ? selectedActionItem : currentItem; } } return selectedActionItem; }

Target:
private ActionItem findActionItem(ActionItemNoteDetailDto detailDto) { QueryByCriteria query = QueryByCriteria.Builder.fromPredicates( PredicateFactory.equal(KFSPropertyConstants.PRINCIPAL_ID, detailDto.getPrincipalId()), PredicateFactory.equal(CUKFSConstants.DOCUMENT_ID, detailDto.getDocHeaderId())); List<ActionItem> actionItems = KRADServiceLocator.getDataObjectService().findMatching(ActionItem.class, query).getResults(); ActionItem selectedActionItem = null; if (LOG.isDebugEnabled() ) { LOG.debug("findActionItem, number of action items for principal " + detailDto.getPrincipalId() + " and document number " + detailDto.getDocHeaderId() + " is " + CollectionUtils.size(actionItems)); } if (CollectionUtils.isNotEmpty(actionItems)) { selectedActionItem = (ActionItem) Collections.max(actionItems, new ActionListPriorityComparator()); } return selectedActionItem; }
Source:
public String getHumanishName() throws IllegalArgumentException { if ("".equals(getPath()) || getPath() == null) throw new IllegalArgumentException(); String s = getPath(); String[] elements; if ("file".equals(scheme) || LOCAL_FILE.matcher(s).matches()) { elements = s.split("[\\" + File.separator + "/]"); } else elements = s.split("/"); if (elements.length == 0) throw new IllegalArgumentException(); String result = elements[elements.length - 1]; if (Constants.DOT_GIT.equals(result)) result = elements[elements.length - 2]; else if (result.endsWith(Constants.DOT_GIT_EXT)) result = result.substring(0, result.length() - Constants.DOT_GIT_EXT.length()); return result; }

Target:
public String getHumanishName() throws IllegalArgumentException { if ("".equals(getPath()) || getPath() == null) throw new IllegalArgumentException(); String s = getPath(); String[] elements; if ("file".equals(scheme) || LOCAL_FILE.matcher(s).matches()) elements = s.split("[\\" + File.separatorChar + "/]"); else elements = s.split("/"); if (elements.length == 0) throw new IllegalArgumentException(); String result = elements[elements.length - 1]; if (Constants.DOT_GIT.equals(result)) result = elements[elements.length - 2]; else if (result.endsWith(Constants.DOT_GIT_EXT)) result = result.substring(0, result.length() - Constants.DOT_GIT_EXT.length()); return result; }
Source:
public void testFileHandlerReconnectOnReadFail() throws Exception { final String chunkDownloadExMsg = "Test exception. Chunk processing error."; IgniteEx snd = startGrid(0); IgniteEx rcv = startGrid(1); snd.cluster().active(true); File fileToSend = createFileRandomData("testFile", 5 * 1024 * 1024); final AtomicInteger readedChunks = new AtomicInteger(); transmissionFileIoFactory(rcv, new FileIOFactory() { @Override public FileIO create(File file, OpenOption... modes) throws IOException { fileIo[0] = IO_FACTORY.create(file, modes); return new FileIODecorator(fileIo[0]) { @Override public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException { if (readedChunks.incrementAndGet() == 4) throw new IgniteException(chunkDownloadExMsg); return super.transferFrom(src, position, count); } }; } }); rcv.context().io().addTransmissionHandler(topic, new DefaultTransmissionHandler(rcv, fileToSend, tempStore) { @Override public void onException(UUID nodeId, Throwable err) { assertEquals(chunkDownloadExMsg, err.getMessage()); } }); try (GridIoManager.TransmissionSender sender = snd.context() .io() .openTransmissionSender(rcv.localNode().id(), topic)) { sender.send(fileToSend, TransmissionPolicy.FILE); } }

Target:
public void testFileHandlerReconnectOnReadFail() throws Exception { final String chunkDownloadExMsg = "Test exception. Chunk processing error."; snd = startGrid(0); rcv = startGrid(1); snd.cluster().active(true); File fileToSend = createFileRandomData("testFile", 5 * 1024 * 1024); final AtomicInteger readChunks = new AtomicInteger(); transmissionFileIoFactory(rcv, new FileIOFactory() { @Override public FileIO create(File file, OpenOption... modes) throws IOException { fileIo[0] = IO_FACTORY.create(file, modes); return new FileIODecorator(fileIo[0]) { @Override public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException { if (readChunks.incrementAndGet() == 4) throw new IgniteException(chunkDownloadExMsg); return super.transferFrom(src, position, count); } }; } }); rcv.context().io().addTransmissionHandler(topic, new DefaultTransmissionHandler(rcv, fileToSend, tempStore) { @Override public void onException(UUID nodeId, Throwable err) { assertEquals(chunkDownloadExMsg, err.getMessage()); } }); try (GridIoManager.TransmissionSender sender = snd.context() .io() .openTransmissionSender(rcv.localNode().id(), topic)) { sender.send(fileToSend, TransmissionPolicy.FILE); } }
Source:
public void testGetTumorTypesByVersion() { Map<String, TumorType> returnedTumorTypes = cacheUtil.getTumorTypesByVersion(legacyVersion); String rootTumorTypeCode = returnedTumorTypes.keySet().iterator().next(); TumorType rootTumorType = returnedTumorTypes.get(rootTumorTypeCode); assertEquals("TISSUE", rootTumorTypeCode); assertEquals("TISSUE", rootTumorType.getCode()); assertEquals(32, rootTumorType.getChildren().size()); assertNoHistoryInChildren(rootTumorType.getChildren()); assertNoRescindsInChildren(rootTumorType.getChildren()); assertNoPrecursorsInChildren(rootTumorType.getChildren()); returnedTumorTypes = cacheUtil.getTumorTypesByVersion(latestVersion); Boolean foundHistory = Boolean.FALSE; foundHistory = assertHistoryInChildren(returnedTumorTypes, foundHistory); assertTrue("Failed to find history for 'SS'", foundHistory); Boolean foundRescinds = Boolean.FALSE; foundRescinds = assertRescindsInChildren(returnedTumorTypes, foundRescinds); assertTrue("Failed to find rescinds for 'URMM'", foundRescinds); Boolean foundPrecursors = Boolean.FALSE; foundPrecursors = assertPrecursorsInChildren(returnedTumorTypes, foundPrecursors); assertTrue("Failed to find precursors for 'CLLSLL'", foundPrecursors); }

Target:
public void testGetTumorTypesByVersion() { Map<String, TumorType> returnedTumorTypes = cacheUtil.getTumorTypesByVersion(legacyVersion); String rootTumorTypeCode = returnedTumorTypes.keySet().iterator().next(); TumorType rootTumorType = returnedTumorTypes.get(rootTumorTypeCode); assertEquals("TISSUE", rootTumorTypeCode); assertEquals("TISSUE", rootTumorType.getCode()); assertEquals(32, rootTumorType.getChildren().size()); assertNoHistoryInChildren(rootTumorType.getChildren()); assertNoRevocationsInChildren(rootTumorType.getChildren()); assertNoPrecursorsInChildren(rootTumorType.getChildren()); returnedTumorTypes = cacheUtil.getTumorTypesByVersion(latestVersion); Boolean foundHistory = Boolean.FALSE; foundHistory = assertHistoryInChildren(returnedTumorTypes, foundHistory); assertTrue("Failed to find history for 'SS'", foundHistory); Boolean foundRevocations = Boolean.FALSE; foundRevocations = assertRevocationsInChildren(returnedTumorTypes, foundRevocations); assertTrue("Failed to find revocations for 'URMM'", foundRevocations); Boolean foundPrecursors = Boolean.FALSE; foundPrecursors = assertPrecursorsInChildren(returnedTumorTypes, foundPrecursors); assertTrue("Failed to find precursors for 'CLLSLL'", foundPrecursors); }
Source:
public void testUpdate() throws Exception { for (String regionId : regions) { ImmutableMultimap<String, String> headers = ImmutableMultimap.of(SwiftHeaders.STATIC_WEB_INDEX, "__index.html", SwiftHeaders.STATIC_WEB_ERROR, "__error.html"); UpdateContainerOptions opts = new UpdateContainerOptions().headers(headers); assertNotNull(api.getContainerApiForRegion(regionId).create(name)); Container container = api.getContainerApiForRegion(regionId).get(name); assertNotNull(container); assertEquals(container.getName(), name); assertEquals(container.getMetadata().size(), 0); assertNotNull(api.getContainerApiForRegion(regionId).update(name, opts)); Container updatedContainer = api.getContainerApiForRegion(regionId).get(name); assertNotNull(updatedContainer); assertEquals(updatedContainer.getName(), name); assertEquals(updatedContainer.getMetadata().size(), 2); assertEquals(updatedContainer.getMetadata().get("web-index"), "__index.html"); assertEquals(updatedContainer.getMetadata().get("web-error"), "__error.html"); assertTrue(api.getContainerApiForRegion(regionId).deleteIfEmpty(name)); } }

Target:
public void testUpdate() throws Exception { for (String regionId : regions) { ImmutableMultimap<String, String> headers = ImmutableMultimap.of(SwiftHeaders.STATIC_WEB_INDEX, "__index.html", SwiftHeaders.STATIC_WEB_ERROR, "__error.html"); UpdateContainerOptions opts = new UpdateContainerOptions().headers(headers); assertNotNull(api.getContainerApiForRegion(regionId).create(name)); Container container = api.getContainerApiForRegion(regionId).get(name); assertNotNull(container); assertEquals(container.getName(), name); assertTrue(container.getMetadata().isEmpty()); assertNotNull(api.getContainerApiForRegion(regionId).update(name, opts)); Container updatedContainer = api.getContainerApiForRegion(regionId).get(name); assertNotNull(updatedContainer); assertEquals(updatedContainer.getName(), name); assertEquals(updatedContainer.getMetadata().size(), 2); assertEquals(updatedContainer.getMetadata().get("web-index"), "__index.html"); assertEquals(updatedContainer.getMetadata().get("web-error"), "__error.html"); assertTrue(api.getContainerApiForRegion(regionId).deleteIfEmpty(name)); } }
Source:
protected Mono<LoadBalancerInner> getInnerAsync() { return this .manager() .inner() .loadBalancers() .getByResourceGroupAsync(this.resourceGroupName(), this.name(), null); }

Target:
protected Mono<LoadBalancerInner> getInnerAsync() { return this .manager() .inner() .loadBalancers() .getByResourceGroupAsync(this.resourceGroupName(), this.name()); }
Source:
private ContentWriteController contentWriteController() { return ContentWriteController.create( configFetcher, contentWriteExecutor, lookupBackedContentIdGenerator, contentWriteMessageSender, contentModelOutputter(), lookupStore, contentResolver, contentWriter, new EquivalenceBreaker( contentResolver, entryStore, lookupWriter ), oldContentDeactivator, configFetcher ); }

Target:
private ContentWriteController contentWriteController() { return ContentWriteController.create( configFetcher, contentWriteExecutor, lookupBackedContentIdGenerator, contentWriteMessageSender, contentModelOutputter(), lookupStore, contentResolver, contentWriter, new EquivalenceBreaker( contentResolver, entryStore, lookupWriter ), oldContentDeactivator ); }
Source:
private boolean isCinderDisksExist() { return CollectionUtils.exists(getDisksList(), new Predicate() { @Override public boolean evaluate(Object o) { Disk disk = (Disk) o; return disk.getDiskStorageType() == DiskStorageType.CINDER; } }); }

Target:
private boolean isCinderDisksExist() { return !ImagesHandler.filterDisksBasedOnCinder(getDisksList()).isEmpty(); }
Source:
public ResponseEntity<?> createWorkflowInstance( @RequestBody @ApiParam(value = "Submitted workflow instance information", required = true) CreateWorkflowInstanceRequest req) { WorkflowInstance instance = createWorkflowConverter.convert(req); try { long id = workflowInstances.insertWorkflowInstance(instance); instance = workflowInstances.getWorkflowInstance(id, EnumSet.of(WorkflowInstanceInclude.CURRENT_STATE_VARIABLES), null); return created(URI.create(String.valueOf(id))).body(createWorkflowConverter.convert(instance)); } catch (StateVariableValueTooLongException e) { return badRequest().body(e.getMessage()); } }

Target:
public ResponseEntity<CreateWorkflowInstanceResponse> createWorkflowInstance( @RequestBody @ApiParam(value = "Submitted workflow instance information", required = true) CreateWorkflowInstanceRequest req) { WorkflowInstance instance = createWorkflowConverter.convert(req); long id = workflowInstances.insertWorkflowInstance(instance); instance = workflowInstances.getWorkflowInstance(id, EnumSet.of(WorkflowInstanceInclude.CURRENT_STATE_VARIABLES), null); return created(URI.create(String.valueOf(id))).body(createWorkflowConverter.convert(instance)); }
Source:
private void processExternallyManagedVms() { _externalVmsToAdd.clear(); List<String> vmsToQuery = new ArrayList<String>(); for (VmInternalData vmInternalData : _runningVms.values()) { VM currentVmData = _vmDict.get(vmInternalData.getVmDynamic().getId()); if (currentVmData == null) { if (getDbFacade().getVmStaticDao().get(vmInternalData.getVmDynamic().getId()) == null) { Guid vmId = vmInternalData.getVmDynamic().getId(); vmsToQuery.add(vmId.toString()); } } } if (!vmsToQuery.isEmpty()) { Map[] vmsInfo = getVmInfo(vmsToQuery); for (Map vmInfo : vmsInfo) { Guid vmId = Guid.createGuidFromString((String) vmInfo.get(VdsProperties.vm_guid)); VmStatic vmStatic = new VmStatic(); vmStatic.setId(vmId); vmStatic.setCreationDate(new Date()); vmStatic.setVdsGroupId(_vds.getVdsGroupId()); String vmNameOnHost = (String) vmInfo.get(VdsProperties.vm_name); if (StringUtils.equals(HOSTED_ENGINE_VM_NAME, vmNameOnHost)) { vmStatic.setName(vmNameOnHost); vmStatic.setOrigin(OriginType.HOSTED_ENGINE); } else { vmStatic.setName(String.format(EXTERNAL_VM_NAME_FORMAT, vmNameOnHost)); vmStatic.setOrigin(OriginType.EXTERNAL); } vmStatic.setNumOfSockets(Integer.parseInt((String) vmInfo.get(VdsProperties.num_of_cpus))); vmStatic.setMemSizeMb(Integer.parseInt((String) vmInfo.get(VdsProperties.mem_size_mb))); _externalVmsToAdd.add(vmStatic); log.infoFormat("Importing VM {0} as {1}, as it is running on the on Host, but does not exist in the engine.", vmNameOnHost, vmStatic.getName()); } } }

Target:
private void processExternallyManagedVms() { List<String> vmsToQuery = new ArrayList<String>(); for (VmInternalData vmInternalData : _runningVms.values()) { VM currentVmData = _vmDict.get(vmInternalData.getVmDynamic().getId()); if (currentVmData == null) { if (getDbFacade().getVmStaticDao().get(vmInternalData.getVmDynamic().getId()) == null) { Guid vmId = vmInternalData.getVmDynamic().getId(); vmsToQuery.add(vmId.toString()); } } } if (!vmsToQuery.isEmpty()) { Map[] vmsInfo = getVmInfo(vmsToQuery); for (Map vmInfo : vmsInfo) { Guid vmId = Guid.createGuidFromString((String) vmInfo.get(VdsProperties.vm_guid)); VmStatic vmStatic = new VmStatic(); vmStatic.setId(vmId); vmStatic.setCreationDate(new Date()); vmStatic.setVdsGroupId(_vds.getVdsGroupId()); String vmNameOnHost = (String) vmInfo.get(VdsProperties.vm_name); if (StringUtils.equals(HOSTED_ENGINE_VM_NAME, vmNameOnHost)) { vmStatic.setName(vmNameOnHost); vmStatic.setOrigin(OriginType.HOSTED_ENGINE); } else { vmStatic.setName(String.format(EXTERNAL_VM_NAME_FORMAT, vmNameOnHost)); vmStatic.setOrigin(OriginType.EXTERNAL); } vmStatic.setNumOfSockets(Integer.parseInt((String) vmInfo.get(VdsProperties.num_of_cpus))); vmStatic.setMemSizeMb(Integer.parseInt((String) vmInfo.get(VdsProperties.mem_size_mb))); _externalVmsToAdd.add(vmStatic); log.infoFormat("Importing VM {0} as {1}, as it is running on the on Host, but does not exist in the engine.", vmNameOnHost, vmStatic.getName()); } } }
Source:
Collection<String> asNames(List<Path> recoveryLogs) { return Collections2.transform(recoveryLogs, input -> input.getName()); }

Target:
Collection<String> asNames(List<Path> recoveryLogs) { return Collections2.transform(recoveryLogs, Path::getName); }
Source:
public <K, N> InternalTimerService<N> getInternalTimerService( String name, TypeSerializer<N> namespaceSerializer, Triggerable<K, N> triggerable) { if (timeServiceManager == null) { throw new RuntimeException("The timer service has not been initialized."); } @SuppressWarnings("unchecked") InternalTimeServiceManager<K> keyedTimeServiceHandler = (InternalTimeServiceManager<K>) timeServiceManager; KeyedStateBackend<K> keyedStateBackend = getKeyedStateBackend(); checkNotNull(keyedStateBackend, "Timers can only be used on keyed operators."); return keyedTimeServiceHandler.getInternalTimerService( name, keyedStateBackend.getKeySerializer(), namespaceSerializer, triggerable); }

Target:
public <K, N> InternalTimerService<N> getInternalTimerService( String name, TypeSerializer<N> namespaceSerializer, Triggerable<K, N> triggerable) { if (timeServiceManager == null) { throw new RuntimeException("The timer service has not been initialized."); } @SuppressWarnings("unchecked") InternalTimeServiceManager<K> keyedTimeServiceHandler = (InternalTimeServiceManager<K>) timeServiceManager; KeyedStateBackend<K> keyedStateBackend = getKeyedStateBackend(); checkState(keyedStateBackend != null, "Timers can only be used on keyed operators."); return keyedTimeServiceHandler.getInternalTimerService( name, keyedStateBackend.getKeySerializer(), namespaceSerializer, triggerable); }
Source:
static void cleanup() throws Exception { final Field userAgentStyleSheetField = Application.class.getDeclaredField("userAgentStylesheet"); userAgentStyleSheetField.setAccessible(true); userAgentStyleSheetField.set(null, null); }

Target:
static void cleanup() throws Exception { setUserAgentStylesheet(null); }
Source:
public void testRunTests() { String exercisePath = getTargetPath("arith_funcs"); String outputPath = exercisePath + "/results.txt"; String[] args = {"--runtests", exercisePath, outputPath}; expectedMessage = "Test results can be found in " + outputPath; mainTest(0, args); }

Target:
public void testRunTests() { final String exercisePath = getTargetPath("arith_funcs"); final String outputPath = exercisePath + "/results.txt"; String[] args = {"run-tests", exercisePath, outputPath}; exit.expectSystemExitWithStatus(0); exit.checkAssertionAfterwards(new Assertion() { @Override public void checkAssertion() throws Exception { Mockito.verify(executor).runTests(Paths.get(exercisePath)); assertEquals("Test results can be found in " + outputPath + "\n", mio.getSysOut()); assertEquals("Error output should be empty.", "", mio.getSysErr()); } }); mainClass.main(args); }
Source:
public static void stopContainer() throws Exception { LOGGER.info("*** reseting test configuration"); ModelControllerClient client = getNativeModelControllerClient(); serverTearDown(client); LOGGER.info("*** stopping container"); controller.stop(); }

Target:
public static void stopContainer() throws Exception { ModelControllerClient client = getNativeModelControllerClient(); serverTearDown(client); controller.stop(); }
Source:
public static List<String> addProperties(String key, List<String> values) { if (key == null) throw new NullPointerException(); if (key.length() == 0) throw new IllegalArgumentException(); List<String> old = _props.get(key); if (old == null) old = new LinkedList<String>(); old.addAll(values); return _props.put(key, old); }

Target:
public static List<String> addProperties(String key, List<String> values) { if (key == null) throw new NullPointerException(); if (key.length() == 0) throw new IllegalArgumentException(); synchronized (_props) { List<String> old = _props.get(key); if (old == null) old = new LinkedList<String>(); old.addAll(values); return _props.put(key, old); } }
Source:
public void testUpdateVcfSequenceDictionary(final String outputFileName) throws IOException, NoSuchFieldException, IllegalAccessException { File inputFile = new File(TEST_DATA_PATH, "vcfFormatTest.vcf"); final File samSequenceDictionaryVcf = new File(TEST_DATA_PATH, "vcfFormatTest.bad_dict.vcf"); final File outputFile = new File(outputFileName); outputFile.deleteOnExit(); UNZIPPED_FILE.deleteOnExit(); final UpdateVcfSequenceDictionary updateVcfSequenceDictionary = new UpdateVcfSequenceDictionary(); updateVcfSequenceDictionary.INPUT = inputFile; updateVcfSequenceDictionary.OUTPUT = outputFile; updateVcfSequenceDictionary.SEQUENCE_DICTIONARY = samSequenceDictionaryVcf; Assert.assertEquals(updateVcfSequenceDictionary.instanceMain(new String[0]), 0); if (outputFileName.endsWith(VcfUtils.COMPRESSED_VCF_ENDING)) { unzipFile(outputFile, UNZIPPED_FILE); } if ( outputFileName != STD_OUT_NAME ) { IOUtil.assertFilesEqual(samSequenceDictionaryVcf, outputFileName.endsWith(VcfUtils.COMPRESSED_VCF_ENDING) ? UNZIPPED_FILE : outputFile); } }

Target:
public void testUpdateVcfSequenceDictionary(final String outputFileName) throws IOException, NoSuchFieldException, IllegalAccessException { File outputFile = new File(outputFileName); outputFile.deleteOnExit(); final UpdateVcfSequenceDictionary updateVcfSequenceDictionary = new UpdateVcfSequenceDictionary(); updateVcfSequenceDictionary.INPUT = INPUT_FILE; updateVcfSequenceDictionary.SEQUENCE_DICTIONARY = SAM_SEQUENCE_DICTIONARY_VCF; if (outputFileName.equals(STD_OUT_NAME)) { final FileOutputStream stream = new FileOutputStream(STD_OUT_FILE); final Field fdField = FileDescriptor.class.getDeclaredField("fd"); fdField.setAccessible(true); updateVcfSequenceDictionary.OUTPUT = new File("/dev/fd/" + fdField.getInt(stream.getFD())); } else { updateVcfSequenceDictionary.OUTPUT = outputFile; } Assert.assertEquals(updateVcfSequenceDictionary.instanceMain(new String[0]), 0); if (outputFileName.equals(STD_OUT_NAME)) { outputFile = STD_OUT_FILE; } else if (outputFileName.endsWith(IOUtil.COMPRESSED_VCF_FILE_EXTENSION)) { File unzippedOutputFile = new File(OUTPUT_DATA_PATH + ".out.vcf"); unzippedOutputFile.deleteOnExit(); unzipFile(outputFile, unzippedOutputFile); outputFile = unzippedOutputFile; } IOUtil.assertFilesEqual(SAM_SEQUENCE_DICTIONARY_VCF, outputFile); Assert.assertEquals(SAMSequenceDictionaryExtractor.extractDictionary(INPUT_FILE.toPath()).size(), 84); Assert.assertEquals(SAMSequenceDictionaryExtractor.extractDictionary(SAM_SEQUENCE_DICTIONARY_VCF.toPath()).size(), 82); Assert.assertEquals(SAMSequenceDictionaryExtractor.extractDictionary(outputFile.toPath()).size(), 82); }
Source:
public Optional<ClientPlayer> getClientPlayer() { return Optional.ofNullable((ClientPlayer) player); }

Target:
public Optional<ClientPlayer> getClientPlayer() { return Optional.ofNullable((ClientPlayer) this.player); }
Source:
private static Request parse(final InputStream input) throws IOException { boolean eof = true; final Collection<String> head = new LinkedList<String>(); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); Opt<Integer> data = new Opt.Empty<Integer>(); while (true) { data = RqLive.data(input, data); if (data.get() < 0) { break; } eof = false; if (data.get() == '\r') { if (input.read() != '\n') { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( "there is no LF after CR in header, line #%d: \"%s\"", head.size() + 1, new String(baos.toByteArray()) ) ); } if (baos.size() == 0) { break; } data = new Opt.Single<Integer>(input.read()); addHeader(data, baos, head); continue; } legalCharacterCheck(data, baos, head.size() + 1); baos.write(data.get()); data = new Opt.Empty<Integer>(); } if (eof) { throw new IOException("empty request"); } return new Request() { @Override public Iterable<String> head() { return head; } @Override public InputStream body() { return input; } }; }

Target:
private static Request parse(final InputStream input) throws IOException { boolean eof = true; final Collection<String> head = new LinkedList<String>(); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); Opt<Integer> data = new Opt.Empty<Integer>(); while (true) { data = RqLive.data(input, data); if (data.get() < 0) { break; } eof = false; if (data.get() == '\r') { if (input.read() != '\n') { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( "there is no LF after CR in header, line #%d: \"%s\"", head.size() + 1, new String(baos.toByteArray()) ) ); } if (baos.size() == 0) { break; } data = new Opt.Single<Integer>(input.read()); final Opt<String> header = newHeader(data, baos); if (header.has()) { head.add(header.get()); } continue; } baos.write(legalCharacter(data, baos, head.size() + 1)); data = new Opt.Empty<Integer>(); } if (eof) { throw new IOException("empty request"); } return new Request() { @Override public Iterable<String> head() { return head; } @Override public InputStream body() { return input; } }; }
Source:
public void start(CoprocessorEnvironment env) throws IOException { if (env instanceof RegionCoprocessorEnvironment) { this.env = (RegionCoprocessorEnvironment) env; } else { throw new CoprocessorException("Must be loaded on a table region!"); } statsUpdateFrequencyMs = env.getConfiguration().getInt(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, QueryServicesOptions.DEFAULT_STATS_UPDATE_FREQ_MS); maxStatsAgeMs = env.getConfiguration().getInt(QueryServices.MAX_STATS_AGE_MS_ATTRIB, QueryServicesOptions.DEFAULT_MAX_STATS_AGE_MS); LOG.info("Starting Tracing-Metrics Systems"); Tracing.addTraceMetricsSource(); Metrics.ensureConfigured(); }

Target:
public void start(CoprocessorEnvironment env) throws IOException { if (env instanceof RegionCoprocessorEnvironment) { this.env = (RegionCoprocessorEnvironment) env; } else { throw new CoprocessorException("Must be loaded on a table region!"); } LOG.info("Starting Tracing-Metrics Systems"); Tracing.addTraceMetricsSource(); Metrics.ensureConfigured(); }
Source:
public static void syncDishImage(ArrayList<Dish> dishList) { if (dishList == null) { return; } for (Dish dish : dishList) { String imgUrl = getRequestUrl(null, dish.getImageServer()); String imgName = dish.getImageServer().split("/", 2)[1]; String filePath = getLocalFileStorageUrl("", imgName); RequestHelper.getFileFromServer(imgUrl, null, filePath); dish.setImageLocal(filePath); } }

Target:
public static boolean syncDishImage(ArrayList<Dish> dishList) { if (dishList == null) { return true; } for (Dish dish : dishList) { String imgUrl = getRequestUrl(null, dish.getImageServer()); String imgName = dish.getImageServer().split("/", 2)[1]; String filePath = getLocalFileStorageUrl("", imgName); RequestHelper.getFileFromServer(imgUrl, null, filePath); dish.setImageLocal(filePath); } return true; }
Source:
protected void buttonPressed(int buttonId) { if (buttonId == OK) { name = nameText.getText(); pushMode = forPush.getSelection(); } super.buttonPressed(buttonId); }

Target:
protected void buttonPressed(int buttonId) { if (buttonId == OK) { name = getTrimmedRemoteName(); pushMode = forPush.getSelection(); } super.buttonPressed(buttonId); }
Source:
protected Map<String, Pair<String, String>> getExclusiveLocks() { Map<String, Pair<String, String>> exclusiveLock = null; if (getDisk() != null) { exclusiveLock = new HashMap<>(); exclusiveLock.put(getDisk().getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.DISK, VdcBllMessages.ACTION_TYPE_FAILED_DISKS_LOCKED)); addCanDoActionMessage(String.format("$%1$s %2$s", "diskAliases", getDiskAlias())); if (getDisk().isBoot()) { exclusiveLock.put(getVmId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM_DISK_BOOT, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } } return exclusiveLock; }

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { Map<String, Pair<String, String>> exclusiveLock = null; if (getDisk() != null) { exclusiveLock = new HashMap<>(); exclusiveLock.put(getDisk().getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.DISK, VdcBllMessages.ACTION_TYPE_FAILED_DISKS_LOCKED.name() + String.format("$diskAliases %1$s", getDiskAlias()))); if (getDisk().isBoot()) { exclusiveLock.put(getVmId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM_DISK_BOOT, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } } return exclusiveLock; }
Source:
public ScheduledExecutorServiceBuilderTest() { super(); this.execTracker = null; }

Target:
public ScheduledExecutorServiceBuilderTest() { this.execTracker = null; this.le = mock(LifecycleEnvironment.class); }