auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public PropertyConstraintMappingContext field(String property) { Contracts.assertNotNull( property, "The property name must not be null." ); Contracts.assertNotEmpty( property, MESSAGES.propertyNameMustNotBeEmpty() ); JavaBeanField javaBeanField = getFieldProperty( beanClass, property ); if ( javaBeanField == null || javaBeanField.getDeclaringClass() != beanClass ) { throw LOG.getUnableToFindPropertyWithAccessException( beanClass, property, ElementType.FIELD ); } if ( configuredMembers.contains( javaBeanField ) ) { throw LOG.getPropertyHasAlreadyBeConfiguredViaProgrammaticApiException( beanClass, property ); } PropertyConstraintMappingContextImpl context = new FieldPropertyConstraintMappingContextImpl( this, javaBeanField ); configuredMembers.add( javaBeanField ); propertyContexts.add( context ); return context; }

Target:
public PropertyConstraintMappingContext field(String property) { Contracts.assertNotEmpty( property, MESSAGES.propertyNameMustNotBeEmpty() ); JavaBeanField javaBeanField = getFieldProperty( beanClass, property ); if ( javaBeanField == null || javaBeanField.getDeclaringClass() != beanClass ) { throw LOG.getUnableToFindPropertyWithAccessException( beanClass, property, ElementType.FIELD ); } if ( configuredMembers.contains( javaBeanField ) ) { throw LOG.getPropertyHasAlreadyBeConfiguredViaProgrammaticApiException( beanClass, property ); } FieldConstraintMappingContextImpl context = new FieldConstraintMappingContextImpl( this, javaBeanField ); configuredMembers.add( javaBeanField ); propertyContexts.add( context ); return context; }
Source:
void operationRetried(String text, Exception ex, int retries, boolean idempotent) { LOG.info("{}: Retried {}: {}", retries, text, ex.toString()); LOG.debug("Stack", ex); owner.operationRetried(text, ex, retries, idempotent); }

Target:
void operationRetried(String text, Exception ex, int retries, boolean idempotent) { LOG.info("{}: Retried {}: {}", text, retries, ex.toString()); LOG.debug("Stack", ex); owner.operationRetried(text, ex, retries, idempotent); }
Source:
public void testSameSizes() throws Exception { int min = 3, max = 8, maxAlloc = 1 << max; BuddyAllocator a = new BuddyAllocator(isDirect, isMapped, 1 << min, maxAlloc, maxAlloc, maxAlloc, 0, tmpDir, new DummyMemoryManager(), LlapDaemonCacheMetrics.create("test", "1"), null, true, 1024 * 1024 * 128); for (int i = max; i >= min; --i) { allocSameSize(a, 1 << (max - i), i); } }

Target:
public void testSameSizes() throws Exception { int min = 3, max = 8, maxAlloc = 1 << max; BuddyAllocator a = new BuddyAllocator(isDirect, isMapped, 1 << min, maxAlloc, maxAlloc, maxAlloc, 0, tmpDir, new DummyMemoryManager(), LlapDaemonCacheMetrics.create("test", "1"), null, true); for (int i = max; i >= min; --i) { allocSameSize(a, 1 << (max - i), i); } }
Source:
public boolean isFreeFormContainerChildrenPresentation() { boolean isFreeForm = true; EObject editPartContainer = part.resolveSemanticElement().eContainer(); if (editPartContainer instanceof DNodeList) { isFreeForm = false; } else if (editPartContainer instanceof DNodeContainer) { DNodeContainer container = (DNodeContainer) editPartContainer; ContainerLayout childrenPresentation = container.getChildrenPresentation(); if (!childrenPresentation.equals(ContainerLayout.FREE_FORM)) { isFreeForm = false; } } return isFreeForm; }

Target:
public boolean isFreeFormContainerChildrenPresentation() { boolean isFreeForm = true; EObject eContainer = part.resolveSemanticElement().eContainer(); if (eContainer instanceof DNodeList) { isFreeForm = false; } else if (eContainer instanceof DNodeContainer) { DNodeContainer container = (DNodeContainer) eContainer; ContainerLayout childrenPresentation = container.getChildrenPresentation(); if (!childrenPresentation.equals(ContainerLayout.FREE_FORM)) { isFreeForm = false; } } return isFreeForm; }
Source:
private void flowFromMethodInvocation(MethodYield selectedYield, ExplodedGraph.Node parentNode) { List<JavaFileScannerContext.Location> flowFromMethodInvocation; String message; Symbol argumentSymbol = correspondingArgumentSymbol(symbolicValue, parentNode); if (selectedYield.exception) { Preconditions.checkNotNull(argumentSymbol, "If an exception occurs, the method does not return correctly and the impacted symbolic value can only be from arguments"); message = String.format("Exception '%s' thrown from method invocation", selectedYield.exceptionType.name()); flowFromMethodInvocation = FlowComputation.flow(selectedYield.node, selectedYield.node.programState.getValue(argumentSymbol)); } else { if (argumentSymbol != null) { message = "Learns from method call"; flowFromMethodInvocation = FlowComputation.flow(selectedYield.node, selectedYield.node.programState.getValue(argumentSymbol)); } else { message = "Uses return value"; flowFromMethodInvocation = FlowComputation.flow(selectedYield.node, selectedYield.node.programState.exitValue()); } } flow.add(location(parentNode, String.format("%s [see L#%d].", message, methodDeclarationLine(parentNode)))); flow.addAll(flowFromMethodInvocation); }

Target:
private void flowFromMethodInvocation(MethodYield selectedYield, ExplodedGraph.Node parentNode) { String message; int argumentIndex = correspondingArgumentIndex(symbolicValue, parentNode); if (selectedYield.exception) { Preconditions.checkState(argumentIndex != -1, "Only arguments should be considered when exception occurs"); String exceptionName = selectedYield.exceptionType == null ? "Runtime exception" : selectedYield.exceptionType.name(); message = String.format("Exception '%s' thrown from method invocation", exceptionName); } else { message = argumentIndex >= 0 ? "Learns from method call" : "Uses return value"; } flow.add(location(parentNode, String.format("%s [see L#%d].", message, methodDeclarationLine(parentNode)))); flow.addAll(selectedYield.getFlow(argumentIndex)); }
Source:
public void testHalfNumComputeTasks() { final int numComputeTasks = 4; final int availableEvaluators = numComputeTasks / 2 + 1; final Collection<EvaluatorParameters> activeEvaluators = generateEvaluatorParameters( numComputeTasks, new int[][]{{2500}, {2500}, {2500}, {2500}}); final int upperBoundToDelete = (int) Math.ceil((double) numComputeTasks / 2); final Plan plan = ilpSolverOptimizer.optimize(activeEvaluators, availableEvaluators); checkPlan(activeEvaluators, plan, availableEvaluators); assertEquals(0, plan.getEvaluatorsToAdd().size()); assertTrue("The number of evaluators to be deleted should be <= " + upperBoundToDelete, plan.getEvaluatorsToDelete().size() <= upperBoundToDelete); }

Target:
public void testHalfNumComputeTasks() { final int numComputeTasks = 4; final int availableEvaluators = numComputeTasks / 2 + 1; final Collection<EvaluatorParameters> activeEvaluators = generateEvaluatorParameters( numComputeTasks, new int[][]{{2500}, {2500}, {2500}, {2500}}); final int lowerBoundToDelete = (int) Math.ceil((double) numComputeTasks / 2); final Plan plan = ilpSolverOptimizer.optimize(activeEvaluators, availableEvaluators); checkPlan(activeEvaluators, plan, availableEvaluators); assertEquals(0, plan.getEvaluatorsToAdd().size()); assertTrue("The number of evaluators to be deleted should be >= " + lowerBoundToDelete, plan.getEvaluatorsToDelete().size() >= lowerBoundToDelete); }
Source:
private void findExcessSlots() { final Collection<ExcessResource> excessResources = new ArrayList<>(); for (ResourceProfile requirementProfile : resourceToRequirementMapping.getAllRequirementProfiles()) { int numTotalRequiredResources = resourceRequirements.getResourceCount(requirementProfile); int numTotalAcquiredResources = resourceToRequirementMapping.getNumFulfillingResources(requirementProfile); if (numTotalAcquiredResources > numTotalRequiredResources) { int numExcessResources = numTotalAcquiredResources - numTotalRequiredResources; for (Map.Entry<ResourceProfile, Integer> acquiredResource : resourceToRequirementMapping.getFulfillingResourcesFor(requirementProfile).getResourceProfilesWithCount()) { ResourceProfile acquiredResourceProfile = acquiredResource.getKey(); int numAcquiredResources = acquiredResource.getValue(); if (numAcquiredResources <= numExcessResources) { excessResources.add(new ExcessResource(requirementProfile, acquiredResourceProfile, numAcquiredResources)); numExcessResources -= numAcquiredResources; } else { excessResources.add(new ExcessResource(requirementProfile, acquiredResourceProfile, numExcessResources)); break; } } } } LOG.debug("Detected excess resources for job {}: {}", jobId, excessResources); for (ExcessResource excessResource : excessResources) { resourceToRequirementMapping.decrementCount(excessResource.requirementProfile, excessResource.resourceProfile, excessResource.numExcessResources); this.excessResources.incrementCount(excessResource.resourceProfile, excessResource.numExcessResources); } }

Target:
private void findExcessSlots() { final Collection<ExcessResource> excessResources = new ArrayList<>(); for (ResourceProfile requirementProfile : resourceToRequirementMapping.getAllRequirementProfiles()) { int numTotalRequiredResources = resourceRequirements.getResourceCount(requirementProfile); int numTotalAcquiredResources = resourceToRequirementMapping.getNumFulfillingResources(requirementProfile); if (numTotalAcquiredResources > numTotalRequiredResources) { int numExcessResources = numTotalAcquiredResources - numTotalRequiredResources; for (Map.Entry<ResourceProfile, Integer> acquiredResource : resourceToRequirementMapping.getResourcesFulfilling(requirementProfile).entrySet()) { ResourceProfile acquiredResourceProfile = acquiredResource.getKey(); int numAcquiredResources = acquiredResource.getValue(); if (numAcquiredResources <= numExcessResources) { excessResources.add(new ExcessResource(requirementProfile, acquiredResourceProfile, numAcquiredResources)); numExcessResources -= numAcquiredResources; } else { excessResources.add(new ExcessResource(requirementProfile, acquiredResourceProfile, numExcessResources)); break; } } } } LOG.debug("Detected excess resources for job {}: {}", jobId, excessResources); for (ExcessResource excessResource : excessResources) { resourceToRequirementMapping.decrementCount(excessResource.requirementProfile, excessResource.resourceProfile, excessResource.numExcessResources); this.excessResources.incrementCount(excessResource.resourceProfile, excessResource.numExcessResources); } }
Source:
private static List<SearchVariantsRequest> getShardedRequests(String variantSetId, String contig, long start, long end) { long basesPerShard = 1000000; double shards = Math.ceil((end - start) / (double) basesPerShard); List<SearchVariantsRequest> requests = Lists.newArrayList(); for (int i = 0; i < shards; i++) { long shardStart = start + (i * basesPerShard); long shardEnd = Math.min(end, shardStart + basesPerShard); LOG.info("Adding request with " + contig + " " + shardStart + " to " + shardEnd); requests.add(new SearchVariantsRequest() <<<<<<< HEAD .setVariantsetId(options.datasetId) .setContig(contig) .setStartPosition(shardStart) .setEndPosition(shardEnd)); ======= .setVariantSetIds(Collections.singletonList(variantSetId)) .setReferenceName(contig) .setStart(shardStart) .setEnd(shardEnd)); >>>>>>> master } return requests; }

Target:
private static List<SearchVariantsRequest> getShardedRequests(String variantSetId, String contig, long start, long end) { long basesPerShard = 1000000; double shards = Math.ceil((end - start) / (double) basesPerShard); List<SearchVariantsRequest> requests = Lists.newArrayList(); for (int i = 0; i < shards; i++) { long shardStart = start + (i * basesPerShard); long shardEnd = Math.min(end, shardStart + basesPerShard); LOG.info("Adding request with " + contig + " " + shardStart + " to " + shardEnd); requests.add(new SearchVariantsRequest() .setVariantSetIds(Collections.singletonList(variantSetId)) .setReferenceName(contig) .setStart(shardStart) .setEnd(shardEnd)); } return requests; }
Source:
public void testExpectedContextWhenSNSDisabled() { this.contextRunner .withPropertyValues( "genie.notifications.sns.enabled=false" ) .run( (context) -> { System.out.println(context); Assertions.assertThat(context).doesNotHaveBean(AWSAutoConfiguration.SNS_CLIENT_BEAN_NAME); } ); }

Target:
public void testExpectedContextWhenSNSDisabled() { this.contextRunner .withPropertyValues( "genie.notifications.sns.enabled=false" ).run( (context) -> { Assertions.assertThat(context).doesNotHaveBean(AWSAutoConfiguration.SNS_CLIENT_BEAN_NAME); } ); }
Source:
public FieldProjectionContext<Object> rawField(String absoluteFieldPath) { return field( absoluteFieldPath, Object.class ); }

Target:
public FieldProjectionContext<Object> rawField(String absoluteFieldPath) { return rawField( absoluteFieldPath, Object.class ); }
Source:
public static Builder defaultBuilder() { return new Builder() .addRecognizedErrors(asList(StandardErrorCode.values())) .addRecognizedErrors(asList(HiveErrorCode.values())) .addRecognizedErrors(asList(JdbcErrorCode.values())) .addRecognizedErrors(asList(ThriftErrorCode.values())) .addRetryableError(NO_NODES_AVAILABLE) .addRetryableError(REMOTE_TASK_ERROR) .addRetryableError(SERVER_SHUTTING_DOWN) .addRetryableError(SERVER_STARTING_UP) .addRetryableError(TOO_MANY_REQUESTS_FAILED) .addRetryableError(PAGE_TRANSPORT_ERROR) .addRetryableError(PAGE_TRANSPORT_TIMEOUT) .addRetryableError(REMOTE_HOST_GONE) .addRetryableError(ABANDONED_TASK) .addRetryableError(HIVE_CURSOR_ERROR) .addRetryableError(HIVE_FILE_NOT_FOUND) .addRetryableError(HIVE_TOO_MANY_OPEN_PARTITIONS) .addRetryableError(HIVE_WRITER_OPEN_ERROR) .addRetryableError(HIVE_WRITER_CLOSE_ERROR) .addRetryableError(HIVE_WRITER_DATA_ERROR) .addRetryableError(HIVE_FILESYSTEM_ERROR) .addRetryableError(HIVE_CANNOT_OPEN_SPLIT) .addRetryableError(HIVE_METASTORE_ERROR) .addRetryableError(JDBC_ERROR) .addRetryableError(THRIFT_SERVICE_CONNECTION_ERROR) .addRetryableError(EXCEEDED_TIME_LIMIT, Optional.of(DESCRIBE), Optional.empty()) .addResubmittedError(HIVE_PARTITION_DROPPED_DURING_QUERY) .addResubmittedError(HIVE_TABLE_DROPPED_DURING_QUERY) .addResubmittedError(SYNTAX_ERROR, Optional.of(CONTROL_SETUP), Optional.of(TABLE_ALREADY_EXISTS_PATTERN)) .addResubmittedError(SYNTAX_ERROR, Optional.of(TEST_SETUP), Optional.of(TABLE_ALREADY_EXISTS_PATTERN)); }

Target:
public static Builder defaultBuilder() { return new Builder() .addRecognizedErrors(asList(StandardErrorCode.values())) .addRecognizedErrors(asList(HiveErrorCode.values())) .addRecognizedErrors(asList(JdbcErrorCode.values())) .addRecognizedErrors(asList(ThriftErrorCode.values())) .addRetryableError(NO_NODES_AVAILABLE) .addRetryableError(REMOTE_TASK_ERROR) .addRetryableError(SERVER_SHUTTING_DOWN) .addRetryableError(SERVER_STARTING_UP) .addRetryableError(TOO_MANY_REQUESTS_FAILED) .addRetryableError(PAGE_TRANSPORT_ERROR) .addRetryableError(PAGE_TRANSPORT_TIMEOUT) .addRetryableError(REMOTE_HOST_GONE) .addRetryableError(ABANDONED_TASK) .addRetryableError(HIVE_CURSOR_ERROR) .addRetryableError(HIVE_FILE_NOT_FOUND) .addRetryableError(HIVE_TOO_MANY_OPEN_PARTITIONS) .addRetryableError(HIVE_WRITER_OPEN_ERROR) .addRetryableError(HIVE_WRITER_CLOSE_ERROR) .addRetryableError(HIVE_WRITER_DATA_ERROR) .addRetryableError(HIVE_FILESYSTEM_ERROR) .addRetryableError(HIVE_CANNOT_OPEN_SPLIT) .addRetryableError(HIVE_METASTORE_ERROR) .addRetryableError(JDBC_ERROR) .addRetryableError(THRIFT_SERVICE_CONNECTION_ERROR) .addRetryableError(EXCEEDED_TIME_LIMIT, Optional.of(DESCRIBE), Optional.empty()) .addResubmittedError(HIVE_PARTITION_DROPPED_DURING_QUERY) .addResubmittedError(HIVE_TABLE_DROPPED_DURING_QUERY) .addResubmittedError(CLUSTER_OUT_OF_MEMORY) .addResubmittedError(ADMINISTRATIVELY_PREEMPTED) .addResubmittedError(SYNTAX_ERROR, Optional.of(CONTROL_SETUP), Optional.of(TABLE_ALREADY_EXISTS_PATTERN)) .addResubmittedError(SYNTAX_ERROR, Optional.of(TEST_SETUP), Optional.of(TABLE_ALREADY_EXISTS_PATTERN)); }
Source:
public boolean parse(ByteBuffer buffer) throws IOException { int tag; while (true) { buffer.mark(); int beginning = buffer.position(); tag = FIXTags.get(buffer); if (tag == 0) { buffer.reset(); return false; } if (!beginString.get(buffer)) { buffer.reset(); return false; } if (tag != BeginString) continue; int position = buffer.position(); tag = FIXTags.get(buffer); if (tag == 0) { buffer.reset(); return false; } if (!bodyLength.get(buffer)) { buffer.reset(); return false; } if (tag != BodyLength) { buffer.position(position); continue; } int length = (int)bodyLength.asInt(); if (buffer.remaining() < length + 7) { buffer.reset(); return false; } position = buffer.position(); if (checkSumEnabled) { buffer.position(position + length); tag = FIXTags.get(buffer); if (tag == 0) continue; if (!checkSum.get(buffer)) continue; if (tag != CheckSum) continue; if ((FIXCheckSums.sum(buffer, beginning, position - beginning + length) & (256 - 1)) != checkSum.asCheckSum()) continue; buffer.position(position); } int limit = buffer.limit(); buffer.limit(position + length); boolean garbled = message.get(buffer) == false; buffer.limit(limit); buffer.position(position + length + 7); if (garbled) continue; listener.message(message); return true; } }

Target:
public boolean parse(ByteBuffer buffer) throws IOException { int tag; while (true) { buffer.mark(); int beginning = buffer.position(); tag = FIXTags.get(buffer); if (tag == 0) { buffer.reset(); return false; } if (!beginString.get(buffer)) { buffer.reset(); return false; } if (tag != BeginString) continue; int position = buffer.position(); tag = FIXTags.get(buffer); if (tag == 0) { buffer.reset(); return false; } if (!bodyLength.get(buffer)) { buffer.reset(); return false; } if (tag != BodyLength) { buffer.position(position); continue; } int length = (int)bodyLength.asInt(); if (buffer.remaining() < length + 7) { buffer.reset(); return false; } position = buffer.position(); if (checkSumEnabled) { buffer.position(position + length); tag = FIXTags.get(buffer); if (tag == 0) continue; if (!checkSum.get(buffer)) continue; if (tag != CheckSum) continue; if ((FIXCheckSums.sum(buffer, beginning, position - beginning + length) & 0xff) != checkSum.asCheckSum()) continue; buffer.position(position); } int limit = buffer.limit(); buffer.limit(position + length); boolean garbled = message.get(buffer) == false; buffer.limit(limit); buffer.position(position + length + 7); if (garbled) continue; listener.message(message); return true; } }
Source:
public Ldap() { super(0); }

Target:
public Ldap() { setMinPoolSize(0); }
Source:
public void close() { isOpen = false; wrappedIterator.close(); if (metrics.UMI_LENGTH > 0) { collectMetrics(); } }

Target:
public void close() { isOpen = false; wrappedIterator.close(); metrics.calculateDerivedFields(); }
Source:
private PatchLink createLink(int index, PatchScreen.Type patchType, String before, String after) { Patch patch = patchList.get(index); String fileName = patch.getFileName(); Key thisKey = patch.getKey(); PatchLink result = null; switch (patchType) { case UNIFIED: result = new PatchLink.Unified(before + " " + fileName + " " + after, thisKey, index, this); break; case SIDE_BY_SIDE: result = new PatchLink.SideBySide(before + " " + fileName + " " + after, thisKey, index, this); break; } return result; }

Target:
private PatchLink createLink(int index, PatchScreen.Type patchType, String before, String after) { Patch patch = patchList.get(index); String fileName = patch.getFileName(); int s = fileName.indexOf(File.pathSeparator); if (s >= 0) { fileName.substring(s + 1); } Key thisKey = patch.getKey(); PatchLink result = null; String linkText = before + " " + fileName + " " + after; if (patchType == PatchScreen.Type.SIDE_BY_SIDE && patch.getPatchType() == Patch.PatchType.UNIFIED) { result = new PatchLink.SideBySide(linkText, thisKey, index, this); } else { result = new PatchLink.Unified(linkText, thisKey, index, this); } return result; }
Source:
public void killPlugin(String name, long maxWaitTime, boolean reloading) { for (PluginInfoWrapper pluginInfoWrapper : pluginWrappers) { if (pluginInfoWrapper.getThreadName().equals(name)) { pluginInfoWrapper.stopPlugin(this, maxWaitTime, reloading); } } }

Target:
public void killPlugin(String name, long maxWaitTime, boolean reloading) { for (PluginInfoWrapper pluginInfoWrapper : loadedPlugins.getLoadedPlugins()) { if (pluginInfoWrapper.getThreadName().equals(name)) { pluginInfoWrapper.stopPlugin(this, maxWaitTime, reloading); break; } } }
Source:
public void onReceive(Context context, Intent intent) { final String methodName = "onReceive"; if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) { Logger.v(TAG + methodName, "Application install message is received"); if (intent.getData() != null) { Logger.v(TAG + methodName, "ApplicationReceiver detectes the installation of " + intent.getData().toString()); final String receivedInstalledPackageName = intent.getData().toString(); if (receivedInstalledPackageName.equalsIgnoreCase("package:" + AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME) || receivedInstalledPackageName.equalsIgnoreCase("package:" + AuthenticationSettings.INSTANCE.getBrokerPackageName())) { String installedPackageName = receivedInstalledPackageName.equalsIgnoreCase("package:" + AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME)? AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME : AuthenticationConstants.Broker.COMPANY_PORTAL_APP_PACKAGE_NAME; String request = getInstallRequestInthisApp(context); brokerProxy = new BrokerProxy(context); final Date dateTimeForSavedRequest = new Date(getInstallRequestTimeStamp(context)); if (!StringExtensions.IsNullOrBlank(request) && brokerProxy.canSwitchToBroker() && isRequestTimestampValidForResume(dateTimeForSavedRequest)) { Logger.v(TAG + methodName, receivedInstalledPackageName + " is installed, start sending request to broker."); resumeRequestInBroker(context, request); } else { Logger.v(TAG + methodName, "No request saved in sharedpreferences or request already timeout" + ", cannot resume broker request."); } } } } }

Target:
public void onReceive(Context context, Intent intent) { final String methodName = "onReceive"; if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) { Logger.v(TAG + methodName, "Application install message is received"); if (intent.getData() != null) { Logger.v(TAG + methodName, "ApplicationReceiver detectes the installation of " + intent.getData().toString()); final String receivedInstalledPackageName = intent.getData().toString(); if (receivedInstalledPackageName.equalsIgnoreCase("package:" + AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME) || receivedInstalledPackageName.equalsIgnoreCase("package:" + AuthenticationSettings.INSTANCE.getBrokerPackageName())) { String request = getInstallRequestInthisApp(context); brokerProxy = new BrokerProxy(context); final Date dateTimeForSavedRequest = new Date(getInstallRequestTimeStamp(context)); if (!StringExtensions.IsNullOrBlank(request) && brokerProxy.canSwitchToBroker() && isRequestTimestampValidForResume(dateTimeForSavedRequest)) { Logger.v(TAG + methodName, receivedInstalledPackageName + " is installed, start sending request to broker."); resumeRequestInBroker(context, request); } else { Logger.v(TAG + methodName, "No request saved in sharedpreferences or request already timeout" + ", cannot resume broker request."); } } } } }
Source:
public static <T> QosClient.QueryWeigher<T> writeWeigher(long numRows, Supplier<Long> bytesWritten) { Supplier<Long> weight = Suppliers.memoize(() -> safeGetNumBytesOrDefault(bytesWritten))::get; return new QosClient.QueryWeigher<T>() { @Override public QueryWeight estimate() { return ImmutableQueryWeight.builder() .from(DEFAULT_ESTIMATED_WEIGHT) .numBytes(weight.get()) .numDistinctRows(numRows) .build(); } @Override public QueryWeight weigh(T result, long timeTakenNanos) { return ImmutableQueryWeight.builder() .from(estimate()) .timeTakenNanos((int) timeTakenNanos) .build(); } }; }

Target:
public static <T> QosClient.QueryWeigher<T> writeWeigher(long numRows, Supplier<Long> bytesWritten) { Supplier<Long> weight = Suppliers.memoize(() -> safeGetNumBytesOrDefault(bytesWritten))::get; return new QosClient.QueryWeigher<T>() { @Override public QueryWeight estimate() { return ImmutableQueryWeight.builder() .from(DEFAULT_ESTIMATED_WEIGHT) .numBytes(weight.get()) .numDistinctRows(numRows) .build(); } @Override public QueryWeight weigh(T result, long timeTakenNanos) { return ImmutableQueryWeight.builder() .from(estimate()) .timeTakenNanos(timeTakenNanos) .build(); } }; }
Source:
public static List<List<BakedQuad>> sortQuadsByIndex(IBakedModel model) { List<List<BakedQuad>> layers = new ArrayList(); List<BakedQuad> quads = new ArrayList(); for (EnumFacing dir : EnumFacing.values()) { quads.addAll(model.getQuads(null, dir, 0)); } quads.addAll(model.getQuads(null, null, 0)); for (BakedQuad quad : quads) { int index = quad.hasTintIndex() ? quad.getTintIndex() : 0; try { layers.get(index); } catch (IndexOutOfBoundsException e) { layers.add(index, new ArrayList()); } layers.get(index).add(quad); } return layers; }

Target:
public static List<List<BakedQuad>> sortQuadsByIndex(IBakedModel model) { List<List<BakedQuad>> layers = new ArrayList(); List<BakedQuad> quads = new ArrayList(); for (EnumFacing dir : EnumFacing.values()) { quads.addAll(model.getQuads(null, dir, 0)); } quads.addAll(model.getQuads(null, null, 0)); for (BakedQuad quad : quads) { int index = quad.hasTintIndex() ? quad.getTintIndex() : 0; if (index >= layers.size()) layers.add(index, new ArrayList()); layers.get(index).add(quad); } return layers; }
Source:
public static PublicKey getPublicKey(KeyPairType type, byte[] pub) throws UnsupportedTypeException{ if(type.equals(KeyPairType.DSA)){ throw new UnsupportedTypeException(type); } try { KeyFactory kf = KeyFactory.getInstance(type.alg); X509EncodedKeySpec xks = new X509EncodedKeySpec(pub); return kf.generatePublic(xks); } catch (GeneralSecurityException e) { Logger.error(KeyGenUtils.class, "Internal error; please report:", e); } return null; }

Target:
public static PublicKey getPublicKey(KeyPairType type, byte[] pub){ if(type.equals(KeyPairType.DSA)){ throw new UnsupportedTypeException(type); } try { KeyFactory kf = KeyFactory.getInstance(type.alg); X509EncodedKeySpec xks = new X509EncodedKeySpec(pub); return kf.generatePublic(xks); } catch (GeneralSecurityException e) { Logger.error(KeyGenUtils.class, "Internal error; please report:", e); } return null; }
Source:
public synchronized static void upgradeTo7Dot1() { final SharedPreferences prefs = SalesforceSDKManager.getInstance().getAppContext().getSharedPreferences(SHARED_PREF_FILE, 0); final Map<String, ?> prefContents = prefs.getAll(); if (prefContents != null) { final Set<String> keys = prefContents.keySet(); for (final String key : keys) { if (key != null && key.startsWith("id")) { final String value = prefs.getString(key, null); if (value != null) { final PublicKey publicKey = KeyStoreWrapper.getInstance().getECPublicKey(KEYSTORE_ALIAS); final String encryptedValue = Encryptor.encryptWithRSA(publicKey, value); storeInSharedPrefs(key, encryptedValue); prefs.edit().remove(key).commit(); } } } } }

Target:
public synchronized static void upgradeTo7Dot1() { final SharedPreferences prefs = SalesforceSDKManager.getInstance().getAppContext().getSharedPreferences(SHARED_PREF_FILE, 0); final Map<String, ?> prefContents = prefs.getAll(); if (prefContents != null) { final Set<String> keys = prefContents.keySet(); for (final String key : keys) { if (key != null && key.startsWith("id")) { final String value = prefs.getString(key, null); if (value != null) { final PublicKey publicKey = KeyStoreWrapper.getInstance().getRSAPublicKey(KEYSTORE_ALIAS); final String keyBase = key.replaceFirst(ID_PREFIX, ""); final String mutatedValue = value + String.format(Locale.US, ADDENDUM, keyBase); final String encryptedValue = Encryptor.encryptWithRSA(publicKey, mutatedValue); storeInSharedPrefs(key, encryptedValue); prefs.edit().remove(key).commit(); } } } } }
Source:
public Capabilities getCapabilities() { return this.capabilities; }

Target:
public Capabilities getCapabilities() { return capabilities; }
Source:
public TestClass(Class<?> klass) { fClass = klass; if (klass != null && klass.getConstructors().length > 1) { throw new IllegalArgumentException( "Test class can only have one constructor"); } Map<Class<? extends Annotation>, List<FrameworkMethod>> methodsForAnnotations = new LinkedHashMap<Class<? extends Annotation>, List<FrameworkMethod>>(); Map<Class<? extends Annotation>, List<FrameworkField>> fieldsForAnnotations = new LinkedHashMap<Class<? extends Annotation>, List<FrameworkField>>(); for (Class<?> eachClass : getSuperClasses(fClass)) { for (Method eachMethod : MethodSorter.getDeclaredMethods(eachClass)) { addToAnnotationLists(new FrameworkMethod(eachMethod), methodsForAnnotations); } for (Field eachField : getSortedDeclaredFields(eachClass)) { addToAnnotationLists(new FrameworkField(eachField), fieldsForAnnotations); } } fMethodsForAnnotations = Collections.unmodifiableMap(methodsForAnnotations); fFieldsForAnnotations = Collections.unmodifiableMap(fieldsForAnnotations); }

Target:
public TestClass(Class<?> klass) { fClass = klass; if (klass != null && klass.getConstructors().length > 1) { throw new IllegalArgumentException( "Test class can only have one constructor"); } Map<Class<? extends Annotation>, List<FrameworkMethod>> methodsForAnnotations = new LinkedHashMap<Class<? extends Annotation>, List<FrameworkMethod>>(); Map<Class<? extends Annotation>, List<FrameworkField>> fieldsForAnnotations = new LinkedHashMap<Class<? extends Annotation>, List<FrameworkField>>(); scanAnnotatedMembers(methodsForAnnotations, fieldsForAnnotations); fMethodsForAnnotations = makeDeeplyUnmodifiable(methodsForAnnotations); fFieldsForAnnotations = makeDeeplyUnmodifiable(fieldsForAnnotations); }
Source:
private String getSubtypeString(COSBase item) { if (item instanceof COSString) return ((COSString) item).getString(); else if (item instanceof COSName) return ((COSName) item).getName(); else if (item instanceof COSObject) return getSubtypeString(((COSObject) item).getObject()); else return null; }

Target:
private String getSubtypeString(COSBase item) { if (item instanceof COSString) { return ((COSString) item).getString(); } else if (item instanceof COSName) { return ((COSName) item).getName(); } else if (item instanceof COSObject) { return getSubtypeString(((COSObject) item).getObject()); } else { return null; } }
Source:
public void testWritePlan() throws MalformedURLException, ParseException, URISyntaxException { Bpmn4JsonParser parser = new Bpmn4JsonParser(); URI uri = Paths.get("src/test/resources/bpmn4tosca/bpmn4tosca.json") .toUri(); parser.parse(uri); }

Target:
public void testWritePlan() throws MalformedURLException, ParseException, URISyntaxException { Bpmn4JsonParser parser = new Bpmn4JsonParser(); URI uri = Paths.get("src/test/resources/bpmn4tosca/bpmn4tosca.json").toUri(); ManagementFlow mngmtFlow = parser.parse(uri); }
Source:
public void kill() { try { JobConfig jc = new JobConfig(JobConfigUtil.generateJobIdAndName(appDesc.getConfig())); LOG.info("Killing job {}", jc.getName()); JobRunner runner = new JobRunner(jc); runner.kill(); } catch (Throwable t) { throw new SamzaException("Failed to kill application", t); } }

Target:
public void kill() { try { JobConfig jc = new JobConfig(JobPlanner.generateSingleJobConfig(appDesc.getConfig())); LOG.info("Killing job {}", jc.getName()); JobRunner runner = new JobRunner(jc); runner.kill(); } catch (Throwable t) { throw new SamzaException("Failed to kill application", t); } }
Source:
private boolean perform(Run src, Run<?,?> dst, String expandedFilter, String expandedExcludes, FilePath targetDir, FilePath baseTargetDir, Copier copier, PrintStream console) throws IOException, InterruptedException { FilePath srcDir = selector.getSourceDirectory(src, console); if (srcDir == null) { return isOptional(); } copier.init(src,dst,srcDir,baseTargetDir); try { int cnt; if (!isFlatten()) cnt = copier.copyAll(srcDir, expandedFilter, expandedExcludes, targetDir, isFingerprintArtifacts()); else { targetDir.mkdirs(); FilePath[] list = srcDir.list(expandedFilter, expandedExcludes, false); for (FilePath file : list) copier.copyOne(file, new FilePath(targetDir, file.getName()), isFingerprintArtifacts()); cnt = list.length; } console.println(Messages.CopyArtifact_Copied(cnt, HyperlinkNote.encodeTo('/'+ src.getParent().getUrl(), src.getParent().getFullDisplayName()), HyperlinkNote.encodeTo('/'+src.getUrl(), Integer.toString(src.getNumber())))); return cnt > 0 || isOptional(); } finally { copier.end(); } }

Target:
private boolean perform(Run src, Run<?,?> dst, String expandedFilter, String expandedExcludes, FilePath targetDir, FilePath baseTargetDir, Copier copier, PrintStream console) throws IOException, InterruptedException { FilePath srcDir = selector.getSourceDirectory(src, console); if (srcDir == null) { return isOptional(); } copier.initialize(src, dst, srcDir, baseTargetDir); try { int cnt; if (!isFlatten()) cnt = copier.copyAll(srcDir, expandedFilter, expandedExcludes, targetDir, isFingerprintArtifacts()); else { targetDir.mkdirs(); FilePath[] list = srcDir.list(expandedFilter, expandedExcludes, false); for (FilePath file : list) copier.copyOne(file, new FilePath(targetDir, file.getName()), isFingerprintArtifacts()); cnt = list.length; } console.println(Messages.CopyArtifact_Copied(cnt, HyperlinkNote.encodeTo('/'+ src.getParent().getUrl(), src.getParent().getFullDisplayName()), HyperlinkNote.encodeTo('/'+src.getUrl(), Integer.toString(src.getNumber())))); return cnt > 0 || isOptional(); } finally { copier.end(); } }
Source:
protected int destination(int offset, TextContent content, int count) throws CommandExecutionException { LineInformation line = content.getLineInformationOfOffset(offset); ParenthesesPair pair = null; int startIndex = offset; if (offset == line.getEndOffset() && line.getLength() > 0) { startIndex--; } for (int index = startIndex; index < line.getEndOffset(); index++) { String c = content.getText(index, 1); if (PARENTHESES.containsKey(c)) { pair = PARENTHESES.get(c); return findMatch(index, pair, content, count); } } if (pair == null) { pair = getBlockComment(offset, content); if(pair != null) { return findBlockMatch(offset, pair, content); } } if (CPreProcessorMove.containsPreProcessor(content, line, offset)) { return new CPreProcessorMove().destination(offset, content, count); } throw new CommandExecutionException("no parentheses to jump found"); }

Target:
protected int destination(int offset, TextContent content, int count) throws CommandExecutionException { LineInformation line = content.getLineInformationOfOffset(offset); int startIndex = offset; if (offset == line.getEndOffset() && line.getLength() > 0) { startIndex--; } for (int index = startIndex; index < line.getEndOffset(); index++) { String c = content.getText(index, 1); if (PARENTHESES.containsKey(c)) { return findMatch(index, PARENTHESES.get(c), content, count); } } ParenthesesPair pair = getBlockComment(offset, content); if (pair != null) { return findBlockMatch(offset, pair, content); } if (CPreProcessorMove.containsPreProcessor(content, line, offset)) { return new CPreProcessorMove().destination(offset, content, count); } throw new CommandExecutionException("no parentheses to jump found"); }
Source:
public TimestampIncrementingTableQuerier(QueryMode mode, String name, String topicPrefix, String timestampColumn, Long timestampOffset, String incrementingColumn, Long incrementingOffset, Long timestampDelay) { super(mode, name, topicPrefix); this.timestampColumn = timestampColumn; this.timestampOffset = timestampOffset; this.incrementingColumn = incrementingColumn; this.incrementingOffset = incrementingOffset; this.timestampDelay = timestampDelay == null ? 0L : timestampDelay; }

Target:
public TimestampIncrementingTableQuerier(QueryMode mode, String name, String topicPrefix, String timestampColumn, Long timestampOffset, String incrementingColumn, Long incrementingOffset, Long timestampDelay) { super(mode, name, topicPrefix); this.timestampColumn = timestampColumn; this.timestampOffset = timestampOffset; this.incrementingColumn = incrementingColumn; this.incrementingOffset = incrementingOffset; this.timestampDelay = timestampDelay; }
Source:
private LookupScenarioFxRateProvider(ScenarioMarketData marketData, FxRateLookup lookup) { this.marketData = marketData; this.lookup = lookup; }

Target:
private LookupScenarioFxRateProvider(ScenarioMarketData marketData, FxRateLookup lookup) { this.marketData = ArgChecker.notNull(marketData, "marketData"); this.lookup = ArgChecker.notNull(lookup, "lookup"); }
Source:
private void init() { try { getWorkbench().addWindowListener(WINDOW_LISTENER); IWorkbenchWindow[] windows = getWorkbench().getWorkbenchWindows(); if (windows.length > 0) { launchingWorkbenchWindow = windows[0]; } for (IWorkbenchWindow window : windows) { addListenersToWindow(window); } monitors.add(new WorkbenchUserActivityMonitor()); new MonitorUiExtensionPointReader().initExtensions(); activityContextManager.init(monitors); updateActivityTimout(); activityContextManager.start(); setActivityTrackingEnabled(getPreferenceStore().getBoolean(ACTIVITY_TRACKING_ENABLED)); getPreferenceStore().addPropertyChangeListener(PROPERTY_LISTENER); } catch (Exception e) { StatusHandler.log(new Status(IStatus.ERROR, MonitorUiPlugin.ID_PLUGIN, "Monitor UI start failed", e)); } }

Target:
private void init() { try { getWorkbench().addWindowListener(WINDOW_LISTENER); IWorkbenchWindow[] windows = getWorkbench().getWorkbenchWindows(); if (windows.length > 0) { launchingWorkbenchWindow = windows[0]; } for (IWorkbenchWindow window : windows) { addListenersToWindow(window); } MonitorUiExtensionPointReader.initExtensions(monitors); monitors.add(new WorkbenchUserActivityMonitor()); activityContextManager.init(monitors); updateActivityTimout(); activityContextManager.start(); setActivityTrackingEnabled(getPreferenceStore().getBoolean(ACTIVITY_TRACKING_ENABLED)); getPreferenceStore().addPropertyChangeListener(PROPERTY_LISTENER); } catch (Exception e) { StatusHandler.log(new Status(IStatus.ERROR, MonitorUiPlugin.ID_PLUGIN, "Monitor UI start failed", e)); } }
Source:
public void setLoginRequest(SiteNode loginSiteNode) throws Exception { this.loginSiteNode = loginSiteNode; HttpMessage requestMessage = loginSiteNode.getHistoryReference().getHttpMessage(); this.loginRequestURL = requestMessage.getRequestHeader().getURI().toString(); if (!requestMessage.getRequestHeader().getMethod().equals(HttpRequestHeader.GET)) { this.loginRequestBody = requestMessage.getRequestBody().toString(); } else { this.loginRequestBody = null; } }

Target:
public void setLoginRequest(SiteNode loginSiteNode) throws Exception { this.loginSiteNode = loginSiteNode; HttpMessage requestMessage = loginSiteNode.getHistoryReference().getHttpMessage(); this.loginRequestURL = requestMessage.getRequestHeader().getURI().toString(); if (!requestMessage.getRequestHeader().getMethod().equalsIgnoreCase(HttpRequestHeader.GET)) { this.loginRequestBody = requestMessage.getRequestBody().toString(); } else { this.loginRequestBody = null; } }
Source:
public void leavesPullRequestOpenWhenNoRebaseMode() throws Exception { final Repo repo = new MkGithub().randomRepo(); final Issue issue = repo.issues().create("", ""); final Profile profile = new Profile.Fixed( new XMLDocument( StringUtils.join( "<p> <entry key='merge'>", " <entry key='rebase'>false</entry>", "</entry> </p>" ) ) ); final Agent agent = new ClosePullRequest(profile, repo.github()); final Talk talk = ClosePullRequestTest.createTalk(repo, issue); agent.execute(talk); MatcherAssert.assertThat( new Issue.Smart(issue).state(), Matchers.is("open") ); }

Target:
public void leavesPullRequestOpenWhenNoRebaseMode() throws Exception { final Repo repo = new MkGithub().randomRepo(); final Issue issue = repo.issues().create("", ""); final Profile profile = new Profile.Fixed( new XMLDocument( StringUtils.join( "<p> <entry key='merge'>", " <entry key='rebase'>false</entry>", "</entry> </p>" ) ) ); final Talk talk = ClosePullRequestTest.talk(repo, issue); new ClosePullRequest(profile, repo.github()).execute(talk); final Issue.Smart smart = new Issue.Smart(issue); MatcherAssert.assertThat( smart.state(), Matchers.is("open") ); MatcherAssert.assertThat( smart.comments().iterate(), Matchers.is(Matchers.<Comment>emptyIterable()) ); }
Source:
private boolean warnIfReferenceIsTooLargeForBinField(final SAMRecord rec) { final SAMSequenceRecord sequence = rec.getHeader() != null ? rec.getHeader().getSequence(rec.getReferenceName()) : null; final boolean tooLarge = sequence != null && SAMUtils.isReferenceSequenceIncompatibleWithBAI(sequence); if (!isReferenceSizeWarningShowed & tooLarge && rec.getValidationStringency() != ValidationStringency.SILENT) { LOG.warn("Reference length is too large for BAM bin field."); LOG.warn("Reads on references longer than " + GenomicIndexUtil.BIN_GENOMIC_SPAN + "bp will have bin set to 0."); isReferenceSizeWarningShowed = true; } return tooLarge; }

Target:
private boolean warnIfReferenceIsTooLargeForBinField(final SAMRecord rec) { final SAMSequenceRecord sequence = rec.getHeader() != null ? rec.getHeader().getSequence(rec.getReferenceName()) : null; final boolean tooLarge = sequence != null && SAMUtils.isReferenceSequenceIncompatibleWithBAI(sequence); if (!isReferenceSizeWarningShowed && tooLarge && rec.getValidationStringency() != ValidationStringency.SILENT) { LOG.warn("Reference length is too large for BAM bin field."); LOG.warn("Reads on references longer than " + GenomicIndexUtil.BIN_GENOMIC_SPAN + "bp will have bin set to 0."); isReferenceSizeWarningShowed = true; } return tooLarge; }
Source:
private String getFolderName(File file) { if (file.getParentFile().getName().equals("jobs") && file.getParentFile().getParentFile().getParentFile().getName().equals("jobs")) { return file.getParentFile().getParentFile().getName(); } else return ""; }

Target:
private String getFolderName(File file) { if (isJobInFolder(file)) { File nextAncestor = file.getParentFile().getParentFile(); String folderName = ""; File jobConfigHistoryJobDirection = new File(PluginUtils.getPlugin().getConfiguredHistoryRootDir(), "jobs"); while (nextAncestor.isDirectory() && !nextAncestor.toString().equals(jobConfigHistoryJobDirection.toString())) { folderName = nextAncestor.getName() + (folderName.isEmpty() ? "" : "/") + folderName; nextAncestor = nextAncestor.getParentFile(); } return folderName; } else return ""; }
Source:
public SourceReference build() { if ( sourceName == null ) { return null; } String sourceNameTrimmed = sourceName.trim(); if ( !sourceName.equals( sourceNameTrimmed ) && messager != null ) { messager.printMessage( method.getExecutable(), annotationMirror, sourceAnnotationValue, Message.PROPERTYMAPPING_WHITESPACE_TRIMMED, sourceName, sourceNameTrimmed ); } String[] segments = sourceNameTrimmed.split( "\\." ); SourceReference result = new SourceReference( null, new ArrayList<>( ), false ); if ( method.getSourceParameters().size() > 1 ) { Parameter parameter = fetchMatchingParameterFromFirstSegment( segments ); if ( parameter != null ) { result = buildFromMultipleSourceParameters( segments, parameter ); } } else { Parameter parameter = method.getSourceParameters().get( 0 ); result = buildFromSingleSourceParameters( segments, parameter ); } return result; }

Target:
public SourceReference build() { if ( sourceName == null ) { return null; } Objects.requireNonNull( messager ); String sourceNameTrimmed = sourceName.trim(); if ( !sourceName.equals( sourceNameTrimmed ) ) { messager.printMessage( method.getExecutable(), annotationMirror, sourceAnnotationValue, Message.PROPERTYMAPPING_WHITESPACE_TRIMMED, sourceName, sourceNameTrimmed ); } String[] segments = sourceNameTrimmed.split( "\\." ); SourceReference result = new SourceReference( null, new ArrayList<>( ), false ); if ( method.getSourceParameters().size() > 1 ) { Parameter parameter = fetchMatchingParameterFromFirstSegment( segments ); if ( parameter != null ) { result = buildFromMultipleSourceParameters( segments, parameter ); } } else { Parameter parameter = method.getSourceParameters().get( 0 ); result = buildFromSingleSourceParameters( segments, parameter ); } return result; }
Source:
public boolean isAuthorized(AuthenticatedClient authenticatedClient, TimelockNamespace namespace) { return !namespaceLocker.isLocked(namespace) || privileges.getOrDefault(authenticatedClient, Privileges.EMPTY).hasPrivilege(namespace); }

Target:
public boolean isAuthorized(AuthenticatedClient authenticatedClient, TimelockNamespace namespace) { return !namespaceLocker.isLocked(namespace) || privileges.getOrDefault(authenticatedClient.id(), Privileges.EMPTY).hasPrivilege(namespace); }
Source:
public void testQueryGroupedInput(final File input) { final AbstractMarkDuplicatesCommandLineProgramTester tester = new BySumOfBaseQAndInOriginalOrderMDTester(); final SamReader reader = SamReaderFactory.makeDefault().open(input); tester.setHeader(reader.getFileHeader()); reader.iterator().stream().forEach(tester::addRecord); CloserUtil.close(reader); tester.setExpectedOpticalDuplicate(0); tester.addArg("ASSUME_SORT_ORDER=queryname"); tester.runTest(); }

Target:
public void testQueryGroupedInput(final File input) throws IOException { final AbstractMarkDuplicatesCommandLineProgramTester tester = new BySumOfBaseQAndInOriginalOrderMDTester(); try(final SamReader reader = SamReaderFactory.makeDefault().open(input)) { tester.setHeader(reader.getFileHeader()); reader.iterator().stream().forEach(tester::addRecord); } tester.setExpectedOpticalDuplicate(0); tester.addArg("ASSUME_SORT_ORDER=queryname"); tester.runTest(); }
Source:
public void testBundleRuntimeExecutionEnvironment() throws Exception { File basedir = getBasedir("projects/bree"); Properties properties = new Properties(); properties.put("tycho-version", TychoVersion.getTychoVersion()); List<MavenProject> projects = getSortedProjects(basedir, properties, null); assertEquals(5, projects.size()); TychoProject bundleProject = lookup(TychoProject.class, ArtifactKey.TYPE_ECLIPSE_PLUGIN); assertEquals("executionenvironment.manifest", projects.get(1).getArtifactId()); assertEquals("CDC-1.0/Foundation-1.0", bundleProject.getExecutionEnvironment(projects.get(1)).getProfileName()); assertEquals("executionenvironment.pom-hard", projects.get(2).getArtifactId()); assertEquals("OSGi/Minimum-1.2", bundleProject.getExecutionEnvironment(projects.get(2)).getProfileName()); assertEquals("executionenvironment.pom-soft-buildproperties", projects.get(3).getArtifactId()); assertEquals("OSGi/Minimum-1.1", bundleProject.getExecutionEnvironment(projects.get(3)).getProfileName()); assertEquals("executionenvironment.pom-soft-manifest", projects.get(4).getArtifactId()); assertEquals("OSGi/Minimum-1.0", bundleProject.getExecutionEnvironment(projects.get(4)).getProfileName()); }

Target:
public void testBundleRuntimeExecutionEnvironment() throws Exception { File basedir = getBasedir("projects/bree"); Properties properties = new Properties(); properties.put("tycho-version", TychoVersion.getTychoVersion()); List<MavenProject> projects = getSortedProjects(basedir, properties, null); assertEquals(5, projects.size()); TychoProject bundleProject = lookup(TychoProject.class, ArtifactKey.TYPE_ECLIPSE_PLUGIN); assertEquals("executionenvironment.manifest", projects.get(1).getArtifactId()); assertEquals("CDC-1.0/Foundation-1.0", bundleProject.getExecutionEnvironment(projects.get(1)).getProfileName()); assertEquals("executionenvironment.pom-hard", projects.get(2).getArtifactId()); assertEquals("OSGi/Minimum-1.2", bundleProject.getExecutionEnvironment(projects.get(2)).getProfileName()); assertEquals("executionenvironment.buildproperties", projects.get(3).getArtifactId()); assertEquals("OSGi/Minimum-1.1", bundleProject.getExecutionEnvironment(projects.get(3)).getProfileName()); assertEquals("executionenvironment.pom-default", projects.get(4).getArtifactId()); assertEquals("OSGi/Minimum-1.2", bundleProject.getExecutionEnvironment(projects.get(4)).getProfileName()); }