auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onMatch(RelOptRuleCall call) { SetOp setOp = call.rel(0); JoinState setOpState = RelDistributionUtils.isSetOpSP(setOp.getInputs()); RelDistribution newDistribution = RelDistributions.SINGLETON.with( setOpState.getLiteral(), setOpState.isSP()); List<RelNode> inputs; if (!setOpState.isSP() && setOpState.getLiteral() == null) { inputs = Lists.newArrayList(); setOp.getInputs() .stream() .forEach(node -> { RelDistribution dist = node.getTraitSet().getTrait(RelDistributionTraitDef.INSTANCE); if (!dist.getIsSP() && dist.getPartitionEqualValue() == null && RelDistribution.Type.SINGLETON != dist.getType()) { VoltLogicalExchange exchange = new VoltLogicalExchange(node.getCluster(), node.getTraitSet(), node, dist); inputs.add(exchange); } else { inputs.add(node); } }); } else { inputs = setOp.getInputs(); } SetOp newSetOp = setOp.copy(setOp.getTraitSet().replace(newDistribution), inputs); call.transformTo(newSetOp); }

Target:
public void onMatch(RelOptRuleCall call) { SetOp setOp = call.rel(0); JoinState setOpState = RelDistributionUtils.isSetOpSP(setOp.getInputs()); RelDistribution newDistribution = RelDistributions.SINGLETON.with( setOpState.getLiteral(), setOpState.isSP()); boolean isMP = !setOpState.isSP() && setOpState.getLiteral() == null; List<RelNode> inputs = setOp.getInputs() .stream() .map(node -> { RelDistribution dist = node.getTraitSet().getTrait(RelDistributionTraitDef.INSTANCE); boolean needExchange = isMP && RelDistribution.Type.SINGLETON != dist.getType(); if (needExchange) { VoltLogicalExchange exchange = new VoltLogicalExchange(node.getCluster(), node.getTraitSet(), node, dist); return exchange; } else { return node; } }) .collect(Collectors.toList()); SetOp newSetOp = setOp.copy(setOp.getTraitSet().replace(newDistribution), inputs); call.transformTo(newSetOp); }
Source:
private PBDSegment<M> addSegment(PBDSegment<M> tail, long startId, M extraHeader) throws IOException { long curId = (startId == PBDSegment.INVALID_ID) ? ((tail == null) ? 1 : tail.segmentId() + 1) : startId; String fname = getSegmentFileName(curId); PBDSegment<M> newSegment = initializeNewSegment(curId, new VoltFile(m_path, fname), "an offer", extraHeader); m_segments.put(newSegment.segmentId(), newSegment); if (m_retentionPolicy != null) { m_retentionPolicy.newSegmentAdded(); m_retentionPolicy.bytesAdded(newSegment.m_file.length()); } return newSegment; }

Target:
private PBDSegment<M> addSegment(PBDSegment<M> tail, long startId, M extraHeader) throws IOException { long curId = (startId == PBDSegment.INVALID_ID) ? ((tail == null) ? 1 : tail.segmentId() + 1) : startId; String fname = getSegmentFileName(curId); PBDSegment<M> newSegment = initializeNewSegment(curId, new VoltFile(m_path, fname), "an offer", extraHeader); m_segments.put(newSegment.segmentId(), newSegment); if (m_retentionPolicy != null) { m_retentionPolicy.newSegmentAdded(newSegment.m_file.length()); } return newSegment; }
Source:
public static CheckAndMutate toCheckAndMutate(ClientProtos.Condition condition, List<Mutation> mutations) throws IOException { assert mutations.size() > 0; byte[] row = condition.getRow().toByteArray(); CheckAndMutate.Builder builder = CheckAndMutate.newBuilder(row); Filter filter = condition.hasFilter() ? ProtobufUtil.toFilter(condition.getFilter()) : null; if (filter != null) { builder.ifMatches(filter); } else { builder.ifMatches(condition.getFamily().toByteArray(), condition.getQualifier().toByteArray(), CompareOperator.valueOf(condition.getCompareType().name()), ProtobufUtil.toComparator(condition.getComparator()).getValue()); } TimeRange timeRange = condition.hasTimeRange() ? ProtobufUtil.toTimeRange(condition.getTimeRange()) : TimeRange.allTime(); builder.timeRange(timeRange); try { if (mutations.size() == 1) { if (mutations.get(0) instanceof Put) { return builder.build((Put) mutations.get(0)); } else if (mutations.get(0) instanceof Delete) { return builder.build((Delete) mutations.get(0)); } else { throw new DoNotRetryIOException("Unsupported mutate type: " + mutations.get(0) .getClass().getSimpleName().toUpperCase()); } } else { return builder.build(new RowMutations(mutations.get(0).getRow()).add(mutations)); } } catch (IllegalArgumentException e) { throw new DoNotRetryIOException(e.getMessage()); } }

Target:
public static CheckAndMutate toCheckAndMutate(ClientProtos.Condition condition, List<Mutation> mutations) throws IOException { assert mutations.size() > 0; byte[] row = condition.getRow().toByteArray(); CheckAndMutate.Builder builder = CheckAndMutate.newBuilder(row); Filter filter = condition.hasFilter() ? ProtobufUtil.toFilter(condition.getFilter()) : null; if (filter != null) { builder.ifMatches(filter); } else { builder.ifMatches(condition.getFamily().toByteArray(), condition.getQualifier().toByteArray(), CompareOperator.valueOf(condition.getCompareType().name()), ProtobufUtil.toComparator(condition.getComparator()).getValue()); } TimeRange timeRange = condition.hasTimeRange() ? ProtobufUtil.toTimeRange(condition.getTimeRange()) : TimeRange.allTime(); builder.timeRange(timeRange); try { if (mutations.size() == 1) { Mutation m = mutations.get(0); if (m instanceof Put) { return builder.build((Put) m); } else if (m instanceof Delete) { return builder.build((Delete) m); } else { throw new DoNotRetryIOException("Unsupported mutate type: " + mutations.get(0) .getClass().getSimpleName().toUpperCase()); } } else { return builder.build(new RowMutations(mutations.get(0).getRow()).add(mutations)); } } catch (IllegalArgumentException e) { throw new DoNotRetryIOException(e.getMessage()); } }
Source:
private static List<UsagePermission> buildPermissions() { List<UsagePermission> ps = new ArrayList<>(); for (KubernetesCloud kubernetesCloud : getUsageRestrictedKubernetesClouds()) { UsagePermission p = new UsagePermission(); String name = kubernetesCloud.name; p.setName(name); p.setGranted(false); p.setInherited(false); ps.add(p); } return ps; }

Target:
private static List<UsagePermission> buildPermissions() { List<UsagePermission> ps = new ArrayList<>(); for (KubernetesCloud kubernetesCloud : getUsageRestrictedKubernetesClouds()) { UsagePermission p = new UsagePermission(); p.setName(kubernetesCloud.name); ps.add(p); } return ps; }
Source:
private static ColumnStatistics createPartitionColumnStatistics( HiveColumnHandle column, Type type, List<HivePartition> partitions, Map<String, PartitionStatistics> statistics, double averageRowsPerPartition, double rowCount) { Set<HivePartition> emptyPartitions = partitions.stream() .filter(partition -> getPartitionRowCount(partition.getPartitionId(), statistics).orElse(averageRowsPerPartition) == 0) .collect(toImmutableSet()); return ColumnStatistics.builder() .setDistinctValuesCount(Estimate.of(calculateDistinctPartitionKeys(column, partitions, emptyPartitions))) .setNullsFraction(Estimate.of(calculateNullsFractionForPartitioningKey(column, partitions, statistics, averageRowsPerPartition, rowCount))) .setRange(calculateRangeForPartitioningKey(column, type, partitions, emptyPartitions)) .setDataSize(calculateDataSizeForPartitioningKey(column, type, partitions, statistics, averageRowsPerPartition)) .build(); }

Target:
private static ColumnStatistics createPartitionColumnStatistics( HiveColumnHandle column, Type type, List<HivePartition> partitions, Map<String, PartitionStatistics> statistics, double averageRowsPerPartition, double rowCount) { List<HivePartition> nonEmptyPartitions = partitions.stream() .filter(partition -> getPartitionRowCount(partition.getPartitionId(), statistics).orElse(averageRowsPerPartition) != 0) .collect(toImmutableList()); return ColumnStatistics.builder() .setDistinctValuesCount(Estimate.of(calculateDistinctPartitionKeys(column, nonEmptyPartitions))) .setNullsFraction(Estimate.of(calculateNullsFractionForPartitioningKey(column, partitions, statistics, averageRowsPerPartition, rowCount))) .setRange(calculateRangeForPartitioningKey(column, type, nonEmptyPartitions)) .setDataSize(calculateDataSizeForPartitioningKey(column, type, partitions, statistics, averageRowsPerPartition)) .build(); }
Source:
private void warnIfShortMessageSmallerThanErrorMessage(AbstractPatternRule rule) { if (rule instanceof PatternRule) { int sizeOfShortMessage = ((PatternRule) rule).getShortMessage().length(); int sizeOfErrorMessage = ((PatternRule) rule).getMessage().length(); if (sizeOfShortMessage >= sizeOfErrorMessage) { System.err.println("Warning: The content of <short> should be smaller than the content of" + " <message>). Language: " + rule.language.getName() + ". Rule: " + rule.getId()); } } }

Target:
private void warnIfShortMessageSmallerThanErrorMessage(AbstractPatternRule rule) { if (rule instanceof PatternRule) { int sizeOfShortMessage = ((PatternRule) rule).getShortMessage().length(); int sizeOfErrorMessage = ((PatternRule) rule).getMessage().length(); if (sizeOfShortMessage >= sizeOfErrorMessage) { System.err.println("Warning: The content of <short> should be smaller than the content of" + " <message>. Language: " + rule.language.getName() + ". Rule: " + rule.getId()); } } }
Source:
public void testCreate() { StorageAccountApi storageApi = api.getStorageAccountApi(getResourceGroupName()); StorageService storageAccount = storageApi.get(getStorageServiceName()); String blob = storageAccount.storageServiceProperties().primaryEndpoints().get("blob"); String id = "/subscriptions/" + subscriptionid + "/resourceGroups/" + getResourceGroupName() + "/providers/" + "Microsoft.Compute/virtualMachines/" + getName(); VirtualMachine vm = api().create(getName(), id, getName(), LOCATION, getProperties(blob, nicName)); assertTrue(!vm.name().isEmpty()); String status = "Creating"; int stopCounter = 0; while (status.equals("Creating")) { try { Thread.sleep(120 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } vm = api().get(getName()); status = vm.properties().provisioningState(); stopCounter++; if (stopCounter == 15) break; } status = vm.properties().provisioningState(); assertTrue(!status.equals("Creating")); assertTrue(!status.equals("Failed")); }

Target:
public void testCreate(){ StorageAccountApi storageApi = api.getStorageAccountApi(getResourceGroupName()); StorageService storageAccount = storageApi.get(getStorageServiceName()); String blob = storageAccount.storageServiceProperties().primaryEndpoints().get("blob"); VirtualMachine vm = api().create(getName(), LOCATION, getProperties(blob, nicName)); assertTrue(!vm.name().isEmpty()); boolean jobDone = Predicates2.retry(new Predicate<String>() { @Override public boolean apply(String name) { return !api().get(name).properties().provisioningState().equals("Creating"); } }, 60 * 20 * 1000).apply(getName()); assertTrue(jobDone, "create operation did not complete in the configured timeout"); String status = api().get(vmName).properties().provisioningState(); assertTrue(!status.equals("Creating")); assertTrue(!status.equals("Failed")); }
Source:
public PredicateASTFactoryData(Predicate predicate, List<KiePMMLOutputField> outputFields, List<KiePMMLDroolsRule> rules, String parentPath, String currentRule, Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap) { this.predicate = predicate; this.outputFields = outputFields; this.rules = rules; this.parentPath = parentPath; this.currentRule = currentRule; this.fieldTypeMap = fieldTypeMap; }

Target:
public PredicateASTFactoryData(Predicate predicate, List<KiePMMLOutputField> outputFields, List<KiePMMLDroolsRule> rules, String parentPath, String currentRule, Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap) { this.predicate = predicate; this.outputFields = outputFields != null ? Collections.unmodifiableList(outputFields) : Collections.emptyList(); this.rules = rules; this.parentPath = parentPath; this.currentRule = currentRule; this.fieldTypeMap = fieldTypeMap != null ? Collections.unmodifiableMap(fieldTypeMap) : Collections.emptyMap(); }
Source:
public int getMultipleAssignmentsIndex(StructureTreeNode treeNode) { if (Objects.nonNull(treeNode.getDataObject()) && treeNode.getDataObject() instanceof View && Objects.nonNull(((View) treeNode.getDataObject()).getMediaUnit())) { return severalAssignments.indexOf(((View) treeNode.getDataObject()).getMediaUnit()); } return -1; }

Target:
public int getMultipleAssignmentsIndex(StructureTreeNode treeNode) { if (treeNode.getDataObject() instanceof View && Objects.nonNull(((View) treeNode.getDataObject()).getMediaUnit())) { return severalAssignments.indexOf(((View) treeNode.getDataObject()).getMediaUnit()); } return -1; }
Source:
PagedFlux<IncidentRootCause> listIncidentRootCauses( String detectionConfigurationId, String incidentId, Context context) { AnomalyIncident anomalyIncident = new AnomalyIncident(); IncidentHelper.setId(anomalyIncident, incidentId); IncidentHelper.setDetectionConfigurationId(anomalyIncident, detectionConfigurationId); try { return new PagedFlux<>(() -> listIncidentRootCausesInternal(anomalyIncident, context), null); } catch (RuntimeException ex) { return new PagedFlux<>(() -> monoError(logger, ex)); } }

Target:
PagedFlux<IncidentRootCause> listIncidentRootCauses( String detectionConfigurationId, String incidentId, Context context) { try { Objects.requireNonNull(detectionConfigurationId, "'detectionConfigurationId' is required."); Objects.requireNonNull(incidentId, "'incidentId' is required."); AnomalyIncident anomalyIncident = new AnomalyIncident(); IncidentHelper.setId(anomalyIncident, incidentId); IncidentHelper.setDetectionConfigurationId(anomalyIncident, detectionConfigurationId); return new PagedFlux<>(() -> listIncidentRootCausesInternal(anomalyIncident, context), null); } catch (RuntimeException ex) { return new PagedFlux<>(() -> monoError(logger, ex)); } }
Source:
private void showMultiplePrompts(final OSInAppMessage inAppMessage, final List<OSInAppMessagePrompt> prompts) { for (OSInAppMessagePrompt prompt : prompts) { if (!prompt.hasPrompted()) { currentPrompt = prompt; break; } } if (currentPrompt != null) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "IAM prompt to handle: " + currentPrompt.toString()); currentPrompt.setPrompted(true); currentPrompt.handlePrompt(new OneSignal.OSPromptActionCompletionCallback() { @Override public void completed(@Nullable String messageTitle, @Nullable String message, boolean accepted) { currentPrompt = null; OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "IAM prompt to handle finished accepted: " + accepted); if (inAppMessage.isPreview && messageTitle!= null && message != null) showInformativeAlert(messageTitle, message, inAppMessage, prompts); else showMultiplePrompts(inAppMessage, prompts); } }); } else { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "No IAM prompt to handle, dismiss message: " + inAppMessage.messageId); messageWasDismissed(inAppMessage); } }

Target:
private void showMultiplePrompts(final OSInAppMessage inAppMessage, final List<OSInAppMessagePrompt> prompts) { for (OSInAppMessagePrompt prompt : prompts) { if (!prompt.hasPrompted()) { currentPrompt = prompt; break; } } if (currentPrompt != null) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "IAM prompt to handle: " + currentPrompt.toString()); currentPrompt.setPrompted(true); currentPrompt.handlePrompt(new OneSignal.OSPromptActionCompletionCallback() { @Override public void onCompleted(OneSignal.PromptActionResult result) { currentPrompt = null; OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "IAM prompt to handle finished with result: " + result); if (inAppMessage.isPreview && result == OneSignal.PromptActionResult.LOCATION_PERMISSIONS_MISSING_MANIFEST) showAlertDialogMessage(inAppMessage, prompts); else showMultiplePrompts(inAppMessage, prompts); } }); } else { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.DEBUG, "No IAM prompt to handle, dismiss message: " + inAppMessage.messageId); messageWasDismissed(inAppMessage); } }
Source:
public static void main(String[] args) throws Exception { final ManagedChannel channel = new ManagedChannel() { @Override public <RequestT, ResponseT> ClientCall<RequestT, ResponseT> newCall( MethodDescriptor<RequestT, ResponseT> methodDescriptor, CallOptions callOptions) { return null; } @Override public String authority() { return null; } @Override public ManagedChannel shutdown() { return null; } @Override public boolean isShutdown() { return false; } @Override public boolean isTerminated() { return false; } @Override public ManagedChannel shutdownNow() { return null; } @Override public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { return false; } }; int threads = 100; int concurrent = 400; final ChannelPool cp = new ChannelPool( Collections.<HeaderInterceptor>emptyList(), new ChannelPool.ChannelFactory() { @Override public ManagedChannel create() throws IOException { return channel; } }); cp.ensureChannelCount(40); ExecutorService es = Executors.newFixedThreadPool(threads); Callable<Void> runnable = new Callable<Void>() { @Override public Void call() throws Exception { long start = System.nanoTime(); for (int i = 0; i < TEST_COUNT; i++) { cp.newCall(null, null); } long diff = System.nanoTime() - start; double naonPerRow = diff / TEST_COUNT; System.out.println(String.format("took %d ms. %.0f", diff / 1_000_000, naonPerRow)); return null; } }; runnable.call(); for (int j = 0; j < concurrent; j++) { es.submit(runnable); } es.shutdown(); es.awaitTermination(1000, TimeUnit.SECONDS); }

Target:
public static void main(String[] args) throws Exception { final ManagedChannel channel = new ManagedChannel() { @Override public <RequestT, ResponseT> ClientCall<RequestT, ResponseT> newCall( MethodDescriptor<RequestT, ResponseT> methodDescriptor, CallOptions callOptions) { return null; } @Override public String authority() { return null; } @Override public ManagedChannel shutdown() { return null; } @Override public boolean isShutdown() { return false; } @Override public boolean isTerminated() { return false; } @Override public ManagedChannel shutdownNow() { return null; } @Override public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { return false; } }; int threads = 100; int concurrent = 400; final ChannelPool cp = new ChannelPool( Collections.<HeaderInterceptor>emptyList(), new ChannelPool.ChannelFactory() { @Override public ManagedChannel create() throws IOException { return channel; } }); cp.ensureChannelCount(40); ExecutorService es = Executors.newFixedThreadPool(threads); Callable<Void> runnable = new Callable<Void>() { @Override public Void call() throws Exception { long start = System.nanoTime(); for (int i = 0; i < TEST_COUNT; i++) { cp.newCall(null, null); } long diff = System.nanoTime() - start; double nanosPerRow = diff / TEST_COUNT; System.out.println(String.format("took %d ms. %.0f", diff / 1_000_000, nanosPerRow)); return null; } }; runnable.call(); for (int j = 0; j < concurrent; j++) { es.submit(runnable); } es.shutdown(); es.awaitTermination(1000, TimeUnit.SECONDS); }
Source:
public void addSubnet(ExternalSubnet subnet) { String err = "cannot add subnet to an unmanaged external network provider"; log.error(err); throw new EngineException(EngineError.PROVIDER_FAILURE, err); }

Target:
public void addSubnet(ExternalSubnet subnet) { String err = String.format("Cannot add subnet to an unmanaged external network provider %s", provider.getName()); log.error(err); throw new EngineException(EngineError.PROVIDER_FAILURE, err); }
Source:
public static Set<DistributionModuleGroup> getModuleGroups() { Set<DistributionModuleGroup> hs = new HashSet<>(); hs.add(new DistributionModuleGroup(CDH5120Constant.SPARK2_MODULE_GROUP.getModuleName(), false, condition)); hs.add(new DistributionModuleGroup(CDH5120Constant.SPARK_MRREQUIRED_MODULE_GROUP.getModuleName(), true, condition)); hs.add(new DistributionModuleGroup(CDH5120Constant.HDFS_MODULE_GROUP_SPARK2_2.getModuleName(), false, condition)); hs.add(new DistributionModuleGroup(CDH5120Constant.HDFS_MODULE_GROUP_COMMON.getModuleName(), false, condition)); hs.add(new DistributionModuleGroup(CDH5120Constant.MAPREDUCE_MODULE_GROUP.getModuleName(), false, condition)); ComponentCondition conditionUseNavigator = new SimpleComponentCondition(new BasicExpression( SparkBatchConstant.USE_CLOUDERA_NAVIGATOR)); hs.add(new DistributionModuleGroup(CDH5120Constant.TALEND_CLOUDERA_CDH_5_12_NAVIGATOR.getModuleName(), true, conditionUseNavigator)); return hs; }

Target:
public static Set<DistributionModuleGroup> getModuleGroups() { Set<DistributionModuleGroup> hs = new HashSet<>(); hs.add(new DistributionModuleGroup(CDH5120Constant.SPARK2_MODULE_GROUP.getModuleName(), false, condition)); hs.add(new DistributionModuleGroup(CDH5120Constant.SPARK_MRREQUIRED_MODULE_GROUP.getModuleName(), true, condition)); hs.add(new DistributionModuleGroup(CDH5120Constant.HDFS_MODULE_GROUP_SPARK2_2.getModuleName(), false, condition)); hs.add(new DistributionModuleGroup(CDH5120Constant.HDFS_MODULE_GROUP_COMMON.getModuleName(), false, condition)); hs.add(new DistributionModuleGroup(CDH5120Constant.MAPREDUCE_MODULE_GROUP.getModuleName(), false, condition)); END_CLOUDERA_CDH_5_12_NAVIGATOR.getModuleName(), return hs; }
Source:
@Bean @Lazy ArmeriaServerConfigurator uiServerConfigurator( IndexSwitchingService indexSwitchingService) throws IOException { HttpService indexService = indexHtml.isReadable() ? indexSwitchingService : indexSwitchingService.lensIndex; ServerCacheControl maxAgeYear = new ServerCacheControlBuilder().maxAgeSeconds(TimeUnit.DAYS.toSeconds(365)).build(); Service<HttpRequest, HttpResponse> uiFileService = HttpFileServiceBuilder.forClassPath("zipkin-ui").cacheControl(maxAgeYear).build() .orElse( HttpFileServiceBuilder.forClassPath("zipkin-lens").cacheControl(maxAgeYear).build()); String config = writeConfig(ui); return sb -> { sb.service("/zipkin/config.json", HttpFileBuilder.of(HttpData.of(UTF_8, config)) .cacheControl(new ServerCacheControlBuilder().maxAgeSeconds(600).build()) .contentType(MediaType.JSON_UTF_8) .build() .asService()); sb.serviceUnder("/zipkin/", uiFileService); sb.service("/zipkin/", indexService) .service("/zipkin/index.html", indexService) .service("/zipkin/traces/{id}", indexService) .service("/zipkin/dependency", indexService) .service("/zipkin/traceViewer", indexService); sb.service("/favicon.ico", new RedirectService(HttpStatus.FOUND, "/zipkin/favicon.ico")) .service("/", new RedirectService(HttpStatus.FOUND, "/zipkin/")) .service("/zipkin", new RedirectService(HttpStatus.FOUND, "/zipkin/")); }; }

Target:
@Bean @Lazy ArmeriaServerConfigurator uiServerConfigurator( IndexSwitchingService indexSwitchingService) throws IOException { HttpService indexService = indexHtml.isReadable() ? indexSwitchingService : indexSwitchingService.lensIndex; ServerCacheControl maxAgeYear = new ServerCacheControlBuilder().maxAgeSeconds(TimeUnit.DAYS.toSeconds(365)).build(); Service<HttpRequest, HttpResponse> uiFileService = HttpFileServiceBuilder.forClassPath("zipkin-ui").cacheControl(maxAgeYear).build() .orElse( HttpFileServiceBuilder.forClassPath("zipkin-lens").cacheControl(maxAgeYear).build()); String config = writeConfig(ui); return sb -> { sb.service("/zipkin/config.json", HttpFileBuilder.of(HttpData.ofUtf8(config)) .cacheControl(new ServerCacheControlBuilder().maxAgeSeconds(600).build()) .contentType(MediaType.JSON_UTF_8) .build() .asService()); sb.serviceUnder("/zipkin/", uiFileService); sb.service("/zipkin/", indexService) .service("/zipkin/index.html", indexService) .service("/zipkin/traces/{id}", indexService) .service("/zipkin/dependency", indexService) .service("/zipkin/traceViewer", indexService); sb.service("/favicon.ico", new RedirectService(HttpStatus.FOUND, "/zipkin/favicon.ico")) .service("/", new RedirectService(HttpStatus.FOUND, "/zipkin/")) .service("/zipkin", new RedirectService(HttpStatus.FOUND, "/zipkin/")); }; }
Source:
public RsVelocity(final String folder, final InputStream template, final Scalar<Map<String, Object>> params) { super( new RsOf( () -> new RsEmpty().head(), () -> RsVelocity.render(folder, template, params.get()) ) ); }

Target:
public RsVelocity(final String folder, final InputStream template, final Scalar<Map<String, Object>> params) { super( new ResponseOf( () -> new RsEmpty().head(), () -> RsVelocity.render(folder, template, params.get()) ) ); }
Source:
public void trim(Long trimMark) { if (Address.isAddress(trimMark)) { long numAddressesToTrim = addressMap.rankLong(trimMark); if (numAddressesToTrim <= NO_ADDRESSES) { return; } List<Long> addressesToTrim = new ArrayList<>(); LongIterator it = addressMap.getLongIterator(); for (int i = 0; i < numAddressesToTrim; i++) { addressesToTrim.add(it.next()); } if (!addressesToTrim.isEmpty()) { removeAddresses(addressesToTrim); } } }

Target:
public void trim(Long trimMark) { if (!Address.isAddress(trimMark)) { return; } long numAddressesToTrim = addressMap.rankLong(trimMark); if (numAddressesToTrim <= NO_ADDRESSES) { return; } List<Long> addressesToTrim = new ArrayList<>(); LongIterator it = addressMap.getLongIterator(); for (int i = 0; i < numAddressesToTrim; i++) { addressesToTrim.add(it.next()); } if (!addressesToTrim.isEmpty()) { removeAddresses(addressesToTrim); } }
Source:
public void undeploy() { List<AssertionError> errors = Lists.newArrayList(); undeploy(errors); if (errors.size() > 0) { fail(format("Failed to undeploy job %s %s - %s", job.getId(), job.toString(), errors.get(0))); } }

Target:
public void undeploy() { final List<AssertionError> errors = Lists.newArrayList(); undeploy(errors); if (errors.size() > 0) { fail(format("Failed to undeploy job %s - %s", getJobDescription(job), errors.get(0))); } }
Source:
private CompletableFuture<Void> visitDataReadCommand(InvocationContext ctx, AbstractDataCommand command) throws Throwable { boolean statisticsEnabled = getStatisticsEnabled(command); if (!statisticsEnabled || !ctx.isOriginLocal()) return ctx.continueInvocation(); long start = timeService.time(); return ctx.onReturn((ctx1, command1, rv, throwable) -> { long intervalMilliseconds = timeService.timeDuration(start, TimeUnit.MILLISECONDS); if (rv == null) { missTimes.add(intervalMilliseconds); misses.increment(); } else { hitTimes.add(intervalMilliseconds); hits.increment(); } return null; }); }

Target:
private CompletableFuture<Void> visitDataReadCommand(InvocationContext ctx, AbstractDataCommand command) throws Throwable { boolean statisticsEnabled = getStatisticsEnabled(command); if (!statisticsEnabled || !ctx.isOriginLocal()) return ctx.continueInvocation(); long start = timeService.time(); return ctx.onReturn((rCtx, rCommand, rv, throwable) -> { long intervalMilliseconds = timeService.timeDuration(start, TimeUnit.MILLISECONDS); if (rv == null) { missTimes.add(intervalMilliseconds); misses.increment(); } else { hitTimes.add(intervalMilliseconds); hits.increment(); } return null; }); }
Source:
public ChannelBuilder withKind(ChannelKind kind) { this.kind = kind; return this; }

Target:
public ChannelBuilder withKind(ChannelKind kind) { if (kind == null) { throw new IllegalArgumentException("kind must not be null"); } this.kind = kind; return this; }
Source:
private SecretKey pbkdf2DerivedKeyForPassword(String password, byte[] salt, int iterations, int length) throws NoSuchAlgorithmException, InvalidKeySpecException { if (length < 1) { throw new IllegalArgumentException("Length must greater than 0"); } if (password == null || password.length() < 1) { throw new IllegalArgumentException("Length must greater than 0"); } if (salt == null || salt.length < 1) { throw new IllegalArgumentException("Length must greater than 0"); } if (iterations < 1) { throw new IllegalArgumentException("Length must greater than 0"); } SecretKeyFactory pbkdf2Factory; if (Build.VERSION.SDK_INT >= 19) { pbkdf2Factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1And8bit"); } else { pbkdf2Factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); } PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt, iterations, length * BYTES_TO_BITS); return pbkdf2Factory.generateSecret(keySpec); }

Target:
private SecretKey pbkdf2DerivedKeyForPassword(String password, byte[] salt, int iterations, int length) throws NoSuchAlgorithmException, InvalidKeySpecException { if (length < 1) { throw new IllegalArgumentException("length must greater than 0"); } if (password == null || password.length() < 1) { throw new IllegalArgumentException("password must not be null or empty String"); } if (salt == null || salt.length < 1) { throw new IllegalArgumentException("salt must not be null or empty byte array"); } if (iterations < 1) { throw new IllegalArgumentException("iterations must greater than 0"); } SecretKeyFactory pbkdf2Factory; if (Build.VERSION.SDK_INT >= 19) { pbkdf2Factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1And8bit"); } else { pbkdf2Factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); } PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray(), salt, iterations, length * BYTES_TO_BITS); return pbkdf2Factory.generateSecret(keySpec); }
Source:
private RefactoringStatus checkParameterNamesInRippleMethods() throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); Set<String> newParameterNames= getNewParameterNamesList(); for (IMethod fRippleMethod : fRippleMethods) { for (String paramName : fRippleMethod.getParameterNames()) { if (newParameterNames.contains(paramName)) { String[] args= new String[]{JavaElementUtil.createMethodSignature(fRippleMethod), BasicElementLabels.getJavaElementName(paramName)}; String msg= Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_already_has, args); RefactoringStatusContext context= JavaStatusContext.create(fRippleMethod.getCompilationUnit(), fRippleMethod.getNameRange()); result.addError(msg, context); } } } return result; }

Target:
private RefactoringStatus checkParameterNamesInRippleMethods() throws JavaModelException { RefactoringStatus result= new RefactoringStatus(); Set<String> newParameterNames= getNewParameterNamesList(); for (IMethod rippleMethod : fRippleMethods) { for (String paramName : rippleMethod.getParameterNames()) { if (newParameterNames.contains(paramName)) { String[] args= new String[]{JavaElementUtil.createMethodSignature(rippleMethod), BasicElementLabels.getJavaElementName(paramName)}; String msg= Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_already_has, args); RefactoringStatusContext context= JavaStatusContext.create(rippleMethod.getCompilationUnit(), rippleMethod.getNameRange()); result.addError(msg, context); } } } return result; }
Source:
public CoordinatorConfig(Properties config) { _config = config; _properties = new VerifiableProperties(config); _cluster = _properties.getString(CONFIG_CLUSTER); _zkAddress = _properties.getString(CONFIG_ZK_ADDRESS); _zkSessionTimeout = _properties.getInt(CONFIG_ZK_SESSION_TIMEOUT, ZkClient.DEFAULT_SESSION_TIMEOUT); _zkConnectionTimeout = _properties.getInt(CONFIG_ZK_CONNECTION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT); _retryIntervalMs = _properties.getInt(CONFIG_RETRY_INTERVAL, 1000 ); _heartbeatPeriodMs = _properties.getLong(CONFIG_HEARTBEAT_PERIOD_MS, Duration.ofMinutes(1).toMillis()); _debounceTimerMs = _properties.getLong(CONFIG_DEBOUNCE_TIMER_MS, Duration.ofSeconds(30).toMillis()); _defaultTransportProviderName = _properties.getString(CONFIG_DEFAULT_TRANSPORT_PROVIDER, ""); _zkCleanUpOrphanConnectorTask = _properties.getBoolean(CONFIG_ZK_CLEANUP_ORPHAN_CONNECTOR_TASK, false); }

Target:
public CoordinatorConfig(Properties config) { _config = config; _properties = new VerifiableProperties(config); _cluster = _properties.getString(CONFIG_CLUSTER); _zkAddress = _properties.getString(CONFIG_ZK_ADDRESS); _zkSessionTimeout = _properties.getInt(CONFIG_ZK_SESSION_TIMEOUT, ZkClient.DEFAULT_SESSION_TIMEOUT); _zkConnectionTimeout = _properties.getInt(CONFIG_ZK_CONNECTION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT); _retryIntervalMs = _properties.getInt(CONFIG_RETRY_INTERVAL, 1000 ); _heartbeatPeriodMs = _properties.getLong(CONFIG_HEARTBEAT_PERIOD_MS, Duration.ofMinutes(1).toMillis()); _debounceTimerMs = _properties.getLong(CONFIG_DEBOUNCE_TIMER_MS, Duration.ofSeconds(30).toMillis()); _defaultTransportProviderName = _properties.getString(CONFIG_DEFAULT_TRANSPORT_PROVIDER, ""); _zkCleanUpOrphanConnectorTask = _properties.getBoolean(CONFIG_ZK_CLEANUP_ORPHAN_CONNECTOR_TASK, false); _zkCleanUpOrphanConnectorTaskLock = _properties.getBoolean(CONFIG_ZK_CLEANUP_ORPHAN_CONNECTOR_TASK_LOCK, false); }
Source:
public boolean isRunning() { return isStarted(); }

Target:
public boolean isRunning() { return !isStopping() && !isStopped(); }
Source:
public FakeVdsmInit(String configPath) throws Exception { if (configPath == null){ URL propertiesFileURL = this.getClass().getResource("/config.properties"); configPath = propertiesFileURL.getPath(); } final Map<String, String> paramMap = new HashMap<String, String>(); Properties properties = new Properties(); properties.load(new FileInputStream(new File(configPath))); for (String s: properties.stringPropertyNames()){ paramMap.put(s, (String) properties.get(s)); } AppConfig appConfig = AppConfig.getInstance(); appConfig.init(paramMap); System.setProperty("logDir", appConfig.getLogDir()); final TaskProcessor taskProcessor = TaskProcessor.getInstance(); taskProcessor.init(); JsonRpcServer server = new JsonRpcServer(appConfig.getJsonHost(), appConfig.getJsonPort(), appConfig.isEncrypted()); server.start(); while (true) { Thread.sleep(1000); } }

Target:
public FakeVdsmInit(String configPath) throws Exception { if (configPath == null){ URL propertiesFileURL = this.getClass().getResource("/config.properties"); configPath = propertiesFileURL.getPath(); } final Map<String, String> paramMap = new HashMap<String, String>(); Properties properties = new Properties(); properties.load(new FileInputStream(new File(configPath))); for (String s: properties.stringPropertyNames()){ paramMap.put(s, (String) properties.get(s)); } AppConfig appConfig = AppConfig.getInstance(); appConfig.init(paramMap); System.setProperty("logDir", appConfig.getLogDir()); final TaskProcessor taskProcessor = TaskProcessor.getInstance(); taskProcessor.init(); JsonRpcServer.initMonitoring(); JsonRpcServer server = new JsonRpcServer(appConfig.getJsonHost(), appConfig.getJsonPort(), appConfig.isEncrypted()); server.setDaemon(true); server.run(); while (true) { Thread.sleep(100); } }
Source:
private JScrollPane getScrollPane() { if (proxiesScrollPane == null) { proxiesScrollPane = new JScrollPane(); proxiesScrollPane.setViewportView(getProxiesOptionsPanel()); } return proxiesScrollPane; }

Target:
private JScrollPane getScrollPane() { if (proxiesScrollPane == null) { proxiesScrollPane = new JScrollPane(); proxiesScrollPane.setBorder(BorderFactory.createEmptyBorder()); proxiesScrollPane.setViewportView(getScrollPanel()); } return proxiesScrollPane; }
Source:
public AssetView(List<Player> players) { setLayout(new MigLayout( "aligny top,wrap 15, gap 0", "0[]0[]0", "0[]1[]1[]1[]1[]1[]1[]1" )); if(players.size() > 1) add(new JLabel("Player"), MIG_CONFIG); else add(new JLabel()); add(newJLabel(WOOD_ICON), MIG_CONFIG); add(newJLabel(STONE_ICON), MIG_CONFIG); add(newJLabel(CLAY_ICON), MIG_CONFIG); add(newJLabel(ORE_ICON), MIG_CONFIG); add(newJLabel(LOOM_ICON), MIG_CONFIG); add(newJLabel(PAPYRUS_ICON), MIG_CONFIG); add(newJLabel(GLASS_ICON), MIG_CONFIG); add(newJLabel(SCIENCE1_ICON), MIG_CONFIG); add(newJLabel(SCIENCE2_ICON), MIG_CONFIG); add(newJLabel(SCIENCE3_ICON), MIG_CONFIG); add(newJLabel(GOLD_ICON), MIG_CONFIG); add(newJLabel(VICTORY_ICON), MIG_CONFIG); add(newJLabel(SHIELD_ICON), MIG_CONFIG); JLabel stageLabel = newJLabel(STAGE_ICON); resizeJLabelIcon(stageLabel,-1,60); add(stageLabel, MIG_CONFIG); for(Player player : players) { if(players.size() > 1) add(new JLabel("Player " + player.getPlayerId())); else add(new JLabel()); AssetMap playerAssets = player.getAssets(); for(String asset : Asset.ASSET_TYPES) { add(newTextJLabel("" + playerAssets.get(asset)),MIG_CONFIG); } } }

Target:
public AssetView(List<Player> players) { setLayout(new MigLayout( "aligny top,wrap 15, gap 0", "0[]0[]0", "0[]1[]1[]1[]1[]1[]1[]1" )); if(players.size() > 1) add(new JLabel("Player"), MIG_CONFIG); else add(new JLabel()); add(newJLabel(WOOD_ICON), MIG_CONFIG); add(newJLabel(STONE_ICON), MIG_CONFIG); add(newJLabel(CLAY_ICON), MIG_CONFIG); add(newJLabel(ORE_ICON), MIG_CONFIG); add(newJLabel(LOOM_ICON), MIG_CONFIG); add(newJLabel(PAPYRUS_ICON), MIG_CONFIG); add(newJLabel(GLASS_ICON), MIG_CONFIG); add(newJLabel(SCIENCE1_ICON), MIG_CONFIG); add(newJLabel(SCIENCE2_ICON), MIG_CONFIG); add(newJLabel(SCIENCE3_ICON), MIG_CONFIG); add(newJLabel(GOLD_ICON), MIG_CONFIG); add(newJLabel(VICTORY_ICON), MIG_CONFIG); add(newJLabel(SHIELD_ICON), MIG_CONFIG); JLabel stageLabel = newJLabel(STAGE_ICON); resizeJLabelIcon(stageLabel,-1,60); add(stageLabel, MIG_CONFIG); for(Player player : players) { if(players.size() > 1) add(new JLabel(player.toString())); else add(new JLabel()); AssetMap playerAssets = player.getAssets(); for(String asset : Asset.ASSET_TYPES) { add(newTextJLabel("" + playerAssets.get(asset)),MIG_CONFIG); } } }
Source:
void activate() { try { Central.bndCall(() -> { process(); list = memoize(this::list0); return null; }); } catch (Exception e) { logger.error("Could not activate {}", getName(), e); } }

Target:
void activate() { process(); }
Source:
public void testAdaptor() throws Exception { byte[] testByteArray = new byte[]{1, 2, 3}; ByteArrayObjectDataOutput out = new ByteArrayObjectDataOutput(10, mockSerializationService, ByteOrder.BIG_ENDIAN); ByteArrayObjectDataInput in = new ByteArrayObjectDataInput(out.buffer, mockSerializationService, ByteOrder.BIG_ENDIAN, false); adapter.write(out, testByteArray); byte[] read = (byte[]) adapter.read(in); Serializer impl = adapter.getImpl(); assertArrayEquals(testByteArray, read); assertEquals(serializer, impl); assertEquals(serializer.getTypeId(), adapter.getTypeId()); }

Target:
public void testAdaptor() throws Exception { byte[] testByteArray = new byte[]{1, 2, 3}; ByteArrayObjectDataOutput out = new ByteArrayObjectDataOutput(10, mockSerializationService, ByteOrder.BIG_ENDIAN); ByteArrayObjectDataInput in = new ByteArrayObjectDataInput(out.buffer, mockSerializationService, ByteOrder.BIG_ENDIAN); adapter.write(out, testByteArray); byte[] read = (byte[]) adapter.read(in); Serializer impl = adapter.getImpl(); assertArrayEquals(testByteArray, read); assertEquals(serializer, impl); assertEquals(serializer.getTypeId(), adapter.getTypeId()); }
Source:
public void onFileDeleting(OfflineFileDeleteEvent event) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Delete file"); builder.setMessage("Are you sure?"); builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { deleteFileFromOfflineStorage(event.getFile()); } }); builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alertDialog = builder.create(); alertDialog.show(); }

Target:
public void onFileDeleting(OfflineFileDeleteEvent event) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.alert_delete_dialog); builder.setMessage(R.string.alert_delete_confirm); builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { deleteFileFromOfflineStorage(event.getFile()); } }); builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog alertDialog = builder.create(); alertDialog.show(); }
Source:
public static BooleanExpression parse(String sql) throws FilterException { Object result = cache.get(sql); if (result instanceof FilterException) { throw (FilterException) result; } else if (result instanceof BooleanExpression) { return (BooleanExpression) result; } else { String actual = sql; boolean convertStringExpressions = false; boolean hyphenatedProps = false; while (true) { if (actual.startsWith(CONVERT_STRING_EXPRESSIONS_PREFIX)) { convertStringExpressions = true; actual = actual.substring(CONVERT_STRING_EXPRESSIONS_PREFIX.length()); continue; } if (actual.startsWith(HYPHENATED_PROPS_PREFIX)) { hyphenatedProps = true; actual = actual.substring(HYPHENATED_PROPS_PREFIX.length()); continue; } if (actual.startsWith(NO_CONVERT_STRING_EXPRESSIONS_PREFIX)) { convertStringExpressions = false; actual = actual.substring(NO_CONVERT_STRING_EXPRESSIONS_PREFIX.length()); continue; } if (actual.startsWith(NO_HYPHENATED_PROPS_PREFIX)) { hyphenatedProps = false; actual = actual.substring(NO_HYPHENATED_PROPS_PREFIX.length()); continue; } break; } if (convertStringExpressions) { ComparisonExpression.CONVERT_STRING_EXPRESSIONS.set(true); } try { BooleanExpression e = null; if (hyphenatedProps) { HyphenatedParser parser = new HyphenatedParser(new StringReader(actual)); e = parser.JmsSelector(); } else { StrictParser parser = new StrictParser(new StringReader(actual)); e = parser.JmsSelector(); } synchronized (cache) { cache.put(sql, e); } return e; } catch (Throwable e) { FilterException fe = new FilterException(actual, e); synchronized (cache) { cache.put(sql, fe); } throw fe; } finally { if (convertStringExpressions) { ComparisonExpression.CONVERT_STRING_EXPRESSIONS.remove(); } } } }

Target:
public static BooleanExpression parse(String sql) throws FilterException { String actual = sql; boolean convertStringExpressions = false; boolean hyphenatedProps = false; while (true) { if (actual.startsWith(CONVERT_STRING_EXPRESSIONS_PREFIX)) { convertStringExpressions = true; actual = actual.substring(CONVERT_STRING_EXPRESSIONS_PREFIX.length()); continue; } if (actual.startsWith(HYPHENATED_PROPS_PREFIX)) { hyphenatedProps = true; actual = actual.substring(HYPHENATED_PROPS_PREFIX.length()); continue; } if (actual.startsWith(NO_CONVERT_STRING_EXPRESSIONS_PREFIX)) { convertStringExpressions = false; actual = actual.substring(NO_CONVERT_STRING_EXPRESSIONS_PREFIX.length()); continue; } if (actual.startsWith(NO_HYPHENATED_PROPS_PREFIX)) { hyphenatedProps = false; actual = actual.substring(NO_HYPHENATED_PROPS_PREFIX.length()); continue; } break; } if (convertStringExpressions) { ComparisonExpression.CONVERT_STRING_EXPRESSIONS.set(true); } try { BooleanExpression e = null; if (hyphenatedProps) { HyphenatedParser parser = new HyphenatedParser(new StringReader(actual)); e = parser.JmsSelector(); } else { StrictParser parser = new StrictParser(new StringReader(actual)); e = parser.JmsSelector(); } return e; } catch (Throwable e) { FilterException fe = new FilterException(actual, e); throw fe; } finally { if (convertStringExpressions) { ComparisonExpression.CONVERT_STRING_EXPRESSIONS.remove(); } } }
Source:
private Stream<String> complaintsForResourceType(List<Protos.Resource> resources, String resourceName, double minSize) { double totalSize = resources.stream().filter(resource -> resource.getName().equals(resourceName)).collect(Collectors.summingDouble(resource -> resource.getScalar().getValue())); if (totalSize < minSize) { return Arrays.asList("required minimum " + minSize + " " + resourceName + " but offer only has " + totalSize + " in total").stream(); } else { String[] reasons = new String[]{}; return Arrays.asList(reasons).stream(); } }

Target:
private Stream<String> complaintsForResourceType(List<Protos.Resource> resources, String resourceName, double minSize) { double totalSize = resources.stream().filter(resource -> resource.getName().equals(resourceName)).collect(Collectors.summingDouble(resource -> resource.getScalar().getValue())); if (totalSize < minSize) { return Collections.singletonList("required minimum " + minSize + " " + resourceName + " but offer only has " + totalSize + " in total").stream(); } else { return Arrays.asList(new String[]{}).stream(); } }
Source:
public Configuration loadConfiguration() { File configFile = getFileSystemConfigFile(); if (!configFile.exists()) { LOGGER.warn(" file " + configFile + " does not exist --> loading default config.xml from classpath"); return ScenarioDocuXMLFileUtil.unmarshal(Configuration.class, getDefaultConfigFile()); } LOGGER.info(" loading configuration from file: " + configFile); return ScenarioDocuXMLFileUtil.unmarshal(Configuration.class, configFile); }

Target:
public Configuration loadConfiguration() { File configFile = getFileSystemConfigFile(); if (!configFile.exists()) { LOGGER.warn(" file " + configFile + " does not exist --> loading default config.xml from classpath"); return ScenarioDocuXMLFileUtil.unmarshal(Configuration.class, getDefaultConfigFile()); } else { LOGGER.info(" loading configuration from file: " + configFile); return ScenarioDocuXMLFileUtil.unmarshal(Configuration.class, configFile); } }
Source:
public boolean isEligible(TaskResult result) { StepResult<Boolean> stepResult = (StepResult<Boolean>) result.getStepResult(SignUpInclusionCriteriaStepIdentifier); if(stepResult != null) { return stepResult.getResult(); } return false; }

Target:
public boolean isEligible(TaskResult result) { StepResult<Boolean> stepResult = (StepResult<Boolean>) result.getStepResult(SignUpTask.SignUpInclusionCriteriaStepIdentifier); if(stepResult != null) { return stepResult.getResult(); } return false; }
Source:
public Map<String, String> getKeywordMap(NodeTemplate nodeTemplate) { return MutableMap.of( "SELF", nodeTemplate.getName() ); }

Target:
public Map<String, String> getKeywordMap(NodeTemplate nodeTemplate) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); String nodeTemplateName = nodeTemplate.getName(); if (nodeTemplateName != null) { builder.put("SELF", nodeTemplateName); } return builder.build(); }
Source:
protected void endWithFailure() { unLockImage(); log.warnFormat("Failed to extend size of the volume '${0}', user: '${1}'", getImage().getId(), getUserName()); addCustomValue("DiskId", getImageId().toString()); addCustomValue("UserName", getUserName()); AuditLogDirector.log(this, AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE); setSucceeded(true); }

Target:
protected void endWithFailure() { if (log.isWarnEnabled()) { log.warnFormat("Failed to extend size of the volume '${0}', user: '${1}'", getImage().getId(), getUserName()); } updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE); getReturnValue().setEndActionTryAgain(false); }
Source:
public void openLink(final String link) { if (ChanSettings.openLinkConfirmation.get()) { new AlertDialog.Builder(getContext()) .setNegativeButton(R.string.cancel, null) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (ChanSettings.openLinkBrowser.get()) { AndroidUtils.openLink(link); } else { AndroidUtils.openLinkInBrowser((Activity) getContext(), link); } } }) .setTitle(R.string.open_link_confirmation) .setMessage(link) .show(); } else { if (ChanSettings.openLinkBrowser.get()) { AndroidUtils.openLink(link); } else { AndroidUtils.openLinkInBrowser((Activity) getContext(), link); } } }

Target:
public void openLink(final String link) { if (ChanSettings.openLinkConfirmation.get()) { new AlertDialog.Builder(getContext()) .setNegativeButton(R.string.cancel, null) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { openLinkConfirmed(link); } }) .setTitle(R.string.open_link_confirmation) .setMessage(link) .show(); } else { openLinkConfirmed(link); } }