auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected String nameFor(Unit<?> unit) { String label = this.unitToName.get(unit); if (label != null) { return label; } else if (unit instanceof BaseUnit) { return unit.getSymbol(); } else if (unit instanceof AlternateUnit) { return unit.getSymbol(); } else if (!(unit instanceof TransformedUnit)) { return null; } else { TransformedUnit<?> tfmUnit = (TransformedUnit) unit; Unit<?> baseUnit = tfmUnit.getParentUnit(); UnitConverter cvtr = tfmUnit.getConverter(); StringBuilder result = new StringBuilder(); String baseUnitName = format(baseUnit); String prefix = this.prefixFor(cvtr); if (baseUnitName.indexOf(183) < 0 && baseUnitName.indexOf(42) < 0 && baseUnitName.indexOf(47) < 0) { result.append(baseUnitName); } else { result.append('('); result.append(baseUnitName); result.append(')'); } if (prefix != null) { result.insert(0, prefix); } else if (cvtr instanceof AddConverter) { result.append('+'); result.append(((AddConverter) cvtr).getOffset()); } else if (cvtr instanceof RationalConverter) { double dividend = ((RationalConverter) cvtr).getDividend().doubleValue(); if (dividend != 1.0D) { result.append('*'); result.append(dividend); } double divisor = ((RationalConverter) cvtr).getDivisor().doubleValue(); if (divisor != 1.0D) { result.append('/'); result.append(divisor); } } else { if (!(cvtr instanceof MultiplyConverter)) { return "[" + baseUnit + "?]"; } result.append('*'); result.append(((MultiplyConverter) cvtr).getFactor()); } return result.toString(); } }

Target:
protected String nameFor(Unit<?> unit) { String label = unitToName.get(unit); if (label != null) return label; if (unit instanceof BaseUnit) return ((BaseUnit<?>) unit).getSymbol(); if (unit instanceof AlternateUnit) return ((AlternateUnit<?>) unit).getSymbol(); if (unit instanceof TransformedUnit) { TransformedUnit<?> tfmUnit = (TransformedUnit<?>) unit; Unit<?> baseUnit = tfmUnit.getParentUnit(); UnitConverter cvtr = tfmUnit.getConverter(); StringBuilder result = new StringBuilder(); String baseUnitName = format(baseUnit); String prefix = prefixFor(cvtr); if ((baseUnitName.indexOf('\u00b7') >= 0) || (baseUnitName.indexOf('*') >= 0) || (baseUnitName.indexOf('/') >= 0)) { result.append('('); result.append(baseUnitName); result.append(')'); } else { result.append(baseUnitName); } if (prefix != null) { result.insert(0, prefix); } else { if (cvtr instanceof AddConverter) { result.append('+'); result.append(((AddConverter) cvtr).getOffset()); } else if (cvtr instanceof RationalConverter) { double dividend = ((RationalConverter) cvtr).getDividend().doubleValue(); if (dividend != 1) { result.append('*'); result.append(dividend); } double divisor = ((RationalConverter) cvtr).getDivisor().doubleValue(); if (divisor != 1) { result.append('/'); result.append(divisor); } } else if (cvtr instanceof MultiplyConverter) { result.append('*'); result.append(((MultiplyConverter) cvtr).getFactor()); } else { return "[" + baseUnit + "?]"; } } return result.toString(); } return null; }
Source:
public WorkunitInfo compileWUFromECL(WorkunitInfo wu ) throws Exception { Integer sleeptime=wu.getSleepMillis(); if (sleeptime == null) { sleeptime = defaultWaitTime; } WorkunitInfo createdWU = createWUFromECL(wu); if (createdWU != null && createdWU.getErrorCount() == 0 && createdWU.getExceptions() == null) { createdWU.setCluster(wu.getCluster()); submitWU(createdWU); this.monitorWUToCompletion(createdWU); WUInfo parameters=new WUInfo(); parameters.setWuid(createdWU.getWuid()); parameters.setIncludeExceptions(true); WUInfoResponse res=wsWorkunitsServiceSoapProxy.WUInfo(parameters); if (createdWU.getExceptions() == null && res.getWorkunit() != null && res.getWorkunit().getExceptions() != null) { this.throwWsWUExceptions(res.getWorkunit().getExceptions(),"Workunit Compile Failed"); } } return createdWU; }

Target:
public WorkunitInfo compileWUFromECL(WorkunitInfo wu ) throws Exception { Integer sleeptime=wu.getSleepMillis(); if (sleeptime == null) { sleeptime = defaultWaitTime; } WorkunitInfo createdWU = createWUFromECL(wu); if (createdWU != null && createdWU.getErrorCount() == 0 && createdWU.getExceptions() == null) { createdWU.setCluster(wu.getCluster()); submitWU(createdWU); this.monitorWUToCompletion(createdWU); WUInfoResponse res=this.getWUInfo(createdWU.getWuid(), false, false, false, false, false, true, false, false, false); if (createdWU.getExceptions() == null && res.getWorkunit() != null && res.getWorkunit().getExceptions() != null) { this.throwWUECLExceptions(res.getWorkunit().getExceptions(),"Workunit Compile Failed"); } } return createdWU; }
Source:
private void printSuccessMessage(String domainName, String action) { if (addPermissions) { System.out.println(String.format(SUCCESSFULLY_COMPLETED_ACTION_ON_DOMAIN, "added", domainName)); } else { System.out.println(SERVICE_RESTART_MESSAGE); } }

Target:
private void printSuccessMessage(String domainName, String action) { if (addPermissions) { System.out.print(String.format(SUCCESS_MESSAGE_FOR_ACTION_WITH_ADD_PERMISSIONS, "added", domainName)); } System.out.println(SERVICE_RESTART_MESSAGE); }
Source:
public Collection<Session> getSessionsByIp(final InetAddress serverIp) { removeClosedSessions(); return sessions.stream() .filter(s -> InetExtractor.extract(s.getUserProperties()).equals(serverIp)) .filter(Session::isOpen) .collect(Collectors.toSet()); }

Target:
public Collection<Session> getSessionsByIp(final InetAddress serverIp) { return sessions.stream() .filter(Session::isOpen) .filter(s -> InetExtractor.extract(s.getUserProperties()).equals(serverIp)) .collect(Collectors.toSet()); }
Source:
public static Collection<Object[]> params() { return Arrays.asList(new Object[][]{ {INPUT_FADV_RANDOM, Default_JSSE}, {INPUT_FADV_NORMAL, Default_JSSE}, {INPUT_FADV_SEQUENTIAL, Default_JSSE}, {INPUT_FADV_RANDOM, Default_JSSE_with_GCM}, {INPUT_FADV_NORMAL, Default_JSSE_with_GCM}, {INPUT_FADV_SEQUENTIAL, Default_JSSE_with_GCM}, }); }

Target:
public static Collection<Object[]> params() { return Arrays.asList(new Object[][]{ {INPUT_FADV_SEQUENTIAL, Default_JSSE}, {INPUT_FADV_RANDOM, Default_JSSE_with_GCM}, {INPUT_FADV_NORMAL, Default_JSSE_with_GCM}, }); }
Source:
public void setUp() throws Exception { File file = new File(COPEPlugin.getLocalStorage(), "known-projects"); file.createNewFile(); Files.write(file.toPath(), "known1\nknown2\n".getBytes(), StandardOpenOption.WRITE); snapshotManager = new SnapshotManager(); }

Target:
public void setUp() throws Exception { File file = new File(COPEPlugin.getLocalStorage(), "known-projects"); file.createNewFile(); Files.write(file.toPath(), "known1\nknown2\n".getBytes(), StandardOpenOption.WRITE); snapshotManager = new SnapshotManager(COPEPlugin.getLocalStorage().getAbsolutePath()); }
Source:
private void loadRemoteEntries() { if (swipeRefresh != null && !swipeRefresh.isRefreshing()) { swipeRefresh.setRefreshing(true); } state.setLoadRemoteEntries(new LoadRemoteEntries(this)); Utils.execute(state.loadRemoteEntries); }

Target:
private void loadRemoteEntries() { state.setLoadRemoteEntries(new LoadRemoteEntries(this)); Utils.execute(state.loadRemoteEntries); }
Source:
public UserMetricsTask( final MeterRegistry registry, final JobSearchService jobSearchService, final UserMetricsProperties userMetricsProperties ) { this.registry = registry; this.jobSearchService = jobSearchService; this.userMetricsProperties = userMetricsProperties; this.activeUsersCount = new AtomicLong(0); this.activeUsersCountGauge = Gauge.builder(USER_ACTIVE_USERS_METRIC_NAME, activeUsersCount::get) .register(registry); }

Target:
public UserMetricsTask( final MeterRegistry registry, final JobSearchService jobSearchService, final UserMetricsProperties userMetricsProperties ) { this.registry = registry; this.jobSearchService = jobSearchService; this.userMetricsProperties = userMetricsProperties; this.activeUsersCount = new AtomicLong(0); Gauge.builder(USER_ACTIVE_USERS_METRIC_NAME, () -> this.getUsersCount()) .register(registry); }
Source:
public DimFilter toDruidFilter( final PlannerContext plannerContext, final RowSignature rowSignature, final RexNode rexNode ) { final List<RexNode> operands = ((RexCall) rexNode).getOperands(); final DruidExpression druidExpression = Expressions.toDruidExpression( plannerContext, rowSignature, operands.get(0) ); if (druidExpression == null || !druidExpression.isSimpleExtraction()) { return null; } String base64EncodedBloomKFilter = RexLiteral.stringValue(operands.get(1)); byte[] bytes = StringUtils.toUtf8(base64EncodedBloomKFilter); byte[] decoded = Base64.decodeBase64(bytes); try { BloomKFilter filter = BloomFilterSerializersModule.bloomKFilterFromBytes(decoded); return new BloomDimFilter( druidExpression.getSimpleExtraction().getColumn(), BloomKFilterHolder.fromBloomKFilter(filter), druidExpression.getSimpleExtraction().getExtractionFn() ); } catch (IOException ioe) { return null; } }

Target:
public DimFilter toDruidFilter( final PlannerContext plannerContext, final RowSignature rowSignature, final RexNode rexNode ) { final List<RexNode> operands = ((RexCall) rexNode).getOperands(); final DruidExpression druidExpression = Expressions.toDruidExpression( plannerContext, rowSignature, operands.get(0) ); if (druidExpression == null || !druidExpression.isSimpleExtraction()) { return null; } String base64EncodedBloomKFilter = RexLiteral.stringValue(operands.get(1)); final byte[] decoded = BaseEncoding.base64().decode(base64EncodedBloomKFilter); BloomKFilter filter; BloomKFilterHolder holder; try { filter = BloomFilterSerializersModule.bloomKFilterFromBytes(decoded); holder = BloomKFilterHolder.fromBloomKFilter(filter); } catch (IOException ioe) { throw new RuntimeException("Failed to deserialize bloom filter", ioe); } if (druidExpression.isSimpleExtraction()) { return new BloomDimFilter( druidExpression.getSimpleExtraction().getColumn(), holder, druidExpression.getSimpleExtraction().getExtractionFn() ); } else { return null; } }
Source:
private boolean shouldFetchFromSchemaRegistry(String id) { if (!failedFetchHistories.containsKey(id)) { return true; } FailedFetchHistory failedFetchHistory = failedFetchHistories.get(id); boolean maxRetriesNotExceeded = failedFetchHistory.numOfAttempts < getByIdMaxRetries; boolean minRetryIntervalSatisfied = System.nanoTime() - failedFetchHistory.previousAttemptTime >= TimeUnit.SECONDS .toNanos(getByIdMinIntervalSeconds); return maxRetriesNotExceeded && minRetryIntervalSatisfied; }

Target:
private synchronized boolean shouldFetchFromSchemaRegistry(String id) { if (!failedFetchHistories.containsKey(id)) { return true; } FailedFetchHistory failedFetchHistory = failedFetchHistories.get(id); boolean maxRetriesNotExceeded = failedFetchHistory.numOfAttempts < getByIdMaxRetries; boolean minRetryIntervalSatisfied = System.nanoTime() - failedFetchHistory.previousAttemptTime >= TimeUnit.SECONDS .toNanos(getByIdMinIntervalSeconds); return maxRetriesNotExceeded && minRetryIntervalSatisfied; }
Source:
public void configure(Binder binder) { Binders.dataSegmentPullerBinder(binder).addBinding("hdfs").to(HdfsDataSegmentPuller.class).in(LazySingleton.class); Binders.dataSegmentPusherBinder(binder).addBinding("hdfs").to(HdfsDataSegmentPusher.class).in(LazySingleton.class); Binders.dataSegmentKillerBinder(binder).addBinding("hdfs").to(HdfsDataSegmentKiller.class).in(LazySingleton.class); final Configuration conf = new Configuration(); conf.set("fs.hdfs.impl", DistributedFileSystem.class.getName()); if (props != null) { for (String propName : System.getProperties().stringPropertyNames()) { if (propName.startsWith("hadoop.")) { conf.set(propName.substring("hadoop.".length()), System.getProperty(propName)); } } } binder.bind(Configuration.class).toInstance(conf); JsonConfigProvider.bind(binder, "druid.storage", HdfsDataSegmentPusherConfig.class); Binders.taskLogsBinder(binder).addBinding("hdfs").to(HdfsTaskLogs.class); JsonConfigProvider.bind(binder, "druid.indexer.logs", HdfsTaskLogsConfig.class); binder.bind(HdfsTaskLogs.class).in(LazySingleton.class); }

Target:
public void configure(Binder binder) { Binders.dataSegmentPullerBinder(binder).addBinding("hdfs").to(HdfsDataSegmentPuller.class).in(LazySingleton.class); Binders.dataSegmentPusherBinder(binder).addBinding("hdfs").to(HdfsDataSegmentPusher.class).in(LazySingleton.class); Binders.dataSegmentKillerBinder(binder).addBinding("hdfs").to(HdfsDataSegmentKiller.class).in(LazySingleton.class); final Configuration conf = new Configuration(); conf.set("fs.hdfs.impl", DistributedFileSystem.class.getName()); conf.set("fs.file.impl", LocalFileSystem.class.getName()); if (props != null) { for (String propName : System.getProperties().stringPropertyNames()) { if (propName.startsWith("hadoop.")) { conf.set(propName.substring("hadoop.".length()), System.getProperty(propName)); } } } binder.bind(Configuration.class).toInstance(conf); JsonConfigProvider.bind(binder, "druid.storage", HdfsDataSegmentPusherConfig.class); Binders.taskLogsBinder(binder).addBinding("hdfs").to(HdfsTaskLogs.class); JsonConfigProvider.bind(binder, "druid.indexer.logs", HdfsTaskLogsConfig.class); binder.bind(HdfsTaskLogs.class).in(LazySingleton.class); }
Source:
public static void recvMsg(ZMQ.Socket socket, int flags, Consumer<ZMsg> handler) { ZMsg msg = null; try { msg = ZMsg.recvMsg(socket, flags); } catch (ZMQException ignore) { } handler.accept(msg); }

Target:
public static void recvMsg(ZMQ.Socket socket, int flags, Consumer<ZMsg> handler) { handler.accept(ZMsg.recvMsg(socket, flags)); }
Source:
public ClientDiscoveryService build() { ArrayList<CandidateClusterContext> contexts = new ArrayList<CandidateClusterContext>(); for (ClientConfig config : configs) { ClientNetworkConfig networkConfig = config.getNetworkConfig(); SocketInterceptor interceptor = initSocketInterceptor(networkConfig.getSocketInterceptorConfig()); ICredentialsFactory credentialsFactory = initCredentialsFactory(config); if (credentialsFactory == null) { credentialsFactory = new StaticCredentialsFactory(new UsernamePasswordCredentials(config.getClientName(), "")); } credentialsFactory.configure(cs -> { }); DiscoveryService discoveryService = initDiscoveryService(config); AddressProvider provider; if (externalAddressProvider != null) { provider = externalAddressProvider; } else { provider = createAddressProvider(config, discoveryService); } final SSLConfig sslConfig = networkConfig.getSSLConfig(); final SocketOptions socketOptions = networkConfig.getSocketOptions(); contexts.add(new CandidateClusterContext(config.getClientName(), provider, discoveryService, credentialsFactory, interceptor, qualifier -> clientExtension.createChannelInitializer(sslConfig, socketOptions))); } return new ClientDiscoveryService(configsTryCount, contexts); }

Target:
public ClientDiscoveryService build() { ArrayList<CandidateClusterContext> contexts = new ArrayList<CandidateClusterContext>(); for (ClientConfig config : configs) { ClientNetworkConfig networkConfig = config.getNetworkConfig(); SocketInterceptor interceptor = initSocketInterceptor(networkConfig.getSocketInterceptorConfig()); ICredentialsFactory credentialsFactory = initCredentialsFactory(config); if (credentialsFactory == null) { credentialsFactory = new StaticCredentialsFactory(new UsernamePasswordCredentials(config.getClientName(), "")); } credentialsFactory.configure(cs -> { throw new UnsupportedCallbackException(cs[0]); }); DiscoveryService discoveryService = initDiscoveryService(config); AddressProvider provider; if (externalAddressProvider != null) { provider = externalAddressProvider; } else { provider = createAddressProvider(config, discoveryService); } final SSLConfig sslConfig = networkConfig.getSSLConfig(); final SocketOptions socketOptions = networkConfig.getSocketOptions(); contexts.add(new CandidateClusterContext(config.getClientName(), provider, discoveryService, credentialsFactory, interceptor, qualifier -> clientExtension.createChannelInitializer(sslConfig, socketOptions))); } return new ClientDiscoveryService(configsTryCount, contexts); }
Source:
private void insertTextIntoPage(String text) { if (this.selectionStart != this.selectionEnd) { this.removeSelectedText(); } String s = this.text; this.selectionEnd = MathHelper.clamp(this.selectionEnd, 0, s.length()); String s1 = (new StringBuilder(s)).insert(this.selectionEnd, text).toString(); int i = this.font.getWordWrappedHeight(s1 + "" + TextFormatting.BLACK + "_", 114); if (i <= 128 && s1.length() < 1024) { this.setText(s1); this.selectionStart = this.selectionEnd = Math.min(this.text.length(), this.selectionEnd + text.length()); } }

Target:
private void insertTextIntoPage(String text) { if (this.selectionStart != this.selectionEnd) this.removeSelectedText(); String s = this.text; this.selectionEnd = MathHelper.clamp(this.selectionEnd, 0, s.length()); String s1 = (new StringBuilder(s)).insert(this.selectionEnd, text).toString(); int i = this.font.getWordWrappedHeight(s1 + "" + TextFormatting.BLACK + "_", 114); if (i <= 128 && s1.length() < 1024) { this.setText(s1); this.selectionStart = this.selectionEnd = Math.min(this.text.length(), this.selectionEnd + text.length()); } }
Source:
private void extractCollectionId(Element mods, IndexDocumentBean idb) { List<?> identifiers = mods.getChildren("identifier", JDOMNamespaceUtil.MODS_V3_NS); List<String> collectionId = new ArrayList<>(); if (identifiers != null && identifiers.size() > 0) { for (Object id: identifiers) { Element aid = (Element) id; Attribute type = aid.getAttribute("type"); Attribute collection = aid.getAttribute("displayLabel"); if (type == null || collection == null) { continue; } if (collection.getValue().equals("Collection Number") && type.getValue().equals("local")) { collectionId.add(aid.getValue()); } } } if (collectionId.size() > 0) { idb.setCollectionId(collectionId.get(0)); } else { idb.setCollectionId(null); } }

Target:
private void extractCollectionId(Element mods, IndexDocumentBean idb) { List<?> identifiers = mods.getChildren("identifier", JDOMNamespaceUtil.MODS_V3_NS); String collectionId = null; if (identifiers != null && identifiers.size() > 0) { for (Object id: identifiers) { Element aid = (Element) id; Attribute type = aid.getAttribute("type"); Attribute collection = aid.getAttribute("displayLabel"); if (type == null || collection == null) { continue; } if (collection.getValue().equals("Collection Number") && type.getValue().equals("local")) { collectionId = aid.getValue(); break; } } } idb.setCollectionId(collectionId); }
Source:
public ImmutablePair validateWorkflowSet(Set<SourceFile> sourcefiles, String primaryDescriptorFilePath) { List<SourceFile.FileType> fileTypes = new ArrayList<>(Arrays.asList(SourceFile.FileType.DOCKSTORE_CWL)); Set<SourceFile> filteredSourcefiles = filterSourcefiles(sourcefiles, fileTypes); Optional<SourceFile> mainDescriptor = filteredSourcefiles.stream().filter((sourceFile -> Objects.equals(sourceFile.getPath(), primaryDescriptorFilePath))).findFirst(); Boolean isValid = true; String validationMessage = null; Map<String, String> validationMessageObject = new HashMap<>(); if (mainDescriptor.isPresent()) { Yaml yaml = new Yaml(); String content = mainDescriptor.get().getContent(); if (content == null || content.isEmpty()) { isValid = false; validationMessage = "Primary descriptor is empty."; } else if (!content.contains("class: Workflow")) { isValid = false; validationMessage = "Requires class: Workflow."; } else if (!this.isValidCwl(content, yaml)) { isValid = false; validationMessage = "Invalid CWL version."; } } else { validationMessage = "Primary CWL descriptor is not present."; isValid = false; } validationMessageObject.put(primaryDescriptorFilePath, validationMessage); return new ImmutablePair<>(isValid, validationMessageObject); }

Target:
public VersionTypeValidation validateWorkflowSet(Set<SourceFile> sourcefiles, String primaryDescriptorFilePath) { List<SourceFile.FileType> fileTypes = new ArrayList<>(Arrays.asList(SourceFile.FileType.DOCKSTORE_CWL)); Set<SourceFile> filteredSourcefiles = filterSourcefiles(sourcefiles, fileTypes); Optional<SourceFile> mainDescriptor = filteredSourcefiles.stream().filter((sourceFile -> Objects.equals(sourceFile.getPath(), primaryDescriptorFilePath))).findFirst(); boolean isValid = true; String validationMessage = null; Map<String, String> validationMessageObject = new HashMap<>(); if (mainDescriptor.isPresent()) { Yaml yaml = new Yaml(); String content = mainDescriptor.get().getContent(); if (content == null || content.isEmpty()) { isValid = false; validationMessage = "Primary descriptor is empty."; } else if (!content.contains("class: Workflow")) { isValid = false; validationMessage = "Requires class: Workflow."; } else if (!this.isValidCwl(content, yaml)) { isValid = false; validationMessage = "Invalid CWL version."; } } else { validationMessage = "Primary CWL descriptor is not present."; isValid = false; } validationMessageObject.put(primaryDescriptorFilePath, validationMessage); return new VersionTypeValidation(isValid, validationMessageObject); }
Source:
public boolean equals(Object other) { if (other == null || !(other instanceof ShowSchemasStatement)) return false; ShowSchemasStatement stmt = (ShowSchemasStatement) other; return Objects.equals(schemaPattern, stmt.getSchemaPattern()); }

Target:
public boolean equals(Object other) { if (!(other instanceof ShowSchemasStatement)) return false; ShowSchemasStatement stmt = (ShowSchemasStatement) other; return Objects.equals(schemaPattern, stmt.getSchemaPattern()); }
Source:
public void waitUntilAllBlocked() { try { _blockersDoneLatch.await(); } catch (Exception ex) { } }

Target:
public void waitUntilAllBlocked() throws InterruptedException { _blockersDoneLatch.await(); }
Source:
public void addBuddy(UserDto user, BuddyDto buddy) { Require.that(user != null && user.getId() != null, InvalidDataException::emptyUserId); Require.that(buddy != null && buddy.getId() != null, InvalidDataException::emptyBuddyId); updateUser(user.getId(), userEntity -> { userRetrievalService.assertValidatedUser(userEntity); Buddy buddyEntity = buddyRepository.findById(buddy.getId()) .orElseThrow(() -> InvalidDataException.missingEntity(Buddy.class, buddy.getId())); userEntity.addBuddy(buddyEntity); UserAnonymized userAnonymizedEntity = userEntity.getAnonymized(); userAnonymizedEntity.addBuddyAnonymized(buddyEntity.getBuddyAnonymized()); userAnonymizedService.updateUserAnonymized(userAnonymizedEntity); }); }

Target:
public void addBuddy(UserDto user, BuddyDto buddy) { Require.that(user != null && user.getId() != null, InvalidDataException::emptyUserId); Require.that(buddy != null && buddy.getId() != null, InvalidDataException::emptyBuddyId); updateUser(user.getId(), userEntity -> { userAssertionService.assertValidatedUser(userEntity); Buddy buddyEntity = buddyRepository.findById(buddy.getId()) .orElseThrow(() -> InvalidDataException.missingEntity(Buddy.class, buddy.getId())); userEntity.addBuddy(buddyEntity); UserAnonymized userAnonymizedEntity = userEntity.getAnonymized(); userAnonymizedEntity.addBuddyAnonymized(buddyEntity.getBuddyAnonymized()); userAnonymizedService.updateUserAnonymized(userAnonymizedEntity); }); }
Source:
public static void main(String[] args) { String endpoint = "https://<RESOURCE_NAME>.communication.azure.com"; String accessToken = "SECRET"; HttpClient httpClient = new NettyAsyncHttpClientBuilder().build(); CommunicationClientCredential credential = null; try { credential = new CommunicationClientCredential(accessToken); } catch (NoSuchAlgorithmException e) { System.out.println(e.getMessage()); } catch (InvalidKeyException e) { System.out.println(e.getMessage()); } SmsClientBuilder smsClientBuilder = new SmsClientBuilder(); smsClientBuilder.endpoint(endpoint) .credential(credential) .httpClient(httpClient); SmsClient smsClient = smsClientBuilder.buildClient(); List<PhoneNumber> to = new ArrayList<PhoneNumber>(); to.add(new PhoneNumber("<to-phone-number>")); SendSmsOptions options = new SendSmsOptions(); options.setEnableDeliveryReport(true); SendSmsResponse response = smsClient.sendMessage( new PhoneNumber("<leased-phone-number>"), to, "your message", options ); System.out.println("MessageId: " + response.getMessageId()); }

Target:
public static void main(String[] args) { String endpoint = "https://<RESOURCE_NAME>.communication.azure.com"; String accessKey = "SECRET"; HttpClient httpClient = new NettyAsyncHttpClientBuilder().build(); CommunicationClientCredential credential = null; try { credential = new CommunicationClientCredential(accessKey); } catch (NoSuchAlgorithmException e) { System.out.println(e.getMessage()); } catch (InvalidKeyException e) { System.out.println(e.getMessage()); } SmsClientBuilder smsClientBuilder = new SmsClientBuilder(); smsClientBuilder.endpoint(endpoint) .credential(credential) .httpClient(httpClient); SmsClient smsClient = smsClientBuilder.buildClient(); List<PhoneNumber> to = new ArrayList<PhoneNumber>(); to.add(new PhoneNumber("<to-phone-number>")); SendSmsOptions options = new SendSmsOptions(); options.setEnableDeliveryReport(true); SendSmsResponse response = smsClient.sendMessage( new PhoneNumber("<leased-phone-number>"), to, "your message", options ); System.out.println("MessageId: " + response.getMessageId()); }
Source:
public void testSetTitleIconStartMargin() throws Throwable { int startMargin = 100; int navIconWidth = 100; mActivityRule.runOnUiThread(() -> { mToolbar.setNavigationIconContainerWidth(navIconWidth); mToolbar.setTitleIcon(android.R.drawable.sym_def_app_icon); mToolbar.setTitleIconStartMargin(startMargin); }); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); onView(withId(R.id.title_icon)).check(matches(withLeft(navIconWidth + startMargin))); }

Target:
public void testSetTitleIconStartMargin() throws Throwable { int startMargin = 100; int navIconWidth = 100; mActivityRule.runOnUiThread(() -> { mToolbar.setNavigationIconContainerWidth(navIconWidth); mToolbar.setTitleIcon(android.R.drawable.sym_def_app_icon); mToolbar.setTitleIconStartMargin(startMargin); }); onView(withId(R.id.title_icon)).check(matches(withLeft(navIconWidth + startMargin))); }
Source:
public String toString() { return getClass().getName() + "." + getName(); }

Target:
public String toString() { return getClass().getName() + "." + getName() + " Guid = " + guid.toString(); }
Source:
public PatchScript call() throws OrmException, NoSuchChangeException { validatePatchSetId(psa); validatePatchSetId(psb); control = changeControlFactory.validateFor(changeId); change = control.getChange(); ReviewDb db = null; try { db = schemaFactory.open(); patchSet = db.patchSets().get(patchSetId); if (patchSet == null) { throw new NoSuchChangeException(changeId); } projectKey = change.getProject(); aId = psa != null ? toObjectId(db, psa) : null; bId = toObjectId(db, psb); try { git = repoManager.openRepository(projectKey.get()); } catch (RepositoryNotFoundException e) { log.error("Repository " + projectKey + " not found", e); throw new NoSuchChangeException(changeId, e); } final String fileName = patchKey.getFileName(); try { final PatchList list = listFor(keyFor(settings.getWhitespace())); final PatchScriptBuilder b = newBuilder(list); final PatchListEntry contentWS = list.get(fileName); final CommentDetail comments = allComments(db); final PatchListEntry contentActual; if (settings.getWhitespace() == Whitespace.IGNORE_NONE) { contentActual = contentWS; } else { contentActual = listFor(keyFor(Whitespace.IGNORE_NONE)).get(fileName); } try { return b.toPatchScript(contentWS, comments, contentActual); } catch (IOException e) { log.error("File content unavailable", e); throw new NoSuchChangeException(changeId, e); } } finally { git.close(); } } finally { if (db != null) { db.close(); } } }

Target:
public PatchScript call() throws OrmException, NoSuchChangeException { validatePatchSetId(psa); validatePatchSetId(psb); control = changeControlFactory.validateFor(changeId); change = control.getChange(); ReviewDb db = schemaFactory.open(); try { patchSet = db.patchSets().get(patchSetId); if (patchSet == null) { throw new NoSuchChangeException(changeId); } projectKey = change.getProject(); aId = psa != null ? toObjectId(db, psa) : null; bId = toObjectId(db, psb); try { git = repoManager.openRepository(projectKey.get()); } catch (RepositoryNotFoundException e) { log.error("Repository " + projectKey + " not found", e); throw new NoSuchChangeException(changeId, e); } final String fileName = patchKey.getFileName(); try { final PatchList list = listFor(keyFor(settings.getWhitespace())); final PatchScriptBuilder b = newBuilder(list); final PatchListEntry contentWS = list.get(fileName); final CommentDetail comments = allComments(db); final PatchListEntry contentActual; if (settings.getWhitespace() == Whitespace.IGNORE_NONE) { contentActual = contentWS; } else { contentActual = listFor(keyFor(Whitespace.IGNORE_NONE)).get(fileName); } try { return b.toPatchScript(contentWS, comments, contentActual); } catch (IOException e) { log.error("File content unavailable", e); throw new NoSuchChangeException(changeId, e); } } finally { git.close(); } } finally { db.close(); } }
Source:
public static void main(String[] args) { if (args.length != 3) { println("usage: FunctionalTest <ENDPOINT> <ACCESSKEY> <SECRETKEY>"); return; } endpoint = args[0]; accessKey = args[1]; secretKey = args[2]; try { client = new MinioClient(endpoint, accessKey, secretKey); makeBucket_test1(); if (!endpoint.toLowerCase().contains("minio")) { makeBucket_test2(); makeBucket_test3(); } listBuckets_test(); bucketExists_test(); removeBucket_test(); setup(); putObject_test1(); putObject_test2(); putObject_test3(); putObject_test4(); statObject_test(); getObject_test1(); getObject_test2(); getObject_test3(); getObject_test4(); listObject_test1(); listObject_test2(); listObject_test3(); listObject_test4(); removeObject_test(); listIncompleteUploads_test1(); listIncompleteUploads_test2(); listIncompleteUploads_test3(); removeIncompleteUploads_test(); presignedGetObject_test1(); presignedGetObject_test2(); presignedPutObject_test1(); presignedPutObject_test2(); presignedPostPolicy_test(); copyObject_test1(); copyObject_test2(); threadedPutObject(); teardown(); } catch (Exception e) { e.printStackTrace(); return; } }

Target:
public static void main(String[] args) { if (args.length != 3) { println("usage: FunctionalTest <ENDPOINT> <ACCESSKEY> <SECRETKEY>"); return; } endpoint = args[0]; accessKey = args[1]; secretKey = args[2]; try { client = new MinioClient(endpoint, accessKey, secretKey); makeBucket_test1(); if (!endpoint.toLowerCase().contains("minio")) { makeBucket_test2(); makeBucket_test3(); } listBuckets_test(); bucketExists_test(); removeBucket_test(); setup(); putObject_test1(); putObject_test2(); putObject_test3(); putObject_test4(); statObject_test(); getObject_test1(); getObject_test2(); getObject_test3(); getObject_test4(); listObject_test1(); listObject_test2(); listObject_test3(); listObject_test4(); removeObject_test(); listIncompleteUploads_test1(); listIncompleteUploads_test2(); listIncompleteUploads_test3(); removeIncompleteUploads_test(); presignedGetObject_test1(); presignedGetObject_test2(); presignedPutObject_test1(); presignedPutObject_test2(); presignedPostPolicy_test(); copyObject_test1(); copyObject_test2(); copyObject_test3(); copyObject_test4(); copyObject_test5(); threadedPutObject(); teardown(); } catch (Exception e) { e.printStackTrace(); return; } }
Source:
public void parseArguments(List<String> args) throws Exception { args.remove(0); ParametersParser parser = new ParametersParser( getClass().getResourceAsStream("arguments.properties"), "module" ); moduleArgs = parser.parse(args); if(moduleArgs.containsKey("help")) { printUsage(parser); throw new ExitException(); } List<String> actionOthers = (List<String>) moduleArgs.get(ParametersParser.OTHER); String action = actionOthers.remove(0); actionMethod = actions.get(action); if(actionMethod == null) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } parser = new ParametersParser( getClass().getResourceAsStream("arguments.properties"), action ); actionArgs = parser.parse(actionOthers); List<Throwable> actionErrors = (List<Throwable>) actionArgs.get(ParametersParser.ERROR); if(actionArgs.containsKey("help")) { printUsage(parser); throw new ExitException(); } else if(!actionErrors.isEmpty()) { for(Throwable t : actionErrors) { if(t instanceof ExitException) { logger.error(t.getMessage()); throw (ExitException)t; } } } }

Target:
public void parseArguments(List<String> args) throws Exception { args.remove(0); ParametersParser parser = new ParametersParser( getClass().getResourceAsStream("arguments.properties"), "module" ); moduleArgs = parser.parse(args); List<String> actionOthers = (List<String>) moduleArgs.get(ParametersParser.PARAMETER_KEY_OTHER); if(moduleArgs.containsKey("help")) { printUsage(parser); throw new ExitException("Help", 0); } if(actionOthers.size() < 1) { logger.error("Please provide action."); throw new ExitException("Action not provided", 1); } String action = actionOthers.remove(0); actionMethod = actions.get(action); if(actionMethod == null) { throw new IllegalArgumentException( String.format("No such action '%1$s' exists for module '%2$s'", action, getName()) ); } parser = new ParametersParser( getClass().getResourceAsStream("arguments.properties"), action ); actionArgs = parser.parse(actionOthers); List<Throwable> actionErrors = (List<Throwable>) actionArgs.get(ParametersParser.PARAMETER_KEY_ERRORS); if(actionArgs.containsKey("help")) { printUsage(parser); throw new ExitException("Help", 0); } else if(!actionErrors.isEmpty()) { for(Throwable t : actionErrors) { logger.error(t.getMessage()); logger.debug(t.getMessage(), t); } throw new ExitException("Parsing error", 1); } }
Source:
public void recreateImageReaderWhenRefresh() { mDeferredImageReaderSurface.refresh(); mDeferredImageReaderSurface.notifySurfaceAttached(); mDeferredImageReaderSurface.refresh(); mDeferredImageReaderSurface.notifySurfaceAttached(); assertThat(mDeferredImageReaderSurface.mImageReaderToReleaseList.size()) .isEqualTo(2); assertThat(mDeferredImageReaderSurface.getAttachedCount()) .isEqualTo(3); assertThat(mDeferredImageReaderSurface.getSurface()).isNotNull(); }

Target:
public void recreateImageReaderWhenRefresh() { mDeferredImageReaderSurface.refresh(); mDeferredImageReaderSurface.notifySurfaceAttached(); mDeferredImageReaderSurface.refresh(); mDeferredImageReaderSurface.notifySurfaceAttached(); assertThat(mDeferredImageReaderSurface.mImageReaderToReleaseList.size()) .isEqualTo(2); assertThat(mDeferredImageReaderSurface.getAttachedCount()).isEqualTo(3); assertThat(mDeferredImageReaderSurface.getImageReader()).isNotNull(); }
Source:
public void testGenSecretKeyKeySize() { for(KeyType type: keyTypes){ byte[] key = KeyGenUtils.genSecretKey(type).getEncoded(); assertEquals("KeyType: "+type.name(), type.keySize >> 3, key.length); } }

Target:
public void testGenSecretKeyKeySize() { for(KeyType type: keyTypes){ byte[] key = KeyGenUtils.genSecretKey(type).getEncoded(); int keySizeBytes = type.keySize >> 3; assertEquals("KeyType: "+type.name(), keySizeBytes, key.length); } }
Source:
@VisibleForTesting ConfigurableResource getMaxResources(String queue) { ConfigurableResource maxQueueResource = maxQueueResources.get(queue); return maxQueueResource == null ? queueMaxResourcesDefault : maxQueueResource; }

Target:
ConfigurableResource getMaxResources(String queue) { ConfigurableResource maxQueueResource = maxQueueResources.get(queue); if (maxQueueResource == null) { maxQueueResource = queueMaxResourcesDefault; } return maxQueueResource; }
Source:
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { if (block == ItemsAndBlocks.backpackStandGhost) { world.setBlockToAir(x, y, z); if (!world.isRemote) dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); } }

Target:
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { if (world.getBlock(x, y + 1, z) != ItemsAndBlocks.backpackStandGhost) { world.setBlockToAir(x, y, z); if (!world.isRemote) dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); } }
Source:
public byte[] call(final byte[] memento) throws InterruptedException { LOG.info("SimpleEMTask commencing..."); LOG.log(Level.INFO, "Before sleep, memory store contains {0} blocks", memoryStore.getAll(DATATYPE)); final Map<Long, Object> initialData = memoryStore.getRange(DATATYPE, ids.get(0), ids.get(NUM_DATA - 1)); assert initialData.keySet().containsAll(ids); assert initialData.values().containsAll(ids); simpleEMTaskReady.setReady(true); heartBeatTriggerManager.triggerHeartBeat(); final long sleepMillis = (iterations + 1) * periodMillis; LOG.info("Sleep for: " + sleepMillis); Thread.sleep(sleepMillis); LOG.log(Level.INFO, "After sleep, memory store contains {0} blocks", memoryStore.getAll(DATATYPE)); final Map<Long, Object> dataAfterMove = memoryStore.getRange(DATATYPE, ids.get(0), ids.get(NUM_DATA - 1)); assert dataAfterMove.keySet().containsAll(ids); assert dataAfterMove.values().containsAll(ids); return null; }

Target:
public byte[] call(final byte[] memento) throws InterruptedException { LOG.info("SimpleEMTask commencing..."); final Map<Long, Object> initialData = memoryStore.getRange(DATATYPE, ids.get(0), ids.get(NUM_DATA - 1)); assert initialData.keySet().containsAll(ids); assert initialData.values().containsAll(ids); simpleEMTaskReady.setReady(true); heartBeatTriggerManager.triggerHeartBeat(); final long sleepMillis = (iterations + 1) * periodMillis; LOG.info("Sleep for: " + sleepMillis); Thread.sleep(sleepMillis); final Map<Long, Object> dataAfterMove = memoryStore.getRange(DATATYPE, ids.get(0), ids.get(NUM_DATA - 1)); assert dataAfterMove.keySet().containsAll(ids); assert dataAfterMove.values().containsAll(ids); return null; }
Source:
public boolean canReadCommit(ReviewDb db, RevWalk rw, RevCommit commit) { try { Repository repo = repoManager.openRepository(getProject().getNameKey()); try { return isMergedIntoVisibleRef(repo, db, rw, commit, repo.getAllRefs()); } finally { repo.close(); } } catch (IOException e) { String msg = String.format( "Cannot verify permissions to commit object %s in repository %s", commit.name(), getProject().getNameKey()); log.error(msg, e); return false; } }

Target:
public boolean canReadCommit(ReviewDb db, RevWalk rw, RevCommit commit) { try { Repository repo = openRepository(); try { return isMergedIntoVisibleRef(repo, db, rw, commit, repo.getAllRefs()); } finally { repo.close(); } } catch (IOException e) { String msg = String.format( "Cannot verify permissions to commit object %s in repository %s", commit.name(), getProject().getNameKey()); log.error(msg, e); return false; } }
Source:
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (this.singletonsInstantiated) { if (bean instanceof MessageChannelMetrics) { MessageChannelMetrics monitor = (MessageChannelMetrics) bean; this.channels.add(monitor); registerChannel(monitor); } else if (bean instanceof MessageProducer && bean instanceof Lifecycle) { registerProducer((MessageProducer) bean); } else if (bean instanceof AbstractEndpoint) { if (bean instanceof IntegrationConsumer) { IntegrationConsumer integrationConsumer = (IntegrationConsumer) bean; MessageHandler handler = integrationConsumer.getHandler(); if (handler instanceof MessageHandlerMetrics) { MessageHandlerMetrics messageHandlerMetrics = (MessageHandlerMetrics) handler; registerHandler(messageHandlerMetrics); this.handlers.add(messageHandlerMetrics); return bean; } } else if (bean instanceof SourcePollingChannelAdapter) { SourcePollingChannelAdapter pollingChannelAdapter = (SourcePollingChannelAdapter) bean; MessageSource<?> messageSource = pollingChannelAdapter.getMessageSource(); if (messageSource instanceof MessageSourceMetrics) { MessageSourceMetrics messageSourceMetrics = (MessageSourceMetrics) messageSource; registerSource(messageSourceMetrics); this.sources.add(messageSourceMetrics); return bean; } } registerEndpoint((AbstractEndpoint) bean); } } return bean; }

Target:
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (this.singletonsInstantiated) { try { if (bean instanceof MessageChannelMetrics) { MessageChannelMetrics monitor = (MessageChannelMetrics) extractTarget(bean); this.channels.add(monitor); registerChannel(monitor); this.runtimeBeans.add(bean); } else if (bean instanceof MessageProducer && bean instanceof Lifecycle) { registerProducer((MessageProducer) bean); this.runtimeBeans.add(bean); } else if (bean instanceof AbstractEndpoint) { if (bean instanceof IntegrationConsumer) { IntegrationConsumer integrationConsumer = (IntegrationConsumer) bean; MessageHandler handler = integrationConsumer.getHandler(); if (handler instanceof MessageHandlerMetrics) { MessageHandlerMetrics messageHandlerMetrics = (MessageHandlerMetrics) extractTarget(handler); registerHandler(messageHandlerMetrics); this.handlers.add(messageHandlerMetrics); this.runtimeBeans.add(messageHandlerMetrics); return bean; } } else if (bean instanceof SourcePollingChannelAdapter) { SourcePollingChannelAdapter pollingChannelAdapter = (SourcePollingChannelAdapter) bean; MessageSource<?> messageSource = pollingChannelAdapter.getMessageSource(); if (messageSource instanceof MessageSourceMetrics) { MessageSourceMetrics messageSourceMetrics = (MessageSourceMetrics) extractTarget(messageSource); registerSource(messageSourceMetrics); this.sources.add(messageSourceMetrics); this.runtimeBeans.add(messageSourceMetrics); return bean; } } registerEndpoint((AbstractEndpoint) bean); this.runtimeBeans.add(bean); } } catch (Exception e) { logger.error("Could not register an MBean for: " + beanName, e); } } return bean; }
Source:
Path(Method method, int p, String name, Converter<T, String> valueConverter, boolean encoded) { this.name = checkNotNull(name, "name == null"); this.valueConverter = valueConverter; this.encoded = encoded; this.method = method; this.p = p; }

Target:
Path(Method method, int p, String name, Converter<T, String> valueConverter, boolean encoded) { this.method = method; this.p = p; this.name = checkNotNull(name, "name == null"); this.valueConverter = valueConverter; this.encoded = encoded; }
Source:
private void scanFile(InputFile inputFile) { PythonFile pythonFile = SonarQubePythonFile.create(inputFile); PythonVisitorContext visitorContext; try { AstNode astNode = parser.parse(pythonFile.content()); FileInput parse = new PythonTreeMaker().fileInput(astNode); visitorContext = new PythonVisitorContext(astNode, parse, pythonFile); saveMeasures(inputFile, visitorContext); } catch (RecognitionException e) { visitorContext = new PythonVisitorContext(pythonFile, e); LOG.error("Unable to parse file: " + inputFile.toString()); LOG.error(e.getMessage()); context.newAnalysisError() .onFile(inputFile) .at(inputFile.newPointer(e.getLine(), 0)) .message(e.getMessage()) .save(); } List<PythonSubscriptionCheck> checksBasedOnTree = new ArrayList<>(); for (PythonCheck check : checks.all()) { if (check instanceof PythonSubscriptionCheck) { checksBasedOnTree.add((PythonSubscriptionCheck) check); } else { check.scanFile(visitorContext); } } SubscriptionVisitor.analyze(checksBasedOnTree, visitorContext); saveIssues(inputFile, visitorContext.getIssues()); visitorContext.rootTree().accept(new SymbolVisitor(context.newSymbolTable().onFile(inputFile))); new PythonHighlighter(context, inputFile).scanFile(visitorContext); }

Target:
private void scanFile(InputFile inputFile) { PythonFile pythonFile = SonarQubePythonFile.create(inputFile); PythonVisitorContext visitorContext; try { AstNode astNode = parser.parse(pythonFile.content()); FileInput parse = new PythonTreeMaker().fileInput(astNode); visitorContext = new PythonVisitorContext(astNode, parse, pythonFile); saveMeasures(inputFile, visitorContext); } catch (RecognitionException e) { visitorContext = new PythonVisitorContext(pythonFile, e); LOG.error("Unable to parse file: " + inputFile.toString()); LOG.error(e.getMessage()); context.newAnalysisError() .onFile(inputFile) .at(inputFile.newPointer(e.getLine(), 0)) .message(e.getMessage()) .save(); } List<PythonSubscriptionCheck> checksBasedOnTree = new ArrayList<>(); for (PythonCheck check : checks.all()) { if (check instanceof PythonSubscriptionCheck) { checksBasedOnTree.add((PythonSubscriptionCheck) check); } else { check.scanFile(visitorContext); } } SubscriptionVisitor.analyze(checksBasedOnTree, visitorContext); saveIssues(inputFile, visitorContext.getIssues()); new SymbolVisitor(context.newSymbolTable().onFile(inputFile)).visitFileInput(visitorContext.rootTree()); new PythonHighlighter(context, inputFile).scanFile(visitorContext); }
Source:
public String toString() { return MoreObjects.toStringHelper(this) .add("blockId", mSrcBlockId) .add("srcLocation", mSrcLocation) .add("dstLocation", mDstLocation).toString(); }

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("srcBlockId", mSrcBlockId) .add("dstBlockId", mDstBlockId) .add("srcLocation", mSrcLocation) .add("dstLocation", mDstLocation).toString(); }
Source:
public Response deleteGroupMember(@PathParam("member") String userId) { groupService.deleteUserFromGroup(group, userId); return Response.noContent().build(); }

Target:
public Response deleteGroupMember(@PathParam("member") String userId) { groupService.deleteUserFromGroup(group, userId); return Response.ok().build(); }
Source:
protected synchronized void addRemoteData(RemoteServerData remoteServerData){ String serverName = remoteServerData.getServerName(); remoteServerDataList.add(remoteServerData); if(RemoteDescriptorProvider.DATACLOUD_SERVER_NAME.equals(serverName)){ RemoteServerState remoteServerState = checkDataCloudServerAvailability(remoteServerData); actualStateMap.put(serverName, remoteServerState); notifyAllListeners(serverName); } }

Target:
protected synchronized void addRemoteData(RemoteServerData remoteServerData){ final String serverName = remoteServerData.getServerName(); remoteServerDataList.add(remoteServerData); if(RemoteDescriptorProvider.DATACLOUD_SERVER_NAME.equals(serverName)){ final RemoteServerState remoteServerState = checkDataCloudServerAvailability(remoteServerData); actualStateMap.put(serverName, remoteServerState); notifyAllListeners(serverName); } }
Source:
private void loadToplist() { if (disposable != null) { disposable.dispose(); } gridView.setVisibility(View.GONE); txtvError.setVisibility(View.GONE); butRetry.setVisibility(View.GONE); txtvEmpty.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); ItunesTopListLoader loader = new ItunesTopListLoader(getContext()); disposable = loader.loadToplist(100) .subscribe(podcasts -> { progressBar.setVisibility(View.GONE); topList = podcasts; updateData(topList); }, error -> { Log.e(TAG, Log.getStackTraceString(error)); progressBar.setVisibility(View.GONE); txtvError.setText(error.toString()); txtvError.setVisibility(View.VISIBLE); butRetry.setOnClickListener(v -> loadToplist()); butRetry.setVisibility(View.VISIBLE); }); }

Target:
private void loadToplist() { if (disposable != null) { disposable.dispose(); } gridView.setVisibility(View.GONE); txtvError.setVisibility(View.GONE); butRetry.setVisibility(View.GONE); txtvEmpty.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); ItunesTopListLoader loader = new ItunesTopListLoader(getContext()); disposable = loader.loadToplist(25) .subscribe(podcasts -> { progressBar.setVisibility(View.GONE); topList = podcasts; updateData(topList); }, error -> { Log.e(TAG, Log.getStackTraceString(error)); progressBar.setVisibility(View.GONE); txtvError.setText(error.toString()); txtvError.setVisibility(View.VISIBLE); butRetry.setOnClickListener(v -> loadToplist()); butRetry.setVisibility(View.VISIBLE); }); }
Source:
public List<String> getAllStudentsSorted() { ArrayList<String> allStudents = new ArrayList<String>(); allStudents.addAll(noResponse); allStudents.addAll(studentsWhoResponded); allStudents.sort(compareByTeamNameStudentName); return allStudents; }

Target:
public List<String> getAllStudentsSorted() { ArrayList<String> allStudents = new ArrayList<String>(studentsWhoDidNotRespond); allStudents.addAll(studentsWhoResponded); allStudents.sort(compareByTeamNameStudentName); return allStudents; }