auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
CheckedFuture<PatchSet.Id, InsertException> insertPatchSet() throws IOException { rp.getRevWalk().parseBody(newCommit); final Thread caller = Thread.currentThread(); ListenableFuture<PatchSet.Id> future = changeUpdateExector.submit( requestScopePropagator.wrap(new Callable<PatchSet.Id>() { @Override public PatchSet.Id call() throws OrmException, IOException, NoSuchChangeException { try { if (caller == Thread.currentThread() || magicBranch.edit) { return magicBranch.edit ? upsertEdit() : insertPatchSet(db); } else { ReviewDb db = schemaFactory.open(); try { return insertPatchSet(db); } finally { db.close(); } } } finally { synchronized (replaceProgress) { replaceProgress.update(1); } } } })); return Futures.makeChecked(future, INSERT_EXCEPTION); }

Target:
CheckedFuture<PatchSet.Id, InsertException> insertPatchSet() throws IOException { rp.getRevWalk().parseBody(newCommit); final Thread caller = Thread.currentThread(); ListenableFuture<PatchSet.Id> future = changeUpdateExector.submit( requestScopePropagator.wrap(new Callable<PatchSet.Id>() { @Override public PatchSet.Id call() throws OrmException, IOException, NoSuchChangeException { try { if (caller == Thread.currentThread()) { return magicBranch.edit ? upsertEdit() : insertPatchSet(db); } else { ReviewDb db = schemaFactory.open(); try { return magicBranch.edit ? upsertEdit() : insertPatchSet(db); } finally { db.close(); } } } finally { synchronized (replaceProgress) { replaceProgress.update(1); } } } })); return Futures.makeChecked(future, INSERT_EXCEPTION); }
Source:
private GrpcChannelKey(AlluxioConfiguration conf) { try { mLocalHostName = NetworkAddressUtils .getLocalHostName((int) conf.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS)); } catch (Exception e) { mLocalHostName = "<UNKNOWN>"; } }

Target:
private GrpcChannelKey(AlluxioConfiguration conf) { String localHostName; try { localHostName = NetworkAddressUtils .getLocalHostName((int) conf.getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS)); } catch (Exception e) { localHostName = NetworkAddressUtils.UNKNOWN_HOSTNAME; } mLocalHostName = localHostName; }
Source:
public FluoConfiguration setOraclePort(int oraclePort) { setProperty(ORACLE_PORT_PROP, verifyPositive(ORACLE_PORT_PROP, oraclePort)); return this; }

Target:
public FluoConfiguration setOraclePort(int oraclePort) { return setPort(ORACLE_PORT_PROP, oraclePort); }
Source:
public Result adaptResponse(Row response) { if (response == null) { return new Result(); } List<org.apache.hadoop.hbase.Cell> hbaseCells = new ArrayList<>(); Set<Long> cellTimestamps = new HashSet<>(); byte[] rowKey = response.getKey().toByteArray(); for (Family family : response.getFamiliesList()) { byte[] familyNameBytes = Bytes.toBytes(family.getName()); for (Column column : family.getColumnsList()) { byte[] columnQualifier = column.getQualifier().toByteArray(); cellTimestamps.clear(); for (Cell cell : column.getCellsList()) { if (cell.getLabelsCount() > 0) { continue; } Long cellTimestamp = cell.getTimestampMicros(); if (!cellTimestamps.contains(cellTimestamp)) { cellTimestamps.add(cellTimestamp); long hbaseTimestamp = BigtableConstants.HBASE_TIMEUNIT.convert( cellTimestamp, BigtableConstants.BIGTABLE_TIMEUNIT); KeyValue keyValue = new KeyValue( rowKey, familyNameBytes, columnQualifier, hbaseTimestamp, cell.getValue().toByteArray()); hbaseCells.add(keyValue); } } } } Collections.sort(hbaseCells, KeyValue.COMPARATOR); return Result.create(hbaseCells); }

Target:
public Result adaptResponse(Row response) { if (response == null) { return new Result(); } SortedSet<org.apache.hadoop.hbase.Cell> hbaseCells = new TreeSet<>(KeyValue.COMPARATOR); byte[] rowKey = response.getKey().toByteArray(); for (Family family : response.getFamiliesList()) { byte[] familyNameBytes = Bytes.toBytes(family.getName()); for (Column column : family.getColumnsList()) { byte[] columnQualifier = column.getQualifier().toByteArray(); for (Cell cell : column.getCellsList()) { if (cell.getLabelsCount() > 0) { continue; } long hbaseTimestamp = BigtableConstants.HBASE_TIMEUNIT.convert( cell.getTimestampMicros(), BigtableConstants.BIGTABLE_TIMEUNIT); KeyValue keyValue = new KeyValue( rowKey, familyNameBytes, columnQualifier, hbaseTimestamp, cell.getValue().toByteArray()); hbaseCells.add(keyValue); } } } return Result.create(hbaseCells.toArray(new org.apache.hadoop.hbase.Cell[hbaseCells.size()])); }
Source:
public void validate(T values) { for (int i = 0; i < expressions.size(); i++) { expressions.get(i).setNextRow(values); } for (int i = 0; i < inputs.size(); i++) { Object val = inputs.get(i).value(); if (val == null) { throw new IllegalArgumentException("\"" + notNullColumns.get(i) + "\" must not be null"); } } for (int i = 0; i < checkConstraints.size(); i++) { Tuple<? extends Input<?>, CheckConstraint<Symbol>> checkEntry = checkConstraints.get(i); Input<?> checkInput = checkEntry.v1(); Boolean value = (Boolean) checkInput.value(); if (value == null) { continue; } if (!value.booleanValue()) { CheckConstraint<Symbol> chk = checkEntry.v2(); throw new IllegalArgumentException(String.format( Locale.ENGLISH, "Failed CONSTRAINT %s CHECK (%s) and values %s", chk.name(), chk.expressionStr(), values)); } } }

Target:
public void validate(T values) { for (int i = 0; i < expressions.size(); i++) { expressions.get(i).setNextRow(values); } for (int i = 0; i < inputs.size(); i++) { Object val = inputs.get(i).value(); if (val == null) { throw new IllegalArgumentException("\"" + notNullColumns.get(i) + "\" must not be null"); } } for (int i = 0; i < checkConstraints.size(); i++) { Tuple<? extends Input<?>, CheckConstraint<Symbol>> checkEntry = checkConstraints.get(i); Input<?> checkInput = checkEntry.v1(); Object value = checkInput.value(); if (value == null) { continue; } assert value instanceof Boolean : "expected a boolean value"; if (!((Boolean) value).booleanValue()) { CheckConstraint<Symbol> chk = checkEntry.v2(); throw new IllegalArgumentException(String.format( Locale.ENGLISH, "Failed CONSTRAINT %s CHECK (%s) and values %s", chk.name(), chk.expressionStr(), values)); } } }
Source:
public static String[] getFileExtensions( IDLTKLanguageToolkit languageToolkit) { if (languageToolkit == null) { return null; } final IContentType type = Platform.getContentTypeManager() .getContentType(languageToolkit.getLanguageContentType()); if (type != null) { return type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC); } else { return null; } }

Target:
public static String[] getFileExtensions( IDLTKLanguageToolkit languageToolkit) { final IContentType type = Platform.getContentTypeManager() .getContentType(languageToolkit.getLanguageContentType()); if (type != null) { return type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC); } else { return null; } }
Source:
public RefreshPlan computePlan(CreatedOutput container) { RefreshPlan post = new RefreshPlan(signatureProvider); Collection<? extends Mapping> childMappings = container.getChildMappings(); pre.computeStatus(container, childMappings); post.addPreviousStatus(pre.getExistingOutputs()); Iterable<? extends Mapping> mappingsCreatingElements = Iterables.filter(childMappings, new Predicate<Mapping>() { @Override public boolean apply(Mapping input) { return input.getCreator().some(); } }); Iterable<Collection<MappingHiearchy>> transformedHiearchy = Iterables.transform(mappingsCreatingElements, toHierarchy); Iterable<MappingHiearchy> childHiearchies = Sets.newLinkedHashSet(Iterables.concat(transformedHiearchy)); for (MappingHiearchy nodeHiearch : childHiearchies) { Iterator<Mapping> it = nodeHiearch.fromMostSpecificToMostGeneral(); while (it.hasNext()) { Mapping cur = it.next(); if (cur.isEnabled() && cur.getCreator().some()) { Option<EvaluatedSemanticPartition> par = invalidator.hasFastResult(container.getDescriptor().getSourceElement(), cur.getSemanticPartition()); if (!par.some()) { cur.getSemanticPartition().setTreeElementVariables(container); par = Options.newSome(cur.getSemanticPartition().evaluate(container.getDescriptor().getSourceElement())); cur.getSemanticPartition().unSetTreeElementVariables(); } Collection<? extends OutputDescriptor> allCandidateDescriptors = cur.getCreator().get().computeDescriptors(container, par.get().elements()); post.appendOutputDescritorsKeepingTheMostSpecific(allCandidateDescriptors); } } } return post; }

Target:
public RefreshPlan computePlan(CreatedOutput container) { RefreshPlan post = new RefreshPlan(signatureProvider); Collection<? extends Mapping> childMappings = container.getChildMappings(); pre.computeStatus(container, childMappings); post.addPreviousStatus(pre.getExistingOutputs()); Iterable<? extends Mapping> mappingsCreatingElements = Iterables.filter(childMappings, new Predicate<Mapping>() { @Override public boolean apply(Mapping input) { return input.getCreator().some(); } }); Iterable<Collection<MappingHiearchy>> transformedHiearchy = Iterables.transform(mappingsCreatingElements, toHierarchy); Iterable<MappingHiearchy> childHiearchies = Sets.newLinkedHashSet(Iterables.concat(transformedHiearchy)); for (MappingHiearchy nodeHiearch : childHiearchies) { Iterator<Mapping> it = nodeHiearch.fromMostSpecificToMostGeneral(); while (it.hasNext()) { Mapping cur = it.next(); if (cur.isEnabled() && cur.getCreator().some()) { Option<EvaluatedSemanticPartition> par = invalidator.hasFastResult(container.getDescriptor().getSourceElement(), cur.getSemanticPartition()); if (!par.some()) { par = Options.newSome(cur.getSemanticPartition().evaluate(container.getDescriptor().getSourceElement(), container)); } Collection<? extends OutputDescriptor> allCandidateDescriptors = cur.getCreator().get().computeDescriptors(container, par.get().elements()); post.appendOutputDescritorsKeepingTheMostSpecific(allCandidateDescriptors); } } } return post; }
Source:
public void testList() { List<MonitoringCenter> result = monitoringCenterApi().list(); assertNotNull(result); }

Target:
public void testList() { List<MonitoringCenter> result = monitoringCenterApi().list(); assertNotNull(result); Assert.assertTrue(result.size() >= 1); }
Source:
private boolean updateIndex(final String indexName, final List<String> fieldNames, final Changes changes, long lastSequence) { if (indexName == null || indexName.isEmpty()) { return false; } Future<Boolean> result = queue.submitTransaction(new SQLQueueCallable<Boolean>() { @Override public Boolean call(SQLDatabase database) { boolean transactionSuccess = true; database.beginTransaction(); for (DocumentRevision rev: changes.getResults()) { String tableName = IndexManager.tableNameForIndex(indexName); database.delete(tableName, " _id = ? ", new String[]{rev.getId()}); if (!rev.isDeleted()) { List<DBParameter> parameters = parametersToIndexRevision(rev, indexName, fieldNames); if (parameters == null) { continue; } for (DBParameter parameter: parameters) { if (parameter != null) { long rowId = database.insert(parameter.tableName, parameter.contentValues); if (rowId < 0) { transactionSuccess = false; } } if (!transactionSuccess) { String msg = String.format("Updating index %s failed.", indexName); logger.log(Level.SEVERE, msg); break; } } } if (!transactionSuccess) { break; } } if (transactionSuccess) { database.setTransactionSuccessful(); } database.endTransaction(); return transactionSuccess; } }); boolean success; try { success = result.get(); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Execution error encountered:", e); success = false; } catch (InterruptedException e) { logger.log(Level.SEVERE, "Execution interrupted error encountered:", e); success = false; } if (success) { success = updateMetadataForIndex(indexName, lastSequence); } return success; }

Target:
private boolean updateIndex(final String indexName, final List<String> fieldNames, final Changes changes, long lastSequence) { if (indexName == null || indexName.isEmpty()) { return false; } Future<Boolean> result = queue.submitTransaction(new SQLQueueCallable<Boolean>() { @Override public Boolean call(SQLDatabase database) { database.beginTransaction(); for (DocumentRevision rev: changes.getResults()) { String tableName = IndexManager.tableNameForIndex(indexName); database.delete(tableName, " _id = ? ", new String[]{rev.getId()}); if (!rev.isDeleted()) { List<DBParameter> parameters = parametersToIndexRevision(rev, indexName, fieldNames); if (parameters == null) { continue; } for (DBParameter parameter: parameters) { if (parameter != null) { long rowId = database.insert(parameter.tableName, parameter.contentValues); if (rowId < 0) { String msg = String.format("Updating index %s failed.", indexName); logger.log(Level.SEVERE, msg); throw new QueryException(msg); } } } } } return true; } }); boolean success; try { success = result.get(); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Execution error encountered:", e); success = false; } catch (InterruptedException e) { logger.log(Level.SEVERE, "Execution interrupted error encountered:", e); success = false; } if (success) { success = updateMetadataForIndex(indexName, lastSequence); } return success; }
Source:
public GHCompare getCompare(GHBranch id1, GHBranch id2) throws IOException { String fqid1 = id1.getName(); String fqid2 = id2.getName(); try { String owner1 = id1.getOwner().getOwnerName(); String owner2 = id2.getOwner().getOwnerName(); if (!owner1.equals(owner2)) { fqid1 = String.format("%s:%s",owner1,id1.getName()); fqid2 = String.format("%s:%s",owner2,id2.getName()); } } catch (RuntimeException e) { } return getCompare(fqid1,fqid2); }

Target:
public GHCompare getCompare(GHBranch id1, GHBranch id2) throws IOException { GHRepository owner1 = id1.getOwner(); GHRepository owner2 = id2.getOwner(); if (owner1!=null && owner2!=null) { String ownerName1 = owner1.getOwnerName(); String ownerName2 = owner2.getOwnerName(); if (!StringUtils.equals(ownerName1, ownerName2)) { String qualifiedName1 = String.format("%s:%s", ownerName1, id1.getName()); String qualifiedName2 = String.format("%s:%s", ownerName2, id2.getName()); return getCompare(qualifiedName1, qualifiedName2); } } return getCompare(id1.getName(), id2.getName()); }
Source:
public void traceSelected(TmfTraceSelectedSignal signal) { ITmfTrace trace = getTrace(); if (signal.getTrace() == trace) { for (IAnalysisParameterProvider provider : fParameterProviders) { provider.registerModule(this); } } }

Target:
public void traceSelected(TmfTraceSelectedSignal signal) { if (signal.getTrace() == fTrace) { for (IAnalysisParameterProvider provider : fParameterProviders) { provider.registerModule(this); } } }
Source:
public void findAllUnloadedOnViewDistanceDecrease(long playerAddress, int oldHorizontalViewDistance, int newHorizontalViewDistance, int oldVerticalViewDistance, int newVerticalViewDistance, TLongSet cubesToUnload, TLongSet columnsToUnload) { int playerCubeX = AddressTools.getX(playerAddress); int playerCubeY = AddressTools.getY(playerAddress); int playerCubeZ = AddressTools.getZ(playerAddress); for (int cubeX = playerCubeX - oldHorizontalViewDistance; cubeX <= playerCubeX + oldHorizontalViewDistance; cubeX++) { for (int cubeZ = playerCubeZ - oldHorizontalViewDistance; cubeZ <= playerCubeZ + oldHorizontalViewDistance; cubeZ++) { if (!isPointWithinCubeVolume(playerCubeX, 0, playerCubeZ, cubeX, 0, cubeZ, newHorizontalViewDistance, newVerticalViewDistance)) { columnsToUnload.add(getAddress(cubeX, cubeZ)); } for (int cubeY = playerCubeY - oldVerticalViewDistance; cubeY <= playerCubeY + oldVerticalViewDistance; cubeY++) { if (!isPointWithinCubeVolume(playerCubeX, playerCubeY, playerCubeZ, cubeX, cubeY, cubeZ, newVerticalViewDistance, newVerticalViewDistance)) { cubesToUnload.add(getAddress(cubeX, cubeY, cubeZ)); } } } } }

Target:
public void findAllUnloadedOnViewDistanceDecrease(long playerAddress, int oldHorizontalViewDistance, int newHorizontalViewDistance, int oldVerticalViewDistance, int newVerticalViewDistance, TLongSet cubesToUnload, TLongSet columnsToUnload) { int playerCubeX = AddressTools.getX(playerAddress); int playerCubeY = AddressTools.getY(playerAddress); int playerCubeZ = AddressTools.getZ(playerAddress); for (int cubeX = playerCubeX - oldHorizontalViewDistance; cubeX <= playerCubeX + oldHorizontalViewDistance; cubeX++) { for (int cubeZ = playerCubeZ - oldHorizontalViewDistance; cubeZ <= playerCubeZ + oldHorizontalViewDistance; cubeZ++) { if (!isPointWithinCubeVolume(playerCubeX, 0, playerCubeZ, cubeX, 0, cubeZ, newHorizontalViewDistance, newVerticalViewDistance)) { columnsToUnload.add(getAddress(cubeX, cubeZ)); } for (int cubeY = playerCubeY - oldVerticalViewDistance; cubeY <= playerCubeY + oldVerticalViewDistance; cubeY++) { if (!isPointWithinCubeVolume(playerCubeX, playerCubeY, playerCubeZ, cubeX, cubeY, cubeZ, newHorizontalViewDistance, newVerticalViewDistance)) { cubesToUnload.add(getAddress(cubeX, cubeY, cubeZ)); } } } } }
Source:
protected IWorkbenchPart getBootstrapPart() { IWorkbenchPage page = getSite().getPage(); if (page == null) { return null; } ISelection originalSel = page.getSelection(); IWorkbenchPart activePart = page.getActivePart(); if (activePart != null && activePart != this) { bootstrapSelection = originalSel; return activePart; } if (originalSel == null || originalSel.isEmpty()) { return null; } IEditorPart activeEditor = page.getActiveEditor(); if (activeEditor != null && isImportant(activeEditor)) { ISelection selection = activeEditor.getSite().getSelectionProvider().getSelection(); if (originalSel.equals(selection)) { bootstrapSelection = originalSel; return activeEditor; } } IViewReference[] viewrefs = page.getViewReferences(); for (IViewReference ref : viewrefs) { IWorkbenchPart part = ref.getPart(false); if (part == null || part == this || !page.isPartVisible(part)) { continue; } if (!isImportant(part) || part.getSite().getSelectionProvider() == null) { continue; } ISelection selection = part.getSite().getSelectionProvider().getSelection(); if (originalSel.equals(selection)) { bootstrapSelection = originalSel; return part; } } return null; }

Target:
protected IWorkbenchPart getBootstrapPart() { IWorkbenchPage page = getSite().getPage(); if (page == null) { return null; } ISelection originalSel = page.getSelection(); IWorkbenchPart activePart = page.getActivePart(); if (activePart != null && activePart != this) { bootstrapSelection = originalSel; return activePart; } if (originalSel == null || originalSel.isEmpty()) { return null; } IEditorPart activeEditor = page.getActiveEditor(); if (activeEditor != null && isImportant(activeEditor)) { if (activeEditor.getSite().getSelectionProvider() != null) { ISelection selection = activeEditor.getSite().getSelectionProvider().getSelection(); if (originalSel.equals(selection)) { bootstrapSelection = originalSel; return activeEditor; } } } IViewReference[] viewrefs = page.getViewReferences(); for (IViewReference ref : viewrefs) { IWorkbenchPart part = ref.getPart(false); if (part == null || part == this || !page.isPartVisible(part)) { continue; } if (!isImportant(part) || part.getSite().getSelectionProvider() == null) { continue; } ISelection selection = part.getSite().getSelectionProvider().getSelection(); if (originalSel.equals(selection)) { bootstrapSelection = originalSel; return part; } } return null; }
Source:
public static InstanceDiscoveryMetadata getCachedInstanceDiscoveryMetadata(final URL authorityUrl) { return sAadAuthorityHostMetadata.get(authorityUrl.getHost().toLowerCase(Locale.US)); }

Target:
static InstanceDiscoveryMetadata getCachedInstanceDiscoveryMetadata(final URL authorityUrl) { return sAadAuthorityHostMetadata.get(authorityUrl.getHost().toLowerCase(Locale.US)); }
Source:
public void variousFormatReaderTest(final String inputFile) { final File input = new File(TEST_DATA_DIR, inputFile); final SamReader reader = SamReaderFactory.makeDefault().open(input); for (final SAMRecord rec : reader) { } CloserUtil.close(reader); }

Target:
public void variousFormatReaderTest(final String inputFile) throws IOException { final File input = new File(TEST_DATA_DIR, inputFile); try(final SamReader reader = SamReaderFactory.makeDefault().open(input)) { for (final SAMRecord rec : reader) { } } }
Source:
protected void done() { super.done(); progress.finish(); try { String markup = get(); if (markup != null) { setPanelText(markup, true); } else { setPanelText("", false); } } catch (InterruptedException | ExecutionException ex) { logger.log(Level.SEVERE, "Error getting marked up text", ex); setPanelText(NbBundle.getMessage(ExtractedContentViewer.class, "ExtractedContentPanel.getText.error.msg"), true); } catch (java.util.concurrent.CancellationException ex) { } updateControls(source); scrollToCurrentHit(source); }

Target:
protected void done() { super.done(); progress.finish(); try { String markup = get(); if (markup != null) { setPanelText(markup, true); } else { setPanelText("", false); } } catch (InterruptedException | CancellationException | ExecutionException ex) { logger.log(Level.SEVERE, "Error getting marked up text", ex); setPanelText(Bundle.IndexedText_errorMessage_errorGettingText(), true); } updateControls(source); scrollToCurrentHit(source); }
Source:
private Pair<Map<String, Object>, Map<String, Object>> readSettingsFile(File src) throws IOException, ClassNotFoundException { ObjectInputStream input = null; try { input = new ObjectInputStream(new FileInputStream(src)); Map<String, Object> generalEntries = (Map<String, Object>) input.readObject(); Map<String, Object> adminEntries = (Map<String, Object>) input.readObject(); return new Pair<>(generalEntries, adminEntries); } finally { try { if (input != null) { input.close(); } } catch (IOException ex) { Timber.e(ex, "Exception thrown while closing an input stream due to: %s ", ex.getMessage()); } } }

Target:
private Pair<Map<String, Object>, Map<String, Object>> readSettingsFile(File src) throws IOException, ClassNotFoundException { try (ObjectInputStream input = new ObjectInputStream(new FileInputStream(src))) { Map<String, Object> generalEntries = (Map<String, Object>) input.readObject(); Map<String, Object> adminEntries = (Map<String, Object>) input.readObject(); return new Pair<>(generalEntries, adminEntries); } }
Source:
public void testGetNonVariantOverlapsPredicate() { long start = 1000L; Variant overlapStart = Variant.newBuilder().setReferenceBases("T").addAlternateBases("A").setStart(900L).build(); Variant overlapStartNonVariant = Variant.newBuilder().setReferenceBases("T").setStart(900L).setEnd(1005L).build(); Predicate<Variant> shardPredicate = ShardBoundary.getNonVariantOverlapsPredicate(start, null); assertFalse(shardPredicate.apply(overlapStart)); assertTrue(shardPredicate.apply(overlapStartNonVariant)); }

Target:
public void testGetNonVariantOverlapsPredicate() { long start = 1000L; Variant overlapStart = Variant.newBuilder().setReferenceBases("T").addAlternateBases("A").setStart(900L).build(); Variant overlapStartNonVariant = Variant.newBuilder().setReferenceBases("T").setStart(900L).setEnd(1005L).build(); Variant overlapStartGatkNonVariant = Variant.newBuilder().setReferenceBases("T") .addAlternateBases("A").addAlternateBases(VariantUtils.GATK_NON_VARIANT_SEGMENT_ALT) .setStart(900L).setEnd(1005L).build(); Predicate<Variant> shardPredicate = ShardBoundary.getNonVariantOverlapsPredicate(start, null); assertFalse(shardPredicate.apply(overlapStart)); assertTrue(shardPredicate.apply(overlapStartNonVariant)); assertTrue(shardPredicate.apply(overlapStartGatkNonVariant)); }
Source:
public final void dispose() { withContextClassLoader(null, () -> { log(miniSplash(format("Disposing %s '%s'", artifactType, getArtifactName()))); }); ClassLoader originalClassLoader = currentThread().getContextClassLoader(); try { ClassLoader artifactCL = null; if (getArtifactClassLoader() != null) { artifactCL = getArtifactClassLoader().getClassLoader(); } if (artifactCL != null) { currentThread().setContextClassLoader(artifactCL); } doDispose(); if (artifactCL != null) { if (isRegionClassLoaderMember(artifactCL)) { ((DisposableClassLoader) artifactCL.getParent()).dispose(); } else if (artifactCL instanceof DisposableClassLoader) { ((DisposableClassLoader) artifactCL).dispose(); } } } finally { currentThread().setContextClassLoader(originalClassLoader); deploymentClassLoader = null; } }

Target:
public final void dispose() { withContextClassLoader(null, () -> log(miniSplash(format("Disposing %s '%s'", artifactType, getArtifactName())))); ClassLoader originalClassLoader = currentThread().getContextClassLoader(); try { ClassLoader artifactCL = null; if (getArtifactClassLoader() != null) { artifactCL = getArtifactClassLoader().getClassLoader(); } if (artifactCL != null) { currentThread().setContextClassLoader(artifactCL); } doDispose(); if (artifactCL != null) { if (isRegionClassLoaderMember(artifactCL)) { ((DisposableClassLoader) artifactCL.getParent()).dispose(); } else if (artifactCL instanceof DisposableClassLoader) { ((DisposableClassLoader) artifactCL).dispose(); } } } finally { currentThread().setContextClassLoader(originalClassLoader); deploymentClassLoader = null; } }
Source:
protected Control createDialogArea(final Composite parent) { Image aboutImage = null; AboutItem item = null; if (product != null) { aboutImage = product.getAboutImage(); if (aboutImage == null || aboutImage.getBounds().width <= maxImageWidth) { String aboutTextProperty = product.getAboutText(); if (aboutTextProperty != null) { aboutText = new AboutText(aboutTextProperty); item = aboutText.getAboutItem(); } } } Composite workArea = WidgetFactory.composite(SWT.NONE).layoutData(new GridData(GridData.FILL_BOTH)) .create(parent); GridLayoutFactory.fillDefaults().applyTo(workArea); Color background = JFaceColors.getBannerBackground(parent.getDisplay()); Color foreground = JFaceColors.getBannerForeground(parent.getDisplay()); Composite top = (Composite) super.createDialogArea(workArea); GridLayoutFactory.fillDefaults().applyTo(top); top.setLayoutData(new GridData(GridData.FILL_BOTH)); top.setBackground(background); top.setForeground(foreground); final Composite topContainer = WidgetFactory.composite(SWT.NONE).background(background).foreground(foreground) .create(top); GridLayoutFactory.fillDefaults().numColumns(aboutImage == null || item == null ? 1 : 2).applyTo(topContainer); int topContainerHeightHint = calculateTopContainerHeightAndCreateImage(aboutImage, background, foreground, topContainer, parent); GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, topContainerHeightHint).applyTo(topContainer); createTextWidget(parent, item, background, foreground, topContainer); return workArea; }

Target:
protected Control createDialogArea(final Composite parent) { Optional<Image> aboutImage = Optional.empty(); Optional<AboutItem> aboutItem = Optional.empty(); if (product != null) { aboutImage = product.getAboutImage(); if (!aboutImage.isPresent() || aboutImage.get().getBounds().width <= maxImageWidth) { String aboutTextProperty = product.getAboutText(); if (aboutTextProperty != null) { aboutText = new AboutText(aboutTextProperty); aboutItem = aboutText.getAboutItem(); } } } Composite workArea = WidgetFactory.composite(SWT.NONE).layoutData(new GridData(GridData.FILL_BOTH)) .create(parent); GridLayoutFactory.fillDefaults().applyTo(workArea); Color background = JFaceColors.getBannerBackground(parent.getDisplay()); Color foreground = JFaceColors.getBannerForeground(parent.getDisplay()); Composite top = (Composite) super.createDialogArea(workArea); GridLayoutFactory.fillDefaults().applyTo(top); top.setLayoutData(new GridData(GridData.FILL_BOTH)); top.setBackground(background); top.setForeground(foreground); final Composite topContainer = WidgetFactory.composite(SWT.NONE).background(background).foreground(foreground) .create(top); GridLayoutFactory.fillDefaults().numColumns(aboutImage == null || !aboutItem.isPresent() ? 1 : 2) .applyTo(topContainer); int topContainerHeightHint = calculateTopContainerHeightAndCreateImage(aboutImage, background, foreground, topContainer, parent); GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, topContainerHeightHint).applyTo(topContainer); aboutItem.ifPresent(c -> createTextWidget(parent, c, background, foreground, topContainer)); return workArea; }
Source:
public void auditRequestMessage(T request, AssertionType assertion, NhinTargetSystemType target, String direction, String _interface, Boolean isRequesting, Properties webContextProperties, String serviceName) { LOG.trace("--- Before auditing of request message ---"); if (getAuditLogger() != null) { getAuditLogger().auditRequestMessage(request, assertion, target, direction, _interface, isRequesting, webContextProperties, serviceName, getAuditTransforms()); } else { LOG.error("Error looking into EJB JNDI Object"); } LOG.trace("--- After auditing of request message ---"); }

Target:
public void auditRequestMessage(T request, AssertionType assertion, NhinTargetSystemType target, String direction, String _interface, Boolean isRequesting, Properties webContextProperties, String serviceName) { LOG.trace("--- Before auditing of request message ---"); if (getAuditLogger() != null) { getAuditLogger().auditRequestMessage(request, assertion, target, direction, _interface, isRequesting, webContextProperties, serviceName, getAuditTransforms()); } LOG.trace("--- After auditing of request message ---"); }
Source:
private LockInfo() { record = new ZNRecord("LOCK"); setLockInfoFields(DEFAULT_OWNER_TEXT, DEFAULT_MESSAGE_TEXT, DEFAULT_TIMEOUT_LONG); }

Target:
private LockInfo() { _record = new ZNRecord(ZNODE_ID); setLockInfoFields(DEFAULT_OWNER_TEXT, DEFAULT_MESSAGE_TEXT, DEFAULT_TIMEOUT_LONG); }
Source:
private static Set<IResource> collectResources(ResourceMapping[] mappings) throws CoreException { final Set<IResource> resources = new HashSet<IResource>(); ResourceMappingContext context = ResourceMappingContext.LOCAL_CONTEXT; for (ResourceMapping mapping : mappings) { ResourceTraversal[] traversals = mapping.getTraversals(context, new NullProgressMonitor()); for (ResourceTraversal traversal : traversals) resources.addAll(Arrays.asList(traversal.getResources())); } return resources; }

Target:
private static Set<IResource> collectResources(ResourceMapping[] mappings) throws CoreException { final Set<IResource> resources = new HashSet<IResource>(); ResourceMappingContext context = ResourceMappingContext.LOCAL_CONTEXT; for (ResourceMapping mapping : mappings) { ResourceTraversal[] traversals = mapping.getTraversals(context, new NullProgressMonitor()); for (ResourceTraversal traversal : traversals) { resources.addAll(Arrays.asList(traversal.getResources())); } } return resources; }
Source:
protected final List<Type> getColumnTypes(String tableName, String... columnNames) { checkArgument(session.getCatalog().isPresent(), "catalog not set"); checkArgument(session.getSchema().isPresent(), "schema not set"); Metadata metadata = localQueryRunner.getMetadata(); QualifiedObjectName qualifiedTableName = new QualifiedObjectName(session.getCatalog().get(), session.getSchema().get(), tableName); TableHandle tableHandle = metadata.getTableHandle(session, qualifiedTableName).orElse(null); checkArgument(tableHandle != null, "Table %s does not exist", qualifiedTableName); Map<String, ColumnHandle> allColumnHandles = metadata.getColumnHandles(session, tableHandle); return Arrays.stream(columnNames) .map(allColumnHandles::get) .map(columnHandle -> metadata.getColumnMetadata(session, tableHandle, columnHandle).getType()) .collect(toImmutableList()); }

Target:
protected final List<Type> getColumnTypes(String tableName, String... columnNames) { checkState(session.getCatalog().isPresent(), "catalog not set"); checkState(session.getSchema().isPresent(), "schema not set"); Metadata metadata = localQueryRunner.getMetadata(); QualifiedObjectName qualifiedTableName = new QualifiedObjectName(session.getCatalog().get(), session.getSchema().get(), tableName); TableHandle tableHandle = metadata.getTableHandle(session, qualifiedTableName) .orElseThrow(() -> new IllegalArgumentException(format("Table %s does not exist", qualifiedTableName))); Map<String, ColumnHandle> allColumnHandles = metadata.getColumnHandles(session, tableHandle); return Arrays.stream(columnNames) .map(allColumnHandles::get) .map(columnHandle -> metadata.getColumnMetadata(session, tableHandle, columnHandle).getType()) .collect(toImmutableList()); }
Source:
public IntegrationFlow tfrErrors() { return f -> f.enrichHeaders(Mail.headers() .subject("File split and transfer failed") .from("foo@bar") .toFunction(m -> new String[] {"bar@baz"})) .enrichHeaders(h -> h.header(EMAIL_SUCCESS_SUFFIX, ".failed") .headerExpression(FileHeaders.ORIGINAL_FILE, "payload.failedMessage.headers['" + FileHeaders.ORIGINAL_FILE + "']")) .<MessagingException, String>transform(p -> { StringBuilder builder = new StringBuilder(); builder.append(p.getFailedMessage().getPayload().toString()).append("\n") .append(getStackTraceAsString(p)); return builder.toString(); }) .channel("toMail.input"); }

Target:
public IntegrationFlow tfrErrors() { return f -> f.enrichHeaders(Mail.headers() .subject("File split and transfer failed") .from("foo@bar") .toFunction(m -> new String[] {"bar@baz"})) .enrichHeaders(h -> h.header(EMAIL_SUCCESS_SUFFIX, ".failed") .headerExpression(FileHeaders.ORIGINAL_FILE, "payload.failedMessage.headers['" + FileHeaders.ORIGINAL_FILE + "']")) .<MessagingException, String>transform(p -> p.getFailedMessage().getPayload().toString() + "\n" + getStackTraceAsString(p)) .channel("toMail.input"); }
Source:
private UrlEncodedFormEntity createUrlEncodedFormEntity(final String contentEncoding) throws UnsupportedEncodingException { PropertyIterator args = getArguments().iterator(); List<NameValuePair> nvps = new ArrayList<>(); String urlContentEncoding = contentEncoding; if (urlContentEncoding == null || urlContentEncoding.length() == 0) { urlContentEncoding = EncoderCache.URL_ARGUMENT_ENCODING; } while (args.hasNext()) { HTTPArgument arg = (HTTPArgument) args.next().getObjectValue(); String parameterName = arg.getName(); if (arg.isSkippable(parameterName)) { continue; } String parameterValue = arg.getValue(); if (!arg.isAlwaysEncoded()) { try { URLCodec urlCodec = new URLCodec(contentEncoding); parameterName = urlCodec.decode(parameterName, urlContentEncoding); parameterValue = urlCodec.decode(parameterValue, urlContentEncoding); } catch (DecoderException e) { log.error(contentEncoding + " exception in encoding!"); throw new Error(e.toString(), e); } } nvps.add(new BasicNameValuePair(parameterName, parameterValue)); } return new UrlEncodedFormEntity(nvps, urlContentEncoding); }

Target:
private UrlEncodedFormEntity createUrlEncodedFormEntity(final String contentEncoding) throws UnsupportedEncodingException { PropertyIterator args = getArguments().iterator(); List<NameValuePair> nvps = new ArrayList<>(); String urlContentEncoding = contentEncoding; if (urlContentEncoding == null || urlContentEncoding.length() == 0) { urlContentEncoding = EncoderCache.URL_ARGUMENT_ENCODING; } while (args.hasNext()) { HTTPArgument arg = (HTTPArgument) args.next().getObjectValue(); String parameterName = arg.getName(); if (arg.isSkippable(parameterName)) { continue; } String parameterValue = arg.getValue(); if (!arg.isAlwaysEncoded()) { try { URLCodec urlCodec = new URLCodec(contentEncoding); parameterName = urlCodec.decode(parameterName, urlContentEncoding); parameterValue = urlCodec.decode(parameterValue, urlContentEncoding); } catch (DecoderException e) { log.error("exception in encoding for parameter name and parameter value {}!", contentEncoding,parameterName,parameterValue); throw new Error(e.toString(), e); } } nvps.add(new BasicNameValuePair(parameterName, parameterValue)); } return new UrlEncodedFormEntity(nvps, urlContentEncoding); }
Source:
public <T> HTMLDisplayer<T> getHTMLDisplayer(Type targetType, String roleHint) throws HTMLDisplayerException { try { HTMLDisplayer<T> component; ComponentManager componentManager = this.componentManagerProvider.get(); Type type = targetType; Type converterType = new DefaultParameterizedType(null, HTMLDisplayer.class, type); while (!componentManager.hasComponent(converterType, roleHint) && type instanceof ParameterizedType) { type = ((ParameterizedType) type).getRawType(); converterType = new DefaultParameterizedType(null, HTMLDisplayer.class, type); } if (!componentManager.hasComponent(converterType, roleHint)) { converterType = HTMLDisplayer.class; } if (componentManager.hasComponent(converterType, roleHint)) { component = componentManager.getInstance(converterType, roleHint); } else { component = componentManager.getInstance(converterType); } return component; } catch (ComponentLookupException e) { throw new HTMLDisplayerException( "Failed to initialized the HTML displayer for target type [" + targetType + "] and role [" + String .valueOf(roleHint) + "]", e); } }

Target:
public <T> HTMLDisplayer<T> getHTMLDisplayer(Type targetType, String roleHint) throws HTMLDisplayerException { try { HTMLDisplayer<T> component; ComponentManager componentManager = this.componentManagerProvider.get(); Type type = targetType; Type displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, type); while (!componentManager.hasComponent(displayerType, roleHint) && type instanceof ParameterizedType) { type = ((ParameterizedType) type).getRawType(); displayerType = new DefaultParameterizedType(null, HTMLDisplayer.class, type); } if (!componentManager.hasComponent(displayerType, roleHint)) { displayerType = HTMLDisplayer.class; } if (componentManager.hasComponent(displayerType, roleHint)) { component = componentManager.getInstance(displayerType, roleHint); } else { component = componentManager.getInstance(displayerType); } return component; } catch (ComponentLookupException e) { throw new HTMLDisplayerException( "Failed to initialized the HTML displayer for target type [" + targetType + "] and role [" + String .valueOf(roleHint) + "]", e); } }
Source:
public boolean isModified() { if (this.refreshDelay < 0) { return false; } long time = System.currentTimeMillis(); if (this.refreshDelay == 0 || (time - this.lastModifiedChecked.get()) > this.refreshDelay) { this.lastModifiedChecked.set(time); boolean modified = this.source.isModified(); if (modified) { this.script = null; } return modified; } return false; }

Target:
public boolean isModified() { return this.refreshDelay >= 0 && (System.currentTimeMillis() - this.lastModifiedChecked.get()) > this.refreshDelay && this.source.isModified(); }
Source:
public FileStatus getFileStatus(Path path) throws IOException { List<ClientFileInfo> tachyInfo = fileSystem.listStatus(pathToString(path.getParent())); FileStatus stratInfo = null; for (int x = 0; x < tachyInfo.size(); x++) { if (tachyInfo.get(x).path.equals(pathToString(path))) { stratInfo = new TachyonFileStatus(tachyInfo.get(x), name); } } return stratInfo; }

Target:
public FileStatus getFileStatus(Path path) throws IOException { try { List<ClientFileInfo> tachyInfo = fileSystem.listStatus(pathToString(path.getParent())); int targetID = fileSystem.getFileId(pathToString(path)); for (int x = 0; x < tachyInfo.size(); x++) { if (tachyInfo.get(x).id == targetID) { return new TachyonFileStatus(tachyInfo.get(x), name); } } return null; } catch (IOException ioe) { if (ioe.getCause() instanceof FileDoesNotExistException) { throw new FileNotFoundException(ioe.getCause().getMessage()); } else { throw ioe; } } }
Source:
private void showVideoSpeedFragmentPopup() { hideSettingsPopUp(); List<Float> speeds = new ArrayList<>(); speeds.add(0.5f); speeds.add(1.f); speeds.add(1.5f); speeds.add(2.0f); speedDialogFragment = SpeedDialogFragment.getInstance(speeds, new SpeedDialogFragment.IListDialogCallback() { @Override public void onItemClicked(Float speed) { setPlaybackSpeed(speed); if (player != null) { player.setPlaybackSpeed(speed); } } @Override public void onCancelClicked() { speedDialogFragment.dismiss(); } }, loginPrefs.getPlaybackSpeed()); speedDialogFragment.show(getFragmentManager(), "video_speed_dialog"); speedDialogFragment.setCancelable(false); }

Target:
private void showVideoSpeedFragmentPopup() { hideSettingsPopUp(); speedDialogFragment = SpeedDialogFragment.getInstance(new SpeedDialogFragment.IListDialogCallback() { @Override public void onItemClicked(Float speed) { loginPrefs.saveDefaultPlaybackSpeed(speed); if (player != null) { player.setPlaybackSpeed(speed); } } @Override public void onCancelClicked() { speedDialogFragment.dismiss(); } }, loginPrefs.getDefaultPlaybackSpeed()); speedDialogFragment.show(getFragmentManager(), "video_speed_dialog"); speedDialogFragment.setCancelable(true); }
Source:
private void markExperimentFailure(Exception exception) { nextPermittedExperiment.accumulateAndGet(Instant.now(clock).plus(REFRESH_INTERVAL), (existing, current) -> existing.compareTo(current) > 0 ? existing : current); log.info("Experiment failed; we will revert to the fallback service. We will allow attempting to use" + " the experimental service again in {}.", SafeArg.of("retryDuration", REFRESH_INTERVAL), exception); }

Target:
private void markExperimentFailure(Exception exception) { nextPermittedExperiment.accumulateAndGet(Instant.now(clock).plus(REFRESH_INTERVAL), (existing, current) -> existing.compareTo(current) > 0 ? existing : current); log.info("Experiment failed; we will revert to the fallback service. We will allow attempting to use the" + " experimental service again after a timeout.", SafeArg.of("timeout", REFRESH_INTERVAL), exception); }
Source:
private void validateActivityDates(Long startDate, Long endDate) throws ValidationException{ Calendar calendarCounter = Calendar.getInstance(TimeZone.getTimeZone("UTC")); Integer maxActivityRangeInDays = Integer.getInteger(env.getProperty("maxActivityRangeInDays"), 60); calendarCounter.setTime(new Date(endDate)); calendarCounter.add(Calendar.DATE, -maxActivityRangeInDays); if(new Date(startDate).compareTo(calendarCounter.getTime()) < 0){ throw new ValidationException("Cannot search an activity with a date range more than " + maxActivityRangeInDays + " days."); } }

Target:
private void validateActivityDates(Long startDate, Long endDate) throws ValidationException{ Calendar calendarCounter = Calendar.getInstance(TimeZone.getTimeZone("UTC")); Integer maxActivityRangeInDays = Integer.getInteger(env.getProperty("maxActivityRangeInDays"), 60); calendarCounter.setTime(new Date(endDate)); if(new Date(startDate).compareTo(calendarCounter.getTime()) > 0){ throw new ValidationException("Cannot search for activity with the start date after the end date"); } calendarCounter.add(Calendar.DATE, -maxActivityRangeInDays); if(new Date(startDate).compareTo(calendarCounter.getTime()) < 0){ throw new ValidationException("Cannot search for activity with a date range more than " + maxActivityRangeInDays + " days."); } }
Source:
private Route<? extends EventMessage, EventContext, I> eventImportRouting() { return (message, context) -> { Set<I> ids = eventImportRouting.apply(message, context); int numberOfTargets = ids.size(); String messageType = message.getClass() .getName(); checkState( numberOfTargets > 0, "Could not get aggregate ID from the event context: `%s`. Event class: `%s`.", context, messageType ); checkState( numberOfTargets == 1, "Expected one aggregate ID, but got %s (%s). Event class: `%s`, context: `%s`.", String.valueOf(numberOfTargets), ids, messageType, context ); I id = ids.stream() .findFirst() .orElseThrow(() -> newIllegalStateException( "Unable to route import event `%s`. Event: %s", messageType, shortDebugString(message)) ); return id; }; }

Target:
private Route<? extends EventMessage, EventContext, I> eventImportRouting() { return (message, context) -> { Set<I> ids = eventImportRouting.apply(message, context); int numberOfTargets = ids.size(); String messageType = message.getClass() .getName(); checkState( numberOfTargets > 0, "Could not get aggregate ID from the event context: `%s`. Event class: `%s`.", context, messageType ); checkState( numberOfTargets == 1, "Expected one aggregate ID, but got %s (%s). Event class: `%s`, context: `%s`.", String.valueOf(numberOfTargets), ids, messageType, context ); I id = ids.stream() .findFirst() .orElseThrow(() -> newIllegalStateException( "Unable to route import event `%s`.", messageType) ); return id; }; }
Source:
public void testVisibilityImplicitClassMembers() throws Exception { IBinding[] memberBindings = findQualifiedPossiblyImplicit(pdom, "AClass::AClass"); int visibility = getMemberVisibility(memberBindings[0]); VisibilityAsserts.assertVisibility(ICPPClassType.v_public, visibility); int visibility2 = getMemberVisibility(memberBindings[0]); VisibilityAsserts.assertVisibility(ICPPClassType.v_public, visibility2); }

Target:
public void testVisibilityImplicitClassMembers() throws Exception { IBinding[] memberBindings = findQualifiedPossiblyImplicit(pdom, "AClass::AClass"); assertVisibility(ICPPClassType.v_public, getMemberVisibility(memberBindings[0])); assertVisibility(ICPPClassType.v_public, getMemberVisibility(memberBindings[1])); }
Source:
public void onClick(View arg0) { if (app.deleteWaypoint(id)) { if (Settings.isStoreOfflineWpMaps()) { for (int level = 1; level <= 5; level++) { try { if (id > 0) { StaticMapsProvider.getMapFile(geocode, "wp" + id + "_", level, false).delete(); } } catch (Exception e) { Log.e(Settings.tag, "cgeowaypoint.deleteWaypointListener.onClick: " + e.toString()); } } } cgeoapplication.removeCacheFromCache(geocode); finish(); return; } else { showToast(res.getString(R.string.err_waypoint_delete_failed)); } }

Target:
public void onClick(View arg0) { if (app.deleteWaypoint(id)) { StaticMapsProvider.removeWpStaticMaps(id, geocode); cgeoapplication.removeCacheFromCache(geocode); finish(); return; } else { showToast(res.getString(R.string.err_waypoint_delete_failed)); } }
Source:
public void canDoActionFailsOnNullHook() { cmd = spy(new DisableGlusterHookCommand(new GlusterHookParameters(CLUSTER_ID, HOOK_ID))); setupMocks(cmd,false); assertFalse(cmd.canDoAction()); }

Target:
public void canDoActionFailsOnNullHook() { cmd = spy(new DisableGlusterHookCommand(new GlusterHookParameters(CLUSTER_ID, HOOK_ID))); setupMocks(cmd,false); assertFalse(cmd.canDoAction()); assertTrue(cmd.getReturnValue().getCanDoActionMessages().contains(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_DOES_NOT_EXIST.toString())); }
Source:
private void askAddToIndex(final String path, final String fileName) { final ProjectDescriptor project = appContext.getCurrentProject().getRootProject(); Map<String, List<String>> attributes = project.getAttributes(); if (!(attributes.containsKey("vcs.provider.name") && attributes.get("vcs.provider.name").contains("git"))) { return; } ConfirmCallback confirmCallback = new ConfirmCallback() { @Override public void accepted() { String filePath = path.substring(project.getName().length() + 2); try { gitServiceClient .add(project, false, Collections.singletonList(filePath), new RequestCallback<Void>() { @Override protected void onSuccess(Void result) { notificationManager.showInfo(localizationConstant.actionNewFileAddToIndexNotification(fileName)); } @Override protected void onFailure(Throwable exception) { notificationManager.showError(exception.getMessage()); } }); } catch (WebSocketException e) { e.printStackTrace(); } } }; CancelCallback cancelCallback = new CancelCallback() { @Override public void cancelled() { } }; dialogFactory.createConfirmDialog(localizationConstant.actionNewFileAddToIndexTitle(), localizationConstant.actionNewFileAddToIndexText(fileName), confirmCallback, cancelCallback).show(); }

Target:
private void askAddToIndex(final String path, final String fileName) { final ProjectConfigDto project = appContext.getCurrentProject().getRootProject(); Map<String, List<String>> attributes = project.getAttributes(); if (!(attributes.containsKey("vcs.provider.name") && attributes.get("vcs.provider.name").contains("git"))) { return; } ConfirmCallback confirmCallback = new ConfirmCallback() { @Override public void accepted() { String filePath = path.substring(project.getName().length() + 2); try { gitServiceClient .add(project, false, Collections.singletonList(filePath), new RequestCallback<Void>() { @Override protected void onSuccess(Void result) { notificationManager.showInfo(localizationConstant.actionNewFileAddToIndexNotification(fileName)); } @Override protected void onFailure(Throwable exception) { notificationManager.showError(exception.getMessage()); } }); } catch (WebSocketException e) { e.printStackTrace(); } } }; CancelCallback cancelCallback = new CancelCallback() { @Override public void cancelled() { } }; dialogFactory.createConfirmDialog(localizationConstant.actionNewFileAddToIndexTitle(), localizationConstant.actionNewFileAddToIndexText(fileName), confirmCallback, cancelCallback).show(); }