auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void putEntry(ArchiveOutputStream out, String path, FileMode mode, ObjectLoader loader) throws IOException { if (path.endsWith("/") != FileMode.TREE.equals(mode)) { throw new IllegalArgumentException( "ZipFormat.putEntry: path " + path + " does not match mode " + mode); } final ZipArchiveEntry entry = new ZipArchiveEntry(path); if (FileMode.TREE.equals(mode)) { out.putArchiveEntry(entry); out.closeArchiveEntry(); return; } if (FileMode.REGULAR_FILE.equals(mode)) { } else if (mode == FileMode.EXECUTABLE_FILE || mode == FileMode.SYMLINK) { entry.setUnixMode(mode.getBits()); } else { throw new IllegalArgumentException( "ZipFormat.putEntry: Unsupported mode " + mode); } entry.setSize(loader.getSize()); out.putArchiveEntry(entry); loader.copyTo(out); out.closeArchiveEntry(); }

Target:
public void putEntry(ArchiveOutputStream out, String path, FileMode mode, ObjectLoader loader) throws IOException { if (path.endsWith("/") && mode != FileMode.TREE) throw new IllegalArgumentException(MessageFormat.format( ArchiveText.get().pathDoesNotMatchMode, path, mode)); if (!path.endsWith("/") && mode == FileMode.TREE) path = path + "/"; final ZipArchiveEntry entry = new ZipArchiveEntry(path); if (mode == FileMode.TREE) { out.putArchiveEntry(entry); out.closeArchiveEntry(); return; } if (mode == FileMode.REGULAR_FILE) { } else if (mode == FileMode.EXECUTABLE_FILE || mode == FileMode.SYMLINK) { entry.setUnixMode(mode.getBits()); } else { throw new IllegalArgumentException(MessageFormat.format( ArchiveText.get().unsupportedMode, mode)); } entry.setSize(loader.getSize()); out.putArchiveEntry(entry); loader.copyTo(out); out.closeArchiveEntry(); }
Source:
public Answer execute(final OvsDestroyTunnelCommand command, final LibvirtComputingResource libvirtComputingResource) { try { if (!libvirtComputingResource.findOrCreateTunnelNetwork(command.getBridgeName())) { s_logger.warn("Unable to find tunnel network for GRE key:" + command.getBridgeName()); return new Answer(command, false, "No network found"); } final Script scriptCommand = new Script(libvirtComputingResource.getOvsTunnelPath(), libvirtComputingResource.getTimeout().getMillis(), s_logger); scriptCommand.add("destroy_tunnel"); scriptCommand.add("--bridge", command.getBridgeName()); scriptCommand.add("--iface_name", command.getInPortName()); final String result = scriptCommand.execute(); if (result == null) { return new Answer(command, true, result); } else { return new Answer(command, false, result); } } catch (final Exception e) { s_logger.warn("caught execption when destroy ovs tunnel", e); return new Answer(command, false, e.getMessage()); } }

Target:
public Answer execute(final OvsDestroyTunnelCommand command, final LibvirtComputingResource libvirtComputingResource) { try { if (!libvirtComputingResource.findOrCreateTunnelNetwork(command.getBridgeName())) { s_logger.warn("Unable to find tunnel network for GRE key:" + command.getBridgeName()); return new Answer(command, false, "No network found"); } final Script scriptCommand = new Script(libvirtComputingResource.getOvsTunnelPath(), libvirtComputingResource.getTimeout(), s_logger); scriptCommand.add("destroy_tunnel"); scriptCommand.add("--bridge", command.getBridgeName()); scriptCommand.add("--iface_name", command.getInPortName()); final String result = scriptCommand.execute(); if (result == null) { return new Answer(command, true, result); } else { return new Answer(command, false, result); } } catch (final Exception e) { s_logger.warn("caught execption when destroy ovs tunnel", e); return new Answer(command, false, e.getMessage()); } }
Source:
private List<IndexEntry> getValidIndexEntriesForIndexSegment(Offset indexSegmentStartOffset, long deleteReferenceTimeMs, long expiryReferenceTimeMs) { List<IndexEntry> validEntries = new ArrayList<>(); for (Map.Entry<MockId, IndexValue> indexSegmentEntry : referenceIndex.get(indexSegmentStartOffset).entrySet()) { MockId key = indexSegmentEntry.getKey(); IndexValue value = indexSegmentEntry.getValue(); if (value.isFlagSet(IndexValue.Flags.Delete_Index)) { validEntries.add(new IndexEntry(key, value)); if (!isDeletedAt(key, deleteReferenceTimeMs) && !isExpiredAt(key, expiryReferenceTimeMs) && value.getOriginalMessageOffset() != -1 && value.getOriginalMessageOffset() >= indexSegmentStartOffset.getOffset()) { validEntries.add(new IndexEntry(key, allKeys.get(key).getFirst())); } } else if (!isExpiredAt(key, expiryReferenceTimeMs)) { if (!deletedKeys.contains(key)) { validEntries.add(new IndexEntry(key, value)); } else if (!isDeletedAt(key, deleteReferenceTimeMs)) { validEntries.add(new IndexEntry(key, value)); } } } return validEntries; }

Target:
List<IndexEntry> getValidIndexEntriesForIndexSegment(Offset indexSegmentStartOffset, long deleteReferenceTimeMs, long expiryReferenceTimeMs) { List<IndexEntry> validEntries = new ArrayList<>(); for (Map.Entry<MockId, IndexValue> indexSegmentEntry : referenceIndex.get(indexSegmentStartOffset).entrySet()) { MockId key = indexSegmentEntry.getKey(); IndexValue value = indexSegmentEntry.getValue(); if (value.isFlagSet(IndexValue.Flags.Delete_Index)) { validEntries.add(new IndexEntry(key, value)); if (!isDeletedAt(key, deleteReferenceTimeMs) && !isExpiredAt(key, expiryReferenceTimeMs) && value.getOriginalMessageOffset() != -1 && value.getOriginalMessageOffset() >= indexSegmentStartOffset.getOffset()) { validEntries.add(new IndexEntry(key, allKeys.get(key).getFirst())); } } else if (!isExpiredAt(key, expiryReferenceTimeMs)) { if (!deletedKeys.contains(key)) { validEntries.add(new IndexEntry(key, value)); } else if (!isDeletedAt(key, deleteReferenceTimeMs)) { validEntries.add(new IndexEntry(key, value)); } } } return validEntries; }
Source:
private void handleAdd() { IPluginModelBase model = (IPluginModelBase) getPage().getModel(); PluginSelectionDialog dialog = new PluginSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), getAvailablePlugins(model), getAvailablePluginImports(model), true); dialog.create(); if (dialog.open() == Window.OK) { Object[] models = dialog.getResult(); IPluginImport[] imports = new IPluginImport[models.length]; try { for (int i = 0; i < models.length; i++) { IPluginModel candidate = (IPluginModel) models[i]; String pluginId = candidate.getPlugin().getId(); IPluginImport importNode = createImport(model.getPluginFactory(), pluginId); String version = VersionUtil.computeInitialPluginVersion(candidate.getPlugin().getVersion()); importNode.setVersion(version); imports[i] = importNode; } addImports(model.getPluginBase(), imports); } catch (CoreException e) { } } }

Target:
private void handleAdd() { IPluginModelBase model = (IPluginModelBase) getPage().getModel(); PluginSelectionDialog dialog = new PluginSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), getAvailablePlugins(model, false), getAvailablePlugins(model, true), true); dialog.create(); if (dialog.open() == Window.OK) { Object[] models = dialog.getResult(); IPluginImport[] imports = new IPluginImport[models.length]; try { for (int i = 0; i < models.length; i++) { IPluginModel candidate = (IPluginModel) models[i]; String pluginId = candidate.getPlugin().getId(); IPluginImport importNode = createImport(model.getPluginFactory(), pluginId); String version = VersionUtil.computeInitialPluginVersion(candidate.getPlugin().getVersion()); importNode.setVersion(version); imports[i] = importNode; } addImports(model.getPluginBase(), imports); } catch (CoreException e) { } } }
Source:
private static String getUserAgentSuffix() { String suffix = ";" + USER_AGENT_SUFFIX; return suffix; }

Target:
private static String getUserAgentSuffix() { return ";" + USER_AGENT_SUFFIX; }
Source:
public void connect() throws OpenEnergyMonitorException { try { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); CommPort commPort = portIdentifier.open(this.getClass().getName(), 2000); serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(BAUDRATE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); serialPort.enableReceiveThreshold(1); serialPort.enableReceiveTimeout(100); try { serialPort.addEventListener(this); serialPort.notifyOnDataAvailable(true); } catch (TooManyListenersException e) { } in = serialPort.getInputStream(); logger.debug("Open Energy Monitor Serial Port message listener started"); } catch (Exception e) { throw new OpenEnergyMonitorException(e); } }

Target:
public void connect() throws OpenEnergyMonitorException { try { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); CommPort commPort = portIdentifier.open(this.getClass().getName(), 2000); serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(BAUDRATE, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); serialPort.enableReceiveThreshold(1); serialPort.enableReceiveTimeout(100); try { serialPort.addEventListener(this); serialPort.notifyOnDataAvailable(true); } catch (TooManyListenersException e) { logger.warn("Can't add serial port event listener. ", e); } in = serialPort.getInputStream(); logger.debug("Open Energy Monitor Serial Port message listener started"); } catch (Exception e) { throw new OpenEnergyMonitorException(e); } }
Source:
public static void main(String[] args) { Properties props = new Properties(); if (args.length < 2) { System.out.println("testkafkaimporter: brokers topic [format]"); System.exit(1); } props.put("brokers", args[0]); props.put("topics", args[1]); String format = "csv"; if (args.length > 2) format = args[2]; props.put("procedure", "fake"); KafkaStreamImporterFactory factory = new KafkaStreamImporterFactory(); VoltCSVFormatterFactory ffactory = new VoltCSVFormatterFactory(); ffactory.create(format, props); FormatterBuilder fb = new FormatterBuilder(format, props); fb.setFormatterFactory(ffactory); System.out.println("Properties are: " + props); Map<URI, ImporterConfig> mmap = factory.createImporterConfigurations(props, fb); System.out.println("Number of Partitions for topic are: " + mmap.size()); CountDownLatch cdl = new CountDownLatch(mmap.size()); for (URI uri : mmap.keySet()) { KafkaTopicPartitionImporter importer = new KafkaTopicPartitionImporter((KafkaStreamImporterConfig )mmap.get(uri)); Runner runner = new Runner(importer, cdl); runner.start(); } try { cdl.await(); } catch (InterruptedException ex) { ex.printStackTrace(); } System.out.println("Exiting."); }

Target:
public static void main(String[] args) { Properties props = new Properties(); if (args.length < 1) { System.out.println("testkafkaimporter: path-to-properties-file - The file should have brokers and topics properties at minimum."); System.exit(1); } String filename = args[0]; try (InputStream is = new FileInputStream(new File(filename))) { props.load(is); } catch (Exception ex) { ex.printStackTrace(); } String partition = props.getProperty("partition"); if (args.length > 2) { partition = args[2]; if (partition != null && partition.equals("all")) { partition = null; } } String format = props.getProperty("format"); if (format == null || format.length() <= 0) format = "csv"; System.out.println("Properties are: " + props); props.put("procedure", "fake"); KafkaStreamImporterFactory factory = new KafkaStreamImporterFactory(); VoltCSVFormatterFactory ffactory = new VoltCSVFormatterFactory(); ffactory.create(format, props); FormatterBuilder fb = new FormatterBuilder(format, props); fb.setFormatterFactory(ffactory); Map<URI, ImporterConfig> mmap = factory.createImporterConfigurations(props, fb); System.out.println("Number of Partitions for topic are: " + mmap.size() + " Requested partition: " + partition); CountDownLatch cdl = new CountDownLatch(mmap.size()); for (URI uri : mmap.keySet()) { if (partition != null && !uri.toString().endsWith(partition)) { cdl.countDown(); continue; } KafkaTopicPartitionImporter importer = new KafkaTopicPartitionImporter((KafkaStreamImporterConfig )mmap.get(uri)); Runner runner = new Runner(importer, cdl); runner.start(); } try { cdl.await(); } catch (InterruptedException ex) { ex.printStackTrace(); } System.out.println("Exiting."); }
Source:
private void setFileTimes(final String filePath,final String creationTime,final String lastModifiedTime ,final String lastAccessedTime) { try { final BasicFileAttributeView attributes = Files.getFileAttributeView(Paths.get(filePath), BasicFileAttributeView.class); final FileTime timeCreation = FileTime.fromMillis(Long.parseLong(creationTime)); final FileTime timeModified = FileTime.fromMillis(Long.parseLong(lastModifiedTime)); final FileTime timeAccessed = FileTime.fromMillis(Long.parseLong(lastAccessedTime)); attributes.setTimes(timeModified, timeAccessed, timeCreation); } catch (final Exception e) { e.printStackTrace(); } }

Target:
private void setFileTimes(final String filePath,final String creationTime,final String lastModifiedTime ,final String lastAccessedTime) { try { final BasicFileAttributeView attributes = Files.getFileAttributeView(Paths.get(filePath), BasicFileAttributeView.class); final FileTime timeCreation = FileTime.fromMillis(Long.parseLong(creationTime)); final FileTime timeModified = FileTime.fromMillis(Long.parseLong(lastModifiedTime)); final FileTime timeAccessed = FileTime.fromMillis(Long.parseLong(lastAccessedTime)); attributes.setTimes(timeModified, timeAccessed, timeCreation); } catch (final Exception e) { LOG.error("Unable to restore creation and modified time", e); metadataRestoreListener.metadataRestoreFailed("Unable to restore creation and modified time ::"+e.getMessage()); } }
Source:
public void canExposeASingleEventType() throws Exception { final EventType expectedEventType = buildEventType(); when(repo.findByName(EVENT_TYPE_NAME)).thenReturn(expectedEventType); final MockHttpServletRequestBuilder requestBuilder = get("/event-types/" + EVENT_TYPE_NAME) .accept(APPLICATION_JSON); mockMvc.perform(requestBuilder) .andExpect(status().is2xxSuccessful()) .andExpect(content().contentTypeCompatibleWith(APPLICATION_JSON)) .andExpect(content().json(asJsonString(expectedEventType))); }

Target:
public void canExposeASingleEventType() throws Exception { final EventType expectedEventType = buildEventType(); when(repo.findByName(EVENT_TYPE_NAME)).thenReturn(expectedEventType); final MockHttpServletRequestBuilder requestBuilder = get("/event-types/" + EVENT_TYPE_NAME) .accept(APPLICATION_JSON); mockMvc.perform(requestBuilder) .andExpect(status().is(200)) .andExpect(content().contentTypeCompatibleWith(APPLICATION_JSON)) .andExpect(content().json(asJsonString(expectedEventType))); }
Source:
public boolean isPlatformCaseSensitive() { return !isMySql() && !isSqlServer(); }

Target:
public boolean isPlatformCaseSensitive() { return spiEbeanServer().getDatabasePlatform().isCaseSensitiveCollation(); }
Source:
public void start() throws TTransportException { for (Engine engine : engines.values()) { engine.start(); } httpServer.start(); plugins.start(); System.out.println("The Concourse server has started"); server.serve(); Thread managementd = new Thread(() -> { managementServer.serve(); },"management-server"); managementd.setDaemon(true); managementd.start(); }

Target:
public void start() throws TTransportException { for (Engine engine : engines.values()) { engine.start(); } httpServer.start(); plugins.start(); Thread managementd = new Thread(() -> { managementServer.serve(); },"management-server"); managementd.setDaemon(true); managementd.start(); System.out.println("The Concourse server has started"); server.serve(); }
Source:
public QueryBuilder make(EsHint hint, String fieldName, Object value) { CommonTermsQueryBuilder commonQuery = QueryBuilders.commonTermsQuery(fieldName, value); if (hint.analyzer != null) { commonQuery.analyzer(hint.analyzer); } return commonQuery; }

Target:
public QueryBuilder make(EsHint hint, String fieldName, Object value) { return QueryBuilders.commonTermsQuery(fieldName, value).analyzer(hint.analyzer); }
Source:
public Iterator<HiveFileInfo> list(FileSystem fileSystem, Table table, Path path, NamenodeStats namenodeStats, NestedDirectoryPolicy nestedDirectoryPolicy, PathFilter pathFilter) { SchemaTableName schemaTableName = new SchemaTableName(table.getDatabaseName(), table.getTableName()); List<HiveFileInfo> files = cache.getIfPresent(path); if (files != null) { return files.iterator(); } if (cachedTableNames.contains(schemaTableName)) { RemoteIterator<LocatedFileStatus> iterator = null; try { iterator = fileSystem.listLocatedStatus(path); } catch (IOException e) { throw new PrestoException(HIVE_FILE_NOT_FOUND, "Hive file location does not exist: " + path); } HadoopFileInfoIterator fileIterator = new HadoopFileInfoIterator(cachingRemoteIterator(iterator, path)); return new HiveFileIterator(path, p -> fileIterator, namenodeStats, nestedDirectoryPolicy, pathFilter); } return delegate.list(fileSystem, table, path, namenodeStats, nestedDirectoryPolicy, pathFilter); }

Target:
public Iterator<HiveFileInfo> list(FileSystem fileSystem, Table table, Path path, NamenodeStats namenodeStats, NestedDirectoryPolicy nestedDirectoryPolicy, PathFilter pathFilter) { SchemaTableName schemaTableName = new SchemaTableName(table.getDatabaseName(), table.getTableName()); List<HiveFileInfo> files = cache.getIfPresent(path); if (files != null) { return files.iterator(); } Iterator<HiveFileInfo> iterator = delegate.list(fileSystem, table, path, namenodeStats, nestedDirectoryPolicy, pathFilter); if (cachedTableNames.contains(schemaTableName)) { return cachingIterator(iterator, path); } return iterator; }
Source:
public @Nullable Object resolve(@NonNull ISegment segment) { if (segment instanceof CalledFunction) { CalledFunction calledFunction = (CalledFunction) segment; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { String symbolText; ISymbolProvider provider = SymbolProviderManager.getInstance().getSymbolProvider(trace); if (calledFunction.getSymbol() instanceof Long) { Long address=(Long) calledFunction.getSymbol(); symbolText = provider.getSymbolText(address); if(symbolText==null) { return "0x"+Long.toHexString(address); } return symbolText; } return calledFunction.getSymbol().toString(); } } return null; }

Target:
public @Nullable Object resolve(@NonNull ISegment segment) { if (segment instanceof CalledFunction) { CalledFunction calledFunction = (CalledFunction) segment; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { String symbolText; ISymbolProvider provider = SymbolProviderManager.getInstance().getSymbolProvider(trace); ITmfStateValue symbol = ((ITmfStateValue) calledFunction.getSymbol()); switch (symbol.getType()) { case LONG: Long longAddress = symbol.unboxLong(); symbolText = provider.getSymbolText(longAddress); if (symbolText == null) { return "0x" + Long.toHexString(longAddress); } return symbolText; case STRING: return symbol.unboxStr(); case INTEGER: Integer intAddress = symbol.unboxInt(); symbolText = provider.getSymbolText(intAddress); if (symbolText == null) { return "0x" + Integer.toHexString(intAddress); } return symbolText; case DOUBLE: case NULL: case CUSTOM: default: break; } } } return null; }
Source:
public long size() { build(); return body.length() + partBoundary.length + partHeader.length; }

Target:
public long size() { build(); if (body.length() > -1) { return body.length() + partBoundary.length + partHeader.length; } else { return -1; } }
Source:
public void testGetSanitizedData() { testProps.put(SERVICE_PID, TEST_PID); testProps.put(SERVICE_FACTORYPID, TEST_PID); testProps.put(FELIX_FILENAME, temporaryFile.toURI()); testProps.put(FELIX_NEW_CONFIG, true); testProps.put(SERVICE_FACTORY_PIDLIST, new ArrayList<>()); testProps.put(PROPERTY_REVISION, TEST_PID); context = new ConfigurationContextImpl(TEST_PID, testProps); assertThat(context.getServicePid(), is(TEST_PID)); assertThat(context.getSanitizedProperties().size(), is(2)); }

Target:
public void testGetSanitizedData() { testProps.put(SERVICE_PID, TEST_PID); testProps.put(SERVICE_FACTORYPID, TEST_PID); testProps.put(FELIX_FILENAME, temporaryFile.toURI()); testProps.put(FELIX_NEW_CONFIG, true); testProps.put(SERVICE_FACTORY_PIDLIST, new ArrayList<>()); testProps.put(PROPERTY_REVISION, TEST_REVISION); context = new ConfigurationContextImpl(TEST_PID, testProps); assertThat(context.getServicePid(), is(TEST_PID)); assertThat(context.getSanitizedProperties().size(), is(2)); }
Source:
public APIResult updateDatasourceDependents(String datasourceName, Boolean skipDryRun) { try { Datasource datasource = EntityUtil.getEntity(EntityType.DATASOURCE, datasourceName); StringBuilder result = new StringBuilder(String.format("Updating feed entities " + "dependent on datasource : %s ", datasource.getName())); Pair<String, EntityType>[] dependentEntities = EntityIntegrityChecker.referencedBy(datasource); if (dependentEntities == null) { return new APIResult(APIResult.Status.SUCCEEDED, String.format("Datasource %s has " + "no dependent entities", datasourceName)); } for (Pair<String, EntityType> depEntity : dependentEntities) { Entity entity = EntityUtil.getEntity(depEntity.second, depEntity.first); if (entity.getEntityType() == EntityType.FEED) { Feed newFeed = (Feed) entity.copy(); for (org.apache.falcon.entity.v0.feed.Cluster feedCluster : newFeed.getClusters().getClusters()) { if (feedCluster.getType() == ClusterType.SOURCE) { boolean updatedFeed = isUpdateFeedDatasourceVersion(feedCluster, datasource, newFeed); if (updatedFeed) { result.append(getWorkflowEngine(entity).update(entity, newFeed, feedCluster.getName(), skipDryRun)); updateEntityInConfigStore(entity, newFeed); } } } } } return new APIResult(APIResult.Status.SUCCEEDED, result.toString()); } catch (FalconException e) { LOG.error("Update failed", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }

Target:
public APIResult updateDatasourceDependents(String datasourceName, Boolean skipDryRun) { try { Datasource datasource = EntityUtil.getEntity(EntityType.DATASOURCE, datasourceName); StringBuilder result = new StringBuilder(String.format("Updating feed entities " + "dependent on datasource : %s ", datasource.getName())); Pair<String, EntityType>[] dependentEntities = EntityIntegrityChecker.referencedBy(datasource); if (dependentEntities == null) { return new APIResult(APIResult.Status.SUCCEEDED, String.format("Datasource %s has " + "no dependent entities", datasourceName)); } for (Pair<String, EntityType> depEntity : dependentEntities) { Entity entity = EntityUtil.getEntity(depEntity.second, depEntity.first); if (entity.getEntityType() != EntityType.FEED) { throw FalconWebException.newAPIException("Datasource dependents should be FEEDS, but" + "encountered type : " + entity.getEntityType()); } Feed newFeed = (Feed) entity.copy(); for (org.apache.falcon.entity.v0.feed.Cluster feedCluster : newFeed.getClusters().getClusters()) { if (feedCluster.getType() == ClusterType.SOURCE) { boolean updatedFeed = isUpdateFeedDatasourceVersion(feedCluster, datasource, newFeed); if (updatedFeed) { result.append(getWorkflowEngine(entity).update(entity, newFeed, feedCluster.getName(), skipDryRun)); updateEntityInConfigStore(entity, newFeed); } } } } return new APIResult(APIResult.Status.SUCCEEDED, result.toString()); } catch (FalconException e) { LOG.error("Update failed", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }
Source:
protected void initListeners(TreeViewer viewer) { super.initListeners(viewer); viewer.getControl().addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent event) { SafeRunner.run(() -> { handleMiddleClick(event); }); } private void handleMiddleClick(MouseEvent event) throws CoreException { if (event.button == 2 && event.widget instanceof Tree) { TreeItem item = ((Tree) event.widget).getItem(new Point(event.x, event.y)); if (item == null) { return; } Object data = item.getData(); if (data instanceof IProject) { IProject project = (IProject) data; if (project.isOpen()) { project.close(new NullProgressMonitor()); } } } } }); }

Target:
protected void initListeners(TreeViewer viewer) { super.initListeners(viewer); viewer.getControl().addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent event) { SafeRunner.run(() -> { handleMiddleClick(event); }); } private void handleMiddleClick(MouseEvent event) throws CoreException { if (event.button == 2 && event.widget instanceof Tree) { TreeItem item = ((Tree) event.widget).getItem(new Point(event.x, event.y)); if (item == null) { return; } Object data = item.getData(); if (data instanceof IProject) { IProject project = (IProject) data; CloseResourceAction cra = new CloseResourceAction(() -> null); cra.selectionChanged(new StructuredSelection(project)); cra.run(); } } } }); }
Source:
private void onSave() { if (!validate()) { return; } flush(); Frontend.RunAction(action, new ProviderParameters(provider), null, true); cancel(); }

Target:
private void onSave() { if (!validate()) { return; } flush(); Frontend.RunAction(action, new ProviderParameters(provider)); cancel(); }
Source:
public List<RepositoryLocation<? extends Repository>> loadRepositoryLocations() { List<RepositoryLocation<? extends Repository>> result = new ArrayList<>(); File repositoryListFile = new File(repositoryListPath); if (repositoryListFile.exists()) { try { result = this.objectMapper.readValue(new File(repositoryListPath), TypeFactory.defaultInstance().constructParametricType(List.class, RepositoryLocation.class)); } catch (IOException e) { LOGGER.error("Couldn't load repository location list", e); } } else { try { result.add(new GitRepositoryLocation.Builder() .withGitRepositoryUri(new URL("<LINK_0>").toURI()) .withBranch("5.0-alpha").build()); result.add(new ClasspathRepositoryLocation("/org/phoenicis/repository")); } catch (URISyntaxException | MalformedURLException e) { LOGGER.error("Couldn't create default repository location list", e); } } return result; }

Target:
public List<RepositoryLocation<? extends Repository>> loadRepositoryLocations() { List<RepositoryLocation<? extends Repository>> result = new ArrayList<>(); File repositoryListFile = new File(repositoryListPath); if (repositoryListFile.exists()) { try { result = this.objectMapper.readValue(new File(repositoryListPath), TypeFactory.defaultInstance().constructParametricType(List.class, RepositoryLocation.class)); } catch (IOException e) { LOGGER.error("Couldn't load repository location list", e); } } else { try { result.add(new GitRepositoryLocation.Builder() .withGitRepositoryUri(new URL(defaultGitUrl).toURI()) .withBranch(defaultGitBranch).build()); result.add(new ClasspathRepositoryLocation(defaultClasspath)); } catch (URISyntaxException | MalformedURLException e) { LOGGER.error("Couldn't create default repository location list", e); } } return result; }
Source:
private GatewayResponse<BaseAuthoriseResponse> createGatewayBaseAuthoriseResponse(boolean isAuthorised) { GatewayResponseBuilder<BaseAuthoriseResponse> gatewayResponseBuilder = responseBuilder(); return gatewayResponseBuilder.withResponse(new BaseAuthoriseResponse() { private final String transactionId = randomUUID().toString(); @Override public AuthoriseStatus authoriseStatus() { return isAuthorised ? AuthoriseStatus.AUTHORISED : AuthoriseStatus.REJECTED; } @Override public String getTransactionId() { return transactionId; } @Override public String getErrorCode() { return null; } @Override public String getErrorMessage() { return null; } @Override public Optional<GatewayParamsFor3ds> getAuth3dsDetails() { return Optional.empty(); } @Override public String toString() { return "Sandbox authorisation response (transactionId: " + getTransactionId() + ", isAuthorised: " + isAuthorised + ')'; } }).build(); }

Target:
private GatewayResponse<BaseAuthoriseResponse> createGatewayBaseAuthoriseResponse(boolean isAuthorised) { GatewayResponseBuilder<BaseAuthoriseResponse> gatewayResponseBuilder = responseBuilder(); return gatewayResponseBuilder.withResponse(new BaseAuthoriseResponse() { private final String transactionId = randomUUID().toString(); @Override public AuthoriseStatus authoriseStatus() { return isAuthorised ? AuthoriseStatus.AUTHORISED : AuthoriseStatus.REJECTED; } @Override public String getTransactionId() { return transactionId; } @Override public String getErrorCode() { return null; } @Override public String getErrorMessage() { return null; } @Override public Optional<GatewayParamsFor3ds> getGatewayParamsFor3ds() { return Optional.empty(); } @Override public String toString() { return "Sandbox authorisation response (transactionId: " + getTransactionId() + ", isAuthorised: " + isAuthorised + ')'; } }).build(); }
Source:
private void loadValidUrl(final boolean shouldShowError) { if (mWebView != null) { if (PreferencesState.getCredentialsFromPreferences().isDemoCredentials()) { showHideWebView(false); mErrorDemoText.setTextTranslation(R.string.demo_page_text); } else { new ApiAvailabilityFactory().getGetWebViewAvailableUseCase().execute( new GetWebAvailableUseCase.Callback() { @Override public void onSuccess() { executeOnWebAvailable(); } @Override public void onError() { if(shouldShowError) { showError(); } } }); } } }

Target:
private void loadValidUrl(final boolean shouldShowError) { if (mWebView != null) { if (PreferencesState.getCredentialsFromPreferences().isDemoCredentials()) { showHideWebView(false); mErrorDemoText.setTextTranslation(R.string.demo_page_text); } else { new ApiAvailabilityFactory().getGetWebViewAvailableUseCase().execute( new GetWebAvailableUseCase.Callback() { @Override public void onSuccess() { executeOnWebAvailable(); } @Override public void onError(ApiStatus apiStatus) { if(shouldShowError) { showApiNotAvailableError(apiStatus.getMessage()); } } }); } } }
Source:
public static String saveIptablesRules() { return BashCommands.alternatives( BashCommands.ifExecutableElse1("apt-get", BashCommands.installPackage("iptables-persistent")), iptablesService("save")); }

Target:
public static String saveIptablesRules() { return alternatives(sudo("service iptables save"), chain(installPackage("iptables-persistent"), sudo("/etc/init.d/iptables-persistent save"))); }
Source:
public static Map.Entry<String, Map<String, ?>> powerACCommand( PowerACState powerACState) { return new AbstractMap.SimpleEntry<>(POWER_AC_STATE, prepareArguments("state", powerACState.toString())); }

Target:
public static Map.Entry<String, Map<String, ?>> powerACCommand( PowerACState powerACState) { return new AbstractMap.SimpleEntry<>(POWER_AC_STATE, prepareArguments("state", powerACState.name().toLowerCase())); }
Source:
public void spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue() throws Throwable { activePublisherTest(Integer.MAX_VALUE, new PublisherTestRun<T>() { @Override public void run(Publisher<T> pub) throws Throwable { ManualSubscriberWithSubscriptionSupport<T> sub = new BlackholeSubscriberWithSubscriptionSupport<T>(env) { int maxCalls = 10; @Override public void onNext(T element) { env.debug(this + "::onNext(" + element + ")"); if (subscription.isCompleted()) { if (maxCalls > 0) { subscription.value().request(Long.MAX_VALUE - 1); maxCalls--; } } else { env.flop("Subscriber::onNext(" + element + ") called before Subscriber::onSubscribe"); } } }; env.subscribe(pub, sub, env.defaultTimeoutMillis()); sub.request(1); sub.request(1); sub.request(1); sub.expectErrorWithMessage(IllegalStateException.class, "3.17"); env.verifyNoAsyncErrors(env.defaultTimeoutMillis()); } }); }

Target:
public void spec317_mustSignalOnErrorWhenPendingAboveLongMaxValue() throws Throwable { activePublisherTest(Integer.MAX_VALUE, new PublisherTestRun<T>() { @Override public void run(Publisher<T> pub) throws Throwable { ManualSubscriberWithSubscriptionSupport<T> sub = new BlackholeSubscriberWithSubscriptionSupport<T>(env) { int callsCounter = 10; @Override public void onNext(T element) { env.debug(String.format("%s::onNext(%s)", this, element)); if (subscription.isCompleted()) { if (callsCounter > 0) { subscription.value().request(Long.MAX_VALUE - 1); callsCounter--; } } else { env.flop(String.format("Subscriber::onNext(%s) called before Subscriber::onSubscribe", element)); } } }; env.subscribe(pub, sub, env.defaultTimeoutMillis()); sub.request(1); sub.expectErrorWithMessage(IllegalStateException.class, "3.17"); env.verifyNoAsyncErrors(env.defaultTimeoutMillis()); } }); }
Source:
CorfuRecord<V, M> getRecord(@Nonnull final String tableName, @Nonnull final K key) { return get(tableName, null, key); }

Target:
CorfuRecord<V, M> getRecord(@Nonnull final String tableName, @Nonnull final K key) { return getRecord(tableName, null, key); }
Source:
private static URL mapToURL(String path) { try { File file = new File(path); return file.toURI().toURL(); } catch (MalformedURLException e) { throw new IllegalStateException(e); } }

Target:
private static URL mapToURL(String path) { try { return new URL(path); } catch (MalformedURLException e) { try { return new File(path).toURI().toURL(); } catch (MalformedURLException e1) { throw new IllegalArgumentException(e1); } } }
Source:
public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_TIME_TICK)) { scheduleTimeTickEvent(); } else if (intent.getAction().equals(Intent.ACTION_DATE_CHANGED)) { TimeZone zone = TimeZone.getTimeZone(SystemProperties.get(TIMEZONE_PROPERTY)); int gmtOffset = zone.getRawOffset(); if (zone.inDaylightTime(new Date(System.currentTimeMillis()))) { gmtOffset += zone.getDSTSavings(); } setKernelTimezone(mDescriptor, -(gmtOffset / 60000)); scheduleDateChangedEvent(); } }

Target:
public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_TIME_TICK)) { scheduleTimeTickEvent(); } else if (intent.getAction().equals(Intent.ACTION_DATE_CHANGED)) { TimeZone zone = TimeZone.getTimeZone(SystemProperties.get(TIMEZONE_PROPERTY)); int gmtOffset = zone.getOffset(System.currentTimeMillis()); setKernelTimezone(mDescriptor, -(gmtOffset / 60000)); scheduleDateChangedEvent(); } }
Source:
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { if (baseRequest.isHandled()) { return; } String resourcePath = getResourcePath(request); if (resourcePath == null) { return; } if (resourcePath.equals("")) { response.setStatus(HttpServletResponse.SC_TEMPORARY_REDIRECT); response.setHeader("Location", response.encodeRedirectURL(baseUri + "/")); baseRequest.setHandled(true); return; } URL resource = getResource(resourcePath); if (resource == null) { return; } baseRequest.setHandled(true); String method = request.getMethod(); boolean skipContent = false; if (!HttpMethod.GET.is(method)) { if (HttpMethod.HEAD.is(method)) { skipContent = true; } else { response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); return; } } InputStream resourceStream = null; try { resourceStream = resource.openStream(); String contentType = MIME_TYPES.getMimeByExtension(resource.toString()); response.setContentType(contentType); if (skipContent) { return; } ByteStreams.copy(resourceStream, response.getOutputStream()); } finally { closeQuietly(resourceStream); } }

Target:
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { if (baseRequest.isHandled()) { return; } String resourcePath = getResourcePath(request); if (resourcePath == null) { return; } if (resourcePath.isEmpty()) { response.setStatus(HttpServletResponse.SC_TEMPORARY_REDIRECT); response.setHeader(HttpHeaders.LOCATION, response.encodeRedirectURL(baseUri + "/")); baseRequest.setHandled(true); return; } URL resource = getResource(resourcePath); if (resource == null) { return; } baseRequest.setHandled(true); String method = request.getMethod(); boolean skipContent = false; if (!HttpMethod.GET.is(method)) { if (HttpMethod.HEAD.is(method)) { skipContent = true; } else { response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); return; } } InputStream resourceStream = null; try { resourceStream = resource.openStream(); String contentType = MIME_TYPES.getMimeByExtension(resource.toString()); response.setContentType(contentType); if (skipContent) { return; } ByteStreams.copy(resourceStream, response.getOutputStream()); } finally { closeQuietly(resourceStream); } }
Source:
public void onBannerLoaded(BannerView bannerView) { mBannerView = bannerView; bannerListener.onAdLoaded(UnityAdapter.this); Log.v(TAG, "Unity Ads Banner finished loading banner for placement: " + mBannerView.getPlacementId()); }

Target:
public void onBannerLoaded(BannerView bannerView) { Log.v(TAG, "Unity Ads Banner finished loading banner for placement: " + mBannerView.getPlacementId()); bannerListener.onAdLoaded(UnityAdapter.this); }
Source:
private void querySubprocess() { try { _process.writeSpoutMsg(spoutMsg); while (true) { Emission emission = _process.readEmission(); String command = emission.getCommand(); if (command.equals("sync")) { return; } else if (command.equals("log")) { String msg = emission.getMsg(); LOG.info("Shell msg: " + msg); } else if (command.equals("emit")) { String stream = emission.getStream(); Long task = emission.getTask(); List<Object> tuple = emission.getTuple(); Object messageId = emission.getId(); if (task == 0) { List<Integer> outtasks = _collector.emit(stream, tuple, messageId); _process.writeTaskIds(outtasks); } else { _collector.emitDirect((int)task.longValue(), stream, tuple, messageId); } } } } catch (IOException e) { throw new RuntimeException(e); } }

Target:
private void querySubprocess() { try { _process.writeSpoutMsg(spoutMsg); while (true) { ShellMsg shellMsg = _process.readShellMsg(); String command = shellMsg.getCommand(); if (command.equals("sync")) { return; } else if (command.equals("log")) { String msg = shellMsg.getMsg(); LOG.info("Shell msg: " + msg); } else if (command.equals("emit")) { String stream = shellMsg.getStream(); Long task = shellMsg.getTask(); List<Object> tuple = shellMsg.getTuple(); Object messageId = shellMsg.getId(); if (task == 0) { List<Integer> outtasks = _collector.emit(stream, tuple, messageId); if (shellMsg.areTaskIdsNeeded()) { _process.writeTaskIds(outtasks); } } else { _collector.emitDirect((int) task.longValue(), stream, tuple, messageId); } } else { throw new RuntimeException("Unknown command received: " + command); } } } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public ServerTemplate update(ServerTemplate serverTemplate) { ServerTemplate updated = null; synchronized (templateMap) { if (templateKeyMap.isEmpty()) { loadTemplateMapsFromFile(); } templateKeyMap.put(serverTemplate.getId(), new ServerTemplateKey(serverTemplate.getId(),serverTemplate.getName())); updated = templateMap.put(serverTemplate.getId(),serverTemplate); writeTemplateMap(); } return updated; }

Target:
public ServerTemplate update(ServerTemplate serverTemplate) { ServerTemplate updated = null; synchronized (templateMap) { templateKeyMap.put(serverTemplate.getId(), new ServerTemplateKey(serverTemplate.getId(),serverTemplate.getName())); updated = templateMap.put(serverTemplate.getId(),serverTemplate); writeTemplateMap(); } return updated; }
Source:
public void deployQueue(final String address, final String name, final String filterStr, final boolean durable) throws Exception { if (AuditLogger.isEnabled()) { AuditLogger.deployQueue(this.server, address, name, filterStr, durable); } checkStarted(); clearIO(); try { server.createQueue(new QueueConfiguration(name) .setAddress(address) .setName(name) .setFilterString(filterStr) .setDurable(durable)); } finally { blockOnIO(); } }

Target:
public void deployQueue(final String address, final String name, final String filterStr, final boolean durable) throws Exception { if (AuditLogger.isEnabled()) { AuditLogger.deployQueue(this.server, address, name, filterStr, durable); } checkStarted(); clearIO(); try { server.createQueue(new QueueConfiguration(name) .setAddress(address) .setFilterString(filterStr) .setDurable(durable)); } finally { blockOnIO(); } }
Source:
private PluginProperties parsePluginConfigs(InputStream inputStream) { ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory()); try { PluginProperties pluginConfigs = objectMapper.readValue(inputStream, PluginProperties.class); return pluginConfigs; } catch (IOException e) { throw new PluginLoaderException("Unable to parse plugin configurations", e); } }

Target:
private PluginProperties parsePluginConfigs(InputStream inputStream) { ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory()); try { PluginProperties pluginConfigs = objectMapper.readValue(inputStream, PluginProperties.class); pluginConfigs.validate(); return pluginConfigs; } catch (IOException e) { throw new MalformedPluginConfigurationException("Unable to parse plugin configurations", e); } }
Source:
public void run(final Callback callback) { final Deque<Node<View, Edge>> nodes = new ArrayDeque(); processedConnectors.clear(); if (!keepChildren) { childrenTraverseProcessor .setRootUUID(candidate.getUUID()) .traverse(graph, new AbstractChildrenTraverseCallback<Node<View, Edge>, Edge<Child, Node>>() { @Override public void startNodeTraversal(final Node<View, Edge> node) { super.startNodeTraversal(node); if (isDockedNode(node)) { return; } nodes.add(node); } @Override public boolean startNodeTraversal(final List<Node<View, Edge>> parents, final Node<View, Edge> node) { super.startNodeTraversal(parents, node); if (isDockedNode(node)) { return true; } nodes.add(node); return true; } }); } if (!keepChildren) { nodes.descendingIterator().forEachRemaining(node -> processNode(node, callback, false)); } processNode(candidate, callback, true); }

Target:
public void run(final Callback callback) { final Deque<Node<View, Edge>> nodes = createNodesDequeue(); processedConnectors.clear(); if (!keepChildren) { deleteChildren(callback, nodes); } processNode(candidate, callback, true); }
Source:
private Point calculateCenterLocation(IGraphicalEditPart host, CompoundCommand cc, IAdaptable iAdaptable, Point previousCenterLocation) { Rectangle rect = new Rectangle(); rect.setSize(LayoutHelper.UNDEFINED.getSize()); Point centerLocation; if (previousCenterLocation == null) { Point referencePoint = getLayoutHelper().getReferencePosition(host.getContentPane(), ((FigureCanvas) host.getViewer().getControl()).getViewport(), host); rect.setLocation(referencePoint); Point point = getLayoutHelper().validatePosition(host.getContentPane(), rect); PrecisionPoint result = new PrecisionPoint(point); GraphicalHelper.applyZoomOnPoint(host, result); SnapToHelper helper = host.getAdapter(SnapToHelper.class); if (helper != null) { PrecisionPoint preciseLocation = new PrecisionPoint(result); helper.snapPoint(new CreateRequest(), PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, preciseLocation, result); } GraphicalHelper.applyInverseZoomOnPoint(host, result); rect.setLocation(result); centerLocation = result.getCopy(); } else { int padding = SiriusLayoutDataManager.PADDING; if (GraphicalHelper.isSnapToGridEnabled(host)) { padding = GraphicalHelper.getGridSpacing(host); } centerLocation = new Point(previousCenterLocation).getTranslated(padding, padding); } IGraphicalEditPart part = (IGraphicalEditPart) host.getViewer().getEditPartRegistry().get(iAdaptable.getAdapter(View.class)); cc.add(new ICommandProxy(new SetBoundsCommand(host.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, part, centerLocation))); return centerLocation.getCopy(); }

Target:
private Point calculateCenterLocation(IGraphicalEditPart host, CompoundCommand cc, IAdaptable iAdaptable, Point previousCenterLocation) { Rectangle rect = new Rectangle(); rect.setSize(LayoutHelper.UNDEFINED.getSize()); Point centerLocation; if (previousCenterLocation == null) { Point referencePoint = getLayoutHelper().getReferencePosition(host.getContentPane(), ((FigureCanvas) host.getViewer().getControl()).getViewport(), host); rect.setLocation(referencePoint); Point point = getLayoutHelper().validatePosition(host.getContentPane(), rect); PrecisionPoint result = new PrecisionPoint(point); GraphicalHelper.logical2screen(result, host); SnapToHelper helper = host.getAdapter(SnapToHelper.class); if (helper != null) { PrecisionPoint preciseLocation = new PrecisionPoint(result); helper.snapPoint(new CreateRequest(), PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, preciseLocation, result); } GraphicalHelper.screen2logical(result, host); rect.setLocation(result); centerLocation = result.getCopy(); } else { int padding = SiriusLayoutDataManager.PADDING; if (GraphicalHelper.isSnapToGridEnabled(host)) { padding = GraphicalHelper.getGridSpacing(host); } centerLocation = new Point(previousCenterLocation).getTranslated(padding, padding); } IGraphicalEditPart part = (IGraphicalEditPart) host.getViewer().getEditPartRegistry().get(iAdaptable.getAdapter(View.class)); cc.add(new ICommandProxy(new SetBoundsCommand(host.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, part, centerLocation))); return centerLocation.getCopy(); }
Source:
private static Action getFindAction() { if (findAction == null) { findAction = new AbstractAction("findAction") { private static final long serialVersionUID = 8365172573382425660L; @Override public void actionPerformed(ActionEvent e) { Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); if (focusOwner instanceof JTextComponent) { FindDialog findDialog = new FindDialog(SwingUtilities.getWindowAncestor(focusOwner), false); findDialog.setLastInvoker((JTextComponent) focusOwner); } } }; } return findAction; }

Target:
private static Action getFindAction() { if (findAction == null) { findAction = new AbstractAction("findAction") { private static final long serialVersionUID = 8365172573382425660L; @Override public void actionPerformed(ActionEvent e) { Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); if (focusOwner instanceof JTextComponent) { FindDialog findDialog = FindDialog.getDialog(SwingUtilities.getWindowAncestor(focusOwner), false); findDialog.setLastInvoker((JTextComponent) focusOwner); } } }; } return findAction; }
Source:
public Builder withInstructions(Text instructions) { feedbackSessionAttributes.setInstructions(instructions); return this; }

Target:
public Builder withInstructions(Text instructions) { Text instructionsToSet = instructions == null ? new Text("") : instructions; feedbackSessionAttributes.setInstructions(instructionsToSet); return this; }
Source:
public void should_initialise_actual() { Iterator<String> names = asList("Luke", "Leia").iterator(); Iterable<String> actual = (Iterable<String>) assertThat(names).toIterable().actual; assertThat(actual).containsOnly("Leia", "Luke"); }

Target:
public void should_initialise_actual() { Iterator<String> names = asList("Luke", "Leia").iterator(); Iterator<String> actual = (Iterator<String>) assertThat(names).actual; assertThat(actual).hasNext(); }
Source:
KubernetesWatcher(@Named(BaragonKubernetesIntegrationModule.EVENT_LISTENERS) Map<KubernetesEvent, KubernetesEventListener> eventListeners) { this.client = new DefaultKubernetesClient(); this.executorService = Executors.newCachedThreadPool(); this.eventListeners = eventListeners; }

Target:
KubernetesWatcher(@Named(BaragonKubernetesIntegrationModule.EVENT_LISTENERS) Map<KubernetesEvent, KubernetesEventListener> eventListeners) { Config config = new ConfigBuilder() .withMasterUrl(TEST_CLUSTER_URL) .build(); this.client = new DefaultKubernetesClient(config); this.executorService = Executors.newCachedThreadPool(); this.eventListeners = eventListeners; }
Source:
protected void startScan() { for (RemoteDevice device : upnpService.getRegistry().getRemoteDevices()) { remoteDeviceAdded(upnpService.getRegistry(), device); } upnpService.getRegistry().addListener(this); upnpService.getControlPoint().search(); upnpService.getControlPoint().search(new RootDeviceHeader()); }

Target:
protected void startScan() { for (RemoteDevice device : upnpService.getRegistry().getRemoteDevices()) { remoteDeviceAdded(upnpService.getRegistry(), device); } upnpService.getRegistry().addListener(this); upnpService.getControlPoint().search(); }