auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean equals(Object obj) { if (obj instanceof Identity) { Identity<T> identity = (Identity<T>) obj; if (getGuid() == identity.getGuid()) { return true; } return getGuid().equals(identity.getGuid()); } return false; }

Target:
public boolean equals(Object obj) { boolean equal = false; if (obj instanceof Identity) { Identity<T> identity = (Identity<T>) obj; if (getGuid() == identity.getGuid()) { equal = true; } else if (getGuid() != null) { equal = getGuid().equals(identity.getGuid()); } } return equal; }
Source:
void checkValid() { if (iteratorCollection == null) { throw new ConcurrentModificationException( "No outside changes to a Realm is allowed while iterating a RealmResults." + " Don't call Realm.refresh() while iterating or use iterators across event loops."); } }

Target:
void checkValid() { if (iteratorCollection == null) { throw new ConcurrentModificationException( "No outside changes to a Realm is allowed while iterating a living Realm collection."); } }
Source:
private void initArticleHeaderView() { pageHeaderView.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { LeadImagesHandler.this.setWebViewPaddingTop(); parentFragment.getWebView().setVisibility(VISIBLE); }); pageHeaderView.setCallback(new PageHeaderView.Callback() { @Override public void onImageClicked() { openImageInGallery(null); } @Override public void onCallToActionClicked() { if (callToActionIsTranslation ? (callToActionTargetSummary != null && callToActionSourceSummary != null) : callToActionSourceSummary != null) { getActivity().startActivityForResult(DescriptionEditActivity.newIntent(getActivity(), callToActionIsTranslation ? callToActionTargetSummary.getPageTitle() : callToActionSourceSummary.getPageTitle(), null, callToActionSourceSummary, callToActionTargetSummary, callToActionIsTranslation ? SUGGESTED_EDITS_TRANSLATE_CAPTION : SUGGESTED_EDITS_ADD_CAPTION), ACTIVITY_REQUEST_IMAGE_CAPTION_EDIT); } } }); }

Target:
private void initArticleHeaderView() { pageHeaderView.setCallback(new PageHeaderView.Callback() { @Override public void onImageClicked() { openImageInGallery(null); } @Override public void onCallToActionClicked() { if (callToActionIsTranslation ? (callToActionTargetSummary != null && callToActionSourceSummary != null) : callToActionSourceSummary != null) { getActivity().startActivityForResult(DescriptionEditActivity.newIntent(getActivity(), callToActionIsTranslation ? callToActionTargetSummary.getPageTitle() : callToActionSourceSummary.getPageTitle(), null, callToActionSourceSummary, callToActionTargetSummary, callToActionIsTranslation ? SUGGESTED_EDITS_TRANSLATE_CAPTION : SUGGESTED_EDITS_ADD_CAPTION), ACTIVITY_REQUEST_IMAGE_CAPTION_EDIT); } } }); }
Source:
public void release() throws EEException { LOG.trace("Releasing Execution Engine... " + pointer); if (pointer != 0L) { final int errorCode = nativeDestroy(pointer); pointer = 0L; checkErrorCode(errorCode); } deserializer = null; deserializerBufferOrigin.discard(); exceptionBuffer = null; exceptionBufferOrigin.discard(); psetBufferC.discard(); psetBuffer = null; granularStatsBufferC.discard(); granularStatsBuffer = null; LOG.trace("Released Execution Engine."); }

Target:
public void release() throws EEException { LOG.trace("Releasing Execution Engine... " + pointer); if (pointer != 0L) { final int errorCode = nativeDestroy(pointer); pointer = 0L; checkErrorCode(errorCode); } deserializer = null; deserializerBufferOrigin.discard(); exceptionBuffer = null; exceptionBufferOrigin.discard(); psetBufferC.discard(); psetBuffer = null; perFragmentStatsBufferC.discard(); perFragmentStatsBuffer = null; LOG.trace("Released Execution Engine."); }
Source:
private long getSleepTime(int tries) { if (INCREMENTAL_BACKOFF_MS == null) { return 0; } else { if (tries > INCREMENTAL_BACKOFF_MS.length) { return INCREMENTAL_BACKOFF_MS[INCREMENTAL_BACKOFF_MS.length - 1]; } else { return INCREMENTAL_BACKOFF_MS[tries - 1]; } } }

Target:
private static long getSleepTime(int tries) { if (INCREMENTAL_BACKOFF_MS == null) { return 0; } else { if (tries > INCREMENTAL_BACKOFF_MS.length) { return INCREMENTAL_BACKOFF_MS[INCREMENTAL_BACKOFF_MS.length - 1]; } else { return INCREMENTAL_BACKOFF_MS[tries - 1]; } } }
Source:
private String detectContentType(FilePath file) throws InterruptedException, IOException { Tika tika = new Tika(); try (InputStream stream = file.read()) { if (file.getName().endsWith(".js")) { return "application/javascript"; } else { return tika.detect(stream, file.getName()); } } }

Target:
private String detectContentType(FilePath file) throws InterruptedException, IOException { Tika tika = new Tika(); try (InputStream stream = file.read()) { if (file.getName().toLowerCase().endsWith(".js")) { return "application/javascript"; } else { return tika.detect(stream, file.getName()); } } }
Source:
private void init() { inflate(getContext(), R.layout.view_description_edit_help, this); ButterKnife.bind(this); String helpStr = ResourceUtil.readAssetFile(getContext(), "description_edit_help.html"); helpText.setText(StringUtil.fromHtml(helpStr)); }

Target:
private void init() { inflate(getContext(), R.layout.view_description_edit_help, this); ButterKnife.bind(this); helpText.setText(StringUtil.fromHtml(getContext().getString(R.string.description_edit_help_body))); }
Source:
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { String url = in.readUTF(); System.out.println("Reading " + url); ConnectionFactoryParser parser = new ConnectionFactoryParser(); ServerLocatorParser locatorParser = new ServerLocatorParser(); try { URI uri = new URI(url); serverLocator = locatorParser.newObject(uri, null); parser.populateObject(uri, this); } catch (Exception e) { e.printStackTrace(); throw new InvalidObjectException(e.getMessage()); } }

Target:
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { String url = in.readUTF(); ConnectionFactoryParser parser = new ConnectionFactoryParser(); ServerLocatorParser locatorParser = new ServerLocatorParser(); try { URI uri = new URI(url); serverLocator = locatorParser.newObject(uri, null); parser.populateObject(uri, this); } catch (Exception e) { InvalidObjectException ex = new InvalidObjectException(e.getMessage()); ex.initCause(e); throw ex; } }
Source:
public ByteBufferSharing getUnwrappedBuffer() { return shareBuffer(null); }

Target:
public ByteBufferSharing getUnwrappedBuffer() { return shareBuffer(EMPTY_BUFFER); }
Source:
private static AccessToken makeToken(final Long accountId) { return new AccessToken.Builder() .withAccountId(accountId) .withCreatedAt(DateTime.now()) .withExpiresIn(DateTime.now().plusHours(1).getMillis()) .withRefreshToken(UUID.randomUUID()) .withToken(UUID.randomUUID()) .withScopes(new OAuthScope[]{ OAuthScope.USER_BASIC, OAuthScope.USER_BASIC }) .withAppId(1L) .build(); }

Target:
private static AccessToken makeToken(final Long accountId) { return new AccessToken.Builder() .withAccountId(accountId) .withCreatedAt(DateTime.now()) .withExpiresIn(DateTime.now().plusHours(1).getMillis()) .withRefreshToken(UUID.randomUUID()) .withToken(UUID.randomUUID()) .withScopes(new OAuthScope[]{ OAuthScope.USER_BASIC }) .withAppId(1L) .build(); }
Source:
public void testGetAdapter() throws PartInitException { outline.partClosed(outline); TestUtils.openEditor(testFile); MockLanguageServer.INSTANCE.setTimeToProceedQueries(500); outline.partOpened(outline); }

Target:
public void testGetAdapter() throws PartInitException { outline.partClosed(outline); TestUtils.openEditor(testFile); MockLanguageServer.INSTANCE.setTimeToProceedQueries(500); long beginOpenOutline = System.currentTimeMillis(); outline.partOpened(outline); long endOpenOutline = System.currentTimeMillis(); long durationOpenOutline = endOpenOutline - beginOpenOutline; Assert.assertTrue(String.format("Open outline took longer than 50ms: %d", durationOpenOutline), durationOpenOutline <= 50); DisplayHelper.sleep(Display.getCurrent(), 500); String pageClassName = outline.getCurrentPage().getClass().getPackage().getName(); Assert.assertTrue(pageClassName.contains("lsp4e")); }
Source:
public void run(final int iteration) { LOG.log(Level.INFO, "Iteration Started"); final Map<Long, Document> workloadMap = memoryStore.getAll(); final List<Document> workload = new ArrayList<>(workloadMap.values()); final int numDocuments = workload.size(); int numSampledDocuments = 0; for (int batchIdx = 0; batchIdx < numMiniBatchPerIter; batchIdx++) { final int batchSize = numDocuments / numMiniBatchPerIter + ((numDocuments % numMiniBatchPerIter > batchIdx) ? 1 : 0); sampler.sample(workload.subList(numSampledDocuments, numSampledDocuments + batchSize)); numSampledDocuments += batchSize; LOG.log(Level.INFO, "{0}/{1} documents are sampled", new Object[]{numSampledDocuments, numDocuments}); } LOG.log(Level.INFO, "Start computing log likelihood"); final List<int[]> wordTopicCounts = parameterWorker.pull(vocabList); final int[] wordTopicCountsSummary = wordTopicCounts.remove(numVocabs); LOG.log(Level.INFO, "App metric log: {0}", buildAppMetrics(statCalculator.computeDocLLH(workload), statCalculator.computeWordLLH(wordTopicCounts, wordTopicCountsSummary))); LOG.log(Level.INFO, "Iteration Ended"); }

Target:
public void run(final int iteration) { LOG.log(Level.INFO, "Iteration Started"); final Map<Long, Document> workloadMap = memoryStore.getAll(); final List<Document> workload = new ArrayList<>(workloadMap.values()); final int numDocuments = workload.size(); int numSampledDocuments = 0; for (int batchIdx = 0; batchIdx < numMiniBatchPerIter; batchIdx++) { final int batchSize = numDocuments / numMiniBatchPerIter + ((numDocuments % numMiniBatchPerIter > batchIdx) ? 1 : 0); sampler.sample(workload.subList(numSampledDocuments, numSampledDocuments + batchSize)); numSampledDocuments += batchSize; LOG.log(Level.INFO, "{0} documents out of {1} have been sampled", new Object[]{numSampledDocuments, numDocuments}); } LOG.log(Level.INFO, "Start computing log likelihood"); final List<int[]> wordTopicCounts = parameterWorker.pull(vocabList); final int[] wordTopicCountsSummary = wordTopicCounts.remove(numVocabs); LOG.log(Level.INFO, "App metric log: {0}", buildAppMetrics(statCalculator.computeDocLLH(workload), statCalculator.computeWordLLH(wordTopicCounts, wordTopicCountsSummary))); LOG.log(Level.INFO, "Iteration Ended"); }
Source:
public void testCreateSchemaWithConstraints() throws Exception { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName(tname("ft2")); builder.setNamespaceURI(dataStore.getNamespaceURI()); builder.setCRS(CRS.decode("EPSG:4326")); builder.add(aname("geometry"), Geometry.class); builder.nillable(false).add(aname("intProperty"), Integer.class); builder.length(5).add(aname("stringProperty"), String.class); SimpleFeatureType featureType = builder.buildFeatureType(); dataStore.createSchema(featureType); SimpleFeatureType ft2 = dataStore.getSchema(tname("ft2")); FeatureWriter<SimpleFeatureType, SimpleFeature> w = dataStore.getFeatureWriter( tname("ft2"),Transaction.AUTO_COMMIT); w.hasNext(); SimpleFeature f = w.next(); f.setAttribute( 1, new Integer(0)); f.setAttribute( 2, "hello"); w.write(); w.close(); w = dataStore.getFeatureWriter( tname("ft2"),Transaction.AUTO_COMMIT); w.hasNext(); f = w.next(); f.setAttribute( 1, null ); try { w.write(); fail( "null value for intProperty should have failed"); } catch( Exception e ) { } f.setAttribute( 1, new Integer(1) ); f.setAttribute( 2, "hello!"); try { w.write(); fail( "string greather than 5 chars should have failed"); } catch( Exception e ) { } w.close(); }

Target:
public void testCreateSchemaWithConstraints() throws Exception { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName(tname("ft2")); builder.setNamespaceURI(dataStore.getNamespaceURI()); builder.setCRS(CRS.decode("EPSG:4326")); builder.add(aname("geometry"), Geometry.class); builder.nillable(false).add(aname("intProperty"), Integer.class); builder.length(5).add(aname("stringProperty"), String.class); SimpleFeatureType featureType = builder.buildFeatureType(); dataStore.createSchema(featureType); SimpleFeatureType ft2 = dataStore.getSchema(tname("ft2")); FeatureWriter<SimpleFeatureType, SimpleFeature> w = dataStore.getFeatureWriter( tname("ft2"),Transaction.AUTO_COMMIT); w.hasNext(); SimpleFeature f = w.next(); f.setAttribute( 1, new Integer(0)); f.setAttribute( 2, "hello"); w.write(); w.hasNext(); f = w.next(); f.setAttribute( 1, null ); try { w.write(); fail( "null value for intProperty should have failed"); } catch( Exception e ) { } f.setAttribute( 1, new Integer(1) ); f.setAttribute( 2, "hello!"); try { w.write(); fail( "string greather than 5 chars should have failed"); } catch( Exception e ) { } w.close(); }
Source:
public Optional<Container> openInventory(Inventory inventory) throws IllegalArgumentException { if (((IMixinContainer) this.openContainer).isInUse()) { SpongeImpl.getLogger().warn("This player is currently modifying an open container. This action will be delayed."); Sponge.getScheduler().createTaskBuilder().delayTicks(0).execute(() -> { this.closeInventory(); this.openInventory(inventory); }).submit(SpongeImpl.getPlugin()); return this.getOpenInventory(); } return Optional.ofNullable((Container) SpongeCommonEventFactory.displayContainer((EntityPlayerMP) (Object) this, inventory)); }

Target:
public Optional<Container> openInventory(Inventory inventory) throws IllegalArgumentException { if (((IMixinContainer) this.openContainer).isInUse()) { Cause cause = Sponge.getCauseStackManager().getCurrentCause(); SpongeImpl.getLogger().warn("This player is currently modifying an open container. This action will be delayed."); Sponge.getScheduler().createTaskBuilder().delayTicks(0).execute(() -> { try (StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) { cause.all().forEach(frame::pushCause); cause.getContext().asMap().forEach((key, value) -> frame.addContext(((EventContextKey) key), value)); this.closeInventory(); this.openInventory(inventory); } }).submit(SpongeImpl.getPlugin()); return this.getOpenInventory(); } return Optional.ofNullable((Container) SpongeCommonEventFactory.displayContainer((EntityPlayerMP) (Object) this, inventory)); }
Source:
public void submoduleWithNoGitDirectory() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); final RevCommit id = git.commit().setMessage("create file").call(); final String path = "sub"; DirCache cache = db.lockDirCache(); DirCacheEditor editor = cache.editor(); editor.add(new PathEdit(path) { public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.GITLINK); ent.setObjectId(id); } }); editor.commit(); File submoduleRoot = new File(db.getWorkTree(), path); assertTrue(submoduleRoot.mkdir()); assertTrue(new File(submoduleRoot, Constants.DOT_GIT).mkdir()); TreeWalk walk = new TreeWalk(db); DirCacheIterator indexIter = new DirCacheIterator(db.readDirCache()); FileTreeIterator workTreeIter = new FileTreeIterator(db); walk.addTree(indexIter); walk.addTree(workTreeIter); walk.setFilter(PathFilter.create(path)); FileUtils.delete(submoduleRoot, FileUtils.RECURSIVE); assertTrue(walk.next()); assertFalse(indexIter.idEqual(workTreeIter)); }

Target:
public void submoduleWithNoGitDirectory() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); final RevCommit id = git.commit().setMessage("create file").call(); final String path = "sub"; DirCache cache = db.lockDirCache(); DirCacheEditor editor = cache.editor(); editor.add(new PathEdit(path) { public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.GITLINK); ent.setObjectId(id); } }); editor.commit(); File submoduleRoot = new File(db.getWorkTree(), path); assertTrue(submoduleRoot.mkdir()); assertTrue(new File(submoduleRoot, Constants.DOT_GIT).mkdir()); TreeWalk walk = new TreeWalk(db); DirCacheIterator indexIter = new DirCacheIterator(db.readDirCache()); FileTreeIterator workTreeIter = new FileTreeIterator(db); walk.addTree(indexIter); walk.addTree(workTreeIter); walk.setFilter(PathFilter.create(path)); assertTrue(walk.next()); assertFalse(indexIter.idEqual(workTreeIter)); assertEquals(ObjectId.zeroId(), workTreeIter.getEntryObjectId()); }
Source:
private boolean reportInternalServerErrorOverSideband() throws IOException { @SuppressWarnings("resource" ) SideBandOutputStream err = new SideBandOutputStream( SideBandOutputStream.CH_ERROR, SideBandOutputStream.SMALL_BUF, rawOut); err.write(Constants.encode(JGitText.get().internalServerError)); err.flush(); return true; }

Target:
private void reportInternalServerErrorOverSideband() throws IOException { @SuppressWarnings("resource" ) SideBandOutputStream err = new SideBandOutputStream( SideBandOutputStream.CH_ERROR, SideBandOutputStream.SMALL_BUF, rawOut); err.write(Constants.encode(JGitText.get().internalServerError)); err.flush(); }
Source:
protected void joinTestJobs() { try { progressService.busyCursorWhile( new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InterruptedException { Job.getJobManager().join(TestJob.FAMILY_TEST_JOB, monitor); } }); } catch (InterruptedException | InvocationTargetException e) { e.printStackTrace(); } }

Target:
protected void joinTestJobs() { try { progressService.busyCursorWhile( new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InterruptedException { Job.getJobManager().join(TestJob.FAMILY_TEST_JOB, monitor); } }); } catch (InterruptedException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }
Source:
public void onUserNotice(final UserNotice msg) { final String user = msg.getSource().getNick(); String[] ignoredUsers = configurationService.getString( IrcProperties.PROP_IRC_IGNORE,"") .split(","); for (String ignoredUser : ignoredUsers) { if (user.equalsIgnoreCase(ignoredUser.trim())) { LOGGER.info("Ignored incoming user notice from " + user); return; } } final Contact from = MessageManager.this.provider.getPersistentPresence() .findOrCreateContactByID(user); final MessageIrcImpl message = MessageIrcImpl.newNoticeFromIRC(from, msg.getText()); MessageManager.this.provider.getBasicInstantMessaging() .fireMessageReceived(message, from); }

Target:
public void onUserNotice(final UserNotice msg) { final String user = msg.getSource().getNick(); if(isUserIgnored(msg.getSource().getNick())) { return; } final Contact from = MessageManager.this.provider.getPersistentPresence() .findOrCreateContactByID(user); final MessageIrcImpl message = MessageIrcImpl.newNoticeFromIRC(from, msg.getText()); MessageManager.this.provider.getBasicInstantMessaging() .fireMessageReceived(message, from); }
Source:
public void testJtaTransactionContextSwitch() throws Exception { for (TransactionConcurrency concurrency : TransactionConcurrency.values()) { for (TransactionIsolation isolation : TransactionIsolation.values()) { TransactionConfiguration configuration = grid(0).context().config().getTransactionConfiguration(); configuration.setDefaultTxConcurrency(concurrency); configuration.setDefaultTxIsolation(isolation); jtaTransactionContextSwitch(TransactionConcurrency.OPTIMISTIC.equals(concurrency) && (TransactionIsolation.REPEATABLE_READ.equals(isolation))); } } }

Target:
public void testJtaTransactionContextSwitch() throws Exception { for (TransactionIsolation isolation : TransactionIsolation.values()) { TransactionConfiguration cfg = grid(0).context().config().getTransactionConfiguration(); cfg.setDefaultTxConcurrency(TransactionConcurrency.OPTIMISTIC); cfg.setDefaultTxIsolation(isolation); jtaTransactionContextSwitch((TransactionIsolation.REPEATABLE_READ.equals(isolation))); } }
Source:
public void parse(Map<String, Object> parameters) { Integer spotPercentage = getInt(parameters, AwsInstanceTemplate.EC2_SPOT_PERCENTAGE); doIfNotNull(spotPercentage, sp -> { spot = new AwsInstanceTemplateV4SpotParameters(); spot.setPercentage(sp); }); Double spotMaxPrice = getDouble(parameters, AwsInstanceTemplate.EC2_SPOT_MAX_PRICE); doIfNotNull(spotMaxPrice, maxPrice -> { if (Objects.isNull(spot)) { spot = new AwsInstanceTemplateV4SpotParameters(); } spot.setMaxPrice(maxPrice); }); encryption = new AwsEncryptionV4Parameters(); encryption.setKey(getParameterOrNull(parameters, InstanceTemplate.VOLUME_ENCRYPTION_KEY_ID)); String type = getParameterOrNull(parameters, InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE); if (type != null) { encryption.setType(EncryptionType.valueOf(type)); } String placementGroupStrategy = getParameterOrNull(parameters, AwsInstanceTemplate.PLACEMENT_GROUP_STRATEGY); if (placementGroupStrategy != null) { placementGroup = new AwsPlacementGroupV4Parameters(); placementGroup.setStrategy(AwsPlacementGroupStrategy.valueOf(placementGroupStrategy)); } }

Target:
public void parse(Map<String, Object> parameters) { Integer spotPercentage = getInt(parameters, AwsInstanceTemplate.EC2_SPOT_PERCENTAGE); doIfNotNull(spotPercentage, sp -> { spot = new AwsInstanceTemplateV4SpotParameters(); spot.setPercentage(sp); }); Double spotMaxPrice = getDouble(parameters, AwsInstanceTemplate.EC2_SPOT_MAX_PRICE); doIfNotNull(spotMaxPrice, maxPrice -> { if (Objects.isNull(spot)) { spot = new AwsInstanceTemplateV4SpotParameters(); } spot.setMaxPrice(maxPrice); }); encryption = new AwsEncryptionV4Parameters(); encryption.setKey(getParameterOrNull(parameters, InstanceTemplate.VOLUME_ENCRYPTION_KEY_ID)); String type = getParameterOrNull(parameters, InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE); if (type != null) { encryption.setType(EncryptionType.valueOf(type)); } String placementGroupStrategy = getParameterOrNull(parameters, AwsInstanceTemplate.PLACEMENT_GROUP_STRATEGY); placementGroup = new AwsPlacementGroupV4Parameters(); if (placementGroupStrategy != null) { placementGroup.setStrategy(AwsPlacementGroupStrategy.valueOf(placementGroupStrategy)); } else { placementGroup.setStrategy(AwsPlacementGroupStrategy.NONE); } }
Source:
public void work() throws Exception { if (sslInfrastructureService.isRegistered()) { if (webSocketSessionHandler.isNotRunning()) { webSocketSessionHandler.clearCallBacks(); synchronized (this) { webSocketSessionHandler.setSession(webSocketClientHandler.connect(this)); } } updateServerAgentRuntimeInfo(); } }

Target:
public void work() throws Exception { if (sslInfrastructureService.isRegistered()) { if (webSocketSessionHandler.isNotRunning()) { webSocketSessionHandler.clearCallBacks(); webSocketSessionHandler.setSession(webSocketClientHandler.connect(this)); } updateServerAgentRuntimeInfo(); } }
Source:
private Set<String> getEnabledCredentialTypes(List<CredentialProvider> credentialProviders) { Set<String> enabledCredentialTypes = new HashSet<>(); for (AuthenticationFlowModel flow : realm.getAuthenticationFlows()) { for (AuthenticationExecutionModel execution : realm.getAuthenticationExecutions(flow.getId())) { if (execution.getAuthenticator() != null) { AuthenticatorFactory authenticatorFactory = (AuthenticatorFactory) session.getKeycloakSessionFactory().getProviderFactory(Authenticator.class, execution.getAuthenticator()); if (authenticatorFactory != null && authenticatorFactory.getReferenceCategory() != null) { enabledCredentialTypes.add(authenticatorFactory.getReferenceCategory()); } } } } Set<String> credentialTypes = credentialProviders.stream() .map(CredentialProvider::getType) .collect(Collectors.toSet()); enabledCredentialTypes.retainAll(credentialTypes); return enabledCredentialTypes; }

Target:
private Set<String> getEnabledCredentialTypes(List<CredentialProvider> credentialProviders) { Set<String> enabledCredentialTypes = new HashSet<>(); for (AuthenticationFlowModel flow : realm.getAuthenticationFlows()) { if (isFlowEffectivelyDisabled(flow)) continue; for (AuthenticationExecutionModel execution : realm.getAuthenticationExecutions(flow.getId())) { if (execution.getAuthenticator() != null && DISABLED != execution.getRequirement()) { AuthenticatorFactory authenticatorFactory = (AuthenticatorFactory) session.getKeycloakSessionFactory().getProviderFactory(Authenticator.class, execution.getAuthenticator()); if (authenticatorFactory != null && authenticatorFactory.getReferenceCategory() != null) { enabledCredentialTypes.add(authenticatorFactory.getReferenceCategory()); } } } } Set<String> credentialTypes = credentialProviders.stream() .map(CredentialProvider::getType) .collect(Collectors.toSet()); enabledCredentialTypes.retainAll(credentialTypes); return enabledCredentialTypes; }
Source:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { DropboxConfiguration configuration = new DropboxConfiguration(); configuration.setAccessToken((String)parameters.get("accessToken")); configuration.setLocalPath((String)parameters.get("localPath")); configuration.setRemotePath(((String)parameters.get("remotePath")).replaceAll("\\s","+")); configuration.setNewRemotePath((String)parameters.get("newRemotePath")); configuration.setQuery((String)parameters.get("query")); configuration.setOperation(DropboxOperation.valueOf(remaining)); configuration.setClientIdentifier( parameters.get("clientIdentifier") == null ? DropboxPropertyManager.getInstance().getProperty("clientIdentifier") : (String) parameters.get("clientIdentifier")); if (parameters.get("uploadMode") != null) { configuration.setUploadMode(DropboxUploadMode.valueOf((String)parameters.get("uploadMode"))); } DropboxConfigurationValidator.validate(configuration); setProperties(configuration, parameters); Endpoint endpoint = new DropboxEndpoint(uri, this, configuration); return endpoint; }

Target:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { DropboxConfiguration configuration = new DropboxConfiguration(); configuration.setAccessToken((String)parameters.get("accessToken")); configuration.setLocalPath((String)parameters.get("localPath")); configuration.setRemotePath( parameters.get("remotePath") != null ? ((String) parameters.get("remotePath")).replaceAll("\\s", "+") : null); configuration.setNewRemotePath((String)parameters.get("newRemotePath")); configuration.setQuery((String)parameters.get("query")); configuration.setOperation(DropboxOperation.valueOf(remaining)); configuration.setClientIdentifier( parameters.get("clientIdentifier") == null ? DropboxPropertyManager.getInstance().getProperty("clientIdentifier") : (String) parameters.get("clientIdentifier")); if (parameters.get("uploadMode") != null) { configuration.setUploadMode(DropboxUploadMode.valueOf((String)parameters.get("uploadMode"))); } DropboxConfigurationValidator.validate(configuration); setProperties(configuration, parameters); Endpoint endpoint = new DropboxEndpoint(uri, this, configuration); return endpoint; }
Source:
private static IFile getFileForLocationURI(IWorkspaceRoot root, URI uri) { IFile[] files = root.findFilesForLocationURI(uri); int shortestPathSegmentCount = Integer.MAX_VALUE; IFile shortestPath = null; for (IFile file : files) { IPath fullPath = file.getFullPath(); if (!file.exists()) continue; if (fullPath.segmentCount() < shortestPathSegmentCount) { shortestPath = file; shortestPathSegmentCount = fullPath.segmentCount(); } } return shortestPath; }

Target:
private static IFile getFileForLocationURI(IWorkspaceRoot root, URI uri) { IFile[] files = root.findFilesForLocationURI(uri); return getExistingResourceWithShortestPath(files); }
Source:
protected void configure(HttpSecurity httpSecurity) throws Exception { httpSecurity .csrf() .disable() .authorizeRequests() .anyRequest().permitAll(); }

Target:
protected void configure(HttpSecurity httpSecurity) throws Exception { httpSecurity .csrf() .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()) .ignoringRequestMatchers( new AntPathRequestMatcher( this.adminServerProperties.path("/instances"), HttpMethod.POST.toString()), new AntPathRequestMatcher( this.adminServerProperties.path("/instances/*"), HttpMethod.DELETE.toString()), new AntPathRequestMatcher( this.adminServerProperties.path("/actuator/**"))) .and() .authorizeRequests() .antMatchers(adminServerProperties.path("/assets/**")).permitAll() .antMatchers(adminServerProperties.path("/sw.js")).permitAll() .antMatchers(adminServerProperties.path("/instances")) .hasAnyAuthority("ROLE_client", "SCOPE_openid") .anyRequest().hasAuthority("SCOPE_openid") .and() .oauth2Login() .successHandler(authenticationSuccessHandler) .loginPage(adminServerProperties.path("/oauth2/authorization/" + getClientId())) .and() .logout() .logoutSuccessUrl(getLogoutSuccessUrl()) .and() .oauth2Client() .and() .httpBasic(); }
Source:
public RawPacket[] reverseTransform(RawPacket[] pkts) { if (incomingPT == -1 || pkts == null) return pkts; Long ssrc = findSSRC(pkts); long primarySsrc = getPrimarySsrc(ssrc); if (primarySsrc == -1) { return pkts; } AbstractFECReceiver fpt; synchronized (fecReceivers) { fpt = fecReceivers.get(primarySsrc); if (fpt == null) { if (fecType == FecType.ULPFEC) { fpt = new ULPFECReceiver(primarySsrc, incomingPT); } else if (fecType == FecType.FLEXFEC_03) { fpt = new FlexFec03Receiver(primarySsrc, incomingPT); } else { logger.error("Unknown fec type set: " + fecType); return pkts; } fecReceivers.put(primarySsrc, fpt); } } return fpt.reverseTransform(pkts); }

Target:
public RawPacket[] reverseTransform(RawPacket[] pkts) { if (incomingPT == -1 || pkts == null) return pkts; Long ssrc = findSSRC(pkts); long primarySsrc = getPrimarySsrc(ssrc); if (primarySsrc == -1) { return pkts; } AbstractFECReceiver fecReceiver; synchronized (fecReceivers) { fecReceiver = fecReceivers.get(primarySsrc); if (fecReceiver == null) { if (fecType == FecType.ULPFEC) { fecReceiver = new ULPFECReceiver(primarySsrc, incomingPT); } else if (fecType == FecType.FLEXFEC_03) { fecReceiver = new FlexFec03Receiver(primarySsrc, incomingPT); } else { logger.error("Unknown fec type set: " + fecType); return pkts; } fecReceivers.put(primarySsrc, fecReceiver); } } return fecReceiver.reverseTransform(pkts); }
Source:
public static Shell getActiveShell() { Shell activeShell = Display.getDefault().getActiveShell(); return (activeShell != null) ? activeShell : new Shell(); }

Target:
public static Shell getActiveShell() { return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); }
Source:
private static long batchSize( long pagesToClean, int threads ) { try { int result = Math.multiplyExact(100 * threads); return min(MAX_BATCH_SIZE, max(MIN_BATCH_SIZE, pagesToClean / result)); } catch (ArithmeticException e) { return MIN_BATCH_SIZE; } }

Target:
private static long batchSize( long pagesToClean, int threads ) { return min(MAX_BATCH_SIZE, max(MIN_BATCH_SIZE, pagesToClean / (100L * threads))); }
Source:
public Object start(IApplicationContext context) throws Exception { File[] filesToFormat = processCommandLine((String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS)); if (filesToFormat == null) { return IApplication.EXIT_OK; } if (!this.quiet) { if (this.configName != null) { System.out.println(Messages.bind(Messages.CommandLineConfigFile, this.configName)); } System.out.println(Messages.bind(Messages.CommandLineStart)); } @SuppressWarnings("unchecked") final CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(this.options); for (int i = 0, max = filesToFormat.length; i < max; i++) { final File file = filesToFormat[i]; if (file.isDirectory()) { formatDirTree(file, codeFormatter); } else if (hasSuitableFileExtension(file)) { formatFile(file, codeFormatter); } } if (!this.quiet) { System.out.println(Messages.bind(Messages.CommandLineDone)); } return IApplication.EXIT_OK; }

Target:
public Object start(IApplicationContext context) throws Exception { File[] filesToFormat = processCommandLine((String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS)); if (filesToFormat == null) { return IApplication.EXIT_OK; } if (!this.quiet) { if (this.configName != null) { System.out.println(Messages.bind(Messages.CommandLineConfigFile, this.configName)); } System.out.println(Messages.CommandLineStart); } @SuppressWarnings("unchecked") final CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(this.options); for (int i = 0, max = filesToFormat.length; i < max; i++) { final File file = filesToFormat[i]; if (file.isDirectory()) { formatDirTree(file, codeFormatter); } else { formatFile(file, codeFormatter); } } if (!this.quiet) { System.out.println(Messages.CommandLineDone); } return IApplication.EXIT_OK; }
Source:
public QualityProfileDto getProfile(DbSession dbSession, QProfileReference ref) { QualityProfileDto profile; if (ref.hasKey()) { profile = dbClient.qualityProfileDao().selectByKey(dbSession, ref.getKey()); checkFound(profile, "Quality Profile with key '"+ref.getKey()+"' does not exist"); } else { OrganizationDto org = getOrganizationByKey(dbSession, ref.getOrganizationKey().orElse(null)); profile = dbClient.qualityProfileDao().selectByNameAndLanguage(org, ref.getName(), ref.getLanguage(), dbSession); checkFound(profile, "Quality Profile for language '"+ref.getLanguage()+"' and name '"+ref.getName()+"' does not exist"+ref.getOrganizationKey().map(o ->" in organization '"+o+"'").orElse("")); } return profile; }

Target:
public QualityProfileDto getProfile(DbSession dbSession, QProfileReference ref) { QualityProfileDto profile; if (ref.hasKey()) { profile = dbClient.qualityProfileDao().selectByKey(dbSession, ref.getKey()); checkFound(profile, "Quality Profile with key '%s' does not exist", ref.getKey()); } else { OrganizationDto org = getOrganizationByKey(dbSession, ref.getOrganizationKey().orElse(null)); profile = dbClient.qualityProfileDao().selectByNameAndLanguage(org, ref.getName(), ref.getLanguage(), dbSession); checkFound(profile, "Quality Profile for language '%s' and name '%s' does not exist%s", ref.getLanguage(), ref.getName(), ref.getOrganizationKey().map(o -> " in organization '"+o+"'").orElse("")); } return profile; }
Source:
public KeycloakTokenResponse getIdentityProviderToken(String oauthProvider) throws ForbiddenException, BadRequestException, IOException, ConflictException, NotFoundException, ServerException, UnauthorizedException { String url = UriBuilder.fromUri(keycloakSettings.get().get(AUTH_SERVER_URL_SETTING)) .path("/realms/{realm}/broker/{provider}/token") .build(keycloakSettings.get().get(REALM_SETTING), oauthProvider) .toString(); try { String response = doRequest(url, HttpMethod.GET, null); return DtoFactory.getInstance() .createDtoFromJson(toJson(response), KeycloakTokenResponse.class); } catch (BadRequestException e) { if (assotiateUserPattern.matcher(e.getMessage()).matches()) { throw new UnauthorizedException(e.getMessage()); } else { throw e; } } }

Target:
public KeycloakTokenResponse getIdentityProviderToken(String oauthProvider) throws ForbiddenException, BadRequestException, IOException, NotFoundException, ServerException, UnauthorizedException { String url = UriBuilder.fromUri(keycloakSettings.get().get(AUTH_SERVER_URL_SETTING)) .path("/realms/{realm}/broker/{provider}/token") .build(keycloakSettings.get().get(REALM_SETTING), oauthProvider) .toString(); try { String response = doRequest(url, HttpMethod.GET, null); return DtoFactory.getInstance() .createDtoFromJson(toJson(response), KeycloakTokenResponse.class); } catch (BadRequestException e) { if (assotiateUserPattern.matcher(e.getMessage()).matches()) { throw new UnauthorizedException(e.getMessage()); } throw e; } }
Source:
public String getXRegistryConfigHeaderValue(@Nullable AuthConfigs paramAuthConfigs) { Map<String, AuthConfig> authConfigs = new HashMap<>(); authConfigs.putAll(initialAuthConfig.getAuthConfigs().getConfigs()); if (paramAuthConfigs != null && paramAuthConfigs.getConfigs() != null) { authConfigs.putAll(paramAuthConfigs.getConfigs()); } if (authConfigs.get("docker.io") != null) { AuthConfig authConfig = authConfigs.get("docker.io"); authConfigs.remove("docker.io"); authConfigs.put(DEFAULT_REGISTRY, authConfig); } return Base64.getEncoder().encodeToString(JsonHelper.toJson(authConfigs).getBytes()); }

Target:
public String getXRegistryConfigHeaderValue(@Nullable AuthConfigs paramAuthConfigs) { Map<String, AuthConfig> authConfigs = new HashMap<>(); authConfigs.putAll(initialAuthConfig.getAuthConfigs().getConfigs()); if (paramAuthConfigs != null && paramAuthConfigs.getConfigs() != null) { authConfigs.putAll(paramAuthConfigs.getConfigs()); } AuthConfig abnormalDefaultRegistryAuthConfig = authConfigs.remove("docker.io"); if (abnormalDefaultRegistryAuthConfig != null) { authConfigs.put(DEFAULT_REGISTRY, abnormalDefaultRegistryAuthConfig); } return Base64.getEncoder().encodeToString(JsonHelper.toJson(authConfigs).getBytes()); }
Source:
public @NonNull Comparator<@NonNull LamiTableEntry> getComparator() { return (o1, o2) -> { Number d1 = resolveNumber(o1); Number d2 = resolveNumber(o2); if (d1 == null && d2 == null) { return 0; } if (d1 == null) { return 1; } if (d2 == null) { return -1; } BigDecimal bd1 = new BigDecimal(d1.toString()); BigDecimal bd2 = new BigDecimal(d2.toString()); return bd1.compareTo(bd2); }; }

Target:
public @NonNull Comparator<@NonNull LamiTableEntry> getComparator() { return (o1, o2) -> { Number d1 = resolveNumber(o1); Number d2 = resolveNumber(o2); if (d1 == null && d2 == null) { return 0; } if (d1 == null) { return 1; } if (d2 == null) { return -1; } return Long.compare(d1.longValue(), d2.longValue()); }; }
Source:
private Subscription enqueue(Action0 action, long execTime) { if (innerSubscription.isUnsubscribed()) { return Subscriptions.empty(); } PriorityQueue<TimedAction> queue = QUEUE.get(); final TimedAction timedAction = new TimedAction(action, execTime, COUNTER_UPDATER.incrementAndGet(TrampolineScheduler.this)); queue.add(timedAction); if (wip.getAndIncrement() == 0) { while (!queue.isEmpty()) { queue.poll().action.call(); } wip.decrementAndGet(); return Subscriptions.empty(); } else { return Subscriptions.create(new Action0() { @Override public void call() { PriorityQueue<TimedAction> _q = QUEUE.get(); if (_q != null) { _q.remove(timedAction); } } }); } }

Target:
private Subscription enqueue(Action0 action, long execTime) { if (innerSubscription.isUnsubscribed()) { return Subscriptions.empty(); } PriorityQueue<TimedAction> queue = QUEUE.get(); final TimedAction timedAction = new TimedAction(action, execTime, COUNTER_UPDATER.incrementAndGet(TrampolineScheduler.this)); queue.add(timedAction); if (wip.getAndIncrement() == 0) { do { queue.poll().action.call(); } while (wip.decrementAndGet() > 0); return Subscriptions.empty(); } else { return Subscriptions.create(new Action0() { @Override public void call() { PriorityQueue<TimedAction> _q = QUEUE.get(); if (_q != null) { _q.remove(timedAction); } } }); } }
Source:
public void initialize(URL url, ResourceBundle resourceBundle) { queryState.getCurrentQuery().addListener((obs, odlVal, newVal) -> queryState.setSelectedModel(runQuery())); ListPane lp = new ListPane(queryState); VBox.setVgrow(lp, Priority.ALWAYS); ta = new TextArea(); ta.setEditable(false); ta.textProperty().bindBidirectional(queryState.getCurrentQuery()); vBox.getChildren().addAll(lp, ta); tableLikeView.setContent(new TablePane(queryState)); textLikeView.setContent(TextPane.getInstance(queryState)); }

Target:
public void initialize(URL url, ResourceBundle resourceBundle) { ListPane lp = new ListPane(queryState); VBox.setVgrow(lp, Priority.ALWAYS); ta = new TextArea(); ta.setEditable(false); ta.textProperty().bindBidirectional(queryState.getCurrentQuery()); vBox.getChildren().addAll(lp, ta); tableLikeView.setContent(new TablePane(queryState)); textLikeView.setContent(TextPane.getInstance(queryState)); }
Source:
private static QueryDataSource subquery(final DataSource dataSource) { return new QueryDataSource( GroupByQuery.builder() .setDataSource(dataSource) .setInterval(new MultipleIntervalSegmentSpec(Collections.singletonList(Intervals.of("2000/3000")))) .setGranularity(Granularities.ALL) .build() ); }

Target:
private static QueryDataSource subquery(final DataSource dataSource) { return new QueryDataSource( GroupByQuery.builder() .setDataSource(dataSource) .setInterval(new MultipleIntervalSegmentSpec(MILLENIUM_INTERVALS)) .setGranularity(Granularities.ALL) .build() ); }
Source:
public void getRowsAccessibleThroughCopies() { Transaction t = startTransaction(); byte[] rowKey = row(0); byte[] value = value(0); t.put(TEST_TABLE, ImmutableMap.of( Cell.create(rowKey, column(0)), value)); t.commit(); t = startTransaction(); SortedMap<byte[], RowResult<byte[]>> result = t.getRows(TEST_TABLE, ImmutableList.of(rowKey), ColumnSelection.all()); assertThat(result.get(rowKey)) .as("it should be possible to get a row from getRows with a passed-in byte array") .isNotNull() .satisfies(rowResult -> assertThat(rowResult.getOnlyColumnValue()).isEqualTo(value)); byte[] rowKeyCopy = row(0); assertThat(rowKeyCopy).isNotSameAs(rowKey); assertThat(result.get(rowKeyCopy)) .as("it should be possible to get a row from getRows with a copy of a passed-in byte array") .isNotNull() .satisfies(rowResult -> assertThat(rowResult.getOnlyColumnValue()).isEqualTo(value)); }

Target:
public void getRowsAccessibleThroughCopies() { Transaction t = startTransaction(); byte[] rowKey = row(0); byte[] value = value(0); t.put(TEST_TABLE, ImmutableMap.of( Cell.create(rowKey, column(0)), value)); t.commit(); t = startTransaction(); SortedMap<byte[], RowResult<byte[]>> result = t.getRows(TEST_TABLE, ImmutableList.of(rowKey), ColumnSelection.all()); assertThat(result.get(rowKey)) .as("it should be possible to get a row from getRows with a passed-in byte array") .isNotNull() .satisfies(rowResult -> assertThat(rowResult.getOnlyColumnValue()).isEqualTo(value)); byte[] rowKeyCopy = rowKey.clone(); assertThat(rowKeyCopy).isNotSameAs(rowKey); assertThat(result.get(rowKeyCopy)) .as("it should be possible to get a row from getRows with a copy of a passed-in byte array") .isNotNull() .satisfies(rowResult -> assertThat(rowResult.getOnlyColumnValue()).isEqualTo(value)); }
Source:
private boolean isAllowedInCourseLevel(String privilegeName) { Assumption.assertTrue(isPrivilegeNameValid(privilegeName)); return this.courseLevel.getOrDefault(privilegeName, Boolean.FALSE).booleanValue(); }

Target:
private boolean isAllowedInCourseLevel(String privilegeName) { Assumption.assertTrue(isPrivilegeNameValid(privilegeName)); return this.courseLevel.getOrDefault(privilegeName, false); }
Source:
public void apply( WorkspaceConfigImpl workspaceConfig, Component k8sComponent, FileContentProvider contentProvider) throws DevfileException { checkArgument(workspaceConfig != null, "Workspace config must not be null"); checkArgument(k8sComponent != null, "Component must not be null"); checkArgument( kubernetesBasedComponentTypes.contains(k8sComponent.getType()), format("Plugin must have %s type", String.join(" or ", kubernetesBasedComponentTypes))); String componentContent = retrieveContent(k8sComponent, contentProvider); List<HasMetadata> componentObjects = new ArrayList<>(unmarshalComponentObjects(k8sComponent, componentContent)); if (!k8sComponent.getSelector().isEmpty()) { componentObjects = SelectorFilter.filter(componentObjects, k8sComponent.getSelector()); } List<PodData> podsData = getPodDatas(componentObjects); Map<String, Map<String, String>> podToContainerAndMachineName = estimateMachineNames(podsData); linkCommandsToMachineName(workspaceConfig, k8sComponent, podToContainerAndMachineName); if (Boolean.TRUE.equals(k8sComponent.getMountSources())) { applyProjectsVolumes(podsData, componentObjects); } applyEntrypoints(k8sComponent.getEntrypoints(), componentObjects); Map<String, MachineConfigImpl> machineConfigs = k8sComponent.getAlias() != null ? prepareMachineConfigs(k8sComponent.getAlias(), podToContainerAndMachineName) : emptyMap(); k8sEnvProvisioner.provision(workspaceConfig, environmentType, componentObjects, machineConfigs); }

Target:
public void apply( WorkspaceConfigImpl workspaceConfig, Component k8sComponent, FileContentProvider contentProvider) throws DevfileException { checkArgument(workspaceConfig != null, "Workspace config must not be null"); checkArgument(k8sComponent != null, "Component must not be null"); checkArgument( kubernetesBasedComponentTypes.contains(k8sComponent.getType()), format("Plugin must have %s type", String.join(" or ", kubernetesBasedComponentTypes))); String componentContent = retrieveContent(k8sComponent, contentProvider); List<HasMetadata> componentObjects = new ArrayList<>(unmarshalComponentObjects(k8sComponent, componentContent)); if (!k8sComponent.getSelector().isEmpty()) { componentObjects = SelectorFilter.filter(componentObjects, k8sComponent.getSelector()); } List<PodData> podsData = getPodDatas(componentObjects); if (Boolean.TRUE.equals(k8sComponent.getMountSources())) { applyProjectsVolumes(podsData, componentObjects); } applyEntrypoints(k8sComponent.getEntrypoints(), componentObjects); Map<String, MachineConfigImpl> machineConfigs = prepareMachineConfigs(podsData, k8sComponent.getAlias()); linkCommandsToMachineName(workspaceConfig, k8sComponent, machineConfigs.keySet()); k8sEnvProvisioner.provision(workspaceConfig, environmentType, componentObjects, machineConfigs); }
Source:
private void doLogout() { boolean doUpdate = true; if (app == null) { doUpdate = false; app = WikipediaApp.getInstance(); } app.getEditTokenStorage().clearAllTokens(); app.getCookieManager().clearAllCookies(); app.getUserInfoStorage().clearUser(); Toast.makeText(app, R.string.toast_logout_complete, Toast.LENGTH_LONG).show(); if (doUpdate) { setupDynamicNavDrawerItems(); } }

Target:
private void doLogout() { app.getEditTokenStorage().clearAllTokens(); app.getCookieManager().clearAllCookies(); app.getUserInfoStorage().clearUser(); Toast.makeText(app, R.string.toast_logout_complete, Toast.LENGTH_LONG).show(); navDrawerHelper.setupDynamicNavDrawerItems(); }
Source:
public void testDecompressionSkipForBinaryFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibEncoder(ZlibWrapper.NONE, 9, 15, 8)); EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerMessageDeflateDecoder(false, ALWAYS_SKIP)); byte[] payload = new byte[300]; random.nextBytes(payload); assertTrue(encoderChannel.writeOutbound(Unpooled.wrappedBuffer(payload))); ByteBuf compressedPayload = encoderChannel.readOutbound(); BinaryWebSocketFrame compressedBinaryFrame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV1, compressedPayload); assertTrue(decoderChannel.writeInbound(compressedBinaryFrame)); WebSocketFrame inboundFrame = decoderChannel.readInbound(); assertEquals(WebSocketExtension.RSV1, inboundFrame.rsv()); assertEquals(compressedPayload, inboundFrame.content()); assertTrue(inboundFrame.release()); assertTrue(encoderChannel.finish()); assertFalse(decoderChannel.finish()); }

Target:
public void testDecompressionSkipForBinaryFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibEncoder(ZlibWrapper.NONE, 9, 15, 8)); EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerMessageDeflateDecoder(false, ALWAYS_SKIP)); byte[] payload = new byte[300]; random.nextBytes(payload); assertTrue(encoderChannel.writeOutbound(Unpooled.wrappedBuffer(payload))); ByteBuf compressedPayload = encoderChannel.readOutbound(); BinaryWebSocketFrame compressedBinaryFrame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV1, compressedPayload); assertTrue(decoderChannel.writeInbound(compressedBinaryFrame)); WebSocketFrame inboundFrame = decoderChannel.readInbound(); assertEquals(WebSocketExtension.RSV1, inboundFrame.rsv()); assertEquals(compressedPayload, inboundFrame.content()); assertTrue(inboundFrame.release()); assertTrue(encoderChannel.finishAndReleaseAll()); assertFalse(decoderChannel.finish()); }
Source:
public void copy(boolean cut) { Actor a = views.getKeyboardFocus(); if (a instanceof CopyListener) { Object content = cut ? ((CopyListener) a).cut() : ((CopyListener) a).copy(); if (content != null) { clipboard.setContents(assets.toJson(content)); contentClazz = content.getClass(); } } }

Target:
public void copy(boolean cut) { Actor a = views.getKeyboardFocus(); if (a instanceof CopyListener) { Object content = ((CopyListener) a).copy(cut); if (content != null) { for (ClipboardListener listener : clipboardListeners) { listener.copied(content); } clipboard.setContents(assets.toJson(content)); contentClazz = content.getClass(); } } }