auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void serialize(PrecisionRecallState state, BlockBuilder out) { int requiredBytes = SizeOf.SIZE_OF_INT + SizeOf.SIZE_OF_INT; if (state.getTrueWeights() != null) { requiredBytes += state.getTrueWeights().getRequiredBytesForSerialization(); requiredBytes += state.getFalseWeights().getRequiredBytesForSerialization(); } SliceOutput sliceOut = Slices.allocate(requiredBytes).getOutput(); sliceOut.appendInt(state.getNull() ? 1 : 0); sliceOut.appendInt(state.getTrueWeights() == null ? 0 : 1); if (state.getTrueWeights() != null) { state.getTrueWeights().serialize(sliceOut); state.getFalseWeights().serialize(sliceOut); } VARBINARY.writeSlice(out, sliceOut.getUnderlyingSlice()); }

Target:
public void serialize(PrecisionRecallState state, BlockBuilder out) { int requiredBytes = SizeOf.SIZE_OF_BYTE; if (state.getTrueWeights() != null) { requiredBytes += state.getTrueWeights().getRequiredBytesForSerialization(); requiredBytes += state.getFalseWeights().getRequiredBytesForSerialization(); } SliceOutput sliceOut = Slices.allocate(requiredBytes).getOutput(); sliceOut.appendByte(state.getTrueWeights() == null ? 0 : 1); if (state.getTrueWeights() != null) { state.getTrueWeights().serialize(sliceOut); state.getFalseWeights().serialize(sliceOut); } VARBINARY.writeSlice(out, sliceOut.getUnderlyingSlice()); }
Source:
private void runReadRequest(XdkRequestInfo requestInfo) { ChannelRecord record = requestInfo.channelRecord; try { Xdk xdk = getXdk(requestInfo.xdkAddress); if (xdk.isConnected()) { Object readResult = getReadResult(requestInfo.sensorName, xdk); final Optional<TypedValue<?>> typedValue = getTypedValue(requestInfo.dataType, readResult); if (!typedValue.isPresent()) { record.setChannelStatus(new ChannelStatus(FAILURE, "Error while converting the retrieved value to the defined typed", null)); record.setTimestamp(System.currentTimeMillis()); return; } record.setValue(typedValue.get()); record.setChannelStatus(new ChannelStatus(SUCCESS)); record.setTimestamp(System.currentTimeMillis()); } else { record.setChannelStatus(new ChannelStatus(FAILURE, "Unable to Connect...", null)); record.setTimestamp(System.currentTimeMillis()); return; } } catch (KuraBluetoothIOException | ConnectionException e) { record.setChannelStatus(new ChannelStatus(ChannelFlag.FAILURE, "Xdk Read Operation Failed", null)); record.setTimestamp(System.currentTimeMillis()); logger.warn(e.getMessage()); return; } }

Target:
private void runReadRequest(XdkRequestInfo requestInfo) { ChannelRecord record = requestInfo.channelRecord; try { Xdk xdk = getXdk(requestInfo.xdkAddress); if (xdk.isConnected()) { Object readResult = getReadResult(requestInfo.sensorName, xdk); final Optional<TypedValue<?>> typedValue = getTypedValue(requestInfo.dataType, readResult); if (!typedValue.isPresent()) { record.setChannelStatus(new ChannelStatus(FAILURE, "Error while converting the retrieved value to the defined typed", null)); record.setTimestamp(System.currentTimeMillis()); return; } record.setValue(typedValue.get()); record.setChannelStatus(new ChannelStatus(SUCCESS)); record.setTimestamp(System.currentTimeMillis()); } else { record.setChannelStatus(new ChannelStatus(FAILURE, "Unable to Connect...", null)); record.setTimestamp(System.currentTimeMillis()); } } catch (KuraBluetoothIOException | ConnectionException e) { record.setChannelStatus(new ChannelStatus(ChannelFlag.FAILURE, "Xdk Read Operation Failed", null)); record.setTimestamp(System.currentTimeMillis()); logger.warn(e.getMessage()); } }
Source:
public void testVertexCentricQuery() { int noVertices = 10000; }

Target:
public void testVertexCentricQuery() { testVertexCentricQuery(10000 ); }
Source:
public Map list() { final Host host = getActiveHost(); Map resultMap = getDoneStatus(); List statusList = new ArrayList(); for (VM vm : host.getRunningVMs().values()) { Map vmMap = map(); vmMap.put("status", vm.getStatus().toString()); vmMap.put("vmId", vm.getId()); statusList.add(vmMap); } resultMap.put("vmList", statusList); return resultMap; }

Target:
public Map list() { final Host host = getActiveHost(); final Map resultMap = getDoneStatus(); final List statusList = new ArrayList(); for (VM vm : host.getRunningVMs().values()) { Map vmMap = map(); vmMap.put("status", vm.getStatus().toString()); vmMap.put("vmId", vm.getId()); statusList.add(vmMap); } resultMap.put("vmList", statusList); return resultMap; }
Source:
protected InternalCacheEntry<WrappedBytes, WrappedBytes> performRemove(long bucketHeadAddress, Object key) { WrappedByteArray wba = toWrapper(key); long prevAddress = 0; while (bucketHeadAddress != 0) { long nextAddress = offHeapEntryFactory.getNext(bucketHeadAddress); InternalCacheEntry<WrappedBytes, WrappedBytes> ice = offHeapEntryFactory.fromMemory(bucketHeadAddress); if (ice.getKey().equals(wba)) { entryRemoved(bucketHeadAddress); if (prevAddress != 0) { offHeapEntryFactory.setNext(prevAddress, nextAddress); } else { memoryLookup.putMemoryAddress(key, nextAddress); } size.decrementAndGet(); return ice; } prevAddress = bucketHeadAddress; bucketHeadAddress = nextAddress; } return null; }

Target:
protected InternalCacheEntry<WrappedBytes, WrappedBytes> performRemove(long bucketHeadAddress, Object key) { WrappedByteArray wba = toWrapper(key); long prevAddress = 0; long address = bucketHeadAddress; while (address != 0) { long nextAddress = offHeapEntryFactory.getNext(address); InternalCacheEntry<WrappedBytes, WrappedBytes> ice = offHeapEntryFactory.fromMemory(address); if (ice.getKey().equals(wba)) { entryRemoved(address); if (prevAddress != 0) { offHeapEntryFactory.setNext(prevAddress, nextAddress); } else { memoryLookup.putMemoryAddress(key, nextAddress); } size.decrementAndGet(); return ice; } prevAddress = address; address = nextAddress; } return null; }
Source:
private void logTasks() { final StringBuilder stringBuilder = new StringBuilder(1024).append("\n\n"); for (Task task : tasks.build()) { stringBuilder.append(String.format(" %-7s /tasks/%s (%s)\n", "POST", task.getName(), task.getClass().getCanonicalName())); } LOG.info(stringBuilder.toString()); }

Target:
private void logTasks() { final StringBuilder stringBuilder = new StringBuilder(1024).append("\n\n"); for (Task task : tasks.build()) { stringBuilder.append(String.format(" %-7s /tasks/%s (%s)\n", "POST", task.getName(), task.getClass().getCanonicalName())); } LOG.info("tasks = {}", stringBuilder.toString()); }
Source:
private Mono<Void> appendBlock(Flux<ByteBuffer> blockData, long offset, long writeLength) { this.appendPositionAccessConditions.setAppendPosition(offset); return client.appendBlockWithResponse(blockData, writeLength, appendBlobAccessConditions) .then() .onErrorResume(t -> t instanceof IOException || t instanceof BlobStorageException, e -> { this.lastError = new IOException(e); return null; }); }

Target:
private Mono<Void> appendBlock(Flux<ByteBuffer> blockData, long offset, long writeLength) { this.appendPositionAccessConditions.setAppendPosition(offset); return client.appendBlockWithResponse(blockData, writeLength, appendBlobAccessConditions) .then() .onErrorResume(t -> t instanceof IOException || t instanceof BlobStorageException, e -> { this.lastError = new IOException(e); return Mono.empty(); }); }
Source:
private MappedClass addMappedClass(final MappedClass mc, final boolean validate) { addConverters(mc); if (validate && !mc.isInterface()) { mc.validate(this); } mappedClasses.put(mc.getClazz().getName(), mc); Set<MappedClass> mcs = mappedClassesByCollection.get(mc.getCollectionName()); if (mcs == null) { mcs = new CopyOnWriteArraySet<MappedClass>(); final Set<MappedClass> temp = mappedClassesByCollection.putIfAbsent(mc.getCollectionName(), mcs); if (temp != null) { mcs = temp; } } mcs.add(mc); return mc; }

Target:
private MappedClass addMappedClass(final MappedClass mc, final boolean validate) { addConverters(mc); if (validate) { mc.validate(this); } mappedClasses.put(mc.getClazz().getName(), mc); Set<MappedClass> mcs = mappedClassesByCollection.get(mc.getCollectionName()); if (mcs == null) { mcs = new CopyOnWriteArraySet<MappedClass>(); final Set<MappedClass> temp = mappedClassesByCollection.putIfAbsent(mc.getCollectionName(), mcs); if (temp != null) { mcs = temp; } } mcs.add(mc); return mc; }
Source:
public void canFilterOutUninterestingMetrics() { MetricsManager differentManager = MetricsManagers.createAlwaysSafeAndFilteringForTests(); SweepOutcomeMetrics.registerTargeted( metricsManager, ImmutableMap.of("strategy", "thorough"), () -> false); TargetedSweepMetrics targetedMetrics = TargetedSweepMetrics .create(differentManager, mock(TimelockService.class), new InMemoryKeyValueService(true), TargetedSweepMetrics.MetricsConfiguration.builder() .millisBetweenRecomputingMetrics(Long.MAX_VALUE) .build()); SweepOutcomeMetrics.TARGETED_OUTCOMES.forEach(outcome -> { targetedMetrics.registerOccurrenceOf(ShardAndStrategy.thorough(1), outcome); assertThat(metricsManager).hasNotRegisteredTargetedOutcome(THOROUGH, outcome); }); }

Target:
public void canFilterOutUninterestingMetrics() { SweepOutcomeMetrics.registerTargeted( metricsManager, ImmutableMap.of("strategy", "thorough"), () -> false); TargetedSweepMetrics targetedMetrics = TargetedSweepMetrics .create(metricsManager, mock(TimelockService.class), new InMemoryKeyValueService(true), TargetedSweepMetrics.MetricsConfiguration.builder() .millisBetweenRecomputingMetrics(Long.MAX_VALUE) .build()); SweepOutcomeMetrics.TARGETED_OUTCOMES.forEach(outcome -> { targetedMetrics.registerOccurrenceOf(ShardAndStrategy.thorough(1), outcome); }); org.assertj.core.api.Assertions.assertThat(metricsManager.getPublishableMetrics().getMetrics()).isEmpty(); }
Source:
public void showLoanRepaymentTransactions(List<LoanRepaymentRequest> loanRepaymentRequests) { mLoanRepaymentRequests = loanRepaymentRequests; if (loanRepaymentRequests.size() == 0) { ll_error.setVisibility(View.VISIBLE); mNoPayloadText.setText("There is No LoanRepayment to Sync"); mNoPayloadIcon.setImageResource(R.drawable.ic_assignment_turned_in_black_24dp); } else { mSyncLoanRepaymentAdapter.setLoanRepaymentRequests(loanRepaymentRequests); } }

Target:
public void showLoanRepaymentTransactions(List<LoanRepaymentRequest> loanRepaymentRequests) { mLoanRepaymentRequests = loanRepaymentRequests; if (loanRepaymentRequests.size() == 0) { ll_error.setVisibility(View.VISIBLE); mNoPayloadText.setText(getActivity() .getResources().getString(R.string.no_repayment_to_sync)); mNoPayloadIcon.setImageResource(R.drawable.ic_assignment_turned_in_black_24dp); } else { mSyncLoanRepaymentAdapter.setLoanRepaymentRequests(loanRepaymentRequests); } }
Source:
public static ProjectConfigDto toProjectConfig(Project project, UriBuilder serviceUriBuilder) throws ForbiddenException, ServerException, ProjectTypeConstraintException, ValueStorageException { String name = project.getName(); String path = project.getPath(); ProjectConfigDto projectConfigDto = DtoFactory.getInstance().createDto(ProjectConfigDto.class); projectConfigDto.withName(name).withPath(path); try { ProjectConfig config = project.getConfig(); projectConfigDto.withDescription(config.getDescription()); projectConfigDto.withMixins(config.getMixins()); projectConfigDto.withAttributes(config.getAttributes()); List<ProjectConfigDto> modules = config.getModules() .stream() .map(DtoConverter::toProjectConfigDto) .collect(Collectors.toList()); projectConfigDto.withModules(modules); projectConfigDto.withContentRoot(config.getContentRoot()); projectConfigDto.withType(config.getType()); projectConfigDto.withSource(toSourceDto(config.getSource())); projectConfigDto.setContentRoot(project.getContentRoot()); } catch (ServerException | ValueStorageException | ProjectTypeConstraintException exception) { projectConfigDto.withType(BaseProjectType.ID).withType("blank"); ProjectProblem projectProblem = DtoFactory.getInstance() .createDto(ProjectProblem.class) .withCode(1) .withMessage(exception.getMessage()); projectConfigDto.getProblems().add(projectProblem); } if (serviceUriBuilder != null) { projectConfigDto.withLinks(generateProjectLinks(project, serviceUriBuilder)); } return projectConfigDto; }

Target:
public static ProjectConfigDto toProjectConfig(Project project, UriBuilder serviceUriBuilder) throws ForbiddenException, ServerException, ProjectTypeConstraintException, ValueStorageException { String name = project.getName(); String path = project.getPath(); ProjectConfigDto projectConfigDto = newDto(ProjectConfigDto.class); projectConfigDto.withName(name).withPath(path); try { ProjectConfig config = project.getConfig(); projectConfigDto.withDescription(config.getDescription()); projectConfigDto.withMixins(config.getMixins()); projectConfigDto.withAttributes(config.getAttributes()); List<ProjectConfigDto> modules = config.getModules() .stream() .map(DtoConverter::toProjectConfigDto) .collect(Collectors.toList()); projectConfigDto.withModules(modules); projectConfigDto.withContentRoot(config.getContentRoot()); projectConfigDto.withType(config.getType()); projectConfigDto.withSource(toSourceDto(config.getSource())); projectConfigDto.setContentRoot(project.getContentRoot()); } catch (ServerException | ValueStorageException | ProjectTypeConstraintException exception) { projectConfigDto.withType(BaseProjectType.ID).withType("blank"); ProjectProblem projectProblem = newDto(ProjectProblem.class).withCode(1).withMessage(exception.getMessage()); projectConfigDto.getProblems().add(projectProblem); } if (serviceUriBuilder != null) { projectConfigDto.withLinks(generateProjectLinks(project, serviceUriBuilder)); } return projectConfigDto; }
Source:
CloudBlobStore(VerifiableProperties properties, PartitionId partitionId, CloudDestination cloudDestination, ClusterMap clusterMap, VcrMetrics vcrMetrics) throws IllegalStateException { CloudConfig cloudConfig = new CloudConfig(properties); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(properties); this.clusterMap = clusterMap; this.cloudDestination = Objects.requireNonNull(cloudDestination, "cloudDestination is required"); this.partitionId = Objects.requireNonNull(partitionId, "partitionId is required"); this.vcrMetrics = Objects.requireNonNull(vcrMetrics, "vcrMetrics is required"); minTtlMillis = TimeUnit.DAYS.toMillis(cloudConfig.vcrMinTtlDays); requireEncryption = cloudConfig.vcrRequireEncryption; recentBlobCache = Collections.synchronizedMap(new RecentBlobCache(1000, cloudConfig.recentBlobCacheLimit)); String cryptoAgentFactoryClass = cloudConfig.cloudBlobCryptoAgentFactoryClass; try { cryptoAgentFactory = Utils.getObj(cryptoAgentFactoryClass, properties, clusterMapConfig.clusterMapClusterName, vcrMetrics.getMetricRegistry()); } catch (ReflectiveOperationException e) { throw new IllegalStateException("Unable to construct factory " + cryptoAgentFactoryClass, e); } this.cryptoAgent = cryptoAgentFactory.getCloudBlobCryptoAgent(); }

Target:
CloudBlobStore(VerifiableProperties properties, PartitionId partitionId, CloudDestination cloudDestination, ClusterMap clusterMap, VcrMetrics vcrMetrics) throws IllegalStateException { CloudConfig cloudConfig = new CloudConfig(properties); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(properties); this.clusterMap = clusterMap; this.cloudDestination = Objects.requireNonNull(cloudDestination, "cloudDestination is required"); this.partitionId = Objects.requireNonNull(partitionId, "partitionId is required"); this.vcrMetrics = Objects.requireNonNull(vcrMetrics, "vcrMetrics is required"); minTtlMillis = TimeUnit.DAYS.toMillis(cloudConfig.vcrMinTtlDays); requireEncryption = cloudConfig.vcrRequireEncryption; recentBlobCache = Collections.synchronizedMap(new RecentBlobCache(cloudConfig.recentBlobCacheLimit)); String cryptoAgentFactoryClass = cloudConfig.cloudBlobCryptoAgentFactoryClass; try { cryptoAgentFactory = Utils.getObj(cryptoAgentFactoryClass, properties, clusterMapConfig.clusterMapClusterName, vcrMetrics.getMetricRegistry()); } catch (ReflectiveOperationException e) { throw new IllegalStateException("Unable to construct factory " + cryptoAgentFactoryClass, e); } this.cryptoAgent = cryptoAgentFactory.getCloudBlobCryptoAgent(); }
Source:
public boolean useAbstractConvertersForConversion(RelTraitSet fromTraits, RelTraitSet toTraits) { return !fromTraits.containsIfApplicable(Convention.NONE); }

Target:
public boolean useAbstractConvertersForConversion(RelTraitSet fromTraits, RelTraitSet toTraits) { return true; }
Source:
public Set<User> getTeamMembersById(@PathVariable Long teamId) { System.out.println("Calling normal method"); Team team = teamService.getTeamById(teamId).orElseThrow(() -> new TeamNotFoundException(teamId)); return team.getMembers(); }

Target:
public Set<User> getTeamMembersById(@PathVariable Long teamId) { Team team = teamService.getTeamById(teamId).orElseThrow(() -> new TeamNotFoundException(teamId)); return team.getMembers(); }
Source:
public boolean hasHoldings(String identifier, BigDecimal amount) { try { return hasAccount(identifier) && Economy.hasEnough(identifier, amount); } catch (UserDoesNotExistException ignore) { return false; } }

Target:
public boolean hasHoldings(String identifier, BigDecimal amount) { try { return Economy.hasEnough(identifier, amount); } catch (UserDoesNotExistException ignore) { return false; } }
Source:
protected String createUUID() { return (UUID.randomUUID().toString()); }

Target:
protected String createUUID() { return UUID.randomUUID().toString(); }
Source:
public int length() { return mCodes.size(); }

Target:
public int length() { return codePointCount(); }
Source:
protected boolean canDoAction() { if (getParameters().getId() == null || !entityExists()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } return true; }

Target:
protected boolean canDoAction() { if (getParameters().getId() == null || !entityExists()) { return failCanDoAction(getParameters().isVm() ? VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND : VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } return true; }
Source:
public void contextInitialized(ServletContextEvent sce) { FenixFramework.getDomainModel().registerDeletionListener(Person.class, (person) -> { Site homepageSite = person.getHomepage(); if (homepageSite != null) { person.setHomepage(null); homepageSite.getHomepageSite().delete(); } }); FenixFramework.getDomainModel().registerDeletionListener(Unit.class, (unit) -> { Site site = unit.getSite(); if (site != null) { unit.setSite(null); site.delete(); } }); CMSRenderer.addHandler(new HomepageRequestHandler()); CMSRenderer.addHandler(new UnitRequestHandler()); Signal.register(ResultsImportationProcess.QUC_RESULTS_IMPORTED, ExecutionCourseQUCListener.createQUCComponent()) }

Target:
public void contextInitialized(ServletContextEvent sce) { FenixFramework.getDomainModel().registerDeletionListener(Person.class, (person) -> { Site homepageSite = person.getHomepage(); if (homepageSite != null) { person.setHomepage(null); homepageSite.getHomepageSite().delete(); } }); FenixFramework.getDomainModel().registerDeletionListener(Unit.class, (unit) -> { Site site = unit.getSite(); if (site != null) { unit.setSite(null); site.delete(); } }); CMSRenderer.addHandler(new HomepageRequestHandler()); CMSRenderer.addHandler(new UnitRequestHandler()); Signal.register(UserProfile.USER_NAME_CHANGED, HomepageListener::updateName); Signal.register(ResultsImportationProcess.QUC_RESULTS_IMPORTED, (event) -> ExecutionCourseQUCListener.createQUCComponent()); }
Source:
long saveOnlineDetectionData(JsonNode payloadNode, DatasetConfigDTO datasetConfigDTO, MetricConfigDTO metricConfigDTO) throws JsonProcessingException { JsonNode dataNode = payloadNode.get(DATA_FIELD); String timeColumnName = datasetConfigDTO.getTimeColumn(); String datasetName = datasetConfigDTO.getDataset(); String metricName = metricConfigDTO.getName(); ArrayNode columnsNode = dataNode.withArray(COLUMNS_FIELD); int[] colIndices = findTimeAndMetricColumns(columnsNode, timeColumnName, metricName); int timeColIdx = colIndices[0]; int metricColIdx = colIndices[1]; Preconditions.checkArgument(metricColIdx>=0 && timeColIdx>=0, String.format("metric: %s or time: %s not found in adhoc data.", metricName, timeColumnName)); OnlineDetectionDataDTO onlineDetectionDataDTO = new OnlineDetectionDataDTO(); onlineDetectionDataDTO.setDataset(datasetName); onlineDetectionDataDTO.setMetric(metricName); onlineDetectionDataDTO.setOnlineDetectionData(this.objectMapper.writeValueAsString(dataNode)); long id = onlineDetectionDataDAO.save(onlineDetectionDataDTO); LOG.info("Saved online data with dataset: and metric: {}", onlineDetectionDataDTO.getDataset(), onlineDetectionDataDTO.getMetric()); return id; }

Target:
OnlineDetectionDataDTO saveOnlineDetectionData(JsonNode payloadNode, DatasetConfigDTO datasetConfigDTO, MetricConfigDTO metricConfigDTO) throws JsonProcessingException { JsonNode dataNode = payloadNode.get(DATA_FIELD); String timeColumnName = datasetConfigDTO.getTimeColumn(); String datasetName = datasetConfigDTO.getDataset(); String metricName = metricConfigDTO.getName(); Preconditions.checkArgument(validateOnlineDetectionData(dataNode, timeColumnName, metricName), String.format("metric: %s or time: %s not found in adhoc data.", metricName, timeColumnName)); OnlineDetectionDataDTO onlineDetectionDataDTO = new OnlineDetectionDataDTO(); onlineDetectionDataDTO.setDataset(datasetName); onlineDetectionDataDTO.setMetric(metricName); onlineDetectionDataDTO.setOnlineDetectionData(this.objectMapper.writeValueAsString(dataNode)); onlineDetectionDataDAO.save(onlineDetectionDataDTO); LOG.info("Saved online data with dataset: and metric: {}", onlineDetectionDataDTO.getDataset(), onlineDetectionDataDTO.getMetric()); return onlineDetectionDataDTO; }
Source:
public Object invoke(String name, Object[] args, String[] sig) throws MBeanException, ReflectionException { if (log.isDebugEnabled()) { log.debugf("Invoke method called on %s", name); } MBeanOperationInfo opInfo = null; for (IspnMBeanOperationInfo op : opInfos) { if (op.getOperationName().equals(name)) { opInfo = op; break; } } if (opInfo == null) { final String msg = "Operation " + name + " not amongst operations in " + opInfos; throw new MBeanException(new ServiceNotFoundException(msg), msg); } for (int i = 0; i < args.length; i++) { if (log.isDebugEnabled()) log.debugf("Argument value before transformation: " + args[i] + " and its class: " + args[i].getClass() + ". For method.invoke we need it to be class: " + sig[i]); if (sig[i].equals(Integer.class.getCanonicalName())) { args[i] = Integer.parseInt((String) args[i]); } if (sig[i].equals(Long.class.getCanonicalName())) { args[i] = Long.parseLong((String) args[i]); } } try { Class<?>[] classes = new Class[sig.length]; for (int i = 0; i < classes.length; i++) { classes[i] = ReflectionUtil.getClassForName(sig[i], null); } Method method = getObject().getClass().getMethod(opInfo.getName(), classes); return method.invoke(getObject(), args); } catch (Exception e) { throw new MBeanException(e); } }

Target:
public Object invoke(String name, Object[] args, String[] sig) throws MBeanException, ReflectionException { if (log.isDebugEnabled()) { log.debugf("Invoke method called on %s", name); } MBeanOperationInfo opInfo = null; for (IspnMBeanOperationInfo op : opInfos) { if (op.getOperationName().equals(name)) { opInfo = op; break; } } if (opInfo == null) { final String msg = "Operation " + name + " not amongst operations in " + opInfos; throw new MBeanException(new ServiceNotFoundException(msg), msg); } for (int i = 0; i < args.length; i++) { if (log.isDebugEnabled()) log.debugf("Argument value before transformation: %s and its class: %s. " + "For method.invoke we need it to be class: %s", args[i], args[i].getClass(), sig[i]); if (sig[i].equals(int.class.getCanonicalName())) { args[i] = Integer.parseInt((String) args[i]); } if (sig[i].equals(long.class.getCanonicalName())) { args[i] = Long.parseLong((String) args[i]); } } try { Class<?>[] classes = new Class[sig.length]; for (int i = 0; i < classes.length; i++) { classes[i] = ReflectionUtil.getClassForName(sig[i], null); } Method method = getObject().getClass().getMethod(opInfo.getName(), classes); return method.invoke(getObject(), args); } catch (Exception e) { throw new MBeanException(e); } }
Source:
private Answer executeRequest(DeallocateVmVspCommand cmd) { try { isNuageVspGuruLoaded(); _nuageVspGuruClient.deallocate(cmd.getNetworkUuid(), cmd.getNicFromDdUuid(), cmd.getNicMacAddress(), cmd.getNicIp4Address(), cmd.isL3Network(), cmd.isSharedNetwork(), cmd.getVpcUuid(), cmd.getNetworksDomainUuid(), cmd.getVmInstanceName(), cmd.getVmUuid(), cmd.isExpungingState()); return new DeallocateVmVspAnswer(cmd, true, "Deallocated VM from Nuage VSP."); } catch (Exception e) { s_logger.error("Failure during " + cmd, e); return new DeallocateVmVspAnswer(cmd, e); } }

Target:
private Answer executeRequest(DeallocateVmVspCommand cmd) { try { isNuageVspGuruLoaded(); _nuageVspGuruClient.deallocate(cmd.getNetworkUuid(), cmd.getNicFromDdUuid(), cmd.getNicMacAddress(), cmd.getNicIp4Address(), cmd.isL3Network(), cmd.isSharedNetwork(), cmd.getVpcUuid(), cmd.getNetworksDomainUuid(), cmd.getVmInstanceName(), cmd.getVmUuid(), cmd.isExpungingState()); return new Answer(cmd, true, "Deallocated VM " + cmd.getVmInstanceName() + " on Nuage VSD " + _hostName); } catch (ExecutionException | ConfigurationException e) { s_logger.error("Failure during " + cmd + " on Nuage VSD " + _hostName, e); return new Answer(cmd, e); } }
Source:
public boolean include(final TreeWalk walker) { String walkString = walker.getPathString(); if (fullpaths.contains(walkString)) return true; if (prefixes.contains(walkString)) return true; for (int i = walkString.indexOf('/'); i > 0; i = walkString .indexOf('/', i + 1)) { String prefix = walkString.substring(0, i); if (fullpaths.contains(prefix)) return true; } byte[] r = max.pathRaw; final int cmp = walker.isPathPrefix(r, r.length); if (cmp > 0) throw StopWalkException.INSTANCE; return false; }

Target:
public boolean include(final TreeWalk walker) { byte[] rp = walker.getRawPath(); Hasher hasher = new Hasher(rp, walker.getPathLength()); while (hasher.hashNext()) { int hash = hasher.nextHash(); if (fullpaths.contains(rp, hasher.length(), hash)) return true; if (!hasher.hashNext()) if (prefixes.contains(rp, hasher.length(), hash)) return true; } final int cmp = walker.isPathPrefix(max, max.length); if (cmp > 0) throw StopWalkException.INSTANCE; return false; }
Source:
public void testAutoLabeling() { Map<String, String> envs = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); envs.put(HadoopSparkJob.SPARK_NODE_LABELING_ENV_VAR, Boolean.TRUE.toString()); envs.put(HadoopSparkJob.SPARK_AUTO_NODE_LABELING_ENV_VAR, Boolean.TRUE.toString()); envs.put(HadoopSparkJob.SPARK_DESIRED_NODE_LABEL_ENV_VAR, "test2"); envs.put(HadoopSparkJob.SPARK_MIN_MEM_VCORE_RATIO_ENV_VAR, "3"); URL url = getClass().getClassLoader().getResource("spark-defaults.conf"); envs.put(HadoopSparkJob.SPARK_PROPERTY_FILE_PATH_ENV_VAR, url.getPath()); setEnv(envs); Configuration.addDefaultResource("yarn-site.xml"); String[] argArray = new String[] { "--conf", "spark.yarn.queue=test", "--conf", "spark.yarn.executor.nodeLabelExpression=test", "--executor-cores", "2", "--executor-memory", "7G" }; argArray = HadoopSecureSparkWrapper.handleNodeLabeling(argArray); argArray = HadoopSecureSparkWrapper.removeNullsFromArgArray(argArray); Assert.assertTrue(argArray.length == 6); Assert.assertTrue(argArray[1].contains("test2")); }

Target:
public void testAutoLabeling() { Map<String, String> envs = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); envs.put(HadoopSparkJob.SPARK_NODE_LABELING_ENV_VAR, Boolean.TRUE.toString()); envs.put(HadoopSparkJob.SPARK_AUTO_NODE_LABELING_ENV_VAR, Boolean.TRUE.toString()); envs.put(HadoopSparkJob.SPARK_DESIRED_NODE_LABEL_ENV_VAR, "test2"); envs.put(HadoopSparkJob.SPARK_MIN_MEM_VCORE_RATIO_ENV_VAR, "3"); setEnv(envs); Configuration.addDefaultResource("yarn-site.xml"); String[] argArray = new String[] { "--conf", "spark.yarn.queue=test", "--conf", "spark.yarn.executor.nodeLabelExpression=test", "--executor-cores", "2", "--executor-memory", "7G" }; argArray = HadoopSecureSparkWrapper.handleNodeLabeling(argArray); argArray = HadoopSecureSparkWrapper.removeNullsFromArgArray(argArray); Assert.assertTrue(argArray.length == 6); Assert.assertTrue(argArray[1].contains("test2")); }
Source:
private Boolean checkProblemValue() { final SWTBotView problemViewBot = bot.viewByTitle("Problems"); problemViewBot.setFocus(); final SWTBotTree problemTree = problemViewBot.bot().tree(); bot.waitUntil(new ICondition() { public boolean test() throws Exception { return (problemViewBot.isActive()) && (problemTree.getAllItems().length == 1); } public void init(SWTBot bot) { } public String getFailureMessage() { return "Problems view is not active."; } }); for (SWTBotTreeItem item : problemTree.getAllItems()) { item.expand(); for (String itemMessage : item.getNodes()) { if (errorMessage.equals(itemMessage)) { return true; } } } return false; }

Target:
private Boolean checkProblemValue() { final SWTBotView problemViewBot = bot.viewByTitle("Problems"); problemViewBot.setFocus(); final SWTBotTree problemTree = problemViewBot.bot().tree(); bot.waitUntil(new CheckTreeItemEnabled(problemTree.getTreeItem(ERROR_NODE))); SWTBotTreeItem item = problemTree.getTreeItem(ERROR_NODE).expand(); for (String itemMessage : item.getNodes()) { if (errorMessage.equals(itemMessage)) { return true; } } return false; }
Source:
public void initializeDataSource(ITmfTrace trace) { TmfAbstractAnalysisModule module = createStatisticsAnalysiModule(); if (!(module instanceof AbstractSegmentStatisticsAnalysis)) { return; } try { module.setTrace(trace); module.schedule(); if (fModule != null) { fModule.dispose(); } fModule = (AbstractSegmentStatisticsAnalysis) module; } catch (TmfAnalysisException e) { Activator.getDefault().logError("Error initializing statistics analysis module", e); } }

Target:
public void initializeDataSource(ITmfTrace trace) { TmfAbstractAnalysisModule module = createStatisticsAnalysiModule(); if (module == null) { return; } try { module.setTrace(trace); module.schedule(); if (fModule != null) { fModule.dispose(); } fModule = module; } catch (TmfAnalysisException e) { Activator.getDefault().logError("Error initializing statistics analysis module", e); } }
Source:
void maybeChangeExpirationDate(IndexValue target, List<IndexValue> allValues) { if (target.isTTLUpdate()) { return; } for (IndexValue v : allValues) { if (v.isTTLUpdate()) { target.setExpiresAtMs(v.getExpiresAtMs()); target.setFlag(IndexValue.Flags.Ttl_Update_Index); return; } } }

Target:
void maybeChangeExpirationDate(IndexValue target, List<IndexValue> allValues) { if (target.isTTLUpdate() && target.getExpiresAtMs() == Utils.Infinite_Time) { return; } for (IndexValue v : allValues) { if (v.isTTLUpdate()) { target.setExpiresAtMs(v.getExpiresAtMs()); target.setFlag(IndexValue.Flags.Ttl_Update_Index); return; } } }
Source:
public DocumentModel run(DocumentModel doc) { if (before != null && !before.getParentRef().equals(doc.getParentRef())) { throw new NuxeoException(NOT_SAME_FOLDER_ERROR_MSG); } session.orderBefore(doc.getParentRef(), doc.getName(), before != null ? before.getName() : null); session.save(); return session.getDocument(doc.getRef()); }

Target:
public DocumentModel run(DocumentModel doc) { try { session.orderBefore(doc.getParentRef(), doc.getName(), before != null ? before.getName() : null); session.save(); return session.getDocument(doc.getRef()); } catch (DocumentNotFoundException e) { throw new NuxeoException(NOT_SAME_FOLDER_ERROR_MSG); } }
Source:
public synchronized void cleanupQueue(String queueName) throws InterruptedException { logger.info("Cleaning up queue: " + queueName); taskDriver.cleanupQueue(queueName); }

Target:
public synchronized void cleanupQueue(String queueName) { logger.info("Cleaning up queue: " + queueName); taskDriver.cleanupQueue(queueName); }
Source:
public CommandResult runCommand(Integer id, String command) { CommandResult commandResult = null; Process process = null; String[] callSequence = command.split("[\\r\\n\\s]+"); try { process = new ProcessBuilder(callSequence).start(); ArrayList<String> outputMessage = inputStreamArrayToList(process.getInputStream()); ArrayList<String> errorMessage = inputStreamArrayToList(process.getErrorStream()); int errCode = process.waitFor(); outputMessage.addAll(errorMessage); commandResult = new CommandResult(id, command, errCode == 0, outputMessage); } catch (IOException | InterruptedException exception) { ArrayList<String> errorMessages = new ArrayList<>(); errorMessages.add(exception.getCause().toString()); errorMessages.add(exception.getMessage()); commandResult = new CommandResult(id, command, false, errorMessages); return commandResult; } finally { if (process != null) { closeStream(process.getInputStream()); closeStream(process.getOutputStream()); closeStream(process.getErrorStream()); } } return commandResult; }

Target:
public CommandResult runCommand(Integer id, String command) { CommandResult commandResult = null; Process process = null; String[] callSequence = command.split("[\\r\\n\\s]+"); try { process = new ProcessBuilder(callSequence).start(); ArrayList<String> outputMessage = inputStreamArrayToList(process.getInputStream()); ArrayList<String> errorMessage = inputStreamArrayToList(process.getErrorStream()); int errCode = process.waitFor(); outputMessage.addAll(errorMessage); commandResult = new CommandResult(id, command, errCode == 0, outputMessage); if (!commandResult.isSuccessful()) { logger.error("Execution of Command " + commandResult.getId() + " " + commandResult.getCommand() + " failed!: " + commandResult.getMessages()); } if (commandResult.isSuccessful()) { logger.info("Execution of Command " + commandResult.getId() + " " + commandResult.getCommand() + " was succesfull!: " + commandResult.getMessages()); } } catch (IOException | InterruptedException exception) { ArrayList<String> errorMessages = new ArrayList<>(); errorMessages.add(exception.getCause().toString()); errorMessages.add(exception.getMessage()); commandResult = new CommandResult(id, command, false, errorMessages); logger.error("Execution of Command " + commandResult.getId() + " " + commandResult.getCommand() + " failed!: " + commandResult.getMessages()); return commandResult; } finally { if (process != null) { closeStream(process.getInputStream()); closeStream(process.getOutputStream()); closeStream(process.getErrorStream()); } } return commandResult; }
Source:
protected Collection<Integer> translateForBatchInternal( final AbstractMultipleInputTransformation<OUT> transformation, final Context context) { boolean isKeyed = transformation instanceof KeyedMultipleInputTransformation; boolean isInputSelectable = isInputSelectable(transformation); if (isKeyed && !isInputSelectable) { BatchExecutionUtils.adjustChainingStrategy(transformation); } Collection<Integer> ids = translateInternal(transformation, context); if (isKeyed && !isInputSelectable) { BatchExecutionUtils.applySortingInputs(transformation.getId(), context); } return ids; }

Target:
protected Collection<Integer> translateForBatchInternal( final AbstractMultipleInputTransformation<OUT> transformation, final Context context) { Collection<Integer> ids = translateInternal(transformation, context); boolean isKeyed = transformation instanceof KeyedMultipleInputTransformation; if (isKeyed) { BatchExecutionUtils.applySortingInputs(transformation.getId(), context); } return ids; }
Source:
public TableStatistics getTableStatistics(ConnectorSession session, ConnectorTableHandle tableHandle, Constraint<ColumnHandle> constraint) { if (!isStatisticsEnabled(session)) { return EMPTY_STATISTICS; } List<HivePartition> hivePartitions = partitionManager.getPartitions(metastore, tableHandle, constraint).getPartitions(); Map<String, ColumnHandle> tableColumns = Maps.filterValues( getColumnHandles(session, tableHandle), columnHandle -> !getColumnMetadata(session, tableHandle, columnHandle).isHidden()); return hiveStatisticsProvider.getTableStatistics(session, tableHandle, hivePartitions, tableColumns); }

Target:
public TableStatistics getTableStatistics(ConnectorSession session, ConnectorTableHandle tableHandle, Constraint<ColumnHandle> constraint) { if (!isStatisticsEnabled(session)) { return EMPTY_STATISTICS; } List<HivePartition> hivePartitions = partitionManager.getPartitions(metastore, tableHandle, constraint).getPartitions(); Map<String, ColumnHandle> tableColumns = getColumnHandles(session, tableHandle) .entrySet().stream() .filter(entry -> !((HiveColumnHandle) entry.getValue()).isHidden()) .collect(toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)); return hiveStatisticsProvider.getTableStatistics(session, tableHandle, hivePartitions, tableColumns); }
Source:
public void setLoadMeterTimerPeriod(int p) { if (m_loadMeterTimerPeriod == p) return; m_loadMeterTimerPeriod = p > LOAD_METER_TIMER_MIN ? p : LOAD_METER_TIMER_MIN; disposeLoadMeterTimer(); initializeLoadMeterTimer(); }

Target:
public void setLoadMeterTimerPeriod(int p) { assert (p > LOAD_METER_TIMER_MIN); if (m_loadMeterTimerPeriod == p) return; m_loadMeterTimerPeriod = p > LOAD_METER_TIMER_MIN ? p : LOAD_METER_TIMER_MIN; disposeLoadMeterTimer(); initializeLoadMeterTimer(); }
Source:
private static List<List<String>> decodePartitionLists(Object object) { if (object == null) { return null; } return ImmutableList.copyOf(((Collection<?>) object).stream() .peek(HiveAnalyzeProperties::throwIfNull) .map(partition -> ((Collection<?>) partition).stream() .map(name -> name == null ? HIVE_DEFAULT_DYNAMIC_PARTITION : ((String) name)) .collect(toImmutableList())) .collect(toList())); }

Target:
private static List<List<String>> decodePartitionLists(Object object) { if (object == null) { return null; } return ImmutableList.copyOf(((Collection<?>) object).stream() .peek(HiveAnalyzeProperties::throwIfNull) .map(partition -> ((Collection<?>) partition).stream() .map(name -> firstNonNull((String) name, HIVE_DEFAULT_DYNAMIC_PARTITION)) .collect(toImmutableList())) .collect(toImmutableSet())); }
Source:
private int buildsOfProjectOnAllNodes(Task task) { if (!shouldBeThrottled(task, getThrottleJobProperty(task))) { return 0; } Job job = taskToJob(task); if (job != null) { RunList<?> runningBuilds = job.getBuilds().filter(new Predicate<Run>() { @Override public boolean apply(Run run) { return run.isBuilding(); } }); int runCount = Iterators.size(runningBuilds.iterator()); LOGGER.log(Level.FINE, "There are {0} running builds of {1}.", new Object[]{runCount, job.getDisplayName()}); return runCount; } LOGGER.log(Level.WARNING, "Could not determine number of builds of " + task.getDisplayName()); return 0; }

Target:
private int buildsOfProjectOnAllNodes(Task task) { if (!shouldBeThrottled(task, getThrottleJobProperty(task))) { return 0; } if (task.getClass().getName().equals("org.jenkinsci.plugins.workflow.job.WorkflowJob")) { return buildsOfPipelineJob(task); } else { return buildsOfProjectOnAllNodesImpl(task); } }
Source:
protected void onRemoveElement(Rule rule) { String uid = rule.getUID(); ruleEngine.removeRule(uid); String templateUID = rule.getTemplateUID(); if (templateUID != null) { synchronized (this) { Set<String> ruleUIDs = mapTemplateToRules.get(templateUID); if (ruleUIDs != null) { ruleUIDs.remove(uid); } } } postRuleRemovedEvent(rule); }

Target:
protected void onRemoveElement(Rule rule) { String uid = rule.getUID(); ruleEngine.removeRule(uid); String templateUID = rule.getTemplateUID(); if (templateUID != null) { synchronized (this) { Set<String> ruleUIDs = mapTemplateToRules.get(templateUID); if (ruleUIDs != null) { ruleUIDs.remove(uid); } } } }
Source:
private void closeSerialPort() { if (serialPort != null) { try { serialPort.removeEventListener(); outputStream.flush(); outputStream.close(); inputStream.close(); } catch (Exception e) { logger.error("Error closing serial port.", e); } finally { serialPort.close(); logger.debug("Closed serial port."); serialPort = null; inputStream = null; outputStream = null; } } }

Target:
private void closeSerialPort() { if (serialPort != null) { SerialPort sp = serialPort; try { sp.disableReceiveTimeout(); sp.removeEventListener(); if (outputStream != null) { OutputStream os = outputStream; os.flush(); os.close(); } if (inputStream != null) { inputStream.close(); } } catch (IOException e) { logger.error("Error closing serial port.", e); } finally { sp.close(); logger.debug("Closed serial port."); serialPort = null; inputStream = null; outputStream = null; } } }
Source:
public void addFunction(GoloFunction function) { FunctionContainer container = this.functionContainersStack.peek(); if(container.getFunctions().contains(function)) { GoloFunction firstDeclaration = null; for (GoloFunction f : container.getFunctions()) { if (function.equals(f)) { firstDeclaration = f; } } errorMessage(AMBIGUOUS_DECLARATION, function.getASTNode(), String.format("Declaring a function `%s` twice (declared first at line=%d, column=%d) ", function.getName(), firstDeclaration.getASTNode().getLineInSourceCode(), firstDeclaration.getASTNode().getColumnInSourceCode())); } container.addFunction(function); }

Target:
public void addFunction(GoloFunction function) { FunctionContainer container = this.functionContainersStack.peek(); if(container.getFunctions().contains(function)) { GoloFunction firstDeclaration = null; for (GoloFunction f : container.getFunctions()) { if (function.equals(f)) { firstDeclaration = f; } } errorMessage(AMBIGUOUS_DECLARATION, function.getASTNode(), String.format("Declaring a function `%s` twice (declared first here: %s)", function.getName(), firstDeclaration == null ? "unknown" : firstDeclaration.getASTNode().getPositionInSourceCode())); } container.addFunction(function); }
Source:
public int hashCode() { int result = apiKey != null ? apiKey.hashCode() : 0; result = 31 * result + (clientId != null ? clientId.hashCode() : 0); result = 31 * result + (stripeVersion != null ? stripeVersion.hashCode() : 0); result = 31 * result + (stripeVersionOnBehalfOf != null ? stripeVersionOnBehalfOf.hashCode() : 0); result = 31 * result + (idempotencyKey != null ? idempotencyKey.hashCode() : 0); result = 31 * result + (stripeAccount != null ? stripeAccount.hashCode() : 0); result = 31 * result + connectTimeout; result = 31 * result + readTimeout; return result; }

Target:
public int hashCode() { int result = apiKey != null ? apiKey.hashCode() : 0; result = 31 * result + (clientId != null ? clientId.hashCode() : 0); result = 31 * result + (idempotencyKey != null ? idempotencyKey.hashCode() : 0); result = 31 * result + (stripeAccount != null ? stripeAccount.hashCode() : 0); result = 31 * result + (stripeVersion != null ? stripeVersion.hashCode() : 0); result = 31 * result + (stripeVersionOverride != null ? stripeVersionOverride.hashCode() : 0); result = 31 * result + connectTimeout; result = 31 * result + readTimeout; return result; }
Source:
public long getNextTimestamp() throws TimestampIOException { long nextTS = _timestampCounter.addAndGet(TIMESTAMP_INCREMENT); long maxTS = _maxReservedTimestamp; if (nextTS > maxTS) { reserveNextBlock(nextTS); } _numTimestampsCreated.incrementAndGet(); return nextTS; }

Target:
public long getNextTimestamp() throws TimestampIOException { long nextTS = _timestampCounter.addAndGet(TIMESTAMP_INCREMENT); if (nextTS > _maxReservedTimestamp) { reserveNextBlock(nextTS); } _numTimestampsCreated.incrementAndGet(); return nextTS; }
Source:
public void getDuplicatePatientsByAttributes_shouldThrowAnAPIExceptionIfAttributesIsEmpty() { List<String> attributes = new ArrayList<>(); patientService.getDuplicatePatientsByAttributes(attributes); }

Target:
public void getDuplicatePatientsByAttributes_shouldThrowAnAPIExceptionIfAttributesIsEmpty() { expectedException.expect(APIException.class); expectedException.expectMessage(NULL_ERROR_MESSAGE_FOR_ATTRIBUTES_NULL); patientService.getDuplicatePatientsByAttributes(new ArrayList<>()); }
Source:
public T peek(int n) { return dequeue.peekLast(n); }

Target:
public T peek(int n) { return elements[(head + n) & mask]; }
Source:
public JudgmentEnrichmentHash process(JudgmentEnrichmentTags judgmentEnrichmentTags) throws Exception { String hash = judgmentEnrichmentTagsHashCalculator.calculateHash(judgmentEnrichmentTags); JudgmentEnrichmentHash enrichmentHash = judgmentEnrichmentHashRepository.findByJudgmentId(judgmentEnrichmentTags.getJudgmentId()); if (enrichmentHash == null) { enrichmentHash = new JudgmentEnrichmentHash(); enrichmentHash.setJudgmentId(judgmentEnrichmentTags.getJudgmentId()); } enrichmentHash.fillNewHash(hash); return enrichmentHash; }

Target:
public JudgmentEnrichmentHash process(JudgmentEnrichmentTags judgmentEnrichmentTags) throws Exception { JudgmentEnrichmentHash enrichmentHash = judgmentEnrichmentHashRepository.findByJudgmentId(judgmentEnrichmentTags.getJudgmentId()); if (enrichmentHash == null) { enrichmentHash = new JudgmentEnrichmentHash(); enrichmentHash.setJudgmentId(judgmentEnrichmentTags.getJudgmentId()); } String hash = judgmentEnrichmentTagsHashCalculator.calculateHash(judgmentEnrichmentTags); enrichmentHash.updateHash(hash); return enrichmentHash; }
Source:
public void test_psql_format_from_string() { Period period = PGIntervalParser.apply("@ 1 year 1 mon 1 day 1 hour 1 minute 1 secs"); Assert.assertEquals(period, new Period().withYears(1).withMonths(1).withDays(1).withHours(1).withMinutes(1).withSeconds(1)); }

Target:
public void test_psql_format_from_string() { Period period = PGIntervalParser.apply("@ 1 year 1 mon 1 day 1 hour 1 minute 1 secs"); assertThat(period, is(new Period().withYears(1).withMonths(1).withDays(1).withHours(1).withMinutes(1).withSeconds(1))); }
Source:
private void processInitialStatusUpdates(WarningsPrinter warningsPrinter) { while (client.isRunning() && (client.currentData().getData() == null)) { warningsPrinter.print(client.currentStatusInfo().getWarnings(), true, false); client.advance(); } List<PrestoWarning> warnings = (client.isRunning() ? client.currentStatusInfo() : client.finalStatusInfo()).getWarnings(); warningsPrinter.print(warnings, false, true); }

Target:
private void processInitialStatusUpdates(WarningsPrinter warningsPrinter) { while (client.isRunning() && (client.currentData().getData() == null)) { warningsPrinter.print(client.currentStatusInfo().getWarnings(), true, false); client.advance(); } List<PrestoWarning> warnings; if (client.isRunning()) { warnings = client.currentStatusInfo().getWarnings(); } else { warnings = client.finalStatusInfo().getWarnings(); } warningsPrinter.print(warnings, false, true); }
Source:
public List<DataNode> getAllExistingDataNodes() { List<DataNode> dataNodes = new ArrayList<>(); for (Datacenter dcObj : hardwareLayout.getDatacenters()) { dataNodes.addAll(dcObj.getDataNodes()); } return dataNodes; }

Target:
public List<DataNode> getAllExistingDataNodes() { List<DataNode> dataNodes = new ArrayList<>(); for (Datacenter dcObj : hardwareLayout.getDatacenters()) { dataNodes.addAll(dcObj.getDataNodes()); } return Collections.unmodifiableList(dataNodes); }
Source:
private void activateContextService() { IContextService contextService = (IContextService) getSite() .getService(IContextService.class); if (contextService != null) { contextService.activateContext(VIEW_ID); } }

Target:
private void activateContextService() { IContextService contextService = (IContextService) getSite() .getService(IContextService.class); if (contextService != null) contextService.activateContext(VIEW_ID); }
Source:
public TimeDimensionColumn getTimeDimension(String dimensionName) { return getDimensions().stream() .filter(dimension -> dimension.getName().equals(dimensionName)) .filter(dimension -> dimension instanceof TimeDimensionColumn) .map(TimeDimensionColumn.class::cast) .findAny() .orElse(null); }

Target:
public TimeDimensionColumn getTimeDimension(String dimensionName) { DimensionColumn dimension = dimensions.get(dimensionName); if (dimension instanceof TimeDimensionColumn) { return (TimeDimensionColumn) dimension; } return null; }
Source:
private void autoIgnoreTopLevelDerivedResources(IProject project, IProgressMonitor monitor) throws CoreException { List<IPath> paths = findDerivedResources(project); if (paths.size() > 0) { IgnoreOperation ignoreOp = new IgnoreOperation(paths); ignoreOp.execute(monitor); } }

Target:
private void autoIgnoreTopLevelDerivedResources(IProject project, IProgressMonitor monitor) throws CoreException { List<IPath> paths = findDerivedResources(project); if (paths.size() > 0) { IgnoreOperation ignoreOp = new IgnoreOperation(paths); IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); ignoreOp.execute(subMonitor); } }