auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private mxCell getOrCreateVertex(AccountDeviceInstance adi, CommunicationsManager commsManager, CommunicationsFilter currentFilter) { final AccountDeviceInstance accountDeviceInstance = adi; final String name = accountDeviceInstance.getAccount().getTypeSpecificID(); final mxCell vertex = nodeMap.computeIfAbsent(name + accountDeviceInstance.getDeviceId(), vertexName -> { long adiRelationshipsCount = 1; try { adiRelationshipsCount = commsManager.getRelationshipSourcesCount(accountDeviceInstance, currentFilter); } catch (TskCoreException tskCoreException) { <START> logger.log(Level.SEVERE, "Error", tskCoreException); <END> } double size = Math.sqrt(adiRelationshipsCount) + 10; AccountDeviceInstanceKey adiKey = new AccountDeviceInstanceKey(adi, currentFilter, adiRelationshipsCount); mxCell newVertex = (mxCell) insertVertex( getDefaultParent(), name, adiKey, Math.random() * 400, Math.random() * 400, size, size); return newVertex; }); return vertex; }</code><technical_language>Please error more informative</technical_language>

Target:
private mxCell getOrCreateVertex(AccountDeviceInstance adi, CommunicationsManager commsManager, CommunicationsFilter currentFilter) { final AccountDeviceInstance accountDeviceInstance = adi; final String name = accountDeviceInstance.getAccount().getTypeSpecificID(); final mxCell vertex = nodeMap.computeIfAbsent(name + accountDeviceInstance.getDeviceId(), vertexName -> { long adiRelationshipsCount = 1; try { adiRelationshipsCount = commsManager.getRelationshipSourcesCount(accountDeviceInstance, currentFilter); } catch (TskCoreException tskCoreException) { logger.log(Level.SEVERE, "There was an error fetching relationships for the node: " + accountDeviceInstance, tskCoreException); } double size = Math.sqrt(adiRelationshipsCount) + 10; AccountDeviceInstanceKey adiKey = new AccountDeviceInstanceKey(adi, currentFilter, adiRelationshipsCount); mxCell newVertex = (mxCell) insertVertex( getDefaultParent(), name, adiKey, Math.random() * 400, Math.random() * 400, size, size); return newVertex; }); return vertex; }
Source:
<code>private String cutTrailingZerosofString(String number) { BigDecimal decimal = new BigDecimal(number); if (decimal.compareTo(BigDecimal.ZERO) == 0) { <START> decimal = BigDecimal.ZERO; <END> } else { decimal = decimal.stripTrailingZeros(); } return decimal.toPlainString(); }</code><technical_language>Please explain. If of negative zero, please provide a code snippet result is -0 this code</technical_language>

Target:
private String cutTrailingZerosofString(String number) { return new BigDecimal(number).stripTrailingZeros().toPlainString(); }
Source:
<code>public VectorizedParquetRecordReader( InputSplit inputSplit, JobConf conf) { try { serDeStats = new SerDeStats(); projectionPusher = new ProjectionPusher(); initialize(inputSplit, conf); colsToInclude = ColumnProjectionUtils.getReadColumnIDs(conf); <START> rbCtx = new VectorizedRowBatchCtx(); <END> rbCtx.init(createStructObjectInspector(), new String[0]); } catch (Throwable e) { LOG.error("Failed to create the vectorized reader due to exception " + e); throw new RuntimeException(e); } }</code><technical_language>in this constructor rbCtx is initialized in a constructor</technical_language>

Target:
public VectorizedParquetRecordReader( InputSplit inputSplit, JobConf conf) { try { serDeStats = new SerDeStats(); projectionPusher = new ProjectionPusher(); initialize(inputSplit, conf); colsToInclude = ColumnProjectionUtils.getReadColumnIDs(conf); rbCtx = Utilities.getVectorizedRowBatchCtx(conf); } catch (Throwable e) { LOG.error("Failed to create the vectorized reader due to exception " + e); throw new RuntimeException(e); } }
Source:
<code>public static QC to(QcDto dto) { QC to; switch (dto.getType().getQcTarget()) { <START> case "Library": <END> LibraryQC newLibraryQc = new LibraryQC(); Library ownerLibrary = new LibraryImpl(); ownerLibrary.setId(dto.getEntityId()); newLibraryQc.setLibrary(ownerLibrary); to = newLibraryQc; break; case "Sample": SampleQC newSampleQc = new SampleQC(); Sample ownerSample = new SampleImpl(); ownerSample.setId(dto.getEntityId()); newSampleQc.setSample(ownerSample); to = newSampleQc; break; case "Pool": PoolQC newPoolQc = new PoolQC(); Pool ownerPool = new PoolImpl(); ownerPool.setId(dto.getEntityId()); newPoolQc.setPool(ownerPool); to = newPoolQc; break; default: throw new IllegalArgumentException("No such QC target: " + dto.getType().getQcTarget()); } if (dto.getId() != null) { to.setId(dto.getId()); } to.setDate(parseDate(dto.getDate())); to.setResults(dto.getResults()); to.setType(to(dto.getType())); return to; }</code><technical_language>Strings in enum constants in classes</technical_language>

Target:
public static QC to(QcDto dto) { QC to; switch (dto.getType().getQcTarget()) { case Library: LibraryQC newLibraryQc = new LibraryQC(); Library ownerLibrary = new LibraryImpl(); ownerLibrary.setId(dto.getEntityId()); newLibraryQc.setLibrary(ownerLibrary); to = newLibraryQc; break; case Sample: SampleQC newSampleQc = new SampleQC(); Sample ownerSample = new SampleImpl(); ownerSample.setId(dto.getEntityId()); newSampleQc.setSample(ownerSample); to = newSampleQc; break; case Pool: PoolQC newPoolQc = new PoolQC(); Pool ownerPool = new PoolImpl(); ownerPool.setId(dto.getEntityId()); newPoolQc.setPool(ownerPool); to = newPoolQc; break; default: throw new IllegalArgumentException("No such QC target: " + dto.getType().getQcTarget()); } if (dto.getId() != null) { to.setId(dto.getId()); } to.setDate(parseDate(dto.getDate())); to.setResults(dto.getResults()); to.setType(to(dto.getType())); return to; }
Source:
<code>public void beginRecognizeReceiptsWithOptions() throws IOException { File sourceFile = new File("{file_source_url}"); Flux<ByteBuffer> buffer = Utility.convertStreamToByteBuffer( new ByteArrayInputStream(Files.readAllBytes(sourceFile.toPath()))); <START> formRecognizerAsyncClient.beginRecognizeReceipts(buffer, sourceFile.length(), FormContentType.IMAGE_JPEG, true, <END> Duration.ofSeconds(5)).subscribe(trainingOperationResponse -> { System.out.println("Polling completed successfully"); trainingOperationResponse.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedReceipt -> { USReceipt usReceipt = ReceiptExtensions.asUSReceipt(recognizedReceipt); System.out.printf("Page Number: %s%n", usReceipt.getMerchantName().getPageNumber()); System.out.printf("Merchant Name %s%n", usReceipt.getMerchantName().getName()); System.out.printf("Merchant Name Value: %s%n", usReceipt.getMerchantName().getFieldValue()); System.out.printf("Merchant Address %s%n", usReceipt.getMerchantAddress().getName()); System.out.printf("Merchant Address Value: %s%n", usReceipt.getMerchantAddress().getFieldValue()); System.out.printf("Total: %s%n", usReceipt.getTotal().getName()); System.out.printf("Total Value: %s%n", usReceipt.getTotal().getFieldValue()); })); }); END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeReceipts#Flux-long-FormContentType-boolean-Duration }</code><technical_language>passing includeTextDetails true show in code access form content</technical_language>

Target:
public void beginRecognizeReceiptsWithOptions() throws IOException { File sourceFile = new File("{file_source_url}"); boolean includeTextDetails = true; Flux<ByteBuffer> buffer = Utility.convertStreamToByteBuffer( new ByteArrayInputStream(Files.readAllBytes(sourceFile.toPath()))); formRecognizerAsyncClient.beginRecognizeReceipts(buffer, sourceFile.length(), FormContentType.IMAGE_JPEG, includeTextDetails, Duration.ofSeconds(5)).subscribe(recognizePollingOperation -> { recognizePollingOperation.getFinalResult().subscribe(recognizedReceipts -> recognizedReceipts.forEach(recognizedReceipt -> { USReceipt usReceipt = ReceiptExtensions.asUSReceipt(recognizedReceipt); System.out.printf("Page Number: %s%n", usReceipt.getMerchantName().getPageNumber()); System.out.printf("Merchant Name: %s, confidence: %.2f%n", usReceipt.getMerchantName().getFieldValue(), usReceipt.getMerchantName().getConfidence()); System.out.printf("Merchant Address: %s, confidence: %.2f%n", usReceipt.getMerchantAddress().getFieldValue(), usReceipt.getMerchantAddress().getConfidence()); System.out.printf("Merchant Phone Number %s, confidence: %.2f%n", usReceipt.getMerchantPhoneNumber().getFieldValue(), usReceipt.getMerchantPhoneNumber().getConfidence()); System.out.printf("Total: %.2f, confidence: %.2f%n", usReceipt.getTotal().getFieldValue(), usReceipt.getTotal().getConfidence()); })); }); END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeReceipts#Flux-long-FormContentType-boolean-Duration }
Source:
<code>public <T> void setAttribute(Class<T> clazz, T value) { if (value == null) { removeAttribute(clazz); } else { synchronized (this) { <START> checkType(clazz); <END> context.setAttribute(clazz.getName(), value); } } }</code><technical_language>is a genuine risk multiple sources try set lookup time ? wondering this synchronize access storing attributes vaadin servlet context, lookup. wondering if synchronization access another API, getAttribute is synchronized. this is fine thinking out loud</technical_language>

Target:
public <T> void setAttribute(Class<T> clazz, T value) { if (value == null) { removeAttribute(clazz); } else { synchronized (getContext()) { checkLookupDuplicate(clazz); getContext().setAttribute(clazz.getName(), value); } } }
Source:
<code>protected void registerExtraDatabaseTypes( Properties configuration ) throws KettlePluginException { <START> String impalaSimbaDriverName = <END> configuration.getProperty( "impala.simba.driver", "com.cloudera.impala.jdbc41.Driver" ); JDBC_POSSIBLE_DRIVER_MAP.put( "ImpalaSimba", impalaSimbaDriverName ); }</code><technical_language>need impala for hdi35, Cloudera only</technical_language>

Target:
protected void registerExtraDatabaseTypes( Properties configuration ) throws KettlePluginException { }
Source:
<code>public Set<Feature> getWordFeatures(TextAnnotation ta, int wordPosition) throws EdisonException { if (data.size() == 0) loadData(); String lemma = WordHelpers.getLemma(ta, wordPosition); Set<Feature> features = new LinkedHashSet<>(); if (data.containsKey(lemma)) { <START> String tmp = data.get("give"); <END> features.add(DiscreteFeature.create(data.get(lemma))); } return features; }</code><technical_language>this line</technical_language>

Target:
public Set<Feature> getWordFeatures(TextAnnotation ta, int wordPosition) throws EdisonException { if (data.size() == 0) loadData(); String lemma = WordHelpers.getLemma(ta, wordPosition); Set<Feature> features = new LinkedHashSet<>(); if (data.containsKey(lemma)) { features.add(DiscreteFeature.create(data.get(lemma))); } return features; }
Source:
<code>public Optional<AuthorData> createFrom(DataHolder dataHolder) { if (dataHolder instanceof ItemStack) { <START> if (((ItemStack) dataHolder).getItem() != Items.writable_book || ((ItemStack) dataHolder).getItem() != Items.written_book) { <END> return Optional.empty(); } if (((ItemStack) dataHolder).getTagCompound() == null || ((ItemStack) dataHolder).getTagCompound().hasKey(NbtDataUtil.ITEM_BOOK_AUTHOR)) { return Optional.<AuthorData>of(new SpongeAuthorData()); } final String json = ((ItemStack) dataHolder).getTagCompound().getString(NbtDataUtil.ITEM_BOOK_AUTHOR); final Text author = Texts.json().fromUnchecked(json); return Optional.<AuthorData>of(new SpongeAuthorData(author)); } else { return Optional.empty(); } }</code><technical_language>This AND, OR</technical_language>

Target:
public Optional<AuthorData> createFrom(DataHolder dataHolder) { if (dataHolder instanceof ItemStack) { if (((ItemStack) dataHolder).getItem() != Items.writable_book && ((ItemStack) dataHolder).getItem() != Items.written_book) { return Optional.empty(); } if (!((ItemStack) dataHolder).hasTagCompound() || !((ItemStack) dataHolder).getTagCompound().hasKey(NbtDataUtil.ITEM_BOOK_AUTHOR)) { return Optional.<AuthorData>of(new SpongeAuthorData()); } final String json = ((ItemStack) dataHolder).getTagCompound().getString(NbtDataUtil.ITEM_BOOK_AUTHOR); final Text author = Texts.json().fromUnchecked(json); return Optional.<AuthorData>of(new SpongeAuthorData(author)); } else { return Optional.empty(); } }
Source:
<code>public void horizontalConflictWithThreeQueens() { Queen queen1 = new Queen(0, row1, column1); Queen queen2 = new Queen(1, row1, column2); Queen queen3 = new Queen(2, row1, column3); constraintVerifier.forConstraint(constraintProvider::horizontalConflict) .given(queen1, queen2, queen3) <START> .expectReward(3); <END> }</code><technical_language>Code syntax method parameters great. for difficult part: naming. want settle names? - forConstraint(): +0.8 (like Class.forName()). -- alternatives: ofConstraint()= +1 (like LocalTime.of()) - given: +1 (short sweet) -- alternatives: givenFacts +0 (more descriptive) - expectReward: +0 -- alternatives: assertReward: +1 (because of JUnit's assertEquals(expeted, actual))</technical_language>

Target:
public void horizontalConflictWithThreeQueens() { Queen queen1 = new Queen(0, row1, column1); Queen queen2 = new Queen(1, row1, column2); Queen queen3 = new Queen(2, row1, column3); constraintVerifier.verifyThat(constraintProvider::horizontalConflict) .given(queen1, queen2, queen3) .penalizesBy(3); }
Source:
<code><START> public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { <END> View view = inflater.inflate(R.layout.list_fragment, container, false); adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1); ListView listView = (ListView) view.findViewById(android.R.id.list); listView.setAdapter(adapter); AndroidObservable.bindFragment(this, SampleObservables.numberStrings(1, 500, 100)) .observeOn(mainThread()) .lift(new BindAdapter()) .subscribe(); final ProgressBar progressBar = (ProgressBar) view.findViewById(android.R.id.progress); AndroidObservable.bindFragment(this, ViewObservable.listViewScroll(listView)) .subscribe(new Action1<OnListViewScrollEvent>() { @Override public void call(OnListViewScrollEvent event) { if (event.totalItemCount == 0) { return; } int progress = (int) ((100.0 * (event.firstVisibleItem + event.visibleItemCount)) / event.totalItemCount); progressBar.setProgress(progress); } }); return view; }</code><technical_language>@mttkay define kinds of sample a cohesive sample application? I if some sort of "theme" sample app a good idea</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.list_fragment, container, false); adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1); ListView listView = (ListView) view.findViewById(android.R.id.list); listView.setAdapter(adapter); AndroidObservable.bindFragment(this, SampleObservables.numberStrings(1, 500, 100)) .observeOn(mainThread()) .lift(new BindAdapter()) .subscribe(); final ProgressBar progressBar = (ProgressBar) view.findViewById(android.R.id.progress); AndroidObservable.bindFragment(this, ViewObservable.listScrollEvents(listView)) .subscribe(new Action1<OnListViewScrollEvent>() { @Override public void call(OnListViewScrollEvent event) { if (event.totalItemCount == 0) { return; } int progress = (int) ((100.0 * (event.firstVisibleItem + event.visibleItemCount)) / event.totalItemCount); progressBar.setProgress(progress); } }); return view; }
Source:
<code>protected void commitFile(JobContext job, Path source, Path target) throws IOException { <START> log.info(String.format("Overwriting %s to %s", source, target)); <END> try { FileContext.getFileContext(job.getConfiguration()).rename(source, target, Options.Rename.OVERWRITE); } catch (Exception e) { log.error(String.format("Failed to overwrite from %s to %s", source, target)); throw new IOException(String.format("Failed to overwrite from %s to %s", source, target)); } }</code><technical_language>confusing 'Overwriting' times. If file exist, is norm, 'overwriting'. Is a burden check if file exists log message that? if is needed, nice this happens</technical_language>

Target:
protected void commitFile(JobContext job, Path source, Path target) throws IOException { if (FileSystem.get(job.getConfiguration()).exists(target)) { log.info(String.format("Overwriting %s to %s", source, target)); try { FileContext.getFileContext(job.getConfiguration()).rename(source, target, Options.Rename.OVERWRITE); } catch (Exception e) { log.error(String.format("Failed to overwrite from %s to %s", source, target)); throw new IOException(String.format("Failed to overwrite from %s to %s", source, target)); } } else { super.commitFile(job, source, target); } }
Source:
<code>public Comparator getComparator() { <START> return (Comparator<Object>) (o1, o2) -> { <END> try { if (o1 instanceof ByteBuffer && o2 instanceof ByteBuffer) { BloomKFilter o1f = BloomKFilter.deserialize((ByteBuffer) o1); BloomKFilter o2f = BloomKFilter.deserialize((ByteBuffer) o2); return Ints.compare(o1f.getNumSetBits(), o2f.getNumSetBits()); } else if (o1 instanceof BloomKFilter && o2 instanceof BloomKFilter) { BloomKFilter o1f = (BloomKFilter) o1; BloomKFilter o2f = (BloomKFilter) o2; return Ints.compare(o1f.getNumSetBits(), o2f.getNumSetBits()); } else { throw new RE("Unable to compare unexpected types [%s]", o1.getClass().getName()); } } catch (IOException ioe) { throw new RuntimeException("Failed to deserialize BloomKFilter"); } }; }</code><technical_language>this comparator expensive, mention in docs</technical_language>

Target:
public Comparator getComparator() { return COMPARATOR; }
Source:
<code>public void install(File artifact) throws IOException { log.debug(String.format("ConnectorDeployer.install(\"%s\")", artifact.getAbsolutePath())); ConnectorFile configFile = new ConnectorFile(artifact); ConnectorConfiguration newConfig = ConnectorConfigurationUtil.loadFromFile(configFile); authenticate(AUTH_USER, AUTH_PASSWORD); if (newConfig.getContent().getProperties().get(Constants.SERVICE_RANKING) == null && ConnectorFile.isRootService(artifact)) { <START> newConfig.getContent().getProperties().put(Constants.SERVICE_RANKING, "-1"); <END> } try { serviceManager.createService(newConfig.getConnectorId(), newConfig.getContent()); } catch (ServiceValidationFailedException e) { throw new RuntimeException(e); } }</code><technical_language>y -1; Integer.LOWEST</technical_language>

Target:
public void install(File artifact) throws IOException { LOGGER.debug("ConnectorDeployer.install(\"{}\")", artifact.getAbsolutePath()); ConnectorFile configFile = new ConnectorFile(artifact); ConnectorConfiguration newConfig = configFile.load(); authenticate(AUTH_USER, AUTH_PASSWORD); if (newConfig.getContent().getProperties().get(Constants.SERVICE_RANKING) == null && ConnectorFile.isRootService(artifact)) { newConfig.getContent().getProperties().put(Constants.SERVICE_RANKING, "-1"); } LOGGER.info("Loading instance {}", newConfig.getConnectorId()); try { serviceManager.create(newConfig.getConnectorId(), newConfig.getContent()); } catch (ConnectorValidationFailedException e) { throw new RuntimeException(e); } }
Source:
<code>public void setSeverityLevel(int severityLevel) { <START> this.severityLevel = severityLevel; <END> }</code><technical_language>Add check here</technical_language>

Target:
public void setSeverityLevel(int severityLevel) { if (severityLevel < 1 || severityLevel > 5) { throw new IllegalArgumentException("The severty level should be between 1-5"); } this.severityLevel = severityLevel; }
Source:
<code>public void credentialsChanged(Credentials credentials) { <START> executor.needToRefreshCreds = true; <END> }</code><technical_language>Minor: this method name signature needs change is setting a flag supplied parameter</technical_language>

Target:
public void credentialsChanged(Credentials credentials) { executor.setNeedToRefreshCreds(); }
Source:
<code>private static Observable<NetworkStatus.State> createObservable(Merlin merlin) { return Observable.create(new MerlinAction(merlin), Emitter.BackpressureMode.LATEST) <START> .distinctUntilChanged(); <END> }</code><technical_language>distinctUntilChanged before? kinda sense, I if filter event all. Users this right</technical_language>

Target:
private static Observable<NetworkStatus> createObservable(Merlin merlin) { return Observable.create(new MerlinAction(merlin), Emitter.BackpressureMode.LATEST); }
Source:
<code>final AsyncFunction<ResultSet, R> iterate() { return resultSet -> { <START> Preconditions.checkArgument(resultSet != null, "ResultSet should not be null when iterating"); <END> rowStreamAccumulator.accumulateRowStream(Streams.stream(resultSet) .limit(resultSet.getAvailableWithoutFetching())); boolean wasLastPage = resultSet.getExecutionInfo().getPagingState() == null; if (wasLastPage) { return Futures.immediateFuture(rowStreamAccumulator.result()); } else { ListenableFuture<ResultSet> future = resultSet.fetchMoreResults(); return Futures.transformAsync(future, iterate(), executor); } }; }</code><technical_language>control source here, I fair assume null + Preconditions.checkNotNull</technical_language>

Target:
private AsyncFunction<ResultSet, R> iterate() { return resultSet -> { rowStreamAccumulator.accumulateRowStream(Streams.stream(resultSet) .limit(resultSet.getAvailableWithoutFetching())); boolean wasLastPage = resultSet.getExecutionInfo().getPagingState() == null; if (wasLastPage) { return Futures.immediateFuture(rowStreamAccumulator.result()); } else { ListenableFuture<ResultSet> future = resultSet.fetchMoreResults(); return Futures.transformAsync(future, iterate(), executorService); } }; }
Source:
<code>public Page getOutput() { if (!isBlocked().isDone()) { return null; } if (!statisticsAggregationOperator.isFinished()) { <START> verify(statisticsAggregationOperator.isBlocked().isDone()); <END> Page page = statisticsAggregationOperator.getOutput(); if (page == null) { return null; } for (int position = 0; position < page.getPositionCount(); position++) { computedStatisticsBuilder.add(getComputedStatistics(page, position)); } return null; } if (state != State.FINISHING) { return null; } state = State.FINISHED; outputMetadata = tableFinisher.finishTable(fragmentBuilder.build(), computedStatisticsBuilder.build()); PageBuilder page = new PageBuilder(1, TYPES); page.declarePosition(); BIGINT.writeLong(page.getBlockBuilder(0), rowCount); return page.build(); }</code><technical_language>Add a message in case this fails java "aggregation operator blocked"</technical_language>

Target:
public Page getOutput() { if (!isBlocked().isDone()) { return null; } if (!statisticsAggregationOperator.isFinished()) { verify(statisticsAggregationOperator.isBlocked().isDone(), "aggregation operator should not be blocked"); Page page = statisticsAggregationOperator.getOutput(); if (page == null) { return null; } for (int position = 0; position < page.getPositionCount(); position++) { computedStatisticsBuilder.add(getComputedStatistics(page, position)); } return null; } if (state != State.FINISHING) { return null; } state = State.FINISHED; outputMetadata = tableFinisher.finishTable(fragmentBuilder.build(), computedStatisticsBuilder.build()); PageBuilder page = new PageBuilder(1, TYPES); page.declarePosition(); BIGINT.writeLong(page.getBlockBuilder(0), rowCount); return page.build(); }
Source:
<code>private CurrencyAmount(Currency currency, double amount) { <START> ArgChecker.notNull(currency, "currency"); <END> this.currency = currency; this.amount = amount; }</code><technical_language>inline ArgChecker form</technical_language>

Target:
private CurrencyAmount(Currency currency, double amount) { this.currency = ArgChecker.notNull(currency, "currency"); this.amount = amount; }
Source:
<code>protected void addVmWatchdog() { VmWatchdog vmWatchdog = getParameters().getWatchdog(); <START> if (vmWatchdog != null && !VmDeviceUtils.hasWatchdog(getVmTemplateId())) { <END> WatchdogParameters parameters = new WatchdogParameters(); parameters.setId(getParameters().getVmId()); parameters.setAction(vmWatchdog.getAction()); parameters.setModel(vmWatchdog.getModel()); runInternalAction(VdcActionType.AddWatchdog, parameters, cloneContextAndDetachFromParent()); } }</code><technical_language>need 'override' template watchdog (for created vm) if user provided watchdog info</technical_language>

Target:
protected void addVmWatchdog() { VmWatchdog vmWatchdog = getParameters().getWatchdog(); if (vmWatchdog != null) { VdcActionType actionType = VmDeviceUtils.hasWatchdog(getVmTemplateId()) ? VdcActionType.UpdateWatchdog : VdcActionType.AddWatchdog; runInternalAction(actionType, buildAddOrUpdateWatchdogParameters(vmWatchdog), cloneContextAndDetachFromParent()); } }
Source:
<code>public static SecurityPriceInfo ofCurrencyMinorUnit(Currency currency) { int digits = currency.getMinorUnitDigits(); double unitAmount = 1; <START> for (int i = 0; i < digits; i++) { <END> unitAmount = unitAmount / 10; } return new SecurityPriceInfo(unitAmount, CurrencyAmount.of(currency, unitAmount), 1); }</code><technical_language>double unitAmount = Math.pow(10, -currency.getMinorUnitDigits()):</technical_language>

Target:
public static SecurityPriceInfo ofCurrencyMinorUnit(Currency currency) { int digits = currency.getMinorUnitDigits(); double unitAmount = Math.pow(10, -digits); return new SecurityPriceInfo(unitAmount, CurrencyAmount.of(currency, unitAmount), 1); }
Source:
<code>public Object getTarget() { if (!SKIP_PERMISSION_CHECK) { <START> Jenkins.get().checkPermission(Jenkins.SYSTEM_READ); <END> } return this; }</code><technical_language>solution in large Overall/Manage PR instead, please</technical_language>

Target:
public Object getTarget() { if (!SKIP_PERMISSION_CHECK) { Jenkins.get().checkPermission(Jenkins.ADMINISTER); } return this; }
Source:
<code>public void dataStoredProperly() throws Exception { final long before = this.now(); final Comment comment = this.comment(); final long after = this.now(); MatcherAssert.assertThat( comment.number(), Matchers.greaterThan(0) ); final Comment.Smart smart = new Comment.Smart(comment); MatcherAssert.assertThat( smart.issue().number(), Matchers.greaterThan(0) ); MatcherAssert.assertThat( smart.author().login(), Matchers.equalTo("jeff") ); MatcherAssert.assertThat( smart.body(), Matchers.equalTo(COMMENT_TEXT) ); <START> final String domain = "<LINK_0>"; <END> final String path = "/repos/jeff/test/issues/comments/1"; MatcherAssert.assertThat( smart.url(), Matchers.equalTo(new URL(domain + path)) ); MatcherAssert.assertThat( smart.createdAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( smart.createdAt().getTime(), Matchers.lessThanOrEqualTo(after) ); MatcherAssert.assertThat( smart.updatedAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( smart.updatedAt().getTime(), Matchers.lessThanOrEqualTo(after) ); }</code><technical_language>@cvrebert one-time variable. inlined</technical_language>

Target:
public void dataStoredProperly() throws Exception { final String cmt = "what's up?"; final long before = MkCommentTest.now(); final Comment comment = this.comment(cmt); final long after = MkCommentTest.now(); MatcherAssert.assertThat( comment.number(), Matchers.greaterThan(0) ); final Comment.Smart smart = new Comment.Smart(comment); MatcherAssert.assertThat( smart.issue().number(), Matchers.greaterThan(0) ); MatcherAssert.assertThat( smart.author().login(), Matchers.equalTo("jeff") ); MatcherAssert.assertThat( smart.body(), Matchers.equalTo(cmt) ); MatcherAssert.assertThat( smart.url(), Matchers.equalTo( new URL( "<LINK_0>/repos/jeff/test/issues/comments/1" ) ) ); MatcherAssert.assertThat( smart.createdAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( smart.createdAt().getTime(), Matchers.lessThanOrEqualTo(after) ); MatcherAssert.assertThat( smart.updatedAt().getTime(), Matchers.greaterThanOrEqualTo(before) ); MatcherAssert.assertThat( smart.updatedAt().getTime(), Matchers.lessThanOrEqualTo(after) ); }
Source:
<code>public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result = method.invoke(obj, args); <START> if (method.getName().equals("glGetError")) { <END> return result; } checkError(); return result; }</code><technical_language>slightly faster, I guess, if method is looked proxy creation time. I overly concerned this is a debugging class. ok if a follow-on improvement, too</technical_language>

Target:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result = method.invoke(obj, args); if (method.equals(methodGlGetError)) { return result; } checkError(); return result; }
Source:
<code>public ListenableFuture<Map<Cell, Value>> getAsync(TableReference tableRef, Map<Cell, Long> timestampByCell) { long startTime = System.currentTimeMillis(); return KvsProfilingLogger.maybeLogAsync(() -> delegate.getAsync(tableRef, timestampByCell), (logger, stopwatch) -> <START> logger.log("Call to KVS.get at time {}, on table {}, requesting cells took ms ", <END> LoggingArgs.startTimeMillis(startTime), LoggingArgs.tableRef(tableRef), LoggingArgs.cellCount(timestampByCell.size()), LoggingArgs.durationMillis(stopwatch)), logCellResultSize(4L)); }</code><technical_language>interpolation</technical_language>

Target:
public ListenableFuture<Map<Cell, Value>> getAsync(TableReference tableRef, Map<Cell, Long> timestampByCell) { long startTime = System.currentTimeMillis(); return KvsProfilingLogger.maybeLogAsync(() -> delegate.getAsync(tableRef, timestampByCell), (logger, stopwatch) -> logger.log("Call to KVS.getAsync", LoggingArgs.startTimeMillis(startTime), LoggingArgs.tableRef(tableRef), LoggingArgs.cellCount(timestampByCell.size()), LoggingArgs.durationMillis(stopwatch)), logCellResultSize(4L)); }
Source:
<code>protected Void doInBackground(Void... params) { <START> arrayList = new ArrayList<>(); <END> InputStream is = null; Bitmap tempBitmap; String frameFolder = "frames"; AssetManager assetmanager = getResources().getAssets(); try { String str[] = assetmanager.list("frames"); for (int file = 0; file < str.length; file++) { is = assetmanager.open(frameFolder + File.separator + file + ".png"); tempBitmap = Bitmap.createScaledBitmap(BitmapFactory.decodeStream(is), 140, 160, false); tempBitmap.compress(Bitmap.CompressFormat.JPEG, 100, new ByteArrayOutputStream()); arrayList.add(tempBitmap); } is.close(); } catch (IOException IOE) { Log.i(TAG, "getAssets: " + IOE.getMessage()); } return null; }</code><technical_language>@codepoet2017390 initialized this ArrayList in onPreExecute method do too</technical_language>

Target:
protected Void doInBackground(Void... params) { InputStream is = null; Bitmap tempBitmap; String frameFolder = "frames"; AssetManager assetmanager = getResources().getAssets(); try { String str[] = assetmanager.list("frames"); for (int file = 0; file < str.length; file++) { is = assetmanager.open(frameFolder + File.separator + file + ".png"); tempBitmap = Bitmap.createScaledBitmap(BitmapFactory.decodeStream(is), 140, 160, false); tempBitmap.compress(Bitmap.CompressFormat.JPEG, 100, new ByteArrayOutputStream()); arrayList.add(tempBitmap); } is.close(); } catch (IOException IOE) { Log.i(TAG, "getAssets: " + IOE.getMessage()); } return null; }
Source:
<code>public void shouldGetWithBinary() { expect(inner.get(keyBytes)).andReturn(valueAndTimestampBytes); inner.put(eq(keyBytes), aryEq(valueAndTimestampBytes)); expectLastCall(); init(); <START> metered.put(key, valueAndTimestamp); <END> final RawAndDeserializedValue<String> valueWithBinary = metered.getWithBinary(key); assertEquals(valueWithBinary.value, valueAndTimestamp); assertEquals(valueWithBinary.serializedValue, valueAndTimestampBytes); }</code><technical_language>mocked store get, need do a put, right</technical_language>

Target:
public void shouldGetWithBinary() { expect(inner.get(keyBytes)).andReturn(valueAndTimestampBytes); inner.put(eq(keyBytes), aryEq(valueAndTimestampBytes)); expectLastCall(); init(); final RawAndDeserializedValue<String> valueWithBinary = metered.getWithBinary(key); assertEquals(valueWithBinary.value, valueAndTimestamp); assertEquals(valueWithBinary.serializedValue, valueAndTimestampBytes); }
Source:
<code>public static int getfd(FileDescriptor descriptor) { <START> Field field = getFieldByReflection(descriptor.getClass(), "fd"); <END> try { return field.getInt(descriptor); } catch (Exception e) { LOG.warn("Unable to read fd field from java.io.FileDescriptor"); } return -1; }</code><technical_language>this is dangerous. Relying internals for control bound break compatibility in unexpected ways. Is java-centric fadvise</technical_language>

Target:
public static int getfd(FileDescriptor descriptor) { try { return field.getInt(descriptor); } catch (IllegalArgumentException | IllegalAccessException e) { log.warn("Unable to read fd field from java.io.FileDescriptor"); } return -1; }
Source:
<code>public List<String> getValues() { List<String> values = new ArrayList<String>(); if (getTaskAttribute().getValues().size() > 1) { values = getTaskAttribute().getValues(); <START> } else { <END> String selectedKeywords = getAttributeMapper().getValue(getTaskAttribute()); StringTokenizer st = new StringTokenizer(selectedKeywords, ",", false); while (st.hasMoreTokens()) { String s = st.nextToken().trim(); values.add(s); } } return values; }</code><technical_language>values a list a comma-delimited string</technical_language>

Target:
public List<String> getValues() { List<String> values = new ArrayList<String>(); values = getTaskAttribute().getValues(); return values; }
Source:
<code>public void settingsPerformanceTest() throws Exception { for (int i = 0; i < TEST_TIME; i++) { <START> for (int j = 0; j < ACTIVITIES.length; j++) { executePreformanceTest(ACTIVITIES[j], TEXTS[j], j); } <END> } }</code><technical_language>refactoring ACTIVITIES. for(Page page : PAGES) { executePreformanceTest(page.action, page.title, page.displayName); }</technical_language>

Target:
public void settingsPerformanceTest() throws Exception { for (int i = 0; i < TEST_TIME; i++) { for (Page page : PAGES) { executePreformanceTest(page.action, page.displayName, page.title); } } }
Source:
<code>protected void processTuple(T tuple, boolean isStream1Data) { Spillable.SpillableListMultimap<K,T> store = isStream1Data ? stream1Data : stream2Data; K key = extractKey(tuple,isStream1Data); <START> if (!store.put(key, tuple)) { <END> return; } Future<List> future; if (isStream1Data) { if (isRightKeyPrimary()) { future = ((SpillableMapAsMultiMapImpl)stream2Data).getAsync(key); } else { future = ((SpillableTimeSlicedArrayListMultiMapImpl)stream2Data).getAsync(key); } } else { if (isLeftKeyPrimary()) { future = ((SpillableMapAsMultiMapImpl)stream1Data).getAsync(key); } else { future = ((SpillableTimeSlicedArrayListMultiMapImpl)stream1Data).getAsync(key); } } if (future == null) { return; } if (future.isDone()) { try { joinStream(tuple,isStream1Data, future.get()); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } } else { waitingEvents.put(new JoinEvent<>(key,tuple,isStream1Data),future); } }</code><technical_language>Please mention put return false? implementations return true default</technical_language>

Target:
protected void processTuple(T tuple, boolean isStream1Data) { Spillable.SpillableListMultimap<K,T> store = isStream1Data ? stream1Data : stream2Data; K key = extractKey(tuple,isStream1Data); if (isExpiredTuple(tuple,isStream1Data)) { return; } store.put(key, tuple); Future<List> future; if (isStream1Data) { future = getAsync(stream2Data, isRightKeyPrimary(), key); } else { future = getAsync(stream1Data, isLeftKeyPrimary(), key); } if (future == null) { return; } if (future.isDone()) { try { joinStream(tuple,isStream1Data, future.get()); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } } else { waitingEvents.put(new JoinEvent<>(key,tuple,isStream1Data),future); } }
Source:
<code>public Iterator<Map.Entry<UK, UV>> iterator() { Map<UK, UV> userMap = stateTable.get(currentNamespace); <START> return userMap == null ? emptyState.entrySet().iterator() : userMap.entrySet().iterator(); <END> }</code><technical_language>Collections.emptyIterator()</technical_language>

Target:
public Iterator<Map.Entry<UK, UV>> iterator() { Map<UK, UV> userMap = stateTable.get(currentNamespace); return userMap == null ? Collections.emptyIterator() : userMap.entrySet().iterator(); }
Source:
<code>public List<Statistic> getStatistics(VdsNetworkInterface iface) { NetworkStatistics s = iface.getStatistics(); List<Statistic> datums = new ArrayList<>(); Double dataRx = RxTxCalculator.percent2bytes(iface.getSpeed(), s.getReceiveRate()); if (dataRx != null) { addDatumToStatistics(datums, setDatum(clone(DATA_RX), dataRx)); } Double dataTx = RxTxCalculator.percent2bytes(iface.getSpeed(), s.getTransmitRate()); if (dataTx != null) { addDatumToStatistics(datums, setDatum(clone(DATA_TX), dataTx)); } if (s.getReceiveDropRate() != null) { addDatumToStatistics(datums, setDatum(clone(ERRS_RX), s.getReceiveDropRate())); } if (s.getTransmitDropRate() != null) { addDatumToStatistics(datums, setDatum(clone(ERRS_TX), s.getTransmitDropRate())); } <START> return datums; <END> }</code><technical_language>i approach making RxTxCalculator#percent2bytes return NULL, this is considered practice consumers of mentioned method defensive nature</technical_language>

Target:
public List<Statistic> getStatistics(VdsNetworkInterface iface) { NetworkStatistics s = iface.getStatistics(); return asList(setDatum(clone(DATA_RX), RxTxCalculator.percent2bytes(iface.getSpeed(), s.getReceiveRate())), setDatum(clone(DATA_TX), RxTxCalculator.percent2bytes(iface.getSpeed(), s.getTransmitRate())), setDatum(clone(ERRS_RX), s.getReceiveDropRate()), setDatum(clone(ERRS_TX), s.getTransmitDropRate())); }
Source:
<code>private void findNegotiatingProfiles(ServletRequest req) { List<String> schemes = new ArrayList<String>(); if (profiles == null) { synchronized (this) { if (profiles == null) { schemes = new ArrayList<>(); profiles = new ArrayList<AuthenticationProfile>(1); <START> long caps = 0; <END> for (String nego : req.getServletContext().getInitParameter(CAPABILITIES_PARAMETER).trim().split("*|*")) { try { caps |= Authn.Capabilities.class.getField(nego).getInt(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { } } for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { ExtMap authnContext = profile.getAuthn().getContext(); if ((authnContext.<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != caps) { profiles.add(0, profile); } schemes.addAll(authnContext.<List<String>>get(Authn.ContextKeys.HTTP_AUTHENTICATION_SCHEME, Collections.<String>emptyList())); } } } } } ((HttpServletRequest) req).setAttribute(FiltersHelper.Constants.SCHEMES_KEY, schemes); }</code><technical_language>integer store a bits a EnumSet</technical_language>

Target:
private void findNegotiatingProfiles(ServletRequest req) { List<String> schemes = new ArrayList<String>(); if (profiles == null) { synchronized (this) { if (profiles == null) { schemes = new ArrayList<>(); profiles = new ArrayList<AuthenticationProfile>(1); long caps = 0; for (String nego : req.getServletContext().getInitParameter(CAPABILITIES_PARAMETER).trim().split("\\|")) { try { caps |= Authn.Capabilities.class.getField(nego).getInt(null); } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException ex) { } } for (AuthenticationProfile profile : AuthenticationProfileRepository.getInstance().getProfiles()) { if (profile != null) { ExtMap authnContext = profile.getAuthn().getContext(); if ((authnContext.<Long> get(Authn.ContextKeys.CAPABILITIES).longValue() & caps) != caps) { profiles.add(0, profile); } schemes.addAll(authnContext.<List<String>>get(Authn.ContextKeys.HTTP_AUTHENTICATION_SCHEME, Collections.<String>emptyList())); } } } } } ((HttpServletRequest) req).setAttribute(FiltersHelper.Constants.SCHEMES_KEY, schemes); }
Source:
<code>private String computeDefaultInternalLinkPattern() { String internalLinkPattern = wikiBaseUrl; if (!internalLinkPattern.endsWith("/")) { internalLinkPattern += "/"; } <START> internalLinkPattern += "index.php?title={0}"; END> return internalLinkPattern; }</code><technical_language>include multiple fixes in a single review</technical_language>

Target:
private String computeDefaultInternalLinkPattern() { String internalLinkPattern = wikiBaseUrl; if (!internalLinkPattern.endsWith("/")) { internalLinkPattern += "/"; } internalLinkPattern += "index.php/{0}"; return internalLinkPattern; }
Source:
<code>private static void requireEnv(String varName) { <START> assertNotNull( <END> System.getenv(varName), String.format("Environment variable '%s' is required to perform these tests.", varName)); }</code><technical_language>Discovered in another PR this - needs assertNotNull(msg, value) work correctly</technical_language>

Target:
private static void requireEnv(String varName) { assertNotNull( String.format("Environment variable '%s' is required to perform these tests.", varName), System.getenv(varName)); }
Source:
<code>public void test() throws Exception { if (myTestFile.getName().startsWith("__")) { System.out.println("debug file encountered: "+myTestFile.getName()); } IonDatagram datagram = load(myTestFile); IonReader treeReader = system().newReader(datagram); FileInputStream in = new FileInputStream(myTestFile); try { IonReader fileReader = system().newReader(in); ReaderCompare.compare(treeReader, fileReader); } finally { in.close(); } in = new FileInputStream(myTestFile); try { Iterator<IonValue> expected = datagram.iterator(); Iterator<IonValue> actual = system().iterate(in); assertIonIteratorEquals(expected, actual); } finally { in.close(); } if (! myFileIsBinary) { treeReader = system().newReader(datagram); byte[] encoded = datagram.getBytes(); IonReader binaryReader = system().newReader(encoded); ReaderCompare.compare(treeReader, binaryReader); } else { <START> EquivsTest.roundTripEquivalence(datagram); <END> } }</code><technical_language>remove if (! myFileIsBinary) check existing logic for binary text</technical_language>

Target:
public void test() throws Exception { if (myTestFile.getName().startsWith("__")) { System.out.println("debug file encountered: "+myTestFile.getName()); } IonDatagram datagram = load(myTestFile); IonReader treeReader = system().newReader(datagram); FileInputStream in = new FileInputStream(myTestFile); try { IonReader fileReader = system().newReader(in); ReaderCompare.compare(treeReader, fileReader); } finally { in.close(); } in = new FileInputStream(myTestFile); try { Iterator<IonValue> expected = datagram.iterator(); Iterator<IonValue> actual = system().iterate(in); assertIonIteratorEquals(expected, actual); } finally { in.close(); } treeReader = system().newReader(datagram); byte[] encoded = datagram.getBytes(); IonReader binaryReader = system().newReader(encoded); ReaderCompare.compare(treeReader, binaryReader); }
Source:
<code><START> public static ImmutableCollection<MapColor> getAll() { <END> return factory.getAll(); }</code><technical_language>Collection</technical_language>

Target:
public static Collection<MapColor> getAll() { return factory.getAll(); }
Source:
<code>public Reply<?> fetchEapMethods() { <START> List<MethodType> types = methodCatalog.findAll(); <END> List<String> list = adaptEAPs(types); return Reply.with(list).as(Json.class).ok(); }</code><technical_language>methods</technical_language>

Target:
public Reply<?> fetchEapMethods() { List<Method> methods = methodCatalog.findAll(); List<String> dtos = adaptEapMethods(methods); return Reply.with(dtos).as(Json.class).ok(); }
Source:
<code>List<String> collect() { <START> this.metricList = new ArrayList<>(); <END> this.keyPropertiesPerBean = new ConcurrentHashMap<>(); try { MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer(); Set<ObjectName> mBeanNames = new HashSet<>(); ObjectName synapseFilterName = new ObjectName(SYNAPSE_DOMAIN_NAME); for (ObjectInstance instance : beanServer.queryMBeans(synapseFilterName, null)) { mBeanNames.add(instance.getObjectName()); } for (ObjectName beanName : mBeanNames) { scrapeBean(beanServer, beanName); } if (this.metricList != null && !metricList.isEmpty()) { Collections.sort(metricList, new Comparator<PrometheusMetric>() { @Override public int compare(final PrometheusMetric object1, final PrometheusMetric object2) { return object1.getMetricName().compareTo(object2.getMetricName()); } }); for (int i = 1; i < metricList.size(); i++) { if (metricList.get(i).getMetricName().equals(metricList.get(i - 1).getMetricName())) { metricList.get(i).setHelp(""); metricList.get(i).setType(""); } } List<String> metrics = new ArrayList<>(); for (PrometheusMetric metric : metricList) { metrics.add(PrometheusMetric.getFormattedMetric(metric)); } return metrics; } } catch (MalformedObjectNameException e) { LOGGER.error("Error in retrieving metric data from JMX MBeans"); } return Collections.emptyList(); }</code><technical_language>lambda syntax here</technical_language>

Target:
List<String> collect() { List<PrometheusMetric> metricList = new ArrayList<>(); Map<ObjectName, LinkedHashMap<String, String>> keyPropertiesPerBean = new ConcurrentHashMap<>(); try { MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer(); Set<ObjectName> mBeanNames = new HashSet<>(); ObjectName synapseFilterName = new ObjectName(SYNAPSE_DOMAIN_NAME); for (ObjectInstance instance : beanServer.queryMBeans(synapseFilterName, null)) { mBeanNames.add(instance.getObjectName()); } for (ObjectName beanName : mBeanNames) { List<PrometheusMetric> metrics = scrapeBean(beanServer, beanName, keyPropertiesPerBean); if (metrics != null && !metrics.isEmpty()) { metricList.addAll(metrics); } } if (!metricList.isEmpty()) { Collections.sort(metricList, new Comparator<PrometheusMetric>() { @Override public int compare(final PrometheusMetric object1, final PrometheusMetric object2) { return object1.getMetricName().compareTo(object2.getMetricName()); } }); for (int i = 1; i < metricList.size(); i++) { if (metricList.get(i).getMetricName().equals(metricList.get(i - 1).getMetricName())) { metricList.get(i).setHelp(""); metricList.get(i).setType(""); } } List<String> metrics = new ArrayList<>(); for (PrometheusMetric metric : metricList) { metrics.add(PrometheusMetric.formatMetric(metric)); } return metrics; } } catch (MalformedObjectNameException e) { LOGGER.error("Error in retrieving metric data from JMX MBeans: ", e); } return Collections.emptyList(); }
Source:
<code><START> public void testCanReadImageInputStream() throws IOException { <END> File rasterfile = TestData.file(GeoTiffReaderTest.class, "geo.tiff"); FileImageInputStream is = new FileImageInputStream(rasterfile); GeoTiffReader reader = new GeoTiffReader(is); GridCoverage2D gridCoverage = reader.read(null); assertTrue(gridCoverage != null && gridCoverage.getNumSampleDimensions() == 1); }</code><technical_language>either, restarted build, ;-)</technical_language>

Target:
public void testCanReadImageInputStream() throws IOException { File rasterfile = TestData.file(GeoTiffReaderTest.class, "geo.tiff"); GeoTiffReader reader = null; try(FileImageInputStream is = new FileImageInputStream(rasterfile)) { reader = new GeoTiffReader(is); GridCoverage2D gridCoverage = reader.read(null); assertTrue(gridCoverage != null && gridCoverage.getNumSampleDimensions() == 1); gridCoverage.dispose(true); } finally { if(reader != null) { reader.dispose(); } } }