auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Optional<RichColumnDescriptor> getDescriptor(List<PrimitiveColumnIO> columns, List<String> path, HiveColumnHandle hiveColumnHandle) { checkArgument(path.size() >= 1, "Parquet nested path should have at least one component"); int index = getPathIndex(columns, path); if (index == -1) { return empty(); } PrimitiveColumnIO columnIO = columns.get(index); HiveType hiveType = hiveColumnHandle == null ? null : hiveColumnHandle.getHiveType(); return Optional.of(new RichColumnDescriptor(columnIO.getColumnDescriptor(), columnIO.getType().asPrimitiveType(), hiveType)); }

Target:
public static Optional<RichColumnDescriptor> getDescriptor(List<PrimitiveColumnIO> columns, List<String> path, HiveColumnHandle hiveColumnHandle) { checkArgument(path.size() >= 1, "Parquet nested path should have at least one component"); int index = getPathIndex(columns, path); if (index == -1) { return empty(); } PrimitiveColumnIO columnIO = columns.get(index); HiveType hiveType = hiveColumnHandle == null ? null : hiveColumnHandle.getHiveType(); return Optional.of(new RichColumnDescriptor(columnIO.getColumnDescriptor(), columnIO.getType().asPrimitiveType(), Optional.ofNullable(hiveType))); }
Source:
public Response doImport(Action action) { validateParameters(action, "cluster.id|name"); Guid destStorageDomainId = getDestStorageDomainId(action); ImportVmParameters params = new ImportVmParameters(getEntity(), parent.getStorageDomainId(), destStorageDomainId, parent.getDataCenterId(destStorageDomainId), getClusterId(action)); params.setImageToDestinationDomainMap(getDiskToDestinationMap(action)); if (action.isSetVm() && action.getVm().isSetSnapshots() && action.getVm().getSnapshots().isSetCollapseSnapshots()) { params.setCopyCollapse(action.getVm().getSnapshots().isCollapseSnapshots()); } if (action.isSetImportAsNewEntity()) { params.setImportAsNewEntity(action.isImportAsNewEntity()); if(action.isSetVm() && action.getVm().isSetName()) { params.getVm().setvm_name(action.getVm().getName()); } } return doAction(VdcActionType.ImportVm, params, action); }

Target:
public Response doImport(Action action) { validateParameters(action, "cluster.id|name"); Guid destStorageDomainId = getDestStorageDomainId(action); ImportVmParameters params = new ImportVmParameters(getEntity(), parent.getStorageDomainId(), destStorageDomainId, parent.getDataCenterId(destStorageDomainId), getClusterId(action)); params.setImageToDestinationDomainMap(getDiskToDestinationMap(action)); if (action.isSetVm() && action.getVm().isSetSnapshots() && action.getVm().getSnapshots().isSetCollapseSnapshots()) { params.setCopyCollapse(action.getVm().getSnapshots().isCollapseSnapshots()); } if (action.isSetClone()) { params.setImportAsNewEntity(action.isClone()); if(action.isSetVm() && action.getVm().isSetName()) { params.getVm().setvm_name(action.getVm().getName()); } } return doAction(VdcActionType.ImportVm, params, action); }
Source:
private void processProbe() { verify(probe != null); PagesSpatialIndex pagesSpatialIndex = getDone(pagesSpatialIndexFuture); DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); while (probePosition < probe.getPositionCount()) { if (joinPositions == null) { joinPositions = pagesSpatialIndex.findJoinPositions(probePosition, probe, probeGeometryChannel); localUserMemoryContext.setBytes(sizeOf(joinPositions)); nextJoinPositionIndex = 0; matchFound = false; if (yieldSignal.isSet()) { return; } } while (nextJoinPositionIndex < joinPositions.length) { if (pageBuilder.isFull()) { return; } int joinPosition = joinPositions[nextJoinPositionIndex]; if (pagesSpatialIndex.isJoinPositionEligible(joinPosition, probePosition, probe)) { pageBuilder.declarePosition(); appendProbe(); pagesSpatialIndex.appendTo(joinPosition, pageBuilder, probeOutputChannels.size()); matchFound = true; } nextJoinPositionIndex++; if (yieldSignal.isSet()) { return; } } if (!matchFound && joinType == SpatialJoinNode.Type.LEFT) { if (pageBuilder.isFull()) { return; } pageBuilder.declarePosition(); appendProbe(); int buildColumnCount = pagesSpatialIndexFactory.getOutputTypes().size(); for (int i = 0; i < buildColumnCount; i++) { pageBuilder.getBlockBuilder(probeOutputChannels.size() + i).appendNull(); } } joinPositions = null; localUserMemoryContext.setBytes(0); probePosition++; } this.probe = null; this.probePosition = 0; }

Target:
private void processProbe() { verify(probe != null); PagesSpatialIndex pagesSpatialIndex = getDone(pagesSpatialIndexFuture); DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); while (probePosition < probe.getPositionCount()) { if (joinPositions == null) { joinPositions = pagesSpatialIndex.findJoinPositions(probePosition, probe, probeGeometryChannel); localUserMemoryContext.setBytes(sizeOf(joinPositions)); nextJoinPositionIndex = 0; matchFound = false; if (yieldSignal.isSet()) { return; } } while (nextJoinPositionIndex < joinPositions.length) { if (pageBuilder.isFull()) { return; } int joinPosition = joinPositions[nextJoinPositionIndex]; if (pagesSpatialIndex.isJoinPositionEligible(joinPosition, probePosition, probe)) { pageBuilder.declarePosition(); appendProbe(); pagesSpatialIndex.appendTo(joinPosition, pageBuilder, probeOutputChannels.size()); matchFound = true; } nextJoinPositionIndex++; if (yieldSignal.isSet()) { return; } } if (!matchFound && joinType == LEFT) { if (pageBuilder.isFull()) { return; } pageBuilder.declarePosition(); appendProbe(); int buildColumnCount = pagesSpatialIndexFactory.getOutputTypes().size(); for (int i = 0; i < buildColumnCount; i++) { pageBuilder.getBlockBuilder(probeOutputChannels.size() + i).appendNull(); } } joinPositions = null; localUserMemoryContext.setBytes(0); probePosition++; } this.probe = null; this.probePosition = 0; }
Source:
public static org.ovirt.engine.core.common.job.Step map(Step step, org.ovirt.engine.core.common.job.Step entity) { org.ovirt.engine.core.common.job.Step target = entity != null ? entity : new org.ovirt.engine.core.common.job.Step(); target.setId(new Guid(step.getId())); if (step.isSetParentStep()) { target.setParentStepId(GuidUtils.asGuid(step.getParentStep().getId())); } target.setJobId(GuidUtils.asGuid(step.getJob().getId())); if (step.isSetType()) { StepEnum type = StepEnum.fromValue(step.getType()); if (type != null) { target.setStepType(map(type)); } } if (step.isSetDescription()) { target.setDescription(step.getDescription()); } if (step.isSetNumber()) { target.setStepNumber(step.getNumber()); } if (step.isSetStatus()) { target.setStatus(JobMapper.map(step.getStatus(), null)); } target.setStartTime(step.isSetStartTime() ? step.getStartTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setEndTime(step.isSetEndTime() ? step.getEndTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setExternal(step.isSetExternal() ? step.isExternal() : true); return target; }

Target:
public static org.ovirt.engine.core.common.job.Step map(Step step, org.ovirt.engine.core.common.job.Step entity) { org.ovirt.engine.core.common.job.Step target = entity != null ? entity : new org.ovirt.engine.core.common.job.Step(); target.setId(GuidUtils.asGuid(step.getId())); if (step.isSetParentStep()) { target.setParentStepId(GuidUtils.asGuid(step.getParentStep().getId())); } target.setJobId(GuidUtils.asGuid(step.getJob().getId())); if (step.isSetType()) { StepEnum type = StepEnum.fromValue(step.getType()); if (type != null) { target.setStepType(map(type)); } } if (step.isSetDescription()) { target.setDescription(step.getDescription()); } if (step.isSetNumber()) { target.setStepNumber(step.getNumber()); } if (step.isSetStatus()) { target.setStatus(JobMapper.map(step.getStatus(), null)); } target.setStartTime(step.isSetStartTime() ? step.getStartTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setEndTime(step.isSetEndTime() ? step.getEndTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setExternal(step.isSetExternal() ? step.isExternal() : true); return target; }
Source:
public void run() { setThreadName(); receiver = initializeMessageReceiver(); try { consume(); } finally { logger.info("Stopped consumer for subscription {}", subscription.getId()); unsetThreadName(); stoppedLatch.countDown(); } }

Target:
public void run() { setThreadName(); logger.info("Starting batch consumer for subscription ", subscription.getId()); Timer.Context timer = new Timer().time(); receiver = initializeMessageReceiver(); logger.info("Started batch consumer for subscription in ms", subscription.getId(), TimeUnit.NANOSECONDS.toMillis(timer.stop())); try { consume(); } finally { logger.info("Stopped consumer for subscription {}", subscription.getId()); unsetThreadName(); stoppedLatch.countDown(); } }
Source:
public static CrateTestServer[] cluster(String clusterName, int numberOfNodes) { int transportPorts[] = new int[numberOfNodes]; int httpPorts[] = new int[numberOfNodes]; Set<Integer> usedPorts = new HashSet<>(2*numberOfNodes); for (int i = 0; i<numberOfNodes; i++) { int port = randomAvailablePort(); while (usedPorts.contains(port)) { port = randomAvailablePort(); } transportPorts[i] = port; usedPorts.add(port); while (usedPorts.contains(port)) { port = randomAvailablePort(); } httpPorts[i] = port; usedPorts.add(port); } String hostAddress = hostAddress().getHostAddress(); CrateTestServer[] servers = new CrateTestServer[numberOfNodes]; for (int i = 0; i< numberOfNodes; i++) { servers[i] = new CrateTestServer(clusterName, hostAddress, httpPorts[i], transportPorts[i], getUnicastHosts(hostAddress, transportPorts, i)); } return servers; }

Target:
public static CrateTestServer[] cluster(String clusterName, int numberOfNodes) { int transportPorts[] = new int[numberOfNodes]; int httpPorts[] = new int[numberOfNodes]; for (int i = 0; i<numberOfNodes; i++) { transportPorts[i] = randomAvailablePort(); httpPorts[i] = randomAvailablePort(); } String hostAddress = InetAddress.getLoopbackAddress().getHostAddress(); CrateTestServer[] servers = new CrateTestServer[numberOfNodes]; String[] unicastHosts = getUnicastHosts(hostAddress, transportPorts); for (int i = 0; i< numberOfNodes; i++) { servers[i] = new CrateTestServer(clusterName, hostAddress, httpPorts[i], transportPorts[i], unicastHosts); } return servers; }
Source:
private List<ApiKeyEntity> getAllEntities(final Boolean includeDeleted) { List<ApiKeyEntity> result = entityManager .createQuery("from ApiKeyEntity where (deleted = :includeDeleted) ", ApiKeyEntity.class) .setParameter("includeDeleted", includeDeleted) .getResultList(); return result; }

Target:
private List<ApiKeyEntity> getAllEntities(final Boolean includeDeleted) { List<ApiKeyEntity> result; if (includeDeleted) { result = entityManager .createQuery("from ApiKeyEntity ", ApiKeyEntity.class) .getResultList(); } else { result = entityManager .createQuery("from ApiKeyEntity where (deleted = false) ", ApiKeyEntity.class) .getResultList(); } return result; }
Source:
public void setUpEnvironment() throws CoreException, IOException { TEMPORARY_FOLDER.create(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot wsRoot = workspace.getRoot(); IProject project = wsRoot.getProject(SOME_PROJECT_NAME); project.create(PROGRESS_MONITOR); project.open(PROGRESS_MONITOR); fProject = project; IFolder folder = project.getFolder("Experiments"); if (!folder.exists()) { folder.create(true, true, PROGRESS_MONITOR); } folder = project.getFolder("Traces"); if (!folder.exists()) { folder.create(true, true, PROGRESS_MONITOR); } IPath filePath = ActivatorTest.getAbsoluteFilePath(TRACE_PATH); IResource resource = folder.getFile(TRACE_FILE); assertNotNull(resource); assertTrue(ResourceUtil.createSymbolicLink(resource, filePath, true, PROGRESS_MONITOR)); File newFolder = TEMPORARY_FOLDER.newFolder(TRACE_FILE); resource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, newFolder.getPath()); IFolder traceFolder = folder.getFolder(TRACE_FOLDER_PATH); if (!traceFolder.exists()) { traceFolder.create(true, true, PROGRESS_MONITOR); } IResource extraTraceResource = traceFolder.getFile(TRACE_FILE); assertNotNull(extraTraceResource); assertTrue(ResourceUtil.createSymbolicLink(extraTraceResource, filePath, true, PROGRESS_MONITOR)); extraTraceResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, newFolder.getPath()); }

Target:
public void setUpEnvironment() throws CoreException, IOException { TEMPORARY_FOLDER.create(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot wsRoot = workspace.getRoot(); IProject project = wsRoot.getProject(SOME_PROJECT_NAME); project.create(PROGRESS_MONITOR); project.open(PROGRESS_MONITOR); fProject = project; IFolder folder = project.getFolder("Experiments"); if (!folder.exists()) { folder.create(true, true, PROGRESS_MONITOR); } folder = project.getFolder("Traces"); if (!folder.exists()) { folder.create(true, true, PROGRESS_MONITOR); } IPath filePath = ActivatorTest.getAbsoluteFilePath(TRACE_PATH); IResource resource = folder.getFile(TRACE_FILE); assertNotNull(resource); assertTrue(ResourceUtil.createSymbolicLink(resource, filePath, true, PROGRESS_MONITOR)); File supplementaryFile = TEMPORARY_FOLDER.newFolder(TRACE_FILE); resource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplementaryFile.getPath()); IFolder traceFolder = folder.getFolder(TRACE_FOLDER_PATH); if (!traceFolder.exists()) { traceFolder.create(true, true, PROGRESS_MONITOR); } IResource extraTraceResource = traceFolder.getFile(TRACE_FILE); assertNotNull(extraTraceResource); assertTrue(ResourceUtil.createSymbolicLink(extraTraceResource, filePath, true, PROGRESS_MONITOR)); extraTraceResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplementaryFile.getPath()); }
Source:
private void parseGlobalSecurity(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder) throws XMLStreamException { GlobalSecurityConfigurationBuilder builder = holder.getGlobalConfigurationBuilder().security(); ParseUtils.requireNoAttributes(reader); while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { Element element = Element.forName(reader.getLocalName()); switch (element) { case AUTHORIZATION: { parseGlobalAuthorization(reader, holder); break; } default: { throw ParseUtils.unexpectedElement(reader); } } } }

Target:
private void parseGlobalSecurity(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder) throws XMLStreamException { ParseUtils.requireNoAttributes(reader); while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { Element element = Element.forName(reader.getLocalName()); switch (element) { case AUTHORIZATION: { parseGlobalAuthorization(reader, holder); break; } default: { throw ParseUtils.unexpectedElement(reader); } } } }
Source:
public List<PaymentWorksVendorUpdatesDTO> getPendingAchUpdatesFromPaymentWorks() { PaymentWorksVendorUpdatesRootDTO updateVendorsRoot = null; List<PaymentWorksVendorUpdatesDTO> vendorUpdates = new ArrayList<PaymentWorksVendorUpdatesDTO>(); boolean moreRecords = true; Client client = buildClient(); ClientResponse response = client.handle(buildClientRequest(buildPendingAchUpdatesFromPaymentWorksURL())); while (moreRecords) { updateVendorsRoot = response.getEntity(PaymentWorksVendorUpdatesRootDTO.class); LOG.debug("getPendingAddressVendorUpdatesFromPaymentWorks, Status: " + response.getStatus()); if (response.getStatus() == 200) { if (ObjectUtils.isNotNull(updateVendorsRoot)) { LOG.debug("getPendingAchUpdatesFromPaymentWorks, ACH Updates retrieved: " + updateVendorsRoot.getCount()); } if (updateVendorsRoot.getCount() > 0) { vendorUpdates.addAll(updateVendorsRoot.getVendorUpdates().getNewVendorList()); } if (StringUtils.isNotEmpty(updateVendorsRoot.getNext())) { response = client.handle(buildClientRequest(updateVendorsRoot.getNext())); } else { moreRecords = false; } } else { LOG.error("getPendingAchUpdatesFromPaymentWorks, Failed to retrieve Pending ACH Updates: " + response.getEntity(String.class)); moreRecords = false; } } return vendorUpdates; }

Target:
public List<PaymentWorksVendorUpdatesDTO> getPendingAchUpdatesFromPaymentWorks() { PaymentWorksVendorUpdatesRootDTO updateVendorsRoot = null; List<PaymentWorksVendorUpdatesDTO> vendorUpdates = new ArrayList<PaymentWorksVendorUpdatesDTO>(); processVendorUpdates(vendorUpdates, buildPendingAchUpdatesFromPaymentWorksURL()); return vendorUpdates; }
Source:
public KStream<K, V> repartition() { return repartition(RepartitionedInternal.empty()); }

Target:
public KStream<K, V> repartition() { return doRepartition(Repartitioned.as(null)); }
Source:
public CollectEnvCommand(FileSystemContext fsContext) { super(fsContext); mCommands = new HashMap<>(); mCommandsAlt = new HashMap<>(); registerCommands(); }

Target:
public CollectEnvCommand(FileSystemContext fsContext) { super(fsContext); registerCommands(); }
Source:
public static Properties loadProperties(Class<?> cls, String name) throws IOException { final String ERR_MSG = "Failed to locate resource file: " + name; InputStream is = cls.getClassLoader().getResourceAsStream(name); if (is == null) { log.error(ERR_MSG); throw new FileNotFoundException(ERR_MSG); } try { Properties props = new Properties(); props.load(is); return props; } finally { try { is.close(); } catch (Exception e) { String msg = (e.getMessage() != null) ? e.getMessage() : ""; log.error("Failed to close input stream: {}", msg); log.debug("Exception", e); } } }

Target:
public static Properties loadProperties(Class<?> cls, String name) throws IOException { final String ERR_MSG = "Failed to locate resource file: " + name; InputStream is = cls.getClassLoader().getResourceAsStream(name); if (is == null) { log.error(ERR_MSG); throw new FileNotFoundException(ERR_MSG); } try { Properties props = new Properties(); props.load(is); return props; } finally { try { is.close(); } catch (Exception e) { log.error("Failed to close input stream: {}", e.getMessage()); log.debug("Exception", e); } } }
Source:
public void testSanity() throws Exception { IncrementalIndex index = new OnheapIncrementalIndex( 0, QueryGranularity.MINUTE, new AggregatorFactory[]{new CountAggregatorFactory("cnt")} ); index.add( new MapBasedInputRow( new DateTime().minus(1).getMillis(), Lists.newArrayList("billy"), ImmutableMap.<String, Object>of("billy", "hi") ) ); index.add( new MapBasedInputRow( new DateTime().minus(1).getMillis(), Lists.newArrayList("sally"), ImmutableMap.<String, Object>of("sally", "bo") ) ); GroupByQueryEngine engine = makeGroupByQueryEngine(); final Sequence<Row> rows = engine.process( GroupByQuery.builder() .setDataSource("test") .setGranularity(QueryGranularity.ALL) .setInterval(new Interval(0, new DateTime().getMillis())) .addDimension("billy") .addDimension("sally") .addAggregator(new LongSumAggregatorFactory("cnt", "cnt")) .build(), new IncrementalIndexStorageAdapter(index) ); final ArrayList<Row> results = Sequences.toList(rows, Lists.<Row>newArrayList()); Assert.assertEquals(2, results.size()); MapBasedRow row = (MapBasedRow) results.get(0); Assert.assertEquals(ImmutableMap.of("billy", "hi", "cnt", 1l), row.getEvent()); row = (MapBasedRow) results.get(1); Assert.assertEquals(ImmutableMap.of("sally", "bo", "cnt", 1l), row.getEvent()); }

Target:
public void testSanity() throws Exception { IncrementalIndex index = indexCreator.createIndex(); index.add( new MapBasedInputRow( new DateTime().minus(1).getMillis(), Lists.newArrayList("billy"), ImmutableMap.<String, Object>of("billy", "hi") ) ); index.add( new MapBasedInputRow( new DateTime().minus(1).getMillis(), Lists.newArrayList("sally"), ImmutableMap.<String, Object>of("sally", "bo") ) ); GroupByQueryEngine engine = makeGroupByQueryEngine(); final Sequence<Row> rows = engine.process( GroupByQuery.builder() .setDataSource("test") .setGranularity(QueryGranularity.ALL) .setInterval(new Interval(0, new DateTime().getMillis())) .addDimension("billy") .addDimension("sally") .addAggregator(new LongSumAggregatorFactory("cnt", "cnt")) .build(), new IncrementalIndexStorageAdapter(index) ); final ArrayList<Row> results = Sequences.toList(rows, Lists.<Row>newArrayList()); Assert.assertEquals(2, results.size()); MapBasedRow row = (MapBasedRow) results.get(0); Assert.assertEquals(ImmutableMap.of("billy", "hi", "cnt", 1l), row.getEvent()); row = (MapBasedRow) results.get(1); Assert.assertEquals(ImmutableMap.of("sally", "bo", "cnt", 1l), row.getEvent()); }
Source:
public Enhancer(Class<?> hostClass, Map<Method, Method> bridgeDelegates) { super(hostClass, ENHANCER_BY_GUICE_MARKER); this.bridgeDelegates = bridgeDelegates; this.checkcastToProxy = ClassDefining.isAnonymousHost(hostClass) ? hostName : proxyName; }

Target:
Enhancer(Class<?> hostClass, Map<Method, Method> bridgeDelegates) { super(hostClass, ENHANCER_BY_GUICE_MARKER); this.bridgeDelegates = bridgeDelegates; this.checkcastToProxy = ClassDefining.isAnonymousHost(hostClass) ? hostName : proxyName; }
Source:
private WeldSEBeanDeploymentArchive mergeToOne(CDI11Bootstrap bootstrap, Collection<WeldSEBeanDeploymentArchive> discoveredArchives) { Set<String> beanClasses = new HashSet<String>(); Set<URL> urls = new HashSet<URL>(); for (BeanDeploymentArchive archive : discoveredArchives) { beanClasses.addAll(archive.getBeanClasses()); urls.add(archive.getBeansXml().getUrl()); } BeansXml beansXml = bootstrap.parse(urls); CompositeWeldSeBeanDeploymentArchive archive = new CompositeWeldSeBeanDeploymentArchive(getId(beansXml.getUrl().getPath()), beanClasses, beansXml); return archive; }

Target:
private WeldSEBeanDeploymentArchive mergeToOne(CDI11Bootstrap bootstrap, Collection<WeldSEBeanDeploymentArchive> discoveredArchives) { Set<String> beanClasses = new HashSet<String>(); Set<URL> urls = new HashSet<URL>(); for (BeanDeploymentArchive archive : discoveredArchives) { beanClasses.addAll(archive.getBeanClasses()); urls.add(archive.getBeansXml().getUrl()); } BeansXml beansXml = bootstrap.parse(urls, true); WeldSEBeanDeploymentArchive archive = new WeldSEBeanDeploymentArchive("main", beanClasses, beansXml); return archive; }
Source:
protected void renameTable(String catalogName, SchemaTableName oldTable, SchemaTableName newTable) { try (Connection connection = connectionFactory.openConnection()) { String sql = format( "ALTER TABLE %s RENAME TO %s", quoted(catalogName, oldTable.getSchemaName(), oldTable.getTableName()), quoted(newTable.getTableName())); execute(connection, sql); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }

Target:
protected void renameTable(String catalogName, SchemaTableName oldTable, SchemaTableName newTable) { try (Connection connection = connectionFactory.openConnection()) { String sql = format( "RENAME TABLE %s TO %s", quoted(catalogName, oldTable.getSchemaName(), oldTable.getTableName()), quoted(newTable.getTableName())); execute(connection, sql); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }
Source:
public AbstractDecimalSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, Optional<Type> outputType, LocalMemoryContext systemMemoryContext, int valuesPerPosition) { this.streamDescriptor = requireNonNull(streamDescriptor, "stream is null"); this.filter = filter.orElse(null); this.outputRequired = outputType.isPresent(); this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.nonDeterministicFilter = this.filter != null && !this.filter.isDeterministic(); this.nullsAllowed = this.filter == null || this.nonDeterministicFilter || this.filter.testNull(); this.scale = streamDescriptor.getOrcType().getScale().get(); this.nullBlock = outputType.map(type -> type.createBlockBuilder(null, 1).appendNull().build()).orElse(null); this.valuesPerPosition = valuesPerPosition; }

Target:
public AbstractDecimalSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, Optional<Type> outputType, LocalMemoryContext systemMemoryContext, int valuesPerPosition) { this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); this.filter = filter.orElse(null); this.outputRequired = outputType.isPresent(); this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.nonDeterministicFilter = this.filter != null && !this.filter.isDeterministic(); this.nullsAllowed = this.filter == null || this.nonDeterministicFilter || this.filter.testNull(); this.scale = streamDescriptor.getOrcType().getScale().get(); this.nullBlock = outputType.map(type -> type.createBlockBuilder(null, 1).appendNull().build()).orElse(null); this.valuesPerPosition = valuesPerPosition; }
Source:
private static List<Type> outputTypes(List<? extends Type> sourceTypes, List<Integer> outputChannels) { ImmutableList.Builder<Type> types = ImmutableList.builder(); for (int channel : outputChannels) { types.add(sourceTypes.get(channel)); } return types.build(); }

Target:
private static List<Type> outputTypes(List<? extends Type> sourceTypes, List<Integer> outputChannels) { return outputChannels.stream() .map(sourceTypes::get) .collect(toImmutableList()); }
Source:
private String aPayment() { JsonStringBuilder jsonStringBuilder = new JsonStringBuilder() .add("charge_id", "chargeId") .add("amount", 100) .add("language", "en") .add("reference", "ref 12") .add("state", new PaymentState("created", false, null, null, null)) .add("email", "test@example.com") .add("description", "description") .add("mandate_id", "amandateid") .add("provider_id", "aproviderid") .add("return_url", "<LINK_0>") .add("payment_provider", "sandbox") .add("card_brand", "VISA") .add("created_date", "2018-07-25T13:12:00"); return jsonStringBuilder.build(); }

Target:
private String aPayment() { JsonStringBuilder jsonStringBuilder = new JsonStringBuilder() .add("charge_id", "chargeId") .add("amount", 100) .add("language", "en") .add("reference", "ref 12") .add("state", new PaymentState("created", false, null, null)) .add("email", "test@example.com") .add("description", "description") .add("return_url", "<LINK_0>") .add("payment_provider", "sandbox") .add("card_brand", "VISA") .add("created_date", "2018-07-25T13:12:00"); return jsonStringBuilder.build(); }
Source:
Set<TaskId> closeLostTasks(final Collection<TopicPartition> lostPartitions) { final Set<TaskId> zombieTasks = partitionsToTaskSet(lostPartitions); log.debug("Closing lost tasks as zombies: {}", zombieTasks); active.closeZombieTasks(); assignedActiveTasks.clear(); changelogReader.clear(); if (!restoreConsumerAssignedStandbys) { restoreConsumer.unsubscribe(); } return zombieTasks; }

Target:
Set<TaskId> closeLostTasks(final Collection<TopicPartition> lostPartitions) { final Set<TaskId> zombieTasks = partitionsToTaskSet(lostPartitions); log.debug("Closing lost tasks as zombies: {}", zombieTasks); final List<TopicPartition> lostTaskChangelogs = new ArrayList<>(); final RuntimeException exception = active.closeZombieTasks(zombieTasks, lostTaskChangelogs); assignedActiveTasks.keySet().removeAll(zombieTasks); changelogReader.remove(lostTaskChangelogs); removeChangelogsFromRestoreConsumer(lostTaskChangelogs, false); if (exception != null) { throw exception; } else if (!assignedActiveTasks.isEmpty()) { throw new IllegalStateException("TaskManager had leftover tasks after removing all zombies"); } return zombieTasks; }
Source:
private boolean usernamesMatch(String url, String bodyUsername) { String usernamePattern = "(?:" + NpmLayoutProvider.NPM_USER_PATH + ")(.*)"; Pattern pattern = Pattern.compile(usernamePattern); Matcher urlUsernameMatcher = pattern.matcher(url); return urlUsernameMatcher.find() && urlUsernameMatcher.group(1).equals(bodyUsername); }

Target:
private boolean usernamesMatch(String url, String bodyUsername) { Matcher urlUsernameMatcher = NpmLayoutProvider.NPM_URL_USERNAME_PATTERN.matcher(url); return urlUsernameMatcher.find() && urlUsernameMatcher.group(1).equals(bodyUsername); }
Source:
public void begin( Bookmark initialBookmark ) { Map<String,Value> parameters = initialBookmark.asBeginTransactionParameters(); connection.run( "BEGIN", parameters, NoOpResponseHandler.INSTANCE ); connection.pullAll( NoOpResponseHandler.INSTANCE ); if ( !initialBookmark.isEmpty() ) { connection.sync(); } }

Target:
public void begin( Bookmark initialBookmark ) { Map<String,Value> parameters = initialBookmark.asBeginTransactionParameters(); connection.run( BEGIN_QUERY, parameters, NoOpResponseHandler.INSTANCE ); connection.pullAll( NoOpResponseHandler.INSTANCE ); if ( !initialBookmark.isEmpty() ) { connection.sync(); } }
Source:
private List<QuotaVdsGroup> getQuotaVdsGroups(int vCpu, int vCpuUsed, long mem, long memUsed) { ArrayList<QuotaVdsGroup> quotaVdsGroups = new ArrayList<QuotaVdsGroup>(); quotaVdsGroups.add(getQuotaVdsGroup(UNLIMITED_VCPU, 0, UNLIMITED_MEM, 0)); quotaVdsGroups.add(getQuotaVdsGroup(10, 2, 1000, 100)); quotaVdsGroups.get(0).setVdsGroupId(new Guid()); quotaVdsGroups.get(1).setVdsGroupId(new Guid()); quotaVdsGroups.add(getQuotaVdsGroup(vCpu, vCpuUsed, mem, memUsed)); return quotaVdsGroups; }

Target:
private List<QuotaVdsGroup> getQuotaVdsGroups(int vCpu, int vCpuUsed, long mem, long memUsed) { ArrayList<QuotaVdsGroup> quotaVdsGroups = new ArrayList<QuotaVdsGroup>(); quotaVdsGroups.add(getQuotaVdsGroup(UNLIMITED_VCPU, 0, UNLIMITED_MEM, 0)); quotaVdsGroups.add(getQuotaVdsGroup(10, 2, 1000, 100)); quotaVdsGroups.get(0).setVdsGroupId(Guid.NewGuid()); quotaVdsGroups.get(1).setVdsGroupId(Guid.NewGuid()); quotaVdsGroups.add(getQuotaVdsGroup(vCpu, vCpuUsed, mem, memUsed)); return quotaVdsGroups; }
Source:
public Account verify(String id, Credential credential) { if (!(credential instanceof PasswordCredential)) { return null; } PasswordCredential passwordCredential = (PasswordCredential) credential; KieServerInstanceAccount account = getAccount(id); String challenge = HashUtil.hash(id, new String(passwordCredential.getPassword())); if (account != null && challenge.equals(account.getHash())) { log.infof("Authentication succesfully for %1$2", id); return account; } log.infof("Authentication failed for %1$2", id); return null; }

Target:
public Account verify(String id, Credential credential) { if (!(credential instanceof PasswordCredential)) { return null; } PasswordCredential passwordCredential = (PasswordCredential) credential; KieServerInstanceAccount account = getAccount(id); String challenge = HashUtil.hash(id, new String(passwordCredential.getPassword())); if (account != null && challenge.equals(account.getHash())) { log.infof("Authentication succesfully for %1$s", id); return account; } log.infof("Authentication failed for %1$s", id); return null; }
Source:
private void addData(TreeSet<Data> data) { if (distributed) { data = filterIncomingDataForNode(data); } if (engineExtensions) { data = processDataExtensions(data); } synchronized (pendingData) { if (log.isDebugEnabled()) { log.debugf("Adding [%s] to pendingData [%s]", data, pendingData); } pendingData.addAll(data); } }

Target:
private void addData(TreeSet<Data> data) { if (distributed) { data = filterIncomingDataForNode(data); } if (engineExtensions) { data = processDataExtensions(data); } synchronized (pendingData) { log.debugf("Adding [%s] to pendingData [%s]", data, pendingData); pendingData.addAll(data); } }
Source:
public static String makeUrlAbsolute(HttpServletRequest request, String path, boolean useClientAddress) { if (path.indexOf("://") < 0) { String server = null; int port = -1; String protocol = null; if (useClientAddress) { URL clientRequest; try { clientRequest = new URL(request.getRequestURL().toString()); } catch (MalformedURLException e) { throw new RuntimeException("get request url was not a well formed url" + e); } server = clientRequest.getHost(); port = clientRequest.getPort() == -1 ? clientRequest.getDefaultPort() : clientRequest.getPort(); protocol = clientRequest.getProtocol(); } else { server = request.getServerName(); port = request.getServerPort(); protocol = request.getScheme(); } StringBuilder b = new StringBuilder(); b.append(protocol); b.append("://"); b.append(server); if (port != -1 && port != 80 && protocol.equals("http") ) { b.append(":"); b.append(port); } if (port != -1 && port != 443 && protocol.equals("https") ) { b.append(":"); b.append(port); } if (!path.startsWith("/")) { b.append("/"); } b.append(path); return b.toString(); } return path; }

Target:
public static String makeUrlAbsolute(HttpServletRequest request, String path, boolean useClientAddress) { if (path.indexOf("://") < 0) { String server = null; int port = -1; String protocol = null; if (useClientAddress) { URL clientRequest; try { clientRequest = new URL(request.getRequestURL().toString()); } catch (MalformedURLException e) { throw new RuntimeException("The request URL is not valid", e); } server = clientRequest.getHost(); port = clientRequest.getPort() == -1 ? clientRequest.getDefaultPort() : clientRequest.getPort(); protocol = clientRequest.getProtocol(); } else { server = request.getServerName(); port = request.getServerPort(); protocol = request.getScheme(); } StringBuilder b = new StringBuilder(); b.append(protocol); b.append("://"); b.append(server); if (port != -1 && port != 80 && protocol.equals("http") ) { b.append(":"); b.append(port); } if (port != -1 && port != 443 && protocol.equals("https") ) { b.append(":"); b.append(port); } if (!path.startsWith("/")) { b.append("/"); } b.append(path); return b.toString(); } return path; }
Source:
public Flux<NumericResponse<ZRemRangeByRankCommand, Long>> zRemRangeByRank( Publisher<ZRemRangeByRankCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRange(), "Range must not be null!"); return cmd .zremrangebyrank(command.getKey(), command.getRange().getLowerBound().getValue().orElse(Long.MIN_VALUE), command.getRange().getUpperBound().getValue().orElse(Long.MAX_VALUE)) .map(value -> new NumericResponse<>(command, value)); })); }

Target:
public Flux<NumericResponse<ZRemRangeByRankCommand, Long>> zRemRangeByRank( Publisher<ZRemRangeByRankCommand> commands) { return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRange(), "Range must not be null!"); return cmd .zremrangebyrank(command.getKey(), command.getRange().getLowerBound().getValue().orElse(0L), command.getRange().getUpperBound().getValue().orElse(Long.MAX_VALUE)) .map(value -> new NumericResponse<>(command, value)); })); }
Source:
public boolean readFromBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final File file = new File(barFolder, ACTOR_MAPPING_FILE); if (file.exists()) { final byte[] content = IOUtil.getContent(file); try { businessArchive.setActorMapping(new ActorMappingConverter().deserializeFromXML(content)); } catch (JAXBException | org.xml.sax.SAXException e) { return false; } } return true; }

Target:
public boolean readFromBarFolder(final BusinessArchive businessArchive, final File barFolder) throws IOException { final File file = new File(barFolder, ACTOR_MAPPING_FILE); if (file.exists()) { final byte[] content = IOUtil.getContent(file); try { businessArchive.setActorMapping(new ActorMappingMarshaller().deserializeFromXML(content)); } catch (XmlMarshallException e) { return false; } return true; } return false; }
Source:
private static DatasetAPIClient getInstance() throws ZebedeeException { if (INSTANCE == null) { synchronized (DatasetAPIClientSupplier.class) { if (INSTANCE == null) { info().log("creating new instance of datasetAPIClient"); try { ReaderConfiguration cgf = ReaderConfiguration.get(); INSTANCE = new DatasetAPIClient(cgf.getDatasetAPIHost(), cgf.getDatasetAPIAuthToken(), cgf.getServiceAuthToken()); } catch (Exception e) { ZebedeeException ex = new InternalServerError("error initalising dataset api client", e); throw error().logException(ex, "error instantiating datasetAPIClient instabce"); } } } } return INSTANCE; }

Target:
private static DatasetAPIClient getInstance() throws ZebedeeException { if (INSTANCE == null) { synchronized (DatasetAPIClientSupplier.class) { if (INSTANCE == null) { info().log("creating new instance of datasetAPIClient"); try { ReaderConfiguration cfg = ReaderConfiguration.get(); INSTANCE = new DatasetAPIClient(cfg.getDatasetAPIHost(), cfg.getDatasetAPIAuthToken(), cfg.getServiceAuthToken()); } catch (Exception e) { ZebedeeException ex = new InternalServerError("error initalising dataset api client", e); throw error().logException(ex, "error instantiating datasetAPIClient instabce"); } } } } return INSTANCE; }
Source:
public void logChange(final String storeName, final Bytes key, final byte[] value, final long timestamp) { throwUnsupportedOperationExceptionIfStandby("logChange"); streamTask.recordCollector().send( storeToChangelogTopic.get(storeName), key, value, null, taskId().partition, timestamp, BYTES_KEY_SERIALIZER, BYTEARRAY_VALUE_SERIALIZER); }

Target:
public void logChange(final String storeName, final Bytes key, final byte[] value, final long timestamp) { throwUnsupportedOperationExceptionIfStandby("logChange"); collector.send( storeToChangelogTopic.get(storeName), key, value, null, taskId().partition, timestamp, BYTES_KEY_SERIALIZER, BYTEARRAY_VALUE_SERIALIZER); }
Source:
public void detectUnusedBinding(Collection<Binding<?>> bindings) { ArrayList<Binding> unusedBindings = new ArrayList<Binding>(); for (Binding<?> binding : bindings) { if (binding.necessary() && !binding.dependedOn()) { unusedBindings.add(binding); } } if (unusedBindings.size() > 0) { StringBuilder builder = new StringBuilder(); builder.append("You have these unused @Provider methods! "); builder.append("Set library=true in your module to disable this check.\n"); for (Binding<?> binding : unusedBindings) { builder.append(binding).append("\n"); } throw new IllegalStateException(builder.toString()); } }

Target:
public void detectUnusedBinding(Collection<Binding<?>> bindings) { ArrayList<Binding> unusedBindings = new ArrayList<Binding>(); for (Binding<?> binding : bindings) { if (!binding.library() && !binding.dependedOn()) { unusedBindings.add(binding); } } if (unusedBindings.size() > 0) { StringBuilder builder = new StringBuilder(); builder.append("You have these unused @Provider methods! "); builder.append("Set library=true in your module to disable this check.\n"); for (Binding<?> binding : unusedBindings) { AbstractProviderMethodBinding<?> providerBinding = (AbstractProviderMethodBinding<?>) binding; builder.append(providerBinding.getModuleName()) .append(".") .append(providerBinding.getMethodName()) .append("()\n"); } throw new IllegalStateException(builder.toString()); } }
Source:
public void headerBinding() { HeadersExchange headersExchange = new HeadersExchange("h"); String headerKey = "headerKey"; BindingBuilder.HeadersExchangeMapConfigurer toConfigurer = BindingBuilder. bind(queue).to(headersExchange); Binding binding = toConfigurer.where(headerKey).exists(); assertNotNull(binding); assertEquals(headersExchange.getName(), binding.getExchange()); assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType()); assertEquals(queue.getName(), binding.getDestination()); assertEquals("", binding.getRoutingKey()); }

Target:
public void headerBinding() { HeadersExchange headersExchange = new HeadersExchange("h"); String headerKey = "headerKey"; Binding binding = BindingBuilder.bind(queue).to(headersExchange).where(headerKey).exists(); assertNotNull(binding); assertEquals(headersExchange.getName(), binding.getExchange()); assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType()); assertEquals(queue.getName(), binding.getDestination()); assertEquals("", binding.getRoutingKey()); }
Source:
void testValidSheets() throws IOException { DataImporter dimp = new RawDataSpreadsheetImporter(); File file1 = createValidTestSpreadsheet("/tmp/valid1.xlsx"); Map<Integer,String> errors = dimp.validate(file1); for (Integer i: errors.keySet()) { System.out.printf("Unexpected error, row %d: %s", i, errors.get(i)); } assertEquals(0, errors.size()); }

Target:
public void testValidSheets() throws IOException { DataImporter dimp = new RawDataSpreadsheetImporter(); File file1 = createValidTestSpreadsheet("/tmp/valid1.xlsx"); Map<Integer,String> errors = dimp.validate(file1); assertEquals(0, errors.size()); }
Source:
private RcsFeatureManager getRcsFeatureManager(int subId) { Phone phone = PhoneGlobals.getPhone(subId); if (phone == null) { throw new ServiceSpecificException(ImsException.CODE_ERROR_INVALID_SUBSCRIPTION, "Invalid subscription Id: " + subId); } ImsPhone imsPhone = (ImsPhone) phone.getImsPhone(); if (imsPhone == null) { throw new ServiceSpecificException(ImsException.CODE_ERROR_UNSUPPORTED_OPERATION, "Cannot find ImsPhone instance: " + subId); } RcsFeatureManager rcsFeatureManager = imsPhone.getRcsManager(); if (rcsFeatureManager == null) { throw new ServiceSpecificException(ImsException.CODE_ERROR_UNSUPPORTED_OPERATION, "Cannot find RcsFeatureManager instance: " + subId); } return rcsFeatureManager; }

Target:
private RcsFeatureManager getRcsFeatureManager(int subId) { Phone phone = PhoneGlobals.getPhone(subId); if (phone == null) { throw new ServiceSpecificException(ImsException.CODE_ERROR_INVALID_SUBSCRIPTION, "Invalid subscription Id: " + subId); } ImsPhone imsPhone = (ImsPhone) phone.getImsPhone(); if (imsPhone == null) { throw new ServiceSpecificException(ImsException.CODE_ERROR_UNSUPPORTED_OPERATION, "Cannot find ImsPhone instance: " + subId); } RcsFeatureManager rcsFeatureManager = imsPhone.getRcsManager(); if (rcsFeatureManager == null) { throw new ServiceSpecificException(ImsException.CODE_ERROR_SERVICE_UNAVAILABLE, "Cannot find RcsFeatureManager instance: " + subId); } return rcsFeatureManager; }
Source:
private CloudNetwork convertToCloudNetwork(Network network) { Set<CloudSubnet> subnets = new HashSet<>(); for (Entry<String, Subnet> subnet : network.subnets().entrySet()) { CloudSubnet cloudSubnet = new CloudSubnet(subnet.getKey(), subnet.getKey(), null, subnet.getValue().addressPrefix()); azureCloudSubnetParametersService.addPrivateEndpointNetworkPolicies(cloudSubnet, subnet.getValue().inner().privateEndpointNetworkPolicies()); subnets.add(cloudSubnet); } Map<String, Object> properties = new HashMap<>(); properties.put("addressSpaces", network.addressSpaces()); properties.put("dnsServerIPs", network.dnsServerIPs()); properties.put("resourceGroupName", network.resourceGroupName()); return new CloudNetwork(network.name(), network.id(), subnets, properties); }

Target:
private CloudNetwork convertToCloudNetwork(Network network) { Set<CloudSubnet> subnets = new HashSet<>(); for (Entry<String, Subnet> subnet : network.subnets().entrySet()) { CloudSubnet cloudSubnet = new CloudSubnet(subnet.getKey(), subnet.getKey(), null, subnet.getValue().addressPrefix()); azureCloudSubnetParametersService.addPrivateEndpointNetworkPolicies(cloudSubnet, subnet.getValue().inner().privateEndpointNetworkPolicies()); subnets.add(cloudSubnet); LOGGER.debug("Mapping azure subnet '{}' to cloudSubnet: {}", subnet.getKey(), cloudSubnet); } Map<String, Object> properties = new HashMap<>(); properties.put("addressSpaces", network.addressSpaces()); properties.put("dnsServerIPs", network.dnsServerIPs()); properties.put("resourceGroupName", network.resourceGroupName()); return new CloudNetwork(network.name(), network.id(), subnets, properties); }
Source:
public Response add(ClusterFeature feature) { validateParameters(feature); org.ovirt.engine.core.common.businessentities.AdditionalFeature featureEntity = ClusterFeaturesMapper.map(feature, null); org.ovirt.engine.core.common.businessentities.Cluster cluster = BackendClusterFeatureHelper.getClusterEntity(this, asGuid(clusterId)); SupportedAdditionalClusterFeature supportedFeature = new SupportedAdditionalClusterFeature(); supportedFeature.setFeature(featureEntity); supportedFeature.setEnabled(true); supportedFeature.setClusterId(asGuid(clusterId)); cluster.getAddtionalFeaturesSupported().add(supportedFeature); return BackendClusterFeatureHelper.updateClusterEntity(this, cluster); }

Target:
public Response add(ClusterFeature feature) { validateParameters(feature); org.ovirt.engine.core.common.businessentities.AdditionalFeature featureEntity = map(feature, null); org.ovirt.engine.core.common.businessentities.Cluster cluster = BackendClusterFeatureHelper.getClusterEntity(this, asGuid(clusterId)); SupportedAdditionalClusterFeature supportedFeature = new SupportedAdditionalClusterFeature(); supportedFeature.setFeature(featureEntity); supportedFeature.setEnabled(true); supportedFeature.setClusterId(asGuid(clusterId)); cluster.getAddtionalFeaturesSupported().add(supportedFeature); ManagementNetworkOnClusterOperationParameters param = new ManagementNetworkOnClusterOperationParameters(cluster); return performAction(ActionType.UpdateCluster, param); }
Source:
List<File> findStoredFiles() { lock.lock(); try { List<File> files = new ArrayList<>(); if (storeDirectory != null) { File dir = new File(storeDirectory); if (dir.exists() && dir.isDirectory()) { File[] values = dir.listFiles(); if (values != null) { files.addAll(Arrays.asList(values)); } } } queuedFiles.addAll(files); return files; } finally { lock.unlock(); } }

Target:
List<File> findStoredFiles() { lock.lock(); try { List<File> files = new ArrayList<>(); if (storeDirectory != null) { File dir = new File(storeDirectory); if (dir.exists() && dir.isDirectory()) { File[] values = dir.listFiles(); if (values != null) { for (File value : values) { if (value.isFile() && !queuedFiles.contains(value)) { files.add(value); } } } } } queuedFiles.addAll(files); return files; } finally { lock.unlock(); } }
Source:
public void run() { if (tokenVerifier != null) { if (mcb.isClosed()) { for (final AccessTokenConfiguration tokenConfig : configuration.getAccessTokenConfigurations()) { try { final AccessToken accessToken = accessTokens.get(tokenConfig.getTokenId()); if (accessToken != null && olderThanMinute(accessToken)) { String token = accessToken.getToken(); if (!tokenVerifier.isTokenValid(token)) { invalidTokenIds.add(accessToken); LOG.warn("Invalid Token scheduled for refresh : " + tokenConfig.getTokenId()); } else { LOG.debug("Token for " + tokenConfig.getTokenId() + " still valid."); } mcb.onSuccess(); } } catch (final Throwable t) { LOG.warn("Unexpected problem during token verify run! TokenId : {}", tokenConfig.getTokenId(), t); mcb.onError(); } } } else { LOG.debug("{} is open, skip check.", mcb.getName()); } } else { LOG.debug("No TokenVerifier configured, skip check."); } }

Target:
public void run() { if (tokenVerifier != null) { if (mcb.isClosed()) { for (final AccessTokenConfiguration tokenConfig : configuration.getAccessTokenConfigurations()) { try { final AccessToken accessToken = accessTokens.get(tokenConfig.getTokenId()); if (accessToken != null && olderThanMinute(accessToken)) { String token = accessToken.getToken(); if (!tokenVerifier.isTokenValid(token)) { invalidTokenIds.add(accessToken); LOG.warn("Invalid Token scheduled for refresh : " + tokenConfig.getTokenId()); } else { LOG.debug("Token for " + tokenConfig.getTokenId() + " still valid."); } mcb.onSuccess(); } } catch (final Throwable t) { LOG.warn("Unexpected problem during token verify run! TokenId : {}", tokenConfig.getTokenId(), t); mcb.onError(); } } } else { LOG.debug("{} is open, skipping check.", mcb.getName()); } } else { LOG.debug("No TokenVerifier configured, skipping check."); } }
Source:
public DefaultMultilineCommentAutoEditStrategy(ICProject project) { if (project == null) { Map<String, ?> options = CCorePlugin.getOptions(); Map<String, String> formatterPrefs = new HashMap<>(options.size()); for (String key : options.keySet()) { Object value = options.get(key); if (value instanceof String) { formatterPrefs.put(key, (String) value); } } DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(formatterPrefs); fFormatBlocks = preferences.format_block_comment; } else { Map<String, String> options = project.getOptions(true); DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options); fFormatBlocks = preferences.format_block_comment; } }

Target:
public DefaultMultilineCommentAutoEditStrategy(ICProject project) { fProject = project; }