auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Map<String, String> CreateStructFromConnection(final storage_server_connections connection, final storage_pool storage_pool) { Map<String, String> con = new HashMap<String, String>(); addOrDefault(con, connection.getid(), Guid.Empty.toString(), "id"); addOrEmpty(con, connection.getconnection(), "connection"); addOrEmpty(con, connection.getportal(), "portal"); addOrEmpty(con, connection.getport(), "port"); addOrEmpty(con, connection.getiqn(), "iqn"); addOrEmpty(con, connection.getuser_name(), "user"); addOrEmpty(con, connection.getpassword(), "password"); if (storage_pool != null && Config.<Boolean> GetValue(ConfigValues.AdvancedNFSOptionsEnabled, storage_pool.getcompatibility_version().getValue())) { addIfNotNullOrEmpty(con, connection.getMountOptions(), "mnt_options"); addIfNotNullOrEmpty(con, connection.getVfsType(), "vfs_type"); addOrDefault(con, connection.getNfsVersion(), "auto", "protocol_version"); addIfNotNullOrEmpty(con, connection.getNfsTimeo(), "timeout"); addIfNotNullOrEmpty(con, connection.getNfsRetrans(), "retrans"); } return con; }

Target:
public static Map<String, String> CreateStructFromConnection(final storage_server_connections connection, final storage_pool storage_pool) { class ConnParamMap extends HashMap<String, String> { void put(String key, Object value, Object def) { put(key, value != null ? value.toString() : def.toString()); } void putIfNotEmpty(String key, Object value) { if (value != null && !"".equals(value.toString())) { put(key, value.toString()); } } }; ConnParamMap con = new ConnParamMap(); con.put("id", connection.getid(), Guid.Empty.toString()); con.put("connection", connection.getconnection(), ""); con.put("portal", connection.getportal(), ""); con.put("port", connection.getport(), ""); con.put("iqn", connection.getiqn(), ""); con.put("user", connection.getuser_name(), ""); con.put("password", connection.getpassword(), ""); if (storage_pool != null && Config.<Boolean> GetValue(ConfigValues.AdvancedNFSOptionsEnabled, storage_pool.getcompatibility_version().getValue())) { con.putIfNotEmpty("mnt_options", connection.getMountOptions()); con.putIfNotEmpty("vfs_type", connection.getVfsType()); con.put("protocol_version", connection.getNfsVersion(), "auto"); con.putIfNotEmpty("timeout", connection.getNfsTimeo()); con.putIfNotEmpty("retrans", connection.getNfsRetrans()); } return con; }
Source:
public int schedule() { schedulingMainLoopTimingLogger = new SchedulingMainLoopTimingLogger(Logger.getLogger(SchedulingMethodImpl.class)); Policy currentPolicy = schedulingService.getPolicy(); activeObjectCreationRetryTimeNumber = ACTIVEOBJECT_CREATION_RETRY_TIME_NUMBER; Map<JobId, JobDescriptor> jobMap = schedulingService.lockJobsToSchedule(); Map<JobId, JobDescriptor> toUnlock = jobMap; logSelectedJobs(jobMap); if (jobMap.isEmpty()) { return 0; } int tasksStarted = startTasks(currentPolicy, jobMap, toUnlock); schedulingMainLoopTimingLogger.printTimingsDEBUGLevel(); return tasksStarted; }

Target:
public int schedule() { schedulingMainLoopTimingLogger = new SchedulingMainLoopTimingLogger(logger); Policy currentPolicy = schedulingService.getPolicy(); activeObjectCreationRetryTimeNumber = ACTIVEOBJECT_CREATION_RETRY_TIME_NUMBER; Map<JobId, JobDescriptor> jobMap = schedulingService.lockJobsToSchedule(); Map<JobId, JobDescriptor> toUnlock = jobMap; logSelectedJobs(jobMap); if (jobMap.isEmpty()) { return 0; } int tasksStarted = startTasks(currentPolicy, jobMap, toUnlock); schedulingMainLoopTimingLogger.printTimingsDEBUGLevel(); return tasksStarted; }
Source:
public void addPartition(TopicPartition topicPartition) { if (!topicPartitions.containsKey(topicPartition)) topicPartitions.put(topicPartition, new TopicPartitionEntry()); }

Target:
private void addPartition(TopicPartition topicPartition) { this.topicPartitions.putIfAbsent(topicPartition, new TopicPartitionEntry()); }
Source:
public ProjectState createEntry(Project.NameKey key) throws Exception { final ReviewDb db = schema.open(); try { final ProjectName pn = db.projectNames().get(key); if (pn == null) { return null; } final Collection<RefRight> rights = Collections.unmodifiableCollection(db.refRights().byProject( pn.getId()).toList()); return projectStateFactory.create(db.projects().get(pn.getId()), rights); } finally { db.close(); } }

Target:
public ProjectState createEntry(Project.NameKey key) throws Exception { final ReviewDb db = schema.open(); try { final ProjectName pn = db.projectNames().get(key); if (pn == null) { return null; } return byId.get(pn.getId()); } finally { db.close(); } }
Source:
public void run(AccountManagerFuture<Boolean> future) { if (future.isDone()) { Account account = new Account(mAccountName, MainApp.getAccountType()); if (!AccountUtils.exists(account, MainApp.getAppContext())) { mUploaderBinder.cancel(account); mDownloaderBinder.cancel(account); } Account a = AccountUtils.getCurrentOwnCloudAccount(this); String accountName = ""; if (a == null) { Account[] accounts = AccountManager.get(this).getAccountsByType(MainApp.getAccountType()); if (accounts.length != 0) accountName = accounts[0].name; AccountUtils.setCurrentOwnCloudAccount(this, accountName); } addAccountsCheckboxPreferences(); } }

Target:
public void run(AccountManagerFuture<Boolean> future) { if (future.isDone()) { Account account = new Account(mAccountName, MainApp.getAccountType()); if (!AccountUtils.exists(account, MainApp.getAppContext())) { if (mUploaderBinder != null) { mUploaderBinder.cancel(account); } if (mDownloaderBinder != null) { mDownloaderBinder.cancel(account); } } Account a = AccountUtils.getCurrentOwnCloudAccount(this); String accountName = ""; if (a == null) { Account[] accounts = AccountManager.get(this).getAccountsByType(MainApp.getAccountType()); if (accounts.length != 0) accountName = accounts[0].name; AccountUtils.setCurrentOwnCloudAccount(this, accountName); } addAccountsCheckboxPreferences(); } }
Source:
public static IStateHistoryBackend createHistoryTreeBackendNewFile(String ssid, File stateFile, int providerVersion, long startTime, int queueSize, Function<ITmfStateInterval, ITmfStateInterval> mapper) throws IOException { if (queueSize > 0) { return new ThreadedHistoryTreeBackendStub(ssid, stateFile, providerVersion, startTime, queueSize, mapper); } return new HistoryTreeBackendStub(ssid, stateFile, providerVersion, startTime, 64 * 1024, 50); }

Target:
public static IStateHistoryBackend createHistoryTreeBackendNewFile(String ssid, File stateFile, int providerVersion, long startTime, int queueSize, Function<ITmfStateInterval, ITmfStateInterval> mapper) throws IOException { if (queueSize > 0) { return new ThreadedHistoryTreeBackendStub(ssid, stateFile, providerVersion, startTime, queueSize, mapper); } return new HistoryTreeBackendStub(ssid, stateFile, providerVersion, startTime, BLOCK_SIZE, MAX_CHILDREN); }
Source:
public Boolean getB(ItemMeta cb, ItemStack d) { return cb.isUnbreakable(); }

Target:
public Boolean getB(ItemMeta cb, ItemStack d) { return NmsItemStackMetaUnbreakable.get().isUnbreakable(cb); }
Source:
public Iterable<RelationshipType> getRelationshipTypes() { KernelTransaction transaction = safeAcquireTransaction(); try ( RelationshipTraversalCursor relationships = transaction.cursors().allocateRelationshipTraversalCursor(); Statement ignore = transaction.acquireStatement() ) { NodeCursor nodes = transaction.nodeCursor(); TokenRead tokenRead = transaction.tokenRead(); singleNode( transaction, nodes ); if ( !nodes.next() ) { throw new NotFoundException( "Node not found." ); } nodes.allRelationships( relationships ); List<RelationshipType> types = new ArrayList<>(); while ( relationships.next() ) { types.add( RelationshipType.withName( tokenRead.relationshipTypeName( relationships.label() ) ) ); } return types; } catch ( KernelException e ) { throw new NotFoundException( "Relationship name not found.", e ); } }

Target:
public Iterable<RelationshipType> getRelationshipTypes() { KernelTransaction transaction = safeAcquireTransaction(); try ( RelationshipTraversalCursor relationships = transaction.cursors().allocateRelationshipTraversalCursor(); Statement ignore = transaction.acquireStatement() ) { NodeCursor nodes = transaction.nodeCursor(); TokenRead tokenRead = transaction.tokenRead(); singleNode( transaction, nodes ); nodes.allRelationships( relationships ); PrimitiveIntSet seen = Primitive.intSet(); List<RelationshipType> types = new ArrayList<>(); while ( relationships.next() ) { int type = relationships.type(); if ( !seen.contains( type ) ) { types.add( RelationshipType.withName( tokenRead.relationshipTypeName( relationships.type() ) ) ); seen.add( type ); } } return types; } catch ( KernelException e ) { throw new NotFoundException( "Relationship name not found.", e ); } }
Source:
public TCPClient createTCPClient(final String host, final int port) throws IOException { checkRunning(); return new TCPClient(this, host, port); }

Target:
public TCPClient createTCPClient(final String host, final int port) throws IOException { checkRunning(); TCPClient tc = new TCPClient(this, host, port); clients.put(((Client)tc).getChannel(), tc); return tc; }
Source:
public void setNode(Node selectedNode) { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { String defaultName = Bundle.TextContentViewerPanel_defaultName(); if (selectedNode == null) { setName(defaultName); } else { Content content = selectedNode.getLookup().lookup(Content.class); if (content != null) { String path = defaultName; try { path = content.getUniquePath(); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Exception while calling Content.getUniquePath() for {0}", content); } setName(path); } else { setName(defaultName); } } currentNode = selectedNode; setupTabs(selectedNode); } finally { this.setCursor(null); } }

Target:
public void setNode(Node selectedNode) { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { String defaultName = Bundle.TextContentViewerPanel_defaultName(); if (selectedNode == null) { setName(defaultName); } else { Content content = selectedNode.getLookup().lookup(Content.class); if (content != null) { String path = defaultName; try { path = content.getUniquePath(); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Exception while calling Content.getUniquePath() for " + content.toString(), ex); } setName(path); } else { setName(defaultName); } } currentNode = selectedNode; setupTabs(selectedNode); } finally { this.setCursor(null); } }
Source:
protected void applyFilter(Bundle filterParams) { Log.d(TAG, "applyFilter()"); this.filterParams = filterParams; if (this.filterParams == null) { this.emptyList.setText(R.string.start); String emptyListTitle = this.getString(R.string.start); String title = this.getString(R.string.bbct_title, emptyListTitle); this.getActivity().setTitle(title); } else { this.emptyList.setText(R.string.empty_list); String emptyListTitle = this.getString(R.string.empty_list); String title = this.getString(R.string.bbct_title, emptyListTitle); this.getActivity().setTitle(title); } StringBuilder sb = null; String[] args = null; if (this.filterParams != null) { sb = new StringBuilder(); args = new String[this.filterParams.size()]; int numQueries = 0; for (String key : this.filterParams.keySet()) { String value = this.filterParams.getString(key); switch (key) { case FilterCards.YEAR_EXTRA: sb.append(BaseballCardContract.YEAR_SELECTION); break; case FilterCards.BRAND_EXTRA: sb.append(BaseballCardContract.BRAND_SELECTION); break; case FilterCards.NUMBER_EXTRA: sb.append(BaseballCardContract.NUMBER_SELECTION); break; case FilterCards.PLAYER_NAME_EXTRA: sb.append(BaseballCardContract.PLAYER_NAME_SELECTION); break; case FilterCards.TEAM_EXTRA: sb.append(BaseballCardContract.TEAM_SELECTION); break; default: Log.e(TAG, "Invalid key: " + key); break; } args[numQueries] = value; numQueries++; if (numQueries < args.length) { sb.append(" AND "); } } } Cursor cursor = this .getActivity() .getContentResolver() .query(this.uri, BaseballCardContract.PROJECTION, sb == null ? null : sb.toString(), args, null); this.swapCursor(cursor); }

Target:
protected void applyFilter(Bundle filterParams) { Log.d(TAG, "applyFilter()"); this.filterParams = filterParams; if (this.filterParams == null) { this.emptyList.setText(R.string.start); } else { this.emptyList.setText(R.string.empty_list); } StringBuilder sb = null; String[] args = null; if (this.filterParams != null) { sb = new StringBuilder(); args = new String[this.filterParams.size()]; int numQueries = 0; for (String key : this.filterParams.keySet()) { String value = this.filterParams.getString(key); switch (key) { case FilterCards.YEAR_EXTRA: sb.append(BaseballCardContract.YEAR_SELECTION); break; case FilterCards.BRAND_EXTRA: sb.append(BaseballCardContract.BRAND_SELECTION); break; case FilterCards.NUMBER_EXTRA: sb.append(BaseballCardContract.NUMBER_SELECTION); break; case FilterCards.PLAYER_NAME_EXTRA: sb.append(BaseballCardContract.PLAYER_NAME_SELECTION); break; case FilterCards.TEAM_EXTRA: sb.append(BaseballCardContract.TEAM_SELECTION); break; default: Log.e(TAG, "Invalid key: " + key); break; } args[numQueries] = value; numQueries++; if (numQueries < args.length) { sb.append(" AND "); } } } Cursor cursor = this .getActivity() .getContentResolver() .query(this.uri, BaseballCardContract.PROJECTION, sb == null ? null : sb.toString(), args, null); this.swapCursor(cursor); }
Source:
public IOBlasterResults call() throws Exception { try { rdfRepository.createNamespace(); List<Statement> statements = generateAndInsert(rdfRepository); IOBlasterResults results = queryForAllMatches(rdfRepository, statements); return results; } finally { rdfRepository.deleteNamespace(); } }

Target:
public IOBlasterResults call() throws Exception { try { rdfRepository.deleteNamespace(); } catch (ContainedException e) { } rdfRepository.createNamespace(); List<Statement> statements = generateAndInsert(rdfRepository); IOBlasterResults results = queryForAllMatches(rdfRepository, statements); return results; }
Source:
private void doExternalServicesBadInputTest(RestMethod[] restMethods, String expectedExceptionMsg) throws JSONException { for (RestMethod restMethod : restMethods) { if (restMethod.equals(RestMethod.UNKNOWN)) { continue; } JSONObject headers = new JSONObject(); List<ByteBuffer> contents = null; if (restMethod.equals(RestMethod.POST)) { setAmbryHeaders(headers, 1, 7200, false, "doExternalServicesBadInputTest", "application/octet-stream", "doExternalServicesBadInputTest"); contents = new ArrayList<ByteBuffer>(); contents.add(ByteBuffer.allocate(1)); contents.add(null); } try { doOperation(createRestRequest(restMethod, "/", headers, contents), new MockRestResponseChannel()); fail("Operation " + restMethod + " should have failed because an external service would have thrown an exception"); } catch (Exception e) { assertEquals("Unexpected exception message", expectedExceptionMsg, e.getMessage()); } } }

Target:
private void doExternalServicesBadInputTest(RestMethod[] restMethods, String expectedExceptionMsg) throws JSONException { for (RestMethod restMethod : restMethods) { if (restMethod.equals(RestMethod.UNKNOWN)) { continue; } JSONObject headers = new JSONObject(); List<ByteBuffer> contents = null; if (restMethod.equals(RestMethod.POST)) { setAmbryHeaders(headers, 0, 7200, false, "doExternalServicesBadInputTest", "application/octet-stream", "doExternalServicesBadInputTest"); contents = new ArrayList<ByteBuffer>(1); contents.add(null); } try { doOperation(createRestRequest(restMethod, "/", headers, contents), new MockRestResponseChannel()); fail("Operation " + restMethod + " should have failed because an external service would have thrown an exception"); } catch (Exception e) { assertEquals("Unexpected exception message", expectedExceptionMsg, e.getMessage()); } } }
Source:
public void run() { try { Object containerKey = kms.getKey(blobId.getAccountId(), blobId.getContainerId()); Object perBlobKey = cryptoService.decryptKey(encryptedKey, containerKey); ByteBuffer decryptedBlobContent = null; if (encryptedBlobContent != null) { decryptedBlobContent = cryptoService.decrypt(encryptedBlobContent, perBlobKey); } ByteBuffer decryptedUserMetadata = null; if (encryptedUserMetadata != null) { decryptedUserMetadata = cryptoService.decrypt(encryptedUserMetadata, perBlobKey); } callback.onCompletion(new DecryptJobResult(blobId, decryptedBlobContent, decryptedUserMetadata), null); } catch (Exception e) { callback.onCompletion(new DecryptJobResult(blobId, null, null), e); } }

Target:
public void run() { Exception exception = null; ByteBuffer decryptedBlobContent = null; ByteBuffer decryptedUserMetadata = null; try { Object containerKey = kms.getKey(blobId.getAccountId(), blobId.getContainerId()); Object perBlobKey = cryptoService.decryptKey(encryptedPerBlobKey, containerKey); if (encryptedBlobContent != null) { decryptedBlobContent = cryptoService.decrypt(encryptedBlobContent, perBlobKey); } if (encryptedUserMetadata != null) { decryptedUserMetadata = cryptoService.decrypt(encryptedUserMetadata, perBlobKey); } } catch (Exception e) { exception = e; } finally { callback.onCompletion( exception == null ? new DecryptJobResult(blobId, decryptedBlobContent, decryptedUserMetadata) : null, exception); } }
Source:
private boolean canRestore(SolrClient client, String collection) throws IOException, SolrServerException { LOGGER.trace("Checking restoration capabilitility of collection {}", collection); if (collectionExists(client, collection)) { LOGGER.trace("Collection already exists", collection); if (force) { LOGGER.trace("Force option set, deleting existing collection", collection); CollectionAdminRequest.Delete delete = CollectionAdminRequest.deleteCollection(collection); CollectionAdminResponse response = delete.process(client); return response.isSuccess(); } else { LOGGER.trace("Force option not set, cannot restore collection", collection); return false; } } return true; }

Target:
private boolean canRestore(SolrClient client, String collection) throws IOException, SolrServerException { LOGGER.trace("Checking restoration capability of collection {}", collection); if (collectionExists(client, collection)) { LOGGER.trace("Collection already exists", collection); if (force) { LOGGER.trace("Force option set, deleting existing collection", collection); CollectionAdminRequest.Delete delete = CollectionAdminRequest.deleteCollection(collection); CollectionAdminResponse response = delete.process(client); return response.isSuccess(); } else { printErrorMessage( String.format( "Force option not set, cannot restore %s collection. Use --force to restore when the collection exists.", collection)); LOGGER.trace("Force option not set, cannot restore collection", collection); return false; } } return true; }
Source:
public KeyValueCollectionPermission isPermittedMatchAll( CollectionPermission subject, KeyValueCollectionPermission matchAll, KeyValueCollectionPermission allPermissionsCollection) { return isPermitted( new MatchOneCollectionPermission(subject.getPermissionList()), matchAll, allPermissionsCollection); }

Target:
public KeyValueCollectionPermission isPermittedMatchAll( CollectionPermission subject, KeyValueCollectionPermission matchAll, KeyValueCollectionPermission allPermissionsCollection) { return isPermitted(subject, matchAll, allPermissionsCollection); }
Source:
protected Object readRecord(Object old, Schema expected, ResolvingDecoder in) throws IOException { SpecificData data = getSpecificData(); if (data.useCustomCoders()) { Object r = data.newRecord(old, expected); if (r instanceof SpecificRecordBase) { SpecificRecordBase d = (SpecificRecordBase) r; if (d.hasCustomCoders()) { d.customDecode(in); return d; } } } return super.readRecord(old, expected, in); }

Target:
protected Object readRecord(Object old, Schema expected, ResolvingDecoder in) throws IOException { SpecificData data = getSpecificData(); if (data.useCustomCoders()) { old = data.newRecord(old, expected); if (old instanceof SpecificRecordBase) { SpecificRecordBase d = (SpecificRecordBase) old; if (d.hasCustomCoders()) { d.customDecode(in); return d; } } } return super.readRecord(old, expected, in); }
Source:
public void testSuperInterface() { ApexNode<?> node = parse("public interface CustomInterface extends A, B implements C {}"); Assert.assertSame(ASTUserInterface.class, node.getClass()); ASTUserInterface toplevel = (ASTUserInterface) node; Assert.assertEquals("A", toplevel.getSuperInterfaceName()); }

Target:
public void testSuperInterface() { ApexNode<?> node = parse("public interface CustomInterface extends A {}"); Assert.assertSame(ASTUserInterface.class, node.getClass()); ASTUserInterface toplevel = (ASTUserInterface) node; Assert.assertEquals("A", toplevel.getSuperInterfaceName()); }
Source:
private RefactoringStatus checkIfFieldDeclaredIn(final IField iField, final IType type) throws JavaModelException { final IField fieldInType= type.getField(iField.getElementName()); if (!fieldInType.exists()) { return null; } if(!iField.getTypeSignature().equals(fieldInType.getTypeSignature())) { return null; } final String[] keys= { JavaElementLabels.getTextLabel(fieldInType, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(type, JavaElementLabels.ALL_FULLY_QUALIFIED)}; final String msg= Messages.format(RefactoringCoreMessages.PullUpRefactoring_Field_declared_in_class, keys); final RefactoringStatusContext context= JavaStatusContext.create(fieldInType); return RefactoringStatus.createWarningStatus(msg, context); }

Target:
private RefactoringStatus checkIfFieldDeclaredIn(final IField iField, final IType type) throws JavaModelException { final IField fieldInType= type.getField(iField.getElementName()); if (!fieldInType.exists() || !iField.getTypeSignature().equals(fieldInType.getTypeSignature())) { return null; } final String[] keys= { JavaElementLabels.getTextLabel(fieldInType, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(type, JavaElementLabels.ALL_FULLY_QUALIFIED)}; final String msg= Messages.format(RefactoringCoreMessages.PullUpRefactoring_Field_declared_in_class, keys); final RefactoringStatusContext context= JavaStatusContext.create(fieldInType); return RefactoringStatus.createWarningStatus(msg, context); }
Source:
private void cleanupMountTable(Date cutoff) { List<Long> purgeInstanceIds = create() .select(INSTANCE.ID) .from(INSTANCE) .where(INSTANCE.STATE.eq("purged")) .fetch().into(Long.class); List<Long> localOrHostBindMountVolumeIds = create() .select(VOLUME.ID) .from(VOLUME) .where(VOLUME.DATA.like("%\"isHostPath\":true%")) .or(VOLUME.DATA.like("%\"driver\":\"local\"%")) .fetch().into(Long.class); ResultQuery<Record1<Long>> ids = create() .select(MOUNT.ID) .from(MOUNT) .where(MOUNT.INSTANCE_ID.in(purgeInstanceIds)) .and(MOUNT.VOLUME_ID.in(localOrHostBindMountVolumeIds)) .and(MOUNT.STATE.eq("inactive")); List<Long> toDelete = null; int rowsDeleted = 0; while ((toDelete = ids.fetch().into(Long.class)).size() > 0) { rowsDeleted += create().delete(MOUNT) .where(MOUNT.ID.in(toDelete)).execute(); } if (rowsDeleted > 0) { log.info("[Rows Deleted] mount={}", rowsDeleted); } }

Target:
private void cleanupMountTable(Date cutoff) { List<Long> purgeInstanceIds = create() .select(INSTANCE.ID) .from(INSTANCE) .where(INSTANCE.STATE.eq(CommonStatesConstants.PURGED)) .fetch().into(Long.class); List<Long> localOrHostBindMountVolumeIds = create() .select(VOLUME.ID) .from(VOLUME) .where(VOLUME.DATA.like("%\"isHostPath\":true%")) .or(VOLUME.DATA.like("%\"driver\":\"local\"%")) .fetch().into(Long.class); ResultQuery<Record1<Long>> ids = create() .select(MOUNT.ID) .from(MOUNT) .where(MOUNT.INSTANCE_ID.in(purgeInstanceIds)) .and(MOUNT.VOLUME_ID.in(localOrHostBindMountVolumeIds)) .and(MOUNT.STATE.eq("inactive")) .limit(QUERY_LIMIT_ROWS.getValue()); List<Long> toDelete = null; int rowsDeleted = 0; while ((toDelete = ids.fetch().into(Long.class)).size() > 0) { rowsDeleted += create().delete(MOUNT) .where(MOUNT.ID.in(toDelete)).execute(); } if (rowsDeleted > 0) { log.info("[Rows Deleted] mount={}", rowsDeleted); } }
Source:
public void visit(SystemStreamPartition systemStreamPartition, StartpointUpcoming startpointUpcoming) { TopicPartition topicPartition = toTopicPartition(systemStreamPartition); Collection<TopicPartition> topicPartitions = ImmutableList.of(topicPartition); LOG.info("Seeking the kafka consumer to the end offset for the topic partition: {}.", topicPartitions); kafkaConsumer.seekToEnd(topicPartitions); }

Target:
public void visit(SystemStreamPartition systemStreamPartition, StartpointUpcoming startpointUpcoming) { TopicPartition topicPartition = toTopicPartition(systemStreamPartition); Collection<TopicPartition> topicPartitions = ImmutableList.of(topicPartition); LOG.info("Seeking the kafka consumer to the end offset for the topic partition: {}.", topicPartitions); synchronized (kafkaConsumer) { kafkaConsumer.seekToEnd(topicPartitions); } }
Source:
public String internalException(String marker) { return "Huch? Warum funktioniert das nicht? Das war bestimmt dein Fehler!" + " Falls dies weiterhin vorkommt leite folgendes an [<LINK_0> @Tillerinobot] oder [<LINK_1> /u/Tillerino]weiter: "+ marker + "."; }

Target:
public String internalException(String marker) { return "Huch? Warum funktioniert das nicht? Das war bestimmt dein Fehler!" + " Falls dies weiterhin vorkommt, leite folgendes an [<LINK_0> @Tillerinobot] oder [<LINK_1> /u/Tillerino] weiter: "+ marker + "."; }
Source:
public GuidePostsInfo(long byteCount, ImmutableBytesWritable guidePosts, long rowCount, int maxLength, int guidePostsCount) { this.guidePosts = guidePosts; this.maxLength = maxLength; this.byteCount = byteCount; this.rowCount = rowCount; this.guidePostsCount = guidePostsCount; lastRow = ByteUtil.EMPTY_BYTE_ARRAY; }

Target:
public GuidePostsInfo(long byteCount, ImmutableBytesWritable guidePosts, long rowCount, int maxLength, int guidePostsCount) { this.guidePosts = new ImmutableBytesWritable(guidePosts); this.maxLength = maxLength; this.byteCount = byteCount; this.rowCount = rowCount; this.guidePostsCount = guidePostsCount; }
Source:
protected void executeVdsBrokerCommand() { status = getBroker().glusterMetaVolumeMount(); proceedProxyReturnValue(); }

Target:
protected void executeVdsBrokerCommand() { status = getBroker().glusterMetaVolumeMount(Config.<String> getValue(ConfigValues.GlusterMetaVolumeName)); proceedProxyReturnValue(); }
Source:
private void createDiskBasedOnLun() { final LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { StorageDomainCommandBase.proceedLUNInDb(lun, lun.getLunType()); getBaseDiskDao().save(getParameters().getDiskInfo()); getDiskLunMapDao().save(new DiskLunMap(getParameters().getDiskInfo().getId(), lun.getLUN_id())); if (getVm() != null) { boolean shouldPlugDisk = getVm().getStatus() == VMStatus.Down && (getParameters().getPlugDiskToVm() == null || getParameters().getPlugDiskToVm()); VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo().getId(), getVmId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK, null, shouldPlugDisk, Boolean.TRUE.equals(getParameters().getDiskInfo().getReadOnly()), null); } return null; } }); getReturnValue().setActionReturnValue(getParameters().getDiskInfo().getId()); plugDiskToVmIfNeeded(); setSucceeded(true); }

Target:
private void createDiskBasedOnLun() { final LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { StorageDomainCommandBase.proceedLUNInDb(lun, lun.getLunType()); getBaseDiskDao().save(getParameters().getDiskInfo()); getDiskLunMapDao().save(new DiskLunMap(getParameters().getDiskInfo().getId(), lun.getLUN_id())); if (getVm() != null) { VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo().getId(), getVmId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK, null, shouldDiskBePlugged(), Boolean.TRUE.equals(getParameters().getDiskInfo().getReadOnly()), null); } return null; } }); getReturnValue().setActionReturnValue(getParameters().getDiskInfo().getId()); plugDiskToVmIfNeeded(); setSucceeded(true); }
Source:
public @ResponseBody String availableInternalUnits(final @RequestParam(required = false, value = "term") String term, final Model model) { final JsonArray result = new JsonArray(); final String trimmedValue = term.trim(); final String[] input = StringNormalizer.normalize(trimmedValue).split(" "); final SapStructure sapStructure = new SapStructure(); final JsonObject sapInput = new JsonObject(); sapInput.addProperty("institution", SapSdkConfiguration.getConfiguration().sapServiceInstitutionCode()); for (final JsonElement pepElement : sapStructure.listSanitizedProjects(sapInput)) { final JsonObject pepObject = pepElement.getAsJsonObject(); final String pepUnitSapId = getString(pepObject, "unitSapId"); final JsonObject o = new JsonObject(); o.addProperty("id", pepUnitSapId); o.addProperty("name", pepUnitSapId); result.add(o); } return result.toString(); }

Target:
public @ResponseBody String availableInternalUnits(final @RequestParam(required = false, value = "term") String term, final Model model) { final JsonArray result = new JsonArray(); final String trimmedValue = term.trim(); final String[] input = StringNormalizer.normalize(trimmedValue).split(" "); final SapStructure sapStructure = new SapStructure(); final JsonObject sapInput = new JsonObject(); sapInput.addProperty("institution", SapSdkConfiguration.getConfiguration().sapServiceInstitutionCode()); for (final JsonElement pepElement : sapStructure.listSanitizedProjects(sapInput)) { final JsonObject pepObject = pepElement.getAsJsonObject(); final String pepUnitSapId = getString(pepObject, "unitSapId"); if (matches(input, pepUnitSapId)) { final JsonObject o = new JsonObject(); o.addProperty("id", pepUnitSapId); o.addProperty("name", pepUnitSapId); result.add(o); } } return result.toString(); }
Source:
public static String getSoundDevice(VmBase vm, Version compatibilityVersion) { final String OS_REGEX = "^.*%1s,([^,]*).*$"; final String DEFAULT_TYPE = "default"; String ret = DEFAULT_TYPE; if (vm.getvm_type() == VmType.Desktop) { String soundDeviceTypeConfig = Config.<String> GetValue( ConfigValues.DesktopAudioDeviceType); String vmOS = vm.getos().name(); Pattern regexPattern = Pattern.compile(String .format(OS_REGEX, vmOS)); Matcher regexMatcher = regexPattern.matcher(soundDeviceTypeConfig); if (regexMatcher.find()) { ret = regexMatcher.group(1); } else { regexPattern = Pattern.compile(String.format(OS_REGEX, DEFAULT_TYPE)); regexMatcher = regexPattern.matcher(soundDeviceTypeConfig); if (regexMatcher.find()) { ret = regexMatcher.group(1); } } } return ret; }

Target:
public static String getSoundDevice(VmBase vm, Version compatibilityVersion) { final String OS_REGEX = "^.*%1s,([^,]*).*$"; final String DEFAULT_TYPE = "default"; String ret = DEFAULT_TYPE; if (vm.getvm_type() == VmType.Desktop) { String soundDeviceTypeConfig = Config.<String> GetValue( ConfigValues.DesktopAudioDeviceType, compatibilityVersion.toString()); String vmOS = vm.getos().name(); Pattern regexPattern = Pattern.compile(String .format(OS_REGEX, vmOS)); Matcher regexMatcher = regexPattern.matcher(soundDeviceTypeConfig); if (regexMatcher.find()) { ret = regexMatcher.group(1); } else { regexPattern = Pattern.compile(String.format(OS_REGEX, DEFAULT_TYPE)); regexMatcher = regexPattern.matcher(soundDeviceTypeConfig); if (regexMatcher.find()) { ret = regexMatcher.group(1); } } } return ret; }
Source:
public void initialize() throws ParseException { final List<Row> rows = dataParser.get(); try { final List<Long> ids = dataIdFactory.getIds(rows.size()); workloadQuota.register(dataType, ids.get(0), ids.get(ids.size() - 1)); partitionTracker.registerPartition(dataType, ids.get(0), ids.get(ids.size() - 1)); memoryStore.getElasticStore().putList(dataType, ids, rows); } catch (final IdGenerationException e) { throw new RuntimeException(e); } }

Target:
public void initialize() throws ParseException { final List<Row> rows = dataParser.get(); try { final List<Long> ids = dataIdFactory.getIds(rows.size()); final Map<String, Set<LongRange>> workloadMap = new HashMap<>(); final Set<LongRange> rangeSet = new HashSet<>(); rangeSet.add(new LongRange(ids.get(0).longValue(), ids.size() - 1)); workloadMap.put(dataType, rangeSet); workloadPartition.initialize(workloadMap); partitionTracker.registerPartition(dataType, ids.get(0), ids.get(ids.size() - 1)); memoryStore.getElasticStore().putList(dataType, ids, rows); } catch (final IdGenerationException e) { throw new RuntimeException(e); } }
Source:
public Response startMonitor( @PathParam("id") int id, @QueryParam("clientId") String clientId, @DefaultValue("10") @QueryParam("updateInterval") int updateInterval) { currentTimestamp = System.currentTimeMillis(); Session session = GTFSDB.initSessionBeginTrans(); GtfsRtFeedModel gtfsRtFeed = (GtfsRtFeedModel) session.createQuery(" FROM GtfsRtFeedModel " + "WHERE rtFeedID = "+id).uniqueResult(); SessionModel feedSession = null; List<SessionModel> sessionModelList = (List<SessionModel>) session.createQuery( " select sm FROM SessionModel sm inner join sm.gtfsRtFeedModel as gm " + " WHERE gm.gtfsRtId = " + id + " AND sm.sessionStartTime > " + (currentTimestamp - (15 * 60 * 1000)) + " ORDER BY sm.sessionStartTime DESC").list(); if(sessionModelList != null && sessionModelList.size() > 0) { feedSession = sessionModelList.get(0); } SessionModel sessionModel = new SessionModel(); sessionModel.setClientId(clientId); sessionModel.setSessionStartTime(currentTimestamp); sessionModel.setGtfsRtFeedModel(gtfsRtFeed); session.save(sessionModel); GTFSDB.commitAndCloseSession(session); if(feedSession == null) { _log.info("No feed session, starting new one!"); startBackgroundTask(gtfsRtFeed, updateInterval); } else{ _log.info("Feed session found!"); } return Response.ok(sessionModel, MediaType.APPLICATION_JSON).build(); }

Target:
public Response startMonitor( @PathParam("id") int id, @QueryParam("clientId") String clientId, @DefaultValue("10") @QueryParam("updateInterval") int updateInterval) { currentTimestamp = System.currentTimeMillis(); Session session = GTFSDB.initSessionBeginTrans(); GtfsRtFeedModel gtfsRtFeed = (GtfsRtFeedModel) session.createQuery(" FROM GtfsRtFeedModel " + "WHERE rtFeedID = "+id).uniqueResult(); SessionModel sessionModel = new SessionModel(); sessionModel.setClientId(clientId); sessionModel.setSessionStartTime(currentTimestamp); sessionModel.setGtfsRtFeedModel(gtfsRtFeed); session.save(sessionModel); GTFSDB.commitAndCloseSession(session); startBackgroundTask(gtfsRtFeed, updateInterval); return Response.ok(sessionModel, MediaType.APPLICATION_JSON).build(); }
Source:
public Block readBlock(Type type) throws IOException { if (!rowGroupOpen) { openRowGroup(); } if (readOffset > 0) { if (presentStream != null) { readOffset = presentStream.countBitsSet(readOffset); } for (StreamReader structField : structFields) { structField.prepareNextRead(readOffset); } } List<Type> typeParameters = type.getTypeParameters(); boolean[] nullVector = new boolean[nextBatchSize]; Block[] blocks = new Block[typeParameters.size()]; if (presentStream == null) { for (int i = 0; i < typeParameters.size(); i++) { if (i < structFields.length) { StreamReader structField = structFields[i]; structField.prepareNextRead(nextBatchSize); blocks[i] = structField.readBlock(typeParameters.get(i)); } else { blocks[i] = getNullBlock(typeParameters.get(i)); } } } else { int nullValues = presentStream.getUnsetBits(nextBatchSize, nullVector); if (nullValues != nextBatchSize) { for (int i = 0; i < typeParameters.size(); i++) { if (i < structFields.length) { StreamReader structField = structFields[i]; structField.prepareNextRead(nextBatchSize - nullValues); blocks[i] = structField.readBlock(typeParameters.get(i)); } else { blocks[i] = getNullBlock(typeParameters.get(i)); } } } else { for (int i = 0; i < typeParameters.size(); i++) { blocks[i] = typeParameters.get(i).createBlockBuilder(null, 0).build(); } } } Block rowBlock = RowBlock.fromFieldBlocks(nullVector, blocks); readOffset = 0; nextBatchSize = 0; return rowBlock; }

Target:
public Block readBlock(Type type) throws IOException { if (!rowGroupOpen) { openRowGroup(); } if (readOffset > 0) { if (presentStream != null) { readOffset = presentStream.countBitsSet(readOffset); } for (StreamReader structField : structFields) { structField.prepareNextRead(readOffset); } } List<Type> typeParameters = type.getTypeParameters(); boolean[] nullVector = new boolean[nextBatchSize]; Block[] blocks = new Block[typeParameters.size()]; if (presentStream == null) { for (int i = 0; i < typeParameters.size(); i++) { if (i < structFields.length) { StreamReader structField = structFields[i]; structField.prepareNextRead(nextBatchSize); blocks[i] = structField.readBlock(typeParameters.get(i)); } else { blocks[i] = getNullBlock(typeParameters.get(i), nextBatchSize); } } } else { int nullValues = presentStream.getUnsetBits(nextBatchSize, nullVector); if (nullValues != nextBatchSize) { for (int i = 0; i < typeParameters.size(); i++) { if (i < structFields.length) { StreamReader structField = structFields[i]; structField.prepareNextRead(nextBatchSize - nullValues); blocks[i] = structField.readBlock(typeParameters.get(i)); } else { blocks[i] = getNullBlock(typeParameters.get(i), nextBatchSize - nullValues); } } } else { for (int i = 0; i < typeParameters.size(); i++) { blocks[i] = typeParameters.get(i).createBlockBuilder(null, 0).build(); } } } verify(Arrays.stream(blocks) .mapToInt(Block::getPositionCount) .distinct() .count() == 1); Block rowBlock = RowBlock.fromFieldBlocks(nullVector, blocks); readOffset = 0; nextBatchSize = 0; return rowBlock; }
Source:
public AbstractFileResolvingResource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; Boolean included = request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null; if (included != null && included.booleanValue()) { servletPath = (String) request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String) request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext = URIUtil.addPaths(servletPath, pathInfo); return getResource(pathInContext); }

Target:
public AbstractFileResolvingResource getResource(HttpServletRequest request) throws MalformedURLException { String servletPath; String pathInfo; boolean included = request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null; if (included) { servletPath = (String) request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH); pathInfo = (String) request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO); if (servletPath == null && pathInfo == null) { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } } else { servletPath = request.getServletPath(); pathInfo = request.getPathInfo(); } String pathInContext = URIUtil.addPaths(servletPath, pathInfo); return getResource(pathInContext); }
Source:
public static VdcReturnValueBase evaluateCorrelationId(VdcActionParametersBase parameters) { VdcReturnValueBase returnValue = null; String correlationId = parameters.getCorrelationId(); if (StringUtils.isEmpty(correlationId)) { correlationId = CorrelationIdTracker.getCorrelationId(); if (StringUtils.isEmpty(correlationId)) { correlationId = LoggedUtils.getObjectId(parameters); } parameters.setCorrelationId(correlationId); } else { List<Class<?>> validationGroups = Arrays.asList(new Class<?>[] { PreRun.class }); List<String> messages = ValidationUtils.validateInputs(validationGroups, parameters); if (!messages.isEmpty()) { VdcReturnValueBase returnErrorValue = new VdcReturnValueBase(); returnErrorValue.setValid(false); returnErrorValue.getValidationMessages().addAll(messages); return returnErrorValue; } } return returnValue; }

Target:
public static VdcReturnValueBase evaluateCorrelationId(VdcActionParametersBase parameters) { VdcReturnValueBase returnValue = null; String correlationId = parameters.getCorrelationId(); if (StringUtils.isEmpty(correlationId)) { correlationId = CorrelationIdTracker.getCorrelationId(); if (StringUtils.isEmpty(correlationId)) { correlationId = LoggedUtils.getObjectId(parameters); } parameters.setCorrelationId(correlationId); } else { List<String> messages = ValidationUtils.validateInputs(validationGroups, parameters); if (!messages.isEmpty()) { VdcReturnValueBase returnErrorValue = new VdcReturnValueBase(); returnErrorValue.setValid(false); returnErrorValue.getValidationMessages().addAll(messages); return returnErrorValue; } } return returnValue; }
Source:
public final void indexingProgress(IndexingProgressStats stats) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { final String cqueryStatusFieldId = "org.eclipse.lsp4e.cpp.status"; final int width = 28; StatusLineContributionItem cqueryStatusField; IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow window : workbenchWindows) { StatusLineManager statusLine = ((WorkbenchWindow) window).getStatusLineManager(); if (statusLine.find(cqueryStatusFieldId) != null) { cqueryStatusField = (StatusLineContributionItem) statusLine.find(cqueryStatusFieldId); } else { cqueryStatusField = new StatusLineContributionItem(cqueryStatusFieldId, width); statusLine.add(cqueryStatusField); } String msg = stats.getTotalJobs() > 0 ? NLS.bind(Messages.CqueryStateBusy, stats.getTotalJobs()) : Messages.CqueryStateIdle; cqueryStatusField.setText(msg); } } }); }

Target:
public final void indexingProgress(IndexingProgressStats stats) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { final String cqueryStatusFieldId = "org.eclipse.lsp4e.cpp.status"; final int width = 28; IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow window : workbenchWindows) { StatusLineManager statusLine = ((WorkbenchWindow) window).getStatusLineManager(); StatusLineContributionItem cqueryStatusField = (StatusLineContributionItem) statusLine.find(cqueryStatusFieldId); if (cqueryStatusField == null) { cqueryStatusField = new StatusLineContributionItem(cqueryStatusFieldId, width); statusLine.add(cqueryStatusField); } String msg = stats.getTotalJobs() > 0 ? NLS.bind(Messages.CqueryStateBusy, stats.getTotalJobs()) : Messages.CqueryStateIdle; cqueryStatusField.setText(msg); } } }); }
Source:
private String getDayCharacters(String label) { int labelCPCount = label.codePointCount(0, label.length()); return label.substring(labelCPCount - 2, labelCPCount); }

Target:
private String getDayCharacters(String label) { return label.substring(label.length() - 2); }
Source:
public void testNoLocsSymlink() throws Exception { final File metricsFile = File.createTempFile("dual.", ".metrics"); metricsFile.deleteOnExit(); final String[] args = new String[]{ "BASECALLS_DIR=" + noSymlink.getAbsolutePath(), "LANE=" + 1, "METRICS_FILE=" + metricsFile.getPath(), "READ_STRUCTURE=" + "25T8B8B25T", "BARCODE=" + "CAATAGTCCGACTCTC" }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<ExtractIlluminaBarcodes.BarcodeMetric, Integer> result = new MetricsFile<ExtractIlluminaBarcodes.BarcodeMetric, Integer>(); result.read(new FileReader(metricsFile)); Assert.assertEquals(result.getMetrics().get(0).PERFECT_MATCHES, 2, "Got wrong number of perfect matches"); Assert.assertEquals(result.getMetrics().get(0).ONE_MISMATCH_MATCHES, 0, "Got wrong number of one-mismatch matches"); }

Target:
public void testNoLocsSymlink() throws Exception { final File metricsFile = File.createTempFile("dual.", ".metrics"); metricsFile.deleteOnExit(); final String[] args = new String[]{ "BASECALLS_DIR=" + noSymlink.getAbsolutePath(), "LANE=" + 1, "METRICS_FILE=" + metricsFile, "READ_STRUCTURE=" + "25T8B8B25T", "BARCODE=" + "CAATAGTCCGACTCTC" }; Assert.assertEquals(runPicardCommandLine(args), 0); final MetricsFile<ExtractIlluminaBarcodes.BarcodeMetric, Integer> result = new MetricsFile<>(); result.read(new FileReader(metricsFile)); Assert.assertEquals(result.getMetrics().get(0).PERFECT_MATCHES, 2, "Got wrong number of perfect matches"); Assert.assertEquals(result.getMetrics().get(0).ONE_MISMATCH_MATCHES, 0, "Got wrong number of one-mismatch matches"); }
Source:
public synchronized void acquireBuffer(boolean metadata) { if (serializedCache != null) { if (metadata) { serializedCache.buffer.resetReaderIndex(); serializedCache.buffer.writerIndex(serializedCache.metadataOffset); doSerializeMetadataInternal(serializedCache.buffer); } serializedCache.buffer.retain(); return; } ByteBuf buf = Unpooled.buffer(); if (metadata) { int metadataOffset = doSerializeInternal(buf); serializedCache = new SerializedCache(buf, metadataOffset); } else { doSerializePayloadInternal(buf); serializedCache = new SerializedCache(buf, buf.writerIndex()); } }

Target:
public synchronized void acquireBuffer(boolean metadata) { if (serializedCache == null) { acquireBufferInternal(metadata); } else { if (metadata) { serializedCache.buffer.resetReaderIndex(); serializedCache.buffer.writerIndex(serializedCache.metadataOffset); doSerializeMetadataInternal(serializedCache.buffer); } serializedCache.buffer.retain(); } }
Source:
public List<Query> getQueries() { return _queries; }

Target:
public ImmutableList<Query> getQueries() { return _queries; }
Source:
private List<SegmentDescriptor> getMissingSegments(final ResponseContext context) { final Object maybeMissingSegments = context.get(ResponseContext.CTX_MISSING_SEGMENTS_KEY); if (maybeMissingSegments == null) { return new ArrayList<>(); } return jsonMapper.convertValue( maybeMissingSegments, new TypeReference<List<SegmentDescriptor>>() { } ); }

Target:
private List<SegmentDescriptor> getMissingSegments(final ResponseContext context) { final Object maybeMissingSegments = context.get(ResponseContext.CTX_MISSING_SEGMENTS); if (maybeMissingSegments == null) { return new ArrayList<>(); } return jsonMapper.convertValue( maybeMissingSegments, new TypeReference<List<SegmentDescriptor>>() { } ); }
Source:
default Iterator<T> dropWhile(Predicate<? super T> predicate) { Objects.requireNonNull(predicate, "predicate is null"); if (!hasNext()) { return empty(); } else { final Iterator<T> that = this; return new AbstractIterator<T>() { private T next; private boolean cached = false; private boolean test = true; @Override public boolean hasNext() { if (cached) { return true; } else if (test) { test = false; while (that.hasNext()) { next = that.next(); if (!predicate.test(next)) { cached = true; return true; } } return false; } else if (that.hasNext()) { next = that.next(); cached = true; return true; } else { return false; } } @Override public T getNext() { cached = false; return next; } }; } }

Target:
default Iterator<T> dropWhile(Predicate<? super T> predicate) { Objects.requireNonNull(predicate, "predicate is null"); if (!hasNext()) { return empty(); } else { final Iterator<T> that = this; return new AbstractIterator<T>() { private T next; private boolean cached = false; private boolean first = true; @Override public boolean hasNext() { if (cached) { return true; } else if (first) { first = false; while (that.hasNext()) { next = that.next(); if (!predicate.test(next)) { cached = true; return true; } } return false; } else if (that.hasNext()) { next = that.next(); cached = true; return true; } else { return false; } } @Override public T getNext() { cached = false; return next; } }; } }
Source:
public SiteTasker take() throws InterruptedException { SiteTasker task = m_tasks.poll(); if (task == null) { m_starvationTracker.beginStarvation(); } else { m_queueDepthTracker.pollUpdate(task.getTimestamp()); return task; } try { task = CoreUtils.queueSpinTake(m_tasks); if (task != null) { m_queueDepthTracker.pollUpdate(task.getTimestamp()); } return task; } finally { m_starvationTracker.endStarvation(); } }

Target:
public SiteTasker take() throws InterruptedException { SiteTasker task = m_tasks.poll(); if (task == null) { m_starvationTracker.beginStarvation(); } else { m_queueDepthTracker.pollUpdate(task.getQueueOfferTime()); return task; } try { task = CoreUtils.queueSpinTake(m_tasks); m_queueDepthTracker.pollUpdate(task.getQueueOfferTime()); return task; } finally { m_starvationTracker.endStarvation(); } }