auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testCreatePayload() { Injector injector = Guice.createInjector(new GsonModule()); CreateVolumeRequestBinder binder = injector.getInstance(CreateVolumeRequestBinder.class); Volume.Request.CreatePayload payload = Volume.Request.creatingBuilder() .dataCenterId("datacenter-id") .name("jclouds-volume") .size(3) .type("HDD") .licenceType(LicenceType.LINUX) .build(); String actual = binder.createPayload(payload); HttpRequest request = binder.createRequest( HttpRequest.builder().method("POST").endpoint("<LINK_0>").build(), actual ); assertEquals(request.getEndpoint().getPath(), "/rest/datacenters/datacenter-id/volumes"); assertNotNull(actual, "Binder returned null payload"); Json json = injector.getInstance(Json.class); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("size", 3); properties.put("licenceType", "LINUX"); properties.put("type", "HDD"); properties.put("name", "jclouds-volume"); HashMap<String, Object> expectedPayload = new HashMap<String, Object>(); expectedPayload.put("properties", properties); assertEquals(actual, json.toJson(expectedPayload)); }

Target:
public void testCreatePayload() { CreateVolumeRequestBinder binder = injector.getInstance(CreateVolumeRequestBinder.class); Volume.Request.CreatePayload payload = Volume.Request.creatingBuilder() .dataCenterId("datacenter-id") .name("jclouds-volume") .size(3) .type(VolumeType.HDD) .licenceType(LicenceType.LINUX) .build(); String actual = binder.createPayload(payload); HttpRequest request = binder.createRequest( HttpRequest.builder().method("POST").endpoint("<LINK_0>").build(), actual ); assertEquals(request.getEndpoint().getPath(), "/rest/v2/datacenters/datacenter-id/volumes"); assertNotNull(actual, "Binder returned null payload"); Json json = injector.getInstance(Json.class); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("size", 3); properties.put("licenceType", "LINUX"); properties.put("type", "HDD"); properties.put("name", "jclouds-volume"); HashMap<String, Object> expectedPayload = new HashMap<String, Object>(); expectedPayload.put("properties", properties); assertEquals(actual, json.toJson(expectedPayload)); }
Source:
protected void setLeader(boolean isLeader) { if (isLeader && leader.compareAndSet(false, isLeader)) { LOGGER.info("Leadership taken (map={}, key={}, val={})", lockMapName, lockKey, lockValue); startAllStoppedConsumers(); } else { if (!leader.getAndSet(isLeader) && isLeader) { LOGGER.info("Leadership lost (map={}, key={} val={})", lockMapName, lockKey, lockValue); } } }

Target:
protected void setLeader(boolean isLeader) { if (isLeader && leader.compareAndSet(false, isLeader)) { LOGGER.info("Leadership taken (map={}, key={}, val={})", lockMapName, lockKey, lockValue); startAllStoppedConsumers(); } else if (!isLeader && leader.getAndSet(isLeader)) { LOGGER.info("Leadership lost (map={}, key={} val={})", lockMapName, lockKey, lockValue); } if (!isLeader && this.route != null) { stopConsumer(route); } }
Source:
public void copyLeftToRight(Diff target, Monitor monitor) { if (target.getState() != DifferenceState.UNRESOLVED) { return; } long start = System.currentTimeMillis(); target.setState(DifferenceState.MERGED); final Set<Diff> dependencies = getDirectMergeDependencies(target, false); boolean requiresMerging = requiresMerging(target, false); for (Diff mergeMe : dependencies) { mergeDiff(mergeMe, false, monitor); } for (Diff transitiveMerge : getDirectResultingMerges(target, false)) { transitiveMerge.setState(DifferenceState.MERGED); } if (requiresMerging) { if (target.getSource() == DifferenceSource.LEFT) { accept(target, false); } else { reject(target, false); } } if (isHandleSubDiffs()) { Set<Diff> subDiffs = Sets.newLinkedHashSet(ComparisonUtil.getDirectSubDiffs(true).apply(target)); for (Diff subDiff : subDiffs) { mergeDiff(subDiff, false, monitor); } } if (LOGGER.isDebugEnabled()) { long duration = System.currentTimeMillis() - start; LOGGER.debug("copyLeftToRight(Diff, Monitor) - diff " + target.hashCode() + " merged in " + duration + "s"); } }

Target:
public void copyLeftToRight(Diff target, Monitor monitor) { if (target.getState() != DifferenceState.UNRESOLVED) { return; } long start = System.currentTimeMillis(); target.setState(DifferenceState.MERGED); final Set<Diff> dependencies = getDirectMergeDependencies(target, false); boolean requiresMerging = requiresMerging(target, false); for (Diff mergeMe : dependencies) { mergeDiff(mergeMe, false, monitor); } for (Diff transitiveMerge : getDirectResultingMerges(target, false)) { transitiveMerge.setState(DifferenceState.MERGED); } if (requiresMerging) { if (target.getSource() == DifferenceSource.LEFT) { accept(target, false); } else { reject(target, false); } } if (isHandleSubDiffs()) { Set<Diff> subDiffs = Sets.newLinkedHashSet(ComparisonUtil.getDirectSubDiffs(true).apply(target)); for (Diff subDiff : subDiffs) { mergeDiff(subDiff, false, monitor); } } if (LOGGER.isDebugEnabled()) { long duration = System.currentTimeMillis() - start; LOGGER.debug("copyLeftToRight(Diff, Monitor) - diff " + target.hashCode() + " merged in " + duration + "ms"); } }
Source:
public InputSplit[] getSplits(final JobConf conf, int ignored) throws IOException { final String domainName = DomainBuilderProperties.getDomainName(conf); RunWithCoordinator.run(DomainBuilderProperties.getConfigurator(conf), new RunnableWithCoordinator() { @Override public void run(Coordinator coordinator) throws IOException { domain = DomainBuilderProperties.getDomain(coordinator, domainName); domainVersion = domain.getVersion(DomainBuilderProperties.getVersionNumber(domainName, conf)); } }); final int domainNumParts = domain.getNumParts(); final StorageEngine storageEngine = domain.getStorageEngine(); final InputSplit[] splits = new InputSplit[domainNumParts]; for (int partition = 0; partition < domainNumParts; ++partition) { Compactor compactor = storageEngine.getCompactor(null, partition); List<String> locations = new ArrayList<String>(); if (compactor instanceof IncrementalPartitionUpdater) { IncrementalPartitionUpdater updater = (IncrementalPartitionUpdater) compactor; IncrementalUpdatePlan updatePlan = updater.computeUpdatePlan(domainVersion); List<String> paths = updater.getRemotePartitionFilePaths(updatePlan); LOG.info("Determining locations for partition " + partition + " using: " + paths); locations = computeOptimalHosts(conf, paths); } splits[partition] = new HadoopDomainCompactorInputSplit(domainName, partition, locations.toArray(new String[locations.size()])); } return splits; }

Target:
public InputSplit[] getSplits(final JobConf conf, int ignored) throws IOException { final String domainName = DomainBuilderProperties.getDomainName(conf); RunWithCoordinator.run(DomainBuilderProperties.getConfigurator(conf), new RunnableWithCoordinator() { @Override public void run(Coordinator coordinator) throws IOException { domain = DomainBuilderProperties.getDomain(coordinator, domainName); domainVersion = domain.getVersion(DomainBuilderProperties.getVersionNumber(domainName, conf)); } }); final int domainNumParts = domain.getNumParts(); final StorageEngine storageEngine = domain.getStorageEngine(); final InputSplit[] splits = new InputSplit[domainNumParts]; for (int partition = 0; partition < domainNumParts; ++partition) { Compactor compactor = storageEngine.getCompactor(null, partition); List<String> locations = new ArrayList<String>(); if (compactor instanceof IncrementalPartitionUpdater) { IncrementalPartitionUpdater updater = (IncrementalPartitionUpdater) compactor; IncrementalUpdatePlan updatePlan = updater.computeUpdatePlan(domainVersion); List<String> paths = updater.getRemotePartitionFilePaths(updatePlan); LOG.info("Determining locations for partition " + partition + " using: " + paths); locations = computeOptimalHosts(conf, paths); LOG.info("Determining locations for partition " + partition + " : " + locations); } splits[partition] = new HadoopDomainCompactorInputSplit(domainName, partition, locations.toArray(new String[locations.size()])); } return splits; }
Source:
public void syncPodsToDirectory(File deployFolder, MultiStatus status, final IServerConsoleWriter consoleWriter) { new OCBinaryOperation() { @Override protected void runOCBinary(MultiStatus multiStatus) { boolean shouldSync = true; if (shouldSync) { for (IPod pod : service.getPods()) { try { if (pod.getStatus() == "Running") { syncPodToDirectory(pod, podPath, deployFolder, consoleWriter); } } catch (IOException | OpenShiftException e) { status.add(new Status(IStatus.ERROR, OpenShiftCoreActivator.PLUGIN_ID, e.getMessage())); } } } } }.run(status); }

Target:
public void syncPodsToDirectory(File deployFolder, MultiStatus status, final IServerConsoleWriter consoleWriter) { new OCBinaryOperation() { @Override protected void runOCBinary(MultiStatus multiStatus) { boolean shouldSync = true; if (shouldSync) { for (IPod pod : service.getPods()) { try { if ("Running".equals(pod.getStatus())) { syncPodToDirectory(pod, podPath, deployFolder, consoleWriter); } } catch (IOException | OpenShiftException e) { status.add(new Status(IStatus.ERROR, OpenShiftCoreActivator.PLUGIN_ID, e.getMessage())); } } } } }.run(status); }
Source:
public static void main(String[] args) { HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(); IMap<String, String> customers = hazelcastInstance.getMap("customers"); LocalMapStats mapStatistics = customers.getLocalMapStats(); Map<String, LocalIndexStats> indexStats = mapStatistics.getIndexStats(); LocalIndexStats nameIndexStats = indexStats.get("name"); System.out.println("average name index hit selectivity on this member = " + nameIndexStats.getAverageHitSelectivity()); }

Target:
public static void main(String[] args) { HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(); IMap<String, String> customers = hazelcastInstance.getMap("customers"); customers.addIndex("name", true); LocalMapStats mapStatistics = customers.getLocalMapStats(); Map<String, LocalIndexStats> indexStats = mapStatistics.getIndexStats(); LocalIndexStats nameIndexStats = indexStats.get("name"); System.out.println("average name index hit selectivity on this member = " + nameIndexStats.getAverageHitSelectivity()); }
Source:
public InventoryDataProviders() { super("inventory"); }

Target:
public InventoryDataProviders() { super(Constants.Sponge.Entity.DataRegistration.INVENTORY); }
Source:
public void newCanHttpPost() throws IOException, InterruptedException, NoSuchAlgorithmException { server.setResponse(NanoHTTPD.Method.POST, defaultMd5Post); Map<String, String> params = new HashMap<>(); params.put("firstK", "firstV"); params.put("secondK", "secondV"); String result = HttpUtil.httpPost(URL_STRING, params); byte[] hash = MessageDigest.getInstance("MD5").digest(HttpUtil.getQuery(params).getBytes()); String expected = Arrays.toString(hash); assertEquals(result, expected); }

Target:
public void newCanHttpPost() throws IOException, InterruptedException, NoSuchAlgorithmException { server.setResponse(NanoHTTPD.Method.POST, defaultMd5Post); Map<String, String> params = new HashMap<>(); params.put("firstK", "firstV"); params.put("secondK", "secondV"); String result = HttpUtil.httpPost(URL_STRING, params); byte[] hash = MessageDigest.getInstance("MD5").digest(HttpUtil.getQuery(params).getBytes()); String expected = Arrays.toString(hash); assertEquals(expected, result); }
Source:
public Reader(Configuration conf, List<Path> paths) throws IOException { mMap = new TreeMap<K, V>(); for (Path path : paths) { FileSystem fs = path.getFileSystem(conf); SequenceFile.Reader seqReader = new SequenceFile.Reader(fs, path, conf); try { Class<? extends K> keyClass = (Class<? extends K>) seqReader.getKeyClass(); Class<? extends V> valClass = (Class<? extends V>) seqReader.getValueClass(); K key = ReflectionUtils.newInstance(keyClass, conf); V val = ReflectionUtils.newInstance(valClass, conf); key = (K) seqReader.next(key); while (key != null) { val = (V) seqReader.getCurrentValue(val); if (!mMap.containsKey(key)) { mMap.put(key, val); } key = ReflectionUtils.newInstance(keyClass, conf); val = ReflectionUtils.newInstance(valClass, conf); key = (K) seqReader.next(key); } } finally { seqReader.close(); } } }

Target:
public Reader(Configuration conf, List<Path> paths) throws IOException { mMap = new HashMap<K, V>(); for (Path path : paths) { FileSystem fs = path.getFileSystem(conf); SequenceFile.Reader seqReader = new SequenceFile.Reader(fs, path, conf); try { Class<? extends K> keyClass = (Class<? extends K>) seqReader.getKeyClass(); Class<? extends V> valClass = (Class<? extends V>) seqReader.getValueClass(); K key = ReflectionUtils.newInstance(keyClass, conf); V val = ReflectionUtils.newInstance(valClass, conf); key = (K) seqReader.next(key); while (key != null) { val = (V) seqReader.getCurrentValue(val); if (!mMap.containsKey(key)) { mMap.put(key, val); } key = ReflectionUtils.newInstance(keyClass, conf); val = ReflectionUtils.newInstance(valClass, conf); key = (K) seqReader.next(key); } } finally { seqReader.close(); } } }
Source:
public ShowBubbleActor createBubbleActor() throws InterpretationException { String textToDisplay = text == null ? "" : text.interpretString(sprite); if (textToDisplay.equals("")) { return null; } return new ShowBubbleActor(textToDisplay, sprite, type); }

Target:
public ShowBubbleActor createBubbleActor() throws InterpretationException { String textToDisplay = text == null ? "" : text.interpretString(sprite); if (textToDisplay.isEmpty()) { return null; } return new ShowBubbleActor(textToDisplay, sprite, type); }
Source:
private void recordEvent(String msg, int evtType) { GridKernalContext ctx = cctx.kernalContext(); Collection<ClusterNode> srvNodes = ctx.cluster().get().forServers().nodes(); ArrayList baselineNodes = new ArrayList(srvNodes.size()); for (ClusterNode clN : srvNodes) baselineNodes.add(clN); ctx.getSystemExecutorService().execute(new Runnable() { @Override public void run() { if (ctx.event().isRecordable(evtType)) { ClusterActivationEvent evt = new ClusterActivationEvent(ctx.discovery().localNode(), msg, evtType, baselineNodes); ctx.event().record(evt); } } }); }

Target:
private void recordEvent(String msg, int evtType) { GridKernalContext ctx = cctx.kernalContext(); Collection<ClusterNode> srvNodes = ctx.cluster().get().forServers().nodes(); Collection<BaselineNode> baselineNodes = new ArrayList<>(srvNodes); ctx.getStripedExecutorService().execute(CLUSTER_ACTIVATION_EVT_STRIPE_ID, new Runnable() { @Override public void run() { if (ctx.event().isRecordable(evtType)) { ClusterActivationEvent evt = new ClusterActivationEvent(ctx.discovery().localNode(), msg, evtType, baselineNodes); ctx.event().record(evt); } } }); }
Source:
public void testSomeCommits() throws CorruptObjectException, UnmergedPathException, IOException { Git git = new Git(db); git.commit().setMessage("initial commit").run(); git.commit().setMessage("second commit").setCommitter(committer).run(); git.commit().setMessage("third commit").setAuthor(author).run(); git.commit().setMessage("fourth commit").setAuthor(author) .setCommitter(committer).run(); String defaultCommitter = new PersonIdent(db).getName(); String expectedAuthors[] = new String[] { defaultCommitter, committer.getName(), author.getName(), author.getName() }; String expectedCommitters[] = new String[] { defaultCommitter, committer.getName(), defaultCommitter, committer.getName() }; String expectedMessages[] = new String[] { "initial", "second", "third", "fourth" }; int l = expectedAuthors.length - 1; for (RevCommit c : git.log().run()) { assertEquals(expectedAuthors[l], c.getAuthorIdent().getName()); assertEquals(expectedCommitters[l], c.getCommitterIdent().getName()); assertTrue(c.getFullMessage().startsWith(expectedMessages[l])); l--; } assertTrue(l==-1); }

Target:
public void testSomeCommits() throws CorruptObjectException, UnmergedPathException, IOException { final Git git = new Git(db); git.commit().setMessage("initial commit").call(); git.commit().setMessage("second commit").setCommitter(committer).call(); git.commit().setMessage("third commit").setAuthor(author).call(); git.commit().setMessage("fourth commit").setAuthor(author) .setCommitter(committer).call(); final Iterable<RevCommit> commits = git.log().call(); final PersonIdent defaultCommitter = new PersonIdent(db); final PersonIdent expectedAuthors[] = new PersonIdent[] { defaultCommitter, committer, author, author }; final PersonIdent expectedCommitters[] = new PersonIdent[] { defaultCommitter, committer, defaultCommitter, committer }; final String expectedMessages[] = new String[] { "initial commit", "second commit", "third commit", "fourth commit" }; int l = expectedAuthors.length - 1; for (final RevCommit c : commits) { assertEquals(expectedAuthors[l].getName(), c.getAuthorIdent() .getName()); assertEquals(expectedCommitters[l].getName(), c.getCommitterIdent() .getName()); assertEquals(c.getFullMessage(), expectedMessages[l]); l--; } assertEquals(l, -1); }
Source:
public void postOnCreateSnapshot(VdcReturnValueBase returnValue, GlusterVolumeSnapshotEntity snapshot) { GlusterVolumeSnapshotModel model = (GlusterVolumeSnapshotModel) getWindow(); model.stopProgress(); if (returnValue != null && returnValue.getSucceeded()) { setWindow(null); } }

Target:
public void postOnCreateSnapshot(VdcReturnValueBase returnValue, GlusterVolumeSnapshotEntity snapshot) { GlusterVolumeSnapshotModel model = (GlusterVolumeSnapshotModel) getWindow(); if (returnValue != null && returnValue.getSucceeded()) { setWindow(null); } }
Source:
public void testDiscoverDeviceNoDevice() throws Exception { String id = "id"; byte[] deviceTimeoutByteArray = new byte[]{0x01}; long deviceTimeout = ByteUtils.byteArrayToLong(deviceTimeoutByteArray) * 100; PowerMockito.when(deviceMock.getParameter("NT")).thenReturn(deviceTimeoutByteArray); long start = System.currentTimeMillis(); RemoteXBeeDevice remote = nd.discoverDevice(id); long end = System.currentTimeMillis(); assertThat("The 'discoverDevice' should block for " + deviceTimeout + " ms", end - start > deviceTimeout, is(equalTo(true))); assertThat("The discovered device should be null", remote, is(equalTo(null))); PowerMockito.verifyPrivate(nd, Mockito.times(1)).invoke(SEND_NODE_DISCOVERY_COMMAND_METHOD, Mockito.anyString()); Mockito.verify(deviceMock, Mockito.times(1)).addPacketListener(packetListener); Mockito.verify(deviceMock, Mockito.times(1)).removePacketListener(packetListener); PowerMockito.verifyPrivate(nd, Mockito.times(1)).invoke(DISCOVER_DEVICES_API_METHOD, null, id); Mockito.verify(networkMock, Mockito.never()).addRemoteDevices(Mockito.anyListOf(RemoteXBeeDevice.class)); }

Target:
public void testDiscoverDeviceNoDevice() throws Exception { String id = "id"; byte[] deviceTimeoutByteArray = new byte[]{0x01}; long deviceTimeout = ByteUtils.byteArrayToLong(deviceTimeoutByteArray) * 100; PowerMockito.when(deviceMock.getParameter("NT")).thenReturn(deviceTimeoutByteArray); long start = System.currentTimeMillis(); RemoteXBeeDevice remote = nd.discoverDevice(id); long end = System.currentTimeMillis(); assertThat("The 'discoverDevice' should block for " + deviceTimeout + " ms", end - start > deviceTimeout, is(equalTo(true))); assertThat("The discovered device should be null", remote, is(equalTo(null))); PowerMockito.verifyPrivate(nd, Mockito.times(1)).invoke(SEND_NODE_DISCOVERY_COMMAND_METHOD, Mockito.anyString()); Mockito.verify(deviceMock, Mockito.times(1)).addPacketListener(packetListener); Mockito.verify(deviceMock, Mockito.times(1)).removePacketListener(packetListener); PowerMockito.verifyPrivate(nd, Mockito.times(1)).invoke(DISCOVER_DEVICES_API_METHOD, null, id); Mockito.verify(networkMock, Mockito.never()).addRemoteDevices(Mockito.anyListOf(RemoteXBeeDevice.class)); Mockito.verify(networkMock, Mockito.never()).addRemoteDevice(Mockito.any(RemoteXBeeDevice.class)); }
Source:
public static void mongoGetExperiment(final DB dbs, final String userId, final String problemId, final String sessionInfo, final MultiConnectionManager internalConnections) throws DatabaseAccessException { final Request.Builder requestBuilder = Request.newBuilder(); requestBuilder.setSessionInfo(sessionInfo); requestBuilder.setRequestType(MessageType.DATA_REQUEST); final ItemRequest.Builder build = ItemRequest.newBuilder(); build.setQuery(ItemQuery.EXPERIMENT); final DBRef myDbRef = new DBRef(dbs, EXPERIMENT_COLLECTION, new ObjectId(problemId)); final DBObject corsor = myDbRef.fetch(); if (corsor == null) { throw new DatabaseAccessException("The student has not submitted anything for this problem"); } final String sketchId = "" + corsor.get(userId); LOG.info("SketchId: ", sketchId); if ("null".equals(sketchId)) { throw new DatabaseAccessException("The student has not submitted anything for this problem"); } build.addItemId(sketchId); final DataRequest.Builder data = DataRequest.newBuilder(); data.addItems(build); requestBuilder.setOtherData(data.build().toByteString()); try { internalConnections.send(requestBuilder.build(), null, SubmissionClientWebSocket.class); } catch (ConnectionException e) { LOG.info("Exception: {}", e); throw new DatabaseAccessException("Failed to send request to submission server for experiment", e); } }

Target:
public static void mongoGetExperiment(final DB dbs, final String userId, final String problemId, final String sessionInfo, final MultiConnectionManager internalConnections) throws DatabaseAccessException { final Request.Builder requestBuilder = Request.newBuilder(); requestBuilder.setSessionInfo(sessionInfo); requestBuilder.setRequestType(MessageType.DATA_REQUEST); final ItemRequest.Builder build = ItemRequest.newBuilder(); build.setQuery(ItemQuery.EXPERIMENT); final DBRef myDbRef = new DBRef(dbs, EXPERIMENT_COLLECTION, new ObjectId(problemId)); final DBObject corsor = myDbRef.fetch(); if (corsor == null) { throw new DatabaseAccessException("The student has not submitted anything for this problem"); } final String sketchId = "" + corsor.get(userId); LOG.info("SketchId: ", sketchId); if ("null".equals(sketchId)) { throw new DatabaseAccessException("The student has not submitted anything for this problem"); } build.addItemId(sketchId); final DataRequest.Builder data = DataRequest.newBuilder(); data.addItems(build); requestBuilder.setOtherData(data.build().toByteString()); try { internalConnections.send(requestBuilder.build(), null, SubmissionClientWebSocket.class); } catch (ConnectionException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); throw new DatabaseAccessException("Failed to send request to submission server for experiment", e); } }
Source:
public String toString() { return String.format("<SchemaPair: %s, %s>", keySchema.toString(), valueSchema.toString()); }

Target:
public String toString() { return String.format("<SchemaPair: %s, %s>", keySchema, valueSchema); }
Source:
public void onDestroyView() { super.onDestroyView(); SharedVariables.isAlertsFragmentAvailable = false; tearDownBindings(); }

Target:
public void onDestroyView() { super.onDestroyView(); isAlertsFragmentAvailable = false; tearDownBindings(); }
Source:
public void testDisablingCrossReferencerWhileReloadingResource() throws Exception { genericSetUp(); initSemanticResource(); Resource fragmentedResource = editingDomain.getResourceSet().getResources().get(2); boolean found = false; for (Adapter adapter : fragmentedResource.eAdapters()) { if (adapter instanceof LazyCrossReferencer) { found = true; break; } } assertTrue("The LazyCrossReferencer adapter is not set on fragmented resource", found); File fragFile = ResourcesPlugin.getWorkspace().getRoot().getProject(TEMPORARY_PROJECT_NAME).getFile(fragmentFileName).getLocation().toFile(); fragFile.setLastModified(System.currentTimeMillis()); ResourceSetSync resourceSetSync = ResourceSetSync.getResourceSetSync(editingDomain).get(); resourceSetSync.statusChanged(fragmentedResource, ResourceSetSync.ResourceStatus.SYNC, ResourceSetSync.ResourceStatus.EXTERNAL_CHANGED); for (Iterator<IStatus> warning = warnings.values().iterator(); warning.hasNext();) { IStatus status = warning.next(); if (status.getCode() == EMFTransactionStatusCodes.RELOAD_DURING_UNLOAD) { fail("Resource is being reloaded during its unload."); } } }

Target:
public void testDisablingCrossReferencerWhileReloadingResource() throws Exception { genericSetUp(); initSemanticResource(); Resource fragmentedResource = ((DAnalysisSessionEObject) session).getControlledResources().get(0); assertNotNull(FRAGMENT_FILE_NAME + " should be part of session controlled resource", fragmentedResource); boolean found = false; for (Adapter adapter : fragmentedResource.eAdapters()) { if (adapter instanceof LazyCrossReferencer) { found = true; break; } } assertTrue("The LazyCrossReferencer adapter is not set on fragmented resource", found); File fragFile = ResourcesPlugin.getWorkspace().getRoot().getProject(TEMPORARY_PROJECT_NAME).getFile(FRAGMENT_FILE_NAME).getLocation().toFile(); fragFile.setLastModified(System.currentTimeMillis()); ResourceSetSync resourceSetSync = ResourceSetSync.getResourceSetSync(editingDomain).get(); resourceSetSync.statusChanged(fragmentedResource, ResourceSetSync.ResourceStatus.SYNC, ResourceSetSync.ResourceStatus.EXTERNAL_CHANGED); for (Iterator<IStatus> warning = warnings.values().iterator(); warning.hasNext();) { IStatus status = warning.next(); if (status.getCode() == EMFTransactionStatusCodes.RELOAD_DURING_UNLOAD) { fail("Resource is being reloaded during its unload."); } } }
Source:
public RelDataType rowType() { synchronized (lock) { Preconditions.checkState(plannerResult != null, "must be call after sql has been planned"); return plannerResult.rowType(); } }

Target:
public RelDataType rowType() { synchronized (lock) { Preconditions.checkState(plannerResult != null, "must be called after sql has been planned"); return plannerResult.rowType(); } }
Source:
public void addContents(@NonNull Container result) { result.add( new PrefilteredPrintedContent("running-builds.txt") { @Override protected void printTo(PrintWriter out, ContentFilter filter) { Optional.ofNullable(Jenkins.getInstanceOrNull()) .ifPresent(jenkins -> Arrays.stream(jenkins.getComputers()) .flatMap(computer -> computer.getAllExecutors().stream()) .collect(Collectors.toList()) .forEach(executor -> Optional.ofNullable(executor.getCurrentExecutable()) .filter(executable -> executable.getParent() == executable.getParent().getOwnerTask()) .ifPresent(executable -> out.println(ContentFilter.filter(filter, executable.toString()))) ) ); } }); }

Target:
public void addContents(@NonNull Container result) { result.add( new PrefilteredPrintedContent("running-builds.txt") { @Override protected void printTo(PrintWriter out, ContentFilter filter) { Arrays.stream(Jenkins.get().getComputers()) .flatMap(computer -> computer.getAllExecutors().stream()) .collect(Collectors.toList()) .forEach(executor -> Optional.ofNullable(executor.getCurrentExecutable()) .filter(executable -> executable.getParent() == executable.getParent().getOwnerTask()) .ifPresent(executable -> out.println(ContentFilter.filter(filter, executable.toString()))) ); } }); }
Source:
public Object[] getChildren() { Object[] result = new Object[0]; if (root) { ITargetPlatformService service = (ITargetPlatformService) PlatformUI.getWorkbench().getService(ITargetPlatformService.class); ITargetDefinition td = null; try { td = service.getWorkspaceTargetHandle().getTargetDefinition(); } catch (CoreException e) { } if (td != null) { WorkbenchProxyObject wpoTargetDefinition = new WorkbenchProxyObject(td, null); wpoTargetDefinition.setValidated(true); result = new Object[] { ResourcesPlugin.getWorkspace().getRoot(), wpoTargetDefinition }; } else { result = new Object[] { ResourcesPlugin.getWorkspace().getRoot() }; } } else if (containedObject instanceof ZipFile) { List<Object> children = new ArrayList<Object>(); Enumeration<? extends ZipEntry> entries = ((ZipFile) containedObject).entries(); ZipEntry zipEntry; while (entries.hasMoreElements()) { zipEntry = entries.nextElement(); if (!zipEntry.isDirectory()) { children.add(new WorkbenchProxyObject(zipEntry, getLabel())); } } result = children.toArray(); } return result; }

Target:
public Object[] getChildren() { Object[] result = new Object[0]; if (root) { ITargetPlatformService service = (ITargetPlatformService) PlatformUI.getWorkbench().getService(ITargetPlatformService.class); ITargetDefinition td = null; try { td = service.getWorkspaceTargetHandle().getTargetDefinition(); } catch (CoreException e) { } if (td != null) { WorkbenchProxyObject wpoTargetDefinition = new WorkbenchProxyObject(td, null); wpoTargetDefinition.setChecked(true); result = new Object[] { ResourcesPlugin.getWorkspace().getRoot(), wpoTargetDefinition }; } else { result = new Object[] { ResourcesPlugin.getWorkspace().getRoot() }; } } else if (containedObject instanceof ZipFile) { List<Object> children = new ArrayList<Object>(); Enumeration<? extends ZipEntry> entries = ((ZipFile) containedObject).entries(); ZipEntry zipEntry; while (entries.hasMoreElements()) { zipEntry = entries.nextElement(); if (!zipEntry.isDirectory()) { children.add(new WorkbenchProxyObject(zipEntry, getLabel())); } } result = children.toArray(); } return result; }
Source:
public BulkByScrollResponse updateByQuery(String index, String type, int batchSize, Script script, int numberOfSlices, QueryBuilder query) throws IOException { UpdateByQueryRequest updateByQueryRequest = new UpdateByQueryRequest(new SearchRequest()); updateByQueryRequest.getSearchRequest() .indices(index) .types(type) .source() .size(batchSize) .query(query); updateByQueryRequest .setScript(script) .setSlices(numberOfSlices); return clientExt.updateByQuery(updateByQueryRequest, RequestOptions.DEFAULT); }

Target:
public BulkByScrollResponse updateByQuery(String index, String type, int batchSize, Script script, int numberOfSlices, QueryBuilder query) throws IOException { UpdateByQueryRequest updateByQueryRequest = new UpdateByQueryRequest(index) .setDocTypes(type) .setBatchSize(batchSize) .setQuery(query) .setScript(script) .setSlices(numberOfSlices); return client.updateByQuery(updateByQueryRequest, RequestOptions.DEFAULT); }
Source:
private String getUrl(SearchCriteria searchCriteria) throws UnsupportedEncodingException { Map<String, String> params = new HashMap<>(); params.put("format", "json"); params.put("addressdetails", "1"); String filterBBOX = PropertyUtil.getOptional(PROPERTY_BBOX); if(filterBBOX != null) { params.put("bounded", "1"); params.put("viewbox", filterBBOX); } else { log.debug("Search BBOX not configured. Add property with key", PROPERTY_BBOX); } params.put("accept-language", searchCriteria.getLocale()); int maxResults = getMaxResults(searchCriteria.getMaxResults()); if (maxResults > 0) { params.put("limit", Integer.toString(maxResults)); } params.put("q", URLEncoder.encode(searchCriteria.getSearchString(),"UTF-8")); return IOHelper.constructUrl(serviceURL, params); }

Target:
private String getUrl(SearchCriteria searchCriteria) throws UnsupportedEncodingException { Map<String, String> params = new HashMap<>(); params.put("format", "json"); params.put("addressdetails", "1"); String filterBBOX = PropertyUtil.getOptional(PROPERTY_BBOX); if(filterBBOX != null) { params.put("bounded", "1"); params.put("viewbox", filterBBOX); } else { log.debug("Search BBOX not configured. Add property with key", PROPERTY_BBOX); } params.put("accept-language", searchCriteria.getLocale()); int maxResults = getMaxResults(searchCriteria.getMaxResults()); if (maxResults > 0) { params.put("limit", Integer.toString(maxResults)); } params.put("q", searchCriteria.getSearchString()); return IOHelper.constructUrl(serviceURL, params); }
Source:
public void testWriteAndReadBCF() throws IOException { final File fakeVCFFile = VariantBaseTest.createTempFile("testWriteAndReadVCFBody.", ".bcf"); Tribble.indexFile(fakeVCFFile).deleteOnExit(); metaData = new HashSet<VCFHeaderLine>(); additionalColumns = new HashSet<String>(); final SAMSequenceDictionary sequenceDict = createArtificialSequenceDictionary(); final VCFHeader header = createFakeHeader(metaData, additionalColumns, sequenceDict); try (final VariantContextWriter writer = new VariantContextWriterBuilder() .setOutputFile(fakeVCFFile).setReferenceDictionary(sequenceDict) .setOptions(EnumSet.of(Options.ALLOW_MISSING_FIELDS_IN_HEADER, Options.INDEX_ON_THE_FLY)) .build()) { writer.writeHeader(header); writer.add(createVC(header)); writer.add(createVC(header)); } VariantContextTestProvider.VariantContextContainer container = VariantContextTestProvider .readAllVCs(fakeVCFFile, new BCF2Codec()); int counter = 0; final Iterator<VariantContext> it = container.getVCs().iterator(); while (it.hasNext()) { it.next(); counter++; } Assert.assertEquals(counter, 2); }

Target:
public void testWriteAndReadBCF() throws IOException { final File bcfOutputFile = File.createTempFile("testWriteAndReadVCF.", ".bcf", tempDir); bcfOutputFile.deleteOnExit(); final VCFHeader header = createFakeHeader(); try (final VariantContextWriter writer = new VariantContextWriterBuilder() .setOutputFile(bcfOutputFile).setReferenceDictionary(header.getSequenceDictionary()) .unsetOption(Options.INDEX_ON_THE_FLY) .build()) { writer.writeHeader(header); writer.add(createVC(header)); writer.add(createVC(header)); } VariantContextTestProvider.VariantContextContainer container = VariantContextTestProvider .readAllVCs(bcfOutputFile, new BCF2Codec()); int counter = 0; final Iterator<VariantContext> it = container.getVCs().iterator(); while (it.hasNext()) { it.next(); counter++; } Assert.assertEquals(counter, 2); }
Source:
public Subscription schedulePeriodically(final Action0 action, long initialDelay, long period, TimeUnit unit) { final long periodInNanos = unit.toNanos(period); final long firstNowNanos = TimeUnit.MILLISECONDS.toNanos(now()); final long firstStartInNanos = firstNowNanos + unit.toNanos(initialDelay); final MultipleAssignmentSubscription mas = new MultipleAssignmentSubscription(); final Action0 recursiveAction = new Action0() { long count; long lastNowNanos = firstNowNanos; long startInNanos = firstStartInNanos; @Override public void call() { if (!mas.isUnsubscribed()) { action.call(); long nextTick; long nowNanos = TimeUnit.MILLISECONDS.toNanos(now()); if (nowNanos + CLOCK_DRIFT_TOLERANCE_NANOS < lastNowNanos || nowNanos >= lastNowNanos + periodInNanos + CLOCK_DRIFT_TOLERANCE_NANOS) { nextTick = nowNanos + periodInNanos; startInNanos -= (lastNowNanos - nowNanos) + periodInNanos; ++count; } else { nextTick = startInNanos + (++count * periodInNanos); } lastNowNanos = nowNanos; long delay = nextTick - nowNanos; mas.set(schedule(this, delay, TimeUnit.NANOSECONDS)); } } }; MultipleAssignmentSubscription s = new MultipleAssignmentSubscription(); mas.set(s); s.set(schedule(recursiveAction, initialDelay, unit)); return mas; }

Target:
public Subscription schedulePeriodically(final Action0 action, long initialDelay, long period, TimeUnit unit) { final long periodInNanos = unit.toNanos(period); final long firstNowNanos = TimeUnit.MILLISECONDS.toNanos(now()); final long firstStartInNanos = firstNowNanos + unit.toNanos(initialDelay); final MultipleAssignmentSubscription mas = new MultipleAssignmentSubscription(); final Action0 recursiveAction = new Action0() { long count; long lastNowNanos = firstNowNanos; long startInNanos = firstStartInNanos; @Override public void call() { if (!mas.isUnsubscribed()) { action.call(); long nextTick; long nowNanos = TimeUnit.MILLISECONDS.toNanos(now()); if (nowNanos + CLOCK_DRIFT_TOLERANCE_NANOS < lastNowNanos || nowNanos >= lastNowNanos + periodInNanos + CLOCK_DRIFT_TOLERANCE_NANOS) { nextTick = nowNanos + periodInNanos; startInNanos = nextTick - (periodInNanos * (++count)); } else { nextTick = startInNanos + (++count * periodInNanos); } lastNowNanos = nowNanos; long delay = nextTick - nowNanos; mas.set(schedule(this, delay, TimeUnit.NANOSECONDS)); } } }; MultipleAssignmentSubscription s = new MultipleAssignmentSubscription(); mas.set(s); s.set(schedule(recursiveAction, initialDelay, unit)); return mas; }
Source:
public void queryWithNumericParameter_shouldReturnResults() { String projectId = spanner.getOptions().getProjectId(); DatabaseClient client = spanner.getDatabaseClient(DatabaseId.of(projectId, instanceId, databaseId)); client.write( ImmutableList.of( Mutation.newInsertOrUpdateBuilder("SingerRevenues") .set("SingerId") .to(1L) .set("Revenue") .to(new BigDecimal("35000")) .build(), Mutation.newInsertOrUpdateBuilder("SingerRevenues") .set("SingerId") .to(6L) .set("Revenue") .to(new BigDecimal("104500")) .build(), Mutation.newInsertOrUpdateBuilder("SingerRevenues") .set("SingerId") .to(14L) .set("Revenue") .to(new BigDecimal("99999999999999999999999999999.99")) .build())); String out = runExample(() -> QueryWithNumericParameterSample.queryWithNumericParameter(client)); assertThat(out).contains("1 35000"); }

Target:
public void queryWithNumericParameter_shouldReturnResults() { String projectId = spanner.getOptions().getProjectId(); DatabaseClient client = spanner.getDatabaseClient(DatabaseId.of(projectId, instanceId, databaseId)); client.write( ImmutableList.of( Mutation.newInsertOrUpdateBuilder("Venues") .set("VenueId") .to(4L) .set("Revenue") .to(new BigDecimal("35000")) .build(), Mutation.newInsertOrUpdateBuilder("Venues") .set("VenueId") .to(19L) .set("Revenue") .to(new BigDecimal("104500")) .build(), Mutation.newInsertOrUpdateBuilder("Venues") .set("VenueId") .to(42L) .set("Revenue") .to(new BigDecimal("99999999999999999999999999999.99")) .build())); String out = runExample(() -> QueryWithNumericParameterSample.queryWithNumericParameter(client)); assertThat(out).contains("4 35000"); }
Source:
public boolean userIsBlocked() throws TooManyLoginAttemptsException { UserSecret userSecret = getSecret(); if (userSecret.getFailedLoginAttempts() >= 3) { if (userSecret.getLastFailedAuthentication() != null && (Instant.now().toEpochMilli() < userSecret.getLastFailedAuthentication().plus(Duration.ofSeconds(30)).toEpochMilli())) { throw new TooManyLoginAttemptsException( "You entered the wrong verification code 3 times, please wait 30 seconds before you try again"); } } return false; }

Target:
public boolean userIsBlocked() throws TooManyLoginAttemptsException { UserSecret userSecret = getSecret(); if (userSecret.getFailedLoginAttempts() >= MAX_FAILED_LOGIN_ATTEMPTS) { if (userSecret.getLastFailedAuthentication() != null && (Instant.now().toEpochMilli() < userSecret.getLastFailedAuthentication() .plus(Duration.ofSeconds(BLOCKED_USER_INTERVAL)) .toEpochMilli())) { throw new TooManyLoginAttemptsException( format("You entered the wrong verification code %d times, please wait for %d seconds before you try again", MAX_FAILED_LOGIN_ATTEMPTS, BLOCKED_USER_INTERVAL)); } } return false; }
Source:
public void pull_changesNewerThanOpenRevs() throws Exception { Bar bar1 = BarUtils.createBar(remoteDb, "Tom", 31); final ChangesResult changesResult1 = remoteDb.changes(null, 1000); Bar bar2 = BarUtils.updateBar(remoteDb, bar1.getId(), "Jerry", 41); final ChangesResult changesResult2 = remoteDb.changes(null, 1000); System.out.println("compact"); URI postURI = new URI(couchClient.getRootUri().toString() + "/_compact"); Assert.assertEquals(202, ClientTestUtils.executeHttpPostRequest(postURI, "")); CouchDbInfo info = couchClient.getDbInfo(); while(info.isCompactRunning()) { Thread.sleep(1000); info = couchClient.getDbInfo(); }; System.out.println("done compact"); PullReplication pullReplication = this.createPullReplication(); BasicPullStrategy customReplicator = new BasicPullStrategy(pullReplication, null, this.config); customReplicator.sourceDb = spy(customReplicator.sourceDb); doAnswer(new ChangesResultAnswer(changesResult1, changesResult2)) .when(customReplicator.sourceDb). changes((Replication.Filter) anyObject(), anyObject(), anyInt()); System.out.println("running...."); customReplicator.run(); System.out.println("done...."); Map m = datastore.getDocument(bar1.getId()).asMap(); System.out.println(m); Assert.assertEquals(41, m.get("age")); Assert.assertEquals("Jerry", m.get("name")); System.out.println("done asserts"); }

Target:
public void pull_changesNewerThanOpenRevs() throws Exception { Bar bar1 = BarUtils.createBar(remoteDb, "Tom", 31); final ChangesResult changesResult1 = remoteDb.changes(null, 1000); Bar bar2 = BarUtils.updateBar(remoteDb, bar1.getId(), "Jerry", 41); final ChangesResult changesResult2 = remoteDb.changes(null, 1000); URI postURI = new URI(couchClient.getRootUri().toString() + "/_compact"); Assert.assertEquals(202, ClientTestUtils.executeHttpPostRequest(postURI, "")); CouchDbInfo info = couchClient.getDbInfo(); while(info.isCompactRunning()) { Thread.sleep(1000); info = couchClient.getDbInfo(); }; PullReplication pullReplication = this.createPullReplication(); BasicPullStrategy customReplicator = new BasicPullStrategy(pullReplication, null, this.config); customReplicator.sourceDb = spy(customReplicator.sourceDb); doAnswer(new ChangesResultAnswer(changesResult1, changesResult2)) .when(customReplicator.sourceDb). changes((Replication.Filter) anyObject(), anyObject(), anyInt()); customReplicator.run(); Map m = datastore.getDocument(bar1.getId()).asMap(); Assert.assertEquals(41, m.get("age")); Assert.assertEquals("Jerry", m.get("name")); }
Source:
public void loadInputs(String simulationName, Map<String, String> valuesMap) { this.simulationNameItem.setValue(simulationName); final Map<String, String> conflictMap = new HashMap<String, String>(); StringBuilder sb = new StringBuilder(); for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { final AbstractSourceLayout source = (AbstractSourceLayout) canvas; final String inputValue = valuesMap.get(source.getName()); if (inputValue != null) { if (source.getValue() == null || source.getValue().isEmpty() || source.isModifiableRelaunchedSimulation()) { if (source.isOptional()) { source.enableInputRelaunchedSimulation(); } source.setValue(inputValue); } else { conflictMap.put(source.getName(), inputValue); } } } } if (!conflictMap.isEmpty()) { SC.ask("The following fields already have a value.<br />" + "Do you want to replace them?<br />" + "Fields: " + conflictMap.keySet(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { AbstractSourceLayout source = (AbstractSourceLayout) canvas; source.setValue(conflictMap.get(source.getName())); } } } } }); } if (sb.length() > 0) { Layout.getInstance().setWarningMessage(sb.toString()); } }

Target:
public void loadInputs(String simulationName, Map<String, String> valuesMap) { this.simulationNameItem.setValue(simulationName); final Map<String, String> conflictMap = new HashMap<String, String>(); StringBuilder sb = new StringBuilder(); for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { final AbstractSourceLayout source = (AbstractSourceLayout) canvas; final String inputValue = valuesMap.get(source.getName()); if (inputValue != null) { if (source.getValue() == null || source.getValue().isEmpty() || source.isValueModifiable()) { if (source.isOptional()) { source.enableInput(); } source.setValue(inputValue); } else { conflictMap.put(source.getName(), inputValue); } } } } if (!conflictMap.isEmpty()) { SC.ask("The following fields already have a value.<br />" + "Do you want to replace them?<br />" + "Fields: " + conflictMap.keySet(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { for (Canvas canvas : sourcesLayout.getMembers()) { if (canvas instanceof AbstractSourceLayout) { AbstractSourceLayout source = (AbstractSourceLayout) canvas; source.setValue(conflictMap.get(source.getName())); } } } } }); } if (sb.length() > 0) { Layout.getInstance().setWarningMessage(sb.toString()); } }
Source:
protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getNetworkDAO().update(getNetwork()); for (NetworkCluster clusterAttachment : getNetworkClusterDAO().getAllForNetwork(getNetwork().getId())) { NetworkClusterHelper.setStatus(clusterAttachment.getClusterId(), getNetwork()); } if (networkChangedToNonVmNetwork()) { removeVnicProfiles(); } return null; } }); if (!getNetwork().isExternal()) { if (NetworkHelper.setupNetworkSupported(getStoragePool().getcompatibility_version())) { applyNetworkChangesToHosts(); } else { List<VdsNetworkInterface> nics = getDbFacade().getInterfaceDao().getVdsInterfacesByNetworkId(getNetwork().getId()); if (nics != null && !nics.isEmpty()) { AuditLogDirector.log(this, AuditLogType.MULTI_UPDATE_NETWORK_NOT_POSSIBLE); } } } setSucceeded(true); }

Target:
protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getNetworkDAO().update(getNetwork()); for (NetworkCluster clusterAttachment : getNetworkClusterDAO().getAllForNetwork(getNetwork().getId())) { NetworkClusterHelper.setStatus(clusterAttachment.getClusterId(), getNetwork()); } if (networkChangedToNonVmNetwork()) { removeVnicProfiles(); } return null; } }); if (!getNetwork().isExternal()) { if (NetworkHelper.setupNetworkSupported(getStoragePool().getcompatibility_version())) { applyNetworkChangesToHosts(); } else { List<VdsNetworkInterface> nics = getDbFacade().getInterfaceDao().getVdsInterfacesByNetworkId(getNetwork().getId()); if (!nics.isEmpty()) { AuditLogDirector.log(this, AuditLogType.MULTI_UPDATE_NETWORK_NOT_POSSIBLE); } } } setSucceeded(true); }
Source:
public boolean hasCorrectVolType(Guid storagePoolId, Guid storageDomainId, Guid imageGroupId, Guid imageId) { DiskImage dbImage = getSnapshotLeaf(imageGroupId); DiskImage vdsmImage = getVolumeInfoFromVdsm(storagePoolId, storageDomainId, imageGroupId, imageId); if (dbImage.getId().equals(vdsmImage.getId())) { return VolType.LEAF == vdsmImage.getVolType(); } return true; }

Target:
public boolean hasCorrectVolType(Guid storagePoolId, Guid storageDomainId, Guid imageGroupId, Guid imageId) { DiskImage dbImage = getSnapshotLeaf(imageGroupId); DiskImage vdsmImage = getVolumeInfoFromVdsm(storagePoolId, storageDomainId, imageGroupId, imageId); return dbImage.getId().equals(vdsmImage.getId()) ? VolType.LEAF == vdsmImage.getVolType() : true; }
Source:
void setCurrentControllerInfo() { if (Build.VERSION.SDK_INT >= 28) { } else if (Build.VERSION.SDK_INT >= 24) { MediaSessionImpl sessionImpl = mSessionImpl != null ? mSessionImpl.get() : null; if (sessionImpl != null) { String packageName = sessionImpl.getCallingPackage(); if (TextUtils.isEmpty(packageName)) { packageName = LEGACY_CONTROLLER; } sessionImpl.setCurrentControllerInfo( new RemoteUserInfo(packageName, UNKNOWN_PID, UNKNOWN_UID)); } } else { MediaSessionImpl sessionImpl = mSessionImpl != null ? mSessionImpl.get() : null; if (sessionImpl != null) { sessionImpl.setCurrentControllerInfo( new RemoteUserInfo(LEGACY_CONTROLLER, UNKNOWN_PID, UNKNOWN_UID)); } } }

Target:
void setCurrentControllerInfo() { if (Build.VERSION.SDK_INT >= 28) { return; } MediaSessionImpl sessionImpl = mSessionImpl != null ? mSessionImpl.get() : null; if (sessionImpl == null) { return; } String packageName; if (Build.VERSION.SDK_INT >= 24) { packageName = sessionImpl.getCallingPackage(); if (TextUtils.isEmpty(packageName)) { packageName = LEGACY_CONTROLLER; } } else { packageName = LEGACY_CONTROLLER; } sessionImpl.setCurrentControllerInfo(new RemoteUserInfo( packageName, UNKNOWN_PID, UNKNOWN_UID)); }
Source:
public static int getArity(@NotNull ErlangSpecification o) { ErlangSpecificationStub stub = o.getStub(); if (stub != null) return stub.getArity(); ErlangFunTypeSigs sigs = getFunTypeSigs(o); List<ErlangTypeSig> typeSigs = sigs != null ? sigs.getTypeSigList() : ContainerUtil.<ErlangTypeSig>emptyList(); ErlangTypeSig sig = typeSigs.size() > 0 ? typeSigs.get(0) : null; return sig != null ? sig.getFunType().getFunTypeArguments().getTypeList().size() : -1; }

Target:
public static int getArity(@NotNull ErlangSpecification o) { ErlangSpecificationStub stub = o.getStub(); if (stub != null) return stub.getArity(); ErlangFunTypeSigs signature = getSignature(o); List<ErlangTypeSig> typeSigs = signature != null ? signature.getTypeSigList() : ContainerUtil.<ErlangTypeSig>emptyList(); ErlangTypeSig sig = typeSigs.size() > 0 ? typeSigs.get(0) : null; return sig != null ? sig.getFunType().getFunTypeArguments().getTypeList().size() : -1; }