auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean parseUrl( HttpChunkedResponseSocket socket, HttpRequestHeader request, TextQueryProcessorState state ) throws PeerDisconnectedException, PeerIsSlowToReadException { final DirectByteCharSequence query = request.getUrlParam("query"); if (query == null || query.length() == 0) { info(state).$("Empty query request received. Sending empty reply.").$(); sendException(socket, 0, "No query text", 400, state.query); return false; } long skip = 0; long stop = Long.MAX_VALUE; CharSequence limit = request.getUrlParam("limit"); if (limit != null) { int sepPos = Chars.indexOf(limit, ','); try { if (sepPos > 0) { skip = Numbers.parseLong(limit, 0, sepPos); if (sepPos + 1 < limit.length()) { stop = Numbers.parseLong(limit, sepPos + 1, limit.length()); } } else { stop = Numbers.parseLong(limit); } } catch (NumericException ex) { } } if (stop < 0) { stop = 0; } if (skip < 0) { skip = 0; } if (configuration.getMaxQueryResponseRowLimit() != Long.MAX_VALUE && (stop - skip) > configuration.getMaxQueryResponseRowLimit()) { stop = skip + configuration.getMaxQueryResponseRowLimit(); } state.query.clear(); try { TextUtil.utf8Decode(query.getLo(), query.getHi(), state.query); } catch (Utf8Exception e) { info(state).$("Bad UTF8 encoding").$(); sendException(socket, 0, "Bad UTF8 encoding in query text", 400, state.query); return false; } state.skip = skip; state.count = 0L; state.stop = stop; state.noMeta = Chars.equalsNc("true", request.getUrlParam("nm")); state.countRows = Chars.equalsNc("true", request.getUrlParam("count")); return true; }

Target:
private boolean parseUrl( HttpChunkedResponseSocket socket, HttpRequestHeader request, TextQueryProcessorState state ) throws PeerDisconnectedException, PeerIsSlowToReadException { final DirectByteCharSequence query = request.getUrlParam("query"); if (query == null || query.length() == 0) { info(state).$("Empty query request received. Sending empty reply.").$(); sendException(socket, 0, "No query text", 400, state.query); return false; } long skip = 0; long stop = Long.MAX_VALUE; CharSequence limit = request.getUrlParam("limit"); if (limit != null) { int sepPos = Chars.indexOf(limit, ','); try { if (sepPos > 0) { skip = Numbers.parseLong(limit, 0, sepPos); if (sepPos + 1 < limit.length()) { stop = Numbers.parseLong(limit, sepPos + 1, limit.length()); } } else { stop = Numbers.parseLong(limit); } } catch (NumericException ex) { } } if (stop < 0) { stop = 0; } if (skip < 0) { skip = 0; } if ((stop - skip) > configuration.getMaxQueryResponseRowLimit()) { stop = skip + configuration.getMaxQueryResponseRowLimit(); } state.query.clear(); try { TextUtil.utf8Decode(query.getLo(), query.getHi(), state.query); } catch (Utf8Exception e) { info(state).$("Bad UTF8 encoding").$(); sendException(socket, 0, "Bad UTF8 encoding in query text", 400, state.query); return false; } state.skip = skip; state.count = 0L; state.stop = stop; state.noMeta = Chars.equalsNc("true", request.getUrlParam("nm")); state.countRows = Chars.equalsNc("true", request.getUrlParam("count")); return true; }
Source:
public Collection<? extends GrantedAuthority> mapAuthorities(Collection<? extends GrantedAuthority> authorities) { Set<MisoAuthority> roles = EnumSet.noneOf(MisoAuthority.class); for (GrantedAuthority a : authorities) { if ((rolePrefix + "ROLE_ADMIN").equals(a.getAuthority())) { roles.add(MisoAuthority.ROLE_ADMIN); } else if ((rolePrefix + "ROLE_INTERNAL").equals(a.getAuthority())) { roles.add(MisoAuthority.ROLE_INTERNAL); } else if ((rolePrefix + "ROLE_EXTERNAL").equals(a.getAuthority())) { roles.add(MisoAuthority.ROLE_EXTERNAL); } } return roles; }

Target:
public Collection<? extends GrantedAuthority> mapAuthorities(Collection<? extends GrantedAuthority> authorities) { Set<MisoAuthority> roles = EnumSet.noneOf(MisoAuthority.class); for (GrantedAuthority a : authorities) { if ((rolePrefix + MisoAuthority.ROLE_ADMIN).equals(a.getAuthority())) { roles.add(MisoAuthority.ROLE_ADMIN); } else if ((rolePrefix + MisoAuthority.ROLE_INTERNAL).equals(a.getAuthority())) { roles.add(MisoAuthority.ROLE_INTERNAL); } else if ((rolePrefix + MisoAuthority.ROLE_EXTERNAL).equals(a.getAuthority())) { roles.add(MisoAuthority.ROLE_EXTERNAL); } } return roles; }
Source:
void addLayer(Layer layer,String style) { this.layers.add(layer); this.styles.add(style); if (srsName == null) { for(String srs : layer.getBoundingBoxes().keySet()) { try { CRS.decode(srs); srsName = srs; break; } catch(Exception e) { } } if(srsName == null) { if (layer.getSrs().contains("EPSG:4326")) { srsName = "EPSG:4326"; } else { srsName = layer.getSrs().iterator().next(); } } validSRS = layer.getSrs(); } else { Set<String> intersection = new HashSet<String>(validSRS); intersection.retainAll(layer.getSrs()); if (!intersection.contains(srsName)) { if (intersection.size() == 0) { throw new IllegalArgumentException("The layer being appended does " + "not have any SRS in common with the ones already " + "included in the WMS request, cannot be merged"); } else if (intersection.contains("EPSG:4326")) { srsName = "EPSG:4326"; } else { srsName = intersection.iterator().next(); } this.validSRS = intersection; } } CoordinateReferenceSystem crs = null; try { crs = CRS.decode(srsName); } catch (Exception e) { LOGGER.log(Level.FINE, "Bounds unavailable for layer" + layer); } this.crs = crs; updateBounds(); }

Target:
void addLayer(Layer layer, String style) { this.layers.add(new LayerStyle(layer, style)); if (srsName == null) { for (String srs : layer.getBoundingBoxes().keySet()) { try { CRS.decode(srs); srsName = srs; break; } catch (Exception e) { } } if (srsName == null) { if (layer.getSrs().contains("EPSG:4326")) { srsName = "EPSG:4326"; } else { srsName = layer.getSrs().iterator().next(); } } validSRS = layer.getSrs(); } else { Set<String> intersection = new HashSet<String>(validSRS); intersection.retainAll(layer.getSrs()); if (!intersection.contains(srsName)) { if (intersection.size() == 0) { throw new IllegalArgumentException("The layer being appended does " + "not have any SRS in common with the ones already " + "included in the WMS request, cannot be merged"); } else if (intersection.contains("EPSG:4326")) { srsName = "EPSG:4326"; } else { srsName = intersection.iterator().next(); } this.validSRS = intersection; } } CoordinateReferenceSystem crs = null; try { crs = CRS.decode(srsName); } catch (Exception e) { LOGGER.log(Level.FINE, "Bounds unavailable for layer" + layer); } this.crs = crs; updateBounds(); }
Source:
public static Collection<String> names(Collection<ConfigInfo> infos) { if (infos.isEmpty()) { return Collections.emptyList(); } return Lists.newArrayList(Iterables.transform(infos, new Function<ConfigInfo, String>() { @Override public String apply(ConfigInfo info) { return info.name(); } })); }

Target:
public static Collection<String> names(Collection<ConfigInfo> infos) { if (infos == null || infos.isEmpty()) { return Collections.emptyList(); } return Lists.newArrayList(Iterables.transform(infos, new Function<ConfigInfo, String>() { @Override public String apply(ConfigInfo info) { return info.name(); } })); }
Source:
public void onBindViewHolder(ThumbnailViewHolder holder, int position) { PhotoChooserItem item = getItemAtPosition(position); int selectedIndex = mIsMultiSelectEnabled ? mSelectedUris.indexOfUri(item.uri) : -1; if (selectedIndex > -1) { holder.txtSelectionCount.setVisibility(View.VISIBLE); holder.txtSelectionCount.setText(Integer.toString(selectedIndex + 1)); } else { holder.txtSelectionCount.setVisibility(View.GONE); } float scale = selectedIndex > -1 ? SCALE_SELECTED : SCALE_NORMAL; if (holder.imgThumbnail.getScaleX() != scale) { holder.imgThumbnail.setScaleX(scale); holder.imgThumbnail.setScaleY(scale); } holder.videoOverlay.setVisibility(item.isVideo ? View.VISIBLE : View.GONE); mThumbnailLoader.loadThumbnail(holder.imgThumbnail, item._id, item.isVideo); }

Target:
public void onBindViewHolder(ThumbnailViewHolder holder, int position) { PhotoChooserItem item = getItemAtPosition(position); if (item == null) { return; } int selectedIndex = mIsMultiSelectEnabled ? mSelectedUris.indexOfUri(item.uri) : -1; if (selectedIndex > -1) { holder.txtSelectionCount.setVisibility(View.VISIBLE); holder.txtSelectionCount.setText(Integer.toString(selectedIndex + 1)); } else { holder.txtSelectionCount.setVisibility(View.GONE); } float scale = selectedIndex > -1 ? SCALE_SELECTED : SCALE_NORMAL; if (holder.imgThumbnail.getScaleX() != scale) { holder.imgThumbnail.setScaleX(scale); holder.imgThumbnail.setScaleY(scale); } holder.videoOverlay.setVisibility(item.isVideo ? View.VISIBLE : View.GONE); mThumbnailLoader.loadThumbnail(holder.imgThumbnail, item._id, item.isVideo); }
Source:
public AboutDialogE4(final Shell parentShell) { super(parentShell); product = new ProductInformation(Platform.getProduct()); }

Target:
public AboutDialogE4(final Shell parentShell) { super(parentShell); product = new ProductInformation(Optional.ofNullable(Platform.getProduct())); }
Source:
public NotificationEventResponse getNextNotification(long lastEventId, int maxEvents, NotificationFilter filter) throws TException { NotificationEventRequest rqst = new NotificationEventRequest(lastEventId); rqst.setMaxEvents(maxEvents); NotificationEventResponse rsp = client.get_next_notification(rqst); LOG.debug("Got back " + rsp.getEventsSize() + " events"); NotificationEventResponse filtered = new NotificationEventResponse(); if (rsp != null && rsp.getEvents() != null) { long nextEventId = lastEventId + 1; for (NotificationEvent e : rsp.getEvents()) { if (e.getEventId() != nextEventId) { LOG.warn("Requested events are found missing in NOTIFICATION_LOG table. " + "Probably, cleaner would've cleaned it up. " + "Try setting higher value for hive.metastore.event.db.listener.timetolive. " + "Also, bootstrap the system again to get back the consistent replicated state."); throw new IllegalStateException("Notification events are missing."); } if ((filter != null) && filter.accept(e)) { filtered.addToEvents(e); } nextEventId++; } } return (filter != null) ? filtered : rsp; }

Target:
public NotificationEventResponse getNextNotification(long lastEventId, int maxEvents, NotificationFilter filter) throws TException { NotificationEventRequest rqst = new NotificationEventRequest(lastEventId); rqst.setMaxEvents(maxEvents); NotificationEventResponse rsp = client.get_next_notification(rqst); LOG.debug("Got back " + rsp.getEventsSize() + " events"); NotificationEventResponse filtered = new NotificationEventResponse(); if (rsp != null && rsp.getEvents() != null) { long nextEventId = lastEventId + 1; for (NotificationEvent e : rsp.getEvents()) { if (e.getEventId() != nextEventId) { LOG.error("Requested events are found missing in NOTIFICATION_LOG table. Expected: {}, Actual: {}. " + "Probably, cleaner would've cleaned it up. " + "Try setting higher value for hive.metastore.event.db.listener.timetolive. " + "Also, bootstrap the system again to get back the consistent replicated state.", nextEventId, e.getEventId()); throw new IllegalStateException("Notification events are missing."); } if ((filter != null) && filter.accept(e)) { filtered.addToEvents(e); } nextEventId++; } } return (filter != null) ? filtered : rsp; }
Source:
public static Geocache getCache(final String geoCode) { final Parameters params = new Parameters("cache_code", geoCode); final IConnector connector = ConnectorFactory.getConnector(geoCode); if (!(connector instanceof OCApiConnector)) { return null; } final OCApiConnector ocapiConn = (OCApiConnector) connector; params.add("fields", getFullFields(ocapiConn)); params.add("attribution_append", "none"); final JSONObject data = request(ocapiConn, OkapiService.SERVICE_CACHE, params).data; if (data == null) { return null; } return parseCache(data); }

Target:
public static Geocache getCache(final String geoCode) { final Parameters params = new Parameters("cache_code", geoCode); final IConnector connector = ConnectorFactory.getConnector(geoCode); if (!(connector instanceof OCApiConnector)) { return null; } final OCApiConnector ocapiConn = (OCApiConnector) connector; params.add("fields", getFullFields(ocapiConn)); params.add("attribution_append", "none"); final JSONResult result = request(ocapiConn, OkapiService.SERVICE_CACHE, params); return result.isSuccess ? parseCache(result.data) : null; }
Source:
protected int act(List<AbstractBuild<?, ?>> builds) throws IOException { job.checkPermission(Run.DELETE); final HashSet<Integer> hs_builds = new HashSet<Integer>(); for (AbstractBuild build : builds) { if (!hs_builds.contains(build.number)) { build.delete(); hs_builds.add(build.number); } } stdout.println("Deleted "+hs_builds.size()+" builds"); return 0; }

Target:
protected int act(List<AbstractBuild<?, ?>> builds) throws IOException { job.checkPermission(Run.DELETE); final HashSet<Integer> hsBuilds = new HashSet<Integer>(); for (AbstractBuild build : builds) { if (!hsBuilds.contains(build.number)) { build.delete(); hsBuilds.add(build.number); } } stdout.println("Deleted "+hsBuilds.size()+" builds"); return 0; }
Source:
public SettingsPanel(SettingsPanelForm form, BriefcasePreferences appPreferences, Analytics analytics, FormCache formCache) { this.form = form; appPreferences.getBriefcaseDir().ifPresent(path -> form.setStorageLocation(path.getParent())); appPreferences.getPullInParallel().ifPresent(form::setPullInParallel); appPreferences.getRememberPasswords().ifPresent(form::setRememberPasswords); appPreferences.getSendUsageData().ifPresent(form::setSendUsageData); appPreferences.getHttpProxy().ifPresent(httpProxy -> { form.enableUseHttpProxy(); form.setHttpProxy(httpProxy); form.updateHttpProxyFields(); }); form.onStorageLocation(path -> { Path briefcaseDir = BriefcasePreferences.buildBriefcaseDir(path); UncheckedFiles.createBriefcaseDir(briefcaseDir); formCache.setLocation(briefcaseDir); formCache.update(); appPreferences.setStorageDir(path); }, () -> { formCache.unsetLocation(); formCache.update(); appPreferences.unsetStorageDir(); }); form.onPullInParallelChange(appPreferences::setPullInParallel); form.onRememberPasswordsChange(appPreferences::setRememberPasswords); form.onSendUsageDataChange(enabled -> { appPreferences.setSendUsage(enabled); analytics.enableTracking(enabled, false); }); form.onHttpProxy(appPreferences::setHttpProxy, appPreferences::unsetHttpProxy); form.onReloadCache(() -> { formCache.update(); JOptionPane.showMessageDialog(getContainer(), "Forms successfully reloaded from storage location.", "", JOptionPane.PLAIN_MESSAGE); }); }

Target:
public SettingsPanel(SettingsPanelForm form, BriefcasePreferences appPreferences, Analytics analytics, FormCache formCache) { this.form = form; appPreferences.getBriefcaseDir().ifPresent(path -> form.setStorageLocation(path.getParent())); appPreferences.getPullInParallel().ifPresent(form::setPullInParallel); appPreferences.getRememberPasswords().ifPresent(form::setRememberPasswords); appPreferences.getSendUsageData().ifPresent(form::setSendUsageData); appPreferences.getHttpProxy().ifPresent(httpProxy -> { form.enableUseHttpProxy(); form.setHttpProxy(httpProxy); form.updateHttpProxyFields(); }); form.onStorageLocation(path -> { Path briefcaseDir = BriefcasePreferences.buildBriefcaseDir(path); UncheckedFiles.createBriefcaseDir(briefcaseDir); formCache.setLocation(briefcaseDir); formCache.update(); appPreferences.setStorageDir(path); }, () -> { formCache.unsetLocation(); formCache.update(); appPreferences.unsetStorageDir(); }); form.onPullInParallelChange(appPreferences::setPullInParallel); form.onRememberPasswordsChange(appPreferences::setRememberPasswords); form.onSendUsageDataChange(enabled -> { appPreferences.setSendUsage(enabled); analytics.enableTracking(enabled, false); }); form.onHttpProxy(appPreferences::setHttpProxy, appPreferences::unsetHttpProxy); form.onReloadCache(() -> { formCache.update(); JOptionPane.showMessageDialog(getContainer(), "Forms successfully reloaded from storage location.", APP_NAME, JOptionPane.PLAIN_MESSAGE); }); }
Source:
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { Optional<GenerateAuditLog> generateAuditLog = Optional.of(handler).filter(h -> h instanceof HandlerMethod) .map(HandlerMethod.class::cast).map(HandlerMethod::getMethod).map(m -> m.getAnnotation(GenerateAuditLog.class)); if (generateAuditLog.isPresent() && generateAuditLog.get().scope().in(ALL, ERROR)) { int responseCode = response.getStatus(); if (ex != null & ex instanceof AccessDeniedException) { responseCode = HttpStatus.FORBIDDEN.value(); } if (ex != null & ex instanceof AuthenticationException) { responseCode = HttpStatus.UNAUTHORIZED.value(); } String requestBodyString = Optional.ofNullable(request).map(this::extractContent).orElse(null); Object requestBody = Optional.of(handler).map(HandlerMethod.class::cast).map(HandlerMethod::getMethod) .map(this::extractRequestType).map(t -> this.parse(requestBodyString, t)).orElse(null); String responseBodyString = Optional.ofNullable(response).map(this::extractContent).orElse(null); if (!HttpStatus.valueOf(responseCode).is2xxSuccessful() && !HttpStatus.valueOf(responseCode).is3xxRedirection()) { this.auditLogSender.sendAuditLog(request, requestBody, responseCode, responseBodyString, generateAuditLog.get()); } } else { super.afterCompletion(request, response, handler, ex); } }

Target:
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { Optional<GenerateAuditLog> generateAuditLog = Optional.of(handler).filter(h -> h instanceof HandlerMethod) .map(HandlerMethod.class::cast).map(HandlerMethod::getMethod).map(m -> m.getAnnotation(GenerateAuditLog.class)); if (generateAuditLog.isPresent() && generateAuditLog.get().scope().in(ALL, ERROR)) { int responseCode = response.getStatus(); if (ex != null & ex instanceof AccessDeniedException) { responseCode = HttpStatus.FORBIDDEN.value(); } if (ex != null & ex instanceof AuthenticationException) { responseCode = HttpStatus.UNAUTHORIZED.value(); } String requestBodyString = Optional.ofNullable(request).map(this::extractContent).orElse(null); Object requestBody = Optional.of(handler).map(HandlerMethod.class::cast).map(HandlerMethod::getMethod) .map(this::extractRequestType).map(t -> this.parse(requestBodyString, t)).orElse(null); String responseBodyString = Optional.ofNullable(response).map(this::extractContent).orElse(null); if (HttpStatus.valueOf(responseCode).isError()) { this.auditLogSender.sendAuditLog(request, requestBody, responseCode, responseBodyString, generateAuditLog.get()); } } else { super.afterCompletion(request, response, handler, ex); } }
Source:
private StorageType updateLUNConnectionsInfo(LUNs lun) { lun.setLunConnections(new ArrayList<storage_server_connections>(getDbFacade() .getStorageServerConnectionDao() .getAllForLun(lun.getLUN_id()))); return lun.getLunConnections().isEmpty() ? StorageType.FCP : lun.getLunConnections().get(0).getstorage_type(); }

Target:
private StorageType updateLUNConnectionsInfo(LUNs lun) { if (lun.getLunConnections() == null) { lun.setLunConnections(new ArrayList<storage_server_connections>(getDbFacade() .getStorageServerConnectionDao() .getAllForLun(lun.getLUN_id()))); } return lun.getLunConnections().isEmpty() ? StorageType.FCP : lun.getLunConnections().get(0).getstorage_type(); }
Source:
private ImageDescriptor createImageDescriptorForId(String providerId, String imageId) { if (imageId == null || providerId == null) return null; String registryKey = makeKey(providerId, imageId); ImageRegistry imageRegistry = GraphitiUIPlugin.getDefault().getImageRegistry(); ImageDescriptor imageDescriptor = imageRegistry.getDescriptor(registryKey); if (imageDescriptor != null) { return imageDescriptor; } Collection<IImageProvider> imageProviders = ExtensionManager.getSingleton() .getImageProvidersForDiagramTypeProviderId(providerId); for (IImageProvider imageProvider : imageProviders) { String imageFilePath = imageProvider.getImageFilePath(imageId); if (imageFilePath != null) { if (imageFilePath.startsWith("bundleentry://")) { try { URL imageFileUrl = new URL(imageFilePath); imageDescriptor = ImageDescriptor.createFromURL(imageFileUrl); } catch (MalformedURLException e) { } } else { String pluginId = imageProvider.getPluginId(); if (pluginId != null) { imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, imageFilePath); } } break; } } if (imageDescriptor == null) { imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); } imageDescriptor = fixImageDescriptor(imageDescriptor); imageRegistry.put(registryKey, imageDescriptor); return imageDescriptor; }

Target:
private ImageDescriptor createImageDescriptorForId(String providerId, String imageId) { if (imageId == null || providerId == null) return null; String registryKey = makeKey(providerId, imageId); ImageRegistry imageRegistry = GraphitiUIPlugin.getDefault().getImageRegistry(); ImageDescriptor imageDescriptor = imageRegistry.getDescriptor(registryKey); if (imageDescriptor != null) { return imageDescriptor; } Collection<IImageProvider> imageProviders = ExtensionManager.getSingleton() .getImageProvidersForDiagramTypeProviderId(providerId); for (IImageProvider imageProvider : imageProviders) { String imageFilePath = imageProvider.getImageFilePath(imageId); if (imageFilePath != null) { if (imageFilePath.startsWith("bundleentry://")) { try { URL imageFileUrl = new URL(imageFilePath); imageDescriptor = ImageDescriptor.createFromURL(imageFileUrl); } catch (MalformedURLException e) { T.racer().error("Bundle entry url for image could not be parsed, url was: " + imageFilePath, e); } } else { String pluginId = imageProvider.getPluginId(); if (pluginId != null) { imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, imageFilePath); } } break; } } if (imageDescriptor == null) { imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); } imageDescriptor = fixImageDescriptor(imageDescriptor); imageRegistry.put(registryKey, imageDescriptor); return imageDescriptor; }
Source:
public void retriesIfFailsWithRetriableException() throws Exception { when(task.run()).thenThrow(new TransactionFailedRetriableException("")).thenReturn("success"); assertThat(run()).isEqualTo("success"); }

Target:
public void retriesIfFailsWithRetriableException() throws Exception { when(task.run()).thenThrow(new TransactionFailedRetriableException("")).thenReturn("success"); assertThat(runExponential()).isEqualTo("success"); assertThat(blockStrategy.numRetries).isEqualTo(1); }
Source:
public LogReplicationSinkManager(String localCorfuEndpoint, LogReplicationConfig config, LogReplicationMetadataManager metadataManager, ServerContext context, long topologyConfigId) { this.logReplicationMetadataManager = metadataManager; this.applySnapshotExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("log-replication-sink-manager-apply-snapshot").build()); this.runtime = CorfuRuntime.fromParameters(CorfuRuntime.CorfuRuntimeParameters.builder() .trustStore((String) context.getServerConfig().get("--truststore")) .tsPasswordFile((String) context.getServerConfig().get("--truststore-password-file")) .keyStore((String) context.getServerConfig().get("--keystore")) .ksPasswordFile((String) context.getServerConfig().get("--keystore-password-file")) .tlsEnabled((Boolean) context.getServerConfig().get("--enable-tls")) .build()) .parseConfigurationString(localCorfuEndpoint).connect(); this.rxState = RxState.LOG_ENTRY_SYNC; this.config = config; this.topologyConfigId = topologyConfigId; init(); }

Target:
public LogReplicationSinkManager(String localCorfuEndpoint, LogReplicationConfig config, LogReplicationMetadataManager metadataManager, ServerContext context, long topologyConfigId) { this.logReplicationMetadataManager = metadataManager; this.applySnapshotExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("apply-snapshot-executor").build()); this.runtime = CorfuRuntime.fromParameters(CorfuRuntime.CorfuRuntimeParameters.builder() .trustStore((String) context.getServerConfig().get("--truststore")) .tsPasswordFile((String) context.getServerConfig().get("--truststore-password-file")) .keyStore((String) context.getServerConfig().get("--keystore")) .ksPasswordFile((String) context.getServerConfig().get("--keystore-password-file")) .tlsEnabled((Boolean) context.getServerConfig().get("--enable-tls")) .build()) .parseConfigurationString(localCorfuEndpoint).connect(); this.rxState = RxState.LOG_ENTRY_SYNC; this.config = config; this.topologyConfigId = topologyConfigId; init(); }
Source:
ExecutorService createGetRangesExecutor(int numThreads) { BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>() { @Override public boolean offer(Runnable e) { sanityCheckQueueSize(); return super.offer(e); } private void sanityCheckQueueSize() { int currentSize = this.size(); if (currentSize >= GET_RANGES_QUEUE_SIZE_WARNING_THRESHOLD) { log.warn("You have pending getRanges tasks. Please sanity check both your level" + "of concurrency and size of batched range requests. If necessary you can" + "increase the value of maxConcurrentGetRanges to allow for a larger" + "thread pool.", currentSize); } } }; return new ThreadPoolExecutor( numThreads, numThreads, 0L, TimeUnit.MILLISECONDS, workQueue, new ThreadFactoryBuilder().setNameFormat(getClass().getSimpleName() + "-get-ranges-%d").build()); }

Target:
ExecutorService createGetRangesExecutor(int numThreads) { BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>() { private final RateLimiter warningRateLimiter = RateLimiter.create(1); @Override public boolean offer(Runnable runnable) { sanityCheckQueueSize(); return super.offer(runnable); } private void sanityCheckQueueSize() { int currentSize = this.size(); if (currentSize >= GET_RANGES_QUEUE_SIZE_WARNING_THRESHOLD && warningRateLimiter.tryAcquire()) { log.warn("You have pending getRanges tasks. Please sanity check both your level " + "of concurrency and size of batched range requests. If necessary you can " + "increase the value of concurrentGetRangesThreadPoolSize to allow for a larger " + "thread pool.", currentSize); } } }; return new ThreadPoolExecutor( numThreads, numThreads, 0L, TimeUnit.MILLISECONDS, workQueue, new ThreadFactoryBuilder().setNameFormat( AbstractTransactionManager.this.getClass().getSimpleName() + "-get-ranges-%d").build()); }
Source:
public static boolean isPullRequestLoaded(String url) { return url.matches("<LINK_0>[^/]+)/([^/]+)/pull/([0-9]+)([/commits,/files]*)"); }

Target:
public static boolean isPullRequestLoaded(String url) { return url.matches("<LINK_0>[^/]+)/([^/]+)/pull/([0-9]+)(/|/commits|/files)?"); }
Source:
public static void setUp() throws IOException, JsonException, ServerConfigurationException { LOG.info().$("begin").$(); root = temp.newFolder("dbRoot").getAbsolutePath(); TestUtils.copyMimeTypes(temp.getRoot().getAbsolutePath()); serverConfiguration = new PropServerConfiguration(temp.getRoot().getAbsolutePath(), new Properties()) { @Override public CairoConfiguration getCairoConfiguration() { return new DefaultCairoConfiguration(root); } }; configuration = serverConfiguration.getCairoConfiguration(); messageBus = new MessageBusImpl(serverConfiguration); }

Target:
public static void setUp() throws IOException, JsonException, ServerConfigurationException { LOG.info().$("begin").$(); root = temp.newFolder("dbRoot").getAbsolutePath(); configuration = new DefaultCairoConfiguration(root); TestUtils.copyMimeTypes(temp.getRoot().getAbsolutePath()); serverConfiguration = new PropServerConfiguration(temp.getRoot().getAbsolutePath(), new Properties()) { @Override public CairoConfiguration getCairoConfiguration() { return configuration; } }; configuration = serverConfiguration.getCairoConfiguration(); messageBus = new MessageBusImpl(serverConfiguration); }
Source:
GarbageCollectWriteAheadLogs(final AccumuloServerContext context, final VolumeManager fs, final LiveTServerSet liveServers, boolean useTrash) throws IOException { this.context = context; this.fs = fs; this.useTrash = useTrash; this.liveServers = liveServers; this.walMarker = new WalStateManager(context.getInstance(), ZooReaderWriter.getInstance()); this.store = new Iterable<TabletLocationState>() { @Override public Iterator<TabletLocationState> iterator() { return Iterators.concat(new RootTabletStateStore(context).iterator(), new MetaDataStateStore(context).iterator()); } }; }

Target:
GarbageCollectWriteAheadLogs(final AccumuloServerContext context, final VolumeManager fs, final LiveTServerSet liveServers, boolean useTrash) throws IOException { this.context = context; this.fs = fs; this.useTrash = useTrash; this.liveServers = liveServers; this.walMarker = new WalStateManager(context.getInstance(), ZooReaderWriter.getInstance()); this.store = new Iterable<TabletLocationState>() { @Override public Iterator<TabletLocationState> iterator() { try { return Iterators.concat(new ZooTabletStateStore().iterator(), new RootTabletStateStore(context).iterator(), new MetaDataStateStore(context).iterator()); } catch (DistributedStoreException e) { throw new RuntimeException(e); } } }; }
Source:
public void shutdown() { try { logger.info("Shutting down server"); for (Acceptor acceptor : acceptors) { if (acceptor != null && acceptor.isRunning()) { acceptor.shutdown(); } } for (Processor processor : processors) { if (processor.isRunning()) { processor.shutdown(); } } logger.info("Shutdown completed"); } catch (Exception e) { logger.error("Error shutting down socket server {}", e); } }

Target:
public void shutdown() { try { logger.info("Shutting down server"); for (Acceptor acceptor : acceptors) { if (acceptor != null) { acceptor.shutdown(); } } for (Processor processor : processors) { processor.shutdown(); } logger.info("Shutdown completed"); } catch (Exception e) { logger.error("Error shutting down socket server {}", e); } }
Source:
public void decorate(Object element, IDecoration decoration) { final Activator activator = Activator.getDefault(); if (activator == null) return; if (!PlatformUI.isWorkbenchRunning()) return; final IResource resource = getResource(element); if (resource == null) { decorateResourceMapping(element, decoration); } else { try { decorateResource(resource, decoration); } catch(CoreException e) { handleException(resource, e); } } }

Target:
public void decorate(Object element, IDecoration decoration) { if (Activator.getDefault() == null) return; if (!PlatformUI.isWorkbenchRunning()) return; final IResource resource = getResource(element); if (resource == null) { decorateResourceMapping(element, decoration); } else { try { decorateResource(resource, decoration); } catch(CoreException e) { handleException(resource, e); } } }
Source:
public static BaseFloatColumnValueSelector makeColumnValueSelectorWithFloatDefault( final ColumnSelectorFactory metricFactory, final ExprMacroTable macroTable, final String fieldName, final String fieldExpression, @Nullable final Float nullValue ) { if (fieldName != null && fieldExpression == null) { return metricFactory.makeColumnValueSelector(fieldName); } if (fieldName == null && fieldExpression != null) { final Expr expr = Parser.parse(fieldExpression, macroTable); final ColumnValueSelector<ExprEval> baseSelector = ExpressionSelectors.makeExprEvalSelector(metricFactory, expr); class ExpressionFloatColumnSelector implements FloatColumnSelector { @Override public float getFloat() { final ExprEval exprEval = baseSelector.getObject(); return exprEval.isNull() ? nullValue : (float) exprEval.asDouble(); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("baseSelector", baseSelector); } @Override public boolean isNull() { return baseSelector.getObject().isNull(); } } return new ExpressionFloatColumnSelector(); } throw new IllegalArgumentException("Must have a valid, non-null fieldName or expression"); }

Target:
public static BaseFloatColumnValueSelector makeColumnValueSelectorWithFloatDefault( final ColumnSelectorFactory metricFactory, final ExprMacroTable macroTable, final String fieldName, final String fieldExpression, @Nullable final Float nullValue ) { if (fieldName != null && fieldExpression == null) { return metricFactory.makeColumnValueSelector(fieldName); } if (fieldName == null && fieldExpression != null) { final Expr expr = Parser.parse(fieldExpression, macroTable); final ColumnValueSelector<ExprEval> baseSelector = ExpressionSelectors.makeExprEvalSelector(metricFactory, expr); class ExpressionFloatColumnSelector implements FloatColumnSelector { @Override public float getFloat() { final ExprEval exprEval = baseSelector.getObject(); return exprEval.isNull() ? nullValue : (float) exprEval.asDouble(); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("baseSelector", baseSelector); } @Override public boolean isNull() { final ExprEval exprEval = baseSelector.getObject(); return exprEval.isNull(); } } return new ExpressionFloatColumnSelector(); } throw new IllegalArgumentException("Must have a valid, non-null fieldName or expression"); }
Source:
private Mono<Boolean> checkIMDSAvailable() { StringBuilder payload = new StringBuilder(); try { payload.append("api-version="); payload.append(URLEncoder.encode("2018-02-01", "UTF-8")); } catch (IOException exception) { return Mono.error(exception); } return Mono.fromCallable(() -> { HttpURLConnection connection = null; URL url = new URL(String.format("<LINK_0>", payload.toString())); try { connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setConnectTimeout(500); connection.connect(); } catch (ConnectException | SecurityException | SocketTimeoutException e) { throw logger.logExceptionAsError( new CredentialUnavailableException("Connection to IMDS endpoint cannot be established. " + e.getMessage(), e)); } finally { if (connection != null) { connection.disconnect(); } } return true; }).onErrorResume(t -> Mono.error(new CredentialUnavailableException( "ManagedIdentityCredential authentication unavailable." + t.getMessage(), t))); }

Target:
private Mono<Boolean> checkIMDSAvailable() { StringBuilder payload = new StringBuilder(); try { payload.append("api-version="); payload.append(URLEncoder.encode("2018-02-01", "UTF-8")); } catch (IOException exception) { return Mono.error(exception); } return Mono.fromCallable(() -> { HttpURLConnection connection = null; URL url = new URL(String.format("<LINK_0>", payload.toString())); try { connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setConnectTimeout(500); connection.connect(); } catch (Exception e) { throw logger.logExceptionAsError( new CredentialUnavailableException( "ManagedIdentityCredential authentication unavailable. " + "Connection to IMDS endpoint cannot be established, " + e.getMessage() + ".", e)); } finally { if (connection != null) { connection.disconnect(); } } return true; }); }
Source:
private static List<OpenMrsXformIndexEntry> getLocalFormEntries() { List<OpenMrsXformIndexEntry> entries = new ArrayList<>(); final ContentResolver resolver = App.getInstance().getContentResolver(); Cursor c = resolver.query(Contracts.Forms.CONTENT_URI, null, null, null, null); try { while (c.moveToNext()) { String uuid = Utils.getString(c, Contracts.Forms.UUID); String name = Utils.getString(c, Contracts.Forms.NAME); long date = 0; entries.add(new OpenMrsXformIndexEntry(uuid, name, date)); } } finally { c.close(); } return entries; }

Target:
private static List<OpenMrsXformIndexEntry> getLocalFormEntries() { List<OpenMrsXformIndexEntry> entries = new ArrayList<>(); final ContentResolver resolver = App.getInstance().getContentResolver(); Cursor c = resolver.query(Contracts.Forms.CONTENT_URI, new String[] {Contracts.Forms.UUID, Contracts.Forms.NAME}, null, null, null); try { while (c.moveToNext()) { String uuid = Utils.getString(c, Contracts.Forms.UUID); String name = Utils.getString(c, Contracts.Forms.NAME); long date = 0; entries.add(new OpenMrsXformIndexEntry(uuid, name, date)); } } finally { c.close(); } return entries; }
Source:
public void initialize_with_empty_builder() { final Stand.Builder builder = Stand.newBuilder(); final Stand stand = builder.build(); assertNotNull(stand); assertTrue("Available types must be empty after the initialization.", stand.getAvailableTypes() .isEmpty()); assertTrue("Known aggregate types must be empty after the initialization", stand.getKnownAggregateTypes() .isEmpty()); }

Target:
public void initialize_with_empty_builder() { final Stand.Builder builder = Stand.newBuilder(); final Stand stand = builder.build(); assertNotNull(stand); assertTrue("Exposed types must be empty after the initialization.", stand.getExposedTypes() .isEmpty()); assertTrue("Exposed aggregate types must be empty after the initialization", stand.getExposedAggregateTypes() .isEmpty()); }
Source:
private void startPollingForChanges() { changesPollingThread = new Thread() { @Override public void run() { this.setName(THREAD_NAME); pollForChanges = true; while (pollForChanges) { if (dialogRunnable == null && isScriptUpdatedOnDisk() ) { if (script.isChanged()) { dialogRunnable = new Runnable() { @Override public void run() { if (JOptionPane.showOptionDialog( ConsolePanel.this, Constant.messages.getString("scripts.console.changedOnDiskAndConsole"), Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, SCRIPT_CHANGED_BUTTONS, null) == JOptionPane.YES_OPTION) { try { extension.getExtScript().saveScript(script); } catch (IOException e) { LOG.error(e.getMessage(), e); } } else { reloadScript(); } dialogRunnable = null; } }; } else { dialogRunnable = new Runnable() { @Override public void run() { if (JOptionPane.showOptionDialog( ConsolePanel.this, Constant.messages.getString("scripts.console.changedOnDisk"), Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, SCRIPT_CHANGED_BUTTONS, null) == JOptionPane.YES_OPTION) { try { extension.getExtScript().saveScript(script); } catch (IOException e) { LOG.error(e.getMessage(), e); } } else { reloadScript(); } dialogRunnable = null; } }; } SwingUtilities.invokeLater(dialogRunnable); } try { sleep(5000); } catch (InterruptedException e) { } } changesPollingThread = null; } }; changesPollingThread.setDaemon(true); changesPollingThread.start(); if (dialogRunnable != null) { return; } }

Target:
private void startPollingForChanges() { changesPollingThread = new Thread() { @Override public void run() { this.setName(THREAD_NAME); pollForChanges = true; while (pollForChanges) { if (dialogRunnable == null && isScriptUpdatedOnDisk() ) { dialogRunnable = new Runnable() { @Override public void run() { String message; if (script.isChanged()) { message = Constant.messages.getString("scripts.console.changedOnDiskAndConsole"); } else { message = Constant.messages.getString("scripts.console.changedOnDisk"); } if (JOptionPane.showOptionDialog( ConsolePanel.this, message, Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, SCRIPT_CHANGED_BUTTONS, null) == JOptionPane.YES_OPTION) { try { extension.getExtScript().saveScript(script); } catch (IOException e) { LOG.error(e.getMessage(), e); } } else { reloadScript(); } dialogRunnable = null; } }; try { SwingUtilities.invokeAndWait(dialogRunnable); } catch (Exception e) { LOG.error(e.getMessage(), e); } } try { sleep(5000); } catch (InterruptedException e) { } } changesPollingThread = null; } }; changesPollingThread.setDaemon(true); changesPollingThread.start(); if (dialogRunnable != null) { return; } }
Source:
public Object getFragmentManager(Object fragment) { if (mMethodGetFragmentManager == null) { return null; } try { return mMethodGetFragmentManager.invoke(fragment); } catch (Exception e) { LogUtil.w(e, "Could not call Fragment.getFragmentManager()"); return null; } }

Target:
public Object getFragmentManager(Object fragment) { return ReflectionUtil.invokeMethod(mMethodGetFragmentManager, fragment); }
Source:
public Optional<Achievement> getById(String id) { return Optional.ofNullable(this.achievementMappings.get(checkNotNull(id).toLowerCase())); }

Target:
public Optional<Achievement> getById(String id) { return Optional.ofNullable(this.achievementMappings.get(checkNotNull(id).toLowerCase(Locale.ENGLISH))); }
Source:
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { String credentials = (String) token.getCredentials(); String[] userpass = credentials.split(":"); if (userpass.length != 2) { LOGGER.debug("Credentials were not in the correct format."); } String user = new String(Base64.getDecoder().decode(userpass[0]), StandardCharsets.UTF_8); String pass = new String(Base64.getDecoder().decode(userpass[1]), StandardCharsets.UTF_8); Subject subject = null; for (JaasRealm jaasRealm : realmList) { try { subject = login(user, pass, jaasRealm.getName()); LOGGER.trace("Login succeeded for against realm {}", user, jaasRealm.getName()); break; } catch (LoginException e) { LOGGER.trace("Login failed for against realm {}", user, jaasRealm.getName()); } } if (subject != null) { SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo(); SimplePrincipalCollection principalCollection = createPrincipalCollectionFromSubject(subject); simpleAuthenticationInfo.setPrincipals(principalCollection); simpleAuthenticationInfo.setCredentials(credentials); return simpleAuthenticationInfo; } throw new AuthenticationException("Login failed for user: " + user); }

Target:
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { String credentials = (String) token.getCredentials(); String[] userpass = credentials.split(":"); if (userpass.length != 2) { throw new AuthenticationException("Credentials were not in the correct format."); } String user = new String(Base64.getDecoder().decode(userpass[0]), StandardCharsets.UTF_8); String pass = new String(Base64.getDecoder().decode(userpass[1]), StandardCharsets.UTF_8); Subject subject = null; for (JaasRealm jaasRealm : realmList) { try { subject = login(user, pass, jaasRealm.getName()); LOGGER.trace("Login succeeded for against realm {}", user, jaasRealm.getName()); break; } catch (LoginException e) { LOGGER.trace("Login failed for against realm {}", user, jaasRealm.getName()); } } if (subject != null) { SimpleAuthenticationInfo simpleAuthenticationInfo = new SimpleAuthenticationInfo(); SimplePrincipalCollection principalCollection = createPrincipalCollectionFromSubject(subject); simpleAuthenticationInfo.setPrincipals(principalCollection); simpleAuthenticationInfo.setCredentials(credentials); return simpleAuthenticationInfo; } throw new AuthenticationException("Login failed for user: " + user); }
Source:
public static GermplasmListNewColumnsInfo createGermplasmListNewColumnsInfo(final String columnHeader, final String columnValue) { final GermplasmListNewColumnsInfo germplasmListNewColumnsInfo = new GermplasmListNewColumnsInfo(1); final LinkedHashMap<String, List<ListDataColumnValues>> columnValuesMap = new LinkedHashMap<>(); final List<ListDataColumnValues> listDataColumnValues = new ArrayList<>(); listDataColumnValues.add(new ListDataColumnValues(columnHeader, 1, columnValue)); columnValuesMap.put(columnHeader, listDataColumnValues); germplasmListNewColumnsInfo.setColumnValuesMap(columnValuesMap); germplasmListNewColumnsInfo.addColumn(columnHeader); return germplasmListNewColumnsInfo; }

Target:
public static GermplasmListNewColumnsInfo createGermplasmListNewColumnsInfo(final String columnHeader, final String columnValue) { final GermplasmListNewColumnsInfo germplasmListNewColumnsInfo = new GermplasmListNewColumnsInfo(1); final Map<String, List<ListDataColumnValues>> columnValuesMap = new LinkedHashMap<>(); final List<ListDataColumnValues> listDataColumnValues = new ArrayList<>(); listDataColumnValues.add(new ListDataColumnValues(columnHeader, 1, columnValue)); columnValuesMap.put(columnHeader, listDataColumnValues); germplasmListNewColumnsInfo.setColumnValuesMap(columnValuesMap); germplasmListNewColumnsInfo.addColumn(columnHeader); return germplasmListNewColumnsInfo; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { final IResource resource = getSelectedResources(event)[0]; if (resource instanceof IFile){ final IFile baseFile = (IFile) resource; final ITypedElement base = SaveableCompareEditorInput .createFileElement(baseFile); final ITypedElement next; try { next = getHeadTypedElement(baseFile); } catch (IOException e) { Activator.handleError( UIText.CompareWithIndexAction_errorOnAddToIndex, e, true); return null; } final GitCompareFileRevisionEditorInput in = new GitCompareFileRevisionEditorInput( base, next, null); CompareUI.openCompareEditor(in); } if (resource instanceof IContainer){ CompareTreeView view; try { view = (CompareTreeView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .showView(CompareTreeView.ID); view.setInput(resource, CompareTreeView.INDEX_VERSION); } catch (PartInitException e) { Activator.handleError(e.getMessage(), e, true); } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final IResource resource = getSelectedResources(event)[0]; if (resource instanceof IFile) { final IFile baseFile = (IFile) resource; final ITypedElement base = SaveableCompareEditorInput .createFileElement(baseFile); final ITypedElement next; try { next = getHeadTypedElement(baseFile); } catch (IOException e) { Activator.handleError( UIText.CompareWithIndexAction_errorOnAddToIndex, e, true); return null; } final GitCompareFileRevisionEditorInput in = new GitCompareFileRevisionEditorInput( base, next, null); CompareUI.openCompareEditor(in); } else if (resource instanceof IContainer) { CompareTreeView view; try { view = (CompareTreeView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage().showView( CompareTreeView.ID); view.setInput(resource, CompareTreeView.INDEX_VERSION); } catch (PartInitException e) { Activator.handleError(e.getMessage(), e, true); } } return null; }
Source:
public void testControllerConnectThenDisconnect() { ClusterControllerManager controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, "TestController"); long start = System.currentTimeMillis(); controller.syncStart(); verifyControllerIsLeader(controller); System.out.println(System.currentTimeMillis() - start + "ms spent on becoming the leader"); start = System.currentTimeMillis(); controller.syncStop(); verifyControllerIsNotLeader(controller); verifyZKDisconnected(controller); System.out.println( System.currentTimeMillis() - start + "ms spent on becoming the standby node from leader"); }

Target:
public void testControllerConnectThenDisconnect() { ClusterControllerManager controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, "TestController"); long start = System.currentTimeMillis(); controller.syncStart(); verifyControllerIsLeader(controller); LOG.info(System.currentTimeMillis() - start + "ms spent on becoming the leader"); start = System.currentTimeMillis(); controller.syncStop(); verifyControllerIsNotLeader(controller); verifyZKDisconnected(controller); LOG.info( System.currentTimeMillis() - start + "ms spent on becoming the standby node from leader"); }
Source:
public void setFilterText(String filter) { this.langLinks.clear(); filter = filter.toLowerCase(); for (PageTitle l: origLangLinks) { Locale locale = new Locale(Utils.toJavaLanguageCode(l.getSite().getLanguage())); if (l.getDisplayText().contains(filter) || locale.getDisplayLanguage().toLowerCase().contains(filter) || locale.getDisplayLanguage(locale).toLowerCase().contains(filter)) { this.langLinks.add(l); } } notifyDataSetInvalidated(); }

Target:
public void setFilterText(String filter) { this.langLinks.clear(); filter = filter.toLowerCase(); for (PageTitle l: origLangLinks) { Locale locale = new Locale(Utils.toJavaLanguageCode(l.getSite().getLanguage())); if (l.getDisplayText().toLowerCase().contains(filter) || locale.getDisplayLanguage().toLowerCase().contains(filter) || locale.getDisplayLanguage(locale).toLowerCase().contains(filter)) { this.langLinks.add(l); } } notifyDataSetInvalidated(); }
Source:
public void testRemoveElement() { int i = fullList.remove(2); assertEquals(i, 3); assertTrue(!fullList.contains(3)); }

Target:
public void testRemoveElement() { fullList.remove(Integer.valueOf(3)); assertFalse(fullList.contains(3)); }