auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static String getDefaultProfile(SsoExtensionsManager extensionsManager) { Optional<ExtensionProxy> defaultExtension = extensionsManager.getExtensionsByService(Authn.class.getName()) .stream() <START> .filter(a -> a.getContext().<Boolean>get(Authn.ConfigKeys.DEFAULT, false)) <END> .findFirst(); return defaultExtension.isPresent() ? getProfileName(defaultExtension.get()) : null; }</code><technical_language>following? .filter(a -> Boolean.valueOf(a.getContext().<Properties>get(Base.ContextKeys.CONFIGURATION).getProperty(Authn.ConfigKeys.DEFAULT_PROFILE)))</technical_language>

Target:
public static String getDefaultProfile(SsoExtensionsManager extensionsManager) { Optional<ExtensionProxy> defaultExtension = extensionsManager.getExtensionsByService(Authn.class.getName()) .stream() .filter(a -> Boolean.valueOf(a.getContext().<Properties>get(Base.ContextKeys.CONFIGURATION) .getProperty(Authn.ConfigKeys.DEFAULT_PROFILE))) .findFirst(); return defaultExtension.isPresent() ? getProfileName(defaultExtension.get()) : null; }
Source:
<code>public User getUserByUsername(String username) throws APIException { <START> User user = dao.getUserByUsername(username); <END> if (isDaemon(user)) { log.warn("requested User '" + username + "' is Daemon"); return null; } return user; }</code><technical_language>This changed, changing search methods</technical_language>

Target:
public User getUserByUsername(String username) throws APIException { return dao.getUserByUsername(username); }
Source:
<code>private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) <START> .depth(2) <END> .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<>(); List<Object> jobsNodes = hudson.getJob(); Set<String> urls = new HashSet<>(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonMatrixMatrixProject.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); if (!urls.contains(jobUrl)) { job.setUrl(jobUrl); buildPlans.add(job); urls.add(jobUrl); } } else if (ids == null) { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }</code><technical_language>this need 2</technical_language>

Target:
private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) .depth(3) .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<>(); List<Object> jobsNodes = hudson.getJob(); Set<String> urls = new HashSet<>(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonMatrixMatrixProject.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); if (!urls.contains(jobUrl)) { job.setUrl(jobUrl); buildPlans.add(job); urls.add(jobUrl); } } else if (ids == null) { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }
Source:
<code>public LeftButton(String name) { super(name); this.name = name; this.getStyleClass().add("leftButton"); <START> this.setMaxWidth(Double.MAX_VALUE); <END> this.setAlignment(Pos.CENTER_LEFT); this.setPadding(new Insets(2)); }</code><technical_language>this default max width? In case I prefer definitions in css files</technical_language>

Target:
public LeftButton(String name) { super(name); this.name = name; this.getStyleClass().add("leftButton"); this.setAlignment(Pos.CENTER_LEFT); this.setPadding(new Insets(2)); }
Source:
<code>public void addEntry(View view) { if (mAmountView.getText().toString().isEmpty()) { mAmountView.setError(getString(R.string.error_invalid_amount)); mAmountView.requestFocus(); return; } <START> <END> final Entry newEntry = createEntry(); if (newEntry == null) { return; } ApiInterface.getInstance().create(newEntry, new ApiCallback<Long>() { @Override public void onSuccess(Long result) { Toast.makeText(AddEntryActivity.this, "Added $" + ((double) newEntry.getAmount() / CENTS) + " to the " + newEntry.getBudget().getName() + " budget " + "with the date of: " + newEntry.getDate() + " with a note of: " + newEntry.getNotes() , Toast.LENGTH_LONG).show(); AddEntryActivity.this.clearEntry(null); newEntry.getBudget().addEntry(newEntry); Intent intent = new Intent(AddEntryActivity.this, LogsActivity.class); finish(); startActivity(intent); } @Override public void onFailure(String errorMessage) { Toast.makeText(AddEntryActivity.this, "FAILED", Toast.LENGTH_LONG).show(); } }); }</code><technical_language>find in strings addentryactivity. factor out of in multiple activities this one. inconsistent error message in addentryactivity is located in strings for add budget</technical_language>

Target:
public void addEntry(View view) { mAmountView.setError(null); if (mAmountView.getText().toString().isEmpty()) { mAmountView.setError(getString(R.string.error_invalid_amount)); mAmountView.requestFocus(); return; } final Entry newEntry = createEntry(); if (newEntry == null) { return; } ApiInterface.getInstance().create(newEntry, new ApiCallback<Long>() { @Override public void onSuccess(Long result) { Toast.makeText(AddEntryActivity.this, "Added $" + ((double) newEntry.getAmount() / CENTS) + " to the " + newEntry.getBudget().getName() + " budget " + "with the date of: " + newEntry.getDate() + " with a note of: " + newEntry.getNotes() , Toast.LENGTH_LONG).show(); AddEntryActivity.this.clearEntry(null); newEntry.getBudget().addEntry(newEntry); finish(); } @Override public void onFailure(String errorMessage) { Toast.makeText(AddEntryActivity.this, "FAILED", Toast.LENGTH_LONG).show(); } }); }
Source:
<code>protected void drawBorder(GC gc) { Rectangle bounds = getBounds(); gc.drawRoundRectangle(bounds.x, bounds.y, bounds.width, bounds.height, fArc, fArc); RGBAColor backgroundColor = getBackgroundColor(); if (fLabel != null && !fLabel.isEmpty() && bounds.width > bounds.height && backgroundColor != null) { gc.setForeground(Utils.getDistinctColor(RGBAUtil.fromRGBAColor(backgroundColor).rgb)); Utils.drawText(gc, fLabel, bounds.x, bounds.y, bounds.width, bounds.height, true, true); <START> } <END> }</code><technical_language>draw label in a method called drawBorder()? label drawn anymore is border</technical_language>

Target:
protected void drawBorder(GC gc) { Rectangle bounds = getBounds(); gc.drawRoundRectangle(bounds.x, bounds.y, bounds.width, bounds.height, fArc, fArc); }
Source:
<code>protected boolean isCustomMtu() { <START> return MtuSelector.customMtu.equals(getMtuSelector().getSelectedItem()); <END> }</code><technical_language>Note enums ==, prefer</technical_language>

Target:
protected boolean isCustomMtu() { return MtuSelector.customMtu == getMtuSelector().getSelectedItem(); }
Source:
<code>private OmVolumeArgs getVolumeInfo(OMMetadataManager omMetadataManager, String volume) throws IOException { omMetadataManager.getLock().acquireVolumeLock(volume); try { String dbVolumeKey = omMetadataManager.getVolumeKey(volume); OmVolumeArgs volumeArgs = omMetadataManager.getVolumeTable().get(dbVolumeKey); if (volumeArgs == null) { LOG.debug("volume:{} does not exist", volume); throw new OMException("Volume " + volume + " is not found", OMException.ResultCodes.VOLUME_NOT_FOUND); } return volumeArgs; } catch (IOException ex) { if (!(ex instanceof OMException)) { LOG.warn("Info volume failed for volume:{}", volume, ex); } throw ex; } finally { <START> omMetadataManager.getLock().releaseVolumeLock(volume); <END> } }</code><technical_language>Logging involves disk IO. done lock</technical_language>

Target:
private OmVolumeArgs getVolumeInfo(OMMetadataManager omMetadataManager, String volume) throws IOException { String dbVolumeKey = omMetadataManager.getVolumeKey(volume); OmVolumeArgs volumeArgs = omMetadataManager.getVolumeTable().get(dbVolumeKey); if (volumeArgs == null) { throw new OMException("Volume " + volume + " is not found", OMException.ResultCodes.VOLUME_NOT_FOUND); } return volumeArgs; }
Source:
<code>public Stream<BlankNodeOrIRI> getGraphNames() { RepositoryConnection conn = getRepositoryConnection(); <START> RepositoryResult<Resource> contexts = conn.getContextIDs(); <END> return Iterations.stream(contexts).map(g -> (BlankNodeOrIRI) rdf4jTermFactory.asRDFTerm(g)); }</code><technical_language>Ditto for reliably closing this RepositoryResult object</technical_language>

Target:
public Stream<BlankNodeOrIRI> getGraphNames() { try (RepositoryConnection conn = getRepositoryConnection()) { RepositoryResult<Resource> contexts = conn.getContextIDs(); return Iterations.stream(contexts).map(g -> (BlankNodeOrIRI) rdf4jTermFactory.asRDFTerm(g)); } }
Source:
<code>EventBus forward(String address, Object message) { <START> forward(address, message, null); <END> return null; }</code><technical_language>Indentation - 2 spaces</technical_language>

Target:
EventBus forward(String address, Object message) { return forward(address, message, null); }
Source:
<code>public void afterTestExecution(ExtensionContext context) { Method testMethod = context.getRequiredTestMethod(); long start = getStore(context).remove(testMethod, long.class); long duration = System.currentTimeMillis() - start; <START> System.out.printf("completed in %d ms.%n", duration); <END> }</code><technical_language>nit: completed -> Completed</technical_language>

Target:
public void afterTestExecution(ExtensionContext context) { TestInformation testInformation = getStore(context) .remove(context.getRequiredTestMethod(), TestInformation.class); long duration = System.currentTimeMillis() - testInformation.startMillis; System.out.printf("%s completed in %d ms.%n", testInformation.logPrefix, duration); }
Source:
<code>public String getString(String dataType, BigInteger address, MemoryByte[] data) { StringBuilder strBuffer = new StringBuilder(); String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR); for (MemoryByte <START> d : <END> data) { if (d.isReadable()) { strBuffer.append(new String(RenderingsUtil.convertByteToCharArray(d.getValue()))); } else { strBuffer.append(paddedStr); } } return strBuffer.toString().toUpperCase(); }</code><technical_language>rename memByte</technical_language>

Target:
public String getString(String dataType, BigInteger address, MemoryByte[] data) { StringBuilder strBuffer = new StringBuilder(); String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR); for (MemoryByte memByte : data) { if (memByte.isReadable()) { strBuffer.append(new String(RenderingsUtil.convertByteToCharArray(memByte.getValue()))); } else { strBuffer.append(paddedStr); } } return strBuffer.toString().toUpperCase(); }
Source:
<code>public Map<Long, Set<TObject>> chronologize(String key, long record, long start, long end, Map<Long, Set<TObject>> context) { <START> Set<TObject> set = Iterables.getLast(context.values(), <END> Sets.<TObject> newLinkedHashSet()); for (Iterator<Write> it = iterator(key, record, end); it.hasNext();) { Write write = it.next(); long writeTimeStamp = write.getVersion(); if(writeTimeStamp >= start) { Text writtenKey = write.getKey(); long writtenRecordId = write.getRecord().longValue(); Action action = write.getType(); if(writtenKey.toString().equals(key) && writtenRecordId == record) { set = Sets.newLinkedHashSet(set); Value newValue = write.getValue(); if(action == Action.ADD) { set.add(newValue.getTObject()); } else if(action == Action.REMOVE) { set.remove(newValue.getTObject()); } context.put(writeTimeStamp, set); } } } return context; }</code><technical_language>call this variable snapshot</technical_language>

Target:
public Map<Long, Set<TObject>> chronologize(String key, long record, long start, long end, Map<Long, Set<TObject>> context) { Set<TObject> snapshot = Iterables.getLast(context.values(), Sets.<TObject> newLinkedHashSet()); for (Iterator<Write> it = iterator(key, record, end); it.hasNext();) { Write write = it.next(); long timestamp = write.getVersion(); if(timestamp >= end){ break; } else{ Text writtenKey = write.getKey(); long writtenRecordId = write.getRecord().longValue(); Action action = write.getType(); if(writtenKey.toString().equals(key) && writtenRecordId == record) { snapshot = Sets.newLinkedHashSet(snapshot); Value newValue = write.getValue(); if(action == Action.ADD) { snapshot.add(newValue.getTObject()); } else if(action == Action.REMOVE) { snapshot.remove(newValue.getTObject()); } if(timestamp >= start && !snapshot.isEmpty()) context.put(timestamp, snapshot); } } } return context; }
Source:
<code>@Override public void rebalanceEnabled(boolean rebalanceEnabled) { <START> kernal.context().cache().context().rebalanceEnabled(rebalanceEnabled); <END> }</code><technical_language>Lets kernal.rebalanceEnabled(rebalanceEnabled);</technical_language>

Target:
@Override public void rebalanceEnabled(boolean rebalanceEnabled) { kernal.rebalanceEnabled(rebalanceEnabled); }
Source:
<code>public static JavaTypeDefinition forClass(TypeDefinitionType type, JavaTypeDefinition... intersectionTypes) { switch (type) { case EXACT: if (intersectionTypes.length == 1) { return intersectionTypes[0]; } else { throw new IllegalArgumentException("Exact intersection types do not exist!"); } case UPPER_BOUND: case UPPER_WILDCARD: <START> return new JavaTypeDefinitionSpecial(type, intersectionTypes); <END> case LOWER_WILDCARD: return new JavaTypeDefinitionLower(intersectionTypes); default: throw new IllegalStateException("Unknow type"); } }</code><technical_language>rename this JavaTypeDefinitionUpper</technical_language>

Target:
public static JavaTypeDefinition forClass(TypeDefinitionType type, JavaTypeDefinition... intersectionTypes) { switch (type) { case EXACT: if (intersectionTypes.length == 1) { return intersectionTypes[0]; } else { throw new IllegalArgumentException("Exact intersection types do not exist!"); } case UPPER_BOUND: case UPPER_WILDCARD: return new JavaTypeDefinitionUpper(type, intersectionTypes); case LOWER_WILDCARD: return new JavaTypeDefinitionLower(intersectionTypes); default: throw new IllegalStateException("Unknow type"); } }
Source:
<code>protected void initOperations() { if (opsInitialized) { return; } AutomationService service = Framework.getService(AutomationService.class); if (service == null) { return; } OperationType[] ops = service.getOperations(); List<OperationType> oops = Arrays.asList(ops); <START> Collections.sort(oops, Comparator.comparing(OperationType::getId)); <END> for (OperationType op : oops) { OperationDocumentation documentation; try { documentation = op.getDocumentation(); } catch (OperationException e) { throw new NuxeoException(e); } this.operations.add(new OperationInfoImpl(documentation, getVersion(), op.getType().getCanonicalName(), op.getContributingComponent())); } opsInitialized = true; }</code><technical_language>List#sort(Comparator) is preferred avoid importing Collections</technical_language>

Target:
protected void initOperations() { if (opsInitialized) { return; } AutomationService service = Framework.getService(AutomationService.class); if (service == null) { return; } OperationType[] ops = service.getOperations(); List<OperationType> oops = Arrays.asList(ops); oops.sort(Comparator.comparing(OperationType::getId)); for (OperationType op : oops) { OperationDocumentation documentation; try { documentation = op.getDocumentation(); } catch (OperationException e) { throw new NuxeoException(e); } this.operations.add(new OperationInfoImpl(documentation, getVersion(), op.getType().getCanonicalName(), op.getContributingComponent())); } opsInitialized = true; }
Source:
<code><START> public NGuid getStorageDomainId() { <END> Guid storageDomainId = getParameters().getStorageDomainId(); if (Guid.Empty.equals(storageDomainId) && getVm() != null && getVm().getDiskMap() != null && !getVm().getDiskMap().isEmpty()) { return getDisksStorageDomainId(); } return storageDomainId == null ? Guid.Empty : storageDomainId; }</code><technical_language>This method called disk images. rename method 'getImageStorageDomainId' solve issue</technical_language>

Target:
public NGuid getStorageDomainId() { if (super.getStorageDomainId() == null) { Guid storageDomainId = getParameters().getStorageDomainId(); if (Guid.Empty.equals(storageDomainId) && getVm() != null && getVm().getDiskMap() != null && !getVm().getDiskMap().isEmpty()) { storageDomainId = getDisksStorageDomainId(); } else if (storageDomainId == null) { storageDomainId = Guid.Empty; } setStorageDomainId(storageDomainId); return storageDomainId; } return super.getStorageDomainId(); }
Source:
<code>public void plotPlayerRatingGraph() { OffsetDateTime afterDate = switch (timePeriodComboBox.getValue()) { <START> case LAST_MONTH -> OffsetDateTime.of(LocalDateTime.now().minusMonths(1), ZoneOffset.UTC); case LAST_YEAR -> OffsetDateTime.of(LocalDateTime.now().minusYears(1), ZoneOffset.UTC); case ALL_TIME -> OffsetDateTime.of(LocalDateTime.MIN, ZoneOffset.UTC); <END> }; List<XYChart.Data<Long, Integer>> values = ratingData.stream() .filter(dataPoint -> dataPoint.getInstant().isAfter(afterDate)) .map(dataPoint -> new Data<>(dataPoint.getInstant().toEpochSecond(), RatingUtil.getRating(dataPoint))) .collect(Collectors.toList()); xAxis.setTickLabelFormatter(ratingLabelFormatter()); if (values.size() > 0) { xAxis.setLowerBound(values.get(0).getXValue()); xAxis.setUpperBound(values.get(values.size() - 1).getXValue()); } xAxis.setTickUnit((xAxis.getUpperBound() - xAxis.getLowerBound()) / 10); XYChart.Series<Long, Integer> series = new XYChart.Series<>(observableList(values)); series.setName(i18n.get("userInfo.ratingOverTime")); ratingHistoryChart.setData(FXCollections.observableList(Collections.singletonList(series))); }</code><technical_language>if put in enums adding a new ratingTimePeriod super easy</technical_language>

Target:
public void plotPlayerRatingGraph() { OffsetDateTime afterDate = OffsetDateTime.of(timePeriodComboBox.getValue().getDate(), ZoneOffset.UTC); List<XYChart.Data<Long, Integer>> values = ratingData.stream() .filter(dataPoint -> dataPoint.getInstant().isAfter(afterDate)) .map(dataPoint -> new Data<>(dataPoint.getInstant().toEpochSecond(), RatingUtil.getRating(dataPoint))) .collect(Collectors.toList()); xAxis.setTickLabelFormatter(ratingLabelFormatter()); if (values.size() > 0) { xAxis.setLowerBound(values.get(0).getXValue()); xAxis.setUpperBound(values.get(values.size() - 1).getXValue()); } xAxis.setTickUnit((xAxis.getUpperBound() - xAxis.getLowerBound()) / 10); XYChart.Series<Long, Integer> series = new XYChart.Series<>(observableList(values)); series.setName(i18n.get("userInfo.ratingOverTime")); ratingHistoryChart.setData(FXCollections.observableList(Collections.singletonList(series))); }
Source:
<code>private Boolean visitDeep(AbstractAbstractFileNode<? extends AbstractFile> node) { boolean hasChildren = node.hasContentChildren(); if (!hasChildren) { return true; } List<Content> derivedChildren = node.getContentChildren(); for (Content childContent : derivedChildren) { if ((childContent instanceof AbstractFile) && ((AbstractFile) childContent).isDir()) { return false; } else { try{ <START> if(0 < Case.getCurrentCase().getSleuthkitCase().getVisibleContentChildrenCount(childContent)){ <END> return false; } } catch (TskCoreException e){ logger.log(Level.SEVERE, "Error checking if file node is leaf.", e); } } } return true; }</code><technical_language>@APriestman @esaunders , I for this query a companion method AbstractContentNode.getContentChildren, adding a new, specialized API SleuthkitCase. This is for UI, for data model, e.g., method header in SleuthkitCase refers lazy (node) loading, meaning in SleuthKit layer. I call SleuthkitCase.executeQuery a new AbstractContentNode.getVisibleContentChildrenCount method instead</technical_language>

Target:
private Boolean visitDeep(AbstractAbstractFileNode<? extends AbstractFile> node) { boolean hasChildren = node.hasContentChildren(); if (!hasChildren) { return true; } List<Content> derivedChildren = node.getContentChildren(); for (Content childContent : derivedChildren) { if ((childContent instanceof AbstractFile) && ((AbstractFile) childContent).isDir()) { return false; } else { if(AbstractContentNode.contentHasVisibleContentChildren(childContent)){ return false; } } } return true; }
Source:
<code>private MacPool decoratePool(MacPool macPool, List<MacPoolDecorator> decorators) { if <START> (decorators == null || decorators.isEmpty()) { <END> log.debug("No MacPoolDecorators passed to decorate pool {}. ", macPool); return macPool; } MacPool result = macPool; log.debug("Decorating MacPool with decorators: {}.", Arrays.toString(decorators.toArray())); for (MacPoolDecorator decorator : decorators) { decorator.setMacPool(result); result = decorator; } return result; }</code><technical_language>"CollectionUtils.isEmpty(decorators)" more readable (+ import org.apache.commons.collections.CollectionUtils;)</technical_language>

Target:
private MacPool decoratePool(MacPool macPool, List<MacPoolDecorator> decorators) { if (CollectionUtils.isEmpty(decorators)) { log.debug("No MacPoolDecorators were passed to decorate pool {}. ", macPool); return macPool; } MacPool result = macPool; log.debug("Decorating MacPool with decorators: {}.", Arrays.toString(decorators.toArray())); for (MacPoolDecorator decorator : decorators) { decorator.setMacPool(result); result = decorator; } return result; }
Source:
<code>private static long calculateRetainedSizeWithoutLoading(Page page) { long retainedSizeInBytes = 0; for (int channel = 0; channel < page.getChannelCount(); channel++) { <START> Block block = page.getBlock(channel); <END> if (!isUnloadedLazyBlock(block)) { retainedSizeInBytes += block.getRetainedSizeInBytes(); } } return retainedSizeInBytes; }</code><technical_language>sense a method returns Iterable<Block> for-each loops work</technical_language>

Target:
private static long calculateRetainedSizeWithoutLoading(Page page) { long retainedSizeInBytes = Page.INSTANCE_SIZE + SizeOf.sizeOfObjectArray(page.getChannelCount()); for (int channel = 0; channel < page.getChannelCount(); channel++) { Block block = page.getBlock(channel); if (!isUnloadedLazyBlock(block)) { retainedSizeInBytes += block.getRetainedSizeInBytes(); } } return retainedSizeInBytes; }
Source:
<code>public long getAllCount() { <START> return 5; <END> }</code><technical_language>This changed, instead need change getAllCount() return VisitService.getAllVisits().size()</technical_language>

Target:
public long getAllCount() { return service.getAllVisits().size(); }
Source:
<code>public JavaScriptDimFilter( @JsonProperty("dimension") String dimension, @JsonProperty("dimensions") String[] dimensions, @JsonProperty("function") String function ) { <START> Preconditions.checkArgument(dimension != null || dimensions != null, "dimension or dimensions must not be null"); <END> Preconditions.checkArgument(!(dimension != null && dimensions != null), "both dimension and dimensions are defined"); Preconditions.checkArgument(function != null, "function must not be null"); this.dimensions = (dimension != null) ? new String[]{dimension} : dimensions; this.function = function; }</code><technical_language>xor care of checks</technical_language>

Target:
public JavaScriptDimFilter( @JsonProperty("dimension") String dimension, @JsonProperty("dimensions") String[] dimensions, @JsonProperty("function") String function ) { Preconditions.checkArgument(dimension != null ^ dimensions != null, "dimensions(xor dimension) must not be null"); Preconditions.checkArgument(function != null, "function must not be null"); this.dimensions = (dimensions != null) ? dimensions : new String[]{dimension}; this.function = function; }
Source:
<code><START> public static RelBuilderFactory proto(final Context context) { <END> return new RelBuilderFactory() { public RelBuilder create(RelOptCluster cluster, RelOptSchema schema) { return new VoltPRelBuilder(context, cluster, schema); } }; }</code><technical_language>suggested IntelliJ: suggestion public static RelBuilderFactory proto(final Context context) { return (cluster, schema) -> new VoltPRelBuilder(context, cluster, schema); }</technical_language>

Target:
public static RelBuilderFactory proto(final Context context) { return (cluster, schema) -> new VoltPRelBuilder(context, cluster, schema); }
Source:
<code>public void testSplitterXML() throws Exception { LineSplitter splitter = new LineSplitter(); splitter.setFormat(Format.XML); Stream<StringHandle> contentStream = splitter.split(new FileInputStream(xmlFile)); assertNotNull(contentStream); StringHandle[] result = contentStream.toArray(size -> new StringHandle[size]); assertNotNull(result); assertEquals(result.length, Files.lines(Paths.get(xmlFile)).count()); String[] originalResult = Files.lines(Paths.get(xmlFile)) .toArray(size -> new String[size]); assertEquals(result[0].getFormat(), Format.XML); for (int i = 0; i < result.length && i < originalResult.length; i++) { assertNotNull(result[i].get()); assertEquals(result[i].get(), originalResult[i]); <START> } <END> }</code><technical_language>other thought. 3 tests share fundamental logic for inspecting results of splitting. sense create a private function takes a Stream<StringHandle>, a Format, String[] array of file lines is called of tests perform inspection common tests? If possible, maintenance easier (with cost of break out separate tests if discover a need for inspection road)</technical_language>

Target:
public void testSplitterXML() throws Exception { LineSplitter splitter = new LineSplitter(); splitter.setFormat(Format.XML); Stream<StringHandle> contentStream = splitter.split(new FileInputStream(xmlFile)); assertNotNull(contentStream); String[] originalResult = Files.lines(Paths.get(xmlFile)) .toArray(size -> new String[size]); checkContent(contentStream, splitter.getFormat(), originalResult); }
Source:
<code>private void bootstrapMachines() throws InfrastructureException, InterruptedException { CompletableFuture<InfrastructureException> firstFailed = new CompletableFuture<>(); List<CompletableFuture> checkMachines = new ArrayList<>(machines.size()); for (OpenShiftMachine machine : machines.values()) { checkMachines.add( CompletableFuture.runAsync( () -> { try { machine.waitRunning(machineStartTimeoutMin); bootstrapMachine(machine); checkMachineServers(machine); } catch (InfrastructureException ex) { sendFailedEvent(machine.getName(), ex.getMessage()); firstFailed.completeExceptionally(ex); throw new CompletionException(ex); } catch (InterruptedException ei) { throw new CompletionException(ei); } }) .thenAccept( a -> { if (!firstFailed.isCompletedExceptionally()) { sendRunningEvent(machine.getName()); } })); } CompletableFuture<Void> allAvailable = CompletableFuture.allOf(checkMachines.toArray(new CompletableFuture[0])); try { CompletableFuture.anyOf(allAvailable, firstFailed).join(); } catch (CompletionException e) { if (firstFailed.isDone()) { <START> throw firstFailed.join(); <END> } else if (e.getCause() instanceof InterruptedException) { throw (InterruptedException) e.getCause(); } else { throw new InfrastructureException(e.getCause().getMessage(), e.getCause()); } } }</code><technical_language>expect get InfrastructureException get here. this completable future is complete exceptionally [here](<LINK_0> I understand firstFailed.join(); throw CompletionException caused InfrastructureException</technical_language>

Target:
private void bootstrapMachines() throws InfrastructureException, InterruptedException { List<CompletableFuture> checkMachines = new ArrayList<>(machines.size()); List<BootstrapMachineTask> tasks = new ArrayList<>(machines.size()); for (OpenShiftMachine machine : machines.values()) { BootstrapMachineTask task = new BootstrapMachineTask(machine); tasks.add(task); checkMachines.add(pool.runAsync(task)); } try { CompletableFuture.allOf(checkMachines.toArray(new CompletableFuture[checkMachines.size()])) .join(); } catch (CompletionException e) { tasks.forEach(BootstrapMachineTask::interrupt); if (e.getCause() instanceof InterruptedException) { throw (InterruptedException) e.getCause(); } else if (e.getCause() instanceof InfrastructureException) { throw (InfrastructureException) e.getCause(); } else { throw new InternalInfrastructureException(e.getCause().getMessage(), e.getCause()); } } }
Source:
<code>private void setMerged(final Change c, final ChangeMessage msg) throws OrmException { try { db.changes().beginTransaction(c.getId()); CodeReviewCommit commit = commits.get(c.getId()); PatchSet.Id merged = commit.change.currentPatchSetId(); setMergedPatchSet(c.getId(), merged); PatchSetApproval submitter = saveApprovals(c, merged); addMergedMessage(submitter, msg); db.commit(); sendMergedEmail(c, submitter); if (submitter != null) { try { hooks.doChangeMergedHook(c, accountCache.get(submitter.getAccountId()).getAccount(), db.patchSets().get(commit.patchsetId), db); } catch (OrmException ex) { log.error("Cannot run hook for submitted patch set " + c.getId(), ex); } } } finally { db.rollback(); } <START> indexer.indexAsync(c); <END> }</code><technical_language>Is ok waits for this? (I thought through.)</technical_language>

Target:
private void setMerged(final Change c, final ChangeMessage msg) throws OrmException, IOException { try { db.changes().beginTransaction(c.getId()); CodeReviewCommit commit = commits.get(c.getId()); PatchSet.Id merged = commit.change.currentPatchSetId(); setMergedPatchSet(c.getId(), merged); PatchSetApproval submitter = saveApprovals(c, merged); addMergedMessage(submitter, msg); db.commit(); sendMergedEmail(c, submitter); if (submitter != null) { try { hooks.doChangeMergedHook(c, accountCache.get(submitter.getAccountId()).getAccount(), db.patchSets().get(commit.patchsetId), db); } catch (OrmException ex) { log.error("Cannot run hook for submitted patch set " + c.getId(), ex); } } } finally { db.rollback(); } indexer.index(c); }
Source:
<code>protected final String getObjectComparisonString( final SimplePredicate.Op op, final ExpressionOperatorParameter parameters) { <START> if (op == SimplePredicate.Op.LIKE) { <END> return new StringBuilder("(") .append(getLeft().getJavaString(parameters)) .append(".indexOf(") .append(getRight().getJavaString(parameters)) .append(')') .append(">=0") .append(")") .toString(); } else return new StringBuilder("(") .append(getLeft().getJavaString(parameters)) .append(".compareTo(") .append(getRight().getJavaString(parameters)) .append(')') .append(op.toJavaString()) .append(0) .append(")") .toString(); }</code><technical_language>Is this supposed implement SQL LIKE? Is MyriaL support for this in RACO? In case, this implements foo '%bar%' allowing wildcards RHS, I expect SQL LIKE</technical_language>

Target:
protected final String getObjectComparisonString( final SimplePredicate.Op op, final ExpressionOperatorParameter parameters) { if (op == SimplePredicate.Op.LIKE) { return new StringBuilder("(") .append(getLeft().getJavaString(parameters)) .append(".toLowerCase().matches(") .append(getRight().getJavaString(parameters)) .append( ".toLowerCase().replace(\".\", \"\\.\").replace(\"?\", \".\").replace(\"%\", \".*\")") .append("))") .toString(); } else return new StringBuilder("(") .append(getLeft().getJavaString(parameters)) .append(".compareTo(") .append(getRight().getJavaString(parameters)) .append(')') .append(op.toJavaString()) .append(0) .append(")") .toString(); }
Source:
<code>private OsgpUnit toStandardUnit(final DlmsUnitTypeDto dlmsUnit) { if ("M_3".equals(dlmsUnit.getUnit())) { return OsgpUnit.M3; } else { try { return OsgpUnit.valueOf(dlmsUnit.getUnit()); <START> } catch (IllegalArgumentException e) { <END> return OsgpUnit.UNDEFINED; } } }</code><technical_language>![CRITICAL](<LINK_1> log rethrow this exception. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private OsgpUnit toStandardUnit(final DlmsUnitTypeDto dlmsUnit) { if ("M_3".equals(dlmsUnit.getUnit())) { return OsgpUnit.M3; } else { for (OsgpUnit osgpUnit : OsgpUnit.values()) { if (osgpUnit.name().equals(dlmsUnit.getUnit())) { return osgpUnit; } } } return OsgpUnit.UNDEFINED; }
Source:
<code>public void call(final Subscriber<? super Intent> subscriber) { final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { subscriber.onNext(intent); } }; final Subscription subscription = AndroidSubscriptions.unsubscribeInUiThread(new Action0() { @Override public void call() { <START> context.unregisterReceiver(broadcastReceiver); <END> } }); subscriber.add(subscription); Intent stickyIntent = context.registerReceiver(broadcastReceiver, intentFilter, broadcastPermission, schedulerHandler); if (stickyIntent != null) { subscriber.onNext(stickyIntent); } }</code><technical_language>question I this is ties in Context life-cycle, e.g. for Activity. I subscribe observable in onStart unsubscribe onStop (or other life-cycle pairs accordingly?)</technical_language>

Target:
public void call(final Subscriber<? super Intent> subscriber) { final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { subscriber.onNext(intent); } }; final Subscription subscription = Subscriptions.create(new Action0() { @Override public void call() { context.unregisterReceiver(broadcastReceiver); } }); subscriber.add(subscription); Intent stickyIntent = context.registerReceiver(broadcastReceiver, intentFilter, broadcastPermission, schedulerHandler); if (stickyIntent != null) { subscriber.onNext(stickyIntent); } }
Source:
<code>public void onlyConsequenceTypesShouldBeConverted() { ConsequenceType consequenceType = new ConsequenceType("geneName", "ensemblGeneId", "ensemblTranscriptId", "strand", "biotype", 0, 0, 0, "aaChange", "codon", new ArrayList<>(), new ArrayList<>()); List<ConsequenceType> consequenceTypes = Collections.singletonList(consequenceType); VariantAnnotation annotation = new VariantAnnotation("1", 1, 2, "A", "T"); annotation.setConsequenceTypes(consequenceTypes); DBObject dbObject = converter.convert(annotation); assertNotNull(dbObject); LinkedList cts = (LinkedList) dbObject.get(AnnotationFieldNames.CONSEQUENCE_TYPE_FIELD); <START> assertTrue(cts.size() == 1); <END> HashSet<BasicDBObject> xrefs = (HashSet) dbObject.get(AnnotationFieldNames.XREFS_FIELD); assertFalse(isXrefPresent(xrefs, "OS01G0112100", "ensemblGene")); assertTrue(isXrefPresent(xrefs, "ensemblGeneId", "ensemblGene")); assertTrue(isXrefPresent(xrefs, "geneName", "HGNC")); assertTrue(isXrefPresent(xrefs, "ensemblTranscriptId", "ensemblTranscript")); }</code><technical_language>assertEquals(1, cts.size())</technical_language>

Target:
public void onlyConsequenceTypesShouldBeConverted() { ConsequenceType consequenceType = new ConsequenceType("geneName", "ensemblGeneId", "ensemblTranscriptId", "strand", "biotype", 0, 0, 0, "aaChange", "codon", new ArrayList<>(), new ArrayList<>()); List<ConsequenceType> consequenceTypes = Collections.singletonList(consequenceType); VariantAnnotation annotation = new VariantAnnotation("1", 1, 2, "A", "T"); annotation.setConsequenceTypes(consequenceTypes); DBObject dbObject = converter.convert(annotation); assertNotNull(dbObject); LinkedList cts = (LinkedList) dbObject.get(AnnotationFieldNames.CONSEQUENCE_TYPE_FIELD); assertEquals(1, cts.size()); HashSet<BasicDBObject> xrefs = (HashSet) dbObject.get(AnnotationFieldNames.XREFS_FIELD); assertFalse(isXrefPresent(xrefs, "OS01G0112100", "ensemblGene")); assertTrue(isXrefPresent(xrefs, "ensemblGeneId", "ensemblGene")); assertTrue(isXrefPresent(xrefs, "geneName", "HGNC")); assertTrue(isXrefPresent(xrefs, "ensemblTranscriptId", "ensemblTranscript")); }
Source:
<code>public void insertOrUpdateTuple( EntityKey key, Tuple tuple, TupleContext tupleContext) throws TupleAlreadyExistsException { Map<String, Object> map = ( (RedisTupleSnapshot) tuple.getSnapshot() ).getMap(); Map<String, String> entity = new HashMap<>(); List<String> toDelete1 = new ArrayList<>(); for ( TupleOperation action : tuple.getOperations() ) { switch ( action.getType() ) { case PUT: map.put( action.getColumn(), action.getValue() ); if ( action.getValue() instanceof Character ) { entity.put( action.getColumn(), action.getValue().toString() ); } else { entity.put( action.getColumn(), (String) action.getValue() ); } break; case REMOVE: case PUT_NULL: map.remove( action.getColumn() ); toDelete1.add( action.getColumn() ); break; } } String entityId = entityId( key ); Long currentTtl = connection.pttl( entityId( key ) ); <START> if ( !toDelete1.isEmpty() ) { <END> String[] toDelete2 = toDelete1.toArray( new String[toDelete1.size()] ); connection.hdel( entityId, toDelete2 ); } if ( !entity.isEmpty() ) { connection.hmset( entityId, entity ); } setEntityTTL( key, currentTtl, getTTL( tupleContext.getOptionsContext() ) ); }</code><technical_language>numbered variable names a bit tough grok. find more descritive? toDelete inline one</technical_language>

Target:
public void insertOrUpdateTuple( EntityKey key, Tuple tuple, TupleContext tupleContext) throws TupleAlreadyExistsException { Map<String, Object> map = ( (RedisTupleSnapshot) tuple.getSnapshot() ).getMap(); MapHelpers.applyTupleOpsOnMap( tuple, map ); Map<String, String> entity = getEntityForUpdate( key, tuple ); List<String> toDelete = getKeysForRemoval( tuple ); String entityId = entityId( key ); Long currentTtl = connection.pttl( entityId( key ) ); if ( !toDelete.isEmpty() ) { connection.hdel( entityId, toDelete.toArray( new String[toDelete.size()] ) ); } if ( !entity.isEmpty() ) { connection.hmset( entityId, entity ); } setEntityTTL( key, currentTtl, getTTL( tupleContext.getOptionsContext() ) ); }
Source:
<code><START> public SaveContentAsDraftActionlet( <END> final ContentletAPI contentletAPI, final CategoryAPI categoryAPI, final PermissionAPI permissionAPI ) { this.contentletAPI = contentletAPI; this.categoryAPI = categoryAPI; this.permissionAPI = permissionAPI; }</code><technical_language>I this constructor need public</technical_language>

Target:
SaveContentAsDraftActionlet( final ContentletAPI contentletAPI, final CategoryAPI categoryAPI, final PermissionAPI permissionAPI ) { super(); this.contentletAPI = contentletAPI; this.categoryAPI = categoryAPI; this.permissionAPI = permissionAPI; }
Source:
<code>void whenWriteAndReadEntriesAsync_thenSuccess() throws Exception { CompletableFuture<Long> f = bk.newCreateLedgerOp() .withDigestType(DigestType.MAC) .withPassword(ledgerPassword) .execute() .thenApply((wh) -> { List<CompletableFuture<Long>> ops = new ArrayList<>(); for( int i = 0; i < 1000 ; i++ ) { byte[] data = String.format("message-%04d", i).getBytes(); ops.add(wh.appendAsync(data)); } return CompletableFuture .allOf(ops.stream().toArray(CompletableFuture[]::new)) .thenCompose((v) -> wh.closeAsync()) .thenApply((v) -> wh.getId()); }) .thenCompose((lf) -> lf); Long ledgerId = f.get(5, TimeUnit.MINUTES); log.info("Ledger created with 1000 entries: ledgerId=" + ledgerId); CompletableFuture<LedgerEntries> ef = bk.newOpenLedgerOp() .withLedgerId(ledgerId) .withPassword(ledgerPassword) .withDigestType(DigestType.MAC) .execute() .thenCompose((rh) -> { return rh.readLastAddConfirmedAsync() .thenCompose((lastId) -> rh.readAsync(0, lastId)); }); LedgerEntries entries = ef.get(5,TimeUnit.MINUTES); <START> <END> long count = 0; Iterator<org.apache.bookkeeper.client.api.LedgerEntry> it = entries.iterator(); while ( it.hasNext()) { org.apache.bookkeeper.client.api.LedgerEntry e = it.next(); String msg = new String(e.getEntryBytes()); assertEquals(String.format("message-%04d", count),msg); count++; } assertEquals(1000,count); log.info("Got entries: count=" + count); }</code><technical_language>lots of blank space</technical_language>

Target:
void whenWriteAndReadEntriesAsync_thenSuccess() throws Exception { CompletableFuture<Long> f = bk.newCreateLedgerOp() .withDigestType(DigestType.MAC) .withPassword(ledgerPassword) .execute() .thenApply((wh) -> { List<CompletableFuture<Long>> ops = new ArrayList<>(); for (int i = 0; i < 1000; i++) { byte[] data = String.format("message-%04d", i) .getBytes(); ops.add(wh.appendAsync(data)); } return CompletableFuture.allOf(ops.stream() .toArray(CompletableFuture[]::new)) .thenCompose((v) -> wh.closeAsync()) .thenApply((v) -> wh.getId()); }) .thenCompose((lf) -> lf); Long ledgerId = f.get(5, TimeUnit.MINUTES); LOG.info("Ledger created with 1000 entries: ledgerId=" + ledgerId); CompletableFuture<LedgerEntries> ef = bk.newOpenLedgerOp() .withLedgerId(ledgerId) .withPassword(ledgerPassword) .withDigestType(DigestType.MAC) .execute() .thenCompose((rh) -> { return rh.readLastAddConfirmedAsync() .thenCompose((lastId) -> rh.readAsync(0, lastId)); }); LedgerEntries entries = ef.get(5, TimeUnit.MINUTES); long count = 0; Iterator<org.apache.bookkeeper.client.api.LedgerEntry> it = entries.iterator(); while (it.hasNext()) { org.apache.bookkeeper.client.api.LedgerEntry e = it.next(); String msg = new String(e.getEntryBytes()); assertEquals(String.format("message-%04d", count), msg); count++; } assertEquals(1000, count); LOG.info("Got entries: count=" + count); }
Source:
<code>public void testSetWalSegmentSizeShouldBeOkWhenSizeBetween512KbAnd2Gb() throws Exception { final DataStorageConfiguration cfg = new DataStorageConfiguration(); <START> cfg.setWalSegmentSize(512 * 1024); <END> cfg.setWalSegmentSize(Integer.MAX_VALUE); }</code><technical_language>semantic units separated empty lines</technical_language>

Target:
public void testSetWalSegmentSizeShouldBeOkWhenSizeBetween512KbAnd2Gb() throws Exception { final DataStorageConfiguration cfg = new DataStorageConfiguration(); cfg.setWalSegmentSize(512 * 1024); assertEquals(512 * 1024, cfg.getWalSegmentSize()); cfg.setWalSegmentSize(Integer.MAX_VALUE); assertEquals(Integer.MAX_VALUE, cfg.getWalSegmentSize()); }
Source:
<code>public String asyncGet(String argument) throws IOException { String note = StringUtils.EMPTY; InputStreamResponseListener listener = new InputStreamResponseListener(); client.newRequest(zepelinhubUrl + argument) .header(ZEPPELIN_TOKEN_HEADER, token) .send(listener); Response response; try { response = listener.get(30, TimeUnit.SECONDS); } catch (InterruptedException | TimeoutException | ExecutionException e) { LOG.error("Cannot perform Get request to ZeppelinHub", e); throw new IOException("Cannot perform Get request to ZeppelinHub", e); } int code = response.getStatus(); if (code == 200) { <START> InputStream responseContent = listener.getInputStream(); <END> note = IOUtils.toString(responseContent, "UTF-8"); responseContent.close(); } else { LOG.error("ZeppelinHub Get returned with status ", zepelinhubUrl + argument, code); throw new IOException("Cannot perform Get request to ZeppelinHub"); } return note; }</code><technical_language>[try-with-resource statements](<LINK_0> (and [here](<LINK_1> is automatically closable, syntactic sugar for did, basically equivalent need change</technical_language>

Target:
public String asyncGet(String argument) throws IOException { return sendToZeppelinHub(HttpMethod.GET, zepelinhubUrl + argument); }
Source:
<code>public GestureTypingDetector(int minPointDistance, @NonNull Iterable<Keyboard.Key> keys) { mMinPointDistance = minPointDistance; mKeys = keys; <START> for (Keyboard.Key key : mKeys) { <END> for (int i = 0; i < key.getCodesCount(); ++i) { char c = Character.toLowerCase((char) key.getCodeAtIndex(i, false)); mKeysByCharacter.put(c, key); } } mGenerateStateSubject.onNext(LoadingState.NOT_LOADED); }</code><technical_language>this moved generateCornersInBackground method? calculation done in a background thread UI thread (which calls this constructor)</technical_language>

Target:
public GestureTypingDetector(int minPointDistance, @NonNull Iterable<Keyboard.Key> keys) { mMinPointDistanceSquared = minPointDistance * minPointDistance; mKeys = keys; mGenerateStateSubject.onNext(LoadingState.NOT_LOADED); }
Source:
<code>private Set<String> computeRoles(U user, T tenant, boolean isSystemTenant) { Set<String> roles = Sets.newTreeSet(); roles.addAll(user.getUserAccountData().getPermissions().getPermissions()); roles.addAll(tenant.getTenantData().getPermissions().getPermissions()); roles.add(UserInfo.PERMISSION_LOGGED_IN); <START> roles.add(tenant.getTenantData().getName()); <END> Set<String> transformedRoles = transformRoles(roles); if (isSystemTenant && transformedRoles.contains(PERMISSION_MANAGE_SYSTEM)) { roles.add(PERMISSION_SYSTEM_TENANT); return transformRoles(roles); } return transformedRoles; }</code><technical_language>accountNumber (?)</technical_language>

Target:
private Set<String> computeRoles(U user, T tenant, boolean isSystemTenant) { Set<String> roles = Sets.newTreeSet(); roles.addAll(user.getUserAccountData().getPermissions().getPermissions()); roles.addAll(tenant.getTenantData().getPermissions().getPermissions()); roles.add(UserInfo.PERMISSION_LOGGED_IN); if (Strings.isFilled(tenant.getTenantData().getAccountNumber())){ roles.add("tenant-" + tenant.getTenantData().getAccountNumber()); } Set<String> transformedRoles = transformRoles(roles); if (isSystemTenant && transformedRoles.contains(PERMISSION_MANAGE_SYSTEM)) { roles.add(PERMISSION_SYSTEM_TENANT); return transformRoles(roles); } return transformedRoles; }
Source:
<code>public void testEmptyArray() throws Exception { Schema schema = new Schema.Parser().parse( Resources.getResource("array.avsc").openStream()); List<Integer> emptyArray = new ArrayList<>(); Path file = new Path(createTempFile().getPath()); try(ParquetWriter<GenericRecord> writer = AvroParquetWriter .<GenericRecord>builder(file) .withSchema(schema) .withConf(testConf) .build()) { GenericData.Record record = new GenericRecordBuilder(schema) .set("myarray", emptyArray).build(); writer.write(record); } <START> AvroParquetReader<GenericRecord> reader = new AvroParquetReader<GenericRecord>(testConf, file); <END> GenericRecord nextRecord = reader.read(); assertNotNull(nextRecord); assertEquals(emptyArray, nextRecord.get("myarray")); }</code><technical_language>Is reason apply AvroParquetReader</technical_language>

Target:
public void testEmptyArray() throws Exception { Schema schema = new Schema.Parser().parse( Resources.getResource("array.avsc").openStream()); List<Integer> emptyArray = new ArrayList<>(); Path file = new Path(createTempFile().getPath()); try(ParquetWriter<GenericRecord> writer = AvroParquetWriter .<GenericRecord>builder(file) .withSchema(schema) .withConf(testConf) .build()) { GenericData.Record record = new GenericRecordBuilder(schema) .set("myarray", emptyArray).build(); writer.write(record); } try (AvroParquetReader<GenericRecord> reader = new AvroParquetReader<>(testConf, file)) { GenericRecord nextRecord = reader.read(); assertNotNull(nextRecord); assertEquals(emptyArray, nextRecord.get("myarray")); } }