auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void alteringSomeParametersDuringClone() throws Exception { destRepo = new File(ResourcesPlugin.getWorkspace() .getRoot().getLocation().toFile(), "test2"); importWizard.openWizard(); RepoPropertiesPage repoProperties = importWizard.openRepoPropertiesPage(); RepoRemoteBranchesPage remoteBranches = repoProperties .nextToRemoteBranches(r.getUri()); remoteBranches.deselectAllBranches(); remoteBranches .assertErrorMessage("At least one branch must be selected."); remoteBranches.assertNextIsDisabled(); remoteBranches.selectBranches(SampleTestRepository.FIX); remoteBranches.assertNextIsEnabled(); WorkingCopyPage workingCopy = remoteBranches.nextToWorkingCopy(); workingCopy.setDirectory(destRepo.toString()); workingCopy.assertBranch(SampleTestRepository.FIX); workingCopy.setRemoteName("src"); workingCopy.waitForCreate(); Repository repository = new RepositoryBuilder().setGitDir( new File(destRepo, Constants.DOT_GIT)).build(); assertNotNull(repository.resolve("src/" + SampleTestRepository.FIX)); assertNull(repository.resolve("src/master")); assertEquals(repository.resolve("stable"), repository .resolve("src/stable")); assertNotNull(repository.resolve(Constants.R_TAGS + SampleTestRepository.v2_0_name).name()); assertTrue(repository.getAllRefs().size() >= 4); bot.button("Cancel").click(); }

Target:
public void alteringSomeParametersDuringClone() throws Exception { destRepo = new File(ResourcesPlugin.getWorkspace() .getRoot().getLocation().toFile(), "test2"); importWizard.openWizard(); RepoPropertiesPage repoProperties = importWizard.openRepoPropertiesPage(); RepoRemoteBranchesPage remoteBranches = repoProperties .nextToRemoteBranches(r.getUri()); remoteBranches.deselectAllBranches(); remoteBranches .assertErrorMessage("At least one branch must be selected."); remoteBranches.assertNextIsDisabled(); remoteBranches.selectBranches(SampleTestRepository.FIX); remoteBranches.assertNextIsEnabled(); WorkingCopyPage workingCopy = remoteBranches.nextToWorkingCopy(); workingCopy.setDirectory(destRepo.toString()); workingCopy.assertBranch(SampleTestRepository.FIX); workingCopy.setRemoteName("src"); workingCopy.waitForCreate(); Repository repository = FileRepositoryBuilder.create(new File(destRepo, Constants.DOT_GIT)); assertNotNull(repository.resolve("src/" + SampleTestRepository.FIX)); assertNull(repository.resolve("src/master")); assertEquals(repository.resolve("stable"), repository .resolve("src/stable")); assertNotNull(repository.resolve(Constants.R_TAGS + SampleTestRepository.v2_0_name).name()); assertTrue(repository.getAllRefs().size() >= 4); bot.button("Cancel").click(); }
Source:
public void setSelectedDevices(List<StorageDevice> selectedDevices) { getStorageDevices().setSelectedItems(selectedDevices); }

Target:
protected void setSelectedDevices(List<StorageDevice> selectedDevices) { getStorageDevices().setSelectedItems(selectedDevices); }
Source:
public void processTraces(Traces traces, String projectId) { URL url; String urlString = String.format("%s/v1/projects/%s/traces", hostUrl, projectId); try { url = new URL(urlString); } catch (MalformedURLException ex) { logger.severe("Malformed URL: " + urlString); return; } String jsonRequest; try { jsonRequest = JsonFormat.printer().print(traces); } catch (InvalidProtocolBufferException ex) { logger.severe("Failed to format: " + traces.toString()); return; } try { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("X-HTTP-Method-Override", "PATCH"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Authorization", "Bearer " + oAuth2Credentials.getAccessToken().getTokenValue()); byte[] responseBytes = ByteStreams.toByteArray(connection.getInputStream()); int responseCode = connection.getResponseCode(); if (responseCode != 200) { logger.severe(String.format("Unsuccessful patchTraces (%s):\nResponse: %s", responseCode, new String(responseBytes))); } } catch (IOException ex) { logger.severe("Failed to send: " + traces.toString()); } }

Target:
private void processTraces(Traces traces, String projectId) { URL url; String urlString = String.format("%s/v1/projects/%s/traces", hostUrl, projectId); try { url = new URL(urlString); } catch (MalformedURLException ex) { logger.severe("Malformed URL: " + urlString); return; } String jsonRequest; try { jsonRequest = JsonFormat.printer().print(traces); } catch (InvalidProtocolBufferException ex) { logger.severe("Failed to format: " + traces.toString()); return; } try { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("X-HTTP-Method-Override", "PATCH"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty( "Authorization", "Bearer " + oAuth2Credentials.getAccessToken().getTokenValue()); InputStream responseStream = connection.getInputStream(); int responseCode = connection.getResponseCode(); if (responseCode != 200) { byte[] responseBytes = ByteStreams.toByteArray(responseStream); logger.severe(String.format("Unsuccessful patchTraces (%s):\nResponse: %s", responseCode, new String(responseBytes))); } } catch (IOException ex) { logger.severe("Failed to send: " + traces.toString()); } }
Source:
public MobFileCleanerChore(HMaster master) { super(master.getServerName() + "-MobFileCleanerChore", master, master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD, MobConstants.DEFAULT_MOB_CLEANER_PERIOD), master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD, MobConstants.DEFAULT_MOB_CLEANER_PERIOD), TimeUnit.SECONDS); this.master = master; try (Connection conn = ConnectionFactory.createConnection(master.getConfiguration())) { this.connection = conn; } catch (IOException e) { LOG.warn("Failed to create connection", e); } cleaner = new ExpiredMobFileCleaner(connection); cleaner.setConf(master.getConfiguration()); checkObsoleteConfigurations(); }

Target:
public MobFileCleanerChore(HMaster master) { super(master.getServerName() + "-MobFileCleanerChore", master, master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD, MobConstants.DEFAULT_MOB_CLEANER_PERIOD), master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD, MobConstants.DEFAULT_MOB_CLEANER_PERIOD), TimeUnit.SECONDS); this.master = master; cleaner = new ExpiredMobFileCleaner(master.getConnection()); cleaner.setConf(master.getConfiguration()); checkObsoleteConfigurations(); }
Source:
public void extractAarLib( Artifact aarArtifact ) throws MojoExecutionException { final File aarFile = artifactResolverHelper.resolveArtifactToFile( aarArtifact ); if ( aarFile.isDirectory() ) { log.warn( "The aar artifact points to '" + aarFile + "' which is a directory; skipping unpacking it." ); return; } final UnArchiver unArchiver = new ZipUnArchiver( aarFile ) { @Override protected Logger getLogger() { return new ConsoleLogger( log.getThreshold(), "dependencies-unarchiver" ); } }; final File aarDirectory = getUnpackedLibFolder( aarArtifact ); aarDirectory.mkdirs(); unArchiver.setDestDirectory( aarDirectory ); log.debug( "Extracting AAR to " + aarDirectory ); try { unArchiver.extract(); } catch ( ArchiverException e ) { throw new MojoExecutionException( "ArchiverException while extracting " + aarDirectory.getAbsolutePath() + ". Message: " + e.getLocalizedMessage(), e ); } final File jniFolder = new File( aarDirectory, AarMojo.NATIVE_LIBRARIES_FOLDER ); final File libsFolder = new File( aarDirectory, "libs" ); if ( !jniFolder.exists() && libsFolder.isDirectory() && libsFolder.exists() ) { String[] natives = libsFolder.list( new PatternFilenameFilter( "^.*(?<!(?i)\\.jar)$" ) ); if ( natives.length > 0 ) { log.debug( "Moving AAR native libraries from libs to jni folder" ); for ( String nativeLibPath : natives ) { try { FileUtils.moveToDirectory( new File( libsFolder, nativeLibPath ), jniFolder, true ); } catch ( IOException e ) { throw new MojoExecutionException( "Could not move native libraries from " + libsFolder, e ); } } } } }

Target:
public void extractAarLib( Artifact aarArtifact ) throws MojoExecutionException { final File aarFile = artifactResolverHelper.resolveArtifactToFile( aarArtifact ); if ( aarFile.isDirectory() ) { log.warn( "The aar artifact points to '" + aarFile + "' which is a directory; skipping unpacking it." ); return; } final UnArchiver unArchiver = new ZipUnArchiver( aarFile ) { @Override protected Logger getLogger() { return new ConsoleLogger( log.getThreshold(), "dependencies-unarchiver" ); } }; final File aarDirectory = getUnpackedLibFolder( aarArtifact ); aarDirectory.mkdirs(); unArchiver.setDestDirectory( aarDirectory ); log.debug( "Extracting AAR to " + aarDirectory ); try { unArchiver.extract(); } catch ( ArchiverException e ) { throw new MojoExecutionException( "ArchiverException while extracting " + aarDirectory.getAbsolutePath() + ". Message: " + e.getLocalizedMessage(), e ); } final File jniFolder = new File( aarDirectory, AarMojo.NATIVE_LIBRARIES_FOLDER ); final File libsFolder = new File( aarDirectory, ApklibMojo.NATIVE_LIBRARIES_FOLDER ); if ( !jniFolder.exists() && libsFolder.isDirectory() && libsFolder.exists() ) { String[] natives = libsFolder.list( new PatternFilenameFilter( "^.*(?<!(?i)\\.jar)$" ) ); if ( natives.length > 0 ) { log.debug( "Moving AAR native libraries from libs to jni folder" ); for ( String nativeLibPath : natives ) { try { FileUtils.moveToDirectory( new File( libsFolder, nativeLibPath ), jniFolder, true ); } catch ( IOException e ) { throw new MojoExecutionException( "Could not move native libraries from " + libsFolder, e ); } } } } }
Source:
public boolean isAccountLinkingEnabled () { return AccountLinkingStatus.ENABLED.equals(getStatus()) ? true : false; }

Target:
public boolean isAccountLinkingEnabled () { return AccountLinkingStatus.ENABLED.equals(getStatus()); }
Source:
private void runAnalysisAndUpdateMarkers(@Nullable Server server, Map<ISonarLintFile, IDocument> docPerFiles, final IProgressMonitor monitor, Map<String, String> mergedExtraProps, List<ClientInputFile> inputFiles, Path analysisWorkDir) throws CoreException { StandaloneAnalysisConfiguration config; IPath projectLocation = getProject().getResource().getLocation(); Path projectBaseDir = projectLocation != null ? projectLocation.toFile().toPath() : analysisWorkDir; if (server != null) { SonarLintLogger.get().debug("Connected mode (using configuration of '" + getProjectConfig().getModuleKey() + "' in server '" + getProjectConfig().getServerId() + "')"); config = new ConnectedAnalysisConfiguration(trimToNull(getProjectConfig().getModuleKey()), projectBaseDir, getProject().getWorkingDir(), inputFiles, mergedExtraProps); } else { SonarLintLogger.get().debug("Standalone mode (project not bound)"); config = new StandaloneAnalysisConfiguration(projectBaseDir, getProject().getWorkingDir(), inputFiles, mergedExtraProps); } Map<ISonarLintIssuable, List<Issue>> issuesPerResource = new LinkedHashMap<>(); filesToAnalyze.keySet().forEach(slFile -> issuesPerResource.put(slFile, new ArrayList<>())); long start = System.currentTimeMillis(); AnalysisResults result = run(server, config, issuesPerResource, monitor); if (!monitor.isCanceled() && result != null) { updateTelemetry(inputFiles, start); updateMarkers(server, docPerFiles, issuesPerResource, result, triggerType, monitor); } }

Target:
private void runAnalysisAndUpdateMarkers(@Nullable Server server, Map<ISonarLintFile, IDocument> docPerFiles, final IProgressMonitor monitor, Map<String, String> mergedExtraProps, List<ClientInputFile> inputFiles, Path analysisWorkDir) throws CoreException { StandaloneAnalysisConfiguration config; IPath projectLocation = getProject().getResource().getLocation(); Path projectBaseDir = projectLocation != null ? projectLocation.toFile().toPath() : analysisWorkDir; if (server != null) { SonarLintLogger.get().debug("Connected mode (using configuration of '" + getProjectConfig().getModuleKey() + "' in server '" + getProjectConfig().getServerId() + "')"); config = new ConnectedAnalysisConfiguration(trimToNull(getProjectConfig().getModuleKey()), projectBaseDir, getProject().getWorkingDir(), inputFiles, mergedExtraProps); } else { SonarLintLogger.get().debug("Standalone mode (project not bound)"); config = new StandaloneAnalysisConfiguration(projectBaseDir, getProject().getWorkingDir(), inputFiles, mergedExtraProps); } Map<ISonarLintIssuable, List<Issue>> issuesPerResource = new LinkedHashMap<>(); filesToAnalyze.keySet().forEach(slFile -> issuesPerResource.put(slFile, new ArrayList<>())); long start = System.currentTimeMillis(); AnalysisResults result = run(server, config, issuesPerResource, monitor); if (!monitor.isCanceled() && result != null) { updateMarkers(server, docPerFiles, issuesPerResource, result, triggerType, monitor); updateTelemetry(inputFiles, start); } }
Source:
public void choiceParameterIssue() throws Exception { try (MockSCMController c = MockSCMController.create()) { c.createRepository("foo"); BasicMultiBranchProject prj = r.jenkins.createProject(BasicMultiBranchProject.class, "foo"); prj.setCriteria(null); BranchSource source = new BranchSource(new MockSCMSource(c, "foo", new MockSCMDiscoverBranches())); ParameterDefinitionBranchPropertyImpl instance = new ParameterDefinitionBranchPropertyImpl(); instance.setParameterDefinitions(Collections.<ParameterDefinition>singletonList( new ChoiceParameterDefinition("CHOOSE", new String[] { "a", "b" }, "choose one") )); source.setStrategy(new DefaultBranchPropertyStrategy(new BranchProperty[]{ instance, new BasicDummyStepBranchProperty() })); prj.getSourcesList().add(source); r.configRoundtrip(prj); assertThat(prj.getSources().get(0).getStrategy(), instanceOf(DefaultBranchPropertyStrategy.class)); DefaultBranchPropertyStrategy strategy = (DefaultBranchPropertyStrategy) prj.getSources().get(0).getStrategy(); assertThat(strategy.getProps().get(0), instanceOf(ParameterDefinitionBranchPropertyImpl.class)); ParameterDefinitionBranchPropertyImpl property = (ParameterDefinitionBranchPropertyImpl) strategy.getProps().get(0); assertThat(property.getParameterDefinitions(), contains( allOf( instanceOf(ChoiceParameterDefinition.class), hasProperty("name", is("CHOOSE")), hasProperty("choices", is(Arrays.asList("a", "b"))), hasProperty("description", is("choose one")) ) )); } }

Target:
public void choiceParameterIssue() throws Exception { assumeThat(Jenkins.getVersion(), greaterThanOrEqualTo(new VersionNumber("2.242"))); try (MockSCMController c = MockSCMController.create()) { c.createRepository("foo"); BasicMultiBranchProject prj = r.jenkins.createProject(BasicMultiBranchProject.class, "foo"); prj.setCriteria(null); BranchSource source = new BranchSource(new MockSCMSource(c, "foo", new MockSCMDiscoverBranches())); ParameterDefinitionBranchPropertyImpl instance = new ParameterDefinitionBranchPropertyImpl(); instance.setParameterDefinitions(Collections.<ParameterDefinition>singletonList( new ChoiceParameterDefinition("CHOOSE", new String[] { "a", "b" }, "choose one") )); source.setStrategy(new DefaultBranchPropertyStrategy(new BranchProperty[]{ instance, new BasicDummyStepBranchProperty() })); prj.getSourcesList().add(source); r.configRoundtrip(prj); assertThat(prj.getSources().get(0).getStrategy(), instanceOf(DefaultBranchPropertyStrategy.class)); DefaultBranchPropertyStrategy strategy = (DefaultBranchPropertyStrategy) prj.getSources().get(0).getStrategy(); assertThat(strategy.getProps().get(0), instanceOf(ParameterDefinitionBranchPropertyImpl.class)); ParameterDefinitionBranchPropertyImpl property = (ParameterDefinitionBranchPropertyImpl) strategy.getProps().get(0); assertThat(property.getParameterDefinitions(), contains( allOf( instanceOf(ChoiceParameterDefinition.class), hasProperty("name", is("CHOOSE")), hasProperty("choices", is(Arrays.asList("a", "b"))), hasProperty("description", is("choose one")) ) )); } }
Source:
public void onNodeDragDrop(TreeDragDropEvent event) { int dropIndex = event.getDropIndex(); DocStructInterface dropDocStruct = (DocStructInterface) event.getDropNode().getData(); DocStructInterface dragDocStruct = (DocStructInterface) event.getDragNode().getData(); if (event.getDropNode().getParent().getData().equals("root")) { Helper.setFehlerMeldung("Only one root element allowed"); } else { if (dropDocStruct.isDocStructTypeAllowedAsChild(dragDocStruct.getDocStructType())) { this.docStruct = dragDocStruct; this.docStruct.getParent().removeChild(dragDocStruct); try { addNewDocStructToExistingDocStruct(dropDocStruct, dragDocStruct, dropIndex); } catch (TypeNotAllowedAsChildException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung(e.getMessage()); } } else { Helper.setFehlerMeldung( dragDocStruct.getDocStructType() + " ot allowed as child of " + dropDocStruct.getDocStructType()); } } }

Target:
public void onNodeDragDrop(TreeDragDropEvent event) { int dropIndex = event.getDropIndex(); DocStructInterface dropDocStruct = (DocStructInterface) event.getDropNode().getData(); DocStructInterface dragDocStruct = (DocStructInterface) event.getDragNode().getData(); if (event.getDropNode().getParent().getData().equals("root")) { Helper.setFehlerMeldung("Only one root element allowed"); } else { if (dropDocStruct.isDocStructTypeAllowedAsChild(dragDocStruct.getDocStructType())) { this.docStruct = dragDocStruct; this.docStruct.getParent().removeChild(dragDocStruct); try { addNewDocStructToExistingDocStruct(dropDocStruct, dragDocStruct, dropIndex); } catch (TypeNotAllowedAsChildException e) { Helper.setErrorMessage(e.getMessage(), logger, e); } } else { Helper.setFehlerMeldung( dragDocStruct.getDocStructType() + " not allowed as child of " + dropDocStruct.getDocStructType()); } } }
Source:
public void run() { ACL.impersonate(ACL.SYSTEM); super.run(); }

Target:
public void run() { SecurityContext old = ACL.impersonate(ACL.SYSTEM); try { super.run(); } finally { SecurityContextHolder.setContext(old); } }
Source:
public List<Span> getChildren(String tenant, String id) { return null; }

Target:
public List<Span> getChildren(String tenant, String id) { throw new UnsupportedOperationException(); }
Source:
public static boolean filteredEquals(EObject property, EObject other, EStructuralFeature... filteredFeatures) { if (property == null) { return other == null; } if (other == null) { return false; } if (property.eClass() != other.eClass()) { return false; } final List<EStructuralFeature> filter = Arrays.asList(filteredFeatures); for (final EStructuralFeature esf : property.eClass().getEStructuralFeatures()) { if (filter.contains(esf)) { continue; } if (!equalFeature(property, other, esf)) { return false; } } return true; }

Target:
public static boolean filteredEquals(EObject property, EObject other, EStructuralFeature... filteredFeatures) { if (property == null) { return other == null; } if (other == null) { return false; } if (property.eClass() != other.eClass()) { return false; } final List<EStructuralFeature> filter = Arrays.asList(filteredFeatures); for (final EStructuralFeature esf : property.eClass().getEAllStructuralFeatures()) { if (filter.contains(esf)) { continue; } if (!equalFeature(property, other, esf)) { return false; } } return true; }
Source:
public AboutDialogContents(ProductInfo info, ProductEditionInfo editionInfo) { initWidget(uiBinder.createAndBindUi(this)); versionLabel.setText(info.version + "for " + info.os); productInfo.getElement().setId("productinfo"); gplLinkLabel.getElement().setId("gplLinkLabel"); Roles.getLinkRole().setAriaDescribedbyProperty(gplLink.getElement(), Id.of(gplLinkLabel.getElement())); userAgentLabel.setText( Window.Navigator.getUserAgent()); buildLabel.setText( "\"" + info.release_name + "\" (" + info.commit.substring(0, 8) + ", " + info.date + ")"); productName.setText(editionInfo.editionName()); copyrightYearLabel.setText("2009-" + info.copyright_year); showNoticelink_.setClickHandler(() -> { RStudioGinjector.INSTANCE.getServer().getProductNotice(new ServerRequestCallback<ProductNotice>() { @Override public void onResponseReceived(ProductNotice notice) { AboutOpenSourceDialog about = new AboutOpenSourceDialog(notice); about.showModal(); } @Override public void onError(ServerError error) { Debug.logError(error); } }); }); if (editionInfo.proLicense()) { gplNotice.setVisible(false); if (Desktop.hasDesktopFrame()) { licenseBox.setVisibleLines(3); licenseLabel.setVisible(true); licenseBox.setVisible(true); licenseBox.setText("Loading..."); Desktop.getFrame().getLicenseStatusMessage(licenseStatus -> { licenseBox.setText(licenseStatus); }); } } }

Target:
public AboutDialogContents(ProductInfo info, ProductEditionInfo editionInfo) { initWidget(uiBinder.createAndBindUi(this)); versionLabel.setText(info.version); productInfo.getElement().setId("productinfo"); gplLinkLabel.getElement().setId("gplLinkLabel"); Roles.getLinkRole().setAriaDescribedbyProperty(gplLink.getElement(), Id.of(gplLinkLabel.getElement())); userAgentLabel.setText( Window.Navigator.getUserAgent()); buildLabel.setText( "\"" + info.release_name + "\" (" + info.commit.substring(0, 8) + ", " + info.date + ") for " + info.os); productName.setText(editionInfo.editionName()); copyrightYearLabel.setText("2009-" + info.copyright_year); showNoticelink_.setClickHandler(() -> { RStudioGinjector.INSTANCE.getServer().getProductNotice(new ServerRequestCallback<ProductNotice>() { @Override public void onResponseReceived(ProductNotice notice) { AboutOpenSourceDialog about = new AboutOpenSourceDialog(notice); about.showModal(); } @Override public void onError(ServerError error) { Debug.logError(error); } }); }); if (editionInfo.proLicense()) { gplNotice.setVisible(false); if (Desktop.hasDesktopFrame()) { licenseBox.setVisibleLines(3); licenseLabel.setVisible(true); licenseBox.setVisible(true); licenseBox.setText("Loading..."); Desktop.getFrame().getLicenseStatusMessage(licenseStatus -> { licenseBox.setText(licenseStatus); }); } } }
Source:
public String evaluate(TransactionContext txnCtx, Input[] args) { assert args.length >= 2 : "number of args must be 2 or 3"; if (args[0].value() == null) { return null; } if (args[1].value() == null) { return (String) args[0].value(); } LpadRpadFunctionImplHelper helper = new LpadRpadFunctionImplHelper(args); helper.pad(); helper.copyString(); return helper.getRet().toString(); }

Target:
public String evaluate(TransactionContext txnCtx, Input[] args) { assert args.length >= 2 : "number of args must be 2 or 3"; String toPad = (String) args[0].value(); Number length = (Number) args[1].value(); if (toPad == null) { return null; } if (length == null) { return toPad; } String filler = null; if (args.length == 3) { filler = (String) args[2].value(); } int len = length.intValue(); final String fillerChars = (filler == null) ? " " : filler; int fillerLen = fillerChars.length(); if (len < 0) { return ""; } if (toPad.length() > len) { return toPad.substring(0, len); } if (fillerLen <= 0) { return toPad; } int toPadLen = len - toPad.length(); StringBuilder ret = new StringBuilder(len); Collections.nCopies(toPadLen / fillerLen, fillerLen) .forEach(n -> ret.append(fillerChars)); ret.append(fillerChars.substring(0, toPadLen % fillerLen)); ret.append(toPad); return ret.toString(); }
Source:
private boolean deQueueAction(ContainerPlacementRequestMessage requestMessage) { if (checkIfActiveOrStandbyContainerHasActivePlacementAction(requestMessage)) { return false; } if (samzaApplicationState.failedProcessors.containsKey(requestMessage.getProcessorId())) { return true; } if (!samzaApplicationState.runningProcessors.containsKey(requestMessage.getProcessorId()) || samzaApplicationState.pendingProcessors.containsKey(requestMessage.getProcessorId())) { LOG.info("ContainerPlacement request: is en-queued because container is pending start", requestMessage); return false; } return true; }

Target:
private boolean deQueueAction(ContainerPlacementRequestMessage requestMessage) { if (checkIfActiveOrStandbyContainerHasActivePlacementAction(requestMessage)) { return false; } if (samzaApplicationState.failedProcessors.containsKey(requestMessage.getProcessorId())) { LOG.info("ContainerPlacement request: is de-queued, container with Processor ID: has exhausted all retries and is in failed state", requestMessage, requestMessage.getProcessorId()); return true; } if (!samzaApplicationState.runningProcessors.containsKey(requestMessage.getProcessorId()) || samzaApplicationState.pendingProcessors.containsKey(requestMessage.getProcessorId())) { LOG.info("ContainerPlacement request: is en-queued because container is pending start", requestMessage); return false; } return true; }
Source:
public StackWalker.StackFrame apply(Stream<StackWalker.StackFrame> stackFrameStream) { boolean foundFqcn = false; Object[] frames = stackFrameStream.toArray(); for (int i = 0; i < frames.length ; ++i) { final String className = ((StackWalker.StackFrame) frames[i]).getClassName(); if (!foundFqcn) { foundFqcn = className.equals(fqcn); } else if (!className.equals(fqcn)) { return (StackWalker.StackFrame) frames[i]; } } return null; }

Target:
public StackWalker.StackFrame apply(Stream<StackWalker.StackFrame> stackFrameStream) { String fqcn = FQCN.get(); boolean foundFqcn = false; Object[] frames = stackFrameStream.toArray(); for (int i = 0; i < frames.length ; ++i) { final String className = ((StackWalker.StackFrame) frames[i]).getClassName(); if (!foundFqcn) { foundFqcn = className.equals(fqcn); } else if (!className.equals(fqcn)) { return (StackWalker.StackFrame) frames[i]; } } return null; }
Source:
public <T extends LwM2mResponse> T send(final Registration destination, final DownlinkRequest<T> request, Long timeout) throws InterruptedException { if (destination.getLwM2mQueue().isClientSleeping()) { return null; } final LwM2mModel model = modelProvider.getObjectModel(destination); CoapRequestBuilder coapRequestBuilder = new CoapRequestBuilder( new InetSocketAddress(destination.getAddress(), destination.getPort()), destination.getRootPath(), destination.getId(), destination.getEndpoint(), model, encoder); request.accept(coapRequestBuilder); final Request coapRequest = coapRequestBuilder.getRequest(); SyncRequestObserver<T> syncMessageObserver = new SyncRequestObserver<T>(coapRequest, timeout) { @Override public T buildResponse(Response coapResponse) { LwM2mResponseBuilder<T> lwm2mResponseBuilder = new LwM2mResponseBuilder<>(coapRequest, coapResponse, destination, model, observationService, decoder); request.accept(lwm2mResponseBuilder); return lwm2mResponseBuilder.getResponse(); } }; coapRequest.addMessageObserver(syncMessageObserver); addPendingRequest(destination, coapRequest); Endpoint endpoint = getEndpointForClient(destination); endpoint.sendRequest(coapRequest); if (destination.usesQueueMode() && !destination.getLwM2mQueue().isClientSleeping()) { destination.getLwM2mQueue().startClientAwakeTimer(); } return syncMessageObserver.waitForResponse(); }

Target:
public <T extends LwM2mResponse> T send(final Registration destination, final DownlinkRequest<T> request, Long timeout) throws InterruptedException { if (destination.getLwM2mQueue().isClientSleeping()) { LOG.info("The destination client is sleeping, request couldn't been sent."); return null; } final LwM2mModel model = modelProvider.getObjectModel(destination); CoapRequestBuilder coapRequestBuilder = new CoapRequestBuilder( new InetSocketAddress(destination.getAddress(), destination.getPort()), destination.getRootPath(), destination.getId(), destination.getEndpoint(), model, encoder); request.accept(coapRequestBuilder); final Request coapRequest = coapRequestBuilder.getRequest(); SyncRequestObserver<T> syncMessageObserver = new SyncRequestObserver<T>(coapRequest, timeout) { @Override public T buildResponse(Response coapResponse) { LwM2mResponseBuilder<T> lwm2mResponseBuilder = new LwM2mResponseBuilder<>(coapRequest, coapResponse, destination, model, observationService, decoder); request.accept(lwm2mResponseBuilder); return lwm2mResponseBuilder.getResponse(); } }; coapRequest.addMessageObserver(syncMessageObserver); addPendingRequest(destination, coapRequest); Endpoint endpoint = getEndpointForClient(destination); endpoint.sendRequest(coapRequest); if (destination.usesQueueMode() && !destination.getLwM2mQueue().isClientSleeping()) { destination.getLwM2mQueue().startClientAwakeTimer(); } return syncMessageObserver.waitForResponse(); }
Source:
public void trade() { for(Entry<String, ArrayList<Order>> buyList : buyOrders.entrySet()) { for ( Entry<String, ArrayList<Order>> sellList : sellOrders.entrySet()) { if (buyList.getKey() == sellList.getKey()) { ArrayList<Order> buySorted = buyOrderSort(buyList.getValue()); ArrayList<Order> sellSorted = sellOrderSort(sellList.getValue()); int buyNum = 0; int sellNum = 0; double price = 0.0; int sellVolume = 0; ArrayList<Double> values = findMarketPrice(buySorted, sellSorted); buyNum = values.get(0).intValue(); sellNum = values.get(1).intValue(); price = values.get(2); sellVolume = values.get(3).intValue(); if (buyNum != -1 && sellNum != -1 && price != -1.0){ PriceSetter set = new PriceSetter(); set.registerObserver(m.getMarketHistory()); m.getMarketHistory().setSubject(set); set.setNewPrice(m, (String)buyList.getKey(), price); for (int i = 0; i <= buyNum; i++) { Order o1 = buySorted.get(i); if (o1.getSize() <= sellVolume) { buyOrders.get(o1.getStockSymbol()).remove(o1); sellVolume -= o1.getSize(); } else { o1.setSize(o1.getSize() - sellVolume); } try { o1.getTrader().tradePerformed(o1, price); } catch (StockMarketExpection e) { e.printStackTrace(); } } for (int i = 0; i <= sellNum; i++) { Order o2 = sellSorted.get(i); sellOrders.get(o2.getStockSymbol()).remove(o2); try { o2.getTrader().tradePerformed(o2, price); } catch (StockMarketExpection e) { e.printStackTrace(); } } } } } } }

Target:
public void trade() { for(Entry<String, ArrayList<Order>> buyList : buyOrders.entrySet()) { for ( Entry<String, ArrayList<Order>> sellList : sellOrders.entrySet()) { if (buyList.getKey() == sellList.getKey()) { ArrayList<Order> buySorted = buyOrderSort(buyList.getValue()); ArrayList<Order> sellSorted = sellOrderSort(sellList.getValue()); int buyNum = 0; int sellNum = 0; double price = 0.0; int sellVolume = 0; ArrayList<Double> values = findMarketPrice(buySorted, sellSorted); buyNum = values.get(0).intValue(); sellNum = values.get(1).intValue(); price = values.get(2); sellVolume = values.get(3).intValue(); if (buyNum != -1 && sellNum != -1 && price != -1.0){ PriceSetter set = new PriceSetter(); set.registerObserver(m.getMarketHistory()); m.getMarketHistory().setSubject(set); set.setNewPrice(m, (String)buyList.getKey(), price); for (int i = 0; i <= buyNum; i++) { Order order = buySorted.get(i); if (buyOrder.getSize() <= sellVolume) { buyOrders.get(order.getStockSymbol()).remove(order); sellVolume -= order.getSize(); } else { order.setSize(o1.getSize() - sellVolume); } try { order.getTrader().tradePerformed(order, price); } catch (StockMarketExpection e) { e.printStackTrace(); } } for (int i = 0; i <= sellNum; i++) { Order order = sellSorted.get(i); sellOrders.get(order.getStockSymbol()).remove(order); try { order.getTrader().tradePerformed(order, price); } catch (StockMarketExpection e) { e.printStackTrace(); } } } } } } }
Source:
public <VO, VR> KStream<K, VR> join(final KStream<K, VO> otherStream, final ValueJoiner<? super V, ? super VO, ? extends VR> joiner, final JoinWindows windows, final Joined<K, V, VO> joined) { return doJoin(otherStream, joiner, windows, joined, null, new KStreamImplJoin(false, false)); }

Target:
public <VO, VR> KStream<K, VR> join(final KStream<K, VO> otherStream, final ValueJoiner<? super V, ? super VO, ? extends VR> joiner, final JoinWindows windows, final Joined<K, V, VO> joined) { Objects.requireNonNull(joined, "Joined can't be null"); final JoinedInternal<K, V, VO> joinedInternal = new JoinedInternal<>(joined); final StreamJoined<K, V, VO> streamJoined = StreamJoined.with(joinedInternal.keySerde(), joinedInternal.valueSerde(), joinedInternal.otherValueSerde()).withName(joinedInternal.name()); return join(otherStream, joiner, windows, streamJoined); }
Source:
private void initialFetchAndSchedule() { Runnable updater = () -> { try { fetchAndUpdateCache(false); } catch (Exception e) { logger.error("Exception occurred when fetching remote account data", e); accountServiceMetrics.fetchRemoteAccountErrorCount.inc(); } }; updater.run(); if (accountInfoMapRef.get().isEmpty() && config.enableServeFromBackup && !backup.isEmpty()) { long aMonthAgo = System.currentTimeMillis() / 1000 - 30 * 24 * 60 * 60; Map<String, String> accountMap = backup.getLatestState(aMonthAgo); if (accountMap != null) { AccountInfoMap newAccountInfoMap = new AccountInfoMap(accountServiceMetrics, accountMap); AccountInfoMap oldAccountInfoMap = accountInfoMapRef.getAndSet(newAccountInfoMap); notifyAccountUpdateConsumers(newAccountInfoMap, oldAccountInfoMap, false); } } if (scheduler != null) { int initialDelay = new Random().nextInt(config.updaterPollingIntervalMs + 1); scheduler.scheduleAtFixedRate(updater, initialDelay, config.updaterPollingIntervalMs, TimeUnit.MILLISECONDS); logger.info( "Background account updater will fetch accounts from remote starting ms from now and repeat with interval={} ms", initialDelay, config.updaterPollingIntervalMs); } if (notifier != null) { notifier.subscribe(ACCOUNT_METADATA_CHANGE_TOPIC, changeTopicListener); } else { logger.warn("Notifier is null. Account updates cannot be notified to other entities. Local account cache may not " + "be in sync with remote account data."); accountServiceMetrics.nullNotifierCount.inc(); } }

Target:
private void initialFetchAndSchedule() { Runnable updater = () -> { try { fetchAndUpdateCache(false); } catch (Exception e) { logger.error("Exception occurred when fetching remote account data", e); accountServiceMetrics.fetchRemoteAccountErrorCount.inc(); } }; updater.run(); if (accountInfoMapRef.get().isEmpty() && config.enableServeFromBackup && !backupFileManager.isEmpty()) { long aMonthAgo = System.currentTimeMillis() / 1000 - TimeUnit.DAYS.toSeconds(30); Map<String, String> accountMap = backupFileManager.getLatestAccountMap(aMonthAgo); if (accountMap != null) { AccountInfoMap newAccountInfoMap = new AccountInfoMap(accountServiceMetrics, accountMap); AccountInfoMap oldAccountInfoMap = accountInfoMapRef.getAndSet(newAccountInfoMap); notifyAccountUpdateConsumers(newAccountInfoMap, oldAccountInfoMap, false); } } if (scheduler != null) { int initialDelay = new Random().nextInt(config.updaterPollingIntervalMs + 1); scheduler.scheduleAtFixedRate(updater, initialDelay, config.updaterPollingIntervalMs, TimeUnit.MILLISECONDS); logger.info( "Background account updater will fetch accounts from remote starting ms from now and repeat with interval={} ms", initialDelay, config.updaterPollingIntervalMs); } if (notifier != null) { notifier.subscribe(ACCOUNT_METADATA_CHANGE_TOPIC, changeTopicListener); } else { logger.warn("Notifier is null. Account updates cannot be notified to other entities. Local account cache may not " + "be in sync with remote account data."); accountServiceMetrics.nullNotifierCount.inc(); } }
Source:
public void testSimpleParsing() throws Exception { LayerDescriptor layerDescriptor; layerDescriptor = new LayerDescriptor("imos:some_layer/sea_water_velocity"); assertEquals("imos", layerDescriptor.workspace); assertEquals("some_layer", layerDescriptor.layer); assertEquals("sea_water_velocity", layerDescriptor.variable); assertEquals("imos:some_layer", layerDescriptor.geoserverName()); assertEquals("imos:some_layer/sea_water_velocity", layerDescriptor.toString()); layerDescriptor = new LayerDescriptor("some_layer/sea_water_velocity"); assertEquals(null, layerDescriptor.workspace); assertEquals("some_layer", layerDescriptor.layer); assertEquals("sea_water_velocity", layerDescriptor.variable); assertEquals("some_layer", layerDescriptor.geoserverName()); assertEquals("some_layer/sea_water_velocity", layerDescriptor.toString()); }

Target:
public void testSimpleParsing() throws Exception { LayerDescriptor layerDescriptor; layerDescriptor = new LayerDescriptor("imos:some_layer/sea_water_velocity"); assertEquals("imos", layerDescriptor.workspace); assertEquals("some_layer", layerDescriptor.layer); assertEquals("sea_water_velocity", layerDescriptor.variable); assertEquals("imos:some_layer", layerDescriptor.geoserverName()); assertEquals("imos:some_layer/sea_water_velocity", layerDescriptor.toString()); assertEquals("time", layerDescriptor.getTimeFieldName()); assertEquals("file_url", layerDescriptor.getUrlFieldName()); layerDescriptor = new LayerDescriptor("some_layer/sea_water_velocity"); assertEquals(null, layerDescriptor.workspace); assertEquals("some_layer", layerDescriptor.layer); assertEquals("sea_water_velocity", layerDescriptor.variable); assertEquals("some_layer", layerDescriptor.geoserverName()); assertEquals("some_layer/sea_water_velocity", layerDescriptor.toString()); assertEquals("time", layerDescriptor.getTimeFieldName()); assertEquals("file_url", layerDescriptor.getUrlFieldName()); }
Source:
public List<JDK> getJDKs() { if(jdks==null) jdks = new ArrayList<JDK>(); return jdks; }

Target:
public List<JDK> getJDKs() { return jdks; }
Source:
public void testHashFirstTwoRowComponents() { HashComponentsTestTable.HashComponentsTestRow testRow = HashComponentsTestTable.HashComponentsTestRow.of(TEST_VALUE_INTEGER, TEST_VALUE_STRING); byte[] component1Bytes = EncodingUtils.encodeUnsignedVarLong(TEST_VALUE_INTEGER); byte[] component2Bytes = EncodingUtils.encodeVarString(TEST_VALUE_STRING); long hashOfFirstTwoComponents = Hashing.murmur3_128().hashBytes(EncodingUtils.add(component1Bytes, component2Bytes)).asLong(); byte[] hashOfComponentsBytes = PtBytes.toBytes(Long.MIN_VALUE ^ hashOfFirstTwoComponents); assertThat(testRow.persistToBytes()) .isEqualTo(EncodingUtils.add(hashOfComponentsBytes, component1Bytes, component2Bytes)); }

Target:
public void testHashFirstTwoRowComponents() { HashComponentsTestTable.HashComponentsTestRow testRow = HashComponentsTestTable.HashComponentsTestRow.of(TEST_VALUE_INTEGER, TEST_VALUE_STRING); byte[] component1Bytes = EncodingUtils.encodeUnsignedVarLong(TEST_VALUE_INTEGER); byte[] component2Bytes = EncodingUtils.encodeVarString(TEST_VALUE_STRING); long hashOfFirstTwoComponents = Hashing.murmur3_128().hashBytes(EncodingUtils.add(component1Bytes, component2Bytes)).asLong(); byte[] hashOfComponentsBytes = PtBytes.toBytes(Long.MIN_VALUE ^ hashOfFirstTwoComponents); byte[] persistedRow = testRow.persistToBytes(); assertThat(persistedRow) .isEqualTo(EncodingUtils.add(hashOfComponentsBytes, component1Bytes, component2Bytes)); assertThat(HashComponentsTestTable.HashComponentsTestRow.BYTES_HYDRATOR.hydrateFromBytes(persistedRow)) .isEqualTo(testRow); }
Source:
public boolean equalWithTolerance(CurveParameterSensitivity other, double tolerance) { Set<SensitivityKey> intersection = sensitivities.keySet(); if (!sensitivities.keySet().equals(other.sensitivities.keySet())) { Set<SensitivityKey> amb = new HashSet<>(sensitivities.keySet()); amb.removeAll(other.sensitivities.keySet()); if (!checkSmall(amb, sensitivities, tolerance)) { return false; } Set<SensitivityKey> bma = new HashSet<>(other.sensitivities.keySet()); bma.removeAll(sensitivities.keySet()); if (!checkSmall(bma, other.sensitivities, tolerance)) { return false; } intersection = new HashSet<>(sensitivities.keySet()); intersection.retainAll(other.sensitivities.keySet()); } for (SensitivityKey key : intersection) { double[] vector1 = sensitivities.get(key); double[] vector2 = other.sensitivities.get(key); if (vector1.length != vector2.length) { return false; } for (int i = 0; i < vector1.length; i++) { if (!DoubleMath.fuzzyEquals(vector1[i], vector2[i], tolerance)) { return false; } } } return true; }

Target:
public boolean equalWithTolerance(CurveParameterSensitivity other, double tolerance) { if (!sensitivities.keySet().equals(other.sensitivities.keySet())) { Set<SensitivityKey> amb = Sets.difference(sensitivities.keySet(), other.sensitivities.keySet()); if (!checkSmall(amb, sensitivities, tolerance)) { return false; } Set<SensitivityKey> bma = Sets.difference(other.sensitivities.keySet(), sensitivities.keySet()); if (!checkSmall(bma, other.sensitivities, tolerance)) { return false; } Set<SensitivityKey> intersection = Sets.intersection(sensitivities.keySet(), other.sensitivities.keySet()); return checkCommon(intersection, sensitivities, other.sensitivities, tolerance); } return checkCommon(sensitivities.keySet(), sensitivities, other.sensitivities, tolerance); }
Source:
public VmTemplate readVmTemplateFromOvf(String ovf) throws OvfReaderException { ArrayList<DiskImage> diskImages = new ArrayList<>(); ArrayList<VmNetworkInterface> interfaces = new ArrayList<>(); VmTemplate template = new VmTemplate(); ovfManager.importTemplate(ovf, template, diskImages, interfaces); template.setInterfaces(interfaces); for (DiskImage disk : diskImages) { template.getDiskTemplateMap().put(disk.getId(), disk); } if (template.getMaxMemorySizeMb() == 0) { template.setMaxMemorySizeMb( VmCommonUtils.maxMemorySizeWithHotplugInMb(template.getOsId(), template.getCompatibilityVersion())); } return template; }

Target:
public VmTemplate readVmTemplateFromOvf(String ovf) throws OvfReaderException { ArrayList<DiskImage> diskImages = new ArrayList<>(); ArrayList<VmNetworkInterface> interfaces = new ArrayList<>(); VmTemplate template = new VmTemplate(); ovfManager.importTemplate(ovf, template, diskImages, interfaces); template.setInterfaces(interfaces); for (DiskImage disk : diskImages) { template.getDiskTemplateMap().put(disk.getId(), disk); } return template; }
Source:
public void init(Map<String, Object> conf) throws StatefulStorageException { checkpointRootPath = (String) conf.get(ROOT_PATH_KEY); maxCheckpoints = (int) conf.get(MAX_CHECKPOINTS_KEY); if (checkpointRootPath != null) { checkpointRootPath = checkpointRootPath.replaceFirst("^~", System.getProperty("user.home")); } LOG.info("Initialing LocalFileSystemStorage with Checkpoint root path: " + checkpointRootPath + " Max checkpoints: " + maxCheckpoints); }

Target:
public void init(Map<String, Object> conf) throws StatefulStorageException { checkpointRootPath = (String) conf.get(ROOT_PATH_KEY); maxCheckpoints = (int) conf.getOrDefault(MAX_CHECKPOINTS_KEY, DEFAULT_MAX_CHECKPOINTS); if (checkpointRootPath != null) { checkpointRootPath = checkpointRootPath.replaceFirst("^~", System.getProperty("user.home")); } LOG.info("Initialing LocalFileSystemStorage with Checkpoint root path: " + checkpointRootPath + " Max checkpoints: " + maxCheckpoints); }
Source:
public void generateInsightsByCategory(final Long accountId, final Long deviceId, final InsightCard.Category category) { Optional<InsightCard> insightCardOptional = Optional.absent(); if (category == InsightCard.Category.LIGHT) { insightCardOptional = Lights.getInsights(accountId, deviceId, deviceDataDAO, lightData); } else if (category == InsightCard.Category.TEMPERATURE) { final AccountInfo.SleepTempType tempPref = this.accountInfoProcessor.checkTemperaturePreference(accountId); final AccountPreference.TemperatureUnit tempUnit = this.getTemperatureUnitString(accountId); insightCardOptional = TemperatureHumidity.getInsights(accountId, deviceId, deviceDataDAO, tempPref, tempUnit); } else if (category == InsightCard.Category.SLEEP_QUALITY) { insightCardOptional = SleepMotion.getInsights(accountId, deviceId, trendsInsightsDAO, sleepStatsDAODynamoDB, false); } else if (category == InsightCard.Category.WAKE_VARIANCE) { DateTime queryEndDate = DateTime.now().withTimeAtStartOfDay(); int numDays = DAYS_ONE_WEEK; LOGGER.debug("for wake variance calling getInsights with accountId and date with numDays {}", accountId, queryEndDate, numDays); insightCardOptional = WakeVariance.getInsights(sleepStatsDAODynamoDB, accountId, wakeStdDevData, queryEndDate, numDays); } if (insightCardOptional.isPresent()) { LOGGER.debug("Insight card present, Inserting insight into DynamoDB"); this.insightsDAODynamoDB.insertInsight(insightCardOptional.get()); } }

Target:
public void generateInsightsByCategory(final Long accountId, final Long deviceId, final InsightCard.Category category) { Optional<InsightCard> insightCardOptional = Optional.absent(); if (category == InsightCard.Category.LIGHT) { insightCardOptional = Lights.getInsights(accountId, deviceId, deviceDataDAO, lightData); } else if (category == InsightCard.Category.TEMPERATURE) { final AccountInfo.SleepTempType tempPref = this.accountInfoProcessor.checkTemperaturePreference(accountId); final AccountPreference.TemperatureUnit tempUnit = this.getTemperatureUnitString(accountId); insightCardOptional = TemperatureHumidity.getInsights(accountId, deviceId, deviceDataDAO, tempPref, tempUnit); } else if (category == InsightCard.Category.SLEEP_QUALITY) { insightCardOptional = SleepMotion.getInsights(accountId, deviceId, trendsInsightsDAO, sleepStatsDAODynamoDB, false); } else if (category == InsightCard.Category.WAKE_VARIANCE) { final DateTime queryEndDate = DateTime.now().withTimeAtStartOfDay(); LOGGER.debug("for wake variance calling getInsights with accountId and date with numDays {}", accountId, queryEndDate, DAYS_ONE_WEEK); insightCardOptional = WakeVariance.getInsights(sleepStatsDAODynamoDB, accountId, wakeStdDevData, queryEndDate, DAYS_ONE_WEEK); } if (insightCardOptional.isPresent()) { LOGGER.debug("Category insight card present for account {}, Inserting insight into DynamoDB", category, accountId); this.insightsDAODynamoDB.insertInsight(insightCardOptional.get()); } }
Source:
public View getView(int position, View convertView, ViewGroup parent) { FeedHolder holder; Feed feed = feedTime.get(position).feed; if (convertView == null) { holder = new FeedHolder(); LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.nav_feedlistitem, parent, false); holder.image = (ImageView) convertView.findViewById(R.id.imgvCover); holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); holder.failure = (IconTextView) convertView.findViewById(R.id.itxtvFailure); holder.count = (TextView) convertView.findViewById(R.id.txtvCount); convertView.setTag(holder); } else { holder = (FeedHolder) convertView.getTag(); } Glide.with(context) .load(feed.getImageUri()) .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate() .into(holder.image); holder.title.setText(feed.getTitle()); holder.failure.setVisibility(View.GONE); holder.count.setVisibility(View.VISIBLE); holder.count.setText(timeToText(feedTime.get(position).timePlayed)); return convertView; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { StatisticsHolder holder; Feed feed = feedTime.get(position).feed; if (convertView == null) { holder = new StatisticsHolder(); LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.statistics_listitem, parent, false); holder.image = (ImageView) convertView.findViewById(R.id.imgvCover); holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); holder.time = (TextView) convertView.findViewById(R.id.txtvTime); convertView.setTag(holder); } else { holder = (StatisticsHolder) convertView.getTag(); } Glide.with(context) .load(feed.getImageUri()) .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate() .into(holder.image); holder.title.setText(feed.getTitle()); holder.time.setText(Converter.shortLocalizedDuration(context, feedTime.get(position).timePlayed)); return convertView; }
Source:
public M filter(BiPredicate<? super K, ? super V> predicate) { Objects.requireNonNull(predicate, "predicate is null"); return filter(t -> predicate.test(t._1(), t._2())); }

Target:
public M filter(BiPredicate<? super K, ? super V> predicate) { Objects.requireNonNull(predicate, "predicate is null"); return filter(t -> predicate.test(t._1, t._2)); }