auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void editSelectedCell(final GridWidget gridWidget) { final GridData gridModel = gridWidget.getModel(); if (gridModel.getSelectedHeaderCells().size() > 0) { final GridData.SelectedCell selectedCell = gridModel.getSelectedHeaderCells().get(0); final int uiHeaderRowIndex = selectedCell.getRowIndex(); final int uiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(), selectedCell.getColumnIndex()); final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex); final GridColumn.HeaderMetaData headerMetaData = column.getHeaderMetaData().get(uiHeaderRowIndex); final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation(); final double columnXCoordinate = rendererHelper.getColumnOffset(column) + column.getWidth() / 2; final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(columnXCoordinate); final GridBodyCellEditContext context = CellContextUtilities.makeRenderContext(gridWidget, ri, ci, null, uiHeaderRowIndex); headerMetaData.edit(context); } else if (gridModel.getSelectedCells().size() == 1) { final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin(); if (origin == null) { return; } gridWidget.startEditingCell(origin.getRowIndex(), ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(), origin.getColumnIndex())); } }

Target:
public static void editSelectedCell(final GridWidget gridWidget) { final GridData gridModel = gridWidget.getModel(); if (gridModel.getSelectedHeaderCells().size() > 0) { final GridData.SelectedCell selectedCell = gridModel.getSelectedHeaderCells().get(0); final int uiHeaderRowIndex = selectedCell.getRowIndex(); final int uiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(), selectedCell.getColumnIndex()); final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex); final GridColumn.HeaderMetaData headerMetaData = column.getHeaderMetaData().get(uiHeaderRowIndex); final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation(); final double columnXCoordinate = rendererHelper.getColumnOffset(column) + column.getWidth() / 2; final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(columnXCoordinate); final GridBodyCellEditContext context = CellContextUtilities.makeRenderContext(gridWidget, ri, ci, null, uiHeaderRowIndex); headerMetaData.edit(context); } else if (gridModel.getSelectedCells().size() > 0) { final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin(); if (origin == null) { return; } gridWidget.startEditingCell(origin.getRowIndex(), ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(), origin.getColumnIndex())); } }
Source:
public RecordReader<NullWritable, StructuredRecord> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { if (!(split instanceof FileSplit)) { throw new IllegalStateException("Input split is not a FileSplit."); } FileSplit fileSplit = (FileSplit) split; String pathField = context.getConfiguration().get(PATH_FIELD); boolean filenameOnly = context.getConfiguration().getBoolean(FILENAME_ONLY, false); String path = filenameOnly ? fileSplit.getPath().getName() : fileSplit.getPath().toUri().toString(); fileSourceFormat = fileSourceFormat.toLowerCase(); if (Objects.equals(fileSourceFormat, "avro")) { RecordReader<AvroKey<GenericRecord>, NullWritable> delegate = (new AvroKeyInputFormat<GenericRecord>()) .createRecordReader(split, context); return new TrackingAvroRecordReader(delegate, pathField, path); } else if (Objects.equals(fileSourceFormat, "parquet")) { RecordReader<Void, GenericRecord> delegate = (new AvroParquetInputFormat<GenericRecord>()) .createRecordReader(split, context); return new TrackingParquetRecordReader(delegate, pathField, path); } else { RecordReader<LongWritable, Text> delegate = (new TextInputFormat()).createRecordReader(split, context); return new TrackingTextRecordReader(delegate, pathField, path); } }

Target:
public RecordReader<NullWritable, StructuredRecord> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { if (!(split instanceof FileSplit)) { throw new IllegalStateException("Input split is not a FileSplit."); } FileSplit fileSplit = (FileSplit) split; String pathField = context.getConfiguration().get(PATH_FIELD); boolean filenameOnly = context.getConfiguration().getBoolean(FILENAME_ONLY, false); String format = context.getConfiguration().get(FORMAT); String path = filenameOnly ? fileSplit.getPath().getName() : fileSplit.getPath().toUri().toString(); String schema = context.getConfiguration().get(SCHEMA); if ("avro".equalsIgnoreCase(format)) { RecordReader<AvroKey<GenericRecord>, NullWritable> delegate = (new AvroKeyInputFormat<GenericRecord>()) .createRecordReader(split, context); return new TrackingAvroRecordReader(delegate, pathField, path, schema, job); } else if ("parquet".equalsIgnoreCase(format)) { RecordReader<Void, GenericRecord> delegate = (new AvroParquetInputFormat<GenericRecord>()) .createRecordReader(split, context); return new TrackingParquetRecordReader(delegate, pathField, path, schema, job); } else { RecordReader<LongWritable, Text> delegate = (new TextInputFormat()).createRecordReader(split, context); return new TrackingTextRecordReader(delegate, pathField, path); } }
Source:
default ClusteredGetCommand buildClusteredGetCommand(Object key, long flagsBitSet, boolean acquireRemoteLock, GlobalTransaction gtx) { if (acquireRemoteLock) throw new UnsupportedOperationException(); return buildClusteredGetCommand(key, flagsBitSet); }

Target:
default ClusteredGetCommand buildClusteredGetCommand(Object key, long flagsBitSet, boolean acquireRemoteLock, GlobalTransaction gtx) { if (acquireRemoteLock) throw new UnsupportedOperationException("acquireRemoteLock is not supported, use Flag.FORCE_WRITE_LOCK"); return buildClusteredGetCommand(key, flagsBitSet); }
Source:
public boolean remove(K key) throws CacheAccessException { checkKey(key); XATransactionContext<K, V> currentContext = getCurrentContext(); if (currentContext.touched(key)) { V oldValue = currentContext.oldValueOf(key); currentContext.addCommand(key, new StoreRemoveCommand<V>(oldValue)); return true; } ValueHolder<SoftLock<V>> softLockValueHolder = getSoftLockValueHolderFromUnderlyingStore(key); if (softLockValueHolder != null) { SoftLock<V> softLock = softLockValueHolder.value(); if (isInDoubt(softLock)) { currentContext.addCommand(key, new StoreEvictCommand<V>(softLock.getOldValue())); } else { currentContext.addCommand(key, new StoreRemoveCommand<V>(softLock.getOldValue())); } } return true; }

Target:
public boolean remove(K key) throws CacheAccessException { checkKey(key); XATransactionContext<K, V> currentContext = getCurrentContext(); if (currentContext.touched(key)) { V oldValue = currentContext.oldValueOf(key); currentContext.addCommand(key, new StoreRemoveCommand<V>(oldValue)); if (oldValue == null) { return false; } else { return true; } } ValueHolder<SoftLock<V>> softLockValueHolder = getSoftLockValueHolderFromUnderlyingStore(key); boolean status = true; if (softLockValueHolder != null) { SoftLock<V> softLock = softLockValueHolder.value(); if (isInDoubt(softLock)) { status = currentContext.addCommand(key, new StoreEvictCommand<V>(softLock.getOldValue())); } else { status = currentContext.addCommand(key, new StoreRemoveCommand<V>(softLock.getOldValue())); } } return status; }
Source:
public void onEvent(SyncedMapEvent event) { switch (event.getAction()) { case SET: case ADD: for (Pair<Integer, String> item : event.getModifiedElements()) { final int id = item.getLeft(); final String clazzName = item.getRight(); if (id >= opcodeTable.length) { throw new IllegalStateException("Server sent a packet id which is greater than the client has allowed."); } MessageCodec<?> codec = opcodeTable[id]; if ((codec != null && codec.getClass().getName().equals(clazzName))) { continue; } try { Class<? extends MessageCodec> clazz = Class.forName(clazzName, true, loader).asSubclass(MessageCodec.class); Constructor<? extends MessageCodec> constr = clazz.getConstructor(int.class); codec = constr.newInstance(id); codec.setDynamic(true); register(codec); } catch (ClassCastException | ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { if (Spout.debugMode()) { e.printStackTrace(); } } } break; case REMOVE: for (Pair<Integer, String> item : event.getModifiedElements()) { MessageCodec<?> codec = find(item.getLeft()); if (codec != null && codec.getClass().getName().equals(item.getRight())) { opcodeTable[codec.getOpcode()] = null; classTable.remove(codec.getType()); } } break; } }

Target:
public void onEvent(SyncedMapEvent event) { switch (event.getAction()) { case SET: case ADD: for (Pair<Integer, String> item : event.getModifiedElements()) { final int id = item.getLeft(); final String className = item.getRight(); if (id >= opcodeTable.length) { throw new IllegalStateException("Server sent a packet id which is greater than the client has allowed."); } MessageCodec<?> codec = opcodeTable[id]; if ((codec != null && codec.getClass().getName().equals(className))) { throw new IllegalArgumentException("Trying to add a codec which already exists: " + className); } try { final Class<? extends MessageCodec> clazz = Class.forName(className, true, loader).asSubclass(MessageCodec.class); final Constructor<? extends MessageCodec> constr = clazz.getConstructor(int.class); codec = constr.newInstance(id); register(codec); } catch (ClassCastException | ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { if (Spout.debugMode()) { e.printStackTrace(); } } } break; case REMOVE: for (Pair<Integer, String> item : event.getModifiedElements()) { MessageCodec<?> codec = find(item.getLeft()); if (codec != null && codec.getClass().getName().equals(item.getRight())) { opcodeTable[codec.getOpcode()] = null; classTable.remove(codec.getType()); } } break; } }
Source:
public void set(@NonNull ContentSet values, @Nullable Boolean value) { values.put(mFieldName, new BooleanBinaryLong(value).value()); }

Target:
public void set(@NonNull ContentSet values, @Nullable Boolean value) { values.put(mFieldName, new BooleanBinaryInt(value).value()); }
Source:
protected RegistryConnHandler getConnHandler() throws IOException { RegistryConnHandler connection = (RegistryConnHandler) ConnectionPool .getConnectionHandler(this, fileURL, true); try { connection.checkConnection(); } catch (IOException e) { throw e; } return connection; }

Target:
protected RegistryConnHandler getConnHandler() throws IOException { RegistryConnHandler connection = (RegistryConnHandler) ConnectionPool .getConnectionHandler(this, fileURL, true); connection.checkConnection(); return connection; }
Source:
public void testContainerPropertiesTab() { DockerImagesTab imageTab = new DockerImagesTab(); imageTab.activate(); imageTab.refresh(); new WaitWhile(new JobIsRunning()); imageTab.runImage(this.imageName); RunADockerImagePageOneWizard firstPage = new RunADockerImagePageOneWizard(); firstPage.setName(this.containerName); firstPage.finish(); new WaitWhile(new JobIsRunning()); DockerContainersTab containerTab = new DockerContainersTab(); containerTab.activate(); containerTab.refresh(); new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL); for (TableItem item : containerTab.getTableItems()) { if (item.getText(1).contains(this.imageName)) { item.click(); break; } } PropertiesView propertiesView = new PropertiesView(); propertiesView.open(); try { propertiesView.selectTab("Info"); } catch (SWTLayerException ex) { fail("Properties tab Info is not opened, is image selected in Images Tab?"); } }

Target:
public void testContainerPropertiesTab() { DockerImagesTab imageTab = new DockerImagesTab(); imageTab.activate(); imageTab.refresh(); new WaitWhile(new JobIsRunning()); imageTab.runImage(this.imageName); RunADockerImagePageOneWizard firstPage = new RunADockerImagePageOneWizard(); firstPage.setName(this.containerName); firstPage.finish(); new WaitWhile(new JobIsRunning()); DockerContainersTab containerTab = new DockerContainersTab(); containerTab.activate(); containerTab.refresh(); new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL); containerTab.select(imageName); PropertiesView propertiesView = new PropertiesView(); propertiesView.open(); try { propertiesView.selectTab("Info"); } catch (SWTLayerException ex) { fail("Properties tab Info is not opened, is image selected in Images Tab?"); } }
Source:
Keyword(String searchTerm, boolean isLiteral, boolean isWholeWord) { this.searchTerm = Normalizer.normalize(searchTerm, Normalizer.Form.NFKD);; this.isLiteral = isLiteral; this.isWholeWord = isWholeWord; this.listName = ""; this.originalTerm = searchTerm; }

Target:
Keyword(String searchTerm, boolean isLiteral, boolean isWholeWord) { this(searchTerm, isLiteral, isWholeWord, "", searchTerm); }
Source:
private void fetchMedia(Uri mediaUri) { if (!MediaUtils.isInMediaStore(mediaUri)) { Uri downloadedUri = MediaUtils.downloadExternalMedia(EditPostActivity.this, mediaUri); if (downloadedUri != null) { addMedia(downloadedUri); } else { Toast.makeText(EditPostActivity.this, getString(R.string.error_downloading_image), Toast.LENGTH_SHORT).show(); } } else { addMedia(mediaUri); } }

Target:
private void fetchMedia(Uri mediaUri) { if (!MediaUtils.isInMediaStore(mediaUri)) { Uri downloadedUri = null; try { downloadedUri = MediaUtils.downloadExternalMedia(EditPostActivity.this, mediaUri); } catch (IllegalStateException e) { AppLog.e(AppLog.T.UTILS, "Can't download the image at: " + mediaUri.toString(), e); CrashlyticsUtils.logException(e, AppLog.T.MEDIA, "Can't download the image at: " + mediaUri.toString() + " See issue #5823"); } if (downloadedUri != null) { addMedia(downloadedUri); } else { Toast.makeText(EditPostActivity.this, getString(R.string.error_downloading_image), Toast.LENGTH_SHORT).show(); } } else { addMedia(mediaUri); } }
Source:
public Patient updatePatientMotechId(Config config, String patientUuid, String newMotechId) { Identifier patientIdentifier = getPatientIdentifier(config, patientUuid); patientIdentifier.setIdentifier(newMotechId); String requestJson = buildGson().toJson(patientIdentifier); String responseJson = postForJson(config, requestJson, "/patient/{patientUuid}/identifier/{identifierUuid}", patientUuid, patientIdentifier.getUuid()); return (Patient) JsonUtils.readJson(responseJson, Patient.class); }

Target:
public void updatePatientMotechId(Config config, String patientUuid, String newMotechId) { Identifier patientIdentifier = getPatientIdentifier(config, patientUuid); patientIdentifier.setIdentifier(newMotechId); String requestJson = buildGson().toJson(patientIdentifier); postForJson(config, requestJson, "/patient/{patientUuid}/identifier/{identifierUuid}", patientUuid, patientIdentifier.getUuid()); }
Source:
private List<LUNs> getVgInfo() { if (getParameters().getVgInfo() != null) { return getParameters().getVgInfo(); } GetVGInfoVDSCommandParameters params = new GetVGInfoVDSCommandParameters(getParameters().getVdsId(), getStorageDomain().getStorage()); if (getParameters().getVdsId() == null) { return (List<LUNs>) VdsCommandsHelper.runVdsCommandWithoutFailover( VDSCommandType.GetVGInfo, params, getStoragePoolId(), null).getReturnValue(); } return (List<LUNs>) runVdsCommand(VDSCommandType.GetVGInfo, params).getReturnValue(); }

Target:
private List<LUNs> getVgInfo() { if (getParameters().getVgInfo() != null) { log.debug("Using the virtual group's information from the command's parameters rather" + "than calling getVgInfo and getting the information directly from vdsm."); return getParameters().getVgInfo(); } GetVGInfoVDSCommandParameters params = new GetVGInfoVDSCommandParameters(getParameters().getVdsId(), getStorageDomain().getStorage()); if (getParameters().getVdsId() == null) { return (List<LUNs>) VdsCommandsHelper.runVdsCommandWithoutFailover( VDSCommandType.GetVGInfo, params, getStoragePoolId(), null).getReturnValue(); } return (List<LUNs>) runVdsCommand(VDSCommandType.GetVGInfo, params).getReturnValue(); }
Source:
protected ModelNode invokeCommand(Cache<?, ?> cache, ModelNode operation) throws Exception { cache.getAdvancedCache().getComponentRegistry().start(); return null; }

Target:
protected ModelNode invokeCommand(Cache<?, ?> cache, ModelNode operation) throws Exception { SecurityActions.startCache(cache.getAdvancedCache()); return null; }
Source:
private void dataCenter_SelectedItemChanged() { if (getCurrentStorageItem() instanceof SanStorageModelBase) { SanStorageModelBase sanStorageModel = (SanStorageModelBase) getCurrentStorageItem(); sanStorageModel.updateRemovableLuns(getDataCenter().getSelectedItem().getCompatibilityVersion()); sanStorageModel.getRequireTableRefresh().setEntity(null); sanStorageModel.getRequireTableRefresh().setEntity(true); } updateItemsAvailability(); behavior.updateDataCenterAlert(); }

Target:
private void dataCenter_SelectedItemChanged() { if (getCurrentStorageItem() instanceof SanStorageModelBase) { SanStorageModelBase sanStorageModel = (SanStorageModelBase) getCurrentStorageItem(); sanStorageModel.updateRemovableLuns(getDataCenter().getSelectedItem().getCompatibilityVersion()); } updateItemsAvailability(); behavior.updateDataCenterAlert(); }
Source:
private String getMigrationNetworkIp() { String migrationIp = null; if (FeatureSupported.migrationNetwork(getVm().getVdsGroupCompatibilityVersion())) { Network migrationNetwork = null; List<Network> allNetworksInCluster = DbFacade.getInstance().getNetworkDao().getAllForCluster(getVm().getVdsGroupId()); for (Network tempNetwork : allNetworksInCluster) { if (tempNetwork.getCluster().isMigration()) { migrationNetwork = tempNetwork; break; } } if (migrationNetwork != null) { final List<VdsNetworkInterface> allInterfacesForDstVds = DbFacade.getInstance().getInterfaceDao().getAllInterfacesForVds(getDestinationVds().getId()); for (VdsNetworkInterface nic : allInterfacesForDstVds) { if (migrationNetwork.getName().equals(nic.getNetworkName())) { migrationIp = nic.getAddress(); break; } } } } return migrationIp; }

Target:
private String getMigrationNetworkIp() { if (!FeatureSupported.migrationNetwork(getVm().getVdsGroupCompatibilityVersion())) { return null; } Network migrationNetwork = null; List<Network> allNetworksInCluster = DbFacade.getInstance().getNetworkDao().getAllForCluster(getVm().getVdsGroupId()); for (Network tempNetwork : allNetworksInCluster) { if (tempNetwork.getCluster().isMigration()) { migrationNetwork = tempNetwork; break; } } if (migrationNetwork != null) { final List<VdsNetworkInterface> allInterfacesForDstVds = DbFacade.getInstance().getInterfaceDao().getAllInterfacesForVds(getDestinationVds().getId()); for (VdsNetworkInterface nic : allInterfacesForDstVds) { if (migrationNetwork.getName().equals(nic.getNetworkName())) { return nic.getAddress(); } } } return null; }
Source:
public void testCallTrackers() throws Throwable { InternalOperationContext opCtx = new InternalOperationContext(); opCtx = opCtx.withTracker(new CallTracker() { @Override public boolean isCancelled() { return true; } @Override public Type getType() { return Type.GRPC_CLIENT_TRACKER; } }); opCtx = opCtx.withTracker(new CallTracker() { @Override public boolean isCancelled() { return false; } @Override public Type getType() { return Type.STATE_LOCK_TRACKER; } }); RpcContext rpcCtx = new RpcContext(mMockBDC, mMockJC, opCtx); assertTrue(rpcCtx.isCancelled()); try { rpcCtx.throwIfCancelled(); fail("Call should have been cancelled."); } catch (RuntimeException e) { } }

Target:
public void testCallTrackers() throws Throwable { InternalOperationContext opCtx = new InternalOperationContext(); opCtx = opCtx.withTracker(new CallTracker() { @Override public boolean isCancelled() { return true; } @Override public Type getType() { return Type.GRPC_CLIENT_TRACKER; } }); opCtx = opCtx.withTracker(new CallTracker() { @Override public boolean isCancelled() { return false; } @Override public Type getType() { return Type.STATE_LOCK_TRACKER; } }); RpcContext rpcCtx = new RpcContext(mMockBDC, mMockJC, opCtx); assertTrue(rpcCtx.isCancelled()); mException.expect(RuntimeException.class); rpcCtx.throwIfCancelled(); }
Source:
public void removeProperty(Property property) { if (!decorators.containsKey(property)) return; AbstractSquareDecorator squareToRemove = decorators.get(property); if (squareToRemove.equals(square)) { square = squareToRemove.getSquare(); decorators.remove(property); return; } AbstractSquareDecorator decorator = (AbstractSquareDecorator) ((AbstractSquareDecorator) square) .getSquare(); AbstractSquareDecorator previousDecorator = (AbstractSquareDecorator) square; while (!squareToRemove.equals(decorator)) { previousDecorator = decorator; decorator = (AbstractSquareDecorator) ((AbstractSquareDecorator) decorator).getSquare(); } previousDecorator.setSquare(decorator.getSquare()); decorators.remove(property); }

Target:
public void removeProperty(Property property) { if (!decorators.containsKey(property)) return; AbstractSquareDecorator decoratorToRemove = decorators.get(property); if (decoratorToRemove.equals(square)) { square = decoratorToRemove.getSquare(); decorators.remove(property); } else { AbstractSquareDecorator decorator = (AbstractSquareDecorator) ((AbstractSquareDecorator) square) .getSquare(); AbstractSquareDecorator previousDecorator = (AbstractSquareDecorator) square; while (!decoratorToRemove.equals(decorator)) { previousDecorator = decorator; decorator = (AbstractSquareDecorator) ((AbstractSquareDecorator) decorator) .getSquare(); } previousDecorator.setSquare(decorator.getSquare()); decorators.remove(property); } }
Source:
public TmfExperiment instantiateTrace() { try { refreshSupplementaryFolder(); if (getTraceType() != null) { IConfigurationElement ce = sfTraceTypeAttributes.get(getTraceType()); if (ce == null) { return null; } TmfExperiment experiment = (TmfExperiment) ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR); return experiment; } } catch (CoreException e) { Activator.getDefault().logError("Error instantiating ITmfTrace object for trace " + getName(), e); } return null; }

Target:
public TmfExperiment instantiateTrace() { try { refreshSupplementaryFolder(); if (getTraceType() != null) { IConfigurationElement ce = sfTraceTypeAttributes.get(getTraceType()); if (ce == null) { return null; } TmfExperiment experiment = (TmfExperiment) ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR); return experiment; } } catch (CoreException e) { Activator.getDefault().logError(Messages.TmfExperimentElement_ErrorInstantiatingTrace + getName(), e); } return null; }
Source:
private void updateDiskVmSnapshotId() { Guid snapshotId = getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = ((DiskImage) disk); getImageDao().updateImageVmSnapshotId(diskImage.getImageId(), snapshotId); diskImage.setvm_snapshot_id(snapshotId); } else { throw new VdcBLLException(VdcBllErrors.StorageException, "update of snapshot id was initiated for unsupported disk type"); } }

Target:
private void updateDiskVmSnapshotId() { Guid snapshotId = getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = ((DiskImage) disk); getImageDao().updateImageVmSnapshotId(diskImage.getImageId(), snapshotId); } else { throw new VdcBLLException(VdcBllErrors.StorageException, "update of snapshot id was initiated for unsupported disk type"); } }
Source:
protected void configure() { bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Singleton.class); }

Target:
protected void configure()
Source:
public void testPackagingRetrieve() throws LobException { String id = "1"; Packaging packaging = Packaging.retrieve(id, Lob.apiKey); assertEquals("1", packaging.getId()); assertEquals("Smart Packaging", packaging.getName()); assertEquals("Automatically determined optimal packaging for safe and secure delivery", packaging.getDescription()); assertEquals("packaging", packaging.getObject()); }

Target:
public void testPackagingRetrieve() throws LobException { String id = "1"; Packaging packaging = Packaging.retrieve(id, Lob.apiKey); assertEquals("1", packaging.getId()); assertEquals("Smart Packaging", packaging.getName()); assertTrue(packaging.getDescription().length() > 0); assertEquals("packaging", packaging.getObject()); }
Source:
List<JcrPackage> getJcrPackages(final ResourceResolver resourceResolver, final String[] paths) { final List<JcrPackage> packages = new ArrayList<JcrPackage>(); for (final String path : paths) { final Resource eventResource = resourceResolver.getResource(path); JcrPackage jcrPackage = null; try { jcrPackage = packaging.open(eventResource.adaptTo(Node.class), false); if (jcrPackage != null) { packages.add(jcrPackage); } } catch (RepositoryException e) { log.warn("Error checking if the path [ ] is a JCR Package.", path); } finally { if (jcrPackage != null) { jcrPackage.close(); } } } return packages; }

Target:
private List<JcrPackage> getJcrPackages(final ResourceResolver resourceResolver, final String[] paths) { final List<JcrPackage> packages = new ArrayList<JcrPackage>(); for (final String path : paths) { final Resource eventResource = resourceResolver.getResource(path); JcrPackage jcrPackage = null; try { jcrPackage = packaging.open(eventResource.adaptTo(Node.class), false); if (jcrPackage != null) { packages.add(jcrPackage); } } catch (RepositoryException e) { log.warn("Error checking if the path [ ] is a JCR Package.", path); } } return packages; }
Source:
public static Object percent2( ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB ) throws KettleValueException { if ( dataA == null || dataB == null ) { return null; } switch ( metaA.getType() ) { case ValueMetaInterface.TYPE_NUMBER: return new Double( metaA.getNumber( dataA ).doubleValue() - divideDoubles( multiplyDoubles( metaA.getNumber( dataA ), metaB.getNumber( dataB ) ), 100.0D ) ); case ValueMetaInterface.TYPE_INTEGER: return new Long( metaA.getInteger( dataA ).longValue() - divideLongs( multiplyLongs( metaA.getInteger( dataA ), metaB.getInteger( dataB ) ), 100L ) ); case ValueMetaInterface.TYPE_BIGNUMBER: return metaA.getBigNumber( dataA ).subtract( divideBigDecimals( multiplyBigDecimals( metaB.getBigNumber( dataB ), metaA.getBigNumber( dataA ), null ), new BigDecimal( 100 ) ) ); default: throw new KettleValueException( "The 'A-B%' function only works on numeric data" ); } }

Target:
public static Object percent2( ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB ) throws KettleValueException { if ( dataA == null || dataB == null ) { return null; } switch ( metaA.getType() ) { case ValueMetaInterface.TYPE_NUMBER: return new Double( metaA.getNumber( dataA ).doubleValue() - divideDoubles( multiplyDoubles( metaA.getNumber( dataA ), metaB.getNumber( dataB ) ), 100.0D ) ); case ValueMetaInterface.TYPE_INTEGER: return new Long( metaA.getInteger( dataA ).longValue() - divideLongs( multiplyLongs( metaA.getInteger( dataA ), metaB.getInteger( dataB ) ), 100L ) ); case ValueMetaInterface.TYPE_BIGNUMBER: return metaA.getBigNumber( dataA ).subtract( divideBigDecimals( multiplyBigDecimals( metaB.getBigNumber( dataB ), metaA.getBigNumber( dataA ), null ), new BigDecimal( 100 ), (MathContext) null ) ); default: throw new KettleValueException( "The 'A-B%' function only works on numeric data" ); } }
Source:
public void visitNode(Tree tree) { AnnotationTree annotationTree = (AnnotationTree) tree; if (isSpringWebHandler(annotationTree)) { findParentMethod(annotationTree).ifPresent(annotatedMethod -> reportIssue(annotatedMethod.simpleName(), "Review this Spring request handler")); } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; List<AnnotationTree> annotations = methodTree.modifiers().annotations(); annotations.stream().filter(SpringEndpointsCheck::isSpringWebHandler).forEach(annotationTree -> reportIssue(methodTree.simpleName(), "Review this Spring request handler")); }
Source:
ConstraintFileType(String name, String prefix) { this.name = name; this.prefix = prefix; }

Target:
private ConstraintFileType(String name, String prefix) { this.name = name; this.prefix = prefix; }
Source:
public int compareTo(PersonAttribute other) { int retValue; if ((retValue = OpenmrsUtil.compareWithNullAsGreatest(this.getAttributeType(), other.getAttributeType())) != 0) { return retValue; } if ((retValue = this.isVoided().compareTo(other.isVoided())) != 0) { return retValue; } if ((retValue = OpenmrsUtil.compareWithNullAsLatest(this.getDateCreated(), other.getDateCreated())) != 0) { return retValue; } if ((retValue = OpenmrsUtil.compareWithNullAsGreatest(this.getValue(), other.getValue())) != 0) { return retValue; } return OpenmrsUtil.compareWithNullAsGreatest(this.getPersonAttributeId(), other.getPersonAttributeId()); }

Target:
public int compareTo(PersonAttribute other) { DefaultComparator paDComparator = new DefaultComparator(); return paDComparator.compare(this, other); }
Source:
private IStatus validateImagePath(IValidationContext ctx, ResourceSet rs, String path) { if (!StringUtil.isEmpty(path)) { if (!validateExtension(path)) { return ctx.createFailureStatus(new Object[] { "The path '" + path + "' doesn't correspond to an image." }); } if (!validateExistence(path, rs)) { return ctx.createFailureStatus(new Object[] { "The image '" + path + "' doesn't exist." }); } } return ctx.createSuccessStatus(); }

Target:
private IStatus validateImagePath(IValidationContext ctx, ResourceSet rs, String path) { if (!StringUtil.isEmpty(path)) { if (!validateExtension(path)) { return ctx.createFailureStatus(new Object[] { "The path '" + path + "' does not correspond to an image." }); } if (!validateExistence(path, rs)) { return ctx.createFailureStatus(new Object[] { "The image '" + path + "' does not exist." }); } } return ctx.createSuccessStatus(); }
Source:
private List<List<Map<String, Object>>> accumulateWithIndex(int index, List<List<Map<String, Object>>> accu, Object input) throws NoSuchFieldException { input.getClass().getDeclaredField(keys[index]); List<Map<String, Object>> curList = accu.get(index); Map map = pojoToMap(input,index + 1); curList.add(map); accu.set(index, curList); return accu; }

Target:
private List<List<Map<String, Object>>> accumulateWithIndex(int index, List<List<Map<String, Object>>> accu, Object input) throws NoSuchFieldException { List<Map<String, Object>> curList = accu.get(index); Map map = pojoToMap(input,index + 1); curList.add(map); accu.set(index, curList); return accu; }
Source:
public void clear() { if (!mMap.isEmpty()) { System.out.println("PREDEX CACHE HITS: " + mHits); System.out.println("PREDEX CACHE MISSES: " + mMisses); } mMap.clear(); }

Target:
public synchronized void clear() { if (!mMap.isEmpty()) { System.out.println("PREDEX CACHE HITS: " + mHits); System.out.println("PREDEX CACHE MISSES: " + mMisses); } mMap.clear(); }
Source:
private void updateNetworkClusters(List<Guid> clusterInDataCenterIds, Network externalNetwork, Network networkInDataCenter) { Set<Guid> networkClusters = networkClusterDao.getAllForNetwork(networkInDataCenter.getId()).stream() .map(NetworkCluster::getClusterId) .collect(Collectors.toSet()); List<Guid> clustersToAttach = clusterInDataCenterIds.stream() .filter(id -> !networkClusters.contains(id)) .collect(Collectors.toList()); if (clustersToAttach.size() > 0) { propagateReturnValue(networkHelper.attachNetworkToClusters(networkInDataCenter.getId(), clustersToAttach)); } }

Target:
private void updateNetworkClusters(List<Guid> clusterInDataCenterIds, Network externalNetwork, Network networkInDataCenter) { Set<Guid> networkClustersWithNetwork = networkClusterDao.getAllForNetwork(networkInDataCenter.getId()).stream() .map(NetworkCluster::getClusterId) .collect(Collectors.toSet()); List<Guid> clustersToAttach = clusterInDataCenterIds.stream() .filter(id -> !networkClustersWithNetwork.contains(id)) .collect(Collectors.toList()); if (clustersToAttach.size() > 0) { propagateReturnValue(networkHelper.attachNetworkToClusters(networkInDataCenter.getId(), clustersToAttach)); } }
Source:
public Schema findSchema(String schemaName) { if (schemaName == null) { throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schemaName); } Schema schema = schemas.get(schemaName); if (schema == infoSchema) { initMetaTables(); } return schema; }

Target:
public Schema findSchema(String schemaName) { if (schemaName == null) { return null; } Schema schema = schemas.get(schemaName); if (schema == infoSchema) { initMetaTables(); } return schema; }
Source:
private void setupKeyboardShortcuts() { addEventHandler(KeyEvent.KEY_PRESSED, event -> { if (MAXIMIZE_WINDOW.match(event)) { ui.maximizeWindow(); } if (MINIMIZE_WINDOW.match(event)) { ui.minimizeWindow(); } if (DEFAULT_SIZE_WINDOW.match(event)) { ui.setDefaultWidth(); } if (SWITCH_DEFAULT_REPO.match(event)) { ui.switchDefaultRepo(); } if (SWITCH_BOARD.match(event)) { ui.getMenuControl().switchBoard(); } if (JUMP_TO_FILTER_BOX.match(event)) { setFocusToFilterBox(); } if (JUMP_TO_FIRST_ISSUE.match(event)) { listView.selectNthItem(1); } for (Map.Entry<Integer, KeyCodeCombination> entry : JUMP_TO_NTH_ISSUE_KEYS.entrySet()) { if (entry.getValue().match(event)){ event.consume(); listView.selectNthItem(entry.getKey()); break; } } }); }

Target:
private void setupKeyboardShortcuts() { addEventHandler(KeyEvent.KEY_PRESSED, event -> { if (MAXIMIZE_WINDOW.match(event)) { ui.maximizeWindow(); } else if (MINIMIZE_WINDOW.match(event)) { ui.minimizeWindow(); } else if (DEFAULT_SIZE_WINDOW.match(event)) { ui.setDefaultWidth(); } else if (SWITCH_DEFAULT_REPO.match(event)) { ui.switchDefaultRepo(); } else if (SWITCH_BOARD.match(event)) { ui.getMenuControl().switchBoard(); } else if (JUMP_TO_FILTER_BOX.match(event)) { setFocusToFilterBox(); } }); }
Source:
protected void readFromParcel(Parcel in) { super.readFromParcel(in); genericIntField1 = readInteger(in); genericLongField1 = readLong(in); genericStringField1 = readString(in); genericStringField2 = readString(in); genericBooleanField1 = ParcelCompat.readBoolean(in); genericDoubleField1 = readDouble(in); }

Target:
protected void readFromParcel(Parcel in) { super.readFromParcel(in); genericIntField1 = readInteger(in); genericLongField1 = readLong(in); genericStringField1 = readString(in); genericStringField2 = readString(in); genericBooleanField1 = readBoolean(in); genericDoubleField1 = readDouble(in); }
Source:
private CompletableFuture<Void> visitReadCommand(InvocationContext ctx, FlagAffectedCommand command, Consumer<ConsistentHash> consistentHashUpdater) throws Throwable { if (isLocalOnly(command)) { return ctx.continueInvocation(); } CacheTopology beginTopology = stateTransferManager.getCacheTopology(); consistentHashUpdater.accept(beginTopology.getReadConsistentHash()); updateTopologyId(command); Object returnValue; try { returnValue = ctx.forkInvocationSync(command); } catch (CacheException e) { Throwable ce = e; while (ce instanceof RemoteException) { ce = ce.getCause(); } if (!(ce instanceof OutdatedTopologyException) && !(ce instanceof SuspectException)) throw e; if (trace) log.tracef("Retrying command because of topology change, current topology is %d: %s", currentTopologyId(), command); int newTopologyId = Math.max(currentTopologyId(), command.getTopologyId() + 1); command.setTopologyId(newTopologyId); waitForTopology(newTopologyId); return visitReadCommand(ctx, command, consistentHashUpdater); } return ctx.shortCircuit(returnValue); }

Target:
private CompletableFuture<Void> visitReadCommand(InvocationContext ctx, FlagAffectedCommand command, Consumer<ConsistentHash> consistentHashUpdater) throws Throwable { if (isLocalOnly(command)) { return ctx.continueInvocation(); } CacheTopology beginTopology = stateTransferManager.getCacheTopology(); consistentHashUpdater.accept(beginTopology.getReadConsistentHash()); updateTopologyId(command); try { return ctx.shortCircuit(ctx.forkInvocationSync(command)); } catch (CacheException e) { Throwable ce = e; while (ce instanceof RemoteException) { ce = ce.getCause(); } if (!(ce instanceof OutdatedTopologyException) && !(ce instanceof SuspectException)) throw e; if (trace) log.tracef("Retrying command because of topology change, current topology is %d: %s", currentTopologyId(), command); int newTopologyId = Math.max(currentTopologyId(), command.getTopologyId() + 1); command.setTopologyId(newTopologyId); waitForTopology(newTopologyId); return visitReadCommand(ctx, command, consistentHashUpdater); } }
Source:
abstract protected void notifyListener(RunListener each) throws Exception; } public void fireTestRunStarted(final Description description) { loadListeners(); new SafeNotifier() { @Override protected void notifyListener(RunListener each) throws Exception { each.testRunStarted(description); } }.run(); }

Target:
abstract protected void notifyListener(RunListener each) throws Exception; } public void fireTestRunStarted(final Description description) { new SafeNotifier() { @Override protected void notifyListener(RunListener each) throws Exception { each.testRunStarted(description); } }.run(); }
Source:
private Map<K, V> getAllInternal(Set<? extends K> keys, boolean includeNulls) throws BulkCacheLoadingException { getAllObserver.begin(); statusTransitioner.checkAvailable(); checkNonNullContent(keys); if(keys.isEmpty()) { getAllObserver.end(GetAllOutcome.SUCCESS); return Collections.emptyMap(); } GetAllFunction<K, V> getAllFunction = new GetAllFunction<K, V>(); Map<K, V> result = new HashMap<K, V>(); try { Map<K, Store.ValueHolder<V>> computedMap = store.bulkComputeIfAbsent(keys, getAllFunction); int hits = 0; int keyCount = 0; for (Map.Entry<K, Store.ValueHolder<V>> entry : computedMap.entrySet()) { keyCount++; if (entry.getValue() != null) { result.put(entry.getKey(), entry.getValue().value()); hits++; } else if (includeNulls) { result.put(entry.getKey(), null); } } addBulkMethodEntriesCount(BulkOps.GET_ALL_HITS, hits); addBulkMethodEntriesCount(BulkOps.GET_ALL_MISS, keyCount - hits); getAllObserver.end(GetAllOutcome.SUCCESS); return result; } catch (StoreAccessException e) { try { return resilienceStrategy.getAllFailure(keys, e); } finally { getAllObserver.end(GetAllOutcome.FAILURE); } } }

Target:
private Map<K, V> getAllInternal(Set<? extends K> keys, boolean includeNulls) throws BulkCacheLoadingException { getAllObserver.begin(); statusTransitioner.checkAvailable(); checkNonNullContent(keys); if(keys.isEmpty()) { getAllObserver.end(GetAllOutcome.SUCCESS); return Collections.emptyMap(); } Map<K, V> result = new HashMap<K, V>(); try { Map<K, Store.ValueHolder<V>> computedMap = store.bulkComputeIfAbsent(keys, new GetAllFunction<K, V>()); int hits = 0; int keyCount = 0; for (Map.Entry<K, Store.ValueHolder<V>> entry : computedMap.entrySet()) { keyCount++; if (entry.getValue() != null) { result.put(entry.getKey(), entry.getValue().value()); hits++; } else if (includeNulls) { result.put(entry.getKey(), null); } } addBulkMethodEntriesCount(BulkOps.GET_ALL_HITS, hits); addBulkMethodEntriesCount(BulkOps.GET_ALL_MISS, keyCount - hits); getAllObserver.end(GetAllOutcome.SUCCESS); return result; } catch (StoreAccessException e) { try { return resilienceStrategy.getAllFailure(keys, e); } finally { getAllObserver.end(GetAllOutcome.FAILURE); } } }
Source:
public ConfigFormat getSyntax() { return syntax; }

Target:
public ConfigSyntax getSyntax() { ConfigFormat format = getFormat(); if(format instanceof ConfigSyntax) { return (ConfigSyntax)format; } return null; }
Source:
public void setProgress(float progress, boolean immediate) { if (mFadeDrawable.getDrawable(PROGRESS_BAR_IMAGE_INDEX) != null) { mFadeDrawable.beginBatchMode(); setProgress(progress); if (immediate) { mFadeDrawable.finishTransitionImmediately(); } mFadeDrawable.endBatchMode(); } }

Target:
public void setProgress(float progress, boolean immediate) { if (mFadeDrawable.getDrawable(PROGRESS_BAR_IMAGE_INDEX) == null) { return; } mFadeDrawable.beginBatchMode(); setProgress(progress); if (immediate) { mFadeDrawable.finishTransitionImmediately(); } mFadeDrawable.endBatchMode(); }
Source:
private void updateFeatureGroupSum(ArtifactReadable item, TreeMap<String, FeatureGroupSum> featureSums, double points) { ArtifactReadable featureGroup = item.getRelated(AtsRelationTypes.AgileFeatureToItem_FeatureGroup).getExactlyOne(); FeatureGroupSum feature = featureSums.get(featureGroup.getName()); if (feature == null) { feature = new FeatureGroupSum(featureGroup.getName(), featureGroup.getSoleAttributeAsString(AtsAttributeTypes.Description, "")); feature.addToSum(points); } else { feature.addToSum(points); } featureSums.put(featureGroup.getName(), feature); }

Target:
private void updateFeatureGroupSum(ArtifactReadable item, TreeMap<String, FeatureGroupSum> featureSums, double points) { ArtifactReadable featureGroup = item.getRelated(AtsRelationTypes.AgileFeatureToItem_FeatureGroup).getExactlyOne(); FeatureGroupSum feature = featureSums.get(featureGroup.getName()); if (feature == null) { feature = new FeatureGroupSum(featureGroup.getName(), featureGroup.getSoleAttributeAsString(AtsAttributeTypes.Description, "")); } feature.addToSum(points); featureSums.put(featureGroup.getName(), feature); }
Source:
public static boolean isNonVmNonVlanNetwork(Network network) { return !network.isVmNetwork() && network.getVlanId() == null; }

Target:
public static boolean isNonVmNonVlanNetwork(Network network) { return !network.isVmNetwork() && !isVlan(network); }
Source:
private char[] getSigningKeyPassphrase(char[] signingKeyPassphrase) throws AliasServiceException { return (signingKeyPassphrase != null) ? signingKeyPassphrase : cachedSigningKeyPassphrase; }

Target:
private char[] getSigningKeyPassphrase(char[] signingKeyPassphrase) { return (signingKeyPassphrase != null) ? signingKeyPassphrase : cachedSigningKeyPassphrase; }
Source:
public final boolean shouldTraverse(NodeTraversal nodeTraversal, Node n, Node parent) { if (isDone()) { return false; } if (n.isScript() || n.isModuleBody()) { return true; } int line = n.getLineno(); if (getLastLineOfCurrentComment() > line) { return true; } boolean outputCommentAfterLine = false; while (hasRemainingComments() && !isCommentAdjacentToLine(line)) { if (getLastLineOfCurrentComment() > line) { return true; } if (getFirstLineOfNextComment() - getLastLineOfCurrentComment() > 1) { outputFloatingCommentFromBuffer(n); } addNextCommentToBuffer(); outputCommentAfterLine = true; } if (getLastLineOfCurrentComment() == line) { if (parent.isCall()) { if (n.getNext() == null) { linkCommentBufferToNode(n); } else { int endOfComment = getCurrentComment().location.end.column; int startOfNextNode = n.getNext().getCharno(); if (endOfComment < startOfNextNode) { String lineContents = compiler .getInput(new InputId(n.getSourceFileName())) .getSourceFile() .getLine(line); String interval = lineContents.substring(endOfComment, startOfNextNode); if (interval.contains(",")) { linkCommentBufferToNode(n); } else { linkCommentBufferToNode(n.getNext()); } } else { return true; } } } else if (getCurrentComment().location.end.column < n.getCharno()) { linkCommentBufferToNode(n); } else { return true; } } else if (getLastLineOfCurrentComment() == line - 1) { linkCommentBufferToNode(n); } else if (!hasRemainingComments() && !outputCommentAfterLine) { outputFloatingCommentFromBuffer(n); } if (!outputCommentAfterLine) { addNextCommentToBuffer(); } return true; }

Target:
public final boolean shouldTraverse(NodeTraversal nodeTraversal, Node n, Node parent) { if (isDone()) { return false; } if (n.isScript() || n.isModuleBody()) { return true; } int line = n.getLineno(); if (getLastLineOfCurrentComment() > line) { return true; } boolean outputCommentAfterLine = false; while (hasRemainingComments() && !isCommentAdjacentToLine(line)) { if (getLastLineOfCurrentComment() > line) { return true; } if (getFirstLineOfNextComment() - getLastLineOfCurrentComment() > 1) { outputFloatingCommentFromBuffer(n); } addNextCommentToBuffer(); outputCommentAfterLine = true; } if (getLastLineOfCurrentComment() == line) { if (parent.isCall()) { if (linkFunctionArgs(n, line)) return true; } else if (getCurrentComment().location.end.column < n.getCharno()) { linkCommentBufferToNode(n); } else { return true; } } else if (getLastLineOfCurrentComment() == line - 1) { linkCommentBufferToNode(n); } else if (!hasRemainingComments() && !outputCommentAfterLine) { outputFloatingCommentFromBuffer(n); } if (!outputCommentAfterLine) { addNextCommentToBuffer(); } return true; }
Source:
public void newInstanceBis() throws IllegalAccessException, InstantiationException { try { if (constructor == null) { this.setDynaBeanClass(); } return ((DynaBean) constructor.newInstance(constructorValues)); } catch (final InvocationTargetException e) { throw new InstantiationException (e.getTargetException().getMessage()); } }

Target:
public void newInstanceBis() throws IllegalAccessException, InstantiationException { if (constructor == null) { this.setDynaBeanClass(); } return ((DynaBean) constructor.newInstance(constructorValues)); }
Source:
private void updateDetailMetric(final CollectArraysVariantCallingMetrics.ArraysVariantCallingDetailMetrics metric, final Genotype genotype, final VariantContext vc, final boolean hasSingletonSample) { if (!vc.getCommonInfo().getFilters().contains(InfiniumVcfFields.ZEROED_OUT_ASSAY)) { metric.TOTAL_ASSAYS++; if (genotype.isCalled()) { metric.NUM_CALLS++; String gtA = (String) genotype.getExtendedAttribute(InfiniumVcfFields.GTA, genotype.getGenotypeString()); if (!gtA.equals(VCFConstants.EMPTY_GENOTYPE)) { metric.NUM_AUTOCALL_CALLS++; } } else { metric.NUM_NO_CALLS++; } if (hasSingletonSample) { ++metric.NUM_SINGLETONS; } if (vc.isSNP()) { final boolean isInDbSnp = dbsnp.snps.isDbSnpSite(vc.getContig(), vc.getStart()); metric.TOTAL_SNPS++; if (isInDbSnp) { metric.NUM_IN_DB_SNP++; } } else if (vc.isIndel()) { metric.TOTAL_INDELS++; } } if (vc.isFiltered()) { metric.FILTERED_SNPS++; } if (genotype != null && !vc.isFiltered()) { if (genotype.isHet()) { metric.numHets++; } else if (genotype.isHomVar()) { metric.numHomVar++; } } }

Target:
private void updateDetailMetric(final CollectArraysVariantCallingMetrics.ArraysVariantCallingDetailMetrics metric, final Genotype genotype, final VariantContext vc, final boolean hasSingletonSample) { metric.NUM_ASSAYS++; if (!vc.isFiltered() || vc.getCommonInfo().getFilters().contains(InfiniumVcfFields.DUPE)) { metric.NUM_NON_FILTERED_ASSAYS++; if (genotype.isCalled()) { metric.NUM_CALLS++; String gtA = (String) genotype.getExtendedAttribute(InfiniumVcfFields.GTA, genotype.getGenotypeString()); if (!gtA.equals(VCFConstants.EMPTY_GENOTYPE)) { metric.NUM_AUTOCALL_CALLS++; } } else { metric.NUM_NO_CALLS++; } if (vc.isSNP()) { final boolean isInDbSnp = dbsnp.snps.isDbSnpSite(vc.getContig(), vc.getStart()); metric.NUM_SNPS++; if (isInDbSnp) { metric.NUM_IN_DB_SNP++; } } else if (vc.isIndel()) { metric.NUM_INDELS++; } if (hasSingletonSample) { metric.NUM_SINGLETONS++; } if (genotype.isHet()) { metric.numHets++; } else if (genotype.isHomVar()) { metric.numHomVar++; } } else { metric.NUM_FILTERED_ASSAYS++; if (vc.getCommonInfo().getFilters().contains(InfiniumVcfFields.ZEROED_OUT_ASSAY)) { metric.NUM_ZEROED_OUT_ASSAYS++; } } }
Source:
public void testCardinalityNullArray() { String projection = "cardinality(merge_hll(ARRAY[null, null, null]))"; assertFunction(projection, BIGINT, null); }

Target:
public void testCardinalityNullArray() { assertFunction("cardinality(merge_hll(null))", BIGINT, null); }
Source:
public static Date parse(String value) throws ParseException { if(StringUtils.isEmpty(value)) { throw new ParseException("Unparseable date: \"" + value + "\"", 0); } String modValue = value.substring(0, value.length()-1) + "GMT-00:00"; SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); return parser.parse(modValue); }

Target:
public static Date parse(String value) throws ParseException { if(StringUtils.isEmpty(value)) { throw new ParseException("Date is not provided", 0); } String modValue = value.substring(0, value.length()-1) + "GMT-00:00"; SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); return parser.parse(modValue); }