auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void readDomainElementAttributes(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> list) throws XMLStreamException { final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { Namespace ns = Namespace.forUri(reader.getAttributeNamespace(i)); switch (ns) { case XML_SCHEMA_INSTANCE: { switch (Attribute.forName(reader.getAttributeLocalName(i))) { case SCHEMA_LOCATION: { parseSchemaLocations(reader, address, list, i); break; } case NO_NAMESPACE_SCHEMA_LOCATION: { break; } default: { throw unexpectedAttribute(reader, i); } } break; } default: switch (Attribute.forName(reader.getAttributeLocalName(i))) { case NAME: { ModelNode op = new ModelNode(); op.get(OP).set(WRITE_ATTRIBUTE_OPERATION); op.get(NAME).set(NAME); op.get(VALUE).set(ParseUtils.parsePossibleExpression(reader.getAttributeValue(i))); list.add(op); break; } case ORGANIZATION: case DOMAIN_ORGANIZATION: { ModelNode op = new ModelNode(); op.get(OP).set(WRITE_ATTRIBUTE_OPERATION); op.get(NAME).set(DOMAIN_ORGANIZATION); op.get(VALUE).set(ParseUtils.parsePossibleExpression(reader.getAttributeValue(i))); list.add(op); break; } default: throw unexpectedAttribute(reader, i); } } } }

Target:
protected void readDomainElementAttributes(XMLExtendedStreamReader reader, ModelNode address, List<ModelNode> list) throws XMLStreamException { boolean hasDomainOrg = false; final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { Namespace ns = Namespace.forUri(reader.getAttributeNamespace(i)); switch (ns) { case XML_SCHEMA_INSTANCE: { switch (Attribute.forName(reader.getAttributeLocalName(i))) { case SCHEMA_LOCATION: { parseSchemaLocations(reader, address, list, i); break; } case NO_NAMESPACE_SCHEMA_LOCATION: { break; } default: { throw unexpectedAttribute(reader, i); } } break; } default: switch (Attribute.forName(reader.getAttributeLocalName(i))) { case NAME: { ModelNode op = new ModelNode(); op.get(OP).set(WRITE_ATTRIBUTE_OPERATION); op.get(NAME).set(NAME); op.get(VALUE).set(ParseUtils.parsePossibleExpression(reader.getAttributeValue(i))); list.add(op); break; } case ORGANIZATION: { if (hasDomainOrg) { throw unexpectedAttribute(reader, i); } } case DOMAIN_ORGANIZATION: { ModelNode op = new ModelNode(); op.get(OP).set(WRITE_ATTRIBUTE_OPERATION); op.get(NAME).set(DOMAIN_ORGANIZATION); op.get(VALUE).set(ParseUtils.parsePossibleExpression(reader.getAttributeValue(i))); list.add(op); hasDomainOrg = true; break; } default: throw unexpectedAttribute(reader, i); } } } }
Source:
public MISTDefaultExecutionEnvironmentImpl(final String serverAddr, final int serverPort, final String runningJarPath) throws InjectionException, IOException { final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder(); cb.bindNamedParameter(MISTQuerySerializerImpl.RunningJarPath.class, runningJarPath); final Injector injector = Tang.Factory.getTang().newInjector(cb.build()); querySerializer = injector.getInstance(MISTQuerySerializer.class); final NettyTransceiver clientToDriver = new NettyTransceiver(new InetSocketAddress(serverAddr, serverPort)); this.proxyToDriver = SpecificRequestor.getClient(MistTaskProvider.class, clientToDriver); final TaskList taskList = proxyToDriver.getTasks(new QueryInfo()); this.tasks = taskList.getTasks(); this.taskProxyMap = new ConcurrentHashMap<IPAddress, ClientToTaskMessage>(); }

Target:
public MISTDefaultExecutionEnvironmentImpl(final String serverAddr, final int serverPort, final String runningJarPath) throws InjectionException, IOException { final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder(); cb.bindNamedParameter(RunningJarPath.class, runningJarPath); final Injector injector = Tang.Factory.getTang().newInjector(cb.build()); querySerializer = injector.getInstance(MISTQuerySerializer.class); final NettyTransceiver clientToDriver = new NettyTransceiver(new InetSocketAddress(serverAddr, serverPort)); this.proxyToDriver = SpecificRequestor.getClient(MistTaskProvider.class, clientToDriver); final TaskList taskList = proxyToDriver.getTasks(new QueryInfo()); this.tasks = taskList.getTasks(); this.taskProxyMap = new ConcurrentHashMap<>(); }
Source:
public ThreadedEventHandler(final Map<String, EventFactory> typedEventFactories, final SafeCaller safeCaller) { thread = new Thread(() -> { final EventHandler worker = new EventHandler(typedEventSubscribers, typedEventFactories, safeCaller); while (running.get()) { try { final Event event = queue.poll(1, TimeUnit.HOURS); if (event == null) { logger.debug("Hey, you have really very few events."); } else if (event.equals(notifyEvent)) { } else { worker.handleEvent(event); } } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } catch (RuntimeException ex) { logger.error("Error on event handling.", ex); } } }, "ESH-OSGiEventManager"); thread.start(); }

Target:
public ThreadedEventHandler(final Map<String, EventFactory> typedEventFactories, final SafeCaller safeCaller) { thread = new Thread(() -> { final EventHandler worker = new EventHandler(typedEventSubscribers, typedEventFactories, safeCaller); while (running.get()) { try { final Event event = queue.poll(1, TimeUnit.HOURS); if (event == null) { logger.debug("Hey, you have really very few events."); } else if (event == notifyEvent) { } else { worker.handleEvent(event); } } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } catch (RuntimeException ex) { logger.error("Error on event handling.", ex); } } }, "ESH-OSGiEventManager"); thread.start(); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Incomparable that = (Incomparable) o; return s != null ? s.equals(that.s) : that.s == null; }

Target:
public boolean equals(Object o) { return o == this || (o instanceof Incomparable && Objects.equals(s, ((Incomparable) o).s)); }
Source:
public ProgramState addConstraintTransitively(SymbolicValue symbolicValue, Constraint constraint) { final ProgramState[] ps = {addConstraint(symbolicValue, constraint)}; knownRelations() .filter(rsv -> rsv.isEquality() && (rsv.getLeftOp() == symbolicValue || rsv.getRightOp() == symbolicValue)) .map(rsv -> rsv.getLeftOp() == symbolicValue ? rsv.getRightOp() : rsv.getLeftOp()) .forEach(sv -> ps[0] = ps[0].addConstraint(sv, constraint)); return ps[0]; }

Target:
public ProgramState addConstraintTransitively(SymbolicValue symbolicValue, Constraint constraint) { List<SymbolicValue> transitiveSymbolicValues = knownRelations() .filter(rsv -> rsv.isEquality() && (rsv.getLeftOp() == symbolicValue || rsv.getRightOp() == symbolicValue)) .map(rsv -> rsv.getLeftOp() == symbolicValue ? rsv.getRightOp() : rsv.getLeftOp()) .collect(Collectors.toList()); ProgramState ps = addConstraint(symbolicValue, constraint); for (SymbolicValue sv : transitiveSymbolicValues) { ps = ps.addConstraint(sv, constraint); } return ps; }
Source:
private void validateTopologyCanProcessData(final StreamsBuilder builder) { final Properties config = new Properties(); final String safeTestName = safeUniqueTestName(getClass(), testName); config.setProperty(StreamsConfig.APPLICATION_ID_CONFIG, "dummy-" + safeTestName); config.setProperty(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "dummy"); config.setProperty(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.IntegerSerde.class.getName()); config.setProperty(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.StringSerde.class.getName()); config.setProperty(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory().getAbsolutePath()); try (final TopologyTestDriver topologyTestDriver = new TopologyTestDriver(builder.build(), config)) { final TestInputTopic<Integer, String> aTopic = topologyTestDriver.createInputTopic("A", new IntegerSerializer(), new StringSerializer()); final TestInputTopic<Integer, String> bTopic = topologyTestDriver.createInputTopic("B", new IntegerSerializer(), new StringSerializer()); final TestOutputTopic<Integer, String> output = topologyTestDriver.createOutputTopic("output", new IntegerDeserializer(), new StringDeserializer()); aTopic.pipeInput(1, "1-alpha"); bTopic.pipeInput(1, "beta"); final Map<Integer, String> x = output.readKeyValuesToMap(); assertThat(x, is(Collections.singletonMap(1, "(1-alpha,(1-alpha,beta))"))); } }

Target:
private void validateTopologyCanProcessData(final StreamsBuilder builder) { final Properties config = new Properties(); final String safeTestName = safeUniqueTestName(getClass(), testName); config.setProperty(StreamsConfig.APPLICATION_ID_CONFIG, "dummy-" + safeTestName); config.setProperty(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "dummy"); config.setProperty(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.IntegerSerde.class.getName()); config.setProperty(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.StringSerde.class.getName()); config.setProperty(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory().getAbsolutePath()); try (final TopologyTestDriver topologyTestDriver = new TopologyTestDriver(builder.build(), config)) { final TestInputTopic<Integer, String> aTopic = topologyTestDriver.createInputTopic("A", new IntegerSerializer(), new StringSerializer()); final TestInputTopic<Integer, String> bTopic = topologyTestDriver.createInputTopic("B", new IntegerSerializer(), new StringSerializer()); final TestOutputTopic<Integer, String> output = topologyTestDriver.createOutputTopic("output", new IntegerDeserializer(), new StringDeserializer()); aTopic.pipeInput(1, "999-alpha"); bTopic.pipeInput(999, "beta"); final Map<Integer, String> x = output.readKeyValuesToMap(); assertThat(x, is(Collections.singletonMap(1, "(999-alpha,(999-alpha,beta))"))); } }
Source:
public Optional<List<DecorationDescriptor>> getDecorationDescriptors(IDiagramElementEditPart diagramEditPart, Session session) { Optional<List<DecorationDescriptor>> decorationDescriptors = Optional.empty(); final View view = (View) diagramEditPart.getModel(); if (view != null && (shouldConsiderDetachedViews() || view.eResource() != null)) { if (shouldBeDecorated(diagramEditPart)) { List<DecorationDescriptor> createDecorationDescriptors = createDecorationDescriptors(diagramEditPart, session); if (createDecorationDescriptors != null && !createDecorationDescriptors.isEmpty()) { decorationDescriptors = Optional.of(createDecorationDescriptors); } } } return decorationDescriptors; }

Target:
public List<DecorationDescriptor> getDecorationDescriptors(IDiagramElementEditPart diagramEditPart, Session session) { final View view = (View) diagramEditPart.getModel(); if (view != null && (shouldConsiderDetachedViews() || view.eResource() != null)) { if (shouldBeDecorated(diagramEditPart)) { return createDecorationDescriptors(diagramEditPart, session); } } return new ArrayList<>(); }
Source:
private Metacard xmlToMetacard(InputStream inputStream) { try { Metacard metacard = xmlInputTransformer.transform(inputStream); metacard.setAttribute(new AttributeImpl(Core.METACARD_TAGS, "query")); LOGGER.trace("Successfully parsed query metacard with id [{}]", metacard.getId()); return metacard; } catch (IOException | CatalogTransformerException e) { LOGGER.debug("Error parsing query metacard input stream", e); return null; } finally { try { inputStream.close(); } catch (IOException e) { LOGGER.debug("An error occurred while closing the input stream", e); } } }

Target:
private Metacard xmlToMetacard(InputStream inputStream) { try { Metacard metacard = xmlInputTransformer.transform(inputStream); metacard.setAttribute(new AttributeImpl(Core.METACARD_TAGS, QUERY_TAG)); LOGGER.trace("Successfully parsed query metacard with id [{}]", metacard.getId()); return metacard; } catch (IOException | CatalogTransformerException e) { LOGGER.debug("Error parsing query metacard input stream", e); return null; } finally { try { inputStream.close(); } catch (IOException e) { LOGGER.debug("An error occurred while closing the input stream", e); } } }
Source:
public void testDescribeVault() throws Exception { GlacierClient client = getGlacierClient(); client.createVault("testDescribeVault"); VaultMetadata vault = getGlacierClient().describeVault("testDescribeVault"); assertEquals(vault.getVaultName(), "testDescribeVault"); assertEquals(vault.getNumberOfArchives(), 0); assertEquals(vault.getSizeInBytes(), 0); assertEquals(vault.getLastInventoryDate(), null); client.deleteVaultIfEmpty("testDescribeVault"); }

Target:
private void testDescribeVault() throws Exception { VaultMetadata vault = api.describeVault(VAULT_NAME1); assertEquals(vault.getVaultName(), VAULT_NAME1); assertEquals(vault.getNumberOfArchives(), 0); assertEquals(vault.getSizeInBytes(), 0); assertEquals(vault.getLastInventoryDate(), null); }
Source:
public RemoteEndpoint selectEndpoint(QName serviceName) { if (getRegistry() == null) { return null; } if (!_endpointIdx.containsKey(serviceName)) { _endpointIdx.put(serviceName, 0); } RemoteEndpoint selectedEp = null; List<RemoteEndpoint> eps = getRegistry().getEndpoints(serviceName); if (!eps.isEmpty()) { int tmp = _endpointIdx.get(serviceName); tmp %= eps.size(); selectedEp = eps.get(tmp); tmp++; _endpointIdx.put(serviceName, tmp); } return selectedEp; }

Target:
public RemoteEndpoint selectEndpoint(QName serviceName) { if (getRegistry() == null) { return null; } RemoteEndpoint selectedEp = null; List<RemoteEndpoint> eps = getRegistry().getEndpoints(serviceName); if (!eps.isEmpty()) { _endpointIdxs.putIfAbsent(serviceName, new AtomicInteger(0)); AtomicInteger idx = _endpointIdxs.get(serviceName); synchronized (idx) { idx.set(idx.get()%eps.size()); selectedEp = eps.get(idx.getAndIncrement()); } } return selectedEp; }
Source:
public void testMakeTimeZone_All() throws IOException { ZoneInfoDB.TzData instance = ZoneInfoDB.getInstance(); String[] availableIDs = instance.getAvailableIDs(); Arrays.sort(availableIDs); for (String id : availableIDs) { BufferIterator bufferIterator = instance.getBufferIterator(id); ZoneInfo zoneInfo = ZoneInfo.makeTimeZone(id, bufferIterator, Long.MIN_VALUE); assertNotNull("TimeZone " + id + " was not created", zoneInfo); assertEquals(id, zoneInfo.getID()); } }

Target:
public void testMakeTimeZone_All() throws Exception { ZoneInfoDB.TzData instance = ZoneInfoDB.getInstance(); String[] availableIDs = instance.getAvailableIDs(); Arrays.sort(availableIDs); for (String id : availableIDs) { BufferIterator bufferIterator = instance.getBufferIterator(id); ZoneInfo zoneInfo = ZoneInfo.makeTimeZone(id, bufferIterator, Long.MIN_VALUE); assertNotNull("TimeZone " + id + " was not created", zoneInfo); assertEquals(id, zoneInfo.getID()); } }
Source:
public void testActionJoinIfPossibleAndTx() throws Exception { TransactionCoordination.getInstance().bindTransaction(mockTransaction); MuleTransactionConfig config = new MuleTransactionConfig(TransactionConfig.ACTION_JOIN_IF_POSSIBLE); ExecutionTemplate executionTemplate = createExecutionTemplate(config); Object result = executionTemplate.execute(getEmptyTransactionCallback()); assertThat(result, is(RETURN_VALUE)); verify(mockTransaction, never()).commit(); verify(mockTransaction, never()).rollback(); assertThat(TransactionCoordination.getInstance().getTransaction(), Is.is(mockTransaction)); }

Target:
public void testActionJoinIfPossibleAndTx() throws Exception { getInstance().bindTransaction(mockTransaction); MuleTransactionConfig config = new MuleTransactionConfig(ACTION_JOIN_IF_POSSIBLE); ExecutionTemplate executionTemplate = createExecutionTemplate(config); Object result = executionTemplate.execute(getEmptyTransactionCallback()); assertThat(result, is(RETURN_VALUE)); verify(mockTransaction, never()).commit(); verify(mockTransaction, never()).rollback(); assertThat(getInstance().getTransaction(), is(mockTransaction)); }
Source:
private void runRemoteUnmarshal() throws Exception { try { Ignite ignite = startGrid(0); byte[] one = ignite.configuration().getMarshaller().marshal(DeclaredBodyEnum.ONE); byte[] two = ignite.configuration().getMarshaller().marshal(DeclaredBodyEnum.TWO); startGrid(1); ignite.compute(ignite.cluster().forRemotes()).call(new UnmarshalCallable(one, two)); } finally { stopAllGrids(); } }

Target:
private void runRemoteUnmarshal() throws Exception { Ignite ignite = startGrid(0); byte[] one = ignite.configuration().getMarshaller().marshal(DeclaredBodyEnum.ONE); byte[] two = ignite.configuration().getMarshaller().marshal(DeclaredBodyEnum.TWO); startGrid(1); ignite.compute(ignite.cluster().forRemotes()).call(new UnmarshalCallable(one, two)); }
Source:
DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList<String> paths = new ArrayList<>(); paths.add("/mypk"); partitionKeyDef.setPaths(paths); IndexingPolicy indexingPolicy = new IndexingPolicy(); List<IncludedPath> includedPaths = new ArrayList<>(); IncludedPath includedPath = new IncludedPath(); includedPath.setPath("/*"); List<Index> indexes = new ArrayList<>(); Index stringIndex = Index.range(DataType.STRING); BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1); indexes.add(stringIndex); Index numberIndex = Index.range(DataType.NUMBER); BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(numberIndex), "getPrecision", -1); indexes.add(numberIndex); includedPath.setIndexes(indexes); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); DocumentCollection collectionDefinition = new DocumentCollection(); collectionDefinition.setIndexingPolicy(indexingPolicy); collectionDefinition.setId(UUID.randomUUID().toString()); collectionDefinition.setPartitionKey(partitionKeyDef); return collectionDefinition; }

Target:
DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList<String> paths = new ArrayList<>(); paths.add("/mypk"); partitionKeyDef.setPaths(paths); IndexingPolicy indexingPolicy = new IndexingPolicy(); List<IncludedPath> includedPaths = new ArrayList<>(); IncludedPath includedPath = new IncludedPath("/*"); List<Index> indexes = new ArrayList<>(); indexes.add(Index.range(DataType.STRING, -1)); indexes.add(Index.range(DataType.NUMBER, -1)); includedPath.setIndexes(indexes); includedPaths.add(includedPath); indexingPolicy.setIncludedPaths(includedPaths); DocumentCollection collectionDefinition = new DocumentCollection(); collectionDefinition.setIndexingPolicy(indexingPolicy); collectionDefinition.setId(UUID.randomUUID().toString()); collectionDefinition.setPartitionKey(partitionKeyDef); return collectionDefinition; }
Source:
private void resetAuthorities(String username) { UserDetails userDetails = userDetailsService.loadUserByUsername(username); Collection<? extends GrantedAuthority> updatedAuthorities = userDetails.getAuthorities(); Object principal = toPrincipal(username); principalSecurityContextRegistry .getSecurityContexts(principal) .forEach(securityContext -> resetAuthorities(securityContext, updatedAuthorities)); }

Target:
private synchronized void resetAuthorities(String username) { UserDetails userDetails = userDetailsService.loadUserByUsername(username); Collection<? extends GrantedAuthority> updatedAuthorities = userDetails.getAuthorities(); Object principal = toPrincipal(username); principalSecurityContextRegistry .getSecurityContexts(principal) .forEach(securityContext -> resetAuthorities(securityContext, updatedAuthorities)); }
Source:
public KeyPair generateKeyPair() throws BuilderException { try { KeyPairGenerator keyGenerator = KeyPairGenerator.getInstance("DSA"); SecureRandom rng = SecureRandom.getInstance("SHA1PRNG", "SUN"); keyGenerator.initialize(1024, rng); return (keyGenerator.generateKeyPair()); } catch (Exception e) { throw new BuilderException("Failed to build DSA key pair", e); } }

Target:
public KeyPair generateKeyPair() throws BuilderException { try { KeyPairGenerator keyGenerator = KeyPairGenerator.getInstance("DSA"); SecureRandom rng = SecureRandom.getInstance("SHA1PRNG", "SUN"); keyGenerator.initialize(1024, rng); return (keyGenerator.generateKeyPair()); } catch (NoSuchAlgorithmException | NoSuchProviderException e) { throw new BuilderException("Failed to build DSA key pair", e); } }
Source:
public void run() { try (SingleLockService locks = createSweepLocks()) { waitUntilSpecificTableSweeperIsInitialized(); sleepForMillis(getBackoffTimeWhenSweepHasNotRun()); log.info("Starting background sweeper."); while (true) { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException("The background sweeper thread is interrupted."); } SweepOutcome outcome = checkConfigAndRunSweep(locks); log.info("Sweep iteration finished with outcome: {}", SafeArg.of("sweepOutcome", outcome)); updateBatchSize(outcome); updateMetrics(outcome); sleepUntilNextRun(outcome); } } catch (InterruptedException e) { log.warn( "Shutting down background sweeper. Please restart the service to rerun background sweep."); sweepOutcomeMetrics.registerOccurrenceOf( SweepOutcome.SHUTDOWN); } catch (Throwable t) { log.error("BackgroundSweeper failed fatally and will not rerun until restarted: {}", UnsafeArg.of("message", t.getMessage()), t); sweepOutcomeMetrics.registerOccurrenceOf( SweepOutcome.FATAL); } }

Target:
public void run() { try (SingleLockService locks = createSweepLocks()) { waitUntilSpecificTableSweeperIsInitialized(); sleepForMillis(getBackoffTimeWhenSweepHasNotRun()); log.info("Starting background sweeper with thread index {}", SafeArg.of("threadIndex", threadIndex)); while (true) { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException("The background sweeper thread is interrupted."); } SweepOutcome outcome = checkConfigAndRunSweep(locks); logOutcome(outcome); updateBatchSize(outcome); updateMetrics(outcome); sleepUntilNextRun(outcome); } } catch (InterruptedException e) { log.warn( "Shutting down background sweeper. Please restart the service to rerun background sweep."); closeTableLockIfHeld(); sweepOutcomeMetrics.registerOccurrenceOf( SweepOutcome.SHUTDOWN); } catch (Throwable t) { log.error("BackgroundSweeper failed fatally and will not rerun until restarted: {}", UnsafeArg.of("message", t.getMessage()), t); closeTableLockIfHeld(); sweepOutcomeMetrics.registerOccurrenceOf( SweepOutcome.FATAL); } }
Source:
static int requiredBufferCapacity( int cardinality, AggregatorFactory[] aggregatorFactories ) { final int cardinalityWithMissingValue = cardinality + 1; final int recordSize = Arrays.stream(aggregatorFactories) .mapToInt(AggregatorFactory::getMaxIntermediateSize) .sum(); return Integer.BYTES + getUsedFlagBufferCapacity(cardinalityWithMissingValue) + cardinalityWithMissingValue * recordSize; }

Target:
static int requiredBufferCapacity( int cardinality, AggregatorFactory[] aggregatorFactories ) { final int cardinalityWithMissingValue = cardinality + 1; final int recordSize = Arrays.stream(aggregatorFactories) .mapToInt(AggregatorFactory::getMaxIntermediateSize) .sum(); return getUsedFlagBufferCapacity(cardinalityWithMissingValue) + cardinalityWithMissingValue * recordSize; }
Source:
public void visit(Image image) { String url = context.encodeUrl(image.getDestination()); AltTextVisitor altTextVisitor = new AltTextVisitor(); image.accept(altTextVisitor); String altText = altTextVisitor.getAltText(); Map<String, String> attrs = new LinkedHashMap<>(); if(context.shouldBeSafe()) { url = context.urlSanitizer().sanitizeImageUrl(url); } attrs.put("src", url); attrs.put("alt", altText); if (image.getTitle() != null) { attrs.put("title", image.getTitle()); } html.tag("img", getAttrs(image, "img", attrs), true); }

Target:
public void visit(Image image) { String url = image.getDestination(); AltTextVisitor altTextVisitor = new AltTextVisitor(); image.accept(altTextVisitor); String altText = altTextVisitor.getAltText(); Map<String, String> attrs = new LinkedHashMap<>(); if (context.shouldSanitizeUrls()) { url = context.urlSanitizer().sanitizeImageUrl(url); } attrs.put("src", context.encodeUrl(url)); attrs.put("alt", altText); if (image.getTitle() != null) { attrs.put("title", image.getTitle()); } html.tag("img", getAttrs(image, "img", attrs), true); }
Source:
public StringBuffer format(double x, StringBuffer sb) { if ((Math.abs(x) >= DECIMAL_MIN && x < DECIMAL_MAX) || x == 0) { x = truncate(x); long lx = (long) x; if (lx == x) sb.append(lx); else sb.append(x); } else { if (forcedDecimal) { coordFormatter.format(x, sb, ZERO); } else { sb.append(truncate(x)); } } return sb; }

Target:
public StringBuffer format(double x, StringBuffer sb) { if ((Math.abs(x) >= DECIMAL_MIN && x < DECIMAL_MAX) || x == 0) { x = truncate(x); long lx = (long) x; if (lx == x) { sb.append(lx); } else { sb.append(x); } } else { if (forcedDecimal) { coordFormatter.format(x, sb, ZERO); } else { sb.append(truncate(x)); } } return sb; }
Source:
protected void setUp() { String[] packages = getClass().getPackage().getName().split("\\."); String categoryName = packages[packages.length - 1]; String language = packages[packages.length - 3]; String rulesetXml = "category/" + language + "/" + categoryName + ".xml"; addRule(rulesetXml, getClass().getSimpleName().replaceFirst("Test$", "")); }

Target:
protected void setUp() { }
Source:
public void marshal(ITypeMarshalBuffer buffer) throws CoreException { final int kind= getKind().ordinal(); final int shiftedKind= kind * ITypeMarshalBuffer.FLAG1; final int modifiers= getModifiers(); if (shiftedKind < ITypeMarshalBuffer.FLAG4 && modifiers == 0) { buffer.putShort((short) (ITypeMarshalBuffer.BASIC_TYPE | shiftedKind)); } else { buffer.putShort((short) (ITypeMarshalBuffer.BASIC_TYPE | ITypeMarshalBuffer.FLAG4)); buffer.putByte((byte) kind); buffer.putByte((byte) modifiers); } }

Target:
public void marshal(ITypeMarshalBuffer buffer) throws CoreException { final int kind= getKind().ordinal(); final int shiftedKind= kind * ITypeMarshalBuffer.FIRST_FLAG; final int modifiers= getModifiers(); if (modifiers == 0) { buffer.putShort((short) (ITypeMarshalBuffer.BASIC_TYPE | shiftedKind)); } else { buffer.putShort((short) (ITypeMarshalBuffer.BASIC_TYPE | ITypeMarshalBuffer.LAST_FLAG)); buffer.putByte((byte) kind); buffer.putByte((byte) modifiers); } }
Source:
public synchronized Map<String, Object> getMapData() { return fData; }

Target:
public synchronized Map<String, Object> getMapData() { return ImmutableMap.copyOf(fData); }
Source:
private UserInfo verifyIpRange(WebContext ctx, UserInfo info) { String actualUser = ctx.getSessionValue("default-user-id").asString(); UserInfo realUser = findUserByUserId(actualUser); if (realUser == null) { return UserInfo.NOBODY; } return realUser.tryAs(Tenant.class) .map(Tenant::getPermissions) .map(PermissionData::getConfig) .filter(config -> config.hasPath("security.ipRanges")) .filter(config -> config.hasPath("security.rolesToKeep")) .map(config -> Tuple.create(config.getStringList("security.ipRanges"), config.getStringList("security.rolesToKeep"))) .filter(data -> !matchesIPRange(ctx, data.getFirst())) .map(data -> removeRoles(info, data.getSecond())) .orElse(info); }

Target:
private UserInfo verifyIpRange(WebContext ctx, UserInfo info) { String actualUser = ctx.getSessionValue(scope.getScopeId() + "-user-id").asString(); UserAccount account = fetchAccount(actualUser, null); if (account == null) { return UserInfo.NOBODY; } Tenant tenant = account.getTenant().getValue(); if (tenant != null && !tenant.matchesIPRange(ctx)) { return createUserWithLimitedRoles(info, tenant.getRolesToKeepAsSet()); } return info; }
Source:
public void recognizePiiEntitiesStringListWithOptions() { List<String> documents = Arrays.asList( "My SSN is 555-55-5555.", "Visa card 0111 1111 1111 1111." ); TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setIncludeStatistics(true) .setModelVersion("latest"); textAnalyticsAsyncClient.recognizePiiEntitiesBatch(documents, "en", requestOptions) .subscribe(piiEntitiesResults -> { TextDocumentBatchStatistics batchStatistics = piiEntitiesResults.getStatistics(); System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n", batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); piiEntitiesResults.forEach(recognizePiiEntitiesResult -> recognizePiiEntitiesResult.getEntities().forEach(entity -> System.out.printf( "Recognized Personally Identifiable Information entity: %s, entity category: %s," + " entity subcategory: %s, offset: %s, length: %s, confidence score: %f.%n", entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getOffset(), entity.getLength(), entity.getConfidenceScore()))); }); END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntitiesBatch#Iterable-String-TextAnalyticsRequestOptions }

Target:
public void recognizePiiEntitiesStringListWithOptions() { List<String> documents = Arrays.asList( "My SSN is 859-98-0987.", "Visa card 0111 1111 1111 1111." ); TextAnalyticsRequestOptions requestOptions = new TextAnalyticsRequestOptions().setIncludeStatistics(true) .setModelVersion("latest"); textAnalyticsAsyncClient.recognizePiiEntitiesBatch(documents, "en", requestOptions) .subscribe(piiEntitiesResults -> { TextDocumentBatchStatistics batchStatistics = piiEntitiesResults.getStatistics(); System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n", batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); piiEntitiesResults.forEach(recognizePiiEntitiesResult -> recognizePiiEntitiesResult.getEntities().forEach(entity -> System.out.printf( "Recognized Personally Identifiable Information entity: %s, entity category: %s," + " entity subcategory: %s, confidence score: %f.%n", entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore()))); }); END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.recognizePiiEntitiesBatch#Iterable-String-TextAnalyticsRequestOptions }
Source:
public static VCFHeader createFakeHeader(final Set<VCFHeaderLine> metaData, final Set<String> additionalColumns, final SAMSequenceDictionary sequenceDict) { metaData.add(new VCFHeaderLine(VCFHeaderVersion.VCF4_0.getFormatString(), VCFHeaderVersion.VCF4_0.getVersionString())); metaData.add(new VCFHeaderLine("two", "2")); additionalColumns.add("extra1"); additionalColumns.add("extra2"); final VCFHeader ret = new VCFHeader(metaData, additionalColumns); ret.setSequenceDictionary(sequenceDict); return ret; }

Target:
public static VCFHeader createFakeHeader(final Set<VCFHeaderLine> metaData, final Set<String> additionalColumns, final SAMSequenceDictionary sequenceDict) { metaData.add(new VCFHeaderLine("two", "2")); additionalColumns.add("extra1"); additionalColumns.add("extra2"); final VCFHeader ret = new VCFHeader(metaData, additionalColumns); ret.setSequenceDictionary(sequenceDict); return ret; }
Source:
private void recoverSegment(long segmentIndex, long segmentId, PbdSegmentName segmentName) throws IOException { PBDSegment<M> segment; if (segmentName.m_quarantined) { segment = new PbdQuarantinedSegment<>(segmentName.m_file, segmentIndex, segmentId); } else { segment = m_pbdSegmentFactory.create(segmentIndex, segmentId, segmentName.m_file, m_usageSpecificLog, m_extraHeaderSerializer); if (!segment.isFinal()) { m_usageSpecificLog.warn("Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered but is not in a final state"); } else if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug( "Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered"); } m_segments.put(segment.segmentIndex(), segment); segment.close(); } m_segments.put(segment.segmentIndex(), segment); }

Target:
private void recoverSegment(long segmentIndex, long segmentId, PbdSegmentName segmentName) throws IOException { PBDSegment<M> segment; if (segmentName.m_quarantined) { segment = new PbdQuarantinedSegment<>(segmentName.m_file, segmentIndex, segmentId); } else { segment = m_pbdSegmentFactory.create(segmentIndex, segmentId, segmentName.m_file, m_usageSpecificLog, m_extraHeaderSerializer); try { if (segment.getNumEntries() == 0 && m_segments.isEmpty()) { if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("Found Empty Segment with entries: " + segment.getNumEntries() + " For: " + segment.file().getName()); m_usageSpecificLog.debug("Segment " + segment.file() + " (final: " + segment.isFinal() + "), will be closed and deleted during init"); } segment.closeAndDelete(); return; } if (!segment.isFinal()) { m_usageSpecificLog.warn("Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered but is not in a final state"); } else if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug( "Segment " + segment.file() + " (final: " + segment.isFinal() + "), has been recovered"); } } catch (IOException e) { m_usageSpecificLog.warn( "Failed to retrieve entry count from segment " + segment.file() + ". Quarantining segment", e); quarantineSegment(segment); return; } finally { segment.close(); } } m_segments.put(segment.segmentIndex(), segment); }
Source:
public void runInToolingApi(CancellationTokenSource tokenSource, IProgressMonitor monitor) throws Exception { try { SubMonitor progress = SubMonitor.convert(monitor, 5); progress.setTaskName((String.format("Synchronizing Gradle build at %s with workspace", this.gradleBuild.getBuildConfig().getRootProjectDirectory()))); new ImportRootProjectOperation(this.gradleBuild.getBuildConfig(), this.newProjectHandler).run(progress.newChild(1)); Collection<EclipseProject> rootProjects = ModelProviderUtil.fetchAllEclipseProjectsWithSyncTask(this.gradleBuild, tokenSource, FetchStrategy.FORCE_RELOAD, progress.newChild(1)); Set<EclipseProject> allProjects = collectAll(rootProjects); new ValidateProjectLocationOperation(allProjects).run(progress.newChild(1)); new RunOnImportTasksOperation(allProjects, this.gradleBuild.getBuildConfig()).run(progress.newChild(1), tokenSource); this.failures = new SynchronizeGradleBuildOperation(allProjects, this.gradleBuild, this.newProjectHandler, ProjectConfigurators.create(this.gradleBuild, CorePlugin.extensionManager().loadConfigurators())).run(progress.newChild(1)); ((DefaultModelProvider)this.gradleBuild.getModelProvider()).getCache().put(EclipseProject.class, rootProjects); } finally { this.gradleBuild.projectConnectionCache.invalidateAll(); } }

Target:
public void runInToolingApi(CancellationTokenSource tokenSource, IProgressMonitor monitor) throws Exception { try { SubMonitor progress = SubMonitor.convert(monitor, 5); progress.setTaskName((String.format("Synchronizing Gradle build at %s with workspace", this.gradleBuild.getBuildConfig().getRootProjectDirectory()))); new ImportRootProjectOperation(this.gradleBuild.getBuildConfig(), this.newProjectHandler).run(progress.newChild(1)); Set<EclipseProject> allProjects = collectAll(this.gradleBuild.modelProvider.fetchEclipseProjectAndRunSyncTasks(tokenSource, progress.newChild(1))); new ValidateProjectLocationOperation(allProjects).run(progress.newChild(1)); new RunOnImportTasksOperation(allProjects, this.gradleBuild.getBuildConfig()).run(progress.newChild(1), tokenSource); this.failures = new SynchronizeGradleBuildOperation(allProjects, this.gradleBuild, this.newProjectHandler, ProjectConfigurators.create(this.gradleBuild, CorePlugin.extensionManager().loadConfigurators())).run(progress.newChild(1)); } finally { this.gradleBuild.projectConnectionCache.invalidateAll(); } }
Source:
public void signalReady(Constraints viewConstraints) { String normalizedConstraints = getNormalizedConstraints(viewConstraints); Path signalPath = new Path(signalDirectory, normalizedConstraints); Path stagedSignalPath = new Path(signalDirectory, normalizedConstraints + STAGED_SIGNAL_POSTFIX); try{ FileContext context = FileContext.getFileContext(conf); final FSDataOutputStream os = context.create(stagedSignalPath, EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE), CreateOpts.perms(FsPermission.getDefault())); os.writeUTF(String.valueOf(System.currentTimeMillis())); os.close(); context.rename(stagedSignalPath, signalPath, Rename.OVERWRITE); } catch (IOException e) { throw new DatasetIOException("Could not access signal path: " + signalPath, e); } }

Target:
public void signalReady(Constraints viewConstraints) { try { rootFileSystem.mkdirs(signalDirectory); } catch (IOException e) { throw new DatasetIOException("Unable to create signal manager directory: " + signalDirectory, e); } String normalizedConstraints = getNormalizedConstraints(viewConstraints); Path signalPath = new Path(signalDirectory, normalizedConstraints); try{ FSDataOutputStream os = rootFileSystem.create(signalPath, true); os.close(); } catch (IOException e) { throw new DatasetIOException("Could not access signal path: " + signalPath, e); } }
Source:
public void validate_shouldFailIfTheConceptDatatypeIsNull() throws Exception { Concept concept = new Concept(); concept.addName(new ConceptName("some name",Context.getLocale())); concept.addDescription(new ConceptDescription("some description",null)); concept.setConceptClass(new ConceptClass()); Errors errors = new BindException(concept, "concept"); new ConceptValidator().validate(concept, errors); Assert.assertTrue(errors.hasErrors()); }

Target:
public void validate_shouldFailIfTheConceptDatatypeIsNull() throws Exception { Concept concept = new Concept(); concept.addName(new ConceptName("some name",Context.getLocale())); concept.addDescription(new ConceptDescription("some description",null)); concept.setConceptClass(new ConceptClass(1)); Errors errors = new BindException(concept, "concept"); new ConceptValidator().validate(concept, errors); Assert.assertEquals(errors.getFieldError("datatype").getCode(), "Concept.datatype.empty"); }
Source:
public int hashCode() { return hf.newHasher(32) .putLong(fSeq) .putLong(fAckseq) .putLong(fFlags).hash().asInt(); }

Target:
public int hashCode() { return hf.newHasher() .putLong(fSeq) .putLong(fAckseq) .putLong(fFlags).hash().asInt(); }
Source:
boolean isComposedOf(Expression exprList[], int start, int end, OrderedIntHashSet excludeSet) { if (opType == OpTypes.VALUE) { return true; } if (excludeSet.contains(opType)) { return true; } for (int i = start; i < end; i++) { if (equals(exprList[i])) { return true; } } if (opType == OpTypes.CAST && nodes.length == 1 && nodes[0].opType == OpTypes.DYNAMIC_PARAM) { return true; } switch (opType) { case OpTypes.LIKE : case OpTypes.MATCH_SIMPLE : case OpTypes.MATCH_PARTIAL : case OpTypes.MATCH_FULL : case OpTypes.MATCH_UNIQUE_SIMPLE : case OpTypes.MATCH_UNIQUE_PARTIAL : case OpTypes.MATCH_UNIQUE_FULL : case OpTypes.UNIQUE : case OpTypes.EXISTS : case OpTypes.TABLE_SUBQUERY : case OpTypes.ROW_SUBQUERY : case OpTypes.COUNT : case OpTypes.APPROX_COUNT_DISTINCT: case OpTypes.SUM : case OpTypes.MIN : case OpTypes.MAX : case OpTypes.AVG : case OpTypes.EVERY : case OpTypes.SOME : case OpTypes.STDDEV_POP : case OpTypes.STDDEV_SAMP : case OpTypes.VAR_POP : case OpTypes.VAR_SAMP : return false; } if (nodes.length == 0) { return false; } boolean result = true; for (int i = 0; i < nodes.length; i++) { result &= (nodes[i] == null || nodes[i].isComposedOf(exprList, start, end, excludeSet)); } return result; }

Target:
boolean isComposedOf(Expression exprList[], int start, int end, OrderedIntHashSet excludeSet) { if (opType == OpTypes.VALUE) { return true; } if (excludeSet.contains(opType)) { return true; } for (int i = start; i < end; i++) { if (equals(exprList[i])) { return true; } } switch (opType) { case OpTypes.CAST: assert(1 == nodes.length); if (nodes[0].opType == OpTypes.DYNAMIC_PARAM) { return true; } break; case OpTypes.LIKE : case OpTypes.MATCH_SIMPLE : case OpTypes.MATCH_PARTIAL : case OpTypes.MATCH_FULL : case OpTypes.MATCH_UNIQUE_SIMPLE : case OpTypes.MATCH_UNIQUE_PARTIAL : case OpTypes.MATCH_UNIQUE_FULL : case OpTypes.UNIQUE : case OpTypes.EXISTS : case OpTypes.TABLE_SUBQUERY : case OpTypes.ROW_SUBQUERY : case OpTypes.COUNT : case OpTypes.APPROX_COUNT_DISTINCT: case OpTypes.SUM : case OpTypes.MIN : case OpTypes.MAX : case OpTypes.AVG : case OpTypes.EVERY : case OpTypes.SOME : case OpTypes.STDDEV_POP : case OpTypes.STDDEV_SAMP : case OpTypes.VAR_POP : case OpTypes.VAR_SAMP : return false; } if (nodes.length == 0) { return false; } boolean result = true; for (int i = 0; i < nodes.length; i++) { result &= (nodes[i] == null || nodes[i].isComposedOf(exprList, start, end, excludeSet)); } return result; }
Source:
public Set<MessageHandlerInterceptor<? super EventMessage<?>>> getHandlerInterceptors() { return interceptors; }

Target:
public List<MessageHandlerInterceptor<? super EventMessage<?>>> getHandlerInterceptors() { return Collections.unmodifiableList(interceptors); }
Source:
public AndroidLocalFilesDirectory(Context context) { this.context = context; }

Target:
AndroidLocalFilesDirectory(Context context) { this.context = context; }
Source:
public Map migrate(Map request) { String dst = (String)request.get("dst"); String vmId = (String)request.get("vmId"); boolean success = true; final VM vm = getActiveHost().getRunningVMs().get(vmId); if (vm == null) { log.info("VM not found: " + vmId); throw new RuntimeException("VM not found: " + vmId); } VM targetVM = vm.clone(); vm.setStatus(VM.VMStatus.MigratingFrom); targetVM.setStatus(VM.VMStatus.MigratingTo); String targetServerName = dst; int idx = dst.indexOf(':'); if(idx != -1) { targetServerName = dst.substring(0, idx); } final Host targetHost = getHostByName(targetServerName); if (targetHost == null) { log.info("Target host not found: " + dst); throw new RuntimeException("Target host not found: " + dst + ", name: " + targetServerName); } targetVM.setHost(targetHost); targetHost.getRunningVMs().put(targetVM.getId(), targetVM); TaskProcessor.getInstance().addTask(new TaskRequest(TaskType.FINISH_MIGRATED_FROM_VM, 10000l, vm)); TaskProcessor.getInstance().addTask(new TaskRequest(TaskType.FINISH_MIGRATED_TO_VM, 10000l, targetVM)); TaskProcessor.getInstance().addTask(new TaskRequest(TaskType.FINISH_MIGRATED_FROM_VM_REMOVE_FROM_HOST, 20000l, vm)); Map resultMap = map(); Map statusMap = map(); statusMap.put("message", success ? "Migration process starting" : "VM not found"); statusMap.put("code", (success ? "0" : "100")); resultMap.put("status", statusMap); log.info("Migrating VM from host: to: {}", new Object[] { vm.getId(), vm.getHost().getName(), targetHost.getName() }); return resultMap; }

Target:
public Map migrate(Map request) { String dst = (String)request.get("dst"); String vmId = (String)request.get("vmId"); boolean success = true; final VM vm = getActiveHost().getRunningVMs().get(vmId); if (vm == null) { log.info("VM not found: " + vmId); throw new RuntimeException("VM not found: " + vmId); } VM targetVM = vm.clone(); vm.setStatus(VM.VMStatus.MigratingFrom); targetVM.setStatus(VM.VMStatus.MigratingTo); String targetServerName = dst; int idx = dst.indexOf(':'); if(idx != -1) { targetServerName = dst.substring(0, idx); } final Host targetHost = getHostByName(targetServerName); if (targetHost == null) { log.info("Target host not found: " + dst); throw new RuntimeException("Target host not found: " + dst + ", name: " + targetServerName); } targetVM.setHost(targetHost); targetHost.getRunningVMs().put(targetVM.getId(), targetVM); TaskProcessor.getInstance().addTask(new TaskRequest(TaskType.FINISH_MIGRATED_FROM_VM, 10000l, vm)); TaskProcessor.getInstance().addTask(new TaskRequest(TaskType.FINISH_MIGRATED_TO_VM, 10000l, targetVM)); TaskProcessor.getInstance().addTask(new TaskRequest(TaskType.FINISH_MIGRATED_FROM_VM_REMOVE_FROM_HOST, 20000l, vm)); Map<String, Object> resultMap = map(); Map statusMap = map(); statusMap.put("message", success ? "Migration process starting" : "VM not found"); statusMap.put("code", (success ? "0" : "100")); resultMap.put("status", statusMap); log.info("Migrating VM from host: to: {}", new Object[] { vm.getId(), vm.getHost().getName(), targetHost.getName() }); return resultMap; }
Source:
private void configureJavaHome(CompilerConfiguration compilerConfiguration) throws MojoExecutionException { if (useJDK != JDKUsage.BREE) { return; } String toolchainId = getTargetExecutionEnvironment().getProfileName(); DefaultJavaToolChain toolChain = toolchainProvider.findMatchingJavaToolChain(session, toolchainId); if (toolChain == null) { throw new MojoExecutionException("useJDK = BREE configured, but no toolchain of type 'jdk' with id '" + toolchainId + "' found. See <LINK_0>"); } compilerConfiguration.addCompilerCustomArgument("--system", toolChain.getJavaHome()); configureBootClassPath(compilerConfiguration, toolChain); }

Target:
private void configureJavaHome(CompilerConfiguration compilerConfiguration) throws MojoExecutionException { if (useJDK != JDKUsage.BREE) { return; } String toolchainId = getTargetExecutionEnvironment().getProfileName(); DefaultJavaToolChain toolChain = toolchainProvider.findMatchingJavaToolChain(session, toolchainId); if (toolChain == null) { throw new MojoExecutionException("useJDK = BREE configured, but no toolchain of type 'jdk' with id '" + toolchainId + "' found. See <LINK_0>"); } compilerConfiguration.addCompilerCustomArgument("use.java.home", toolChain.getJavaHome()); configureBootClassPath(compilerConfiguration, toolChain); }
Source:
public void reset() { this.transportFactories.nullifyBoth(); this.tracerFactory = null; this.storages.nullifyBoth(); this.delivery = Delivery.local(); resetDeploymentType(); }

Target:
public void reset() { this.transportFactory.reset(); this.tracerFactory.reset(); this.storageFactory.reset(); this.delivery.reset(); Class<? extends EnvironmentType> currentEnv = environment().type(); this.delivery.use(Delivery.local(), currentEnv); resetDeploymentType(); }
Source:
private static Class<?>[] getClassesInPackage(Class<?> klass) { String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + "/" + klass.getPackage().getName().replaceAll("\\.", "/") + "/*.class"; ArrayList<Class<?>> results = new ArrayList<Class<?>>(); ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(); try { Resource[] resources = resourcePatternResolver.getResources(packageSearchPath); if (resources != null) { for (Resource resource: resources) { String unqualifiedClassName = resource.getFilename().replace(".class", ""); String className = klass.getPackage().getName() +"." + unqualifiedClassName; Class<?> candidate = ClassUtils.resolveClassName(className, klass.getClassLoader()); if (!Modifier.isAbstract(candidate.getModifiers()) && className.endsWith(TEST_CLASSNAME_SUFFIX)) { results.add(candidate); } } } } catch (IOException e) { throw new RuntimeException(e); } return results.toArray(new Class<?>[results.size()]); }

Target:
private static Class<?>[] getClassesInPackage(Class<?> klass) { String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + "/" + klass.getPackage().getName().replaceAll("\\.", "/") + "/*" + TEST_CLASSNAME_SUFFIX + ".class"; ArrayList<Class<?>> results = new ArrayList<Class<?>>(); ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(); try { Resource[] resources = resourcePatternResolver.getResources(packageSearchPath); if (resources != null) { for (Resource resource: resources) { String unqualifiedClassName = resource.getFilename().replace(".class", ""); String className = klass.getPackage().getName() +"." + unqualifiedClassName; Class<?> candidate = ClassUtils.resolveClassName(className, klass.getClassLoader()); if (!Modifier.isAbstract(candidate.getModifiers())) { results.add(candidate); } } } } catch (IOException e) { throw new RuntimeException(e); } return results.toArray(new Class<?>[results.size()]); }
Source:
public void testWaitForCompletionSuccess() { TestAnalysis module = setUpAnalysis(); IStatus status = module.schedule(); assertEquals(IStatus.ERROR, status.getSeverity()); TmfTraceStub trace = new TmfTraceStub(); trace.init("t1"); try { module.setTrace(trace); } catch (TmfAnalysisException e) { fail(e.getMessage()); } status = module.schedule(); assertEquals(Status.OK_STATUS, status); boolean completed = module.waitForCompletion(); assertTrue(completed); assertEquals(1, module.getAnalysisOutput()); }

Target:
public void testWaitForCompletionSuccess() { TestAnalysis module = setUpAnalysis(); IStatus status = module.schedule(); assertEquals(IStatus.ERROR, status.getSeverity()); try { module.setTrace(TmfTestTrace.A_TEST_10K.getTrace()); } catch (TmfAnalysisException e) { fail(e.getMessage()); } module.setParameter(TestAnalysis.PARAM_TEST, 1); status = module.schedule(); assertEquals(Status.OK_STATUS, status); boolean completed = module.waitForCompletion(new NullProgressMonitor()); assertTrue(completed); assertEquals(1, module.getAnalysisOutput()); }