auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testRestartZooKeeperServer() throws Exception { final int[] clientPorts = new int[SERVER_COUNT]; StringBuilder sb = new StringBuilder(); String server; for (int i = 0; i < SERVER_COUNT; i++) { clientPorts[i] = PortAssignment.unique(); server = "server." + i + "=127.0.0.1:" + PortAssignment.unique() + ":" + PortAssignment.unique() + ":participant;127.0.0.1:" + clientPorts[i]; sb.append(server + "\n"); } String currentQuorumCfgSection = sb.toString(); MainThread[] mt = new MainThread[SERVER_COUNT]; for (int i = 0; i < SERVER_COUNT; i++) { mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection, false); mt[i].start(); } for (int i = 0; i < SERVER_COUNT; i++) { Assert.assertTrue("waiting for server " + i + " being up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i], CONNECTION_TIMEOUT)); } ZooKeeper zk = ClientBase.createZKClient("127.0.0.1:" + clientPorts[0]); String zNodePath = "/serverRestartTest"; String data = "originalData"; zk.create(zNodePath, data.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.close(); mt[0].shutdown(); mt[1].shutdown(); mt[0].start(); mt[1].start(); for (int i = 0; i < SERVER_COUNT; i++) { Assert.assertTrue("waiting for server " + i + " being up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i], CONNECTION_TIMEOUT)); } zk = ClientBase.createZKClient("127.0.0.1:" + clientPorts[0]); byte[] dataBytes = zk.getData(zNodePath, null, null); String receivedData = new String(dataBytes); assertEquals(data, receivedData); for (int i = 0; i < SERVER_COUNT; i++) { mt[i].shutdown(); } }

Target:
public void testRestartZooKeeperServer() throws Exception { final int[] clientPorts = new int[SERVER_COUNT]; StringBuilder sb = new StringBuilder(); String server; for (int i = 0; i < SERVER_COUNT; i++) { clientPorts[i] = PortAssignment.unique(); server = "server." + i + "=127.0.0.1:" + PortAssignment.unique() + ":" + PortAssignment.unique() + ":participant;127.0.0.1:" + clientPorts[i]; sb.append(server + "\n"); } String currentQuorumCfgSection = sb.toString(); MainThread[] mt = new MainThread[SERVER_COUNT]; for (int i = 0; i < SERVER_COUNT; i++) { mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection, false); mt[i].start(); } for (int i = 0; i < SERVER_COUNT; i++) { assertTrue( "waiting for server " + i + " being up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i], CONNECTION_TIMEOUT)); } ZooKeeper zk = ClientBase.createZKClient("127.0.0.1:" + clientPorts[0]); String zNodePath = "/serverRestartTest"; String data = "originalData"; zk.create(zNodePath, data.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.close(); mt[0].shutdown(); mt[1].shutdown(); mt[0].start(); mt[1].start(); for (int i = 0; i < SERVER_COUNT; i++) { assertTrue( "waiting for server " + i + " being up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i], CONNECTION_TIMEOUT)); } zk = ClientBase.createZKClient("127.0.0.1:" + clientPorts[0]); byte[] dataBytes = zk.getData(zNodePath, null, null); String receivedData = new String(dataBytes); assertEquals(data, receivedData); for (int i = 0; i < SERVER_COUNT; i++) { mt[i].shutdown(); } }
Source:
@Override protected String getDescription(MBeanOperationInfo info) { String str = super.getDescription(info); try { Method m = getMethod(info); MXBeanDescription desc = m.getAnnotation(MXBeanDescription.class); if (desc != null) { str = desc.value(); assert str != null; assert !str.trim().isEmpty(); assert Character.isUpperCase(str.charAt(0)) : str; assert str.charAt(str.length() - 1) == '.' : str; } } catch (SecurityException | ClassNotFoundException ignored) { } return str; }

Target:
@Override protected String getDescription(MBeanOperationInfo info) { String str = super.getDescription(info); try { Method m = getMethod(info); MXBeanDescription desc = m.getAnnotation(MXBeanDescription.class); if (desc != null) { str = desc.value(); assert str != null; assert !str.trim().isEmpty(); assert Character.isUpperCase(str.charAt(0)) : DESC_MUST_START_WITH_UPP_CASE + str; assert str.charAt(str.length() - 1) == '.' : DESC_MUST_END_WITH_PERIOD + str; } } catch (SecurityException | ClassNotFoundException ignored) { } return str; }
Source:
private void checkStateOfWsAgent(WsAgentHealthStateDto agentHealthStateDto) { final int statusCode = agentHealthStateDto.getCode(); final String infoWindowTitle = "Workspace Agent Not Responding"; final ConfirmCallback restartCallback = new StopCallback(); if (statusCode == 200) { dialogFactory.createMessageDialog(infoWindowTitle, "Our workspace agent is no longer responding. To fix the problem, verify you have a" + " good network connection and restart the workspace.", restartCallback).show(); } else { dialogFactory.createMessageDialog(infoWindowTitle, "Our workspace agent is no longer responding. To fix the problem, restart the workspace.", restartCallback).show(); } }

Target:
private void checkStateOfWsAgent(WsAgentHealthStateDto agentHealthStateDto) { final int statusCode = agentHealthStateDto.getCode(); final String infoWindowTitle = "Workspace Agent Not Responding"; final ConfirmCallback stopCallback = new StopCallback(); if (statusCode == 200) { dialogFactory.createMessageDialog(infoWindowTitle, "Workspace agent is no longer responding. To fix the problem, verify you have a" + " good network connection and restart the workspace.", stopCallback).show(); } else { dialogFactory.createMessageDialog(infoWindowTitle, "Workspace agent is no longer responding. To fix the problem, restart the workspace.", stopCallback).show(); } }
Source:
private boolean isSupportedByAnyResourceType(Path path) { org.uberfire.backend.vfs.Path convertedPath = convertPath(path); return this.getResourceTypeDefinitionList() .stream() .anyMatch(resourceTypeDefinition -> resourceTypeDefinition.accept(convertedPath)); }

Target:
private boolean isSupportedByAnyResourceType(Path path) { org.uberfire.backend.vfs.Path convertedPath = convertPath(path); return this.getVisibleResourceTypes() .stream() .anyMatch(resourceTypeDefinition -> resourceTypeDefinition.accept(convertedPath)); }
Source:
protected void showAssets() { busyIndicatorView.showBusyIndicator(ts.getTranslation(LibraryConstants.LoadingAssets)); libraryService.call((Boolean hasAssets) -> { if (hasAssets) { this.view.setContent(populatedAssetsScreen.getView().getElement()); } else { this.view.setContent(emptyAssetsScreen.getView().getElement()); } busyIndicatorView.hideBusyIndicator(); }).hasAssets(this.projectInfo.getProject()); }

Target:
protected void showAssets() { busyIndicatorView.showBusyIndicator(ts.getTranslation(LibraryConstants.LoadingAssets)); libraryService.call((Boolean hasAssets) -> { if (hasAssets) { this.view.setContent(populatedAssetsScreen.getView().getElement()); } else { this.view.setContent(emptyAssetsScreen.getView().getElement()); } busyIndicatorView.hideBusyIndicator(); }, new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).hasAssets(this.projectInfo); }
Source:
AllTypesColumnInfo(String path, Table table) { final Map<String, Long> indicesMap = new HashMap<String, Long>(9); this.columnStringIndex = getValidColumnIndex(path, table, "AllTypes", "columnString"); indicesMap.put("columnString", this.columnStringIndex); this.columnLongIndex = getValidColumnIndex(path, table, "AllTypes", "columnLong"); indicesMap.put("columnLong", this.columnLongIndex); this.columnFloatIndex = getValidColumnIndex(path, table, "AllTypes", "columnFloat"); indicesMap.put("columnFloat", this.columnFloatIndex); this.columnDoubleIndex = getValidColumnIndex(path, table, "AllTypes", "columnDouble"); indicesMap.put("columnDouble", this.columnDoubleIndex); this.columnBooleanIndex = getValidColumnIndex(path, table, "AllTypes", "columnBoolean"); indicesMap.put("columnBoolean", this.columnBooleanIndex); this.columnDateIndex = getValidColumnIndex(path, table, "AllTypes", "columnDate"); indicesMap.put("columnDate", this.columnDateIndex); this.columnBinaryIndex = getValidColumnIndex(path, table, "AllTypes", "columnBinary"); indicesMap.put("columnBinary", this.columnBinaryIndex); this.columnObjectIndex = getValidColumnIndex(path, table, "AllTypes", "columnObject"); indicesMap.put("columnObject", this.columnObjectIndex); this.columnRealmListIndex = getValidColumnIndex(path, table, "AllTypes", "columnRealmList"); indicesMap.put("columnRealmList", this.columnRealmListIndex); setIndicesMap(Collections.unmodifiableMap(indicesMap)); }

Target:
AllTypesColumnInfo(String path, Table table) { final Map<String, Long> indicesMap = new HashMap<String, Long>(9); this.columnStringIndex = getValidColumnIndex(path, table, "AllTypes", "columnString"); indicesMap.put("columnString", this.columnStringIndex); this.columnLongIndex = getValidColumnIndex(path, table, "AllTypes", "columnLong"); indicesMap.put("columnLong", this.columnLongIndex); this.columnFloatIndex = getValidColumnIndex(path, table, "AllTypes", "columnFloat"); indicesMap.put("columnFloat", this.columnFloatIndex); this.columnDoubleIndex = getValidColumnIndex(path, table, "AllTypes", "columnDouble"); indicesMap.put("columnDouble", this.columnDoubleIndex); this.columnBooleanIndex = getValidColumnIndex(path, table, "AllTypes", "columnBoolean"); indicesMap.put("columnBoolean", this.columnBooleanIndex); this.columnDateIndex = getValidColumnIndex(path, table, "AllTypes", "columnDate"); indicesMap.put("columnDate", this.columnDateIndex); this.columnBinaryIndex = getValidColumnIndex(path, table, "AllTypes", "columnBinary"); indicesMap.put("columnBinary", this.columnBinaryIndex); this.columnObjectIndex = getValidColumnIndex(path, table, "AllTypes", "columnObject"); indicesMap.put("columnObject", this.columnObjectIndex); this.columnRealmListIndex = getValidColumnIndex(path, table, "AllTypes", "columnRealmList"); indicesMap.put("columnRealmList", this.columnRealmListIndex); setIndicesMap(indicesMap); }
Source:
private void updateGroup(final TupleBatch tb, final int row, final Object[] curAggStates) throws DbException { for (int agg = 0; agg < aggregators.length; ++agg) { if (!(aggregators[agg] .getClass() .getName() .equals(StatefulUserDefinedAggregator.class.getName()))) { aggregators[agg].addRow(tb, row, curAggStates[agg]); } } }

Target:
private void updateGroup(final TupleBatch tb, final int row, final Object[] curAggStates) throws DbException { for (int agg = 0; agg < aggregators.length; ++agg) { if (!(aggregators[agg] instanceof StatefulUserDefinedAggregator)) { aggregators[agg].addRow(tb, row, curAggStates[agg]); } } }
Source:
boolean isVisibleTo(Account account) throws OrmException; } @Override public List<SuggestReviewerInfo> apply(final ChangeResource rsrc) throws BadRequestException, OrmException, IOException { if (query == null) { throw new BadRequestException("missing query field"); } if (!suggestAccounts || query.length() < suggestFrom) { return Collections.emptyList(); } VisibilityControl visibilityControl = getVisibility(rsrc); List<AccountInfo> suggestedAccounts = suggestAccount(visibilityControl); accountLoaderFactory.create(true).fill(suggestedAccounts); final List<SuggestReviewerInfo> reviewer = new ArrayList<SuggestReviewerInfo>(suggestedAccounts.size()); for (final AccountInfo a : suggestedAccounts) { reviewer.add(new SuggestReviewerInfo(a)); } final List<GroupReference> suggestedAccountGroups = suggestAccountGroup(rsrc.getControl().getProjectControl()); for (final GroupReference g : suggestedAccountGroups) { if (suggestGroupAsReviewer(rsrc.getControl().getProject(), g, visibilityControl)) { GroupBaseInfo info = new GroupBaseInfo(); info.id = Url.encode(g.getUUID().get()); info.name = g.getName(); reviewer.add(new SuggestReviewerInfo(info)); } } Collections.sort(reviewer); if (reviewer.size() <= limit) { return reviewer; } else { return reviewer.subList(0, limit); } }

Target:
boolean isVisibleTo(Account account) throws OrmException; } @Override public List<SuggestReviewerInfo> apply(ChangeResource rsrc) throws BadRequestException, OrmException, IOException { if (Strings.isNullOrEmpty(query)) { throw new BadRequestException("missing query field"); } if (!suggestAccounts || query.length() < suggestFrom) { return Collections.emptyList(); } VisibilityControl visibilityControl = getVisibility(rsrc); List<AccountInfo> suggestedAccounts = suggestAccount(visibilityControl); accountLoaderFactory.create(true).fill(suggestedAccounts); List<SuggestReviewerInfo> reviewer = Lists.newArrayList(); for (AccountInfo a : suggestedAccounts) { reviewer.add(new SuggestReviewerInfo(a)); } Project p = rsrc.getControl().getProject(); for (GroupReference g : suggestAccountGroup( rsrc.getControl().getProjectControl())) { if (suggestGroupAsReviewer(p, g, visibilityControl)) { GroupBaseInfo info = new GroupBaseInfo(); info.id = Url.encode(g.getUUID().get()); info.name = g.getName(); reviewer.add(new SuggestReviewerInfo(info)); } } Collections.sort(reviewer); if (reviewer.size() <= limit) { return reviewer; } else { return reviewer.subList(0, limit); } }
Source:
private String toAscii(String unicodeString) throws IllegalArgumentException { String asciiString = ""; int start = 0; int index = getBreakingIndex( unicodeString, ASCII_MAX_LABEL_LENGTH ); int end = unicodeString.length() <= index ? unicodeString.length() : index; while ( true ) { asciiString += IDN.toASCII( unicodeString.substring( start, end ) ); if ( end == unicodeString.length() ) { break; } start = end; index = getBreakingIndex( unicodeString, start + ASCII_MAX_LABEL_LENGTH ); end = index > unicodeString.length() ? unicodeString.length() : index; } return asciiString; }

Target:
private String toAscii(String unicodeString) throws IllegalArgumentException { String asciiString = ""; int start = 0; int end = getIDNToASCIIPartEnd( unicodeString, IDN_TO_ASCII_MAX_LABEL_LENGTH); while ( true ) { asciiString += IDN.toASCII( unicodeString.substring( start, end ) ); if ( end == unicodeString.length() ) { break; } start = end; end = getIDNToASCIIPartEnd( unicodeString, start + IDN_TO_ASCII_MAX_LABEL_LENGTH); } return asciiString; }
Source:
private JsonObject createHierarchicalJson(Schema schema, IndexedRecord record, int idPos){ JsonObject jsonObject = JsonObject.create(); for (int i = 0; i < schema.getFields().size(); i++){ if (i == idPos) continue; Object value = record.get(i); String fieldName = schema.getFields().get(i).name(); try { JsonObject innerJson = JsonObject.fromJson(value.toString()); jsonObject.put(fieldName, innerJson); } catch (Exception e) { jsonObject.put(fieldName, value); } } return jsonObject; }

Target:
public JsonObject createHierarchicalJson(Schema schema, IndexedRecord record, int idPos){ JsonObject jsonObject = JsonObject.create(); for (int i = 0; i < schema.getFields().size(); i++){ if (i == idPos) continue; Object value = record.get(i); String fieldName = schema.getFields().get(i).name(); try { JsonObject innerJson = JsonObject.fromJson(value.toString()); jsonObject.put(fieldName, innerJson); } catch (Exception e) { jsonObject.put(fieldName, value); } } return jsonObject; }
Source:
static void write(Node node, Map<String, String> map, File file, String lang) throws FileNotFoundException { FileOutputStream fos = null; BufferedOutputStream bos = null; try { fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos); write(node, map, bos, lang); } finally { if (bos != null) { try { bos.close(); } catch (IOException e) { } } if (fos != null) { try { fos.close(); } catch (IOException e) { } } } }

Target:
static void write(Node node, Map<String, String> map, File file, String lang) throws IOException { try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos);) { write(node, map, bos, lang); } }
Source:
protected MavenArtifactCoordinates getArtifactCoordinates(RepositoryPath repositoryPath) throws IOException { MavenArtifact artifact = MavenArtifactUtils.convertPathToArtifact(repositoryPath); return artifact != null ? new MavenArtifactCoordinates(artifact) : null; }

Target:
protected MavenArtifactCoordinates getArtifactCoordinates(RepositoryPath repositoryPath) throws IOException { MavenArtifact artifact = MavenArtifactUtils.convertPathToArtifact(repositoryPath); return new MavenArtifactCoordinates(artifact); }
Source:
protected boolean checkNamespaceExists(String namespaceName) throws InfrastructureException { return clientFactory.createOC().projects().withName(namespaceName).get() != null; }

Target:
protected boolean checkNamespaceExists(String namespaceName) throws InfrastructureException { return fetchNamespaceObject(namespaceName).isPresent(); }
Source:
public static AbstractJwsSigner createJwsSigner(JwsSignerObject jwsSignerObject, OpenIdConfigurationResponse discoveryResponse) { final String algorithm = jwsSignerObject.getIdToken().getHeader().getClaimAsString(JwtHeaderName.ALGORITHM); final SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.fromString(algorithm); final String kid = jwsSignerObject.getIdToken().getHeader().getClaimAsString(JwtHeaderName.KEY_ID); final String jwkUrl = discoveryResponse.getJwksUri(); if (signatureAlgorithm.getFamily() == AlgorithmFamily.RSA) { final RSAPublicKey publicKey = jwsSignerObject.getKeyService().getRSAPublicKey(jwkUrl, kid); return jwsSignerObject.getOpClientFactory().createRSASigner(signatureAlgorithm, publicKey); } else if (signatureAlgorithm.getFamily() == AlgorithmFamily.HMAC) { return new HMACSigner(signatureAlgorithm, jwsSignerObject.getSite().getClientSecret()); } else if (signatureAlgorithm.getFamily() == AlgorithmFamily.EC) { ECDSAPublicKey publicKey = JwkClient.getECDSAPublicKey(jwkUrl, kid); return new ECDSASigner(signatureAlgorithm, publicKey); } return null; }

Target:
public static AbstractJwsSigner createJwsSigner(JwsSignerObject jwsSignerObject, OpenIdConfigurationResponse discoveryResponse) { final String algorithm = jwsSignerObject.getIdToken().getHeader().getClaimAsString(JwtHeaderName.ALGORITHM); final SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.fromString(algorithm); final String kid = jwsSignerObject.getIdToken().getHeader().getClaimAsString(JwtHeaderName.KEY_ID); final String jwkUrl = discoveryResponse.getJwksUri(); if (signatureAlgorithm == null) throw new HttpException(ErrorResponseCode.INVALID_ALGORITHM); if (signatureAlgorithm.getFamily() == AlgorithmFamily.RSA) { final RSAPublicKey publicKey = jwsSignerObject.getKeyService().getRSAPublicKey(jwkUrl, kid); return jwsSignerObject.getOpClientFactory().createRSASigner(signatureAlgorithm, publicKey); } else if (signatureAlgorithm.getFamily() == AlgorithmFamily.HMAC) { return new HMACSigner(signatureAlgorithm, jwsSignerObject.getRp().getClientSecret()); } else if (signatureAlgorithm.getFamily() == AlgorithmFamily.EC) { ECDSAPublicKey publicKey = JwkClient.getECDSAPublicKey(jwkUrl, kid); return new ECDSASigner(signatureAlgorithm, publicKey); } throw new HttpException(ErrorResponseCode.ALGORITHM_NOT_SUPPORTED); }
Source:
private void handle(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.reset(); String pathInfo = req.getPathInfo(); String[] pathParts = pathInfo.split("/"); if (pathParts.length < 3) { resp.sendError(HttpServletResponse.SC_BAD_REQUEST); return; } String assetPath = Arrays.stream(pathParts).skip(1).collect(joining(File.separator)); logger.debug("Retrieving component asset {}", assetPath); try (InputStream assetStream = assetProvider.openAsset(assetPath)) { int size = IOUtils.copy(assetStream, resp.getOutputStream()); String mimeType = mimetypesFileTypeMap.getContentType(pathInfo); resp.setContentType(mimeType); resp.setContentLength(size); resp.setHeader("Cache-Control", cacheControlHeaderValue); } catch (Exception e) { logger.info("Not able to find component asset {}", assetPath); logger.debug("Error opening external component asset", e); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } }

Target:
private void handle(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.reset(); if (!loader.isEnabled()) { logger.debug("Ignoring request because External Components API is disabled."); resp.sendError(HttpServletResponse.SC_NOT_FOUND); return; } String pathInfo = req.getPathInfo(); if (pathInfo == null) { badRequest(resp); return; } String[] pathParts = pathInfo.split("/"); if (pathParts.length < 3) { badRequest(resp); return; } String assetPath = Arrays.stream(pathParts).skip(1).collect(joining(File.separator)); logger.debug("Retrieving component asset {}", assetPath); try (InputStream assetStream = assetProvider.openAsset(assetPath)) { int size = IOUtils.copy(assetStream, resp.getOutputStream()); String mimeType = mimetypesFileTypeMap.getContentType(pathInfo); resp.setContentType(mimeType); resp.setContentLength(size); resp.setHeader(CACHE_CONTROL_PARAM, cacheControlHeaderValue); } catch (Exception e) { logger.info("Not able to find component asset {}", assetPath); logger.debug("Error opening external component asset", e); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } }
Source:
public Message receive(final String queueName, final long timeoutMillis) { Message message = execute(channel -> { CompletableFuture<Delivery> future = new CompletableFuture<>(); Delivery delivery = getDeliveryAndCancelConsumer(channel, future, createConsumer(queueName, channel, future), timeoutMillis); if (delivery == null) { return null; } else { if (isChannelLocallyTransacted(channel)) { channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); channel.txCommit(); } else if (isChannelTransacted()) { ConnectionFactoryUtils.registerDeliveryTag(getConnectionFactory(), channel, delivery.getEnvelope().getDeliveryTag()); } else { channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); } return buildMessageFromDelivery(delivery); } }); logReceived(message); return message; }

Target:
public Message receive(final String queueName, final long timeoutMillis) { Message message = execute(channel -> { Delivery delivery = consumeDelivery(channel, queueName, timeoutMillis); if (delivery == null) { return null; } else { if (isChannelLocallyTransacted(channel)) { channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); channel.txCommit(); } else if (isChannelTransacted()) { ConnectionFactoryUtils.registerDeliveryTag(getConnectionFactory(), channel, delivery.getEnvelope().getDeliveryTag()); } else { channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); } return buildMessageFromDelivery(delivery); } }); logReceived(message); return message; }
Source:
public void testExtractItem() { BloombergDataRow row = BloombergDataRow.builder() .withDate("2014-01-01") .withDescription("description") .withDuration("0:01:01") .withId("id") .withKeywords(ImmutableList.of("key")) .withSource("Bloomberg") .withTitle("title") .withKeywords(ImmutableList.of("key")) .build(); Content content = extractor.extract(row); Item item = (Item) content; assertThat(item.getCanonicalUri(), endsWith("id")); assertThat(item.getCurie(), endsWith("id")); assertEquals(item.getPublisher(), Publisher.BLOOMBERG); assertEquals("description", item.getDescription()); assertEquals("title", item.getTitle()); assertEquals(MediaType.VIDEO, item.getMediaType()); assertEquals(Integer.valueOf(61), Iterables.getOnlyElement(item.getVersions()).getDuration()); assertEquals(new KeyPhrase("key", Publisher.BLOOMBERG), Iterables.getOnlyElement(item.getKeyPhrases())); }

Target:
public void testExtractItem() { BloombergDataRow row = BloombergDataRow.builder() .withDate("2014-01-01") .withDescription("description") .withDuration("0:01:01") .withId("id") .withKeywords(ImmutableList.of("key")) .withSource("Bloomberg") .withTitle("title") .build(); Content content = extractor.extract(row); Item item = (Item) content; assertThat(item.getCanonicalUri(), endsWith("id")); assertThat(item.getCurie(), endsWith("id")); assertEquals(item.getPublisher(), Publisher.BLOOMBERG); assertEquals("description", item.getDescription()); assertEquals("title", item.getTitle()); assertEquals(MediaType.VIDEO, item.getMediaType()); assertEquals(Integer.valueOf(61), Iterables.getOnlyElement(item.getVersions()).getDuration()); assertEquals(new KeyPhrase("key", Publisher.BLOOMBERG), Iterables.getOnlyElement(item.getKeyPhrases())); }
Source:
Set<WritableFulltext> writableNodeIndices() { return nodeIndices.values().stream().map( WritableFulltext::new ).collect( Collectors.toSet() ); }

Target:
Set<WritableFulltext> writableNodeIndices() { return Collections.unmodifiableSet( writableNodeIndices ); }
Source:
public void testRunningTaskDoesNotImpactScriptExecution(boolean withSelectionScript) throws Exception { FileLock fileLock = new FileLock(); Path fileLockPath = fileLock.lock(); String scriptCode = "org.ow2.proactive.scheduler.util.FileLock.waitUntilUnlocked(\"" + fileLockPath.toString().replace("\\", "\\\\") + "\")"; log("Submit script (handled asynchronously by the resource manager)"); List<ScriptResult<Object>> resultsFuture = schedulerHelper.getResourceManager() .executeScript(scriptCode, "groovy", TargetType.NODE_URL.name(), Sets.newSet(testNode.getNodeURL())); log("Submit job"); final JobId jobId = schedulerHelper.submitJob(createNonBlockingJob(withSelectionScript)); Thread.sleep(3000); log("Unlock the script"); fileLock.unlock(); log("Wait when job finish"); schedulerHelper.waitForEventJobFinished(jobId, TIMEOUT); Assert.assertEquals(1, resultsFuture.size()); ScriptResult result = resultsFuture.get(0); if (result.errorOccured()) { result.getException().printStackTrace(); Assert.fail("Script execution failed"); } schedulerHelper.waitUntilState(testNode.getNodeURL(), NodeState.FREE, TIMEOUT); log("Check job result"); checkJobResult(schedulerHelper.getSchedulerInterface(), jobId); Assert.assertEquals("After the node is freed, no active object should remain", 0, testNode.getNode().getNumberOfActiveObjects()); }

Target:
public void testRunningTaskDoesNotImpactScriptExecution(boolean withSelectionScript) throws Exception { FileLock fileLock = new FileLock(); Path fileLockPath = fileLock.lock(); String scriptCode = "org.ow2.proactive.scheduler.util.FileLock.waitUntilUnlocked(\"" + fileLockPath.toString().replace("\\", "\\\\") + "\")"; log("Submit script (handled asynchronously by the resource manager)"); List<ScriptResult<Object>> resultsFuture = schedulerHelper.getResourceManager() .executeScript(scriptCode, "groovy", TargetType.NODE_URL.name(), Sets.newSet(testNode.getNodeURL())); log("Submit job"); final JobId jobId = schedulerHelper.submitJob(createNonBlockingJob(withSelectionScript)); Thread.sleep(3000); log("Unlock the script"); fileLock.unlock(); log("Wait when job finish"); schedulerHelper.waitForEventJobFinished(jobId, TIMEOUT); Assert.assertEquals(1, resultsFuture.size()); ScriptResult result = resultsFuture.get(0); if (result.errorOccured()) { result.getException().printStackTrace(); Assert.fail("Script execution failed"); } schedulerHelper.waitUntilState(testNode.getNodeURL(), NodeState.FREE, TIMEOUT); log("Check job result"); checkJobResult(schedulerHelper.getSchedulerInterface(), jobId); checkActiveObjects(); }
Source:
private static void checkNotAdvertisedWants(RevWalk walk, List<ObjectId> notAdvertisedWants, Set<ObjectId> reachableFrom) throws MissingObjectException, IncorrectObjectTypeException, IOException { AsyncRevObjectQueue q = walk.parseAny(notAdvertisedWants, true); RevObject obj; while ((obj = q.next()) != null) { if (!(obj instanceof RevCommit)) throw new PackProtocolException(MessageFormat.format( JGitText.get().wantNotValid, obj.name())); walk.markStart((RevCommit) obj); } for (ObjectId id : reachableFrom) { try { walk.markUninteresting(walk.parseCommit(id)); } catch (IncorrectObjectTypeException notCommit) { continue; } } RevCommit bad = walk.next(); if (bad != null) { throw new PackProtocolException(MessageFormat.format( JGitText.get().wantNotValid, bad.name())); } walk.reset(); }

Target:
private static void checkNotAdvertisedWants(RevWalk walk, List<ObjectId> notAdvertisedWants, Set<ObjectId> reachableFrom) throws MissingObjectException, IncorrectObjectTypeException, IOException { AsyncRevObjectQueue q = walk.parseAny(notAdvertisedWants, true); try { RevObject obj; while ((obj = q.next()) != null) { if (!(obj instanceof RevCommit)) throw new PackProtocolException(MessageFormat.format( JGitText.get().wantNotValid, obj.name())); walk.markStart((RevCommit) obj); } } catch (MissingObjectException notFound) { ObjectId id = notFound.getObjectId(); throw new PackProtocolException(MessageFormat.format( JGitText.get().wantNotValid, id.name()), notFound); } finally { q.release(); } for (ObjectId id : reachableFrom) { try { walk.markUninteresting(walk.parseCommit(id)); } catch (IncorrectObjectTypeException notCommit) { continue; } } RevCommit bad = walk.next(); if (bad != null) { throw new PackProtocolException(MessageFormat.format( JGitText.get().wantNotValid, bad.name())); } walk.reset(); }
Source:
public <T> T build(Class<T> serviceClass, String userAgent, List<String> uris) { Preconditions.checkArgument(!uris.isEmpty()); List<String> sanitizedUris = sanitizeUris(uris); okhttp3.OkHttpClient client = createOkHttpClient(userAgent, sanitizedUris); Retrofit retrofit = new Retrofit.Builder() .client(client) .baseUrl(sanitizedUris.get(0)) .addConverterFactory(JacksonConverterFactory.create()) .build(); return retrofit.create(serviceClass); }

Target:
public <T> T build(Class<T> serviceClass, String userAgent, List<String> uris) { Preconditions.checkArgument(!uris.isEmpty()); List<String> sanitizedUris = addTrailingSlashes(uris); okhttp3.OkHttpClient client = createOkHttpClient(userAgent, sanitizedUris); Retrofit retrofit = new Retrofit.Builder() .client(client) .baseUrl(sanitizedUris.get(0)) .addConverterFactory(JacksonConverterFactory.create()) .build(); return retrofit.create(serviceClass); }
Source:
public void shouldGetNotFoundFor_markChargeAsCaptureApproved_whenNoChargeExists() { connectorRestApiClient .withAccountId(accountId) .withChargeId("i-do-not-exist") .postMarkChargeAsCaptureApproved() .statusCode(NOT_FOUND.getStatusCode()) .contentType(JSON) .body(JSON_MESSAGE_KEY, contains("Charge with id [i-do-not-exist] not found.")) .body("error_identifier", Matchers.is(ErrorIdentifier.GENERIC.toString())); }

Target:
public void shouldGetNotFoundFor_markChargeAsCaptureApproved_whenNoChargeExists() { connectorRestApiClient .withAccountId(accountId) .withChargeId("i-do-not-exist") .postMarkChargeAsCaptureApproved() .statusCode(NOT_FOUND.getStatusCode()) .contentType(JSON) .body(JSON_MESSAGE_KEY, contains("Charge with id [i-do-not-exist] not found.")) .body("error_identifier", is(ErrorIdentifier.GENERIC.toString())); }
Source:
public static Configuration loadConfig(File configFile) { Configuration config = new BaseConfiguration(); ListDelimiterHandler delimiter = new DefaultListDelimiterHandler(','); PropertiesBuilderParameters propertyParameters = new Parameters().properties(); propertyParameters.setFile(configFile); propertyParameters.setThrowExceptionOnMissing(true); propertyParameters.setListDelimiterHandler(delimiter); FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class); builder.configure(propertyParameters); try { config = builder.getConfiguration(); } catch (ConfigurationException cex) { LOGGER.error("loading of IAM configuration failed"); } return config; }

Target:
public static Configuration loadConfig(File configFile) throws ConfigurationException { Configuration config; ListDelimiterHandler delimiter = new DefaultListDelimiterHandler(','); PropertiesBuilderParameters propertyParameters = new Parameters().properties(); propertyParameters.setFile(configFile); propertyParameters.setThrowExceptionOnMissing(true); propertyParameters.setListDelimiterHandler(delimiter); FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class); builder.configure(propertyParameters); config = builder.getConfiguration(); LOGGER.debug("IAM configuration loaded"); return config; }
Source:
public static boolean isJavaName(String name) { return isJavaIdentifier(name) && isNotRestrictedKeyword(name); }

Target:
static boolean isJavaName(String name) { return isNotRestrictedKeyword(name) && isJavaIdentifier(name); }
Source:
public boolean postOldXmlFormat(String message) { boolean error = false; if (StringUtils.isEmpty(message)) { return error; } String[] msgs = message.split("[\\n]", -1); if (msgs.length > 1) { for (String msg : msgs) { error = postOldXmlFormat(msg) || error; } return error; } if (StringUtils.isNotEmpty(message)) { if (message.charAt(0) == '<') { try { error = _internalPostOldXmlFormat(message); } catch (RuntimeException e) { error = true; log.error( "Installation of Host. Received illegal XML from Host. Message: {}", message); log.error("Exception", e); } } else { log.info("VDS message: {}", message); } } return error; }

Target:
public boolean postOldXmlFormat(String message) { boolean error = false; if (StringUtils.isEmpty(message)) { return error; } String[] msgs = message.split("[\\n]", -1); if (msgs.length > 1) { for (String msg : msgs) { error = postOldXmlFormat(msg) || error; } return error; } if (StringUtils.isNotEmpty(message)) { if (message.charAt(0) == '<') { try { error = _internalPostOldXmlFormat(message); } catch (RuntimeException e) { error = true; log.error( "Installation of Host. Received illegal XML from Host. Message: {}", message); log.debug("Exception", e); } } else { log.info("VDS message: {}", message); } } return error; }
Source:
private void onStandbyClusterAddRemove(TopologyDescriptor discoveredTopology) { log.debug("Standby Cluster has been added or removed from topology={}", discoveredTopology); if (localClusterDescriptor.getRole() == ClusterRole.ACTIVE) { if (replicationManager != null && isLeader.get()) { replicationManager.processStandbyChange(discoveredTopology); } } updateLocalTopology(discoveredTopology); updateReplicationManagerTopology(discoveredTopology); logReplicationMetadataManager.setupTopologyConfigId(topologyDescriptor.getTopologyConfigId()); log.debug("Persist new topologyConfigId {}, cluster id={}, status={}", topologyDescriptor.getTopologyConfigId(), localClusterDescriptor.getClusterId(), localClusterDescriptor.getRole()); }

Target:
private void onStandbyClusterAddRemove(TopologyDescriptor discoveredTopology) { log.debug("Standby Cluster has been added or removed from topology={}", discoveredTopology); if (localClusterDescriptor.getRole() == ClusterRole.ACTIVE) { if (replicationManager != null && isLeader.get()) { replicationManager.processStandbyChange(discoveredTopology); } } updateLocalTopology(discoveredTopology); updateReplicationManagerTopology(discoveredTopology); logReplicationMetadataManager.setupTopologyConfigId(topologyDescriptor.getTopologyConfigId()); log.debug("Persist new topologyConfigId {}, cluster id={}, role={}", topologyDescriptor.getTopologyConfigId(), localClusterDescriptor.getClusterId(), localClusterDescriptor.getRole()); }
Source:
public static SubjectAlternativeNames create(final List<String> dnsNames, final List<String> emails, final List<String> upns) { return new AutoValue_Certificate_SubjectAlternativeNames(dnsNames, emails, upns); }

Target:
public static SubjectAlternativeNames create(final List<String> dnsNames, final List<String> emails, final List<String> upns) { return new AutoValue_Certificate_SubjectAlternativeNames( dnsNames != null ? ImmutableList.copyOf(dnsNames) : ImmutableList.<String> of(), emails != null ? ImmutableList.copyOf(emails) : ImmutableList.<String> of(), upns != null ? ImmutableList.copyOf(upns) : ImmutableList.<String> of() ); }
Source:
public List<Order> getAllOrdersByEvent(Event event) throws EventNotFoundException { List<Order> orders = orderService.getAllOrders(); List<Order> ordersAssociatedWithEvent = new ArrayList<>(); for (Order order : orders) { for (OrderProduct orderProduct : order.getOrderProducts()) { Product product = orderProduct.getProduct(); if (eventService.getByProduct(product).equals(event)) { ordersAssociatedWithEvent.add(order); break; } } } return ordersAssociatedWithEvent; }

Target:
public List<Order> getAllOrdersByEvent(Event event) { List<Order> ordersAssociatedWithEvent = new ArrayList<>(); event.getProducts().stream().forEach(product -> ordersAssociatedWithEvent.addAll(orderService.getAllByProduct(product))); return ordersAssociatedWithEvent; }
Source:
public void fileTimeRotationTest() throws ConfigurationLoadingException, InterruptedException { FileTailerQueue queue = new FileTailerQueue(QUEUE_SIZE); PipeConfiguration flowConfig = TailerLogUtils.loadConfig(); LogTailer tailer = TailerLogUtils.createTailer(queue, flowConfig); String filePath = flowConfig.getSourceConfiguration().getWorkDir() + "/" + flowConfig.getSourceConfiguration().getFileName(); ch.qos.logback.classic.Logger logger = TailerLogUtils.getTimeLogger(filePath); RandomStringUtils randomUtils = new RandomStringUtils(); List<String> logList = new ArrayList<String>(ENTRY_NUMBER); List<String> queueReturnList = new ArrayList<String>(ENTRY_NUMBER); tailer.startWorker(); for (int i = 0; i < ENTRY_NUMBER; i++) { String currLine = randomUtils.randomAlphanumeric(LINE_SIZE); logger.debug(currLine); logList.add(currLine); Thread.sleep(WRITING_INTERVAL); } Thread.sleep(2000); for (String str:logList) { Assert.assertEquals(true, queue.take().getEventData().contains(str)); } tailer.stopWorker(); }

Target:
public void fileTimeRotationTest() throws ConfigurationLoadingException, InterruptedException { FileTailerQueue queue = new FileTailerQueue(QUEUE_SIZE); PipeConfiguration flowConfig = TailerLogUtils.loadConfig(); LogTailer tailer = TailerLogUtils.createTailer(queue, flowConfig); String filePath = flowConfig.getSourceConfiguration().getWorkDir().getAbsolutePath() + "/" + flowConfig.getSourceConfiguration().getFileName(); Logger logger = TailerLogUtils.getTimeLogger(filePath); RandomStringUtils randomUtils = new RandomStringUtils(); List<String> logList = new ArrayList<String>(ENTRY_NUMBER); tailer.startAsync(); for (int i = 0; i < ENTRY_NUMBER; i++) { String currLine = randomUtils.randomAlphanumeric(LINE_SIZE); logger.debug(currLine); logList.add(currLine); Thread.currentThread().sleep(WRITING_INTERVAL); } Thread.currentThread().sleep(SLEEP_TIME); tailer.stopAsync(); for (String str:logList) { Assert.assertEquals(true, queue.take().getEventData().contains(str)); } }
Source:
public void shouldWriteAllFieldsIntoMongoDb() throws Exception { String databaseName = mongoRule.getRandomTemporaryDatabaseName(); mongoOperations = getMongoOperations(databaseName, jobOptions.getMongoConnection()); DBCollection fileCollection = mongoRule.getCollection(databaseName, jobOptions.getDbCollectionsFilesName()); VariantSourceEntityMongoWriter filesWriter = new VariantSourceEntityMongoWriter( mongoOperations, jobOptions.getDbCollectionsFilesName()); VariantSourceEntity variantSourceEntity = getVariantSourceEntity(); filesWriter.write(Collections.singletonList(variantSourceEntity)); DBCursor cursor = fileCollection.find(); int count = 0; while (cursor.hasNext()) { count++; DBObject next = cursor.next(); assertNotNull(next.get("fname")); assertNotNull(next.get("fid")); assertNotNull(next.get("sid")); assertNotNull(next.get("sname")); assertNotNull(next.get("samp")); assertNotNull(next.get("stype")); assertNotNull(next.get("date")); assertNotNull(next.get("aggregation")); DBObject meta = (DBObject) next.get("meta"); assertNotNull(meta); assertNotNull(meta.get("fileformat")); assertNotNull(meta.get("header")); assertNotNull(meta.get("ALT")); assertNotNull(meta.get("FILTER")); assertNotNull(meta.get("INFO")); assertNotNull(meta.get("FORMAT")); } assertEquals(1, count); }

Target:
public void shouldWriteAllFieldsIntoMongoDb() throws Exception { String databaseName = mongoRule.getRandomTemporaryDatabaseName(); mongoOperations = getMongoOperations(databaseName, jobOptions.getMongoConnection()); DBCollection fileCollection = mongoRule.getCollection(databaseName, jobOptions.getDbCollectionsFilesName()); VariantSourceEntityMongoWriter filesWriter = new VariantSourceEntityMongoWriter( mongoOperations, jobOptions.getDbCollectionsFilesName()); VariantSourceEntity variantSourceEntity = getVariantSourceEntity(); filesWriter.write(Collections.singletonList(variantSourceEntity)); DBCursor cursor = fileCollection.find(); int count = 0; while (cursor.hasNext()) { count++; DBObject next = cursor.next(); assertNotNull(next.get(VariantSourceEntity.FILEID_FIELD)); assertNotNull(next.get(VariantSourceEntity.FILENAME_FIELD)); assertNotNull(next.get(VariantSourceEntity.STUDYID_FIELD)); assertNotNull(next.get(VariantSourceEntity.STUDYNAME_FIELD)); assertNotNull(next.get(VariantSourceEntity.STUDYTYPE_FIELD)); assertNotNull(next.get(VariantSourceEntity.AGGREGATION_FIELD)); assertNotNull(next.get(VariantSourceEntity.SAMPLES_FIELD)); assertNotNull(next.get(VariantSourceEntity.DATE_FIELD)); DBObject meta = (DBObject) next.get(VariantSourceEntity.METADATA_FIELD); assertNotNull(meta); assertNotNull(meta.get(VariantSourceEntity.METADATA_FILEFORMAT_FIELD)); assertNotNull(meta.get(VariantSourceEntity.METADATA_HEADER_FIELD)); assertNotNull(meta.get("ALT")); assertNotNull(meta.get("FILTER")); assertNotNull(meta.get("INFO")); assertNotNull(meta.get("FORMAT")); } assertEquals(1, count); }
Source:
public void innerReceive(String dataId, String group, String configInfo) { String oldValue = cacheData.get(dataId); ConfigChangeEvent event = new ConfigChangeEvent(dataId, configInfo, getChangeType(configInfo, oldValue)); cacheData.put(dataId, configInfo); listeners.forEach(listener -> listener.process(event)); }

Target:
public void innerReceive(String dataId, String group, String configInfo) { String oldValue = cacheData.get(dataId); ConfigChangeEvent event = new ConfigChangeEvent(dataId, configInfo, getChangeType(configInfo, oldValue)); if (configInfo == null) { cacheData.remove(dataId); } else { cacheData.put(dataId, configInfo); } listeners.forEach(listener -> listener.process(event)); }
Source:
public SecureStore get() { return injector.getInstance(getSecureStoreImpl()); }

Target:
public SecureStore get() { if (instance == null) { instance = injector.getInstance(getSecureStoreImpl()); } return instance; }
Source:
protected InPlaceCheckBoxTreeDialog createInPlaceCheckBoxTreeDialog(List<String> values) { Map<String, String> validDescriptions = getTaskAttribute().getOptions(); LinkedHashMap<String, String> validValues = new LinkedHashMap<String, String>(validDescriptions.size()); for (String value : validDescriptions.keySet()) { validValues.put(value, value); } InPlaceCheckBoxTreeDialog selectionDialog = new InPlaceCheckBoxTreeDialog(WorkbenchUtil.getShell(), getButton(), values, validValues, NLS.bind(Messages.BugzillaKeywordAttributeEditor_Select_X, getLabel()), validDescriptions); return selectionDialog; }

Target:
protected InPlaceCheckBoxTreeDialog createInPlaceCheckBoxTreeDialog(List<String> values) { Map<String, String> validDescriptions = getTaskAttribute().getOptions(); LinkedHashMap<String, String> validValues = new LinkedHashMap<String, String>(validDescriptions.size()); for (String value : validDescriptions.keySet()) { validValues.put(value, value); } return new InPlaceCheckBoxTreeDialog(WorkbenchUtil.getShell(), getButton(), values, validValues, NLS.bind(Messages.BugzillaKeywordAttributeEditor_Select_X, getLabel()), validDescriptions); }
Source:
protected void executeIrsBrokerCommand() { setReturnValue(Guid.Empty); log.info("-- executeIrsBrokerCommand: calling 'createVolume' with two new parameters: description and UUID"); log.infoFormat( "-- createVolume parameters: sdUUID={0} spUUID={1} imgGUID={2} size={3} bytes volFormat={4} volType={5} volUUID={6} descr={7} srcImgGUID={8} srcVolUUID={9}", getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getImageGroupId().toString(), getParameters().getImageSizeInBytes(), getParameters().getVolumeFormat().name(), getParameters().getImageType().name(), getParameters().getNewImageID().toString(), getParameters().getNewImageDescription(), getParameters().getSourceImageGroupId().toString(), getParameters().getImageId().toString()); uuidReturn = getIrsProxy().createVolume(getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getImageGroupId().toString(), (Long.valueOf(getParameters().getImageSizeInBytes())).toString(), getParameters().getVolumeFormat().getValue(), getParameters().getImageType().getValue(), 2, getParameters().getNewImageID().toString(), getParameters().getNewImageDescription(), getParameters().getSourceImageGroupId().toString(), getParameters().getImageId().toString()); proceedProxyReturnValue(); Guid taskID = new Guid(uuidReturn.mUuid); mCreatedImageId = getParameters().getNewImageID().toString(); setReturnValue(new Guid(mCreatedImageId)); getVDSReturnValue().setCreationInfo( new AsyncTaskCreationInfo(taskID, AsyncTaskType.createVolume, getParameters().getStoragePoolId())); }

Target:
protected void executeIrsBrokerCommand() { setReturnValue(Guid.Empty); log.info("-- executeIrsBrokerCommand: calling 'createVolume' with two new parameters: description and UUID"); uuidReturn = getIrsProxy().createVolume(getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getImageGroupId().toString(), (Long.valueOf(getParameters().getImageSizeInBytes())).toString(), getParameters().getVolumeFormat().getValue(), getParameters().getImageType().getValue(), 2, getParameters().getNewImageID().toString(), getParameters().getNewImageDescription(), getParameters().getSourceImageGroupId().toString(), getParameters().getImageId().toString()); proceedProxyReturnValue(); Guid taskID = new Guid(uuidReturn.mUuid); mCreatedImageId = getParameters().getNewImageID().toString(); setReturnValue(new Guid(mCreatedImageId)); getVDSReturnValue().setCreationInfo( new AsyncTaskCreationInfo(taskID, AsyncTaskType.createVolume, getParameters().getStoragePoolId())); }
Source:
public void onTrackInfoChanged(@NonNull SessionPlayer player, @NonNull List<TrackInfo> trackInfos) { onTracksChanged(player, trackInfos); }

Target:
public void onTrackInfoChanged(@NonNull SessionPlayer player, @NonNull List<TrackInfo> trackInfos) { }
Source:
public void copyPackets(long startTime, long endTime, String newTracePath) throws CTFException { CTFTrace trace = fInTrace; if (trace != null) { long adjustedStart = startTime - trace.getClock().getClockOffset(); long adjustedEnd = endTime - trace.getClock().getClockOffset(); File out = new File(newTracePath); boolean directoryExists = out.exists(); if (directoryExists && (!out.isDirectory() || out.listFiles().length != 0)) { throw new CTFIOException("Trace segment cannot be created since trace already exists: " + newTracePath); } else if (!out.exists()) { boolean isSuccess = out.mkdir(); if (!isSuccess) { throw new CTFIOException("Creating trace directory failed: " + newTracePath); } } Metadata metadata = new Metadata(fInTrace); try { metadata.copyTo(out); } catch (IOException e) { throw new CTFIOException("Error copying metadata: " + e.toString(), e); } for (ICTFStream stream : trace.getStreams()) { Set<CTFStreamInput> inputs = stream.getStreamInputs(); for (CTFStreamInput s : inputs) { CTFStreamOutputWriter streamOutputwriter = new CTFStreamOutputWriter(checkNotNull(s), out); streamOutputwriter.copyPackets(adjustedStart, adjustedEnd); } } } }

Target:
public void copyPackets(long startTime, long endTime, String newTracePath) throws CTFException { CTFTrace trace = fInTrace; if (trace != null) { long adjustedStart = startTime - trace.getClock().getClockOffset(); long adjustedEnd = endTime - trace.getClock().getClockOffset(); File out = new File(newTracePath); boolean directoryExists = out.exists(); if (directoryExists && (!out.isDirectory() || out.listFiles().length != 0)) { throw new CTFIOException("Trace segment cannot be created since trace already exists: " + newTracePath); } else if (!out.exists()) { boolean isSuccess = out.mkdirs(); if (!isSuccess) { throw new CTFIOException("Creating trace directory failed: " + newTracePath); } } Metadata metadata = new Metadata(fInTrace); try { metadata.copyTo(out); } catch (IOException e) { throw new CTFIOException("Error copying metadata: " + e.toString(), e); } for (ICTFStream stream : trace.getStreams()) { Set<CTFStreamInput> inputs = stream.getStreamInputs(); for (CTFStreamInput s : inputs) { CTFStreamOutputWriter streamOutputwriter = new CTFStreamOutputWriter(checkNotNull(s), out); streamOutputwriter.copyPackets(adjustedStart, adjustedEnd); } } } }