auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public GenericRecord parse(ByteBuffer bytes) { DatumReader<GenericRecord> reader = new GenericDatumReader<GenericRecord>(schemaObj); ByteBufferInputStream inputStream = new ByteBufferInputStream(Collections.singletonList(bytes)); try { return reader.read(null, DecoderFactory.get().binaryDecoder(inputStream, null)); } catch (EOFException eof) { <START> throw new ParseException("Avro's unnecessary EOFException", eof); <END> } catch (Exception e) { throw new ParseException(e, "Fail to decode avro message!"); } }</code><technical_language>Please include JIRA link in this message others it</technical_language>

Target:
public GenericRecord parse(ByteBuffer bytes) { DatumReader<GenericRecord> reader = new GenericDatumReader<GenericRecord>(schemaObj); ByteBufferInputStream inputStream = new ByteBufferInputStream(Collections.singletonList(bytes)); try { return reader.read(null, DecoderFactory.get().binaryDecoder(inputStream, null)); } catch (EOFException eof) { throw new ParseException( eof, "Avro's unnecessary EOFException, detail: [%s]", "<LINK_0>" ); } catch (Exception e) { throw new ParseException(e, "Fail to decode avro message!"); } }
Source:
<code>private static ConcurrentMap<String, List<Request>> asMap( final Collection<Request> reqs) throws IOException { final ConcurrentMap<String, List<Request>> map = new ConcurrentHashMap<String, List<Request>>(reqs.size()); for (final Request req : reqs) { final String header = new RqHeaders.Smart( new RqHeaders.Base(req) ).single(Base.REQUIRED_HEADER); final Matcher matcher = RqMultipart.Base.NAME.matcher(header); if (!matcher.matches()) { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( <START> "\"name\" not found in %s header:", <END> "%s", Base.REQUIRED_HEADER, header ) ); } final String name = matcher.group(1); map.putIfAbsent(name, new LinkedList<Request>()); map.get(name).add(req); } return map; }</code><technical_language>@2686747 here. formatted string broken, change it</technical_language>

Target:
private static Map<String, List<Request>> asMap( final Collection<Request> reqs) throws IOException { final Map<String, List<Request>> map = new HashMap<>(reqs.size()); for (final Request req : reqs) { final String header = new RqHeaders.Smart( new RqHeaders.Base(req) ).single(Base.REQUIRED_HEADER); final Matcher matcher = Base.NAME.matcher(header); if (!matcher.matches()) { throw new HttpException( HttpURLConnection.HTTP_BAD_REQUEST, String.format( "\"name\" not found in Content-Disposition header: %s", header ) ); } final String name = matcher.group(1); if (!map.containsKey(name)) { map.put(name, new LinkedList<Request>()); } map.get(name).add(req); } return map; }
Source:
<code>} catch (URISyntaxException e) { earlyException = new IllegalArgumentException(); <START> earlyException.initCause(e); <END> }</code><technical_language>pass e a constructor parameter</technical_language>

Target:
} catch (URISyntaxException e) { earlyException = new IllegalArgumentException(e); }
Source:
<code><START> public void initialize() { <END> view.refreshSelectPicker(); }</code><technical_language>I concerned this called in "submarine mode" appears called this class. private add some safe-guard for in "submarine mode"</technical_language>

Target:
public void initialize() { if (!isSubmarine.get()) { view.refreshSelectPicker(); } }
Source:
<code>public List<CommitValidationMessage> onCommitReceived( CommitReceivedEvent receiveEvent) throws CommitValidationException { if (receiveEvent.commit.getParentCount() > 1) { if (MagicBranch.isForReview(receiveEvent.command.getRefName())) { if (!refControl.canUploadMerges()) { throw new CommitValidationException( "you are not allowed to upload merges for review"); } } else { <START> if (!refControl.canPushMergesOld() && !refControl.canPushMerges()) { <END> throw new CommitValidationException( "you are not allowed to push merges directly bypassing code review"); } } } return Collections.<CommitValidationMessage> emptyList(); }</code><technical_language>I logic in canPushMerges</technical_language>

Target:
public List<CommitValidationMessage> onCommitReceived( CommitReceivedEvent receiveEvent) throws CommitValidationException { if (receiveEvent.commit.getParentCount() > 1) { if (MagicBranch.isMagicBranch(receiveEvent.command.getRefName())) { if (!refControl.canUploadMerges()) { throw new CommitValidationException( "you are not allowed to upload merges for review"); } } else if (!refControl.canPushMerges()) { throw new CommitValidationException( "you are not allowed to push merges directly bypassing code review"); } } return Collections.<CommitValidationMessage> emptyList(); }
Source:
<code>public FSDataInputStream open(FileSystem fileSystem, Path path, Optional<byte[]> extraFileInfo) throws IOException { if (fileSystem instanceof CachingFileSystem) { CachingFileSystem cachingFileSystem = (CachingFileSystem) fileSystem; <START> return fileOpener.open(cachingFileSystem.getDataTier(), path, extraFileInfo); <END> } else { throw new IllegalArgumentException("Incorrect filesystem found: " + fileSystem.getClass().getName()); } }</code><technical_language>need a CachingInputStream in order cache work</technical_language>

Target:
public CachingInputStream open(FileSystem fileSystem, Path path, Optional<byte[]> extraFileInfo) throws IOException { checkArgument(fileSystem instanceof CachingFileSystem, "fileSystem should be of CachingFileSystem type."); CachingFileSystem cachingFileSystem = (CachingFileSystem) fileSystem; FSDataInputStream fsDataInputStream = fileOpener.open(cachingFileSystem.getDataTier(), path, extraFileInfo); return new CachingInputStream(fsDataInputStream, cacheManager, path, cachingFileSystem.isCacheValidationEnabled()); }
Source:
<code>private InputStream exportGoodleDriveFile(final File file, final String mimetype, final Drive drive, final NodeRef nodeRef) throws IOException { final Object versionType = fileFolderService.getFileInfo(nodeRef).getProperties() .get(PROP_VERSION_TYPE); final String editorURL = String.valueOf(fileFolderService .getFileInfo(nodeRef).getProperties().getOrDefault(PROP_EDITORURL, "")); if (versionType == null || isGoogleDriveMimeType(mimetype) || <START> editorURL.contains("://docs.google.com/document")) <END> { try { return drive.files().export(file.getId(), mimetype).executeMediaAsInputStream(); } catch (GoogleJsonResponseException e) { log.info( "Failed to export GoogleDrive document from GD mimetype (retrying): " + e.getMessage()); } } return drive.files().get(file.getId()).executeMediaAsInputStream(); }</code><technical_language>"spreadsheets" (Google Sheets) "presentation" (Google Slides) in url</technical_language>

Target:
private InputStream exportGoodleDriveFile(final File file, final String mimetype, final Drive drive, final NodeRef nodeRef) throws IOException { final Object versionType = fileFolderService.getFileInfo(nodeRef).getProperties() .get(PROP_VERSION_TYPE); final String editorURL = String.valueOf(fileFolderService .getFileInfo(nodeRef).getProperties().getOrDefault(PROP_EDITORURL, "")); if (versionType == null || isGoogleDriveMimeType(mimetype) || editorURL.contains("://docs.google.com/")) { try { return drive.files().export(file.getId(), mimetype).executeMediaAsInputStream(); } catch (GoogleJsonResponseException e) { log.info( "Failed to export GoogleDrive document from GD mimetype (retrying): " + e.getMessage()); } } return drive.files().get(file.getId()).executeMediaAsInputStream(); }
Source:
<code>public void testFunctionOnThisChained() { Optional<String> description = getTestMethodRef().getDescriptionForFunction(this::function); assertTrue(description.isPresent()); <START> assertNameMatch("function", "testFunctionOnThisChained", CLASSNAME, description.get()); <END> }</code><technical_language>prefix method references "::" more resemble in source code e.g. "function" change "::function"</technical_language>

Target:
public void testFunctionOnThisChained() { Optional<String> description = getTestMethodRef().getDescriptionForFunction(this::function); assertTrue(description.isPresent()); assertNameMatch("::function", "testFunctionOnThisChained", CLASSNAME, description.get()); }
Source:
<code>public void testRefreshingUserMetadata() { ApiClient client = getWebClient(USER_2_USERNAME, testingPostgres); UsersApi usersApi = new UsersApi(client); WorkflowsApi workflowsApi = new WorkflowsApi(client); <START> Workflow workflow = manualRegisterAndPublish(workflowsApi, "DockstoreTestUser2/parameter_test_workflow", "testname", "cwl", <END> SourceControl.GITHUB, "/Dockstore.cwl", false); final long count = testingPostgres.runSelectStatement("select count(*) from user_profile where location='Toronto'", long.class); assertEquals("One user should have this info now, there are " + count, 1, count); }</code><technical_language>"cwl" DescriptorLanguage.CWL.getShortName()</technical_language>

Target:
public void testRefreshingUserMetadata() { ApiClient client = getWebClient(USER_2_USERNAME, testingPostgres); UsersApi usersApi = new UsersApi(client); WorkflowsApi workflowsApi = new WorkflowsApi(client); Workflow workflow = manualRegisterAndPublish(workflowsApi, "DockstoreTestUser2/parameter_test_workflow", "testname", DescriptorLanguage.CWL.getShortName(), SourceControl.GITHUB, "/Dockstore.cwl", false); final long count = testingPostgres.runSelectStatement("select count(*) from user_profile where location='Toronto'", long.class); assertEquals("One user should have this info now, there are " + count, 1, count); }
Source:
<code>public Flux<FeedResponse<T>> drainAsync(int maxPageSize) { return this.component.drainAsync(maxPageSize) .collectList() .map(superList -> { double requestCharge = 0; HashMap<String, String> headers = new HashMap<>(); List<Document> documentList = new ArrayList<>(); for (FeedResponse<T> page : superList) { List<Document> results = (List<Document>) page.getResults(); documentList.addAll(results); requestCharge += page.getRequestCharge(); } this.aggregateGroupings(documentList); <START> return (FeedResponse<T>)createFeedResponseFromGroupingTable(maxPageSize, requestCharge); <END> }).expand(tFeedResponse -> { FeedResponse<T> response = (FeedResponse<T>)createFeedResponseFromGroupingTable(maxPageSize, 0); if (response == null) { return Mono.empty(); } return Mono.just(response); }); }</code><technical_language>Instead of casting (here below), cast in createFeedResponseFromGroupingTable return FeedResponse<T> if is null time ? Casting throw a NPE</technical_language>

Target:
public Flux<FeedResponse<T>> drainAsync(int maxPageSize) { return this.component.drainAsync(maxPageSize) .collectList() .map(superList -> { double requestCharge = 0; HashMap<String, String> headers = new HashMap<>(); List<Document> documentList = new ArrayList<>(); for (FeedResponse<T> page : superList) { List<Document> results = (List<Document>) page.getResults(); documentList.addAll(results); requestCharge += page.getRequestCharge(); } this.aggregateGroupings(documentList); return createFeedResponseFromGroupingTable(maxPageSize, requestCharge); }).expand(tFeedResponse -> { FeedResponse<T> response = createFeedResponseFromGroupingTable(maxPageSize, 0); if (response == null) { return Mono.empty(); } return Mono.just(response); }); }
Source:
<code>protected void handleMessageInternal(final Message<?> message) throws Exception { String topic = this.topicExpression != null ? this.topicExpression.getValue(this.evaluationContext, message, String.class) : message.getHeaders().get("topic", String.class); Assert.state(StringUtils.hasText(topic), "'topic' can't be evaluated to empty."); Object messageKey = this.messageKeyExpression != null ? this.messageKeyExpression.getValue(this.evaluationContext, message) <START> : message.getHeaders().get("messageKey"); <END> this.kafkaProducerContext.send(topic, messageKey, message); }</code><technical_language>A bit late now, KafkaHeaders constants prefixes (kafka_*)</technical_language>

Target:
protected void handleMessageInternal(final Message<?> message) throws Exception { String topic = this.topicExpression != null ? this.topicExpression.getValue(this.evaluationContext, message, String.class) : message.getHeaders().get(KafkaHeaders.TOPIC, String.class); Assert.state(StringUtils.hasText(topic), "'topic' can't be evaluated to empty."); Object messageKey = this.messageKeyExpression != null ? this.messageKeyExpression.getValue(this.evaluationContext, message) : message.getHeaders().get(KafkaHeaders.MESSAGE_KEY); this.kafkaProducerContext.send(topic, messageKey, message); }
Source:
<code>public String toString() { <START> return "ResponseInfo{" + "requestInfo=" + requestInfo + ", error=" + error + ", response=" + content + ", dataNode=" <END> + dataNode + '}'; }</code><technical_language>minor: combine "ResponseInfo{" + "requestInfo=" a single string</technical_language>

Target:
public String toString() { return "ResponseInfo{requestInfo=" + requestInfo + ", error=" + error + ", response=" + content + ", dataNode=" + dataNode + '}'; }
Source:
<code>void setVariantId(String variantId) { if ("".equals(variantId)) { <START> throw new IllegalArgumentException("variantId (vid) should not be null"); <END> } this.variantId = variantId; }</code><technical_language>Actually, this equals checks if string is empty, not-null needs added :)</technical_language>

Target:
void setVariantId(String variantId) { if (variantId == null || variantId.isEmpty()) { throw new IllegalArgumentException("variantId (vid) should not be null"); } this.variantId = variantId; }
Source:
<code>public void testTotalArticleIsIndexedInRemovedStatus() throws Exception { setAllBlogEntriesToStatus( BlogStatus.REMOVED ); Transaction tx = fullTextSession.beginTransaction(); List<Blog> blogEntries = getBlogEntries(); <START> assertThat( blogEntries ).as( "TotalArticle is explicit not intercepted" ).contains( totalArticle ); <END> tx.commit(); }</code><technical_language>Well, do a search replace if decide fix :)</technical_language>

Target:
public void testTotalArticleIsIndexedInRemovedStatus() throws Exception { setAllBlogEntriesToStatus( BlogStatus.REMOVED ); Transaction tx = fullTextSession.beginTransaction(); List<Blog> blogEntries = getBlogEntries(); assertThat( blogEntries ).as( "TotalArticle is explicitly not intercepted" ).contains( totalArticle ); tx.commit(); }
Source:
<code>private void onUpdate() { if (pollingJob == null || pollingJob.isCancelled()) { Configuration config = getThing().getConfiguration(); int refreshInterval = DEFAULT_REFRESH_INTERVAL; Object refreshConfig = config.get("refresh"); if (refreshConfig != null) { refreshInterval = ((BigDecimal) refreshConfig).intValue(); } <START> pollingJob = scheduler.scheduleAtFixedRate(pollingRunnable, 0, refreshInterval, TimeUnit.SECONDS); <END> } }</code><technical_language>I blame for it, shown a change in Github (although moved code), I opportunity add remark :-)</technical_language>

Target:
private void onUpdate() { if (pollingJob == null || pollingJob.isCancelled()) { Configuration config = getThing().getConfiguration(); int refreshInterval = DEFAULT_REFRESH_INTERVAL; Object refreshConfig = config.get("refresh"); if (refreshConfig != null) { refreshInterval = ((BigDecimal) refreshConfig).intValue(); } pollingJob = scheduler.scheduleWithFixedDelay(pollingRunnable, 0, refreshInterval, TimeUnit.SECONDS); } }
Source:
<code>public void testAllExpire() throws InterruptedException { Cache<Object, String> cache0 = cache(0, CACHE_NAME); Cache<Object, String> cache1 = cache(1, CACHE_NAME); Cache<Object, String> cache2 = cache(2, CACHE_NAME); MagicKey key = new MagicKey(cache0); String expectedValue = key + "-expiring"; cache0.put(key, key + "-expiring", 1000, TimeUnit.MILLISECONDS); ClusterListener clusterListener = listener(); cache0.addListener(clusterListener); ts0.advance(1001); ts1.advance(1001); ts2.advance(1001); assertNull(cache0.get(key)); assertNull(cache1.get(key)); assertNull(cache2.get(key)); int expectCount = clusterListener.hasIncludeState() ? 2 : 1; eventually(() -> clusterListener.events.size() >= expectCount); CacheEntryEvent event = clusterListener.events.get(clusterListener.hasIncludeState() ? 1 : 0); assertEquals(Event.Type.CACHE_ENTRY_EXPIRED, event.getType()); assertEquals(key, event.getKey()); if (event.getValue() == null) { <START> System.currentTimeMillis(); <END> } assertEquals(expectedValue, event.getValue()); }</code><technical_language>want log time here</technical_language>

Target:
public void testAllExpire() throws InterruptedException { Cache<Object, String> cache0 = cache(0, CACHE_NAME); Cache<Object, String> cache1 = cache(1, CACHE_NAME); Cache<Object, String> cache2 = cache(2, CACHE_NAME); MagicKey key = new MagicKey(cache0); String expectedValue = key + "-expiring"; cache0.put(key, key + "-expiring", 1000, TimeUnit.MILLISECONDS); ClusterListener clusterListener = listener(); cache0.addListener(clusterListener); ts0.advance(1001); ts1.advance(1001); ts2.advance(1001); assertNull(cache0.get(key)); assertNull(cache1.get(key)); assertNull(cache2.get(key)); int expectCount = clusterListener.hasIncludeState() ? 2 : 1; eventually(() -> clusterListener.events.size() >= expectCount); CacheEntryEvent event = clusterListener.events.get(clusterListener.hasIncludeState() ? 1 : 0); assertEquals(Event.Type.CACHE_ENTRY_EXPIRED, event.getType()); assertEquals(key, event.getKey()); assertEquals(expectedValue, event.getValue()); }
Source:
<code>public String getStereotypeTextToDisplay(View model) { String textToDisplay = EMPTY_STRING; String finalText = EMPTY_STRING; <START> Iterator<?> iter = model.getChildren().iterator(); <END> while (iter.hasNext()) { Object object = iter.next(); if (object instanceof DecorationNode) { DecorationNode label = (DecorationNode) object; if (StereotypeDisplayUtils.STEREOTYPE_LABEL_TYPE.equals(label.getType())) { if (label.isVisible()) { textToDisplay = addStereotypeName(textToDisplay, label, model); } } } } if ((textToDisplay != null) && (!EMPTY_STRING.equals(textToDisplay))) { finalText = StereotypeDisplayUtils.QUOTE_LEFT + textToDisplay + StereotypeDisplayUtils.QUOTE_RIGHT; } return finalText; }</code><technical_language>a correct name for variable</technical_language>

Target:
public String getStereotypeTextToDisplay(View model) { StringBuilder textToDisplay = new StringBuilder(); StringBuilder finalText = new StringBuilder(); Iterator<?> childrenIterator = model.getChildren().iterator(); while (childrenIterator.hasNext()) { Object object = childrenIterator.next(); if (isStereotypeLabel(object)) { if (((View) object).isVisible()) { if (!EMPTY_STRING.equals(textToDisplay.toString()) && (textToDisplay != null)) { textToDisplay.append(StereotypeDisplayUtils.STEREOTYPE_LABEL_SEPARATOR); } textToDisplay.append(getStereotypeName((DecorationNode) object)); } } } if ((textToDisplay.toString() != null) && (!EMPTY_STRING.equals(textToDisplay.toString()))) { finalText.append(StereotypeDisplayUtils.QUOTE_LEFT).append(textToDisplay).append(StereotypeDisplayUtils.QUOTE_RIGHT); } return finalText.toString(); }
Source:
<code><START> public static HttpRequestEvent createHttpRequestEvent(RequestInfo requestInfo, ResponseInfo responseInfo) <END> { requireNonNull(requestInfo, "requestInfo is null"); requireNonNull(responseInfo, "responseInfo is null"); Request request = requestInfo.getRequest(); Response response = responseInfo.getResponse(); String requestUri = null; if (request.getURI() != null) { requestUri = request.getURI().toString(); } String method = request.getMethod(); if (method != null) { method = method.toUpperCase(); } String protocol = getHeader(request, "X-FORWARDED-PROTO"); if (protocol == null) { protocol = request.getScheme(); } if (protocol != null) { protocol = protocol.toLowerCase(); } long timeToLastByte = max(responseInfo.getResponseTimestampMillis() - requestInfo.getRequestTimestampMillis(), 0L); long responseSize = NO_RESPONSE; int responseCode = NO_RESPONSE; if (response != null) { responseSize = responseInfo.getResponseSize(); responseCode = response.getStatus(); } return new HttpRequestEvent( Instant.ofEpochMilli(requestInfo.getRequestTimestampMillis()), protocol, method, requestUri, responseSize, responseCode, timeToLastByte, getFailureReason(responseInfo)); }</code><technical_language>I find this strange. means response code column in log a numeric value</technical_language>

Target:
static HttpRequestEvent createHttpRequestEvent(RequestInfo requestInfo, ResponseInfo responseInfo) { requireNonNull(requestInfo, "requestInfo is null"); requireNonNull(responseInfo, "responseInfo is null"); Request request = requestInfo.getRequest(); Optional<Response> response = responseInfo.getResponse(); String requestUri = null; if (request.getURI() != null) { requestUri = request.getURI().toString(); } String method = request.getMethod(); if (method != null) { method = method.toUpperCase(Locale.US); } long responseSize = NO_RESPONSE; int responseCode = NO_RESPONSE; if (response.isPresent()) { responseSize = responseInfo.getResponseSize(); responseCode = response.get().getStatus(); } long timeToLastByte = max(responseInfo.getResponseTimestampMillis() - requestInfo.getRequestTimestampMillis(), 0L); return new HttpRequestEvent( Instant.ofEpochMilli(requestInfo.getRequestTimestampMillis()), request.getVersion().toString(), method, requestUri, getHeader(request, TRACETOKEN_HEADER), responseSize, responseCode, timeToLastByte, getFailureReason(responseInfo)); }
Source:
<code>private void logCompactionChoice(String tableToCompact, long maxSweptAfterCompact) { if (maxSweptAfterCompact > 0) { log.info("Choosing to compact {}, because it was swept milliseconds after the last compaction", safeTableRef(tableToCompact), maxSweptAfterCompact); } else { log.info("All swept tables have been compacted after the last sweep. Choosing to compact anyway - " + "this may be a no-op. It was last compacted milliseconds after it was last swept.", <START> safeTableRef(tableToCompact), maxSweptAfterCompact); <END> } }</code><technical_language>nit: SafeArg for timings</technical_language>

Target:
private void logCompactionChoice(String tableToCompact, long maxSweptAfterCompact) { if (maxSweptAfterCompact > 0) { log.info("Choosing to compact {}, because it was swept milliseconds after the last compaction", safeTableRef(tableToCompact), SafeArg.of("millisFromCompactionToSweep", maxSweptAfterCompact)); } else { log.info("All swept tables have been compacted after the last sweep. Choosing to compact anyway - " + "this may be a no-op. It was last compacted milliseconds after it was last swept.", safeTableRef(tableToCompact), SafeArg.of("millisFromSweepToCompaction", maxSweptAfterCompact)); } }
Source:
<code>public boolean supportsPrefix(String searchPrefix) { <START> return AbstractSearchProvider.supportsPrefix("nodes=", searchPrefix); <END> }</code><technical_language>NIT: m_delegate.getNamespace()+"=" here</technical_language>

Target:
public boolean supportsPrefix(String searchPrefix) { return AbstractSearchProvider.supportsPrefix(LinkdTopologyProvider.TOPOLOGY_NAMESPACE_LINKD+"=", searchPrefix); }
Source:
<code>public void acceptBalloon() { <START> final ImportVmCommand<ImportVmParameters> c = setupDiskSpaceTest(0); <END> c.getParameters().getVm().setBalloonEnabled(true); c.getParameters().getVm().setClusterArch(ArchitectureType.x86_64); VDSGroup cluster = new VDSGroup(); cluster.setArchitecture(ArchitectureType.x86_64); cluster.setcompatibility_version(Version.getLast()); doReturn(cluster).when(c).getVdsGroup(); osRepository.getDisplayTypes().get(0).put(Version.getLast(), Arrays.asList(DisplayType.qxl)); when(osRepository.isBalloonEnabled(c.getParameters().getVm().getVmOsId(), cluster.getcompatibility_version())).thenReturn(true); assertTrue(c.canDoAction()); }</code><technical_language>problem argument passed setupDiskSpaceTest</technical_language>

Target:
public void acceptBalloon() { final ImportVmCommand<ImportVmParameters> c = setupDiskSpaceTest(createParameters()); c.getParameters().getVm().setBalloonEnabled(true); c.getParameters().getVm().setClusterArch(ArchitectureType.x86_64); VDSGroup cluster = new VDSGroup(); cluster.setArchitecture(ArchitectureType.x86_64); cluster.setcompatibility_version(Version.getLast()); doReturn(cluster).when(c).getVdsGroup(); osRepository.getDisplayTypes().get(0).put(Version.getLast(), Arrays.asList(DisplayType.qxl)); when(osRepository.isBalloonEnabled(c.getParameters().getVm().getVmOsId(), cluster.getcompatibility_version())).thenReturn(true); assertTrue(c.canDoAction()); }
Source:
<code>protected @NonNull TmfViewer createLeftChildViewer(Composite parent) { CounterTreeViewer treeViewer = new CounterTreeViewer(parent); treeViewer.addSelectionChangeListener(new SelectionChangeListener()); ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace); treeViewer.traceSelected(signal); <START> setTrace(trace); <END> } return treeViewer; }</code><technical_language>base class TmfChartView sets trace in createPartControl(). - If TmfTimeViewer handles TmfTraceSelectedSignal signal, initialize trace itself? - If TmfChartView initializes trace, handle TmfTraceSelectedSignal itself? - TmfChartView set initial trace, changed a new trace is selected. matter viewers handle trace change themselves</technical_language>

Target:
protected @NonNull TmfViewer createLeftChildViewer(Composite parent) { CounterTreeViewer treeViewer = new CounterTreeViewer(parent); treeViewer.addSelectionChangeListener(new SelectionChangeListener()); ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace); treeViewer.traceSelected(signal); } return treeViewer; }
Source:
<code>public void onPartitionsRevoked(Collection<TopicPartition> topicPartitions) { _logger.info("Partition ownership revoked for {}, checkpointing.", topicPartitions); <START> if (_autoPausedSourcePartitions.retainAll(topicPartitions)) { <END> _logger.info("Auto-paused partitions set changed after onPartitionsRevoked. Current set is: {}", _autoPausedSourcePartitions); } if (!_shouldDie) { maybeCommitOffsets(_consumer, true); } }</code><technical_language>Question: call Set::retainAll() Set::removeAll() part of onPartitionsRevoked</technical_language>

Target:
public void onPartitionsRevoked(Collection<TopicPartition> topicPartitions) { _logger.info("Partition ownership revoked for {}, checkpointing.", topicPartitions); if (!_shouldDie) { maybeCommitOffsets(_consumer, true); } _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); }
Source:
<code>protected Event analizePosition(Position position) { <START> Object cmdResult = position.getAttributes().get(Position.KEY_RESULT); <END> if (cmdResult != null) { return new Event(Event.COMMAND_RESULT, position.getDeviceId(), position.getId()); } return null; }</code><technical_language>rename cmdResult commandResult</technical_language>

Target:
protected Event analizePosition(Position position) { Object commandResult = position.getAttributes().get(Position.KEY_RESULT); if (commandResult != null) { return new Event(Event.TYPE_COMMAND_RESULT, position.getDeviceId(), position.getId()); } return null; }
Source:
<code>public FileSystem newFileSystem(final URI uri, <START> final Map<String, ?> env) { <END> checkNotNull("uri", uri); checkNotNull("env", env); throw new FileSystemAlreadyExistsException(uri.toString()); }</code><technical_language>ignore sonarCloud :)</technical_language>

Target:
public FileSystem newFileSystem(final URI uri, final Map<String, ?> env) throws IllegalArgumentException, IOException, SecurityException, FileSystemAlreadyExistsException { checkNotNull("uri", uri); checkNotNull("env", env); throw new FileSystemAlreadyExistsException(uri.toString()); }
Source:
<code>protected boolean isSecured() { PropertyCharacteristicHandler propertyHandler = Framework.getService(PropertyCharacteristicHandler.class); String xPath = getXPath(); String path = xPath.substring(xPath.lastIndexOf(':') + 1); <START> return propertyHandler.isSecured(getSchema().getName(), path) && !ClientLoginModule.isCurrentAdministrator(); <END> }</code><technical_language>I prefer "secured" notion stored a flag, other property characteristics (like readonly, dirty, etc.). computed creation time call isSecured (except for check of ClientLoginModule.isCurrentAdministrator)</technical_language>

Target:
protected boolean isSecured() { return areFlagsSet(IS_SECURED) && !ClientLoginModule.isCurrentAdministrator(); }
Source:
<code>private ListenableFuture<Void> deinitInternal() { <START> mInitialized.set(false); <END> ListenableFuture<Void> future = mCameraRepository.deinit(); return CallbackToFutureAdapter.getFuture( completer -> { future.addListener(() -> { if (mCameraExecutor instanceof CameraExecutor) { CameraExecutor executor = (CameraExecutor) mCameraExecutor; executor.deinit(); } completer.set(null); }, mCameraExecutor); return "CameraX deinitInternal"; } ); }</code><technical_language>CameraX instance is replaced init(). Do reason allow resetting this false? check is set "true" deinit() run a NullPointerException</technical_language>

Target:
private ListenableFuture<Void> deinitInternal() { if (!mInitialized.getAndSet(false)) { return mDeinitInternalFuture; } ListenableFuture<Void> future = mCameraRepository.deinit(); mDeinitInternalFuture = CallbackToFutureAdapter.getFuture( completer -> { future.addListener(() -> { if (mCameraExecutor instanceof CameraExecutor) { CameraExecutor executor = (CameraExecutor) mCameraExecutor; executor.deinit(); } completer.set(null); }, mCameraExecutor); return "CameraX deinitInternal"; } ); return mDeinitInternalFuture; }
Source:
<code>public List<Node> getChildren() { List<Node> children = new ArrayList<Node>(); children.addAll(methods); <START> return children; <END> }</code><technical_language>return new ArrayList<>(methods); return methods</technical_language>

Target:
public List<Node> getChildren() { return new ArrayList<Node>(methods); }
Source:
<code>public static Integer toInteger(Boolean bool) { if (null == bool) { return null; } <START> return bool.booleanValue() ? new Integer(1) : new Integer(0); <END> }</code><technical_language>Integer#valueOf(int), delegate work method above, benefit Java's internal int cache</technical_language>

Target:
public static Integer toInteger(Boolean bool) { if (null == bool) { return null; } return bool.booleanValue() ? Integer.valueOf(1) : Integer.valueOf(0); }
Source:
<code>public ServiceEmitter getServiceEmitter(@Self Supplier<DruidNode> configSupplier, Emitter emitter) { final DruidNode config = configSupplier.get(); String version = getClass().getPackage().getImplementationVersion(); final ImmutableMap<String, String> otherServiceDimensions = ImmutableMap.of( "version", <START> version != null ? version : "testing-version" <END> ); final ServiceEmitter retVal = new ServiceEmitter( config.getServiceName(), config.getHostAndPort(), emitter, otherServiceDimensions ); EmittingLogger.registerEmitter(retVal); return retVal; }</code><technical_language>folks in wild package embed this code in strange ways, this returned prior method of Strings.nullToEmpty</technical_language>

Target:
public ServiceEmitter getServiceEmitter(@Self Supplier<DruidNode> configSupplier, Emitter emitter) { final DruidNode config = configSupplier.get(); String version = getClass().getPackage().getImplementationVersion(); final ImmutableMap<String, String> otherServiceDimensions = ImmutableMap.of( "version", Strings.nullToEmpty(version) ); final ServiceEmitter retVal = new ServiceEmitter( config.getServiceName(), config.getHostAndPort(), emitter, otherServiceDimensions ); EmittingLogger.registerEmitter(retVal); return retVal; }
Source:
<code>public TimeGraphScale(Composite parent, TimeGraphColorScheme colors) { super(parent, colors, SWT.NO_BACKGROUND | SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED); TmfSignalManager.register(this); addMouseListener(this); addMouseMoveListener(this); TimeDraw.updateTimeZone(); addDisposeListener(new DisposeListener() { @Override <START> public void widgetDisposed(DisposeEvent e) { <END> TmfSignalManager.deregister(TimeGraphScale.this); } }); }</code><technical_language>lambda</technical_language>

Target:
public TimeGraphScale(Composite parent, TimeGraphColorScheme colors) { super(parent, colors, SWT.NO_BACKGROUND | SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED); TmfSignalManager.register(this); addMouseListener(this); addMouseMoveListener(this); TimeDraw.updateTimeZone(); addDisposeListener((e) -> { TmfSignalManager.deregister(TimeGraphScale.this); }); }
Source:
<code>public void testSelectInverseOneToOne() { inTransaction( session -> { EntityA a = new EntityA( 1L, new EntityB( 2L ) ); session.persist( a ); session.flush(); session.clear(); List<EntityA> list = session.createQuery( "select a from EntityB b left join b.a a", EntityA.class ).list(); List<Object[]> tupleList = session.createQuery( <START> "select b, b.id, a from EntityB b left join b.a a", <END> Object[].class ).list(); assertEquals( "Selecting inverse one-to-one didn't construct the object properly from the result set!", list.get(0), tupleList.get(0)[2] ); } ); }</code><technical_language>add 1 2 more cases reordering scalars a bit gather some more confidence assumptions ordering of arrays. select b, b.id, a, a.id EntityB b left join b.a a</technical_language>

Target:
public void testSelectInverseOneToOne() { inTransaction( session -> { EntityA a = new EntityA( 1L, new EntityB( 2L ), new EntityC( 3L ) ); session.persist( a ); session.flush(); session.clear(); List<Object[]> tupleList = session.createQuery( "select b, b.id, a from EntityB b left join b.a a", Object[].class ).list(); List<EntityA> list = session.createQuery( "select a from EntityB b left join b.a a", EntityA.class ).list(); assertEquals( "Selecting inverse one-to-one didn't construct the object properly from the result set!", list.get(0), tupleList.get(0)[2] ); } ); }
Source:
<code>public InfinispanClientImpl(ClientConfig clientConfig) { if (clientConfig instanceof ClientConfigurationLoader.ConfigurationWrapper) { <START> ClientConfigurationLoader.ConfigurationWrapper wrapper = (ClientConfigurationLoader.ConfigurationWrapper) clientConfig; <END> cacheManager = new RemoteCacheManager(wrapper.getConfiguration()); } asyncExecutorService = cacheManager.getAsyncExecutorService(); }</code><technical_language>is clientConfig is else</technical_language>

Target:
public InfinispanClientImpl(ClientConfig clientConfig) { if (clientConfig instanceof ClientConfigurationLoader.ConfigurationWrapper) { ClientConfigurationLoader.ConfigurationWrapper wrapper = (ClientConfigurationLoader.ConfigurationWrapper) clientConfig; cacheManager = new RemoteCacheManager(wrapper.getConfiguration()); } else { throw new InfinispanConfigurationException("Unable to construct InfinispanClientImpl. ClientConfig is not a ClientConfigurationLoader.ConfigurationWrapper"); } asyncExecutorService = cacheManager.getAsyncExecutorService(); }
Source:
<code><START> public Object createAssociationKeyObject( RowKey rowKey, AssociationKeyMetadata keyMetadata ) { <END> Object result = null; if ( IgniteAssociationSnapshot.isThirdTableAssociation( keyMetadata ) ) { result = UUID.randomUUID().toString(); } else { String associationKeyColumns[] = keyMetadata.getAssociatedEntityKeyMetadata().getAssociationKeyColumns(); if ( associationKeyColumns.length == 1 ) { result = rowKey.getColumnValue( associationKeyColumns[0] ); } else { BinaryObjectBuilder builder = createBinaryObjectBuilder( findKeyType( keyMetadata.getAssociatedEntityKeyMetadata().getEntityKeyMetadata() ) ); for ( int i = 0; i < associationKeyColumns.length; i++ ) { builder.setField( StringHelper.stringAfterPoint( associationKeyColumns[i] ), rowKey.getColumnValue( associationKeyColumns[i] ) ); } result = builder.build(); } } return result; }</code><technical_language>I is wrong in creation of association key, considering entitykey risk insert element if connected entities. I this is reason ManyToManyExtraTest fails, student mario is inserted in class math english classes count element in associations end result is 3 association is recorded for of classes. @Z-z-z-z investaigate this</technical_language>

Target:
public Object createAssociationKeyObject( RowKey rowKey, AssociationKeyMetadata keyMetadata ) { Object result = null; if ( IgniteAssociationSnapshot.isThirdTableAssociation( keyMetadata ) ) { result = UUID.randomUUID().toString(); } else { String associationKeyColumns[] = keyMetadata.getAssociatedEntityKeyMetadata().getAssociationKeyColumns(); if ( associationKeyColumns.length == 1 ) { result = rowKey.getColumnValue( associationKeyColumns[0] ); } else { HashCodeBuilder hashBuilder = new HashCodeBuilder(); BinaryObjectBuilder builder = createBinaryObjectBuilder( findKeyType( keyMetadata.getAssociatedEntityKeyMetadata().getEntityKeyMetadata() ) ); for ( int i = 0; i < associationKeyColumns.length; i++ ) { builder.setField( StringHelper.stringAfterPoint( associationKeyColumns[i] ), rowKey.getColumnValue( associationKeyColumns[i] ) ); hashBuilder.append( rowKey.getColumnValue( associationKeyColumns[i] ) ); } builder.hashCode( hashBuilder.toHashCode() ); result = builder.build(); } } return result; }
Source:
<code>public APIResult getExtensionDefinition( @PathParam("extension-name") String extensionName) { checkIfExtensionServiceIsEnabled(); checkIfExtensionExists(extensionName); try { ExtensionType extensionType = getExtensionType(extensionName); if (ExtensionType.TRUSTED.equals(extensionType)) { return new APIResult(APIResult.Status.SUCCEEDED, ExtensionStore.get().getResource(extensionName, extensionName.toLowerCase() + EXTENSION_PROPERTY_JSON_SUFFIX)); } else { return new APIResult(APIResult.Status.SUCCEEDED, <START> ExtensionStore.getMetaStore().getDetail(extensionName).getDescription()); <END> } } catch (FalconException e) { throw FalconWebException.newAPIException(e, Response.Status.BAD_REQUEST); } catch (Throwable e) { throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }</code><technical_language>This is returning short description user supplied time of registration. returned is content of file/files META</technical_language>

Target:
public APIResult getExtensionDefinition( @PathParam("extension-name") String extensionName) { checkIfExtensionServiceIsEnabled(); checkIfExtensionExists(extensionName); try { ExtensionType extensionType = getExtensionType(extensionName); if (ExtensionType.TRUSTED.equals(extensionType)) { return new APIResult(APIResult.Status.SUCCEEDED, ExtensionStore.get().getResource(extensionName, extensionName.toLowerCase() + EXTENSION_PROPERTY_JSON_SUFFIX)); } else { return new APIResult(APIResult.Status.SUCCEEDED, ExtensionStore.get().getResource(extensionName, null)); } } catch (FalconException e) { throw FalconWebException.newAPIException(e, Response.Status.BAD_REQUEST); } catch (Throwable e) { throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }
Source:
<code>private int persistHydrant(FireHydrant indexToPersist, SegmentIdWithShardSpec identifier) { synchronized (indexToPersist) { if (indexToPersist.hasSwapped()) { log.info( "Segment[%s], Hydrant[%s] already swapped. Ignoring request to persist.", identifier, indexToPersist ); return 0; } log.info("Segment[%s], persisting Hydrant[%s]", identifier, indexToPersist); try { int numRows = indexToPersist.getIndex().size(); final File persistedFile; final File persistDir = createPersistDirIfNeeded(identifier); <START> final IndexSpec indexSpec = tuningConfig.getIndexSpec(); <END> persistedFile = indexMerger.persist( indexToPersist.getIndex(), identifier.getInterval(), new File(persistDir, String.valueOf(indexToPersist.getCount())), indexSpec, tuningConfig.getSegmentWriteOutMediumFactory() ); indexToPersist.swapSegment( new QueryableIndexSegment(indexIO.loadIndex(persistedFile), indexToPersist.getSegmentId()) ); return numRows; } catch (IOException e) { log.makeAlert("dataSource[%s] -- incremental persist failed", schema.getDataSource()) .addData("segment", identifier.toString()) .addData("count", indexToPersist.getCount()) .emit(); throw new RuntimeException(e); } } }</code><technical_language>Change belong this PR</technical_language>

Target:
private int persistHydrant(FireHydrant indexToPersist, SegmentIdWithShardSpec identifier) { synchronized (indexToPersist) { if (indexToPersist.hasSwapped()) { log.info( "Segment[%s], Hydrant[%s] already swapped. Ignoring request to persist.", identifier, indexToPersist ); return 0; } log.info("Segment[%s], persisting Hydrant[%s]", identifier, indexToPersist); try { int numRows = indexToPersist.getIndex().size(); final File persistedFile; final File persistDir = createPersistDirIfNeeded(identifier); persistedFile = indexMerger.persist( indexToPersist.getIndex(), identifier.getInterval(), new File(persistDir, String.valueOf(indexToPersist.getCount())), tuningConfig.getIndexSpecForIntermediatePersists(), tuningConfig.getSegmentWriteOutMediumFactory() ); indexToPersist.swapSegment( new QueryableIndexSegment(indexIO.loadIndex(persistedFile), indexToPersist.getSegmentId()) ); return numRows; } catch (IOException e) { log.makeAlert("dataSource[%s] -- incremental persist failed", schema.getDataSource()) .addData("segment", identifier.toString()) .addData("count", indexToPersist.getCount()) .emit(); throw new RuntimeException(e); } } }
Source:
<code>public void close() throws SQLException { if (hpccConnection != null) { <START> hpccConnection.close(); <END> hpccConnection = null; } if (result != null) { result.close(); result = null; } sqlQuery = ""; dbMetadata = null; closed = true; parameters = null; parser = null; eclQuery = null; }</code><technical_language>closing connection well? if caller attempts execute query closing prepstmt</technical_language>

Target:
public void close() throws SQLException { if (!closed) { closed = true; hpccConnection = null; result = null; sqlQuery = null; dbMetadata = null; parameters = null; parser = null; eclQuery = null; } }
Source:
<code>private void createSystemRole(String roleName, String[] userList, Permission[] permissions) throws UserStoreException { if (systemUserRoleManager.isExistingRole(roleName)) { handleRoleAlreadyExistException(roleName, userList, permissions); } try { systemUserRoleManager.addSystemRole(roleName, userList); } catch (UserStoreException e) { if (ERROR_CODE_DUPLICATE_WHILE_ADDING_A_SYSTEM_ROLE.getCode().contains(e.getErrorCode())) { <START> if (systemUserRoleManager.isExistingRole(roleName)) { <END> handleRoleAlreadyExistException(roleName, userList, permissions); } } throw e; } }</code><technical_language>same... need check is existing</technical_language>

Target:
private void createSystemRole(String roleName, String[] userList, Permission[] permissions) throws UserStoreException { if (systemUserRoleManager.isExistingRole(roleName)) { handleRoleAlreadyExistException(roleName, userList, permissions); } try { systemUserRoleManager.addSystemRole(roleName, userList); } catch (UserStoreException e) { if (ERROR_CODE_DUPLICATE_WHILE_ADDING_A_SYSTEM_ROLE.getCode().contains(e.getErrorCode())) { handleRoleAlreadyExistException(roleName, userList, permissions); } throw e; } }
Source:
<code>public void updateShouldUpdateEmail() throws Exception { userDao.saveOrUpdate(new User("user-1")); HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); userService.update(new User("user-1"), TriState.UNSET, TriState.UNSET, "foo@example.com", null, result); assertThat(result.isSuccessful(), is(true)); assertThat(userService.findUserByName("user-1").getEmail(), is("foo@example.com")); result = new HttpLocalizedOperationResult(); userService.update(new User("user-1"), TriState.TRUE, TriState.UNSET, "", null, result); assertThat(userService.findUserByName("user-1").getEmail(), is("")); assertThat(result.isSuccessful(), is(true)); <START> } <END></code><technical_language>new line police is upset</technical_language>

Target:
public void updateShouldUpdateEmail() throws Exception { User user = new User("user-1"); addUser(user); HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); userService.update(user, TriState.UNSET, TriState.UNSET, "foo@example.com", null, result); assertThat(result.isSuccessful(), is(true)); assertThat(user.getEmail(), is("foo@example.com")); result = new HttpLocalizedOperationResult(); userService.update(user, TriState.TRUE, TriState.UNSET, "", null, result); assertThat(result.isSuccessful(), is(true)); assertThat(user.getEmail(), is("")); }
Source:
<code>private void handleSuccess(IndexedRecord input) throws SQLException { Schema outputSchema = rowProperties.getSchema(); if (outputSchema == null || outputSchema.getFields().size() == 0) { return; } if (rowProperties.propagateQueryResultSet()) { if (rs == null || (!resultSetValidation && !validateResultSet())) { return; } if (resultSetFactory == null) { resultSetFactory = new SnowflakeResultSetIndexedRecordConverter(); resultSetFactory.setSchema(mainSchema); } while (rs.next()) { result.totalCount++; <START> result.successCount++; <END> IndexedRecord resultSetIndexedRecord = resultSetFactory.convertToAvro(rs); if (AvroUtils.isIncludeAllFields(outputSchema)) { successfulWrites.add(resultSetIndexedRecord); } else { IndexedRecord output = new GenericData.Record(outputSchema); for (Field outField : outputSchema.getFields()) { Field inputField = resultSetIndexedRecord.getSchema().getField(outField.name()); if (inputField != null) { output.put(outField.pos(), resultSetIndexedRecord.get(inputField.pos())); } } successfulWrites.add(output); } } } else { result.totalCount++; result.successCount++; IndexedRecord output = new GenericData.Record(outputSchema); for (Field outField : outputSchema.getFields()) { Field inputField = input.getSchema().getField(outField.name()); if (inputField != null) { output.put(outField.pos(), input.get(inputField.pos())); } } successfulWrites.add(output); } }</code><technical_language>more correct increment counters action,</technical_language>

Target:
private void handleSuccess(IndexedRecord input) throws SQLException { Schema outputSchema = rowProperties.getSchema(); if (outputSchema == null || outputSchema.getFields().size() == 0) { return; } if (rowProperties.propagateQueryResultSet()) { if (rs == null || (!resultSetValidation && !validateResultSet())) { return; } if (resultSetFactory == null) { resultSetFactory = new SnowflakeResultSetIndexedRecordConverter(); resultSetFactory.setSchema(mainSchema); } while (rs.next()) { IndexedRecord resultSetIndexedRecord = resultSetFactory.convertToAvro(rs); if (AvroUtils.isIncludeAllFields(outputSchema)) { successfulWrites.add(resultSetIndexedRecord); } else { IndexedRecord output = new GenericData.Record(outputSchema); for (Field outField : outputSchema.getFields()) { Field inputField = resultSetIndexedRecord.getSchema().getField(outField.name()); if (inputField != null) { output.put(outField.pos(), resultSetIndexedRecord.get(inputField.pos())); } } result.totalCount++; result.successCount++; successfulWrites.add(output); } } } else { IndexedRecord output = new GenericData.Record(outputSchema); for (Field outField : outputSchema.getFields()) { Field inputField = input.getSchema().getField(outField.name()); if (inputField != null) { output.put(outField.pos(), input.get(inputField.pos())); } } result.totalCount++; result.successCount++; successfulWrites.add(output); } }