auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private AttributeType extractAttributeTypeFromJsonValue(JsonValue value) { if (value.isNumber()) { try { value.asLong(); return AttributeType.LONG; } catch (NumberFormatException e) { return AttributeType.DOUBLE; } } else if (value.isBoolean()) { return AttributeType.BOOLEAN; } else if (value.isString()) { return AttributeType.STRING; } throw new HazelcastSerializationException("Unknown Json type: " + value); }

Target:
private AttributeType extractAttributeTypeFromJsonValue(JsonValue value) { if (value.isNumber()) { if (value.toString().contains(".")) { return AttributeType.DOUBLE; } else { return AttributeType.LONG; } } else if (value.isBoolean()) { return AttributeType.BOOLEAN; } else if (value.isString()) { return AttributeType.STRING; } throw new HazelcastSerializationException("Unknown Json type: " + value); }
Source:
public void validateEnums(StorageDomain storageDomain) { if (storageDomain != null) { if (storageDomain.isSetType()) { validateEnum(StorageDomainType.class, storageDomain.getType(), true); } if (storageDomain.isSetStorage() && storageDomain.getStorage().isSetType()) { validateEnum(StorageType.class, storageDomain.getStorage().getType(), true); } if (storageDomain.isSetFormat()) { validateEnum(StorageFormat.class, storageDomain.getStorageFormat(), true); } if (storageDomain.isSetStorage() && storageDomain.getStorage().isSetNfsVersion()) { validateEnum(NfsVersion.class, storageDomain.getStorage().getNfsVersion(), true); } if (storageDomain.isSetExternalStatus()) { validateEnum(EntityExternalStatus.class, storageDomain.getExternalStatus().getState().toUpperCase()); } } }

Target:
public void validateEnums(StorageDomain storageDomain) { if (storageDomain != null) { if (storageDomain.isSetType()) { validateEnum(StorageDomainType.class, storageDomain.getType(), true); } if (storageDomain.isSetStorage() && storageDomain.getStorage().isSetType()) { validateEnum(StorageType.class, storageDomain.getStorage().getType(), true); } if (storageDomain.isSetFormat()) { validateEnum(StorageFormat.class, storageDomain.getStorageFormat(), true); } if (storageDomain.isSetStorage() && storageDomain.getStorage().isSetNfsVersion()) { validateEnum(NfsVersion.class, storageDomain.getStorage().getNfsVersion(), true); } if (storageDomain.isSetExternalStatus() && storageDomain.getExternalStatus().getState() != null) { validateEnum(EntityExternalStatus.class, storageDomain.getExternalStatus().getState().toUpperCase()); } } }
Source:
public void testDeserializeFileMessage() throws Exception { File tempFile = getTempTestFile(); Messenger messenger = new Messenger(File.createTempFile("test", "").getParentFile()); FileMessage testMessage = new FileMessage(); testMessage.setFilePath(tempFile.getCanonicalPath()); InputStream is = simulateSendAndReceive(testMessage); assertTrue(messenger.deserializeMessage(is)); IMessage message = messenger.getReceivedMessages().get(0); assertNotNull(message); assertTrue(message instanceof FileMessage); assertFalse(tempFile.getCanonicalPath().equals(((FileMessage)message).getFilePath())); assertFileEquals(tempFile, new File(((FileMessage)message).getFilePath())); assertEquals(0, is.available()); }

Target:
public void testDeserializeFileMessage() throws Exception { File tempFile = MessageTestUtil.getTempTestFile(20); Messenger messenger = new Messenger(File.createTempFile("test", "").getParentFile()); FileMessage testMessage = new FileMessage(); testMessage.setFilePath(tempFile.getCanonicalPath()); int packetSize = 1024; List<PacketFormat> packets = simulateSendAndReceive(testMessage, packetSize); boolean received = false; for (PacketFormat packet : packets) { assertFalse(received); InputBuffer buffer = new InputBuffer(); packet.serialize(buffer); received = messenger.deserializeMessage(buffer.getInputStream()); } assertTrue(received); IMessage message = messenger.getReceivedMessages().get(0); assertNotNull(message); assertTrue(message instanceof FileMessage); assertFalse(tempFile.getCanonicalPath().equals(((FileMessage)message).getFilePath())); CustomAssert.assertChecksumsMatch(tempFile.getCanonicalPath(), ((FileMessage)message).getFilePath()); }
Source:
public PersistentResource getRelation(String relation, String id) { Optional<FilterExpression> filterExpression; boolean skipNew = false; Class<?> entityType = dictionary.getParameterizedType(getResourceClass(), relation); if (requestScope.isMutatingMultipleEntities() && requestScope.getObjectById(dictionary.getJsonAliasFor(entityType), id) != null) { if (!this.checkRelation(relation)) { throw new ForbiddenAccessException("oops"); } Object entity = requestScope.getObjectById(dictionary.getJsonAliasFor(entityType), id); PersistentResource resource = requestScope.getNewPersistentResources().stream() .filter(r -> r.getObject() == entity).findFirst().orElse(null); resource.checkFieldAwarePermissions(ReadPermission.class); return resource; } else { if (entityType == null) { throw new InvalidAttributeException(relation, type); } Class<?> idType = dictionary.getIdType(entityType); Object idVal = CoerceUtil.coerce(id, idType); String idField = dictionary.getIdFieldName(entityType); filterExpression = Optional.of(new FilterPredicate( new FilterPredicate.PathElement( entityType, relation, idType, idField), Operator.IN, Collections.singletonList(idVal))); } Set<PersistentResource> resources = filter(ReadPermission.class, (Set) getRelationChecked(relation, filterExpression), skipNew); for (PersistentResource childResource : resources) { if (childResource.matchesId(id)) { return childResource; } } throw new InvalidObjectIdentifierException(id, relation); }

Target:
public PersistentResource getRelation(String relation, String id) { Optional<FilterExpression> filterExpression; boolean skipNew = false; Class<?> entityType = dictionary.getParameterizedType(getResourceClass(), relation); if (requestScope.isMutatingMultipleEntities() && requestScope.getObjectById(dictionary.getJsonAliasFor(entityType), id) != null) { filterExpression = Optional.empty(); skipNew = true; } else { if (entityType == null) { throw new InvalidAttributeException(relation, type); } Class<?> idType = dictionary.getIdType(entityType); Object idVal = CoerceUtil.coerce(id, idType); String idField = dictionary.getIdFieldName(entityType); filterExpression = Optional.of(new FilterPredicate( new FilterPredicate.PathElement( entityType, relation, idType, idField), Operator.IN, Collections.singletonList(idVal))); } Set<PersistentResource> resources = filter(ReadPermission.class, (Set) getRelationChecked(relation, filterExpression), skipNew); for (PersistentResource childResource : resources) { if (childResource.matchesId(id)) { return childResource; } } throw new InvalidObjectIdentifierException(id, relation); }
Source:
public Encounter createEncounter(String configName, DateTime encounterDatetime, String encounterType, String locationName, String patientUuid, String providerUuid, String visitUuid, String formUuid, Map<String, String> observations) { Location location = getLocationByName(configName, locationName); Patient patient = patientService.getPatientByUuid(configName, patientUuid); Provider provider = providerService.getProviderByUuid(configName, providerUuid); Form form = formService.getFormByUuid(configName, formUuid); Visit visit = null; if (StringUtils.isNotEmpty(visitUuid)) { visit = visitService.getVisitByUuid(configName, visitUuid); } List<Observation> observationList = MapUtils.isNotEmpty(observations) ? convertObservationMapToList(observations, encounterDatetime) : null; EncounterType type = new EncounterType(encounterType); Encounter encounter = new Encounter(location, type, encounterDatetime.toDate(), patient, visit, Collections.singletonList(provider.getPerson()), observationList, form); return encounterService.createEncounter(configName, encounter); }

Target:
public Encounter createEncounter(String configName, DateTime encounterDatetime, String encounterType, String locationName, String patientUuid, String providerUuid, String visitUuid, String formUuid, Map<String, String> observations) { Location location = getLocationByName(configName, locationName); Patient patient = patientService.getPatientByUuid(configName, patientUuid); Provider provider = providerService.getProviderByUuid(configName, providerUuid); Visit visit = null; Form form = null; if (StringUtils.isNotEmpty(visitUuid)) { visit = visitService.getVisitByUuid(configName, visitUuid); } if (StringUtils.isNotEmpty(formUuid)) { form = formService.getFormByUuid(configName, formUuid); } List<Observation> observationList = MapUtils.isNotEmpty(observations) ? convertObservationMapToList(observations, encounterDatetime) : null; EncounterType type = new EncounterType(encounterType); Encounter encounter = new Encounter(location, type, encounterDatetime.toDate(), patient, visit, Collections.singletonList(provider.getPerson()), observationList, form); return encounterService.createEncounter(configName, encounter); }
Source:
public OutputColumns getOutputColumns() { if (lookUpEveryToken) { return new OutputColumns( new String[] { column.getName() + " (synonyms replaced)", column.getName() + " (synonyms found)", column.getName() + " (master terms found)" }, new Class[] { String.class, List.class, List.class }); } else { return new OutputColumns(String.class, new String[] { column.getName() + " (synonyms replaced)" }); } }

Target:
public OutputColumns getOutputColumns() { if (lookUpEveryToken) { final Class[] columnTypes; if( replacedSynonymsType == ReplacedSynonymsType.STRING) { columnTypes = new Class[] { String.class, String.class, String.class }; } else { columnTypes = new Class[] { String.class, List.class, List.class }; } return new OutputColumns( new String[] { column.getName() + " (synonyms replaced)", column.getName() + " (synonyms found)", column.getName() + " (master terms found)" }, columnTypes); } else { return new OutputColumns(String.class, new String[] { column.getName() + " (synonyms replaced)" }); } }
Source:
GarrukSavageHeraldEffect() { super(Outcome.Detriment); staticText = "reveal the top card of your library. If it's a creature card, " + "put it into your hand. Otherwise, put it on the bottom of your library"; }

Target:
GarrukSavageHeraldEffect() { super(Outcome.Benefit); staticText = "reveal the top card of your library. If it's a creature card, " + "put it into your hand. Otherwise, put it on the bottom of your library"; }
Source:
public void addSetter(String fieldName) { try { Field f = clazz.getDeclaredField(fieldName); FixedWidthParser.TypeInfo t = new FixedWidthParser.TypeInfo(f.getName(), ClassUtils.primitiveToWrapper(f.getType())); t.setter = PojoUtils.createSetter(clazz, t.name, t.type); setters.add(t); } catch (NoSuchFieldException e) { throw new RuntimeException("Field " + fieldName + " not found in class " + clazz, e); } catch (Exception e) { throw e; } }

Target:
private void addSetter(String fieldName) { try { Field f = clazz.getDeclaredField(fieldName); FixedWidthParser.TypeInfo t = new FixedWidthParser.TypeInfo(f.getName(), ClassUtils.primitiveToWrapper(f.getType())); t.setter = PojoUtils.createSetter(clazz, t.name, t.type); setters.add(t); } catch (NoSuchFieldException e) { throw new RuntimeException("Field " + fieldName + " not found in class " + clazz, e); } catch (Exception e) { throw new RuntimeException("Exception while adding a setter" + e.getMessage(), e); } }
Source:
private Iterator<Map.Entry<Cell, Value>> getRowColumnRangePostFiltered( TableReference tableRef, RowColumnRangeIterator iterator, int batchHint) { return Iterators.concat(Iterators.transform(Iterators.partition(iterator, batchHint), batch -> { Map<Cell, Value> raw = new LinkedHashMap<>(); batch.forEach(entry -> raw.put(entry.getKey(), entry.getValue())); validatePreCommitRequirementsOnReadIfNecessary(tableRef, getStartTimestamp()); if (raw.isEmpty()) { return Collections.emptyIterator(); } return getWithPostFilteringSync( tableRef, raw, x -> x).iterator(); })); }

Target:
private Iterator<Map.Entry<Cell, Value>> getRowColumnRangePostFiltered( TableReference tableRef, RowColumnRangeIterator iterator, int batchHint) { return Iterators.concat(Iterators.transform(Iterators.partition(iterator, batchHint), batch -> { ImmutableMap.Builder<Cell, Value> rawBuilder = ImmutableMap.builder(); batch.forEach(rawBuilder::put); Map<Cell, Value> raw = rawBuilder.build(); validatePreCommitRequirementsOnReadIfNecessary(tableRef, getStartTimestamp()); if (raw.isEmpty()) { return Collections.emptyIterator(); } SortedMap<Cell, Value> postFiltered = ImmutableSortedMap.copyOf( getWithPostFilteringSync( tableRef, raw, x -> x), preserveInputRowOrder(batch)); return postFiltered.entrySet().iterator(); })); }
Source:
public void handleLightMeasurementDeviceTransition(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final EventMessageDataContainer eventMessageDataContainer) { final Event event = eventMessageDataContainer.getEvents().get(0); if (event == null) { LOGGER.error("No event received for light measurement device: {}", deviceIdentification); return; } LightMeasurementDevice lmd = this.lightMeasurementDeviceRepository .findByDeviceIdentification(deviceIdentification); if (lmd == null) { LOGGER.error("No light measurement device found: {}", deviceIdentification); return; } lmd = this.updateLmdLastCommunicationTime(lmd); if (this.isDuplicateEvent(event, lmd)) { LOGGER.info("Duplicate event detected for light measurement device: {}. Event[id:{} {}]", lmd.getDeviceIdentification(), event.getId(), event.getDateTime(), event.getDescription(), event.getEventType(), event.getIndex()); return; } final CdmaRun cdmaRun = this.getCdmaDevicesPerMastSegment(lmd); final TransitionType transitionType = this.determineTransitionTypeForEvent(event); this.setTransitionService.transitionCdmaRun(cdmaRun, organisationIdentification, correlationUid, transitionType); }

Target:
public void handleLightMeasurementDeviceTransition(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final EventMessageDataContainer eventMessageDataContainer) { final Event event = eventMessageDataContainer.getEvents().get(0); if (event == null) { LOGGER.error("No event received for light measurement device: {}", deviceIdentification); return; } LightMeasurementDevice lmd = this.lightMeasurementDeviceRepository .findByDeviceIdentification(deviceIdentification); if (lmd == null) { LOGGER.error("No light measurement device found: {}", deviceIdentification); return; } lmd = this.updateLmdLastCommunicationTime(lmd); if (this.isDuplicateEvent(event, lmd)) { LOGGER.info("Duplicate event detected for light measurement device: {}. Event[id:{} {}]", lmd.getDeviceIdentification(), event.getId(), event.getDateTime(), event.getDescription(), event.getEventType(), event.getIndex()); return; } final CdmaRun cdmaRun = this.getCdmaDevicesPerMastSegment(lmd); final TransitionType transitionType = this.determineTransitionTypeForEvent(event); this.setTransitionService.setTransitionForCdmaRun(cdmaRun, organisationIdentification, correlationUid, transitionType); }
Source:
private String getOwner(PublicKeyHash writer) { int writerId = getWriterId(writer); try (PreparedStatement search = conn.prepareStatement("SELECT user_id FROM writerusage WHERE writer_id = ?;")) { search.setInt(1, writerId); ResultSet resultSet = search.executeQuery(); resultSet.next(); int userId = resultSet.getInt(1); try (PreparedStatement usersearch = conn.prepareStatement("SELECT name FROM users WHERE id = ?;")) { usersearch.setInt(1, userId); ResultSet userRes = usersearch.executeQuery(); userRes.next(); return userRes.getString(1); } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } }

Target:
private String getOwner(PublicKeyHash writer) { int writerId = getWriterId(writer); try (Connection conn = getConnection(); PreparedStatement search = conn.prepareStatement("SELECT u.name FROM users u, writerusage wu WHERE u.id = wu.user_id AND wu.writer_id = ?;")) { search.setInt(1, writerId); ResultSet resultSet = search.executeQuery(); resultSet.next(); return resultSet.getString(1); } catch (SQLException sqe) { LOG.log(Level.WARNING, sqe.getMessage(), sqe); throw new RuntimeException(sqe); } }
Source:
public void install(ISourceViewer viewer, AnnotationPainter painter) { Assert.isNotNull(viewer); Assert.isNotNull(painter); fViewer= viewer; fPainter= painter; initPainter(); StyledText text= fViewer.getTextWidget(); if (text == null || text.isDisposed()) { return; } updateStylesWidth= new UpdateStylesWidth(); ((ITextViewerExtension4) fViewer).addTextPresentationListener(updateStylesWidth); visibleLines= new VisibleLines(); fViewer.addViewportListener(visibleLines); text.addMouseListener(fMouseTracker); text.addMouseTrackListener(fMouseTracker); text.addMouseMoveListener(fMouseTracker); text.setLineSpacingProvider(this); setColor(text.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)); }

Target:
public void install(ISourceViewer viewer, AnnotationPainter painter) { Assert.isNotNull(viewer); Assert.isNotNull(painter); fViewer= viewer; fPainter= painter; initPainter(); StyledText text= fViewer.getTextWidget(); if (text == null || text.isDisposed()) { return; } if (fViewer instanceof ITextViewerExtension4) { updateStylesWidth= new UpdateStylesWidth(); ((ITextViewerExtension4) fViewer).addTextPresentationListener(updateStylesWidth); } visibleLines= new VisibleLines(); fViewer.addViewportListener(visibleLines); text.addMouseListener(fMouseTracker); text.addMouseTrackListener(fMouseTracker); text.addMouseMoveListener(fMouseTracker); text.setLineSpacingProvider(this); setColor(text.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)); }
Source:
private boolean isValid(TransactionWrite write, AdvancedCache<byte[], byte[]> readCache) { if (write.skipRead()) { if (isTrace) { log.tracef("Operation %s wasn't read.", write); } return true; } CacheEntry<byte[], byte[]> entry = readCache.getCacheEntry(write.key); if (write.wasNonExisting()) { if (isTrace) { log.tracef("Key didn't exist for operation %s. Entry is %s", write, entry); } return entry == null; } if (isTrace) { log.tracef("Checking version for operation %s. Entry is %s", write, entry); } return entry != null && write.versionRead == extractVersion(entry.getMetadata().version()); }

Target:
private boolean isValid(TransactionWrite write, AdvancedCache<byte[], byte[]> readCache) { if (write.skipRead()) { if (isTrace) { log.tracef("Operation %s wasn't read.", write); } return true; } CacheEntry<byte[], byte[]> entry = readCache.getCacheEntry(write.key); if (write.wasNonExisting()) { if (isTrace) { log.tracef("Key didn't exist for operation %s. Entry is %s", write, entry); } return entry == null || entry.getValue() == null; } if (isTrace) { log.tracef("Checking version for operation %s. Entry is %s", write, entry); } return entry != null && write.versionRead == extractVersion(entry.getMetadata().version()); }
Source:
public boolean waitForLocks(WaitForLocksRequest request) { LockRequest legacyRequest = toLegacyWaitForLocksRequest(request.getLockDescriptors()); lockAnonymous(legacyRequest); return true; }

Target:
public WaitForLocksResponse waitForLocks(WaitForLocksRequest request) { LockRequest legacyRequest = toLegacyWaitForLocksRequest(request.getLockDescriptors()); lockAnonymous(legacyRequest); return WaitForLocksResponse.successful(); }
Source:
private void cleanupLeftoverTasks() throws TaskException { List<TaskInfo> allTasks = this.getAllTasks(); List<String> deletedTasks = new ArrayList<>(); String taskName = ""; for (TaskInfo taskInfo : allTasks) { taskName = taskInfo.getName(); if (!newlyRegisteredTasks.contains(taskName)) { deleteTask(taskName); deletedTasks.add(taskName); } } if (!deletedTasks.isEmpty()) { log.info("Deleted " + deletedTasks.size() + " leftover tasks " + deletedTasks); } }

Target:
private void cleanupLeftoverTasks() throws TaskException { List<TaskInfo> allTasks = this.getAllTasks(); List<String> deletedTasks = new ArrayList<>(); String taskName; for (TaskInfo taskInfo : allTasks) { taskName = taskInfo.getName(); if (!newlyRegisteredTasks.contains(taskName)) { deleteTask(taskName); deletedTasks.add(taskName); } } if (!deletedTasks.isEmpty()) { for (String deletedTask : deletedTasks) { log.info("Deleted leftover task: " + deletedTask); } } }
Source:
public void visitLineNumber(int line, Label start) { _lineNumber = line; }

Target:
public void visitLineNumber(int line, Label start) { if (_lineNumber == -1) { _lineNumber = line; } }
Source:
private void fillTreeItemWithGitDirectory(RepositoryMapping m, TreeItem treeItem, IPath gitDir, boolean isAlternative) { if (m.getGitDir() == null) treeItem.setText(2, UIText.ExistingOrNewPage_SymbolicValueEmptyMapping); else { IPath relativePath = new Path(m.getGitDir()); if (isAlternative) { IPath withoutLastSegment = relativePath.removeLastSegments(1); IPath path; if (withoutLastSegment.isEmpty()) path = Path.fromPortableString("."); else path = withoutLastSegment; treeItem.setText(0, path.toString()); } treeItem.setText(2, relativePath.toOSString()); Repository repo = null; try { IProject project = m.getContainer().getProject(); repo = new RepositoryBuilder() .setGitDir(gitDir.toFile()).build(); File workTree = repo.getWorkTree(); IPath workTreePath = Path.fromOSString(workTree .getAbsolutePath()); if (workTreePath.isPrefixOf(project.getLocation())) { IPath makeRelativeTo = project.getLocation() .makeRelativeTo(workTreePath); String repoRelativePath = makeRelativeTo .append("/.project").toPortableString(); ObjectId headCommitId = repo.resolve(Constants.HEAD); if (headCommitId != null) { try (RevWalk revWalk = new RevWalk(repo)) { RevCommit headCommit = revWalk .parseCommit(headCommitId); RevTree headTree = headCommit.getTree(); TreeWalk projectInRepo = TreeWalk.forPath(repo, repoRelativePath, headTree); if (projectInRepo != null) { treeItem.setChecked(true); } } } } } catch (IOException e1) { Activator .logError( UIText.ExistingOrNewPage_FailedToDetectRepositoryMessage, e1); } finally { if (repo != null) { repo.close(); } } } }

Target:
private void fillTreeItemWithGitDirectory(RepositoryMapping m, TreeItem treeItem, IPath gitDir, boolean isAlternative) { if (m.getGitDir() == null) treeItem.setText(2, UIText.ExistingOrNewPage_SymbolicValueEmptyMapping); else { IPath relativePath = new Path(m.getGitDir()); if (isAlternative) { IPath withoutLastSegment = relativePath.removeLastSegments(1); IPath path; if (withoutLastSegment.isEmpty()) path = Path.fromPortableString("."); else path = withoutLastSegment; treeItem.setText(0, path.toString()); } treeItem.setText(2, relativePath.toOSString()); try (Repository repo = new RepositoryBuilder() .setGitDir(gitDir.toFile()).build();) { IProject project = m.getContainer().getProject(); File workTree = repo.getWorkTree(); IPath workTreePath = Path.fromOSString(workTree .getAbsolutePath()); if (workTreePath.isPrefixOf(project.getLocation())) { IPath makeRelativeTo = project.getLocation() .makeRelativeTo(workTreePath); String repoRelativePath = makeRelativeTo .append("/.project").toPortableString(); ObjectId headCommitId = repo.resolve(Constants.HEAD); if (headCommitId != null) { try (RevWalk revWalk = new RevWalk(repo)) { RevCommit headCommit = revWalk .parseCommit(headCommitId); RevTree headTree = headCommit.getTree(); TreeWalk projectInRepo = TreeWalk.forPath(repo, repoRelativePath, headTree); if (projectInRepo != null) { treeItem.setChecked(true); } } } } } catch (IOException e1) { Activator .logError( UIText.ExistingOrNewPage_FailedToDetectRepositoryMessage, e1); } } }
Source:
public void testCassandraOutputOperator() { TestOutputOperator outputOperator = setupForOutputOperatorTest(); List<FieldInfo> fieldInfos = Lists.newArrayList(); fieldInfos.add(new FieldInfo("id", "id", null)); fieldInfos.add(new FieldInfo("age", "age", null)); fieldInfos.add(new FieldInfo("doubleValue", "doubleValue", null)); fieldInfos.add(new FieldInfo("floatValue", "floatValue", null)); fieldInfos.add(new FieldInfo("last_visited", "last_visited", null)); fieldInfos.add(new FieldInfo("lastname", "lastname", null)); fieldInfos.add(new FieldInfo("list1", "list1", null)); fieldInfos.add(new FieldInfo("map1", "map1", null)); fieldInfos.add(new FieldInfo("set1", "set1", null)); fieldInfos.add(new FieldInfo("test", "test", null)); outputOperator.setFieldInfos(fieldInfos); outputOperator.input.setup(tpc); outputOperator.setup(context); outputOperator.activate(context); List<TestPojo> events = Lists.newArrayList(); for (int i = 0; i < 3; i++) { Set<Integer> set = new HashSet<Integer>(); set.add(i); List<Integer> list = new ArrayList<Integer>(); list.add(i); Map<String, Integer> map = new HashMap<String, Integer>(); map.put("key" + i, i); events.add(new TestPojo(UUID.randomUUID(), i, "abclast", true, i, 2.0, set, list, map, new Date(System.currentTimeMillis()))); } outputOperator.beginWindow(0); for (TestPojo event : events) { outputOperator.input.process(event); } outputOperator.endWindow(); Assert.assertEquals("rows in db", 3, outputOperator.getNumOfEventsInStore()); outputOperator.getEventsInStore(); }

Target:
public void testCassandraOutputOperator() { TestOutputOperator outputOperator = setupForOutputOperatorTest(); List<FieldInfo> fieldInfos = Lists.newArrayList(); fieldInfos.add(new FieldInfo("id", "id", null)); fieldInfos.add(new FieldInfo("age", "age", null)); fieldInfos.add(new FieldInfo("doubleValue", "doubleValue", null)); fieldInfos.add(new FieldInfo("floatValue", "floatValue", null)); fieldInfos.add(new FieldInfo("last_visited", "last_visited", null)); fieldInfos.add(new FieldInfo("lastname", "lastname", null)); fieldInfos.add(new FieldInfo("list1", "list1", null)); fieldInfos.add(new FieldInfo("map1", "map1", null)); fieldInfos.add(new FieldInfo("set1", "set1", null)); fieldInfos.add(new FieldInfo("test", "test", null)); outputOperator.setFieldInfos(fieldInfos); outputOperator.setup(context); outputOperator.input.setup(tpc); outputOperator.activate(context); List<TestPojo> events = Lists.newArrayList(); for (int i = 0; i < 3; i++) { Set<Integer> set = new HashSet<Integer>(); set.add(i); List<Integer> list = new ArrayList<Integer>(); list.add(i); Map<String, Integer> map = new HashMap<String, Integer>(); map.put("key" + i, i); events.add(new TestPojo(UUID.randomUUID(), i, "abclast", true, i, 2.0, set, list, map, new Date(System.currentTimeMillis()))); } outputOperator.beginWindow(0); for (TestPojo event : events) { outputOperator.input.process(event); } outputOperator.endWindow(); Assert.assertEquals("rows in db", 3, outputOperator.getNumOfEventsInStore()); outputOperator.getEventsInStore(); }
Source:
public void setLocation(Path newBriefcaseDir) { briefcaseDir = Optional.of(newBriefcaseDir); Path cacheFilePath = newBriefcaseDir.resolve(CACHE_FILE_NAME); cacheFile = Optional.of(cacheFilePath); if (Files.exists(cacheFilePath)) try (InputStream in = Files.newInputStream(cacheFilePath); ObjectInputStream ois = new ObjectInputStream(in)) { hashByPath = (Map<String, String>) ois.readObject(); formDefByPath = (Map<String, BriefcaseFormDefinition>) ois.readObject(); } catch (InvalidClassException e) { log.warn("The serialized forms cache is incompatible due to an update on Briefcase"); delete(cacheFilePath); } catch (IOException | ClassNotFoundException e) { log.warn("Can't read forms cache file", e); delete(cacheFilePath); } if (!Files.exists(cacheFilePath)) { createFile(cacheFilePath); hashByPath = new HashMap<>(); formDefByPath = new HashMap<>(); } update(); }

Target:
public void setLocation(Path newBriefcaseDir) { briefcaseDir = Optional.of(newBriefcaseDir); Path cacheFilePath = newBriefcaseDir.resolve(CACHE_FILE_NAME); cacheFile = Optional.of(cacheFilePath); if (Files.exists(cacheFilePath)) try (InputStream in = Files.newInputStream(cacheFilePath); ObjectInputStream ois = new ObjectInputStream(in)) { hashByPath = (Map<String, String>) ois.readObject(); formDefByPath = (Map<String, BriefcaseFormDefinition>) ois.readObject(); } catch (InvalidClassException e) { log.warn("The serialized forms cache is incompatible due to an update on Briefcase"); delete(cacheFilePath); } catch (IOException | ClassNotFoundException e) { log.warn("Can't read forms cache file", e); delete(cacheFilePath); } if (!Files.exists(cacheFilePath)) { createFile(cacheFilePath); hashByPath = new HashMap<>(); formDefByPath = new HashMap<>(); } }
Source:
private void loadExclusivePIDList() { try (FileReader reader = new FileReader(exclusivePIDStore)) { exclusivcePIDMap = GSON.fromJson(reader, ExclusivePIDMap.class); if (exclusivcePIDMap != null) { exclusivcePIDMap.initializeProcessPIDMapping(); } } catch (JsonSyntaxException | JsonIOException | IOException e) { logger.error("Error loading exclusive pids from {}.", exclusivePIDStore.getAbsolutePath(), e); } finally { if (exclusivcePIDMap == null) { exclusivcePIDMap = new ExclusivePIDMap(); } } }

Target:
private void loadExclusivePIDList() { try (FileReader reader = new FileReader(exclusivePIDStore)) { exclusivePIDMap = gson.fromJson(reader, ExclusivePIDMap.class); if (exclusivePIDMap != null) { exclusivePIDMap.initializeProcessPIDMapping(); } } catch (JsonSyntaxException | JsonIOException e) { logger.error("Error parsing exclusive pids from '{}': {}", exclusivePIDStore.getAbsolutePath(), e.getMessage()); } catch (IOException e) { logger.debug("Error loading exclusive pids from '{}': {}", exclusivePIDStore.getAbsolutePath(), e.getMessage()); } finally { if (exclusivePIDMap == null) { exclusivePIDMap = new ExclusivePIDMap(); } } }
Source:
public static void input(SpatialPartitioningState state, @SqlType(GEOMETRY_TYPE_NAME) Slice slice, @SqlType(INTEGER) long partitionCount) { Envelope envelope = deserializeEnvelope(slice); if (envelope == null) { return; } Rectangle extent = new Rectangle(envelope.getXMin(), envelope.getYMin(), envelope.getXMax(), envelope.getYMax()); if (state.getCount() == 0) { state.setPartitionCount(toIntExact(partitionCount)); state.setExtent(extent); state.setSamples(new ArrayList<>()); } else { state.setExtent(state.getExtent().merge(extent)); } List<Rectangle> samples = state.getSamples(); if (samples.size() <= MAX_SAMPLE_COUNT) { samples.add(extent); } else { int sampleIndex = (int) floor(ThreadLocalRandom.current().nextDouble() * state.getCount()); if (sampleIndex < MAX_SAMPLE_COUNT) { samples.set(sampleIndex, extent); } } state.setCount(state.getCount() + 1); }

Target:
public static void input(SpatialPartitioningState state, @SqlType(GEOMETRY_TYPE_NAME) Slice slice, @SqlType(INTEGER) long partitionCount) { Envelope envelope = deserializeEnvelope(slice); if (envelope == null) { return; } Rectangle extent = new Rectangle(envelope.getXMin(), envelope.getYMin(), envelope.getXMax(), envelope.getYMax()); if (state.getCount() == 0) { state.setPartitionCount(toIntExact(partitionCount)); state.setExtent(extent); state.setSamples(new ArrayList<>()); } else { state.setExtent(state.getExtent().merge(extent)); } List<Rectangle> samples = state.getSamples(); if (samples.size() <= MAX_SAMPLE_COUNT) { samples.add(extent); } else { long sampleIndex = ThreadLocalRandom.current().nextLong(state.getCount()); if (sampleIndex < MAX_SAMPLE_COUNT) { samples.set(toIntExact(sampleIndex), extent); } } state.setCount(state.getCount() + 1); }
Source:
public static void preInit() { wrench = ItemManager.register(new ItemWrench_Neptune("item.wrench")); gearWood = ItemManager.register(new ItemBC_Neptune("item.gear.wood")); gearStone = ItemManager.register(new ItemBC_Neptune("item.gear.stone")); gearIron = ItemManager.register(new ItemBC_Neptune("item.gear.iron")); gearGold = ItemManager.register(new ItemBC_Neptune("item.gear.gold")); gearDiamond = ItemManager.register(new ItemBC_Neptune("item.gear.diamond")); if (BCLib.DEV) { diamondShard = ItemManager.register(new ItemBC_Neptune("item.diamond.shard")); } paintbrush = ItemManager.register(new ItemPaintbrush_BC8("item.paintbrush")); list = ItemManager.register(new ItemList_BC8("item.list")); if (BCLib.DEV) { mapLocation = ItemManager.register(new ItemMapLocation("item.map_location")); markerConnector = ItemManager.register(new ItemMarkerConnector("item.marker_connector")); } volumeBox = ItemManager.register(new ItemVolumeBox("item.volume_box")); if (BCLib.DEV) { goggles = ItemManager.register(new ItemGoggles("item.goggles")); } BCLibItems.guide.setCreativeTab(CreativeTabManager.getTab("buildcraft.main")); }

Target:
public static void preInit() { wrench = ItemManager.register(new ItemWrench_Neptune("item.wrench")); gearWood = ItemManager.register(new ItemBC_Neptune("item.gear.wood")); gearStone = ItemManager.register(new ItemBC_Neptune("item.gear.stone")); gearIron = ItemManager.register(new ItemBC_Neptune("item.gear.iron")); gearGold = ItemManager.register(new ItemBC_Neptune("item.gear.gold")); gearDiamond = ItemManager.register(new ItemBC_Neptune("item.gear.diamond")); if (BCLib.DEV) { diamondShard = ItemManager.register(new ItemBC_Neptune("item.diamond.shard")); } paintbrush = ItemManager.register(new ItemPaintbrush_BC8("item.paintbrush")); list = ItemManager.register(new ItemList_BC8("item.list")); if (BCLib.DEV) { mapLocation = ItemManager.register(new ItemMapLocation("item.map_location")); } markerConnector = ItemManager.register(new ItemMarkerConnector("item.marker_connector")); volumeBox = ItemManager.register(new ItemVolumeBox("item.volume_box")); if (BCLib.DEV) { goggles = ItemManager.register(new ItemGoggles("item.goggles")); } BCLibItems.guide.setCreativeTab(CreativeTabManager.getTab("buildcraft.main")); }
Source:
public static void setOptions(SWTBot bot, int optionFlags, String traceTypeName) { SWTBotCheckBox checkBox = bot.checkBox(Messages.ImportTraceWizard_CreateLinksInWorkspace); if (checkBox.isEnabled()) { if ((optionFlags & ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE) != 0) { checkBox.select(); } else { checkBox.deselect(); } } checkBox = bot.checkBox(Messages.ImportTraceWizard_PreserveFolderStructure); if ((optionFlags & ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE) != 0) { checkBox.select(); } else { checkBox.deselect(); } checkBox = bot.checkBox(Messages.ImportTraceWizard_ImportUnrecognized); if ((optionFlags & ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES) != 0) { checkBox.select(); } else { checkBox.deselect(); } checkBox = bot.checkBox(Messages.ImportTraceWizard_OverwriteExistingTrace); if ((optionFlags & ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES) != 0) { checkBox.select(); } else { checkBox.deselect(); } checkBox = bot.checkBox(Messages.ImportTraceWizard_CreateExperiment); if ((optionFlags & ImportTraceWizardPage.OPTION_CREATE_EXPERIMENT) != 0) { checkBox.select(); } else { checkBox.deselect(); } SWTBotCombo comboBox = bot.comboBoxWithLabel(Messages.ImportTraceWizard_TraceType); if (traceTypeName != null && !traceTypeName.isEmpty()) { comboBox.setSelection(traceTypeName); } else { comboBox.setSelection(ImportTraceWizardPage.TRACE_TYPE_AUTO_DETECT); } }

Target:
public static void setOptions(SWTBot bot, int optionFlags, String traceTypeName) { SWTBotCombo comboBox = bot.comboBoxWithLabel(Messages.ImportTraceWizard_TraceType); if (traceTypeName != null && !traceTypeName.isEmpty()) { comboBox.setSelection(traceTypeName); } else { comboBox.setSelection(ImportTraceWizardPage.TRACE_TYPE_AUTO_DETECT); } SWTBotCheckBox checkBox = bot.checkBox(Messages.ImportTraceWizard_CreateLinksInWorkspace); if (checkBox.isEnabled()) { if ((optionFlags & ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE) != 0) { checkBox.select(); } else { checkBox.deselect(); } } checkBox = bot.checkBox(Messages.ImportTraceWizard_PreserveFolderStructure); if ((optionFlags & ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE) != 0) { checkBox.select(); } else { checkBox.deselect(); } checkBox = bot.checkBox(Messages.ImportTraceWizard_ImportUnrecognized); if (checkBox.isEnabled()) { if ((optionFlags & ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES) != 0) { checkBox.select(); } else { checkBox.deselect(); } } checkBox = bot.checkBox(Messages.ImportTraceWizard_OverwriteExistingTrace); if ((optionFlags & ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES) != 0) { checkBox.select(); } else { checkBox.deselect(); } checkBox = bot.checkBox(Messages.ImportTraceWizard_CreateExperiment); if ((optionFlags & ImportTraceWizardPage.OPTION_CREATE_EXPERIMENT) != 0) { checkBox.select(); } else { checkBox.deselect(); } }
Source:
public void testZeroLengthInterval(){ SimpleInterval interval = new SimpleInterval("1",100,99); }

Target:
public void testZeroLengthInterval(){ SimpleInterval interval = new SimpleInterval("1",100,99); Assert.assertEquals(interval.getContig(), "1"); Assert.assertEquals(interval.getStart(), 100); Assert.assertEquals(interval.getEnd(), 99); }
Source:
private static double medianOrDefault(final List<Double> list) { return list.size() > 0 ? new Median().evaluate(list.stream().mapToDouble(d->d).toArray()) : 1.0; }

Target:
private static double medianOrDefault(final List<Double> list) { return list.size() > 0 ? new Median().evaluate(list.stream().mapToDouble(d->d).toArray()) : DUMMY_VALUE_NEVER_USED; }
Source:
public void applyPhysics(Material oldType, int newTypeId, byte oldData, byte newData) { ItemTable itemTable = ItemTable.instance(); Material newType = Material.getMaterial(newTypeId); for (int y = -1; y <= 1; y++) { for (BlockFace face : LAYER) { if (y == 0 && face == BlockFace.SELF) continue; GlowBlock notify = this.getRelative(face.getModX(), face.getModY() + y, face.getModZ()); BlockFace blockFace; if (y == 0) { blockFace = face.getOppositeFace(); } else if (y == -1 && face == BlockFace.SELF) { blockFace = BlockFace.UP; } else if (y == 1 && face == BlockFace.SELF) { blockFace = BlockFace.DOWN; } else { blockFace = null; } BlockType notifyType = itemTable.getBlock(notify.getTypeId()); if (notifyType != null) { notifyType.onNearBlockChanged(notify, blockFace, this, oldType, oldData, newType, newData); } } } BlockType type = itemTable.getBlock(oldType); if (type != null) { type.onBlockChanged(this, oldType, oldData, newType, newData); } type.receivePulse(this); }

Target:
public void applyPhysics(Material oldType, int newTypeId, byte oldData, byte newData) { ItemTable itemTable = ItemTable.instance(); Material newType = Material.getMaterial(newTypeId); for (int y = -1; y <= 1; y++) { for (BlockFace face : LAYER) { if (y == 0 && face == BlockFace.SELF) continue; GlowBlock notify = this.getRelative(face.getModX(), face.getModY() + y, face.getModZ()); BlockFace blockFace; if (y == 0) { blockFace = face.getOppositeFace(); } else if (y == -1 && face == BlockFace.SELF) { blockFace = BlockFace.UP; } else if (y == 1 && face == BlockFace.SELF) { blockFace = BlockFace.DOWN; } else { blockFace = null; } BlockType notifyType = itemTable.getBlock(notify.getTypeId()); if (notifyType != null) { notifyType.onNearBlockChanged(notify, blockFace, this, oldType, oldData, newType, newData); } } } BlockType type = itemTable.getBlock(oldType); if (type != null) { type.onBlockChanged(this, oldType, oldData, newType, newData); } }
Source:
public ContainerExecDecorator(KubernetesClient client, String podName, String containerName, String path, AtomicBoolean alive, CountDownLatch started, CountDownLatch finished) { this.client = client; this.podName = podName; this.containerName = containerName; this.alive = alive; this.started = started; this.finished = finished; }

Target:
public ContainerExecDecorator(KubernetesClient client, String podName, String containerName, String path, AtomicBoolean alive, CountDownLatch started, CountDownLatch finished) { this(client, podName, containerName, alive, started, finished); }
Source:
public Iterable<SchedulingPipelinedRegion> getAllPipelinedRegions() { return vertexRegions.values().stream().collect(Collectors.toSet()); }

Target:
public Iterable<SchedulingPipelinedRegion> getAllPipelinedRegions() { return new HashSet<>(getVertexRegions().values()); }
Source:
public void updateEnvironment(@NotNull Map<String, String> env, @NotNull User userInfo) { final String externalId = userInfo.getExternalId(); env.put("SSH_ORIGINAL_COMMAND", "git"); env.put("GITEA_PUSHER_EMAIL", userInfo.getEmail()); if (externalId != null) { env.put("GL_ID", PREFIX_USER + externalId); env.put("GITEA_PUSHER_ID", userInfo.getExternalId()); } }

Target:
public void updateEnvironment(@NotNull Map<String, String> env, @NotNull User userInfo) { final String externalId = userInfo.getExternalId(); env.put("SSH_ORIGINAL_COMMAND", "git"); env.put("GITEA_PUSHER_EMAIL", userInfo.getEmail()); if (externalId != null) { env.put("GITEA_PUSHER_ID", userInfo.getExternalId()); } }
Source:
public CachingHasher build() throws IllegalArgumentException { List<long[]> cache = new ArrayList<long[]>(); for (byte[] buff : buffers) { long[] result = new long[2]; result[0] = function.apply(buff, 0); result[1] = function.apply(buff, 1) - result[0]; cache.add(result); } return new CachingHasher(function, cache); }

Target:
public final CachingHasher build() throws IllegalArgumentException { List<long[]> cache = new ArrayList<long[]>(); for (byte[] buff : buffers) { long[] result = new long[2]; result[0] = function.apply(buff, 0); result[1] = function.apply(buff, 1) - result[0]; cache.add(result); } return new CachingHasher(function, cache); }
Source:
protected @Nullable List<@NonNull ITimeGraphRowModel> getRowModel(@NonNull ITmfStateSystem ss, @NonNull SelectionTimeQueryFilter filter, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { TreeMultimap<Integer, ITmfStateInterval> intervals = TreeMultimap.create(Comparator.naturalOrder(), Comparator.comparing(ITmfStateInterval::getStartTime)); Map<@NonNull Long, @NonNull Integer> entries = getSelectedEntries(filter); Collection<Long> times = getTimes(filter, ss.getStartTime(), ss.getCurrentEndTime()); for (ITmfStateInterval interval : ss.query2D(getSelectedEntries(filter).values(), times)) { if (monitor != null && monitor.isCanceled()) { return null; } intervals.put(interval.getAttribute(), interval); } List<ITimeGraphRowModel> rows = new ArrayList<>(); for (Map.Entry<Long, Integer> entry : entries.entrySet()) { if (monitor != null && monitor.isCanceled()) { return null; } List<ITimeGraphState> eventList = new ArrayList<>(); for (ITmfStateInterval interval : intervals.get(entry.getValue())) { long startTime = interval.getStartTime(); long duration = interval.getEndTime() - startTime + 1; Object state = interval.getValue(); String value = state == null ? null : state.toString(); eventList.add(new TimeGraphState(startTime, duration, entry.getKey(), value)); } rows.add(new TimeGraphRowModel(entry.getKey(), eventList)); } return rows; }

Target:
protected @Nullable List<@NonNull ITimeGraphRowModel> getRowModel(@NonNull ITmfStateSystem ss, @NonNull SelectionTimeQueryFilter filter, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { TreeMultimap<Integer, ITmfStateInterval> intervals = TreeMultimap.create(Comparator.naturalOrder(), Comparator.comparing(ITmfStateInterval::getStartTime)); Map<@NonNull Long, @NonNull Integer> entries = getSelectedEntries(filter); Collection<Long> times = getTimes(filter, ss.getStartTime(), ss.getCurrentEndTime()); for (ITmfStateInterval interval : entries.values(), times)) { if (monitor != null && monitor.isCanceled()) { return null; } intervals.put(interval.getAttribute(), interval); } List<ITimeGraphRowModel> rows = new ArrayList<>(); for (Map.Entry<Long, Integer> entry : entries.entrySet()) { if (monitor != null && monitor.isCanceled()) { return null; } List<ITimeGraphState> eventList = new ArrayList<>(); for (ITmfStateInterval interval : intervals.get(entry.getValue())) { long startTime = interval.getStartTime(); long duration = interval.getEndTime() - startTime + 1; Object state = interval.getValue(); String value = state == null ? null : state.toString(); eventList.add(new TimeGraphState(startTime, duration, entry.getKey(), value)); } rows.add(new TimeGraphRowModel(entry.getKey(), eventList)); } return rows; }
Source:
protected StorageDomain map(org.ovirt.engine.core.common.businessentities.StorageDomain entity, StorageDomain template) { StorageDomain model = super.map(entity, template); if (!isFiltered()) { switch (entity.getStorageType()) { case ISCSI: mapVolumeGroupIscsi(model, entity); break; case FCP: mapVolumeGroupFcp(model, entity); break; case NFS: mapNFSProperties(model, entity); case LOCALFS: case POSIXFS: case GLUSTERFS: mapFileDomain(model, entity); break; } } return model; }

Target:
protected StorageDomain map(org.ovirt.engine.core.common.businessentities.StorageDomain entity, StorageDomain template) { StorageDomain model = super.map(entity, template); if (!isFiltered()) { switch (entity.getStorageType()) { case ISCSI: mapVolumeGroupIscsi(model, entity); break; case FCP: mapVolumeGroupFcp(model, entity); break; case NFS: case LOCALFS: case POSIXFS: case GLUSTERFS: mapFileDomain(model, entity); break; } } return model; }
Source:
private static Object handleJoinPointFuture( ProceedingJoinPoint proceedingJoinPoint, io.github.resilience4j.timelimiter.TimeLimiter timeLimiter, boolean blocking) throws Throwable { if(blocking) { return timeLimiter.executeFutureSupplier(() -> { try { return (Future<?>) proceedingJoinPoint.proceed(); } catch (Throwable throwable) { throw new CompletionException(throwable); } }); } return timeLimiter.executeCompletionStage(timeLimiterExecutorService, () -> { try { return (CompletionStage<?>) proceedingJoinPoint.proceed(); } catch (Throwable throwable) { throw new CompletionException(throwable); } }); }

Target:
private static Object handleJoinPointFuture( ProceedingJoinPoint proceedingJoinPoint, io.github.resilience4j.timelimiter.TimeLimiter timeLimiter, boolean blocking) throws Throwable { if(blocking) { return timeLimiter.executeFutureSupplier(() -> CompletableFuture.supplyAsync(() -> { try { return proceedingJoinPoint.proceed(); } catch (Throwable throwable) { throw new CompletionException(throwable); } }) ); } return timeLimiter.executeCompletionStage(timeLimiterExecutorService, () -> { try { return (CompletionStage<?>) proceedingJoinPoint.proceed(); } catch (Throwable throwable) { throw new CompletionException(throwable); } }); }
Source:
public static List<FieldProjection> from(Fields fields, boolean include) { Assert.notNull(fields, "Fields must not be null!"); List<FieldProjection> projections = new ArrayList<FieldProjection>(); for (Field field : fields) { if (!include) { if (!Fields.UNDERSCORE_ID.equals(field.getName())) { throw new IllegalArgumentException( String .format( "Exclusion of field %s not allowed. Projections by the mongodb aggregation framework only support the exclusion of the %s field!", field.getName(), Fields.UNDERSCORE_ID)); } } projections.add(new FieldProjection(field, include ? null : 0)); } return projections; }

Target:
public static List<FieldProjection> from(Fields fields, boolean include) { Assert.notNull(fields, "Fields must not be null!"); List<FieldProjection> projections = new ArrayList<FieldProjection>(); for (Field field : fields) { projections.add(new FieldProjection(field, include ? null : 0)); } return projections; }
Source:
ElasticsearchHttpSpanConsumer(ElasticsearchHttpStorage es) { this.es = es; this.indexNameFormatter = es.indexNameFormatter(); this.indexToServiceSpansCache = Collections.synchronizedMap(new LinkedHashMap<String, Set<Pair<String>>>() { @Override protected boolean removeEldestEntry(Map.Entry<String, Set<Pair<String>>> eldest) { return size() > MAX_CACHE_DAYS; } }); }

Target:
ElasticsearchHttpSpanConsumer(ElasticsearchHttpStorage es) { this.es = es; this.indexNameFormatter = es.indexNameFormatter(); }