auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Predicate<ChangeData> rewrite(Predicate<ChangeData> in, int start) throws QueryParseException { ChangeIndex index = indexes.getSearchIndex(); in = basicRewrites.rewrite(in); int limit = Objects.firstNonNull(ChangeQueryBuilder.getLimit(in), DEFAULT_MAX_LIMIT); limit += start; limit = Math.max(limit, 1); Predicate<ChangeData> out = rewriteImpl(in, index, limit); if (in == out || out instanceof IndexPredicate) { return new IndexedChangeQuery(index, out, limit); } else if (out == null ) { return in; } else { return out; } }

Target:
public Predicate<ChangeData> rewrite(Predicate<ChangeData> in, int start) throws QueryParseException { ChangeIndex index = indexes.getSearchIndex(); in = basicRewrites.rewrite(in); int limit = Objects.firstNonNull(ChangeQueryBuilder.getLimit(in), DEFAULT_MAX_QUERY_LIMIT); limit += start; limit = Math.max(limit, 1); Predicate<ChangeData> out = rewriteImpl(in, index, limit); if (in == out || out instanceof IndexPredicate) { return new IndexedChangeQuery(index, out, limit); } else if (out == null ) { return in; } else { return out; } }
Source:
public String toString() { String domainName = staticData.getName() == null ? "null" : staticData.getName(); String domainId = staticData.getId() == null ? "null" : staticData.getId().toString(); return "StorageDomain[" + domainName + ", " + domainId + "]"; }

Target:
public String toString() { String domainName = staticData == null ? "null" : staticData.getName(); Guid domainId = staticData == null ? null : staticData.getId(); return "StorageDomain[" + domainName + ", " + domainId + "]"; }
Source:
public static ServiceName deploymentSchedulerServiceName(ClassLoader deploymentClassLoader) { if (deploymentClassLoader == null) { deploymentClassLoader = SecurityActions.getContextClassLoader(); } if (deploymentClassLoader instanceof ModuleClassLoader) { ModuleClassLoader moduleClassLoader = (ModuleClassLoader) deploymentClassLoader; final String DEPLOYMEND_CL_NAME_PREFIX = "deployment."; final String clName = moduleClassLoader.getName(); if (clName.startsWith(DEPLOYMEND_CL_NAME_PREFIX)) { final String deploymentName = clName.substring(DEPLOYMEND_CL_NAME_PREFIX.length()); final int earInfixPos = deploymentName.indexOf(EAR_INFIX); if (earInfixPos >= 0) { final String earName = deploymentName.substring(0, earInfixPos + EAR_INFIX.length() - 1); final String warName = deploymentName.substring(earInfixPos + EAR_INFIX.length()); return ServiceName.of("jboss", "deployment", "subunit", earName, warName, SERVICE_NAME); } else { return ServiceName.of("jboss", "deployment", "unit", deploymentName, SERVICE_NAME); } } else { throw new IllegalStateException(String.format("Expected a %s name starting with '%s'; found %s", ModuleClassLoader.class.getName(), DEPLOYMEND_CL_NAME_PREFIX, clName)); } } else { throw new IllegalStateException(String.format("Expected a %s; found %s", ModuleClassLoader.class.getName(), deploymentClassLoader)); } }

Target:
public static ServiceName deploymentSchedulerServiceName(ClassLoader deploymentClassLoader) { if (deploymentClassLoader == null) { deploymentClassLoader = SecurityActions.getContextClassLoader(); } if (deploymentClassLoader instanceof ModuleClassLoader) { ModuleClassLoader moduleClassLoader = (ModuleClassLoader) deploymentClassLoader; final String clName = moduleClassLoader.getName(); if (clName.startsWith(DEPLOYMENT_CL_NAME_PREFIX)) { if (clName.endsWith(WAR_SUFFIX)) { final String deploymentName = clName.substring(DEPLOYMENT_CL_NAME_PREFIX.length()); final int earInfixPos = deploymentName.indexOf(EAR_INFIX); if (earInfixPos >= 0) { final String earName = deploymentName.substring(0, earInfixPos + EAR_INFIX.length() - 1); final String warName = deploymentName.substring(earInfixPos + EAR_INFIX.length()); return ServiceName.of("jboss", "deployment", "subunit", earName, warName, SERVICE_NAME); } else { return ServiceName.of("jboss", "deployment", "unit", deploymentName, SERVICE_NAME); } } else { throw new IllegalStateException(String.format("Expected a %s name ending with '%s'; found %s", ModuleClassLoader.class.getName(), WAR_SUFFIX, clName)); } } else { throw new IllegalStateException(String.format("Expected a %s name starting with '%s'; found %s", ModuleClassLoader.class.getName(), DEPLOYMENT_CL_NAME_PREFIX, clName)); } } else { throw new IllegalStateException( String.format("Expected a %s; found %s", ModuleClassLoader.class.getName(), deploymentClassLoader)); } }
Source:
protected void initCommandsAndReturnValues(ArrayList<VdcReturnValueBase> returnValues) { VdcReturnValueBase returnValue; for (VdcActionParametersBase parameter : getParameters()) { parameter.setMultipleAction(true); returnValue = ExecutionHandler.evaluateCorrelationId(parameter); if (returnValue == null) { CommandBase<?> command = isInternal ? CommandsFactory.createCommand(actionType, parameter, commandContext.clone() .withoutCompensationContext()) : CommandsFactory.createCommand(actionType, parameter); command.setInternalExecution(isInternal); getCommands().add(command); } else { returnValues.add(returnValue); } } }

Target:
private void initCommandsAndReturnValues(ArrayList<VdcReturnValueBase> returnValues) { VdcReturnValueBase returnValue; for (VdcActionParametersBase parameter : getParameters()) { parameter.setMultipleAction(true); returnValue = ExecutionHandler.evaluateCorrelationId(parameter); if (returnValue == null) { CommandBase<?> command = isInternal ? CommandsFactory.createCommand(actionType, parameter, commandContext.clone() .withoutCompensationContext()) : CommandsFactory.createCommand(actionType, parameter); command.setInternalExecution(isInternal); getCommands().add(command); } else { returnValues.add(returnValue); } } }
Source:
void startConsumer() { if (topicPartitions2Offset.size() <= 0) { LOG.warn("Consumer is not subscribed to any SSPs", this); } topicPartitions2Offset.forEach((tp, startingOffsetString) -> { long startingOffset = Long.valueOf(startingOffsetString); try { synchronized (kafkaConsumer) { END_OFFSET kafkaConsumer.seek(tp, startingOffset); } } catch (Exception e) { LOG.error("Got Exception while seeking to " + startingOffsetString + " for " + tp, e); throw new SamzaException(e); } LOG.info("Changing consumer's starting offset for tp = " + tp + " to " + startingOffsetString); proxy.addTopicPartition(topicPartitions2SSP.get(tp), startingOffset); }); if (proxy != null && !proxy.isRunning()) { LOG.info("Starting proxy: " + proxy); proxy.start(); } }

Target:
void startConsumer() { if (topicPartitionsToOffset.size() <= 0) { LOG.error ("{}: Consumer is not subscribed to any SSPs", this); } topicPartitionsToOffset.forEach((tp, startingOffsetString) -> { long startingOffset = Long.valueOf(startingOffsetString); try { synchronized (kafkaConsumer) { kafkaConsumer.seek(tp, startingOffset); } } catch (Exception e) { String msg = String.format("%s: Got Exception while seeking to %s for partition %s", this, startingOffsetString, tp); LOG.error(msg, e); throw new SamzaException(msg, e); } LOG.info("{}: Changing consumer's starting offset for tp = %s to %s", this, tp, startingOffsetString); proxy.addTopicPartition(topicPartitionsToSSP.get(tp), startingOffset); }); if (proxy != null && !proxy.isRunning()) { LOG.info("{}: Starting proxy {}", this, proxy); proxy.start(); } }
Source:
protected CommandBase(T parameters, CommandContext cmdContext) { if (cmdContext == null) { cmdContext = new CommandContext(new EngineContext().setSessionId(parameters.getSessionId())) .setExecutionContext(new ExecutionContext()); } this.context = cmdContext; _parameters = parameters; DbUser user = SessionDataContainer.getInstance().getUser(cmdContext.getEngineContext().getSessionId(), true); if (user != null) { setCurrentUser(user); } ExecutionContext executionContext = cmdContext.getExecutionContext(); if (executionContext.getJob() != null) { setJobId(executionContext.getJob().getId()); } else if (executionContext.getStep() != null) { setJobId(executionContext.getStep().getJobId()); } Guid commandIdFromParameters = parameters.getCommandId(); if (commandIdFromParameters == null) { commandIdFromParameters = Guid.newGuid(); getParameters().setCommandId(commandIdFromParameters); } commandId = commandIdFromParameters; taskHandlers = initTaskHandlers(); setCorrelationId(parameters.getCorrelationId()); }

Target:
protected CommandBase(T parameters, CommandContext cmdContext) { if (cmdContext == null) { cmdContext = new CommandContext(new EngineContext().withSessionId(parameters.getSessionId())) .withExecutionContext(new ExecutionContext()); } this.context = cmdContext; _parameters = parameters; DbUser user = SessionDataContainer.getInstance().getUser(cmdContext.getEngineContext().getSessionId(), true); if (user != null) { setCurrentUser(user); } ExecutionContext executionContext = cmdContext.getExecutionContext(); if (executionContext.getJob() != null) { setJobId(executionContext.getJob().getId()); } else if (executionContext.getStep() != null) { setJobId(executionContext.getStep().getJobId()); } Guid commandIdFromParameters = parameters.getCommandId(); if (commandIdFromParameters == null) { commandIdFromParameters = Guid.newGuid(); getParameters().setCommandId(commandIdFromParameters); } commandId = commandIdFromParameters; taskHandlers = initTaskHandlers(); setCorrelationId(parameters.getCorrelationId()); }
Source:
protected void doStop() { log.info("Stopping Netty server"); boss.shutdownGracefully(); wrkr.shutdownGracefully(); try { sock.channel().closeFuture().sync(); } catch (InterruptedException e) { log.warn("Netty server stop interrupted"); Thread.currentThread().interrupt(); } log.info("Netty server stopped"); notifyStopped(); }

Target:
protected void doStop() { log.info("Stopping Netty server"); boss.shutdownGracefully(); if(!datagram) { wrkr.shutdownGracefully(); } try { sock.channel().closeFuture().sync(); } catch (InterruptedException e) { log.warn("Netty server stop interrupted"); Thread.currentThread().interrupt(); } log.info("Netty server stopped"); notifyStopped(); }
Source:
public void destroy() { clearProjectItems(); tagInput.setValue( "" ); tagList.removeAllChildren(); }

Target:
public void destroy() { projects.removeAllChildren(); tagInput.setValue( "" ); tagList.removeAllChildren(); }
Source:
protected List<Map<String, Serializable>> getTags(DocumentModel docModel) { try { return (List<Map<String, Serializable>>) docModel.getPropertyValue(TAG_LIST); } catch (PropertyNotFoundException e) { if (log.isWarnEnabled()) { log.warn( "Getting tags on " + docModel.getName() + " failed since " + TAG_FACET + " facet is missing on " + docModel.getType() + " document type. This operation will be ignored."); } return new ArrayList<>(); } }

Target:
protected List<Map<String, Serializable>> getTags(DocumentModel docModel) { try { return (List<Map<String, Serializable>>) docModel.getPropertyValue(TAG_LIST); } catch (PropertyNotFoundException e) { if (log.isWarnEnabled()) { log.warn(String.format( "Getting tags on %s failed since %s is missing on %s document type. This operation will be ignored.", docModel.getPathAsString(), TAG_FACET, docModel.getType())); } return new ArrayList<>(); } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); if (renderingConfig.isLocalReflections()) { prePostMaterial.setMatrix4("invProjMatrix", activeCamera.getInverseProjectionMatrix(), true); prePostMaterial.setMatrix4("projMatrix", activeCamera.getProjectionMatrix(), true); } if (renderingConfig.isOutline()) { prePostMaterial.setFloat("outlineDepthThreshold", outlineDepthThreshold, true); prePostMaterial.setFloat("outlineThickness", outlineThickness, true); } if (renderingConfig.isVolumetricFog()) { prePostMaterial.setMatrix4("invViewProjMatrix", activeCamera.getInverseViewProjectionMatrix(), true); } if (renderingConfig.isInscattering()) { skyInscatteringSettingsFrag.set(0, skyInscatteringStrength, skyInscatteringLength, skyInscatteringThreshold); prePostMaterial.setFloat4("skyInscatteringSettingsFrag", skyInscatteringSettingsFrag, true); } renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); if (isLocalReflections) { prePostMaterial.setMatrix4("invProjMatrix", activeCamera.getInverseProjectionMatrix(), true); prePostMaterial.setMatrix4("projMatrix", activeCamera.getProjectionMatrix(), true); } if (isOutline) { prePostMaterial.setFloat("outlineDepthThreshold", outlineDepthThreshold, true); prePostMaterial.setFloat("outlineThickness", outlineThickness, true); } if (isVolumetricFog) { prePostMaterial.setMatrix4("invViewProjMatrix", activeCamera.getInverseViewProjectionMatrix(), true); } if (isInscattering) { prePostMaterial.setFloat4("skyInscatteringSettingsFrag", 0, skyInscatteringStrength, skyInscatteringLength, skyInscatteringThreshold, true); } renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); PerformanceMonitor.endActivity(); }
Source:
public int deleteAnnouncement(int id) { LOG.debug("delete announcement with id: " + id); final SqlSession session = factory.openSession(); int deletedId = -1; try { final AnnouncementsMapper mapper = session.getMapper(AnnouncementsMapper.class); deletedId = mapper.deleteAnnouncement(id); session.commit(); } catch (Exception e) { LOG.error(e, "Couldn't delete announcement with id:", id); } finally { session.close(); } return deletedId; }

Target:
public int deleteAnnouncement(int id) { int deletedId = -1; try (final SqlSession session = factory.openSession()) { final AnnouncementsMapper mapper = session.getMapper(AnnouncementsMapper.class); deletedId = mapper.deleteAnnouncement(id); return deletedId; } catch (Exception e) { throw new ServiceRuntimeException("Failed to save announcements", e); } }
Source:
void queueEdmInfo(EdmInfo edmInfo) { try { Set<String> urls = edmInfo.edmObject.getResourceUrls(urlTypes).keySet(); if (urls.isEmpty()) { logger.error("content url missing in edm file representation: {}", edmInfo.representation); return; } edmInfo.fileInfos = urls.stream().map(FileInfo::new).collect(Collectors.toList()); Map<String, Long> hostCounts = urls.stream() .collect(Collectors.groupingBy(url -> URI.create(url).getHost(), Collectors.counting())); Comparator<Entry<String, Long>> c = Comparator.comparing(Entry::getValue); c = c.thenComparing(Entry::getKey); String host = hostCounts.entrySet().stream().max(c).get().getKey(); SourceInfo source = sourcesByHost.computeIfAbsent(host, SourceInfo::new); source.addToQueue(edmInfo); } catch (Exception e) { subTaskInfoDao.insert( (int) edmInfo.counter, edmInfo.taskInfo.task.getTaskId(), "linkcheck_topology", edmInfo.representation.getUri().toString(), States.ERROR.toString(), "Failed while queing edm info", e.getMessage(), null); StatsTupleData stats = new StatsTupleData(edmInfo.taskInfo.task.getTaskId(), 1); stats.addStatus(edmInfo.representation.getUri().toString(), e.getMessage()); outputCollector.emit(StatsTupleData.STREAM_ID, new Values(stats)); edmProcessed(edmInfo); } }

Target:
void queueEdmInfo(EdmInfo edmInfo) { try { Set<String> urls = edmInfo.edmObject.getResourceUrls(urlTypes).keySet(); if (urls.isEmpty()) { logger.error("content url missing in edm file representation: {}", edmInfo.representation); return; } edmInfo.fileInfos = urls.stream().map(FileInfo::new).collect(Collectors.toList()); Map<String, Long> hostCounts = urls.stream() .collect(Collectors.groupingBy(url -> URI.create(url).getHost(), Collectors.counting())); Comparator<Entry<String, Long>> c = Comparator.comparing(Entry::getValue); c = c.thenComparing(Entry::getKey); String host = hostCounts.entrySet().stream().max(c).get().getKey(); SourceInfo source = sourcesByHost.computeIfAbsent(host, SourceInfo::new); source.addToQueue(edmInfo); } catch (Exception e) { subTaskInfoDao.insert( (int) edmInfo.counter, edmInfo.taskInfo.task.getTaskId(), (String) baseSpout.getComponentConfiguration().getOrDefault(TOPOLOGY_NAME, "linkcheck_topology"), edmInfo.representation.getUri().toString(), States.ERROR.toString(), "Failed while queing edm info", e.getMessage(), null); StatsTupleData stats = new StatsTupleData(edmInfo.taskInfo.task.getTaskId(), 1); stats.addStatus(edmInfo.representation.getUri().toString(), e.getMessage()); outputCollector.emit(StatsTupleData.STREAM_ID, new Values(stats)); edmProcessed(edmInfo); } }
Source:
private static ImportPackageSpecification[] createImportPackages(ExportPackageDescription[] exported, List<String> providedExports, ManifestElement[] imported, ManifestElement[] dynamicImported, int manifestVersion) { List<ImportPackageSpecification> allImports = null; if (manifestVersion < 2) { if (exported.length == 0 && imported == null && dynamicImported == null) return null; allImports = new ArrayList<>(exported.length + (imported == null ? 0 : imported.length)); for (ExportPackageDescription exported1 : exported) { if (providedExports.contains(exported1.getName())) { continue; } ImportPackageSpecificationImpl result = new ImportPackageSpecificationImpl(); result.setName(exported1.getName()); result.setVersionRange(getVersionRange(exported1.getVersion().toString())); result.setDirective(Constants.RESOLUTION_DIRECTIVE, ImportPackageSpecification.RESOLUTION_STATIC); allImports.add(result); } } else { allImports = new ArrayList<>(imported == null ? 0 : imported.length); } if (dynamicImported != null) for (ManifestElement dynamicImported1 : dynamicImported) { addImportPackages(dynamicImported1, allImports, manifestVersion, true); } if (imported != null) for (ManifestElement imported1 : imported) { addImportPackages(imported1, allImports, manifestVersion, false); } return allImports.toArray(new ImportPackageSpecification[allImports.size()]); }

Target:
private static ImportPackageSpecification[] createImportPackages(ExportPackageDescription[] exported, List<String> providedExports, ManifestElement[] imported, ManifestElement[] dynamicImported, int manifestVersion) { List<ImportPackageSpecification> allImports = null; if (manifestVersion < 2) { if (exported.length == 0 && imported == null && dynamicImported == null) return null; allImports = new ArrayList<>(exported.length + (imported == null ? 0 : imported.length)); for (ExportPackageDescription exportDescription : exported) { if (providedExports.contains(exportDescription.getName())) { continue; } ImportPackageSpecificationImpl result = new ImportPackageSpecificationImpl(); result.setName(exportDescription.getName()); result.setVersionRange(getVersionRange(exportDescription.getVersion().toString())); result.setDirective(Constants.RESOLUTION_DIRECTIVE, ImportPackageSpecification.RESOLUTION_STATIC); allImports.add(result); } } else { allImports = new ArrayList<>(imported == null ? 0 : imported.length); } if (dynamicImported != null) for (ManifestElement dynamicImport : dynamicImported) { addImportPackages(dynamicImport, allImports, manifestVersion, true); } if (imported != null) for (ManifestElement imported1 : imported) { addImportPackages(imported1, allImports, manifestVersion, false); } return allImports.toArray(new ImportPackageSpecification[allImports.size()]); }
Source:
public void getPhonesShouldReturnTheListOfPhones() throws Exception { String responseString = "[" + "{" + "\"id\": \"foobar\"," + "\"verified\": \"true\"," + "\"primary\": \"true\"," + "\"e164Masked\": \"+XXXXXXXXX04\"," + "\"internationalMasked\": \"+X XXX-XXX-XX04\"" + "}" + "]"; MockRestAdapter<List<Phone>> adapter = new MockRestAdapter<>("foobar", responseString, null); adapter.request(new RepromiseFunction<UpholdRestAdapter, List<Phone>>() { @Override public Promise<List<Phone>> call(UpholdRestAdapter adapter) { User user = Fixtures.loadUser(); user.setUpholdRestAdapter(adapter); return user.getPhones(); } }); List<Phone> phones = adapter.getResult(); Request request = adapter.getRequest(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), String.format("%s/v0/me/phones", BuildConfig.API_SERVER_URL)); Assert.assertEquals(phones.size(), 1); Assert.assertEquals(phones.get(0).getE164Masked(), "+XXXXXXXXX04"); Assert.assertEquals(phones.get(0).getId(), "foobar"); Assert.assertEquals(phones.get(0).getInternationalMasked(), "+X XXX-XXX-XX04"); Assert.assertTrue(phones.get(0).getPrimary()); Assert.assertTrue(phones.get(0).getVerified()); }

Target:
public void getPhonesShouldReturnTheListOfPhones() throws Exception { String responseString = "[" + "{" + "\"id\": \"foobar\"," + "\"verified\": \"true\"," + "\"primary\": \"true\"," + "\"e164Masked\": \"+XXXXXXXXX04\"" + "}" + "]"; MockRestAdapter<List<Phone>> adapter = new MockRestAdapter<>("foobar", responseString, null); adapter.request(new RepromiseFunction<UpholdRestAdapter, List<Phone>>() { @Override public Promise<List<Phone>> call(UpholdRestAdapter adapter) { User user = Fixtures.loadUser(); user.setUpholdRestAdapter(adapter); return user.getPhones(); } }); List<Phone> phones = adapter.getResult(); Request request = adapter.getRequest(); Assert.assertEquals(request.getMethod(), "GET"); Assert.assertEquals(request.getUrl(), String.format("%s/v0/me/phones", BuildConfig.API_SERVER_URL)); Assert.assertEquals(phones.size(), 1); Assert.assertEquals(phones.get(0).getE164Masked(), "+XXXXXXXXX04"); Assert.assertEquals(phones.get(0).getId(), "foobar"); Assert.assertTrue(phones.get(0).getPrimary()); Assert.assertTrue(phones.get(0).getVerified()); }
Source:
private void initializePartition(Set<TrackerClient> trackerClients, int partitionId, long clusterGenerationId) { Lock lock = new ReentrantLock(); PartitionRelativeLoadBalancerState partitionRelativeLoadBalancerState = new PartitionRelativeLoadBalancerState(partitionId, new DelegatingRingFactory<>(_relativeStrategyProperties.getRingProperties()), _relativeStrategyProperties.getRingProperties().getPointsPerWeight(), lock, _listenerFactories.stream().map(factory -> factory.create(partitionId)).collect(Collectors.toList())); partitionRelativeLoadBalancerState.getLock().lock(); try { if (!_partitionLoadBalancerStateMap.containsKey(partitionId)) { updateStateForPartition(trackerClients, partitionId, partitionRelativeLoadBalancerState, clusterGenerationId); } } finally { partitionRelativeLoadBalancerState.getLock().unlock(); } }

Target:
private void initializePartition(Set<TrackerClient> trackerClients, int partitionId, long clusterGenerationId) { PartitionState partitionState = new PartitionState(partitionId, new DelegatingRingFactory<>(_relativeStrategyProperties.getRingProperties()), _relativeStrategyProperties.getRingProperties().getPointsPerWeight(), _listenerFactories.stream().map(factory -> factory.create(partitionId)).collect(Collectors.toList())); _lock.lock(); try { if (!_partitionLoadBalancerStateMap.containsKey(partitionId)) { updateStateForPartition(trackerClients, partitionId, partitionState, clusterGenerationId); } } finally { _lock.unlock(); } }
Source:
public void handleHoursSpentInputChange( ChangeEvent event ) { try { Long value = hoursSpentInput.getValue().isEmpty() ? null : Long.parseLong( hoursSpentInput.getValue() ); presenter.onHoursSpentChange( value ); } catch ( NumberFormatException e ) { } }

Target:
public void handleHoursSpentInputChange( ChangeEvent event ) { boolean isNumeric = hoursSpentInput.getValue().matches( "\\d+" ); if (isNumeric) { presenter.onHoursSpentChange( Long.parseLong( hoursSpentInput.getValue() ) ); } else { presenter.onHoursSpentChange( 0l ); hoursSpentInput.setValue( "0" ); } }
Source:
protected Node[] createNodesForKey(String key) { try { String accountType = key; if (accountType.equals(Account.Type.CREDIT_CARD.getTypeName())) { return new Node[]{new CreditCardNumberAccountTypeNode()}; } else { String accountTypeDisplayname; try { accountTypeDisplayname = skCase.getCommunicationsManager().getAccountType(accountType).getDisplayName(); } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error getting display name for account type. ", ex); accountTypeDisplayname = accountType; } return new Node[]{new DefaultAccountTypeNode(key, accountTypeDisplayname)}; } } catch (IllegalArgumentException ex) { LOGGER.log(Level.WARNING, "Unknown account type: {0}", key); return new Node[]{new DefaultAccountTypeNode(key, key)}; } }

Target:
protected Node[] createNodesForKey(String key) { String accountType = key; if (accountType.equals(Account.Type.CREDIT_CARD.getTypeName())) { return new Node[]{new CreditCardNumberAccountTypeNode()}; } else { String accountTypeDisplayname; try { accountTypeDisplayname = skCase.getCommunicationsManager().getAccountType(accountType).getDisplayName(); } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error getting display name for account type. ", ex); accountTypeDisplayname = accountType; } return new Node[]{new DefaultAccountTypeNode(key, accountTypeDisplayname)}; } }
Source:
static int checkStyle (int style) { if ((style & SWT.NO_TRIM) != 0) { style &= ~(SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.MAX | SWT.RESIZE | SWT.BORDER); } if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) { style |= SWT.TITLE; } if (style == SWT.NO_MOVE) { style |= SWT.TITLE; } return style; }

Target:
static int checkStyle (int style) { if ((style & SWT.NO_TRIM) != 0) { style &= ~(SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.MAX | SWT.RESIZE | SWT.BORDER); } else if ((style & SWT.NO_MOVE) != 0) { style |= SWT.TITLE; } if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) { style |= SWT.TITLE; } return style; }
Source:
public void processLeftData(final MistDataEvent input) { try { input.setValue(aggregateFunc.apply((WindowData<IN>) input.getValue())); outputEmitter.emitData(input); } catch (ClassCastException e) { throw e; } }

Target:
public void processLeftData(final MistDataEvent input) { try { input.setValue(aggregateFunc.apply((WindowData<IN>) input.getValue())); outputEmitter.emitData(input); } catch (final ClassCastException e) { throw e; } }
Source:
public DataSourceWithSegmentSpec( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec) { this.dataSource = dataSource; this.querySegmentSpec = querySegmentSpec; }

Target:
public DataSourceWithSegmentSpec( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec) { this.dataSource = Preconditions.checkNotNull(dataSource); this.querySegmentSpec = Preconditions.checkNotNull(querySegmentSpec); }
Source:
public String getErrorCodeValue() { return errorCodeValue; }

Target:
public TextAnalyticsErrorCode getErrorCodeValue() { return TextAnalyticsErrorCode.fromString(errorCodeValue); }
Source:
public void loadChunk(int x, int z) { w.loadChunk(z, z); }

Target:
public void loadChunk(int x, int z) { w.loadChunk(x, z); }
Source:
public static boolean promptToDeleteLock(final LockFailedException exception) { final AtomicBoolean confirmed = new AtomicBoolean(); final Display display = PlatformUI.getWorkbench().getDisplay(); display.syncExec(new Runnable() { public void run() { confirmed.set(MessageDialog.openQuestion(display .getActiveShell(), UIText.UIUtils_TitleLockFailed, MessageFormat.format(UIText.UIUtils_MessageLockFailed, exception.getFile().getAbsolutePath()))); } }); return confirmed.get(); }

Target:
public static void promptToDeleteLock(final LockFailedException exception) { final Display display = PlatformUI.getWorkbench().getDisplay(); display.asyncExec(new Runnable() { public void run() { boolean confirmed = MessageDialog.openQuestion(display .getActiveShell(), UIText.UIUtils_TitleLockFailed, MessageFormat.format(UIText.UIUtils_MessageLockFailed, exception.getFile().getAbsolutePath())); if (confirmed) LockFile.unlock(exception.getFile()); } }); }
Source:
public static String getResponseType(final ImmutableList<Ds3ResponseCode> responseCodes) { if (responseCodes == null) return ""; for (final Ds3ResponseCode responseCode : responseCodes) { final int rc = responseCode.getCode(); if (rc < 200 || rc >= 300) continue; for (final Ds3ResponseType responseType : responseCode.getDs3ResponseTypes()) { if (ConverterUtil.hasContent(responseType.getType()) && !responseType.getType().contentEquals("null")) { return StructHelper.getResponseTypeName(responseType.getType()); } if (ConverterUtil.hasContent(responseType.getComponentType()) && !responseType.getComponentType().contentEquals("null")) { return StructHelper.getResponseTypeName(responseType.getComponentType()); } } } return ""; }

Target:
public static String getResponseType(final ImmutableList<Ds3ResponseCode> responseCodes) { if (isEmpty(responseCodes)) return ""; for (final Ds3ResponseCode responseCode : responseCodes) { final int rc = responseCode.getCode(); if (rc < 200 || rc >= 300) continue; for (final Ds3ResponseType responseType : responseCode.getDs3ResponseTypes()) { if (ConverterUtil.hasContent(responseType.getType()) && !responseType.getType().contentEquals("null")) { return StructHelper.getResponseTypeName(responseType.getType()); } if (ConverterUtil.hasContent(responseType.getComponentType()) && !responseType.getComponentType().contentEquals("null")) { return StructHelper.getResponseTypeName(responseType.getComponentType()); } } } return ""; }
Source:
public RenderedImageMap produceMap(final WMSMapContent mapContent, final boolean tiled) { this.mapContent = mapContent; final GetMapRequest request = mapContent.getRequest(); RenderedImageMap map = null; this.map = null; int maxRenderingTime = wms.getMaxRenderingTime() * 1000; int localMaxRenderingTime = 0; Object timeoutOption = request.getFormatOptions().get("timeout"); if (timeoutOption != null) { try { localMaxRenderingTime = Integer.parseInt(timeoutOption.toString()) * 1000; } catch (NumberFormatException e) { LOGGER.log(Level.WARNING,"Could not parse format_option \"timeout\": "+timeoutOption, e); } } if (maxRenderingTime == 0) { maxRenderingTime = localMaxRenderingTime; } else if (localMaxRenderingTime != 0) { maxRenderingTime = Math.min(maxRenderingTime, localMaxRenderingTime); } RenderingTimeoutEnforcer timeout = new RenderingTimeoutEnforcer(maxRenderingTime); timeout.start(); try { map = super.produceMap(mapContent, tiled); } finally { timeout.stop(); } if (timeout.timedOut) { LOGGER.log(Level.WARNING,"Renderer timed out. Returning partial image"); } if (map == null) { map = this.map; } this.mapContent = null; this.renderer = null; this.graphic = null; this.preparedImage = null; this.map = null; return map; }

Target:
public RenderedImageMap produceMap(final WMSMapContent mapContent, final boolean tiled) { this.mapContent = mapContent; final GetMapRequest request = mapContent.getRequest(); RenderedImageMap map = null; this.map = null; int maxRenderingTime = wms.getMaxRenderingTime() * 1000; int localMaxRenderingTime = 0; Object timeoutOption = request.getFormatOptions().get("timeout"); if (timeoutOption != null) { try { localMaxRenderingTime = Integer.parseInt(timeoutOption.toString()); } catch (NumberFormatException e) { LOGGER.log(Level.WARNING,"Could not parse format_option \"timeout\": "+timeoutOption, e); } } if (maxRenderingTime == 0) { maxRenderingTime = localMaxRenderingTime; } else if (localMaxRenderingTime != 0) { maxRenderingTime = Math.min(maxRenderingTime, localMaxRenderingTime); } InternalTimeoutEnforcer timeout = new InternalTimeoutEnforcer(maxRenderingTime); timeout.start(); try { map = super.produceMap(mapContent, tiled); } finally { timeout.stop(); } if (timeout.timedOut) { LOGGER.log(Level.FINE,"Renderer timed out. Returning partial image"); } if (map == null) { map = this.map; } this.mapContent = null; this.renderer = null; this.graphic = null; this.preparedImage = null; this.map = null; return map; }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { if (permissionsList == null) { permissionsList = new ArrayList<PermissionSubject>(); permissionsList.add(new PermissionSubject(getImageId(), VdcObjectType.Disk, ActionGroup.EDIT_DISK_PROPERTIES)); } return permissionsList; }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { if (permissionsList == null) { permissionsList = new ArrayList<PermissionSubject>(); permissionsList.add(new PermissionSubject(getImage().getId(), VdcObjectType.Disk, ActionGroup.EDIT_DISK_PROPERTIES)); } return permissionsList; }
Source:
public static String getParameter(String key) { try { return getConfig().getString(key); } catch (NoSuchElementException e) { e.printStackTrace(); throw new NoSuchElementException("No configuration found in " + CONFIG_FILE + " for key " + key + "!"); } }

Target:
public static String getParameter(String key) { try { return getConfig().getString(key); } catch (NoSuchElementException e) { throw new NoSuchElementException("No configuration found in " + CONFIG_FILE + " for key " + key + "!"); } }
Source:
public static String getHtml(String backgroundColor, String preHtml, String postHtml, Set<XWidgetRendererItem> set, String name) { StringBuffer sb = new StringBuffer(); sb.append(AHTML.startBorderTable(100, backgroundColor, name)); if (preHtml != null) { sb.append(preHtml); } for (XWidgetRendererItem layoutData : set) { XWidget xWidget = layoutData.getXWidget(); if (xWidget instanceof IArtifactWidget) { ((IArtifactWidget) xWidget).setArtifact(layoutData.getArtifact()); } sb.append(layoutData.getXWidget().toHTML(AHTML.LABEL_FONT)); sb.append(AHTML.newline()); } if (postHtml != null) { sb.append(postHtml); } sb.append(AHTML.endBorderTable()); return sb.toString(); }

Target:
public static String getHtml(String backgroundColor, String preHtml, String postHtml, Set<XWidgetRendererItem> set, String name) { StringBuffer sb = new StringBuffer(); int defaultWidth = 100; sb.append(AHTML.startBorderTable(defaultWidth, backgroundColor, name)); if (preHtml != null) { sb.append(preHtml); } for (XWidgetRendererItem layoutData : set) { XWidget xWidget = layoutData.getXWidget(); if (xWidget instanceof IArtifactWidget) { ((IArtifactWidget) xWidget).setArtifact(layoutData.getArtifact()); } sb.append(layoutData.getXWidget().toHTML(AHTML.LABEL_FONT)); sb.append(AHTML.newline()); } if (postHtml != null) { sb.append(postHtml); } sb.append(AHTML.endBorderTable()); return sb.toString(); }
Source:
public void createStates(List<State> states) { List<Document> docs = states.stream().map(converter::stateToBson).collect(Collectors.toList()); log.trace("MongoDB: CREATE [{}]: {}", () -> docs.stream().map(doc -> doc.get(idKey).toString()).collect(Collectors.joining(", ")), () -> docs); try { coll.insertMany(docs); } catch (MongoBulkWriteException mbwe) { final List<String> duplicates = mbwe.getWriteErrors() .stream() .filter(wr -> wr.getCode() == 11000) .map(BulkWriteError::getMessage) .collect(Collectors.toList()); if (duplicates.size() == mbwe.getWriteErrors().size()) { log.trace("MongoDB: -> CONCURRENT UPDATE: {}", duplicates); final ConcurrentUpdateException concurrentUpdateException = new ConcurrentUpdateException(); duplicates.stream().forEach(concurrentUpdateException::addInfo); throw concurrentUpdateException; } throw mbwe; } }

Target:
public void createStates(List<State> states) { List<Document> docs = states.stream().map(converter::stateToBson).collect(Collectors.toList()); log.trace("MongoDB: CREATE [{}]: {}", () -> docs.stream().map(doc -> doc.get(idKey).toString()).collect(Collectors.joining(", ")), () -> docs); try { coll.insertMany(docs); } catch (MongoBulkWriteException mbwe) { List<String> duplicates = mbwe.getWriteErrors() .stream() .filter(wr -> DUPLICATE_KEY.equals(fromErrorCode(wr.getCode()))) .map(BulkWriteError::getMessage) .collect(Collectors.toList()); if (duplicates.size() == mbwe.getWriteErrors().size()) { log.trace("MongoDB: -> DUPLICATE KEY: {}", duplicates); ConcurrentUpdateException concurrentUpdateException = new ConcurrentUpdateException(); duplicates.forEach(concurrentUpdateException::addInfo); throw concurrentUpdateException; } throw mbwe; } }
Source:
public static long getNextPageStart(JSONObject jsonObject) throws StashReportExtractionException { long result = 0; if (jsonObject.get("nextPageStart") != null) { return (Long) jsonObject.get("nextPageStart"); } return 0; }

Target:
public static long getNextPageStart(JSONObject jsonObject) throws StashReportExtractionException { if (jsonObject.get("nextPageStart") != null) { return (Long) jsonObject.get("nextPageStart"); } return 0; }
Source:
public String getExtractedRemoveButtonConfiguration() { String removeButtonConfiguration = getRemoveButtonConfiguration().trim(); if( !removeButtonConfiguration.startsWith( CKEDITOR_CONFIG_REMOVE_BUTTONS ) || !removeButtonConfiguration.endsWith( ";" ) ) { throw new RuntimeException( "Invalid CKEditor removeButtons configuration" ); } int equalSignIndex = removeButtonConfiguration.indexOf( '=' ); int lastSemicolonIndex = removeButtonConfiguration.lastIndexOf( ';' ); return removeButtonConfiguration.substring( equalSignIndex + 1, lastSemicolonIndex ).trim(); }

Target:
private String getExtractedRemoveButtonConfiguration() { String removeButtonConfiguration = getRemoveButtonConfiguration().trim(); if( !removeButtonConfiguration.startsWith( CKEDITOR_CONFIG_REMOVE_BUTTONS ) || !removeButtonConfiguration.endsWith( ";" ) ) { throw new RuntimeException( "Invalid CKEditor removeButtons configuration" ); } int equalSignIndex = removeButtonConfiguration.indexOf( '=' ); int lastSemicolonIndex = removeButtonConfiguration.lastIndexOf( ';' ); return removeButtonConfiguration.substring( equalSignIndex + 1, lastSemicolonIndex ).trim(); }
Source:
public void setUp() throws Exception { when( decisionTableXLSResourceType.getSuffix() ).thenReturn( "XLS" ); when( decisionTableXLSResourceType.accept( XLSPath ) ).thenReturn( true ); when( decisionTableXLSResourceType.accept( XLSXPath ) ).thenReturn( false ); when( decisionTableXLSXResourceType.getSuffix() ).thenReturn( "XLSX" ); when( decisionTableXLSXResourceType.accept( XLSPath ) ).thenReturn( false ); when( decisionTableXLSXResourceType.accept( XLSXPath ) ).thenReturn( true ); presenter = new DecisionTableXLSEditorPresenter( view, decisionTableXLSResourceType, decisionTableXLSXResourceType, busyIndicatorView, new ServiceMock() ) { { kieView = mock( KieEditorWrapperView.class ); overviewWidget = mock( OverviewWidgetPresenter.class ); versionRecordManager = versionRecordManagerMock; concurrentUpdateSessionInfo = null; } protected void makeMenuBar() { } protected void addSourcePage() { } }; }

Target:
public void setUp() throws Exception { when( decisionTableXLSResourceType.getSuffix() ).thenReturn( "XLS" ); when( decisionTableXLSResourceType.accept( XLSPath ) ).thenReturn( true ); when( decisionTableXLSResourceType.accept( XLSXPath ) ).thenReturn( false ); when( decisionTableXLSXResourceType.getSuffix() ).thenReturn( "XLSX" ); when( decisionTableXLSXResourceType.accept( XLSPath ) ).thenReturn( false ); when( decisionTableXLSXResourceType.accept( XLSXPath ) ).thenReturn( true ); presenter = new DecisionTableXLSEditorPresenter( view, decisionTableXLSResourceType, decisionTableXLSXResourceType, busyIndicatorView, notification, new ServiceMock() ) { { kieView = mock( KieEditorWrapperView.class ); overviewWidget = mock( OverviewWidgetPresenter.class ); versionRecordManager = versionRecordManagerMock; concurrentUpdateSessionInfo = null; } protected void makeMenuBar() { } protected void addSourcePage() { } }; }
Source:
public User signup(String name) { control(by.input("username")).set(name); control(by.name("Submit")).clickAndWaitToBecomeStale(Duration.ofSeconds(120)); return new User(getJenkins(), name); }

Target:
public User signup(String name) { control(by.input("username")).set(name); control(by.name("Submit")).clickAndWaitToBecomeStale(); return new User(getJenkins(), name); }
Source:
public boolean contains(final String roleName) { try { return StreamSupport.stream(delegate.spliterator(), false).anyMatch(role -> (regex.matcher(role).matches() && role.replaceFirst(regex.pattern(), replace).equals(roleName)) || (keepNonMapped && !regex.matcher(role).matches() && role.equals(roleName))); } catch (PatternSyntaxException | IndexOutOfBoundsException ex) { throw log.invalidReplacementInRegexRoleMapper(); } }

Target:
public boolean contains(final String roleName) { try { return StreamSupport.stream(delegate.spliterator(), false).anyMatch(role -> { String pattern = this.pattern.pattern(); boolean containsRegex = this.pattern.matcher(role).find(); boolean containsRegexAndRoleExists = containsRegex && (replaceAll ? role.replaceAll(pattern, replace).equals(roleName) : role.replaceFirst(pattern, replace).equals(roleName)); boolean doesNotContainRegexButRoleExists = !containsRegex && keepNonMapped && role.equals(roleName); return containsRegexAndRoleExists || doesNotContainRegexButRoleExists; }); } catch (PatternSyntaxException | IndexOutOfBoundsException ex) { throw log.invalidReplacementInRegexRoleMapper(); } }
Source:
void setErrorReportApiClient(@NonNull ErrorReportApiClient errorReportApiClient) { if (errorReportApiClient == null) { throw new IllegalArgumentException("ErrorReportApiClient cannot be null."); } DeliveryCompat compat = (DeliveryCompat) config.getDelivery(); compat.errorReportApiClient = errorReportApiClient; }

Target:
void setErrorReportApiClient(@NonNull ErrorReportApiClient errorReportApiClient) { if (errorReportApiClient == null) { throw new IllegalArgumentException("ErrorReportApiClient cannot be null."); } DeliveryCompat compat = getAndSetDeliveryCompat(); compat.errorReportApiClient = errorReportApiClient; }
Source:
public void whenExpectingAssumptionViolatedExceptionStatementsThrowingDifferentExceptionShouldFail() { Statement statementThrowingSomeException = new Fail(new SomeException("not expected")); ExpectException expectException = new ExpectException(statementThrowingSomeException, AssumptionViolatedException.class); try { expectException.evaluate(); fail("should throw 'Unexpected exception' when statement throws an exception which is not the one expected"); } catch (Exception e) { assertThat(e.getMessage(), equalTo("Unexpected exception, expected<org.junit.internal.AssumptionViolatedException> " + "but was<org.junit.internal.runners.statements.ExpectExceptionTest$SomeException>")); } }

Target:
public void whenExpectingAssumptionViolatedExceptionStatementsThrowingDifferentExceptionShouldFail() { Statement delegate = new Fail(new SomeException("not expected")); ExpectException expectException = new ExpectException(delegate, AssumptionViolatedException.class); try { expectException.evaluate(); fail("should throw 'Unexpected exception' when statement throws an exception which is not the one expected"); } catch (Exception e) { assertThat(e.getMessage(), equalTo("Unexpected exception, expected<org.junit.internal.AssumptionViolatedException> " + "but was<org.junit.internal.runners.statements.ExpectExceptionTest$SomeException>")); } }
Source:
public void doScrape() throws Exception { MBeanServerConnection beanConn; JMXConnector jmxc = null; if (jmxUrl.isEmpty()) { try { beanConn = ManagementFactory.getPlatformMBeanServer(); } catch (JMRuntimeException e) { if (e.getCause() instanceof ClassNotFoundException) return; else throw e; } } else { Map<String, Object> environment = new HashMap<String, Object>(); if (username != null && username.length() != 0 && password != null && password.length() != 0) { String[] credent = new String[] {username, password}; environment.put(javax.management.remote.JMXConnector.CREDENTIALS, credent); } if (ssl) { environment.put(Context.SECURITY_PROTOCOL, "ssl"); SslRMIClientSocketFactory clientSocketFactory = new SslRMIClientSocketFactory(); environment.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, clientSocketFactory); environment.put("com.sun.jndi.rmi.factory.socket", clientSocketFactory); } jmxc = JMXConnectorFactory.connect(new JMXServiceURL(jmxUrl), environment); beanConn = jmxc.getMBeanServerConnection(); } try { Set<ObjectInstance> mBeanNames = new HashSet(); for (ObjectName name : whitelistObjectNames) { mBeanNames.addAll(beanConn.queryMBeans(name, null)); } for (ObjectName name : blacklistObjectNames) { mBeanNames.removeAll(beanConn.queryMBeans(name, null)); } for (ObjectInstance name : mBeanNames) { long start = System.nanoTime(); scrapeBean(beanConn, name.getObjectName()); logger.fine("TIME: " + (System.nanoTime() - start) + " ns for " + name.getObjectName().toString()); } } finally { if (jmxc != null) { jmxc.close(); } } }

Target:
public void doScrape() throws Exception { MBeanServerConnection beanConn; JMXConnector jmxc = null; if (jmxUrl.isEmpty()) { beanConn = ManagementFactory.getPlatformMBeanServer(); } else { Map<String, Object> environment = new HashMap<String, Object>(); if (username != null && username.length() != 0 && password != null && password.length() != 0) { String[] credent = new String[] {username, password}; environment.put(javax.management.remote.JMXConnector.CREDENTIALS, credent); } if (ssl) { environment.put(Context.SECURITY_PROTOCOL, "ssl"); SslRMIClientSocketFactory clientSocketFactory = new SslRMIClientSocketFactory(); environment.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, clientSocketFactory); environment.put("com.sun.jndi.rmi.factory.socket", clientSocketFactory); } jmxc = JMXConnectorFactory.connect(new JMXServiceURL(jmxUrl), environment); beanConn = jmxc.getMBeanServerConnection(); } try { Set<ObjectInstance> mBeanNames = new HashSet(); for (ObjectName name : whitelistObjectNames) { mBeanNames.addAll(beanConn.queryMBeans(name, null)); } for (ObjectName name : blacklistObjectNames) { mBeanNames.removeAll(beanConn.queryMBeans(name, null)); } for (ObjectInstance name : mBeanNames) { long start = System.nanoTime(); scrapeBean(beanConn, name.getObjectName()); logger.fine("TIME: " + (System.nanoTime() - start) + " ns for " + name.getObjectName().toString()); } } finally { if (jmxc != null) { jmxc.close(); } } }
Source:
public EventDispatcherDescriptor getDispatcherDescriptor() { int nbd = contribs.size(); if (nbd > 0) { return contribs.get(nbd - 1); } else { return null; } }

Target:
public EventDispatcherDescriptor getDispatcherDescriptor() { return contribs.isEmpty() ? null : contribs.get(contribs.size() - 1); }
Source:
private Stream<String> getKeysStream() { try (Cursor<byte[]> cursor = client .getConnectionFactory() .getConnection() .scan(ScanOptions .scanOptions() .match(getPatternTicketRedisKey()) .count(SCAN_COUNT) .build())) { return StreamSupport .stream(Spliterators.spliteratorUnknownSize(cursor, Spliterator.ORDERED), false) .map((key) -> (String) client.getKeySerializer().deserialize(key)) .collect(Collectors.toList()) .stream(); } catch (IOException ex) { LOGGER.error("Could not acquire a Redis connection", ex); return Stream.empty(); } }

Target:
private Stream<String> getKeysStream() { final Cursor<byte[]> cursor = client .getConnectionFactory() .getConnection() .scan(ScanOptions .scanOptions() .match(getPatternTicketRedisKey()) .count(SCAN_COUNT) .build()); return StreamSupport .stream(Spliterators.spliteratorUnknownSize(cursor, Spliterator.ORDERED), false) .map(key -> (String) client.getKeySerializer().deserialize(key)) .onClose(() -> { try { cursor.close(); } catch (final IOException e) { LOGGER.error("Could not close Redis connection", e); } }); }
Source:
public static void display(final String token, final Screen view) { if (view.isRequiresSignIn() && !isSignedIn()) { doSignIn(token); } else { view.setToken(token); body.setView(view); } if (view instanceof PatchScreen) { patchScreen = (PatchScreen) view; menuLeft.setVisible(diffBar, true); menuLeft.selectTab(menuLeft.getWidgetIndex(diffBar)); } else { if (patchScreen != null) { menuLeft.selectTab(isSignedIn() ? 1 : 0); } menuLeft.setVisible(diffBar, false); patchScreen = null; } }

Target:
public static void display(final String token, final Screen view) { if (view.isRequiresSignIn() && !isSignedIn()) { doSignIn(token); } else { view.setToken(token); body.setView(view); } }