auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public RemoteConnection(LinkedHashMap<String, Object> connectionParams) throws IOException { host = (String) connectionParams.get("host"); try{ port = (Integer) connectionParams.get("port"); } catch(ClassCastException e) { port = Integer.parseInt((String) connectionParams.get("port")); } user = (String) connectionParams.get("user"); password = (String) connectionParams.get("password"); jmx_url = (String) connectionParams.get("jmx_url"); if (connectionParams.containsKey("path")){ path = (String) connectionParams.get("path"); } env = getEnv(connectionParams); address = getAddress(connectionParams); String trustStorePath; String trustStorePassword; if (connectionParams.containsKey(TRUST_STORE_PATH_KEY) && connectionParams.containsKey(TRUST_STORE_PASSWORD_KEY)) { trustStorePath = (String) connectionParams.get(TRUST_STORE_PATH_KEY); trustStorePassword = (String) connectionParams.get(TRUST_STORE_PASSWORD_KEY); if (trustStorePath != null && trustStorePassword != null) { System.setProperty("javax.net.ssl.trustStore", trustStorePath); System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword); LOGGER.info("Setting trustStore path: " + trustStorePath + " and trustStorePassword"); } } System.setProperty("sun.rmi.transport.tcp.responseTimeout", DEFAULT_RMI_RESPONSE_TIMEOUT); createConnection(); }

Target:
public RemoteConnection(LinkedHashMap<String, Object> connectionParams) throws IOException { host = (String) connectionParams.get("host"); try{ port = (Integer) connectionParams.get("port"); } catch(ClassCastException e) { port = Integer.parseInt((String) connectionParams.get("port")); } user = (String) connectionParams.get("user"); password = (String) connectionParams.get("password"); jmx_url = (String) connectionParams.get("jmx_url"); rmi_timeout = (String) connectionParams.get("rmi_client_timeout"); if (rmi_timeout == null) { rmi_timeout = DEFAULT_RMI_RESPONSE_TIMEOUT; } if (connectionParams.containsKey("path")){ path = (String) connectionParams.get("path"); } env = getEnv(connectionParams); address = getAddress(connectionParams); String trustStorePath; String trustStorePassword; if (connectionParams.containsKey(TRUST_STORE_PATH_KEY) && connectionParams.containsKey(TRUST_STORE_PASSWORD_KEY)) { trustStorePath = (String) connectionParams.get(TRUST_STORE_PATH_KEY); trustStorePassword = (String) connectionParams.get(TRUST_STORE_PASSWORD_KEY); if (trustStorePath != null && trustStorePassword != null) { System.setProperty("javax.net.ssl.trustStore", trustStorePath); System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword); LOGGER.info("Setting trustStore path: " + trustStorePath + " and trustStorePassword"); } } System.setProperty("sun.rmi.transport.tcp.responseTimeout", rmi_timeout); createConnection(); }
Source:
protected void executeCommand() { final VDS vds = getVds(); try (EngineLock monitoringLock = acquireMonitorLock("Activate")) { ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintenanceVds, false); setSucceeded(setVdsStatus(VDSStatus.Unassigned).getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(() -> { List<Network> networks = getNetworkDao().getAllForCluster(vds.getClusterId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getClusterId(), net); } return null; }); if (vds.getHighlyAvailableIsConfigured()) { SetHaMaintenanceModeVDSCommandParameters param = new SetHaMaintenanceModeVDSCommandParameters(vds, HaMaintenanceMode.LOCAL, false); if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded()) { haMaintenanceFailed = true; } } if (vds.getClusterSupportsGlusterService()) { runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "restart")); } } } }

Target:
protected void executeCommand() { final VDS vds = getVds(); try (EngineLock monitoringLock = acquireMonitorLock("Activate host")) { ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintenanceVds, false); setSucceeded(setVdsStatus(VDSStatus.Unassigned).getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(() -> { List<Network> networks = getNetworkDao().getAllForCluster(vds.getClusterId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getClusterId(), net); } return null; }); if (vds.getHighlyAvailableIsConfigured()) { SetHaMaintenanceModeVDSCommandParameters param = new SetHaMaintenanceModeVDSCommandParameters(vds, HaMaintenanceMode.LOCAL, false); if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded()) { haMaintenanceFailed = true; } } if (vds.getClusterSupportsGlusterService()) { runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "restart")); } } } }
Source:
public QRCodeTabsActivityPage clickConfigureQRWithAdminPassword(String password) { clickOnString(R.string.configure_via_qr_code); inputText("blah"); clickOKOnDialog(); return new QRCodeTabsActivityPage(rule).assertOnPage(); }

Target:
public QRCodeTabsActivityPage clickConfigureQRWithAdminPassword(String password) { clickOnString(R.string.configure_via_qr_code); inputText(password); clickOKOnDialog(); return new QRCodeTabsActivityPage(rule).assertOnPage(); }
Source:
public void clusteredCacheManagerExample() throws Exception { final CacheManagerBuilder<PersistentCacheManager> clusteredCacheManagerBuilder = CacheManagerBuilder.newCacheManagerBuilder() .with(ClusteringServiceConfigurationBuilder.cluster(URI.create("<LINK_0>"))); final PersistentCacheManager cacheManager = clusteredCacheManagerBuilder.build(true); cacheManager.close(); }

Target:
public void clusteredCacheManagerExample() throws Exception { final CacheManagerBuilder<PersistentCacheManager> clusteredCacheManagerBuilder = CacheManagerBuilder.newCacheManagerBuilder() .with(ClusteringServiceConfigurationBuilder.cluster(URI.create("http://localhost:9510/my-application?auto-create"))); final PersistentCacheManager cacheManager = clusteredCacheManagerBuilder.build(true); cacheManager.close(); }
Source:
public TaskResult runTask() { try (TDOperator op = TDOperator.fromConfig(params)) { TDJobOperator job = op.runJob(state, POLL_JOB, this::startJob); state.remove(POLL_JOB); logger.debug("fetching poll job result: {}", job.getJobId()); boolean done = fetchJobResult(job); if (!done) { state.remove(JOB_ID); throw TaskExecutionException.ofNextPolling(pollInterval, ConfigElement.copyOf(state)); } return TaskResult.empty(request); } }

Target:
public TaskResult runTask() { try (TDOperator op = TDOperator.fromConfig(params)) { TDJobOperator job = op.runJob(state, POLL_JOB, this::startJob); state.remove(POLL_JOB); logger.debug("fetching poll job result: {}", job.getJobId()); boolean done = fetchJobResult(job); if (!done) { throw TaskExecutionException.ofNextPolling(pollInterval, ConfigElement.copyOf(state)); } return TaskResult.empty(request); } }
Source:
protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { binding = BearingWidgetAnswerBinding.inflate(((Activity) context).getLayoutInflater()); if (prompt.isReadOnly()) { binding.bearingButton.setVisibility(GONE); } else { binding.bearingButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.bearingButton.setOnClickListener(v -> onButtonClick()); } binding.answerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); return binding.getRoot(); }

Target:
protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { binding = BearingWidgetAnswerBinding.inflate(((Activity) context).getLayoutInflater()); if (prompt.isReadOnly()) { binding.bearingButton.setVisibility(GONE); } else { binding.bearingButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.bearingButton.setOnClickListener(v -> onButtonClick()); } binding.answerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.answerText.setBackground(null); String answerText = prompt.getAnswerText(); if (answerText != null && !answerText.isEmpty()) { binding.bearingButton.setText(getContext().getString(R.string.replace_bearing)); binding.answerText.setText(answerText); } return binding.getRoot(); }
Source:
public final Parcelable.Creator<?> readParcelableCreator(ClassLoader loader) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException { final String name = realObject.readString(); if (name == null) return null; ClassLoader parcelableClassLoader = (loader == null ? getClass().getClassLoader() : loader); Class<?> parcelableClass = Class.forName(name, false , parcelableClassLoader); Field field = parcelableClass.getField("CREATOR"); field.setAccessible(true); return (Parcelable.Creator<?>) field.get(null ); }

Target:
public Parcelable.Creator<?> readParcelableCreator(ClassLoader loader) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException { final String name = realObject.readString(); if (name == null) return null; ClassLoader parcelableClassLoader = (loader == null ? getClass().getClassLoader() : loader); Class<?> parcelableClass = Class.forName(name, false , parcelableClassLoader); Field field = parcelableClass.getField("CREATOR"); field.setAccessible(true); return (Parcelable.Creator<?>) field.get(null ); }
Source:
default CompletableFuture<Map<K, V>> getAllAsync(Collection<K> keys) { Map<CompletableFuture<V>, K> getFutures = keys.stream() .collect(Collectors.toMap(k -> getAsync(k), Function.identity())); return CompletableFuture.allOf( Iterables.toArray(getFutures.keySet(), CompletableFuture.class)) .thenApply(future -> getFutures.keySet().stream() .collect(Collectors.toMap(f -> getFutures.get(f), f -> f.join()))); }

Target:
default CompletableFuture<Map<K, V>> getAllAsync(Collection<K> keys) { Map<K, CompletableFuture<V>> getFutures = keys.stream().collect( Collectors.toMap(k -> k, k -> getAsync(k))); return CompletableFuture.allOf( Iterables.toArray(getFutures.values(), CompletableFuture.class)) .thenApply(future -> getFutures.entrySet() .stream() .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().join()))); }
Source:
TemporaryJobs(final Builder builder, final Config config) { if (builder.heliosDeployment != null) { this.heliosDeployment = builder.heliosDeployment; } else { this.heliosDeployment = getOrCreateHeliosSoloDeployment(); } client = checkNotNull(heliosDeployment.client(), "client"); this.prober = checkNotNull(builder.prober, "prober"); this.defaultHostFilter = checkNotNull(builder.hostFilter, "hostFilter"); this.env = checkNotNull(builder.env, "env"); this.jobPrefix = checkNotNull(builder.jobPrefix, "jobPrefix"); checkArgument(builder.deployTimeoutMillis >= 0, "deployTimeoutMillis"); this.undeployer = new DefaultUndeployer(client); this.deployer = fromNullable(builder.deployer).or( new DefaultDeployer(client, jobs, builder.hostPickingStrategy, builder.jobDeployedMessageFormat, builder.deployTimeoutMillis, undeployer)); final Config configWithPrefix = ConfigFactory.empty() .withValue("prefix", ConfigValueFactory.fromAnyRef(jobPrefix)); this.config = config.withFallback(configWithPrefix).resolve(); }

Target:
private TemporaryJobs(final Builder builder, final Config config) { final HeliosDeployment heliosDeployment = builder.heliosDeployment == null ? singletonHeliosSoloDeployment() : builder.heliosDeployment; client = checkNotNull(heliosDeployment.client(), "client"); this.prober = checkNotNull(builder.prober, "prober"); this.defaultHostFilter = checkNotNull(builder.hostFilter, "hostFilter"); this.env = checkNotNull(builder.env, "env"); this.jobPrefix = checkNotNull(builder.jobPrefix, "jobPrefix"); checkArgument(builder.deployTimeoutMillis >= 0, "deployTimeoutMillis"); this.undeployer = new DefaultUndeployer(client); this.deployer = fromNullable(builder.deployer).or( new DefaultDeployer(client, jobs, builder.hostPickingStrategy, builder.jobDeployedMessageFormat, builder.deployTimeoutMillis, undeployer)); final Config configWithPrefix = ConfigFactory.empty() .withValue("prefix", ConfigValueFactory.fromAnyRef(jobPrefix)); this.config = config.withFallback(configWithPrefix).resolve(); }
Source:
public CompletableFuture<Tuple<List<MapBean>, Integer>> getMatchmakerMapsWithPageCount(int matchmakerQueueId, int count, int page) { Tuple<List<MatchmakerQueueMapPool>, java.util.Map<String, ?>> tuple = fafApiAccessor.getMatchMakerPoolsWithMeta(matchmakerQueueId, count, page); return CompletableFuture.completedFuture(new Tuple<>(tuple.getFirst() .parallelStream() .map(MatchmakerQueueMapPool::getMapPool) .flatMap(mapPool -> mapPool.getMapVersions().stream()) .distinct() .map(MapBean::fromMapVersionDto) .collect(toList()), ((HashMap<String,Integer>) tuple.getSecond().get("page")).get("totalPages"))); }

Target:
public CompletableFuture<Tuple<List<MapBean>, Integer>> getMatchmakerMapsWithPageCount(int matchmakerQueueId, int count, int page) { List<MapVersion> mapVersions = fafApiAccessor.getMatchmakerPools(matchmakerQueueId) .stream() .map(MatchmakerQueueMapPool::getMapPool) .flatMap(mapPool -> mapPool.getMapVersions().stream()) .distinct() .collect(toList()); int totalPages = (mapVersions.size() - 1) / count + 1; return CompletableFuture.completedFuture(new Tuple<>(mapVersions .stream() .skip((page - 1) * count) .limit(count) .map(MapBean::fromMapVersionDto) .collect(toList()), totalPages)); }
Source:
public void onServerEventTest() { if (useComposite) { return; } mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Down}, ServerErrorCode.Replica_Unavailable, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Down}); mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Down}, ServerErrorCode.Temporarily_Disabled, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Down}); mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Down}, ServerErrorCode.Partition_ReadOnly, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Up}); mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Up}, ServerErrorCode.IO_Error, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Down}); mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Up}, ServerErrorCode.Disk_Unavailable, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Down}); }

Target:
public void onServerEventTest() { if (useComposite) { return; } mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Up}, ServerErrorCode.Replica_Unavailable, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Down}); mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Up}, ServerErrorCode.Temporarily_Disabled, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Down}); mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Down}, ServerErrorCode.Replica_Unavailable, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Down}); mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Down}, ServerErrorCode.Temporarily_Disabled, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Down}); mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Down}, ServerErrorCode.Partition_ReadOnly, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Up}); mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Up}, ServerErrorCode.IO_Error, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Down}); mockServerEventsAndVerify( new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Up, ResourceState.Replica_Up}, ServerErrorCode.Disk_Unavailable, new ResourceState[]{ResourceState.Node_Up, ResourceState.Disk_Down, ResourceState.Replica_Down}); }
Source:
public @Nonnull List<String> getVolumeSnapshotIdsFor(String nameOrId) { final Collection<VolumeSnapshot> sortedObjects = new TreeSet<>(VOLUMESNAPSHOT_DATE_COMPARATOR); final Map<String, Collection<VolumeSnapshot>> allVolumeSnapshots = getVolumeSnapshots(); final Collection<VolumeSnapshot> findByName = allVolumeSnapshots.get(nameOrId); if (findByName != null) { for (VolumeSnapshot o : findByName) { if (o.getStatus() == Volume.Status.AVAILABLE) { sortedObjects.add(o); } } } if (nameOrId.matches("[0-9a-f-]{36}")) { final VolumeSnapshot findById = clientProvider.get().blockStorage().snapshots().get(nameOrId); if (findById != null && findById.getStatus() == Volume.Status.AVAILABLE) { sortedObjects.add(findById); } } final List<String> ids = new ArrayList<>(); for (VolumeSnapshot i : sortedObjects) { ids.add(i.getId()); } return ids; }

Target:
public @Nonnull List<String> getVolumeSnapshotIdsFor(String nameOrId) { final Collection<VolumeSnapshot> sortedObjects = new TreeSet<>(VOLUMESNAPSHOT_DATE_COMPARATOR); final Map<String, Collection<VolumeSnapshot>> allVolumeSnapshots = getVolumeSnapshots(); final Collection<VolumeSnapshot> findByName = allVolumeSnapshots.get(nameOrId); if (findByName != null) { sortedObjects.addAll(findByName); } if (nameOrId.matches("[0-9a-f-]{36}")) { final VolumeSnapshot findById = clientProvider.get().blockStorage().snapshots().get(nameOrId); if (findById != null && findById.getStatus() == Status.AVAILABLE) { sortedObjects.add(findById); } } final List<String> ids = new ArrayList<>(); for (VolumeSnapshot i : sortedObjects) { ids.add(i.getId()); } return ids; }
Source:
public String borrow(){ return String.join(" ", "A borrower",name,"wants to get some money."); }

Target:
public String borrow(){ return String.format("Borrower %s wants to get some money.",name); }
Source:
public Shell getShell(TimePeriod timePeriod, Matcher<?>... matchers) { ShellMatchingMatcherIsAvailable shellCondition = new ShellMatchingMatcherIsAvailable(matchers); try{ new WaitUntil(shellCondition, timePeriod); }catch (WaitTimeoutExpiredException e) { AndMatcher am = new AndMatcher(matchers); String exceptionText = "No matching shell found with " + am; exceptionText += "\n" + new DiagnosticTool().getShellsDiagnosticInformation(); throw new CoreLayerException(exceptionText); } return shellCondition.getResult(); }

Target:
public Shell getShell(TimePeriod timePeriod, Matcher<?>... matchers) { ShellMatchingMatcherIsAvailable shellCondition = new ShellMatchingMatcherIsAvailable(matchers); try{ new WaitUntil(shellCondition, timePeriod); }catch (WaitTimeoutExpiredException e) { String exceptionText = shellCondition.errorMessageUntil(); exceptionText += "\n" + new DiagnosticTool().getShellsDiagnosticInformation(); throw new CoreLayerException(exceptionText); } return shellCondition.getResult(); }
Source:
public void mergeDiscoveredPackages(ContentDiscoveryReport report) { int resourceId = report.getResourceId(); long start = System.currentTimeMillis(); if (LOG.isDebugEnabled()) { LOG.debug("Merging [" + report.getDeployedPackages().size() + "] packages for Resource with id [" + resourceId + "]..."); } ResourceCriteria c = new ResourceCriteria(); c.addFilterId(resourceId); c.fetchInstalledPackages(true); List<Resource> result = resourceManager.findResourcesByCriteria(subjectManager.getOverlord(), c); if (result.isEmpty()) { LOG.error("Invalid resource ID specified for merge. Resource ID: " + resourceId); return; } Resource resource = result.get(0); Set<InstalledPackage> doomedPackages = new HashSet<InstalledPackage>(resource.getInstalledPackages()); long timestamp = System.currentTimeMillis(); for (ResourcePackageDetails discoveredPackage : report.getDeployedPackages()) { contentManager.handleDiscoveredPackage(resource, discoveredPackage, doomedPackages, timestamp); } contentManager.removeInstalledPackages(resource, doomedPackages, timestamp); if (LOG.isDebugEnabled()) { LOG.debug("Finished merging [" + report.getDeployedPackages().size() + "] packages in " + (System.currentTimeMillis() - start) + "ms"); } try{ DataPurgeJob.purgeNow(); }catch (Exception e){ LOG.warn("Error trying to schedule a purge job."); } }

Target:
public void mergeDiscoveredPackages(ContentDiscoveryReport report) { int resourceId = report.getResourceId(); long start = System.currentTimeMillis(); if (LOG.isDebugEnabled()) { LOG.debug("Merging [" + report.getDeployedPackages().size() + "] packages for Resource with id [" + resourceId + "]..."); } ResourceCriteria c = new ResourceCriteria(); c.addFilterId(resourceId); c.fetchInstalledPackages(true); List<Resource> result = resourceManager.findResourcesByCriteria(subjectManager.getOverlord(), c); if (result.isEmpty()) { LOG.error("Invalid resource ID specified for merge. Resource ID: " + resourceId); return; } Resource resource = result.get(0); Set<InstalledPackage> doomedPackages = new HashSet<InstalledPackage>(resource.getInstalledPackages()); long timestamp = System.currentTimeMillis(); for (ResourcePackageDetails discoveredPackage : report.getDeployedPackages()) { contentManager.handleDiscoveredPackage(resource, discoveredPackage, doomedPackages, timestamp); } contentManager.removeInstalledPackages(resource, doomedPackages, timestamp); if (LOG.isDebugEnabled()) { LOG.debug("Finished merging [" + report.getDeployedPackages().size() + "] packages in " + (System.currentTimeMillis() - start) + "ms"); } }
Source:
protected String getResource() { return "taskmodel.bpmn"; }

Target:
protected String getResource() { return "taskModel.bpmn"; }
Source:
default ServerEvents getEvents() { Response response = execute(GET_EVENTS); ArrayList<CommandEvent> commands = new ArrayList<>(); ArrayList<ServerEvent> events = new ArrayList<>(); String jsonData = new Json().toJson(response.getValue()); Map<String, Object> value = (Map<String, Object>) response.getValue(); for (String name : value.keySet()) { if (name.equals("commands")) { ArrayList<Map<String, Object>> cmds = (ArrayList<Map<String, Object>>) value.get(name); for (Map<String, Object> cmd : cmds) { commands.add(new CommandEvent( (String) cmd.get("cmd"), ((Long) cmd.get("startTime")).intValue(), ((Long) cmd.get("endTime")).intValue() )); } } else { ArrayList<Long> timestamps = (ArrayList<Long>) value.get(name); List<Integer> intStamps = timestamps .stream() .map(Long::intValue) .collect(Collectors.toList()); events.add(new ServerEvent(name, intStamps)); } } return new ServerEvents(commands, events, jsonData); }

Target:
default ServerEvents getEvents() { Response response = execute(GET_EVENTS); String jsonData = new Json().toJson(response.getValue()); Map<String, Object> value = (Map<String, Object>) response.getValue(); List<CommandEvent> commands = ((List<Map<String, Object>>) value.get("commands")) .stream() .map((Map<String, Object> cmd) -> new CommandEvent( (String) cmd.get("cmd"), ((Long) cmd.get("startTime")), ((Long) cmd.get("endTime")) )) .collect(Collectors.toList()); List<TimedEvent> events = value.keySet().stream() .filter((String name) -> !name.equals("commands")) .map((String name) -> { return new TimedEvent(name, (List<Long>) value.get(name)); }) .collect(Collectors.toList()); return new ServerEvents(commands, events, jsonData); }
Source:
protected void tick(Block b) { Block fluid = b.getRelative(BlockFace.DOWN); Optional<ItemStack> bucket = getFilledBucket(fluid); if (bucket.isPresent() && getCharge(b.getLocation()) >= ENERGY_CONSUMPTION) { BlockMenu menu = BlockStorage.getInventory(b); for (int slot : getInputSlots()) { if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.BUCKET), true, false)) { if (!menu.fits(bucket.get(), getOutputSlots())) { return; } Block consume = findFluid(fluid); if (consume == null) return; removeCharge(b.getLocation(), ENERGY_CONSUMPTION); menu.consumeItem(slot); menu.pushItem(bucket.get().clone(), getOutputSlots()); consume.setType(Material.AIR); return; } } } }

Target:
protected void tick(Block b) { Block fluid = b.getRelative(BlockFace.DOWN); Optional<ItemStack> bucket = getFilledBucket(fluid); if (bucket.isPresent() && getCharge(b.getLocation()) >= ENERGY_CONSUMPTION) { BlockMenu menu = BlockStorage.getInventory(b); for (int slot : getInputSlots()) { if (SlimefunUtils.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.BUCKET), true, false)) { if (!menu.fits(bucket.get(), getOutputSlots())) { return; } Block nextFluid = findNextFluid(fluid); if (nextFluid == null) return; removeCharge(b.getLocation(), ENERGY_CONSUMPTION); menu.consumeItem(slot); menu.pushItem(bucket.get().clone(), getOutputSlots()); nextFluid.setType(Material.AIR); return; } } } }
Source:
public Stream<RDF4JQuad> stream(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) { Resource subj = (Resource) rdf4jTermFactory.asValue(subject); org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); Value obj = rdf4jTermFactory.asValue(object); Resource[] contexts = asContexts(graphName); RepositoryConnection conn = getRepositoryConnection(); RepositoryResult<Statement> statements = conn.getStatements(subj, pred, obj, includeInferred, contexts); return Iterations.stream(statements).map(this::asTripleLike); }

Target:
public Stream<RDF4JQuad> stream(Optional<BlankNodeOrIRI> graphName, BlankNodeOrIRI subject, IRI predicate, RDFTerm object) { Resource subj = (Resource) rdf4jTermFactory.asValue(subject); org.eclipse.rdf4j.model.IRI pred = (org.eclipse.rdf4j.model.IRI) rdf4jTermFactory.asValue(predicate); Value obj = rdf4jTermFactory.asValue(object); Resource[] contexts = asContexts(graphName); RepositoryConnection conn = getRepositoryConnection(); Stream<RDF4JQuad> stream = null; try { RepositoryResult<Statement> statements = conn.getStatements(subj, pred, obj, includeInferred, contexts); stream = Iterations.stream(statements).map(rdf4jTermFactory::asQuad); } finally { if (stream == null) { conn.close(); } } return stream.onClose(conn::close); }
Source:
public void run() { log.info( "Starting deletion of dangling service accounts ({})", this.getClass().getSimpleName()); Set<String> serviceAccountsToKeep = pipelineDAO .all() .parallelStream() .flatMap( pipeline -> pipeline.getTriggers().stream() .map(trigger -> (String) trigger.get(RUN_AS_USER)) .filter(isManagedServiceAccount()) .distinct()) .collect(Collectors.toSet()); serviceAccountDAO .all() .parallelStream() .map(ServiceAccount::getName) .filter(isManagedServiceAccount()) .filter(serviceAccount -> !serviceAccountsToKeep.contains(serviceAccount)) .forEach(serviceAccountDAO::delete); }

Target:
public void run() { log.info( "Starting deletion of dangling service accounts ({})", this.getClass().getSimpleName()); Set<String> serviceAccountsToKeep = pipelineDAO .all() .parallelStream() .flatMap( pipeline -> pipeline.getTriggers().stream() .map(trigger -> (String) trigger.get(RUN_AS_USER)) .filter(isManagedServiceAccount()) .distinct()) .collect(Collectors.toSet()); serviceAccountDAO .all() .parallelStream() .map(ServiceAccount::getName) .filter(isManagedServiceAccount()) .filter(serviceAccount -> !serviceAccountsToKeep.contains(serviceAccount)) .peek( serviceAccount -> log.info( "Deleting managed service account '{}' because it is not in use", serviceAccount)) .forEach(serviceAccountDAO::delete); log.info("Finished deletion of dangling service accounts "); }
Source:
public boolean setExpiryPolicy(K key, ExpiryPolicy expiryPolicy) { if (isClusterVersionLessThan(Versions.V3_11)) { throw new UnsupportedOperationException("setExpiryPolicy operation is available" + "when cluster version is 3.11 or higher"); } try { ensureOpen(); validateNotNull(key); validateNotNull(expiryPolicy); Data keyData = serializationService.toData(key); Data expiryPolicyData = serializationService.toData(expiryPolicy); List<Data> list = Collections.singletonList(keyData); Operation operation = operationProvider.createSetExpiryPolicyOperation(list, expiryPolicyData); Future<Boolean> future = invoke(operation, keyData, true); return future.get(); } catch (Exception e) { throw rethrowAllowedTypeFirst(e, CacheException.class); } }

Target:
public boolean setExpiryPolicy(K key, ExpiryPolicy expiryPolicy) { if (isClusterVersionLessThan(Versions.V3_11)) { throw new UnsupportedOperationException("setExpiryPolicy operation is available" + "when cluster version is 3.11 or higher"); } try { ensureOpen(); validateNotNull(key); validateNotNull(expiryPolicy); Data keyData = serializationService.toData(key); Data expiryPolicyData = serializationService.toData(expiryPolicy); List<Data> list = Collections.singletonList(keyData); Operation operation = operationProvider.createSetExpiryPolicyOperation(list, expiryPolicyData); Future<Boolean> future = invoke(operation, keyData, true); return future.get(); } catch (Throwable e) { throw rethrowAllowedTypeFirst(e, CacheException.class); } }
Source:
public BatchIterator<Row> apply(BatchIterator<Row> batchIterator) { return CollectingBatchIterator .newInstance(batchIterator, Collector.of( () -> new State(rowWriter), (state, row) -> { Object sysNodeCheckId = row.get(0); state.rowWriter.accept(sysNodeCheckId); SysNodeCheck sysNodeCheck = (SysNodeCheck) sysRowUpdater.getRow(sysNodeCheckId); expressions.forEach(x -> x.setNextRow(sysNodeCheck)); Object[] result = new Object[inputs.size()]; for (int i = 0; i < result.length; i++) { result[i] = inputs.get(i).value(); } state.resultRows.add(result); }, (state1, state2) -> { throw new UnsupportedOperationException( "Combine not supported"); }, state -> new CollectionBucket(state.resultRows) )); }

Target:
public BatchIterator<Row> apply(BatchIterator<Row> batchIterator) { return CollectingBatchIterator .newInstance(batchIterator, Collector.of( ArrayList<Object[]>::new, (acc, row) -> { Object[] returnValues = evaluateReturnValues(row); acc.add(returnValues); }, (state1, state2) -> { throw new UnsupportedOperationException( "Combine not supported"); }, CollectionBucket::new )); }
Source:
private Map<String, Map<String, String>> parsePluginConfigValues( List<String> pluginConfigValues) throws UnloggedFailure { Map<String, Map<String, String>> m = new HashMap<>(); for (String pluginConfigValue : pluginConfigValues) { String[] s = pluginConfigValue.split("="); if (s.length != 2) { throw new UnloggedFailure(1, "Invalid plugin config value '" + pluginConfigValue + "', expected format '<plugin-name>.<parameter-name>=<value>'"); } String value = s[1]; s = s[0].split("\\."); if (s.length != 2) { throw new UnloggedFailure(1, "Invalid plugin config value '" + pluginConfigValue + "', expected format '<plugin-name>.<parameter-name>=<value>'"); } String pluginName = s[0]; String paramName = s[1]; Map<String, String> l = m.get(pluginName); if (l == null) { l = new HashMap<>(); m.put(pluginName, l); } l.put(paramName, value); } return m; }

Target:
private Map<String, Map<String, String>> parsePluginConfigValues( List<String> pluginConfigValues) throws UnloggedFailure { Map<String, Map<String, String>> m = new HashMap<>(); for (String pluginConfigValue : pluginConfigValues) { String[] s = pluginConfigValue.split("="); String[] s2 = s[0].split("\\."); if (s.length != 2 || s2.length != 2) { throw new UnloggedFailure(1, "Invalid plugin config value '" + pluginConfigValue + "', expected format '<plugin-name>.<parameter-name>=<value>'"); } String value = s[1]; String pluginName = s2[0]; String paramName = s2[1]; Map<String, String> l = m.get(pluginName); if (l == null) { l = new HashMap<>(); m.put(pluginName, l); } l.put(paramName, value); } return m; }
Source:
private Address makeAddress() { Address address = new Address(Locale.getDefault()); ((ShadowAddress) ShadowExtractor.extract(address)).setSimulatedHasLatLong(hasLatitude, hasLongitude); return address; }

Target:
private Address makeAddress() { Address address = new Address(Locale.getDefault()); address.setLatitude(simulatedLatitude); address.setLongitude(simulatedLongitude); ReflectionHelpers.setField(address, "mHasLatitude", hasLatitude); ReflectionHelpers.setField(address, "mHasLongitude", hasLongitude); return address; }
Source:
public void saveAccessTokenResponse(@NonNull String handle, @Nullable AccessTokenResponse pAccessTokenResponse) { AccessTokenResponse accessTokenResponse = pAccessTokenResponse; String storageKeyAccessToken = ACCESS_TOKEN_RESPONSE.getKey(handle); if (accessTokenResponse == null) { accessTokenResponse = new AccessTokenResponse(); } AccessTokenResponse encryptedToken; try { encryptedToken = encryptToken(accessTokenResponse); } catch (GeneralSecurityException e) { logger.error("Unable to encrypt token, storing as-is", e); encryptedToken = accessTokenResponse; } storageFacade.put(handle, encryptedToken); }

Target:
public void saveAccessTokenResponse(@NonNull String handle, @Nullable AccessTokenResponse pAccessTokenResponse) { AccessTokenResponse accessTokenResponse = pAccessTokenResponse; String storageKeyAccessToken = ACCESS_TOKEN_RESPONSE.getKey(handle); if (accessTokenResponse == null) { accessTokenResponse = new AccessTokenResponse(); } AccessTokenResponse encryptedToken; try { encryptedToken = encryptToken(accessTokenResponse); } catch (GeneralSecurityException e) { logger.warn("Unable to encrypt token, storing as-is", e); encryptedToken = accessTokenResponse; } storageFacade.put(handle, encryptedToken); }
Source:
public CollectResultIterator( CompletableFuture<OperatorID> operatorIdFuture, TypeSerializer<T> serializer, String accumulatorName, CheckpointConfig checkpointConfig) { if (checkpointConfig.getCheckpointingMode() == CheckpointingMode.EXACTLY_ONCE) { if (checkpointConfig.getCheckpointInterval() >= CheckpointCoordinatorConfiguration.MINIMAL_CHECKPOINT_TIME) { this.fetcher = new CollectResultFetcher<>( new CheckpointedCollectResultBuffer<>(serializer), operatorIdFuture, accumulatorName); } else { this.fetcher = new CollectResultFetcher<>( new UncheckpointedCollectResultBuffer<>(serializer, false), operatorIdFuture, accumulatorName); } } else { this.fetcher = new CollectResultFetcher<>( new UncheckpointedCollectResultBuffer<>(serializer, true), operatorIdFuture, accumulatorName); } this.bufferedResult = null; }

Target:
public CollectResultIterator( CompletableFuture<OperatorID> operatorIdFuture, TypeSerializer<T> serializer, String accumulatorName, CheckpointConfig checkpointConfig) { AbstractCollectResultBuffer<T> buffer = createBuffer(serializer, checkpointConfig); this.fetcher = new CollectResultFetcher<>(buffer, operatorIdFuture, accumulatorName); this.bufferedResult = null; }
Source:
private List<Map<String, String>> getTargets(Long hostId, long vmId) { List<Map<String, String>> targets = new ArrayList<>(); HostVO hostVO = _hostDao.findById(hostId); if (hostVO != null && hostVO.getHypervisorType() == HypervisorType.VMware) { List<VolumeVO> volumes = _volsDao.findByInstance(vmId); if (volumes != null) { for (VolumeVO volume : volumes) { StoragePoolVO storagePoolVO = _storagePoolDao.findById(volume.getPoolId()); if (storagePoolVO != null && storagePoolVO.isManaged()) { Map<String, String> target = new HashMap<>(); target.put(ModifyTargetsCommand.STORAGE_HOST, storagePoolVO.getHostAddress()); target.put(ModifyTargetsCommand.STORAGE_PORT, String.valueOf(storagePoolVO.getPort())); target.put(ModifyTargetsCommand.IQN, volume.get_iScsiName()); targets.add(target); } } } } return targets; }

Target:
private List<Map<String, String>> getTargets(Long hostId, long vmId) { List<Map<String, String>> targets = new ArrayList<>(); HostVO hostVO = _hostDao.findById(hostId); if (hostVO == null || hostVO.getHypervisorType() != HypervisorType.VMware) { return targets; } List<VolumeVO> volumes = _volsDao.findByInstance(vmId); if (CollectionUtils.isEmpty(volumes)) { return targets; } for (VolumeVO volume : volumes) { StoragePoolVO storagePoolVO = _storagePoolDao.findById(volume.getPoolId()); if (storagePoolVO != null && storagePoolVO.isManaged()) { Map<String, String> target = new HashMap<>(); target.put(ModifyTargetsCommand.STORAGE_HOST, storagePoolVO.getHostAddress()); target.put(ModifyTargetsCommand.STORAGE_PORT, String.valueOf(storagePoolVO.getPort())); target.put(ModifyTargetsCommand.IQN, volume.get_iScsiName()); targets.add(target); } } return targets; }
Source:
private void displayDirPage(FileSystem fs, String user, HttpServletRequest req, HttpServletResponse resp, Session session, Path path) throws IOException { Page page = newPage(req, resp, session, "azkaban/viewer/hdfs/velocity/hdfs-browser.vm"); page.add("allowproxy", allowGroupProxy); page.add("viewerPath", viewerPath); page.add("viewerName", viewerName); List<Path> paths = new ArrayList<Path>(); List<String> segments = new ArrayList<String>(); getPathSegments(path, paths, segments); page.add("paths", paths); page.add("segments", segments); page.add("user", user); page.add("homedir", getHomeDir(fs)); try { FileStatus[] subdirs = fs.listStatus(path); page.add("subdirs", subdirs); long size = 0; for (int i = 0; i < subdirs.length; ++i) { if (subdirs[i].isDir()) { continue; } size += subdirs[i].getLen(); } page.add("dirsize", size); } catch (AccessControlException e) { String error_message = props.getString("configurable.error.access.message"); page.add("error_message", "Permission denied: " + error_message); page.add("no_fs", "true"); } catch (IOException e) { page.add("error_message", "Error: " + e.getMessage()); } page.render(); }

Target:
private void displayDirPage(FileSystem fs, String user, HttpServletRequest req, HttpServletResponse resp, Session session, Path path) throws IOException { Page page = newPage(req, resp, session, "azkaban/viewer/hdfs/velocity/hdfs-browser.vm"); page.add("allowproxy", allowGroupProxy); page.add("viewerPath", viewerPath); page.add("viewerName", viewerName); List<Path> paths = new ArrayList<Path>(); List<String> segments = new ArrayList<String>(); getPathSegments(path, paths, segments); page.add("paths", paths); page.add("segments", segments); page.add("user", user); page.add("homedir", getHomeDir(fs)); try { FileStatus[] subdirs = fs.listStatus(path); page.add("subdirs", subdirs); long size = 0; for (int i = 0; i < subdirs.length; ++i) { if (subdirs[i].isDir()) { continue; } size += subdirs[i].getLen(); } page.add("dirsize", size); } catch (AccessControlException e) { String error_message = props.getString(HDFSVIEWER_ACCESS_DENIED_MESSAGE); page.add("error_message", "Permission denied: " + error_message); page.add("no_fs", "true"); } catch (IOException e) { page.add("error_message", "Error: " + e.getMessage()); } page.render(); }
Source:
public PluginOperationResult execute() throws OperationException { result.setAction(options.getAction()); switch (options.getAction()) { case LIST: try { return executeList(); } catch (DeserializableException | IOException e) { throw new OperationException(e); } case INSTALL: try { return executeInstall(); } catch (ChecksumMismatchException | UninstallablePluginException | IOException | CryptoException e) { throw new OperationException(e); } case REMOVE: try { return executeRemove(); } catch (PluginNotInstalledException | IOException e) { throw new OperationException(e); } case UPDATE: try { return executeUpdate(); } catch (DeserializableException | PluginException | IOException | CryptoException | ChecksumMismatchException e) { throw new OperationException(e); } default: throw new IllegalArgumentException("Unknown action: " + options.getAction()); } }

Target:
public PluginOperationResult execute() throws OperationException { result.setAction(options.getAction()); switch (options.getAction()) { case LIST: return executeList(); case INSTALL: return executeInstall(); case REMOVE: return executeRemove(); case UPDATE: return executeUpdate(); default: throw new IllegalArgumentException("Unknown action: " + options.getAction()); } }
Source:
protected void refreshComponents() { String reloadStrategy = Framework.getProperty(RELOAD_STRATEGY_PARAMETER, RELOAD_STRATEGY_VALUE_STANDBY); if (log.isInfoEnabled()) { log.info("Refresh components. Strategy: " + reloadStrategy); } ComponentManager mgr = Framework.getRuntime().getComponentManager(); switch(reloadStrategy) { case RELOAD_STRATEGY_VALUE_UNSTASH: mgr.unstash(); break; case RELOAD_STRATEGY_VALUE_STANDBY: mgr.standby(); mgr.unstash(); mgr.resume(); break; case RELOAD_STRATEGY_VALUE_RESTART: default: mgr.refresh(false); break; } }

Target:
protected void refreshComponents() { String reloadStrategy = Framework.getProperty(RELOAD_STRATEGY_PARAMETER, RELOAD_STRATEGY_VALUE_DEFAULT); if (log.isInfoEnabled()) { log.info("Refresh components. Strategy: " + reloadStrategy); } ComponentManager mgr = Framework.getRuntime().getComponentManager(); switch(reloadStrategy) { case RELOAD_STRATEGY_VALUE_UNSTASH: mgr.unstash(); break; case RELOAD_STRATEGY_VALUE_STANDBY: mgr.standby(); mgr.unstash(); mgr.resume(); break; case RELOAD_STRATEGY_VALUE_RESTART: default: mgr.refresh(false); break; } }
Source:
public static Map<String, Change> build(Repository repo) { try (TreeWalk tw = new TreeWalk(repo)) { tw.addTree(new DirCacheIterator(repo.readDirCache())); ObjectId headId = repo.resolve(HEAD); RevCommit headCommit; if (headId != null) { try (RevWalk rw = new RevWalk(repo)) { headCommit = rw.parseCommit(headId); } } else { headCommit = null; } AbbreviatedObjectId commitId; if (headCommit != null) { tw.addTree(headCommit.getTree()); commitId = AbbreviatedObjectId.fromObjectId(headCommit); } else { tw.addTree(new EmptyTreeIterator()); commitId =AbbreviatedObjectId.fromObjectId(zeroId()); } tw.setRecursive(true); headCommit = null; MutableObjectId idBuf = new MutableObjectId(); Map<String, Change> result = new HashMap<String, Change>(); while(tw.next()) { if (!shouldIncludeEntry(tw)) continue; Change change = new Change(); change.name = tw.getNameString(); change.remoteCommitId = commitId; tw.getObjectId(idBuf, 0); change.objectId = AbbreviatedObjectId.fromObjectId(idBuf); tw.getObjectId(idBuf, 1); change.remoteObjectId = AbbreviatedObjectId.fromObjectId(idBuf); calculateAndSetChangeKind(RIGHT, change); result.put(tw.getPathString(), change); } return result; } catch (IOException e) { Activator.error(e.getMessage(), e); return new HashMap<String, Change>(0); } }

Target:
public static Map<String, Change> build(Repository repo) { try (TreeWalk tw = new TreeWalk(repo)) { tw.addTree(new DirCacheIterator(repo.readDirCache())); ObjectId headId = repo.resolve(HEAD); RevCommit headCommit = null; if (headId != null) { try (RevWalk rw = new RevWalk(repo)) { headCommit = rw.parseCommit(headId); } } AbbreviatedObjectId commitId; if (headCommit != null) { tw.addTree(headCommit.getTree()); commitId = AbbreviatedObjectId.fromObjectId(headCommit); } else { tw.addTree(new EmptyTreeIterator()); commitId =AbbreviatedObjectId.fromObjectId(zeroId()); } tw.setRecursive(true); headCommit = null; MutableObjectId idBuf = new MutableObjectId(); Map<String, Change> result = new HashMap<String, Change>(); while(tw.next()) { if (!shouldIncludeEntry(tw)) continue; Change change = new Change(); change.name = tw.getNameString(); change.remoteCommitId = commitId; tw.getObjectId(idBuf, 0); change.objectId = AbbreviatedObjectId.fromObjectId(idBuf); tw.getObjectId(idBuf, 1); change.remoteObjectId = AbbreviatedObjectId.fromObjectId(idBuf); calculateAndSetChangeKind(RIGHT, change); result.put(tw.getPathString(), change); } return result; } catch (IOException e) { Activator.error(e.getMessage(), e); return new HashMap<String, Change>(0); } }
Source:
protected void run() throws Exception { if ("split".equals(subtreeCmd)) { SubtreeSplitCommand split = new SubtreeSplitCommand(db); if (args != null) { for (String path : args) { split.addSplitPath(path); } } ObjectId head = db.resolve("HEAD"); if (rewriteAll) { split.setRewriteAll(); } else if (rewrite) { split.addCommitToRewrite(head); } split.setStart(head); SubtreeSplitResult result = split.call(); if (rewrite || rewriteAll) { out.println(result.getRewrittenCommits().get(head).name()); } for (SubtreeContext c : result.getSubtreeContexts()) { out.println(c.getSplitCommit(head).name() + " " + c.getId()); } } else { throw new CmdLineException(MessageFormat.format( CLIText.get().notAJgitCommand, subtreeCmd)); } }

Target:
protected void run() throws Exception { if ("split".equals(subtreeCmd)) { SubtreeSplitCommand split = new SubtreeSplitCommand(db); if (args != null) { File workDir = db.getWorkTree(); if (workDir == null) { throw new CmdLineException( "No working directory, can not split paths"); } for (String path : args) { File dirCandidate = new File(path); if (!dirCandidate.isDirectory()) { throw new CmdLineException(dirCandidate + " is not a directory"); } split.addSplitPath(workDir.toURI() .relativize(dirCandidate.toURI()).getPath()); } } ObjectId head = db.resolve("HEAD"); if (rewriteAll) { split.setRewriteAll(); } else if (rewrite) { split.addCommitToRewrite(head); } split.setStart(head); SubtreeSplitResult result = split.call(); if (rewrite || rewriteAll) { out.println(result.getRewrittenCommits().get(head).name()); } for (SubtreeContext c : result.getSubtreeContexts().values()) { out.println(c.getSplitCommit(head).name() + " " + c.getId()); } } else { throw new CmdLineException(MessageFormat.format( CLIText.get().notAJgitCommand, subtreeCmd)); } }
Source:
public AccountInfo getAccountInfo() throws IOException { Set<Wallet.WalletFeature> walletFeatures = new HashSet<>(); walletFeatures.add(Wallet.WalletFeature.FUNDING); walletFeatures.add(Wallet.WalletFeature.MARGIN_TRADING); KrakenTradeBalanceInfo krakenTradeBalanceInfo = getKrakenTradeBalance(); Wallet tradingWallet = KrakenAdapters.adaptWallet(getKrakenBalance()); Wallet marginWallet = Wallet.Builder.from(tradingWallet.getBalances().values()) .id("margin") .features(walletFeatures) .maxLeverage(BigDecimal.valueOf(5)) .currentLeverage(BigDecimal.valueOf(krakenTradeBalanceInfo.getCostBasis().doubleValue()/krakenTradeBalanceInfo.getTradeBalance().doubleValue())) .build(); return new AccountInfo(exchange.getExchangeSpecification().getUserName(), tradingWallet,marginWallet); }

Target:
public AccountInfo getAccountInfo() throws IOException { KrakenTradeBalanceInfo krakenTradeBalanceInfo = getKrakenTradeBalance(); Wallet tradingWallet = KrakenAdapters.adaptWallet(getKrakenBalance()); Wallet marginWallet = Wallet.Builder.from(tradingWallet.getBalances().values()) .id("margin") .features(EnumSet.of(Wallet.WalletFeature.FUNDING, Wallet.WalletFeature.MARGIN_TRADING)) .maxLeverage(BigDecimal.valueOf(5)) .currentLeverage( (krakenTradeBalanceInfo.getTradeBalance().equals(BigDecimal.ZERO)) ? BigDecimal.ZERO : krakenTradeBalanceInfo .getCostBasis() .divide(krakenTradeBalanceInfo.getTradeBalance(), MathContext.DECIMAL32)) .build(); return new AccountInfo( exchange.getExchangeSpecification().getUserName(), tradingWallet, marginWallet); }
Source:
public static DateTime of(String instant) { try { return new DateTime(instant, ISOChronology.getInstanceUTC()); } catch (IllegalArgumentException ex) { return new DateTime(Long.valueOf(instant), ISOChronology.getInstanceUTC()); } }

Target:
public static DateTime of(String instant) { try { return new DateTime(instant, ISOChronology.getInstanceUTC()); } catch (IllegalArgumentException ex) { try { return new DateTime(Long.valueOf(instant), ISOChronology.getInstanceUTC()); } catch (IllegalArgumentException ex2) { throw ex; } } }
Source:
public String format() { try { this.props.load( Thread.currentThread().getContextClassLoader() .getResourceAsStream(this.name) ); } catch (final IOException ex) { throw new IllegalStateException( "IOException when loading jcabigithub.properties", ex ); } return String.format( "jcabi-github %s %s %s", this.props.getProperty(FromProperties.JCABI_VERSION), this.props.getProperty(FromProperties.JCABI_BUILD), this.props.getProperty(FromProperties.JCABI_DATE) ); }

Target:
public String format() { try { this.props.load( Thread.currentThread().getContextClassLoader() .getResourceAsStream(this.name) ); } catch (final IOException ex) { throw new IllegalStateException( String.format("IOException when loading %s", this.name), ex ); } return String.format( "jcabi-github %s %s %s", this.props.getProperty(FromProperties.JCABI_VERSION), this.props.getProperty(FromProperties.JCABI_BUILD), this.props.getProperty(FromProperties.JCABI_DATE) ); }