auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener, RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats, boolean indicatorsEnabled, boolean loggingEnabled) { this.context = context; this.dispatcher = dispatcher; this.cache = cache; this.listener = listener; this.requestTransformer = requestTransformer; final List<RequestHandler> allRequestHandlers = new ArrayList<RequestHandler>(7); allRequestHandlers.add(new ResourceRequestHandler(context)); allRequestHandlers.add(new ContactsPhotoRequestHandler(context)); allRequestHandlers.add(new MediaStoreRequestHandler(context)); allRequestHandlers.add(new ContentStreamRequestHandler(context)); allRequestHandlers.add(new AssetRequestHandler(context)); allRequestHandlers.add(new FileRequestHandler(context)); allRequestHandlers.add(new NetworkRequestHandler(dispatcher.downloader, stats)); if (extraRequestHandlers != null && !extraRequestHandlers.isEmpty()) { allRequestHandlers.addAll(extraRequestHandlers); } requestHandlers = Collections.unmodifiableList(allRequestHandlers); this.stats = stats; this.targetToAction = new WeakHashMap<Object, Action>(); this.targetToDeferredRequestCreator = new WeakHashMap<ImageView, DeferredRequestCreator>(); this.indicatorsEnabled = indicatorsEnabled; this.loggingEnabled = loggingEnabled; this.referenceQueue = new ReferenceQueue<Object>(); this.cleanupThread = new CleanupThread(referenceQueue, HANDLER); this.cleanupThread.start(); }

Target:
Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener, RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats, boolean indicatorsEnabled, boolean loggingEnabled) { this.context = context; this.dispatcher = dispatcher; this.cache = cache; this.listener = listener; this.requestTransformer = requestTransformer; final int extraCount = (extraRequestHandlers != null ? extraRequestHandlers.size() : 0); final List<RequestHandler> allRequestHandlers = new ArrayList<RequestHandler>(7 + extraCount); allRequestHandlers.add(new ResourceRequestHandler(context)); allRequestHandlers.add(new ContactsPhotoRequestHandler(context)); allRequestHandlers.add(new MediaStoreRequestHandler(context)); allRequestHandlers.add(new ContentStreamRequestHandler(context)); allRequestHandlers.add(new AssetRequestHandler(context)); allRequestHandlers.add(new FileRequestHandler(context)); allRequestHandlers.add(new NetworkRequestHandler(dispatcher.downloader, stats)); if (extraRequestHandlers != null) { allRequestHandlers.addAll(extraRequestHandlers); } requestHandlers = Collections.unmodifiableList(allRequestHandlers); this.stats = stats; this.targetToAction = new WeakHashMap<Object, Action>(); this.targetToDeferredRequestCreator = new WeakHashMap<ImageView, DeferredRequestCreator>(); this.indicatorsEnabled = indicatorsEnabled; this.loggingEnabled = loggingEnabled; this.referenceQueue = new ReferenceQueue<Object>(); this.cleanupThread = new CleanupThread(referenceQueue, HANDLER); this.cleanupThread.start(); }
Source:
public void test_singleMarketData() { MarketData marketDataCalibrated = StandardComponents.marketDataFactory().create( REQUIREMENTS, CONFIG, MARKET_DATA, REF_DATA); Results results = CALC_RUNNER.calculate(RULES, TARGETS, COLUMN, marketDataCalibrated, REF_DATA); CurrencyAmount computed = (CurrencyAmount) results.get(0, 0).getValue(); CurrencyAmount expected = PRICER.presentValue(OPTION_TRADE.resolve(REF_DATA), EXP_RATES, EXP_VOLS) .convertedTo(USD, EXP_RATES); assertEquals(computed, expected); }

Target:
public void test_singleMarketData() { MarketData marketDataCalibrated = StandardComponents.marketDataFactory().create( REQUIREMENTS, CONFIG, MARKET_DATA, REF_DATA); Results results = CALC_RUNNER.calculate(RULES, TARGETS, COLUMN, marketDataCalibrated, REF_DATA); CurrencyAmount computed = results.get(0, 0, CurrencyAmount.class).getValue(); CurrencyAmount expected = PRICER.presentValue(OPTION_TRADE.resolve(REF_DATA), EXP_RATES, EXP_VOLS) .convertedTo(USD, EXP_RATES); assertEquals(computed, expected); }
Source:
public MultipartSupportImpl(ExtendedServletDTO servletDTO, ServletContext servletContext) { this.servletDTO = servletDTO; File baseStorage = (File)servletContext.getAttribute(ServletContext.TEMPDIR); if (servletDTO.multipartLocation.length() > 0) { File storage = new File(servletDTO.multipartLocation); if (!storage.isAbsolute()) { storage = new File(baseStorage, storage.getPath()); } baseStorage = storage; } if (System.getSecurityManager() != null) { BundleContext bundleContext = (BundleContext)servletContext.getAttribute("osgi-bundlecontext"); Bundle bundle = bundleContext.getBundle(); bundle.hasPermission(new FilePermission(baseStorage.getAbsolutePath(), "read,write")); } baseStorage.mkdirs(); DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setRepository(baseStorage); if (servletDTO.multipartFileSizeThreshold > 0) { factory.setSizeThreshold(servletDTO.multipartFileSizeThreshold); } upload = new ServletFileUpload(factory); if (servletDTO.multipartMaxFileSize > -1L) { upload.setFileSizeMax(servletDTO.multipartMaxFileSize); } if (servletDTO.multipartMaxRequestSize > -1L) { upload.setSizeMax(servletDTO.multipartMaxRequestSize); } }

Target:
public MultipartSupportImpl(ExtendedServletDTO servletDTO, ServletContext servletContext) { this.servletDTO = servletDTO; File baseStorage = (File)servletContext.getAttribute(ServletContext.TEMPDIR); if (servletDTO.multipartLocation.length() > 0) { File storage = new File(servletDTO.multipartLocation); if (!storage.isAbsolute()) { storage = new File(baseStorage, storage.getPath()); } baseStorage = storage; } checkPermission(baseStorage, servletContext); baseStorage.mkdirs(); DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setRepository(baseStorage); if (servletDTO.multipartFileSizeThreshold > 0) { factory.setSizeThreshold(servletDTO.multipartFileSizeThreshold); } upload = new ServletFileUpload(factory); if (servletDTO.multipartMaxFileSize > -1L) { upload.setFileSizeMax(servletDTO.multipartMaxFileSize); } if (servletDTO.multipartMaxRequestSize > -1L) { upload.setSizeMax(servletDTO.multipartMaxRequestSize); } }
Source:
public InternationalizationToggleState() { lastSelectedProject = null; lastSelectedPapyrusProjectName = null; pageSelectionListener = new ISelectionListener() { @Override public void selectionChanged(final IWorkbenchPart part, final ISelection selection) { if(part instanceof IEditorPart){ EObject selectedEObject = null; if(selection instanceof StructuredSelection){ Object firstSelectedElement = ((StructuredSelection) selection).getFirstElement(); if(firstSelectedElement instanceof EObject){ selectedEObject = (EObject) firstSelectedElement; } } if(null != selectedEObject){ final Resource resource = selectedEObject.eResource(); if(null != resource){ final IFile resourceFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(CommonPlugin.resolve(resource.getURI()).toFileString())); if(null != resourceFile){ lastSelectedProject = resourceFile.getProject(); lastSelectedPapyrusProjectName = resource.getURI().lastSegment().replace("."+resource.getURI().fileExtension(), ""); } } } } } }; currentPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); currentPage.addSelectionListener(pageSelectionListener); }

Target:
public InternationalizationToggleState() { lastSelectedProject = null; lastSelectedPapyrusProjectName = null; pageSelectionListener = new ISelectionListener() { @Override public void selectionChanged(final IWorkbenchPart part, final ISelection selection) { if(part instanceof IEditorPart){ EObject selectedEObject = null; if(selection instanceof StructuredSelection){ Object firstSelectedElement = ((StructuredSelection) selection).getFirstElement(); if(firstSelectedElement instanceof EObject){ selectedEObject = (EObject) firstSelectedElement; } } if(null != selectedEObject){ final Resource resource = selectedEObject.eResource(); if(null != resource){ final IFile resourceFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(CommonPlugin.resolve(resource.getURI()).toFileString())); if(null != resourceFile){ lastSelectedProject = resourceFile.getProject(); lastSelectedPapyrusProjectName = resource.getURI().lastSegment().replace("."+resource.getURI().fileExtension(), ""); } } } } } }; currentPage = EditorHelper.getActiveWindow().getActivePage(); currentPage.addSelectionListener(pageSelectionListener); }
Source:
public Action<?, ?> databaseBackupFailedAction() { return new AbstractDatabaseBackupAction<>(DatabaseBackupFailedEvent.class) { @Override protected BackupRestoreContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, DatabaseBackupFailedEvent payload) { Flow flow = getFlow(flowParameters.getFlowId()); Stack stack = stackService.getById(payload.getResourceId()); MDCBuilder.buildMdcContext(stack); flow.setFlowFailed(payload.getException()); return BackupRestoreContext.from(flowParameters, payload, null, null); } @Override protected void doExecute(BackupRestoreContext context, DatabaseBackupFailedEvent payload, Map<Object, Object> variables) throws Exception { backupRestoreStatusService.handleDatabaseBackupFailure(context.getStackId(), payload.getException().getMessage(), payload.getDetailedStatus()); sendEvent(context, DATABASE_BACKUP_FAILED_EVENT.event(), payload); } @Override protected Object getFailurePayload(DatabaseBackupFailedEvent payload, Optional<BackupRestoreContext> flowContext, Exception ex) { return null; } }; }

Target:
public Action<?, ?> databaseBackupFailedAction() { return new AbstractBackupRestoreActions<>(DatabaseBackupFailedEvent.class) { @Override protected BackupRestoreContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, DatabaseBackupFailedEvent payload) { Flow flow = getFlow(flowParameters.getFlowId()); flow.setFlowFailed(payload.getException()); return BackupRestoreContext.from(flowParameters, payload, null, null); } @Override protected void doExecute(BackupRestoreContext context, DatabaseBackupFailedEvent payload, Map<Object, Object> variables) { backupRestoreStatusService.handleDatabaseBackupFailure(context.getStackId(), payload.getException().getMessage(), payload.getDetailedStatus()); sendEvent(context, DATABASE_BACKUP_FAIL_HANDLED_EVENT.event(), payload); } }; }
Source:
public static TupleDomainFilter toFilter(Domain domain) { ValueSet values = domain.getValues(); checkArgument(values instanceof SortedRangeSet, "Unexpected domain type: " + values.getClass().getSimpleName()); List<Range> ranges = ((SortedRangeSet) values).getOrderedRanges(); boolean nullAllowed = domain.isNullAllowed(); if (ranges.isEmpty() && nullAllowed) { return IS_NULL; } Type type = domain.getType(); if (ranges.size() == 1) { return createRangeFilter(type, ranges.get(0), nullAllowed); } if (type == BOOLEAN) { return createBooleanFilter(ranges, nullAllowed); } List<TupleDomainFilter> rangeFilters = ranges.stream() .map(r -> createRangeFilter(type, r, false)) .filter(not(ALWAYS_FALSE::equals)) .collect(toImmutableList()); if (rangeFilters.isEmpty()) { return nullAllowed ? IS_NULL : ALWAYS_FALSE; } if (rangeFilters.get(0) instanceof TupleDomainFilter.BigintRange) { List<TupleDomainFilter.BigintRange> bigintRanges = rangeFilters.stream() .map(TupleDomainFilter.BigintRange.class::cast) .collect(toImmutableList()); if (bigintRanges.stream().allMatch(TupleDomainFilter.BigintRange::isSingleValue)) { return new TupleDomainFilter.BigintValues( bigintRanges.stream() .mapToLong(TupleDomainFilter.BigintRange::getLower) .toArray(), nullAllowed); } return new TupleDomainFilter.BigintMultiRange(bigintRanges, nullAllowed); } return new TupleDomainFilter.MultiRange(rangeFilters, nullAllowed); }

Target:
public static TupleDomainFilter toFilter(Domain domain) { ValueSet values = domain.getValues(); checkArgument(values instanceof SortedRangeSet, "Unexpected domain type: " + values.getClass().getSimpleName()); List<Range> ranges = ((SortedRangeSet) values).getOrderedRanges(); boolean nullAllowed = domain.isNullAllowed(); if (ranges.isEmpty() && nullAllowed) { return IS_NULL; } Type type = domain.getType(); if (ranges.size() == 1) { return createRangeFilter(type, ranges.get(0), nullAllowed); } if (type == BOOLEAN) { return createBooleanFilter(ranges, nullAllowed); } List<TupleDomainFilter> rangeFilters = ranges.stream() .map(range -> createRangeFilter(type, range, false)) .filter(not(ALWAYS_FALSE::equals)) .collect(toImmutableList()); if (rangeFilters.isEmpty()) { return nullAllowed ? IS_NULL : ALWAYS_FALSE; } if (rangeFilters.get(0) instanceof BigintRange) { List<BigintRange> bigintRanges = rangeFilters.stream() .map(BigintRange.class::cast) .collect(toImmutableList()); if (bigintRanges.stream().allMatch(BigintRange::isSingleValue)) { return BigintValues.of( bigintRanges.stream() .mapToLong(BigintRange::getLower) .toArray(), nullAllowed); } return BigintMultiRange.of(bigintRanges, nullAllowed); } return MultiRange.of(rangeFilters, nullAllowed); }
Source:
public void createRealmLists(long reps) { for (long i = 0; i < reps; i++) { AllTypes allTypes = realm.where(AllTypes.class).findFirst(); if (allTypes != null) { allTypes.getColumnRealmList(); } } }

Target:
public void createRealmLists(long reps) { AllTypes allTypes = realm.where(AllTypes.class).findFirst(); for (long i = 0; i < reps; i++) { allTypes.getColumnRealmList(); } }
Source:
public boolean canAuthenticate(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { OAuth2AccessTokenReqDTO oAuth2AccessTokenReqDTO = tokReqMsgCtx.getOauth2AccessTokenReqDTO(); if (!StringUtils.isEmpty(oAuth2AccessTokenReqDTO.getClientId()) && !StringUtils.isEmpty(oAuth2AccessTokenReqDTO.getClientSecret())) { return true; } else { if (org.wso2.carbon.identity.oauth.common.GrantType.SAML20_BEARER.toString().equals( oAuth2AccessTokenReqDTO.getGrantType())) { Properties confProperties = getProperties(); String authConfig = confProperties.getProperty( OAuthConstants.CLIENT_AUTH_CREDENTIAL_VALIDATION); if (StringUtils.isNotEmpty(authConfig) && JavaUtils.isFalseExplicitly(authConfig)) { return true; } } } return false; }

Target:
public boolean canAuthenticate(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { OAuth2AccessTokenReqDTO oAuth2AccessTokenReqDTO = tokReqMsgCtx.getOauth2AccessTokenReqDTO(); if (StringUtils.isNotEmpty(oAuth2AccessTokenReqDTO.getClientId()) && StringUtils.isNotEmpty(oAuth2AccessTokenReqDTO.getClientSecret())) { return true; } else { if (org.wso2.carbon.identity.oauth.common.GrantType.SAML20_BEARER.toString().equals( oAuth2AccessTokenReqDTO.getGrantType())) { authConfig = properties.getProperty( OAuthConstants.CLIENT_AUTH_CREDENTIAL_VALIDATION); if (StringUtils.isNotEmpty(authConfig) && JavaUtils.isFalseExplicitly(authConfig)) { return true; } } } return false; }
Source:
public GenericJBossMarshaller(ClassLoader classLoader, ClassWhiteList classWhiteList) { super(); this.classLoader = classLoader == null ? getClass().getClassLoader() : classLoader; baseCfg.setClassResolver(classWhiteList == null ? new DefaultContextClassResolver(classLoader) : new CheckedClassResolver(classWhiteList, classLoader) ); }

Target:
public GenericJBossMarshaller(ClassLoader classLoader, ClassWhiteList classWhiteList) { super(); if (classLoader == null) { classLoader = getClass().getClassLoader(); } baseCfg.setClassResolver(classWhiteList == null ? new DefaultContextClassResolver(classLoader) : new CheckedClassResolver(classWhiteList, classLoader) ); }
Source:
static Set<Guid> mapDisks(DiskAttachments diskAttachments) { Set<Guid> diskIds = null; if (diskAttachments.isSetDiskAttachments()) { diskIds = mapDisksToSetOfGuids(diskAttachments.getDiskAttachments().stream() .map(DiskAttachment::getDisk)); } return diskIds; }

Target:
public static Set<Guid> mapDisks(DiskAttachments diskAttachments) { Set<Guid> diskIds = null; if (diskAttachments.isSetDiskAttachments()) { diskIds = mapDisksToSetOfGuids(diskAttachments.getDiskAttachments().stream() .map(DiskAttachment::getDisk)); } return diskIds; }
Source:
private void processAttributes(Artifact artifact, WordMLProducer wordMl, PresentationType presentationType, boolean multipleArtifacts, boolean publishInLine) throws OseeCoreException { String attribName = (String) renderer.getOption("AttributeName"); boolean onlyAttrib = false; for (AttributeElement attributeElement : attributeElements) { String attributeName = attributeElement.getAttributeName(); if (renderer.getBooleanOption("AllAttributes") || ((attribName == null) && (attributeName.equals("*")))) { for (IAttributeType attributeType : RendererManager.getAttributeTypeOrderList(artifact)) { if (!outlining || !attributeType.equals(headingAttributeType)) { processAttribute(artifact, wordMl, attributeElement, attributeType, true, presentationType, multipleArtifacts, publishInLine); } } } else { if (attribName != null) { attributeName = attribName; onlyAttrib = true; } AttributeType attributeType = AttributeTypeManager.getType(attributeName); if (artifact.isAttributeTypeValid(attributeType)) { processAttribute(artifact, wordMl, attributeElement, attributeType, false, presentationType, multipleArtifacts, publishInLine); } if (onlyAttrib) { break; } } } wordMl.setPageLayout(artifact); }

Target:
private void processAttributes(Artifact artifact, WordMLProducer wordMl, PresentationType presentationType, boolean multipleArtifacts, boolean publishInLine) throws OseeCoreException { String attribName = (String) renderer.getOption(ATTRIBUTE_NAME); boolean onlyAttrib = false; for (AttributeElement attributeElement : attributeElements) { String attributeName = attributeElement.getAttributeName(); if (renderer.getBooleanOption(ALL_ATTRIBUTES) || ((attribName == null) && (attributeName.equals("*")))) { for (IAttributeType attributeType : RendererManager.getAttributeTypeOrderList(artifact)) { if (!outlining || !attributeType.equals(headingAttributeType)) { processAttribute(artifact, wordMl, attributeElement, attributeType, true, presentationType, multipleArtifacts, publishInLine); } } } else { if (attribName != null) { attributeName = attribName; onlyAttrib = true; } AttributeType attributeType = AttributeTypeManager.getType(attributeName); if (artifact.isAttributeTypeValid(attributeType)) { processAttribute(artifact, wordMl, attributeElement, attributeType, false, presentationType, multipleArtifacts, publishInLine); } if (onlyAttrib) { break; } } } wordMl.setPageLayout(artifact); }
Source:
public void shouldAuthenticate() throws Exception { mockStatic( ForkedBooter.class ); doCallRealMethod() .when( ForkedBooter.class, "lookupDecoderFactory", anyString() ); try ( final ServerSocketChannel server = ServerSocketChannel.open() ) { if ( server.supportedOptions().contains( SO_REUSEADDR ) ) { server.setOption( SO_REUSEADDR, true ); } if ( server.supportedOptions().contains( TCP_NODELAY ) ) { server.setOption( TCP_NODELAY, true ); } if ( server.supportedOptions().contains( SO_KEEPALIVE ) ) { server.setOption( SO_KEEPALIVE, true ); } server.bind( new InetSocketAddress( 0 ) ); int serverPort = ( (InetSocketAddress) server.getLocalAddress() ).getPort(); final UUID uuid = UUID.randomUUID(); String url = "tcp://127.0.0.1:" + serverPort + "?auth=" + uuid; try ( final MasterProcessChannelProcessorFactory factory = invokeMethod( ForkedBooter.class, "lookupDecoderFactory", url ) ) { assertThat( factory ) .isInstanceOf( SurefireMasterProcessChannelProcessorFactory.class ); FutureTask<Boolean> task = new FutureTask<>( new Callable<Boolean>() { @Override public Boolean call() { try { SocketChannel channel = server.accept(); ByteBuffer bb = ByteBuffer.allocate( UUID_STRING_LENGTH ); int read = channel.read( bb ); assertThat( read ) .isEqualTo( UUID_STRING_LENGTH ); bb.flip(); assertThat( new String( bb.array(), US_ASCII ) ) .isEqualTo( uuid.toString() ); return true; } catch ( IOException e ) { return false; } } } ); Thread t = new Thread( task ); t.setDaemon( true ); t.start(); factory.connect( url ); try { task.get( 10, SECONDS ); } finally { factory.close(); } } } }

Target:
public void shouldAuthenticate() throws Exception { mockStatic( ForkedBooter.class ); doCallRealMethod() .when( ForkedBooter.class, "lookupDecoderFactory", anyString() ); try ( final ServerSocketChannel server = ServerSocketChannel.open() ) { server.bind( new InetSocketAddress( 0 ) ); int serverPort = ( (InetSocketAddress) server.getLocalAddress() ).getPort(); final String uuid = UUID.randomUUID().toString(); String url = "tcp://localhost:" + serverPort + "?sessionId=" + uuid; try ( final MasterProcessChannelProcessorFactory factory = invokeMethod( ForkedBooter.class, "lookupDecoderFactory", url ) ) { assertThat( factory ) .isInstanceOf( SurefireMasterProcessChannelProcessorFactory.class ); FutureTask<Boolean> task = new FutureTask<>( new Callable<Boolean>() { @Override public Boolean call() { try { SocketChannel channel = server.accept(); ByteBuffer bb = ByteBuffer.allocate( uuid.length() ); int read = channel.read( bb ); assertThat( read ) .isEqualTo( uuid.length() ); bb.flip(); assertThat( new String( bb.array(), US_ASCII ) ) .isEqualTo( uuid ); return true; } catch ( IOException e ) { return false; } } } ); Thread t = new Thread( task ); t.setDaemon( true ); t.start(); factory.connect( url ); try { task.get( 10, SECONDS ); } finally { factory.close(); } } } }
Source:
public static Client getClient(ClientConfig config, String[] servers, int port) throws Exception { config.setTopologyChangeAware(true); final Client client = ClientFactory.createClient(config); for (String server : servers) { try { client.createConnection(server.trim(), port); break; } catch(IOException e) { } } if (client.getConnectedHostList().isEmpty()) { throw new Exception("Unable to connect to any servers."); } return client; }

Target:
public static Client getClient(ClientConfig config, String[] servers, int port) throws Exception { config.setTopologyChangeAware(true); final Client client = ClientFactory.createClient(config); for (String server : servers) { try { client.createConnection(server.trim(), port); } catch (IOException e) { } } if (client.getConnectedHostList().isEmpty()) { try { client.close(); } catch (Exception ignore) throw new Exception("Unable to connect to any servers."); } return client; }
Source:
Iterable<? extends Annotatable> getAnnotatablesForTestClass( TestClass testClass) { return asList(testClass); }

Target:
Iterable<TestClass> getAnnotatablesForTestClass(TestClass testClass) { return singletonList(testClass); }
Source:
private Member createSomeMember(final Vo createdVo) throws ExtendMembershipException, AlreadyMemberException, WrongAttributeValueException, WrongReferenceAttributeValueException, InternalErrorException, PrivilegeException { final Candidate candidate = setUpCandidate(); final Member createdMember = perun.getMembersManagerBl().createMemberSync(sess, createdVo, candidate); return createdMember; }

Target:
private Member createSomeMember(final Vo createdVo) throws ExtendMembershipException, AlreadyMemberException, WrongAttributeValueException, WrongReferenceAttributeValueException, InternalErrorException { final Candidate candidate = setUpCandidate(); final Member createdMember = perun.getMembersManagerBl().createMemberSync(sess, createdVo, candidate); return createdMember; }
Source:
public Model handleUnknownCatalogException(UnknownCatalogException e) { LOG.warn(e.getMessage(), e); return new LinkedHashModel(); }

Target:
public Model handleUnknownCatalogException(UnknownCatalogException e) { LOG.info(e.getMessage(), e); return new LinkedHashModel(); }
Source:
public void testDeletePackageWithOneToMany() { populateUserPermissions(); runAsSystem( () -> { MetaDataService metadataService = dataService.getMeta(); Package package_ = packageFactory.create("package_onetomany").setLabel("package"); metadataService.upsertPackages(Stream.of(package_)); EntityType refEntityType = testHarness.createDynamicRefEntityType("entityType_onetomany", package_); EntityType entityType = testHarness.createDynamicTestEntityType( "refEntityType_onetomany", package_, refEntityType); Attribute oneToManyAttribute = attributeFactory .create("onetomany") .setName("onetomany") .setDataType(AttributeType.ONE_TO_MANY) .setRefEntity(entityType) .setMappedBy(entityType.getAttribute(ATTR_XREF)); refEntityType.addAttribute(oneToManyAttribute); metadataService.upsertEntityTypes(asList(refEntityType, entityType)); List<Entity> entities = createAndAdd(entityType, refEntityType, 5); Set<Entity> refEntities = entities.stream().map(e -> e.getEntity(ATTR_XREF)).collect(toSet()); assertPresent(entityType, entities); assertPresent(refEntityType, newArrayList(refEntities)); dataService.deleteById(PACKAGE, "package_onetomany"); assertEquals(metadataService.getPackage("package_onetomany"), Optional.empty()); assertTrue(dataService.hasEntityType(entityType.getId())); assertTrue(dataService.hasEntityType(refEntityType.getId())); entities.forEach(this::assertNotPresent); refEntities.forEach(this::assertNotPresent); }); }

Target:
public void testDeletePackageWithOneToMany() { populateUserPermissions(); runAsSystem( () -> { MetaDataService metadataService = dataService.getMeta(); Package package_ = packageFactory.create("package_onetomany").setLabel("package"); metadataService.upsertPackages(Stream.of(package_)); EntityType refEntityType = testHarness.createDynamicRefEntityType("entityType_onetomany", package_); EntityType entityType = testHarness.createDynamicTestEntityType( "refEntityType_onetomany", package_, refEntityType); Attribute oneToManyAttribute = attributeFactory .create("onetomany") .setName("onetomany") .setDataType(AttributeType.ONE_TO_MANY) .setRefEntity(entityType) .setMappedBy(entityType.getAttribute(ATTR_XREF)); refEntityType.addAttribute(oneToManyAttribute); metadataService.upsertEntityTypes(asList(refEntityType, entityType)); List<Entity> entities = createAndAdd(entityType, refEntityType, 5); Set<Entity> refEntities = entities.stream().map(e -> e.getEntity(ATTR_XREF)).collect(toSet()); assertPresent(entityType, entities); assertPresent(refEntityType, newArrayList(refEntities)); dataService.deleteById(PACKAGE, "package_onetomany"); assertEquals(metadataService.getPackage("package_onetomany"), Optional.empty()); assertFalse(dataService.hasEntityType(entityType.getId())); assertFalse(dataService.hasEntityType(refEntityType.getId())); entities.forEach(this::assertNotPresent); refEntities.forEach(this::assertNotPresent); }); }
Source:
public TypeMapper() { boolean javaTime = false; this.xmlJavaMapping = getXmlJavaMapping(javaTime); this.javaXmlMapping = getJavaXmlMapping(javaTime); }

Target:
public TypeMapper() { this(null, null, false); }
Source:
public void subscribe(final boolean subs) throws IOException { this.item.put( new AttributeUpdates().with(DyFriends.ATTR_SUBSCRIPTION, subs) ); Logger.info(this, "bout #%d subscribe to \"%s\"", this.number(), subs); }

Target:
public void subscribe(final boolean subs) throws IOException { this.item.put( new AttributeUpdates().with(DyFriends.ATTR_SUBSCRIPTION, subs) ); Logger.info( this, "bout #%d subscribe to \"%s\" by %s", this.number(), subs, this.self ); }
Source:
public List<Put> getJobPuts() { if (jobHistoryListener != null) return jobHistoryListener.getJobPuts(); else return null; }

Target:
public List<Put> getJobPuts() { if (jobHistoryListener != null) { return jobHistoryListener.getJobPuts(); } else { return null; } }
Source:
public static void parallel(String task, Iterable<Job> jobs) { IProgressMonitor group = getProgressGroup(); try { group.beginTask(task, size(jobs)); for (Job job : jobs) { job.setProgressGroup(group, 1); job.schedule(); } for (Job job : jobs) { job.join(); } } catch (InterruptedException e) { } finally { group.done(); } }

Target:
public static IProgressMonitor parallel(String task, Iterable<Job> jobs) { IProgressMonitor group = getProgressGroup(); try { group.beginTask(task, size(jobs)); for (Job job : jobs) { job.setProgressGroup(group, 1); job.schedule(); } for (Job job : jobs) { job.join(); } } catch (InterruptedException e) { } finally { group.done(); } return group; }
Source:
public void onPackStatistics(PackWriter.Statistics stats) { for (UploadPackLogger logger : loggers) { logger.onPackStatistics(stats); } }

Target:
public void onPackStatistics(PackWriter.Statistics stats) { for (int i = 0; i < count; i++) loggers[i].onPackStatistics(stats); }
Source:
public ClusterDataToSamConverter withTagPerMolecularIndex(final List<String> tagPerMolecularIndex) { if (tagPerMolecularIndex != null) this.tagPerMolecularIndex = tagPerMolecularIndex; return this; }

Target:
public ClusterDataToSamConverter withTagPerMolecularIndex(final List<String> tagPerMolecularIndex) { if (tagPerMolecularIndex == null) throw new IllegalArgumentException("Null given for tagPerMolecularIndex"); this.tagPerMolecularIndex = tagPerMolecularIndex; return this; }
Source:
public void done() { Flow.get(this).setHistory(History.single(new LoginScreen(new User())), Flow.Direction.REPLACE); }

Target:
public void done() { Flow.get(this).setHistory(History.single(new ChooseSignupScreen()), Flow.Direction.REPLACE); }
Source:
protected GroovyCodeVisitor getTransformer(final ASTNode[] nodes, final SourceUnit sourceUnit) { ClassCodeExpressionTransformer transformer = new ClassCodeExpressionTransformer() { @Override protected SourceUnit getSourceUnit() { return sourceUnit; } @Override public Expression transform(final Expression exp) { if (exp instanceof ConstructorCallExpression) { MethodCallExpression call = exp.getNodeMetaData(MacroTransformation.class); if (call != null) { return call; } } return super.transform(exp); } }; return new TransformingCodeVisitor(transformer) { @Override public void visitConstructorCallExpression(final ConstructorCallExpression call) { ClassNode type = call.getType(); if (type instanceof InnerClassNode) { if (((InnerClassNode) type).isAnonymous() && MACROCLASS_TYPE.getNameWithoutPackage().equals(type.getSuperClass().getNameWithoutPackage())) { try { String source = convertInnerClassToSource(type); MethodCallExpression macroCall = callX( propX(classX(ClassHelper.makeWithoutCaching(MacroBuilder.class, false)), "INSTANCE"), MACRO_METHOD, args( constX(source), MacroGroovyMethods.buildSubstitutionMap(sourceUnit, type), classX(ClassHelper.make(ClassNode.class)) ) ); macroCall.setSpreadSafe(false); macroCall.setSafe(false); macroCall.setImplicitThis(false); call.putNodeMetaData(MacroTransformation.class, macroCall); List<ClassNode> classes = sourceUnit.getAST().getClasses(); for (Iterator<ClassNode> iterator = classes.iterator(); iterator.hasNext(); ) { final ClassNode aClass = iterator.next(); if (aClass == type || type == aClass.getOuterClass()) { iterator.remove(); } } } catch (Exception e) { e.printStackTrace(); } return; } } super.visitConstructorCallExpression(call); } private String convertInnerClassToSource(final ClassNode type) throws Exception { String source = GeneralUtils.convertASTToSource(sourceUnit.getSource(), type); source = source.substring(source.indexOf('{') + 1, source.lastIndexOf('}') - 1); return source; } }; }

Target:
protected GroovyCodeVisitor getTransformer(final ASTNode[] nodes, final SourceUnit sourceUnit) { ClassCodeExpressionTransformer transformer = new MacroClassTransformer(sourceUnit); return new MacroClassTransformingCodeVisitor(transformer, sourceUnit); }
Source:
public TaskConfig deserialize(JsonParser parser, DeserializationContext context) throws IOException { LOGGER.debug("Deserializing the json into TaskConfig object"); JsonNode jsonNode = parser.readValueAsTree(); TaskConfig config = new TaskConfig(); ObjectMapper mapper; ObjectCodec codec = parser.getCodec(); if (codec instanceof ObjectMapper) { mapper = (ObjectMapper) codec; } else { mapper = new ObjectMapper(); } if (jsonNode.has("steps")) { Iterator<JsonNode> steps = jsonNode.get("steps").getElements(); while (steps.hasNext()) { config.add(mapper.readValue(steps.next(), TaskConfigStep.class)); } } return config; }

Target:
public TaskConfig deserialize(JsonParser parser, DeserializationContext context) throws IOException { JsonNode jsonNode = parser.readValueAsTree(); TaskConfig config = new TaskConfig(); ObjectMapper mapper; ObjectCodec codec = parser.getCodec(); if (codec instanceof ObjectMapper) { mapper = (ObjectMapper) codec; } else { mapper = new ObjectMapper(); } if (jsonNode.has("steps")) { Iterator<JsonNode> steps = jsonNode.get("steps").getElements(); while (steps.hasNext()) { config.add(mapper.readValue(steps.next(), TaskConfigStep.class)); } } return config; }
Source:
public int compare(TimedAction action1, TimedAction action2) { if (action1.time == action2.time) { return Long.valueOf(action1.count).compareTo(action2.count); } else { return Long.valueOf(action1.time).compareTo(action2.time); } }

Target:
public int compare(TimedAction action1, TimedAction action2) { if (action1.time == action2.time) { return action1.count < action2.count ? -1 : ((action1.count > action2.count) ? 1 : 0); } else { return action1.time < action2.time ? -1 : ((action1.time > action2.time) ? 1 : 0); } }
Source:
default double getDefaultValue() { return this.shadow$getDefaultValue(); }

Target:
default double api$getDefaultValue() { return this.shadow$getDefaultValue(); }
Source:
public LocalRouteServiceConfigurator(String serverName, SupplierDependency<String> route) { super(ServiceName.parse(WebDeploymentRequirement.LOCAL_ROUTE.resolve(serverName))); this.route = route; }

Target:
public LocalRouteServiceConfigurator(String serverName, SupplierDependency<String> route) { super(ServiceNameFactory.parseServiceName(WebDeploymentRequirement.LOCAL_ROUTE.resolve(serverName))); this.route = route; }
Source:
public boolean aggregate(KeyType key) { final int keyHash = Groupers.hash(key); final int grouperNumber = grouperNumberForKeyHash(keyHash); final Grouper<KeyType> grouper = groupers.get(grouperNumber); synchronized (grouper) { return grouper.aggregate(key, keyHash); } }

Target:
public boolean aggregate(KeyType key) { return aggregate(key, Groupers.hash(key)); }
Source:
public Repository getRepository(String storageId, String repositoryId) throws JAXBException { String url = getContextBaseUrl() + "/api/configuration/strongbox/storages/" + storageId + "/" + repositoryId; WebTarget resource = getClientInstance().target(url); setupAuthentication(resource); final Response response = resource.request(MediaType.APPLICATION_JSON).get(); Repository repository = null; if (response.getStatus() == 200) { repository = response.readEntity(Repository.class); } else { displayResponseError(response); } return repository; }

Target:
public RepositoryData getRepository(String storageId, String repositoryId) throws JAXBException { String url = getContextBaseUrl() + "/api/configuration/strongbox/storages/" + storageId + "/" + repositoryId; WebTarget resource = getClientInstance().target(url); setupAuthentication(resource); final Response response = resource.request(MediaType.APPLICATION_JSON).get(); RepositoryData repository = null; if (response.getStatus() == 200) { repository = response.readEntity(RepositoryData.class); } else { displayResponseError(response); } return repository; }
Source:
private String startPasswordDialog(String user) throws IOException { log.debug("starting password dialog."); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println(String.format("Please enter a password for %s:",user)); return br.readLine(); }

Target:
private String startPasswordDialog(String user) throws IOException { log.debug("starting password dialog."); System.out.println(String.format("Please enter a password for %s:",user)); return new String(System.console().readPassword()); }
Source:
public SentenceSample read() throws IOException { StringBuilder sentencesString = new StringBuilder(); List<Span> sentenceSpans = new LinkedList<Span>(); String sentence; while ((sentence = samples.read()) != null) { int begin = sentencesString.length(); sentence = sentence.trim(); sentencesString.append(sentence); while (sentence != null && !endsWith(sentence,'.', '!', '?')) { sentence = samples.read(); } if (sentence != null) { int end = sentencesString.length(); sentenceSpans.add(new Span(begin, end)); sentencesString.append(' '); } if (sentenceSpans.size() > 24) { break; } } if (sentenceSpans.size() > 0) { return new SentenceSample(sentencesString.toString(), sentenceSpans.toArray(new Span[sentenceSpans.size()])); } else { return null; } }

Target:
public SentenceSample read() throws IOException { StringBuilder sentencesString = new StringBuilder(); List<Span> sentenceSpans = new LinkedList<>(); String sentence; for (int i = 0; i < 25 && (sentence = samples.read()) != null; i++) { int begin = sentencesString.length(); sentence = sentence.trim(); sentencesString.append(sentence); int end = sentencesString.length(); sentenceSpans.add(new Span(begin, end)); sentencesString.append(' '); } if (sentenceSpans.size() > 0) { return new SentenceSample(sentencesString.toString(), sentenceSpans.toArray(new Span[sentenceSpans.size()])); } return null; }
Source:
public static ProducerInfo getProducerInfo(String tenantId, Span serverSpan, SpanCache spanCache) { String clientSpanId = SpanUniqueIdGenerator.getClientId(serverSpan.getId()); if (spanCache != null && clientSpanId != null) { Span clientSpan = spanCache.get(tenantId, clientSpanId); Span current = clientSpan; while (current != null && !current.serverSpan() && !current.topLevelSpan()) { current = spanCache.get(tenantId, current.getParentId()); } if (current != null) { ProducerInfo pi = new ProducerInfo(); pi.setDuration(clientSpan.getDuration()); pi.setTimestamp(clientSpan.getTimestamp() / 1000); pi.setFragmentId(clientSpan.getId()); List<Property> spanProperties = clientSpan.properties(); pi.getProperties().addAll(spanProperties); pi.setHostAddress(Span.ipv4Address(spanProperties)); pi.setId(clientSpan.getId()); pi.setMultipleConsumers(false); pi.setSourceOperation(current.operation()); if (current.serverSpan()) { pi.setSourceUri(current.url().getPath()); } else { pi.setSourceUri(Constants.URI_CLIENT_PREFIX + clientSpan.url().getPath()); } return pi; } } return null; }

Target:
public static ProducerInfo getProducerInfo(String tenantId, Span serverSpan, SpanCache spanCache) { String clientSpanId = SpanUniqueIdGenerator.getClientId(serverSpan.getId()); if (spanCache != null && clientSpanId != null) { Span clientSpan = spanCache.get(tenantId, clientSpanId); Span rootOrServerSpan = findRootOrServerSpan(tenantId, clientSpan, spanCache); if (rootOrServerSpan != null) { ProducerInfo pi = new ProducerInfo(); pi.setDuration(clientSpan.getDuration()); pi.setTimestamp(clientSpan.getTimestamp() / 1000); pi.setFragmentId(clientSpan.getId()); List<Property> spanProperties = clientSpan.properties(); pi.getProperties().addAll(spanProperties); pi.setHostAddress(Span.ipv4Address(spanProperties)); pi.setId(clientSpan.getId()); pi.setMultipleConsumers(false); pi.setSourceOperation(rootOrServerSpan.operation()); if (rootOrServerSpan.serverSpan()) { pi.setSourceUri(rootOrServerSpan.url().getPath()); } else { pi.setSourceUri(Constants.URI_CLIENT_PREFIX + clientSpan.url().getPath()); } return pi; } } return null; }
Source:
public void handle(Request request, Response response) throws Exception { try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = qProfileWsSupport.getOrganizationByKey(dbSession, request.param(PARAM_ORGANIZATION)); qProfileWsSupport.checkQProfileAdminPermission(organization); CreateRequest createRequest = toRequest(request, organization); writeProtobuf(doHandle(dbSession, createRequest, request, organization), request, response); } }

Target:
public void handle(Request request, Response response) throws Exception { userSession.checkLoggedIn(); try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = qProfileWsSupport.getOrganizationByKey(dbSession, request.param(PARAM_ORGANIZATION)); userSession.checkPermission(ADMINISTER_QUALITY_PROFILES, organization); CreateRequest createRequest = toRequest(request, organization); writeProtobuf(doHandle(dbSession, createRequest, request, organization), request, response); } }
Source:
public static AbstractReadExecutor getReadExecutor(SinglePartitionReadCommand command, ConsistencyLevel consistencyLevel, long queryStartNanoTime) throws UnavailableException { Keyspace keyspace = Keyspace.open(command.metadata().keyspace); ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(command.metadata().id); SpeculativeRetryPolicy retry = cfs.metadata().params.speculativeRetry; ReplicaPlan.ForTokenRead replicaPlan = ReplicaPlans.forRead(keyspace, command.partitionKey().getToken(), consistencyLevel, retry); if (retry.equals(NeverSpeculativeRetryPolicy.INSTANCE) || consistencyLevel == ConsistencyLevel.EACH_QUORUM) return new NeverSpeculatingReadExecutor(cfs, command, replicaPlan, queryStartNanoTime, false); if (replicaPlan.contact().size() == replicaPlan.candidates().size()) { boolean recordFailedSpeculation = consistencyLevel != ConsistencyLevel.ALL; return new NeverSpeculatingReadExecutor(cfs, command, replicaPlan, queryStartNanoTime, recordFailedSpeculation); } if (retry.equals(AlwaysSpeculativeRetryPolicy.INSTANCE)) return new AlwaysSpeculatingReadExecutor(cfs, command, replicaPlan, queryStartNanoTime); else return new SpeculatingReadExecutor(cfs, command, replicaPlan, queryStartNanoTime); }

Target:
public static AbstractReadExecutor getReadExecutor(SinglePartitionReadCommand command, ConsistencyLevel consistencyLevel, long queryStartNanoTime) throws UnavailableException { Keyspace keyspace = Keyspace.open(command.metadata().keyspace); ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(command.metadata().id); SpeculativeRetryPolicy retry = cfs.metadata().params.speculativeRetry; ReplicaPlan.ForTokenRead replicaPlan = ReplicaPlans.forRead(keyspace, command.partitionKey().getToken(), consistencyLevel, retry); if (retry.equals(NeverSpeculativeRetryPolicy.INSTANCE) || consistencyLevel == ConsistencyLevel.EACH_QUORUM) return new NeverSpeculatingReadExecutor(cfs, command, replicaPlan, queryStartNanoTime, false); if (replicaPlan.contacts().size() == replicaPlan.candidates().size()) { boolean recordFailedSpeculation = consistencyLevel != ConsistencyLevel.ALL; return new NeverSpeculatingReadExecutor(cfs, command, replicaPlan, queryStartNanoTime, recordFailedSpeculation); } if (retry.equals(AlwaysSpeculativeRetryPolicy.INSTANCE)) return new AlwaysSpeculatingReadExecutor(cfs, command, replicaPlan, queryStartNanoTime); else return new SpeculatingReadExecutor(cfs, command, replicaPlan, queryStartNanoTime); }
Source:
public <R extends HttpRequest> R bindToRequest(R request, Object toBind) { throw new IllegalStateException("CreateInstance is a POST operation"); }

Target:
public <R extends HttpRequest> R bindToRequest(R request, Object toBind) { throw new IllegalStateException("Update launch configuration is a POST operation"); }
Source:
private void checkStoreAvailability() { if (!enabled) return; if (!isAvailable()) { throw unavailableException; } }

Target:
private void checkStoreAvailability() { if (!enabled) return; if (unavailableException != null) { throw unavailableException; } }
Source:
public void testCacheHint() throws InterruptedException { final AtomicInteger counter = new AtomicInteger(); Observable<String> o = Observable.create(new OnSubscribe<String>() { @Override public void call(final Subscriber<? super String> observer) { new Thread(new Runnable() { @Override public void run() { counter.incrementAndGet(); observer.onNext("one"); observer.onCompleted(); } }).start(); } }).cache(1); final CountDownLatch latch = new CountDownLatch(2); o.subscribe(new Action1<String>() { @Override public void call(String v) { assertEquals("one", v); latch.countDown(); } }); o.subscribe(new Action1<String>() { @Override public void call(String v) { assertEquals("one", v); latch.countDown(); } }); if (!latch.await(1000, TimeUnit.MILLISECONDS)) { fail("subscriptions did not receive values"); } assertEquals(1, counter.get()); }

Target:
public void testCacheHint() throws InterruptedException { final AtomicInteger counter = new AtomicInteger(); Observable<String> o = Observable.create(new OnSubscribe<String>() { @Override public void call(final Subscriber<? super String> observer) { new Thread(new Runnable() { @Override public void run() { counter.incrementAndGet(); observer.onNext("one"); observer.onCompleted(); } }).start(); } }).cache(1); final CountDownLatch latch = new CountDownLatch(2); o.subscribe(new Action1<String>() { @Override public void call(String v) { assertEquals("one", v); latch.countDown(); } }); o.subscribe(new Action1<String>() { @Override public void call(String v) { assertEquals("one", v); latch.countDown(); } }); assertTrue("subscriptions did not receive values", latch.await(1000, TimeUnit.MILLISECONDS)); assertEquals(1, counter.get()); }
Source:
public void onNext(final AggregationMessage message) { LOG.log(Level.INFO, "Received aggregation message {0}", message); final String slaveId = message.getSourceId().toString(); final String data = codec.decode(message.getData().array()); if (!slaveIds.contains(slaveId)) { slaveIds.add(slaveId); } if (slaveId.startsWith(RemoteEMDriver.CONTEXT_ID_PREFIX) && data.startsWith(RemoteEMDriver.TASK_ID_PREFIX) && slaveId.substring(RemoteEMDriver.CONTEXT_ID_PREFIX.length()) .equals(data.substring(RemoteEMDriver.TASK_ID_PREFIX.length()))) { msgCountDown.countDown(); } else { throw new RuntimeException(String.format("SlaveId %s should not send message with data %s.", slaveId, data)); } }

Target:
public void onNext(final AggregationMessage message) { LOG.log(Level.INFO, "Received aggregation message {0}", message); final String workerId = message.getSourceId().toString(); final String data = codec.decode(message.getData().array()); if (!workerIds.contains(workerId)) { workerIds.add(workerId); } if (validateMsg(workerId, data)) { msgCountDown.countDown(); } else { throw new RuntimeException(String.format("WorkerId %s should not send message with data %s.", workerId, data)); } }
Source:
public void testAssertingIteratorUsesLenientOrdering() { final List<SAMRecord> looselySorted = Arrays.asList(createRecord(1, 10), createRecord(1, 1), createRecord(2, 1)); final SAMRecordCoordinateComparator coordinateComparator = new SAMRecordCoordinateComparator(); final List<SAMRecord> sortedWithFileOrderComparator = looselySorted.stream() .sorted(coordinateComparator::fileOrderCompare) .collect(Collectors.toList()); Assert.assertEquals( sortedWithFileOrderComparator, looselySorted); final List<SAMRecord> sortedWithFullOrderComparator = looselySorted.stream() .sorted(coordinateComparator) .collect(Collectors.toList()); Assert.assertNotEquals(sortedWithFullOrderComparator, looselySorted); final SamReader.AssertingIterator iter = new SamReader.AssertingIterator( wrapInCloseableIterator(looselySorted)); iter.assertSorted(SAMFileHeader.SortOrder.coordinate); int count = 0; while (iter.hasNext()) { iter.next(); count++; } Assert.assertEquals(count, 3); }

Target:
public void testAssertingIteratorUsesLenientOrdering() { final List<SAMRecord> looselySorted = Arrays.asList(createRecord(1, 10), createRecord(1, 1), createRecord(2, 1)); final SAMRecordCoordinateComparator coordinateComparator = new SAMRecordCoordinateComparator(); final List<SAMRecord> sortedWithFileOrderComparator = looselySorted.stream() .sorted(coordinateComparator::fileOrderCompare) .collect(Collectors.toList()); Assert.assertEquals(sortedWithFileOrderComparator, looselySorted); final List<SAMRecord> sortedWithFullOrderComparator = looselySorted.stream() .sorted(coordinateComparator) .collect(Collectors.toList()); Assert.assertNotEquals(sortedWithFullOrderComparator, looselySorted); final SamReader.AssertingIterator iter = new SamReader.AssertingIterator(new PeekableIterator<>(looselySorted.iterator())); iter.assertSorted(SAMFileHeader.SortOrder.coordinate); int count = 0; while (iter.hasNext()) { iter.next(); count++; } Assert.assertEquals(count, 3); }
Source:
public void removeTuple(EntityKey key) { DBCollection collection = this.getCollection( key ); DBObject toDelete = this.getObject( key ); if ( toDelete != null ) { collection.remove( toDelete ); } else { log.tracef( "Unable to remove %1$s (object not found)", key.getId().toString() ); } }

Target:
public void removeTuple(EntityKey key) { DBCollection collection = this.getCollection( key ); DBObject toDelete = this.getObject( key ); if ( toDelete != null ) { collection.remove( toDelete ); } else { if ( log.isTraceEnabled() ) { log.tracef( "Unable to remove %1$s (object not found)", key.getColumnValues()[0] ); } } }