auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void postCollectionAdminGroupCreateAdminGroupUnProcessableName() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setName("Fail"); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/adminGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); }

Target:
public void postCollectionAdminGroupCreateAdminGroupUnProcessableName() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); groupRest.setName("Fail"); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/adminGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isNoContent()); }
Source:
public BranchViewData getViewForBranch(BranchId branch) { List<ArtifactReadable> branchViewArts = queryFactory.fromBranch(branch).andIsOfType(CoreArtifactTypes.BranchView).getResults().getList(); List<ArtifactId> branchViewIds = new ArrayList<>(); for (ArtifactReadable art : branchViewArts) { branchViewIds.add(art); } return new BranchViewData(branch, branchViewIds); }

Target:
public List<ArtifactToken> getViewForBranch(BranchId branch) { return queryFactory.fromBranch(branch).andIsOfType(CoreArtifactTypes.BranchView).loadArtifactTokens(); }
Source:
public boolean processAuxiliaryFile(InputStream fileInputStream, DataFile dataFile, String formatTag, String formatVersion, String origin, boolean isPublic) { StorageIO<DataFile> storageIO =null; String auxExtension = formatTag + "_" + formatVersion; try { storageIO = dataFile.getStorageIO(); AuxiliaryFile auxFile = new AuxiliaryFile(); storageIO.saveInputStreamAsAux(fileInputStream, auxExtension); auxFile.setChecksum(FileUtil.calculateChecksum(storageIO.getAuxFileAsInputStream(auxExtension), systemConfig.getFileFixityChecksumAlgorithm())); Tika tika = new Tika(); auxFile.setContentType(tika.detect(storageIO.getAuxFileAsInputStream(auxExtension))); auxFile.setFormatTag(formatTag); auxFile.setFormatVersion(formatVersion); auxFile.setOrigin(origin); auxFile.setIsPublic(isPublic); auxFile.setDataFile(dataFile); auxFile.setFileSize(storageIO.getAuxObjectSize(auxExtension)); save(auxFile); } catch (IOException ioex) { logger.info("IO Exception trying to save auxiliary file: " + ioex.getMessage()); return false; } catch (Exception e) { try { storageIO.deleteAuxObject(auxExtension); } catch(IOException ioex) { logger.info("IO Exception trying remove auxiliary file in exception handler: " + ioex.getMessage()); return false; } } return true; }

Target:
public AuxiliaryFile processAuxiliaryFile(InputStream fileInputStream, DataFile dataFile, String formatTag, String formatVersion, String origin, boolean isPublic) { StorageIO<DataFile> storageIO =null; AuxiliaryFile auxFile = new AuxiliaryFile(); String auxExtension = formatTag + "_" + formatVersion; try { storageIO = dataFile.getStorageIO(); MessageDigest md = MessageDigest.getInstance(systemConfig.getFileFixityChecksumAlgorithm().toString()); DigestInputStream di = new DigestInputStream(fileInputStream, md); storageIO.saveInputStreamAsAux(fileInputStream, auxExtension); auxFile.setChecksum(FileUtil.checksumDigestToString(di.getMessageDigest().digest()) ); Tika tika = new Tika(); auxFile.setContentType(tika.detect(storageIO.getAuxFileAsInputStream(auxExtension))); auxFile.setFormatTag(formatTag); auxFile.setFormatVersion(formatVersion); auxFile.setOrigin(origin); auxFile.setIsPublic(isPublic); auxFile.setDataFile(dataFile); auxFile.setFileSize(storageIO.getAuxObjectSize(auxExtension)); auxFile = save(auxFile); } catch (IOException ioex) { logger.info("IO Exception trying to save auxiliary file: " + ioex.getMessage()); return null; } catch (Exception e) { try { storageIO.deleteAuxObject(auxExtension); } catch(IOException ioex) { logger.info("IO Exception trying remove auxiliary file in exception handler: " + ioex.getMessage()); return null; } } return auxFile; }
Source:
public FirecannonBlast(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}{R}"); this.getSpellAbility().addEffect(new ConditionalOneShotEffect( new DamageTargetEffect(6), new DamageTargetEffect(3), new InvertCondition(RaidCondition.instance), "{this} deals 3 damage to target creature.<br><i>Raid</i> &mdash; {this} deals 6 damage instead if you attacked with a creature this turn")); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addWatcher(new PlayerAttackedWatcher()); }

Target:
public FirecannonBlast(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}{R}"); this.getSpellAbility().addEffect(new ConditionalOneShotEffect( new DamageTargetEffect(6), new DamageTargetEffect(3), RaidCondition.instance, "{this} deals 3 damage to target creature.<br><i>Raid</i> &mdash; {this} deals 6 damage instead if you attacked with a creature this turn")); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addWatcher(new PlayerAttackedWatcher()); }
Source:
private static void addNotEmptyLines(Set<Integer> set, String text, XmlTextRange fullTextRange) { String[] lines = text.split("(\r)?\n|\r", -1); int lineNumber = fullTextRange.getStartLine(); for (String line : lines) { if (!line.trim().isEmpty()) { set.add(lineNumber); } lineNumber++; } }

Target:
private static void addNotEmptyLines(Set<Integer> set, String text, XmlTextRange fullTextRange) { int lineNumber = fullTextRange.getStartLine(); for (String line : splitLines(text)) { if (!line.trim().isEmpty()) { set.add(lineNumber); } lineNumber++; } }
Source:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateMessageEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertMessageEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, ""); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateMessageEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertMessageEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, EMPTY_VALUE); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
public boolean provides(final String expression) { if (!StringUtil.isEmpty(expression)) { for (final IInterpreterProvider provider : getProviders()) { if (provider.provides(expression)) { return true; } } } return false; }

Target:
public boolean provides(final String expression) { return getProviderForExpression(expression) != null; }
Source:
private ConcurrentMap<String, IPageTypeCategoryRole> getTypeNameToCategoryMap() { if (typeNameToCategoryMap.isEmpty()) { synchronized (typeNameToCategoryMap) { if (typeNameToCategoryMap.isEmpty()) { for (IPageTypeCategoryRole typeCategory : pageTypeCategoryList) { IPageTypeCategoryRole beforeRegCat = typeNameToCategoryMap.putIfAbsent( typeCategory.getTypeName(), typeCategory); if (beforeRegCat != null) { LOGGER.warn("Page type category collision on category name '{}' the colliding" + " category '{}' is shadowed by ''.", typeCategory.getTypeName(), typeCategory.getClass(), beforeRegCat.getClass()); } } } } } return typeNameToCategoryMap; }

Target:
private Map<String, IPageTypeCategoryRole> getTypeNameToCategoryMap() { if (typeNameToCatCache.isEmpty()) { synchronized (typeNameToCatCache) { if (typeNameToCatCache.isEmpty()) { for (IPageTypeCategoryRole typeCategory : pageTypeCategoryList) { IPageTypeCategoryRole beforeRegCat = typeNameToCatCache.putIfAbsent( typeCategory.getTypeName(), typeCategory); if (beforeRegCat != null) { LOGGER.warn("Page type category collision on category name '{}' the colliding" + " category '{}' is shadowed by '{}'.", typeCategory.getTypeName(), typeCategory.getClass(), beforeRegCat.getClass()); } } } } } return Collections.unmodifiableMap(typeNameToCatCache); }
Source:
public void testLightblueDiagnosticsElementPresent() throws Exception { DiagnosticsElement expectedElementDiagnostics = new DiagnosticsElement("MongoCRUDController", true, "[Mongo Config [lightbluemongo1.dev.a1.vary.redhat.com:27017, " + "DatabaseName: metadata]=>ping:OK, Mongo Config [lightbluemongo1.dev.a1.vary.redhat.com:27017, DatabaseName: data]=>ping:OK]"); when(httpTransport.executeRequest(any(LightblueRequest.class), anyString())).thenReturn(new FakeResponse(diagnosticsResponse, null)); LightblueClientConfiguration c = new LightblueClientConfiguration(); try (LightblueHttpClient httpClient = new LightblueHttpClient(c, httpTransport)) { LightblueDiagnosticsResponse response = httpClient.diagnostics(); DiagnosticsElement elementDiagnostics = response.getDiagnostics("MongoCRUDController"); System.out.println(elementDiagnostics); Assert.assertEquals(expectedElementDiagnostics, elementDiagnostics); Assert.assertTrue(elementDiagnostics.isHealthy()); Assert.assertEquals("MongoCRUDController", elementDiagnostics.getElementName()); } }

Target:
public void testLightblueDiagnosticsElementPresent() throws Exception { DiagnosticsElement expectedElementDiagnostics = new DiagnosticsElement("MongoCRUDController", true, "[Mongo Config [MongoURL, " + "DatabaseName: metadata]=>ping:OK, Mongo Config [MongoURL, DatabaseName: data]=>ping:OK]"); when(httpTransport.executeRequest(any(LightblueDiagnosticsRequest.class), anyString())).thenReturn(new FakeResponse(diagnosticsResponse, null)); LightblueClientConfiguration c = new LightblueClientConfiguration(); try (LightblueHttpClient httpClient = new LightblueHttpClient(c, httpTransport)) { LightblueDiagnosticsResponse response = httpClient.diagnostics(); DiagnosticsElement elementDiagnostics = response.getDiagnostics("MongoCRUDController"); Assert.assertEquals(expectedElementDiagnostics, elementDiagnostics); Assert.assertTrue(elementDiagnostics.isHealthy()); Assert.assertEquals("MongoCRUDController", elementDiagnostics.getElementName()); } }
Source:
public static void main(String args[]) { CLIInterface.call(args); final SystemProperties config = SystemProperties.getDefault(); getEthashBlockNumber().ifPresent(blockNumber -> { disableSync(config); new Ethash(config, blockNumber).getFullDataset(); System.exit(0); }); Ethereum ethereum = EthereumFactory.createEthereum(); getBlocksDumpPath(config).ifPresent(path -> { disableSync(config); boolean loaded = false; try { Stream<Path> paths = Files.isDirectory(path) ? Files.list(path).sorted() : Stream.of(path); loaded = ethereum.getBlockLoader().loadBlocks(paths.toArray(Path[]::new)); } catch (IOException e) { e.printStackTrace(); } System.exit(loaded ? 0 : 1); }); }

Target:
public static void main(String args[]) { CLIInterface.call(args); final SystemProperties config = SystemProperties.getDefault(); getEthashBlockNumber().ifPresent(blockNumber -> createDagFileAndExit(config, blockNumber)); getBlocksDumpPath(config).ifPresent(dumpPath -> loadDumpAndExit(config, dumpPath)); createEthereum(); }
Source:
public void postProcessModule(Module module) { String outputType = null; String inputType = null; if (module.getType() == ModuleType.source || module.getType() == ModuleType.processor) { outputType = module.getProperties().getProperty(OUTPUT_TYPE); } if (module.getType() == ModuleType.sink || module.getType() == ModuleType.processor) { inputType = module.getProperties().getProperty(INPUT_TYPE); } if (outputType != null) { configureModuleConverters(outputType, module, false); } if (inputType != null) { configureModuleConverters(inputType, module, true); } }

Target:
public void postProcessModule(Module module) { if (module.getType() == ModuleType.source || module.getType() == ModuleType.processor) { moduleTypeConversionSupport.configureModuleOutputChannelMessageConverters(module); } if (module.getType() == ModuleType.sink || module.getType() == ModuleType.processor) { moduleTypeConversionSupport.configureModuleInputChannelMessageConverters(module); } }
Source:
public void testReconnectStraightEdgeTarget() { diagram = localSession.getLocalSessionBrowser().perCategory().selectViewpoint(VIEWPOINT_NAME).selectRepresentation(REPRESENTATION_STRAIGHT_EDGE_NAME) .selectRepresentationInstance(REPRESENTATION_INSTANCE_STRAIGHT_EDGE_NAME, UIDiagramRepresentation.class).open(); editor = diagram.getEditor(); Point location = editor.getLocation("eClass2", AbstractDiagramBorderNodeEditPart.class); Dimension dimension = editor.getDimension("eClass2", AbstractDiagramBorderNodeEditPart.class); PointList pointList = edgePointList("eClass3", "eClass1"); Point target = pointList.getPoint(pointList.size() - 1); editor.select(editor.getEditPart("ref", ConnectionEditPart.class)); editor.drag(target, location.x + dimension.width / 2, location.y + dimension.height / 2); checkConnectionPoints("eClass3", "eClass2", pointList, false); }

Target:
public void testReconnectStraightEdgeTarget() { reconnectAndValidate(REPRESENTATION_STRAIGHT_EDGE_NAME, false); }
Source:
public void binderDied() { if (DBG) { Slog.d(TAG, "Binder is dead - unregister " + mPackageName); } for (Map.Entry<IBinder, ClientDeathRecipient> entry : mBleApps.entrySet()) { IBinder token = entry.getKey(); ClientDeathRecipient deathRec = entry.getValue(); if (deathRec.equals(this)) { if (DBG) { Slog.d(TAG, "Removing BLE application " + mPackageName); } mBleApps.remove(token); break; } } if (isBleAppPresent()) { return; } if (DBG) { Slog.d(TAG, "Disabling LE only mode after application crash"); } try { mBluetoothLock.readLock().lock(); if (mBluetooth != null && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { mEnable = false; mBluetooth.onBrEdrDown(); } } catch (RemoteException e) { Slog.e(TAG, "Unable to call onBrEdrDown", e); } finally { mBluetoothLock.readLock().unlock(); } }

Target:
public void binderDied() { if (DBG) { Slog.d(TAG, "Binder is dead - unregister " + mPackageName); } for (Map.Entry<IBinder, ClientDeathRecipient> entry : mBleApps.entrySet()) { IBinder token = entry.getKey(); ClientDeathRecipient deathRec = entry.getValue(); if (deathRec.equals(this)) { mBleApps.remove(token); break; } } if (isBleAppPresent()) { return; } if (DBG) { Slog.d(TAG, "Disabling LE only mode after application crash"); } try { mBluetoothLock.readLock().lock(); if (mBluetooth != null && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { mEnable = false; mBluetooth.onBrEdrDown(); } } catch (RemoteException e) { Slog.e(TAG, "Unable to call onBrEdrDown", e); } finally { mBluetoothLock.readLock().unlock(); } }
Source:
private void checkForInlinedCode(final Collection<MutationDetails> combined, final Entry<LineMutatorPair, Collection<MutationDetails>> each) { final List<MutationDetails> mutationsInHandlerBlock = FCollection .filter(each.getValue(), isInFinallyHandler()); if (!isPossibleToCorrectInlining(mutationsInHandlerBlock)) { combined.addAll(each.getValue()); return; } final MutationDetails baseMutation = mutationsInHandlerBlock.get(0); final int firstBlock = baseMutation.getBlock(); final List<Integer> ids = map(each.getValue(), mutationToBlock()); if (ids.stream().filter(Predicate.<Integer>isEqual(firstBlock).negate()).findFirst().isPresent()) { combined.add(makeCombinedMutant(each.getValue())); } else { combined.addAll(each.getValue()); } }

Target:
private void checkForInlinedCode(final Collection<MutationDetails> combined, final Entry<LineMutatorPair, Collection<MutationDetails>> each) { final List<MutationDetails> mutationsInHandlerBlock = FCollection .filter(each.getValue(), isInFinallyHandler()); if (!isPossibleToCorrectInlining(mutationsInHandlerBlock)) { combined.addAll(each.getValue()); return; } final MutationDetails baseMutation = mutationsInHandlerBlock.get(0); final int firstBlock = baseMutation.getBlock(); final List<Integer> ids = map(each.getValue(), mutationToBlock()); if (ids.stream().anyMatch(x -> x.intValue() != firstBlock)) { combined.add(makeCombinedMutant(each.getValue())); } else { combined.addAll(each.getValue()); } }
Source:
private synchronized void clearPackageAccessProperty() { if (hasSecurityManager() && secPrc.sandboxEnabled()) { synchronized (SANDBOXED_NODES_COUNTER) { if (SANDBOXED_NODES_COUNTER.decrementAndGet() == 0) SecurityUtils.removeIgnitePackageFromPackageAccessProperty(); } } }

Target:
private void clearPackageAccessProperty() { if (hasSecurityManager() && secPrc.sandboxEnabled()) { synchronized (SANDBOXED_NODES_COUNTER) { if (SANDBOXED_NODES_COUNTER.decrementAndGet() == 0) { String packAccess = Security.getProperty("package.access"); if (packAccess.equals(IGNITE_INTERNAL_PACKAGE)) Security.setProperty("package.access", null); else if (packAccess.contains(',' + IGNITE_INTERNAL_PACKAGE)) Security.setProperty("package.access", packAccess.replace(',' + IGNITE_INTERNAL_PACKAGE, "")); } } } }
Source:
public void initialise() { metricsModes = Sets.newLinkedHashSet(); modeIterator = Iterators.cycle(metricsModes); currentMode = register(new NullMetricsMode()); register(new RunningMeansMode()); register(new SpikesMode()); register(new AllocationsMode()); register(new RunningThreadsMode()); register(new WorldRendererMode()); register(new RenderingExecTimeMeansMode("Rendering - Execution Time: Running Means - Sorted Alphabetically")); }

Target:
public void initialise() { modes = new ArrayList<>(); register(defaultMode); register(new RunningMeansMode()); register(new SpikesMode()); register(new AllocationsMode()); register(new RunningThreadsMode()); register(new WorldRendererMode()); register(new RenderingExecTimeMeansMode("Rendering - Execution Time: Running Means - Sorted Alphabetically")); currentMode = defaultMode; }
Source:
Object coerce(Object target, Object value, String fieldName, Class<?> fieldClass) { if (fieldClass != null && Collection.class.isAssignableFrom(fieldClass) && value instanceof Collection) { return coerceCollection(target, (Collection) value, fieldName, fieldClass); } if (fieldClass != null && Map.class.isAssignableFrom(fieldClass) && value instanceof Map) { return coerceMap(target, (Map<?, ?>) value, fieldName, fieldClass); } return CoerceUtil.coerce(value, fieldClass); }

Target:
public Object coerce(Object target, Object value, String fieldName, Class<?> fieldClass) { if (fieldClass != null && Collection.class.isAssignableFrom(fieldClass) && value instanceof Collection) { return coerceCollection(target, (Collection) value, fieldName, fieldClass); } if (fieldClass != null && Map.class.isAssignableFrom(fieldClass) && value instanceof Map) { return coerceMap(target, (Map<?, ?>) value, fieldName); } return CoerceUtil.coerce(value, fieldClass); }
Source:
public void trigger(Collection<WorkingTreeModifiedEvent> events) { boolean haveChanges = false; for (WorkingTreeModifiedEvent event : events) { if (event.isEmpty()) { continue; } Repository repo = event.getRepository(); if (repo == null || repo.isBare()) { continue; } File gitDir = repo.getDirectory(); synchronized (repositoriesChanged) { WorkingTreeChanges changes = repositoriesChanged .get(gitDir); if (changes == null) { repositoriesChanged.put(gitDir, new WorkingTreeChanges(event)); } else { changes.merge(event); if (changes.isEmpty()) { repositoriesChanged.remove(gitDir); } } } haveChanges = true; } if (haveChanges && (!Activator.getDefault().getPreferenceStore() .getBoolean(UIPreferences.REFRESH_ONLY_WHEN_ACTIVE) || isActive())) { schedule(); } }

Target:
public void trigger(Collection<WorkingTreeModifiedEvent> events) { boolean haveChanges = false; for (WorkingTreeModifiedEvent event : events) { if (event.isEmpty()) { continue; } Repository repo = event.getRepository(); if (repo == null || repo.isBare()) { continue; } File gitDir = repo.getDirectory(); synchronized (repositoriesChanged) { WorkingTreeChanges changes = repositoriesChanged .get(gitDir); if (changes == null) { repositoriesChanged.put(gitDir, new WorkingTreeChanges(event)); } else { changes.merge(event); if (changes.isEmpty()) { repositoriesChanged.remove(gitDir); } } } haveChanges = true; } if (haveChanges) { schedule(); } }
Source:
private void createToolControlMenu(final MToolControl toolControl, Control renderedCtrl, boolean hideable) { toolControlMenu = new Menu(renderedCtrl); if (hideable) { MenuItem hideItem = new MenuItem(toolControlMenu, SWT.NONE); hideItem.setText(Messages.ToolBarManagerRenderer_MenuCloseText); hideItem.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { toolControl.getTags().add( IPresentationEngine.HIDDEN_EXPLICITLY); } }); new MenuItem(toolControlMenu, SWT.SEPARATOR); } MenuItem restoreHiddenItems = new MenuItem(toolControlMenu, SWT.NONE); restoreHiddenItems .setText(Messages.ToolBarManagerRenderer_MenuRestoreText); restoreHiddenItems.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { removeHiddenTags(toolControl); } }); this.application.getMenuContributions().stream() .filter(menuModel -> menuModel.getPositionInParent().startsWith("popup:toolbar")) .forEach(menuContribution -> { menuContribution.getChildren().forEach(itemModel -> { if (itemModel instanceof MItem) { final IEclipseContext lclContext = getContext(itemModel); HandledContributionItem itemRenderer = ContextInjectionFactory .make(HandledContributionItem.class, lclContext); itemRenderer.setModel((MItem) itemModel); itemRenderer.fill(toolControlMenu, 0); } }); }); renderedCtrl.setMenu(toolControlMenu); }

Target:
private void createToolControlMenu(final MToolControl toolControl, Control renderedCtrl, boolean hideable) { toolControlMenu = new Menu(renderedCtrl); if (hideable) { MenuItem hideItem = new MenuItem(toolControlMenu, SWT.NONE); hideItem.setText(Messages.ToolBarManagerRenderer_MenuCloseText); hideItem.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { toolControl.getTags().add( IPresentationEngine.HIDDEN_EXPLICITLY); } }); new MenuItem(toolControlMenu, SWT.SEPARATOR); } MenuItem restoreHiddenItems = new MenuItem(toolControlMenu, SWT.NONE); restoreHiddenItems .setText(Messages.ToolBarManagerRenderer_MenuRestoreText); restoreHiddenItems.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { removeHiddenTags(toolControl); } }); for (MMenuContribution menuModel : application.getMenuContributions()) { String positionInParent = menuModel.getPositionInParent(); if (positionInParent.startsWith("popup:toolbar")) { for (MMenuElement itemModel : menuModel.getChildren()) { if (itemModel instanceof MItem) { final IEclipseContext lclContext = getContext(itemModel); HandledContributionItem itemRenderer = ContextInjectionFactory .make(HandledContributionItem.class, lclContext); itemRenderer.setModel((MItem) itemModel); itemRenderer.fill(toolControlMenu, 0); } } } } renderedCtrl.setMenu(toolControlMenu); }
Source:
public ListenableFuture<DatanodeInfo[]> reload( final DatanodeReportType type, DatanodeInfo[] oldValue) throws Exception { ListenableFuture<DatanodeInfo[]> listenableFuture = executorService.submit(new Callable<DatanodeInfo[]>() { @Override public DatanodeInfo[] call() throws Exception { return load(type); } }); return listenableFuture; }

Target:
public ListenableFuture<DatanodeInfo[]> reload( final DatanodeReportType type, DatanodeInfo[] oldValue) throws Exception { return executorService.submit(new Callable<DatanodeInfo[]>() { @Override public DatanodeInfo[] call() throws Exception { return load(type); } }); }
Source:
Metrics2ReplicationMetrics(Master master, MetricsSystem system) { this.master = master; this.system = system; pathModTimes = new HashMap<>(); registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION)); replicationUtil = new ReplicationUtil(master); replicationQueueTimeQuantiles = registry.newQuantiles(REPLICATION_QUEUE_TIME_QUANTILES, "replication queue time quantiles in milliseconds", "ops", "latency", 600); replicationQueueTimeStat = registry.newStat(REPLICATION_QUEUE_TIME, "replication queue time stat in milliseconds", "ops", "latency", true); }

Target:
Metrics2ReplicationMetrics(Master master, MetricsSystem system) { this.master = master; this.system = system; pathModTimes = new HashMap<>(); registry = new MetricsRegistry(Interns.info(NAME, DESCRIPTION)); replicationUtil = new ReplicationUtil(master); replicationQueueTimeQuantiles = registry.newQuantiles(REPLICATION_QUEUE_TIME_QUANTILES, "Replication queue time quantiles in milliseconds", "ops", "latency", 600); replicationQueueTimeStat = registry.newStat(REPLICATION_QUEUE_TIME, "Replication queue time statistics in milliseconds", "ops", "latency", true); }
Source:
public void testRelatedAllEntriesRemoved() { List<BibEntry> entries = new ArrayList<>(); entries.add(entry1); entries.add(entry3); db.removeEntries(entries); assertEquals(Optional.empty(), entry2.getField(StandardField.RELATED)); }

Target:
public void testRelatedAllEntriesRemoved() { List<BibEntry> entries = Arrays.asList(entry1, entry3); db.removeEntries(entries); assertEquals(Optional.empty(), entry2.getField(StandardField.RELATED)); }
Source:
public TabletMutationPrepAttempt prepareMutationsForCommit(final TservConstraintEnv cenv, final List<Mutation> mutations) { cenv.setExtent(extent); final ConstraintChecker constraints = constraintChecker.derive(); final TabletMutationPrepAttempt attempt = new TabletMutationPrepAttempt(); mutations.forEach(mutation -> { Violations violations = constraints.check(cenv, mutation); if (violations != null) { attempt.addViolator(mutation, violations); } else { attempt.addNonViolator(mutation); } }); if (!attempt.hasViolations() || attempt.hasNonViolators()) { long time = tabletTime.setUpdateTimes(mutations); attempt.setCommitSession(finishPreparingMutations(time)); } return attempt; }

Target:
public PreparedMutations prepareMutationsForCommit(final TservConstraintEnv cenv, final List<Mutation> mutations) { cenv.setExtent(extent); final ConstraintChecker constraints = constraintChecker.derive(); Violations violations = null; Set<Mutation> violators = null; List<Mutation> nonViolators = null; for (Mutation mutation : mutations) { Violations mutationViolations = constraints.check(cenv, mutation); if (mutationViolations != null) { if (violations == null) { violations = new Violations(); violators = new HashSet<>(); } violations.add(mutationViolations); violators.add(mutation); } } if (violations == null) { nonViolators = mutations; violators = Collections.emptySet(); violations = Violations.EMPTY; } else if (violators.size() != mutations.size()) { nonViolators = new ArrayList<>((mutations.size() - violators.size())); for (Mutation mutation : mutations) { if (!violators.contains(mutation)) { nonViolators.add(mutation); } } } else { nonViolators = Collections.emptyList(); } CommitSession cs = null; if (!nonViolators.isEmpty()) { long time = tabletTime.setUpdateTimes(nonViolators); cs = finishPreparingMutations(time); if (cs == null) { return new PreparedMutations(); } } return new PreparedMutations(cs, nonViolators, violations, violators); }
Source:
public long lastSeen() { return clock.millis() - healtcheckRefreshTime; }

Target:
public long lastSeen() { return clock.millis() - healthcheckRefreshTime; }
Source:
public ProcessingDirective process(final DivolteEvent event) { if (!event.corruptEvent || keepCorrupted) { final boolean duplicate = memory.isProbableDuplicate(event.partyCookie.value, event.sessionCookie.value, event.eventId); event.exchange.putAttachment(DUPLICATE_EVENT_KEY, duplicate); if (!duplicate || keepDuplicates) { final GenericRecord avroRecord = mapper.newRecordFromExchange(event); try { final AvroRecordBuffer avroBuffer = AvroRecordBuffer.fromRecord( event.partyCookie, event.sessionCookie, event.requestStartTime, event.clientUtcOffset, avroRecord); listener.incomingRequest(event, avroBuffer, avroRecord); doProcess(avroBuffer); } catch (final RuntimeException e) { logger.warn(invalid, "Error processing event from party in session {}: {}", event, event.partyCookie, event.sessionCookie, avroRecord, e); } } } return CONTINUE; }

Target:
public ProcessingDirective process(final DivolteEvent event) { if (!event.corruptEvent || keepCorrupted) { final boolean duplicate = memory.isProbableDuplicate(event.partyCookie.value, event.sessionCookie.value, event.eventId); event.exchange.putAttachment(DUPLICATE_EVENT_KEY, duplicate); if (!duplicate || keepDuplicates) { final GenericRecord avroRecord = mapper.newRecordFromExchange(event); try { final AvroRecordBuffer avroBuffer = AvroRecordBuffer.fromRecord( event.partyCookie, event.sessionCookie, event.requestStartTime, event.clientUtcOffset, avroRecord); } catch (final RuntimeException e) { logger.warn(invalid, "Error processing event from party in session {}: {}", event, event.partyCookie, event.sessionCookie, avroRecord, e); } listener.incomingRequest(event, avroBuffer, avroRecord); doProcess(avroBuffer); } } return CONTINUE; }
Source:
Collection<MemberImpl> resolve(Map<MemberImpl, Set<MemberImpl>> disconnections) { Set<MemberImpl> members = new HashSet<>(); disconnections.forEach((k, v) -> { members.add(k); members.addAll(v); }); Graph<MemberImpl> connectivityGraph = buildConnectionGraph(members, disconnections); BronKerboschCliqueFinder<MemberImpl> cliqueFinder = createCliqueFinder(connectivityGraph); Collection<Set<MemberImpl>> maxCliques = cliqueFinder.computeMaxCliques(); if (cliqueFinder.isTimeLimitReached()) { throw new IllegalStateException("Partial disconnection resolution algorithm timed out! disconnectivity map: " + disconnections); } else if (maxCliques.isEmpty()) { throw new IllegalStateException("Partial disconnection resolution algorithm returned no result! " + "disconnectivity map: " + disconnections); } Collection<MemberImpl> membersToRemove = new HashSet<>(members); membersToRemove.removeAll(maxCliques.iterator().next()); return membersToRemove; }

Target:
Collection<MemberImpl> resolve(Map<MemberImpl, Set<MemberImpl>> disconnections) throws TimeoutException { Set<MemberImpl> members = new HashSet<>(); disconnections.forEach((k, v) -> { members.add(k); members.addAll(v); }); Graph<MemberImpl> connectivityGraph = buildConnectionGraph(members, disconnections); BronKerboschCliqueFinder<MemberImpl> cliqueFinder = createCliqueFinder(connectivityGraph); Collection<Set<MemberImpl>> maxCliques = cliqueFinder.computeMaxCliques(); if (cliqueFinder.isTimeLimitReached()) { throw new TimeoutException("Partial disconnection resolution algorithm timed out! disconnectivity map: " + disconnections); } else if (maxCliques.isEmpty()) { throw new IllegalStateException("Partial disconnection resolution algorithm returned no result! " + "disconnectivity map: " + disconnections); } Collection<MemberImpl> membersToRemove = new HashSet<>(members); membersToRemove.removeAll(maxCliques.iterator().next()); return membersToRemove; }
Source:
private List<String> sliceSegsForGpt(String segments) { String specialSegment = "ph3uhzc41"; String[] segs = segments.split(","); if (segs.length > MAX_SEGS_NUMBER_GPT) { if (segments.contains(specialSegment) && !Arrays.asList(segs).subList(0, MAX_SEGS_NUMBER_GPT).contains(specialSegment)) { List<String> slicedSegs = new LinkedList<>(Arrays.asList(Arrays.copyOfRange( segs, 0, MAX_SEGS_NUMBER_GPT - 1))); slicedSegs.add(0, specialSegment); return slicedSegs; } else { return Arrays.asList(Arrays.copyOfRange(segs, 0, MAX_SEGS_NUMBER_GPT)); } } return Arrays.asList(segs); }

Target:
private List<String> sliceSegsForGpt(String segments) { String specialSegment = "ph3uhzc41"; String[] segs = segments.split(","); if (segs.length > MAX_SEGS_NUMBER_GPT) { List<String> slicedSegs = Arrays.asList(segs).subList(0, MAX_SEGS_NUMBER_GPT); if (segments.contains(specialSegment) && !slicedSegs.contains(specialSegment)) { slicedSegs = new LinkedList<>(Arrays.asList(segs).subList(0, MAX_SEGS_NUMBER_GPT - 1)); slicedSegs.add(0, specialSegment); } return slicedSegs; } return Arrays.asList(segs); }
Source:
public ListenableFuture<Iterable<LabelMeta>> findLabels(final String query) { NGramGenerator ngrams = new NGramGenerator(query); List<ResultSetFuture> resultSets = fetchLabelIds(ngrams); return transform( successfulAsList(resultSets), new AsyncFunction<List<ResultSet>, Iterable<LabelMeta>>() { @Override public ListenableFuture<Iterable<LabelMeta>> apply(final List<ResultSet> resultSets) { return transform(fetchLabelMetas(resultSets), new Function<Iterable<LabelMeta>, Iterable<LabelMeta>>() { @Override public Iterable<LabelMeta> apply(final Iterable<LabelMeta> input) { return input; } }); } }); }

Target:
public ListenableFuture<Iterable<LabelMeta>> findLabels(final String query) { final NGramGenerator ngrams = new NGramGenerator(query); final List<ResultSetFuture> resultSets = fetchLabelIds(ngrams); return transform( successfulAsList(resultSets), new AsyncFunction<List<ResultSet>, Iterable<LabelMeta>>() { @Override public ListenableFuture<Iterable<LabelMeta>> apply(final List<ResultSet> resultSets) { return transform(fetchLabelMetas(resultSets), new Function<Iterable<LabelMeta>, Iterable<LabelMeta>>() { @Override public Iterable<LabelMeta> apply(final Iterable<LabelMeta> input) { return input; } }); } }); }
Source:
protected HeaderCacheElement refreshCredentialsWithRetry(@Nullable BackOff backoff) { try { LOG.info("Refreshing the OAuth token"); AccessToken newToken = credentials.refreshAccessToken(); if (newToken == null) { LOG.info("Refreshed the OAuth token"); return new HeaderCacheElement(new IOException("Could not load the token for credentials: " + credentials)); } else { return new HeaderCacheElement(newToken); } } catch (IOException exception) { if (backoff == null) { backoff = retryOptions.createBackoff(); } try { RetryState retryState = getRetryState(backoff); if (retryState == RetryState.PerformRetry) { LOG.warn("Unexpected IOExcetpion during Credential refreshing. Retrying", exception); return refreshCredentialsWithRetry(backoff); } else { return new HeaderCacheElement(exception); } } catch (IOException e) { LOG.warn("Got an exception while trying to run backoff.nextBackOffMillis()", e); return new HeaderCacheElement(exception); } } catch (Exception e) { LOG.warn("Got an unexpected generic exception while trying to refresh credentials.", e); return new HeaderCacheElement(new IOException("Could not read headers", e)); } }

Target:
protected HeaderCacheElement refreshCredentialsWithRetry(@Nullable BackOff backoff) { try { LOG.info("Refreshing the OAuth token"); AccessToken newToken = credentials.refreshAccessToken(); if (newToken == null) { LOG.info("Refreshed the OAuth token"); return new HeaderCacheElement(new IOException("Could not load the token for credentials: " + credentials)); } else { return new HeaderCacheElement(newToken); } } catch (IOException exception) { LOG.warn("Got an unexpected IOException when refreshing google credentials.", exception); if (backoff == null) { backoff = retryOptions.createBackoff(); } try { RetryState retryState = getRetryState(backoff); if (retryState == RetryState.PerformRetry) { return refreshCredentialsWithRetry(backoff); } else { return new HeaderCacheElement(exception); } } catch (IOException e) { LOG.warn("Got an exception while trying to run backoff.nextBackOffMillis()", e); return new HeaderCacheElement(exception); } } catch (Exception e) { LOG.warn("Got an unexpected exception while trying to refresh google credentials.", e); return new HeaderCacheElement(new IOException("Could not read headers", e)); } }
Source:
public Pagination<Payment> searchPayments(final String searchKey, final Long offset, final Long limit, final boolean withPluginInfo, final boolean withAttempts, final Iterable<PluginProperty> properties, final TenantContext context) { return paymentProcessor.searchPayments(searchKey, offset, limit, withPluginInfo, properties, context, internalCallContextFactory.createInternalTenantContext(context)); }

Target:
public Pagination<Payment> searchPayments(final String searchKey, final Long offset, final Long limit, final boolean withPluginInfo, final boolean withAttempts, final Iterable<PluginProperty> properties, final TenantContext context) { return paymentProcessor.searchPayments(searchKey, offset, limit, withPluginInfo, withAttempts, properties, context, internalCallContextFactory.createInternalTenantContext(context)); }
Source:
public ResponseEntity<?> createWorkflowInstance( @RequestBody @ApiParam(value = "Submitted workflow instance information", required = true) CreateWorkflowInstanceRequest req) { WorkflowInstance instance = createWorkflowConverter.convert(req); try { long id = workflowInstances.insertWorkflowInstance(instance); instance = workflowInstances.getWorkflowInstance(id, EnumSet.of(WorkflowInstanceInclude.CURRENT_STATE_VARIABLES), null); return created(URI.create(String.valueOf(id))).body(createWorkflowConverter.convert(instance)); } catch (IllegalArgumentException e) { return status(BAD_REQUEST).body(e.getMessage()); } }

Target:
public ResponseEntity<?> createWorkflowInstance( @RequestBody @ApiParam(value = "Submitted workflow instance information", required = true) CreateWorkflowInstanceRequest req) { WorkflowInstance instance = createWorkflowConverter.convert(req); try { long id = workflowInstances.insertWorkflowInstance(instance); instance = workflowInstances.getWorkflowInstance(id, EnumSet.of(WorkflowInstanceInclude.CURRENT_STATE_VARIABLES), null); return created(URI.create(String.valueOf(id))).body(createWorkflowConverter.convert(instance)); } catch (IllegalArgumentException e) { return status(BAD_REQUEST).body(new ErrorResponse((e.getMessage()))); } }
Source:
public TokenEntry(String image, String tokenSrcID, int beginLine) { setImage(image); this.tokenSrcID = tokenSrcID; this.beginLine = beginLine; this.beginColumn = -1; this.endColumn = -1; this.index = TOKEN_COUNT.get().getAndIncrement(); }

Target:
public TokenEntry(String image, String tokenSrcID, int beginLine) { this(image, tokenSrcID, beginLine, -1, -1); }
Source:
private void assertGetStudiesAll(String url) { ResponseEntity<QueryResponse<QueryResult<VariantStudy>>> response = restTemplate.exchange( url, HttpMethod.GET, null, new ParameterizedTypeReference<QueryResponse<QueryResult<VariantStudy>>>() {}); assertEquals(HttpStatus.OK, response.getStatusCode()); QueryResponse<QueryResult<VariantStudy>> queryResponse = response.getBody(); assertEquals(1, queryResponse.getResponse().size()); List<VariantStudy> results = queryResponse.getResponse().get(0).getResult(); assertTrue(results.size() >= 1); assertVariantStudiesAreNotEmpty(results); }

Target:
private void assertGetStudiesAll(String url) { ResponseEntity<QueryResponse<QueryResult<VariantStudy>>> response = restTemplate.exchange( url, HttpMethod.GET, null, new ParameterizedTypeReference<QueryResponse<QueryResult<VariantStudy>>>() {}); assertEquals(HttpStatus.OK, response.getStatusCode()); QueryResponse<QueryResult<VariantStudy>> queryResponse = response.getBody(); assertEquals(1, queryResponse.getResponse().size()); List<VariantStudy> results = queryResponse.getResponse().get(0).getResult(); assertEquals(3, results.size()); assertVariantStudiesAreNotEmpty(results); }
Source:
public void streamAllEvents() throws IOException, InterruptedException { List<ServerSentEvent<String>> events = getServerSentEvents(ACTUATOR_STREAM_CIRCUITBREAKER_EVENTS); CircuitBreakerEventsEndpointResponse circuitBreakerEventsBefore = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS); try { dummyService.doSomething(true); } catch (IOException ex) { } Thread.sleep(1000); dummyService.doSomething(false); CircuitBreakerEventsEndpointResponse circuitBreakerEventsAfter = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS); assert (circuitBreakerEventsBefore.getCircuitBreakerEvents().size() < circuitBreakerEventsAfter.getCircuitBreakerEvents().size()); Thread.sleep(1000); assert (events.size() == 2); }

Target:
public void streamAllEvents() throws IOException, InterruptedException { List<ServerSentEvent<String>> events = getServerSentEvents(ACTUATOR_STREAM_CIRCUITBREAKER_EVENTS); CircuitBreakerEventsEndpointResponse circuitBreakerEventsBefore = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS); publishEvents(); CircuitBreakerEventsEndpointResponse circuitBreakerEventsAfter = circuitBreakerEvents(ACTUATOR_CIRCUITBREAKEREVENTS); assertThat (circuitBreakerEventsBefore.getCircuitBreakerEvents().size()).isLessThan(circuitBreakerEventsAfter.getCircuitBreakerEvents().size()); Thread.sleep(1000); assertThat (events.size()).isEqualTo(2); }
Source:
protected void onInitialize() { super.onInitialize(); add(new WebMarkupContainer("pin").add( new AttributeAppender("style", "background-color: rgba(" + color.getRed() + ", " + color.getGreen() + ", " + color.getBlue() + ", " + color.getAlpha() + ");"))); }

Target:
protected void onInitialize() { super.onInitialize(); add(new WebMarkupContainer("pin") .add(new AttributeAppender("style", getBackgroundColorModel()))); }
Source:
protected boolean executeAnalysis(final IProgressMonitor monitor) throws TmfAnalysisException { Object workerObj = getParameter(PARAM_WORKER); if (workerObj == null) { return false; } if (!(workerObj instanceof IGraphWorker)) { throw new IllegalStateException("Worker parameter must be an IGraphWorker"); } IGraphWorker worker = (IGraphWorker) workerObj; TmfGraphBuilderModule graphModule = fGraphModule; graphModule.schedule(); SubMonitor subMonitor = SubMonitor.convert(monitor, 3); subMonitor.setTaskName(NLS.bind(Messages.CriticalPathModule_waitingForGraph, graphModule.getName())); if (!graphModule.waitForCompletion(subMonitor)) { Activator.getInstance().logInfo("Critical path execution: graph building was cancelled. Results may not be accurate."); return false; } subMonitor.worked(1); TmfGraph graph = graphModule.getGraph(); if (graph == null) { throw new TmfAnalysisException("Critical Path analysis: graph " + graphModule.getName() + " is null"); } TmfVertex head = graph.getHead(worker); if (head == null) { fCriticalPath = new TmfGraph(); return true; } subMonitor.worked(1); ICriticalPathAlgorithm cp = getAlgorithm(graph); try { fCriticalPath = cp.compute(head, null); return true; } catch (CriticalPathAlgorithmException e) { Activator.getInstance().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e); } subMonitor.done(); return false; }

Target:
protected boolean executeAnalysis(final IProgressMonitor monitor) throws TmfAnalysisException { Object workerObj = getParameter(PARAM_WORKER); if (workerObj == null) { return false; } if (!(workerObj instanceof IGraphWorker)) { throw new IllegalStateException("Worker parameter must be an IGraphWorker"); } IGraphWorker worker = (IGraphWorker) workerObj; TmfGraphBuilderModule graphModule = fGraphModule; graphModule.schedule(); SubMonitor subMonitor = SubMonitor.convert(monitor, 10); subMonitor.setTaskName(NLS.bind(Messages.CriticalPathModule_waitingForGraph, graphModule.getName())); if (!graphModule.waitForCompletion(subMonitor)) { Activator.getInstance().logInfo("Critical path execution: graph building was cancelled. Results may not be accurate."); return false; } subMonitor.worked(8); TmfGraph graph = graphModule.getGraph(); if (graph == null) { throw new TmfAnalysisException("Critical Path analysis: graph " + graphModule.getName() + " is null"); } TmfVertex head = graph.getHead(worker); if (head == null) { fCriticalPath = new TmfGraph(); return true; } subMonitor.worked(1); ICriticalPathAlgorithm cp = getAlgorithm(graph); try { fCriticalPath = cp.compute(head, null); return true; } catch (CriticalPathAlgorithmException e) { Activator.getInstance().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e); } subMonitor.done(); return false; }
Source:
private void refreshGeoRepSessionStatus(final VDSGroup cluster, List<GlusterGeoRepSession> geoRepSessions) { List<Callable<GlusterGeoRepSession>> geoRepSessionCalls = new ArrayList<>(); for (final GlusterGeoRepSession geoRepSession: geoRepSessions) { geoRepSessionCalls.add(new Callable<GlusterGeoRepSession>() { @Override public GlusterGeoRepSession call() throws Exception { geoRepSession.setSessionDetails((ArrayList) getSessionDetailFromCLI(cluster, geoRepSession)); return geoRepSession; } }); } List<GlusterGeoRepSession> updatedSessions = ThreadPoolUtil.invokeAll(geoRepSessionCalls); if (updatedSessions == null) { return; } for (GlusterGeoRepSession updatedSession : updatedSessions) { if (updatedSession.getSessionDetails() == null) { log.info("Geo-replication session details not updated for session '{}' as there was error returning data from VDS", updatedSession.getSessionKey()); continue; } try (EngineLock lock = acquireGeoRepSessionLock(updatedSession.getId())) { GlusterVolumeEntity masterVolume = getVolumeDao().getById(updatedSession.getMasterVolumeId()); updateGeoRepStatus(masterVolume, updatedSession); getGeoRepDao().updateSession(updatedSession); updateSessionDetailsInDB(updatedSession); } } }

Target:
private void refreshGeoRepSessionStatus(final VDSGroup cluster, List<GlusterGeoRepSession> geoRepSessions) { if (geoRepSessions == null || geoRepSessions.isEmpty()) { return; } List<Callable<GlusterGeoRepSession>> geoRepSessionCalls = new ArrayList<>(); for (final GlusterGeoRepSession geoRepSession: geoRepSessions) { geoRepSessionCalls.add(new Callable<GlusterGeoRepSession>() { @Override public GlusterGeoRepSession call() throws Exception { geoRepSession.setSessionDetails((ArrayList) getSessionDetailFromCLI(cluster, geoRepSession)); return geoRepSession; } }); } List<GlusterGeoRepSession> updatedSessions = ThreadPoolUtil.invokeAll(geoRepSessionCalls); for (GlusterGeoRepSession updatedSession : updatedSessions) { if (updatedSession.getSessionDetails() == null) { log.info("Geo-replication session details not updated for session '{}' as there was error returning data from VDS", updatedSession.getSessionKey()); continue; } try (EngineLock lock = acquireGeoRepSessionLock(updatedSession.getId())) { GlusterVolumeEntity masterVolume = getVolumeDao().getById(updatedSession.getMasterVolumeId()); updateGeoRepStatus(masterVolume, updatedSession); getGeoRepDao().updateSession(updatedSession); updateSessionDetailsInDB(updatedSession); } } }
Source:
public void setHostAndPort(final HostAndPort hostAndPort) { jedisSocketFactory.setHost(hostAndPort.getHost()); jedisSocketFactory.setPort(hostAndPort.getPort()); }

Target:
public void setHostAndPort(final HostAndPort hostAndPort) { JedisSocketFactory newFactory = jedisSocketFactory.get().copy(); newFactory.setHost(hostAndPort.getHost()); newFactory.setPort(hostAndPort.getPort()); jedisSocketFactory.set(newFactory); }
Source:
PrimitiveConverter(Class <T> clazz, Function<String, T> toValue) { this.clazz = clazz; this.toValue = toValue; }

Target:
PrimitiveConverter(Class <T> clazz, Function<String, T> toValue) { this.clazz = Objects.requireNonNull(clazz); this.toValue = toValue; }