auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>S3SelectLineRecordReader( Configuration configuration, HiveClientConfig clientConfig, Path path, long start, long length, Properties schema, String ionSqlQuery, PrestoS3ClientFactory s3ClientFactory) { requireNonNull(configuration, "configuration is null"); requireNonNull(clientConfig, "clientConfig is null"); requireNonNull(schema, "schema is null"); requireNonNull(path, "path is null"); requireNonNull(ionSqlQuery, "ionSqlQuery is null"); requireNonNull(s3ClientFactory, "s3ClientFactory is null"); this.selectClient = new PrestoS3SelectClient(configuration, clientConfig, s3ClientFactory); closer.register(selectClient); this.lineDelimiter = (schema).getProperty(LINE_DELIM, "\n"); this.processedRecords = 0; this.recordsFromS3 = 0; this.start = start; this.position = this.start; this.end = this.start + length; this.isFirstLine = true; this.selectObjectContentRequest = buildSelectObjectRequest(schema, ionSqlQuery, path); HiveS3Config defaults = new HiveS3Config(); <START> this.maxAttempts = configuration.getInt(S3_MAX_CLIENT_RETRIES, defaults.getS3MaxClientRetries()) + 1; <END> this.maxBackoffTime = Duration.valueOf(configuration.get(S3_MAX_BACKOFF_TIME, defaults.getS3MaxBackoffTime().toString())); this.maxRetryTime = Duration.valueOf(configuration.get(S3_MAX_RETRY_TIME, defaults.getS3MaxRetryTime().toString())); }</code><technical_language>this throw? in case do need close client? If so, flip creation order. (create client last, is fail)</technical_language>

Target:
S3SelectLineRecordReader( Configuration configuration, HiveClientConfig clientConfig, Path path, long start, long length, Properties schema, String ionSqlQuery, PrestoS3ClientFactory s3ClientFactory) { requireNonNull(configuration, "configuration is null"); requireNonNull(clientConfig, "clientConfig is null"); requireNonNull(schema, "schema is null"); requireNonNull(path, "path is null"); requireNonNull(ionSqlQuery, "ionSqlQuery is null"); requireNonNull(s3ClientFactory, "s3ClientFactory is null"); this.lineDelimiter = (schema).getProperty(LINE_DELIM, "\n"); this.processedRecords = 0; this.recordsFromS3 = 0; this.start = start; this.position = this.start; this.end = this.start + length; this.isFirstLine = true; this.compressionCodecFactory = new CompressionCodecFactory(configuration); this.selectObjectContentRequest = buildSelectObjectRequest(schema, ionSqlQuery, path); HiveS3Config defaults = new HiveS3Config(); this.maxAttempts = configuration.getInt(S3_MAX_CLIENT_RETRIES, defaults.getS3MaxClientRetries()) + 1; this.maxBackoffTime = Duration.valueOf(configuration.get(S3_MAX_BACKOFF_TIME, defaults.getS3MaxBackoffTime().toString())); this.maxRetryTime = Duration.valueOf(configuration.get(S3_MAX_RETRY_TIME, defaults.getS3MaxRetryTime().toString())); this.selectClient = new PrestoS3SelectClient(configuration, clientConfig, s3ClientFactory); closer.register(selectClient); }
Source:
<code>private static boolean parameterCanBeNull(final VariableTree variableTree) { <START> return variableTree.symbol().metadata().isAnnotatedWith("javax.annotation.CheckForNull") <END> || variableTree.symbol().metadata().isAnnotatedWith("javax.annotation.Nullable"); }</code><technical_language>@DidierBesset assign variableTree.symbol().metadata() a variable simplify return statement</technical_language>

Target:
private static boolean parameterCanBeNull(final VariableTree variableTree) { final SymbolMetadata metadata = variableTree.symbol().metadata(); return metadata.isAnnotatedWith("javax.annotation.CheckForNull") || metadata.isAnnotatedWith("javax.annotation.Nullable"); }
Source:
<code>private CqlQueryResponse executeCqlQuery(CqlRequest cqlRequest) throws UnsupportedQueryException, SourceUnavailableException, FederationException { QueryRequest request = cqlRequest.createQueryRequest(catalogFramework.getId(), filterBuilder); Stopwatch stopwatch = Stopwatch.createStarted(); List<QueryResponse> responses = Collections.synchronizedList(new ArrayList<>()); List<Result> results = ResultIterable.resultIterable( (queryRequest) -> { QueryResponse queryResponse = catalogFramework.query(queryRequest); responses.add(queryResponse); return queryResponse; }, request, cqlRequest.getCount()) .stream() .collect(Collectors.toList()); QueryResponse response = new QueryResponseImpl( request, results, true, <START> responses.stream().map(QueryResponse::getHits).findFirst().orElse(-1l), <END> responses .stream() .map(QueryResponse::getProperties) .findFirst() .orElse(Collections.emptyMap())); stopwatch.stop(); return new CqlQueryResponse( cqlRequest.getId(), request, response, cqlRequest.getSource(), stopwatch.elapsed(TimeUnit.MILLISECONDS), cqlRequest.isNormalize(), filterAdapter, actionRegistry); }</code><technical_language>responses for hits. one. Additionally, CatalogFramework.query() returns response. If conditions hold, Line 178 collapses to: responses.get(0).getHits()</technical_language>

Target:
private CqlQueryResponse executeCqlQuery(CqlRequest cqlRequest) throws UnsupportedQueryException, SourceUnavailableException, FederationException { QueryRequest request = cqlRequest.createQueryRequest(catalogFramework.getId(), filterBuilder); Stopwatch stopwatch = Stopwatch.createStarted(); List<QueryResponse> responses = Collections.synchronizedList(new ArrayList<>()); QueryFunction queryFunction = (queryRequest) -> { QueryResponse queryResponse = catalogFramework.query(queryRequest); responses.add(queryResponse); return queryResponse; }; List<Result> results = ResultIterable.resultIterable(queryFunction, request, cqlRequest.getCount()) .stream() .collect(Collectors.toList()); QueryResponse response = new QueryResponseImpl( request, results, true, responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getHits) .findFirst() .orElse(-1l), responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getProperties) .findFirst() .orElse(Collections.emptyMap())); stopwatch.stop(); return new CqlQueryResponse( cqlRequest.getId(), request, response, cqlRequest.getSource(), stopwatch.elapsed(TimeUnit.MILLISECONDS), cqlRequest.isNormalize(), filterAdapter, actionRegistry); }
Source:
<code>@Override @Nullable public Boolean trySample(HttpRequest request) { if (request == null) return null; HttpAdapter<Object, Void> adapter; if (request instanceof HttpClientRequest) { <START> adapter = new HttpClientAdapters.ToRequestAdapter((HttpClientRequest) request); <END> } else { adapter = new HttpServerAdapters.ToRequestAdapter((HttpServerRequest) request); } return trySample(adapter, request.unwrap()); }</code><technical_language>L35 updates from: * @deprecated 5.8, {@code RequestSampler<HttpRequest>}. * @deprecated 5.8, {@code SamplerFunction<HttpRequest>}</technical_language>

Target:
@Override @Nullable public Boolean trySample(HttpRequest request) { if (request == null) return null; Object unwrapped = request.unwrap(); if (unwrapped == null) unwrapped = NULL_SENTINEL; HttpAdapter<Object, Void> adapter; if (request instanceof HttpClientRequest) { adapter = new HttpClientAdapters.ToRequestAdapter((HttpClientRequest) request, unwrapped); } else { adapter = new HttpServerAdapters.ToRequestAdapter((HttpServerRequest) request, unwrapped); } return trySample(adapter, unwrapped); }
Source:
<code>public void validate_shouldPassIfThereIsAtLeastOneValidDescription() throws Exception { Concept concept = new Concept(); concept.addDescription(new ConceptDescription("one description", Context.getLocale())); Errors errors = new BindException(concept, "concept"); new ConceptValidator().validate(concept, errors); <START> boolean notFound = false; <END> for (ObjectError error : errors.getAllErrors()) { if (!error.getCode().equals("Concept.error.notAtLeastOneNonBlankDescription")) { notFound = true; } } Assert.assertTrue(notFound); }</code><technical_language>this true</technical_language>

Target:
public void validate_shouldPassIfThereIsAtLeastOneValidDescription() throws Exception { Concept concept = new Concept(); concept.addDescription(new ConceptDescription("one description", Context.getLocale())); Errors errors = new BindException(concept, "concept"); new ConceptValidator().validate(concept, errors); boolean notFound = true; for (ObjectError error : errors.getAllErrors()) { if (error.getCode().equals("Concept.error.notAtLeastOneNonBlankDescription")) { notFound = false; break; } } Assert.assertTrue(notFound); }
Source:
<code>void display(final ProjectMergeStrategies result) { final Project.NameKey wildKey = Gerrit.getConfig().getWildProject(); Project.NameKey parent = result.getInheritsFrom(); final boolean isWild = parent == null; if (parent == null) { parent = wildKey; } parentPanel.setVisible(!isWild); parentName.setTargetHistoryToken(Dispatcher.toProjectAdmin(parent, ProjectScreen.MERGE_STRATEGY)); parentName.setText(parent.get()); <START> mergeStrategies.display(result.getLocal()); <END> mergeStrategies.setRevision(result.getRevision()); }</code><technical_language>I merge strategies table visible if merge strategies display. a ProjectAccessScreen, table access rights is displayed if access rights defined project, hidden. I merge strategies table</technical_language>

Target:
void display(final ProjectMergeStrategies result) { final Project.NameKey wildKey = Gerrit.getConfig().getWildProject(); Project.NameKey parent = result.getInheritsFrom(); final boolean isWild = parent == null; if (parent == null) { parent = wildKey; } parentPanel.setVisible(!isWild); parentName.setTargetHistoryToken(Dispatcher.toProjectAdmin(parent, ProjectScreen.MERGE_STRATEGY)); parentName.setText(parent.get()); mergeStrategies.setRevision(result.getRevision()); if (!result.getMergeStrategies().isEmpty()) { mergeStrategies.setVisible(true); mergeStrategies.display(result.getMergeStrategies()); } }
Source:
<code>public void beforeMethod() throws Exception { subConsumers = new LineConsumer[] { lineConsumer1, lineConsumer2 }; for (LineConsumer lineConsumer : subConsumers) { <START> doNothing().when(lineConsumer).writeLine(anyString()); <END> } }</code><technical_language>I is default behavior. Do need declare in additionally</technical_language>

Target:
public void beforeMethod() throws Exception { subConsumers = new LineConsumer[] { lineConsumer1, lineConsumer2, lineConsumer3 }; compositeLineConsumer = new CompositeLineConsumer(subConsumers); }
Source:
<code>void didChange() { realmObserverPairs.foreach(onChangeCallBack); Iterator<Runnable> it = transactionCallbacks.iterator(); while (it.hasNext()) { Runnable runnable = it.next(); <START> it.remove(); <END> runnable.run(); } }</code><technical_language>this work if transactionCallbacks contains multiple callbacks? If previous code recursive call, I ConcurrentModificationException thrown</technical_language>

Target:
void didChange() { realmObserverPairs.foreach(onChangeCallBack); if (!transactionCallbacks.isEmpty()) { List<Runnable> callbacks = transactionCallbacks; transactionCallbacks = new ArrayList<Runnable>(); for (Runnable runnable : callbacks) { runnable.run(); } } }
Source:
<code>public void saveEncounter_shouldSaveEncounterWhenTopLevelObsIsUpdatedByRemovingChildObs() throws Exception { executeDataSet(ENC_OBS_HIERARCHY_DATA_XML); EncounterService es = Context.getEncounterService(); ObsService os = Context.getObsService(); Encounter enc = es.getEncounter(100); Obs oParent = os.getObs(100); Obs oChild = os.getObs(101); oParent.removeGroupMember(oChild); es.saveEncounter(enc); <START> Context.evictFromSession(enc); <END> Context.flushSession(); enc = es.getEncounter(100); Set<Obs> obsAtTopLevel = enc.getObsAtTopLevel(true); assertEquals(2,obsAtTopLevel.size()); assertTrue(obsAtTopLevel.contains(os.getObs(100))); Obs newObs = obsAtTopLevel.stream().filter(obs -> obs.getObsId() != 100 ).findFirst().get(); assertNotNull(newObs.getPreviousVersion()); assertEquals(oChild.getObsId(), newObs.getPreviousVersion().getObsId()); assertTrue(os.getObs(100).getGroupMembers(true).contains(os.getObs(102))); assertFalse(os.getObs(100).getGroupMembers(true).contains(os.getObs(101))); }</code><technical_language>Same, need flush clear session</technical_language>

Target:
public void saveEncounter_shouldSaveEncounterWhenTopLevelObsIsUpdatedByRemovingChildObs() throws Exception { executeDataSet(ENC_OBS_HIERARCHY_DATA_XML); EncounterService es = Context.getEncounterService(); ObsService os = Context.getObsService(); Encounter enc = es.getEncounter(100); Obs oParent = os.getObs(100); Obs oChild = os.getObs(101); oParent.removeGroupMember(oChild); es.saveEncounter(enc); Context.flushSession(); Context.clearSession(); enc = es.getEncounter(100); Set<Obs> obsAtTopLevel = enc.getObsAtTopLevel(true); assertEquals(2,obsAtTopLevel.size()); assertTrue(obsAtTopLevel.contains(os.getObs(100))); Obs newObs = obsAtTopLevel.stream().filter(obs -> obs.getObsId() != 100 ).findFirst().get(); assertNotNull(newObs.getPreviousVersion()); assertEquals(oChild.getObsId(), newObs.getPreviousVersion().getObsId()); assertTrue(os.getObs(100).getGroupMembers(true).contains(os.getObs(102))); assertTrue(os.getObs(100).getGroupMembers(true).contains(os.getObs(101))); }
Source:
<code>protected void activate(ComponentContext ctx, Map<String, Object> properties) { <START> logger.info("Activating"); <END> this.componentContext = ctx; init(properties); }</code><technical_language>a bit detailed log message</technical_language>

Target:
protected void activate(ComponentContext ctx, Map<String, Object> properties) { logger.info("Activating {}", ctx.getProperties().get(KURA_SERVICE_PID)); this.componentContext = ctx; init(properties); }
Source:
<code>public ThreadSafeUnaligner( int totalNumChannels, ChannelStateWriter channelStateWriter, CheckpointBarrierUnaligner handler) { barrierReceivedChannels = new boolean[totalNumChannels]; this.channelStateWriter = channelStateWriter; <START> this.handler = handler; <END> Arrays.fill(barrierReceivedChannels, true); numOpenChannels = totalNumChannels; }</code><technical_language>This cyclic reference is redundant confusing IMO. Instead, fields taskName, AbstractInvokable flattenedChannelIndex info in some form. (not a important thing, feel free ignore resolve)</technical_language>

Target:
public ThreadSafeUnaligner( int totalNumChannels, ChannelStateWriter channelStateWriter, CheckpointBarrierUnaligner handler) { storeNewBuffers = new boolean[totalNumChannels]; this.channelStateWriter = channelStateWriter; this.handler = handler; numOpenChannels = totalNumChannels; }
Source:
<code>private void next(final String email, final String password) { if (TextUtils.isEmpty(password)) { mPasswordField.setError(getString(R.string.required_field)); return; } else { mPasswordField.setError(null); } final FirebaseAuth firebaseAuth = mActivityHelper.getFirebaseAuth(); firebaseAuth.signInWithEmailAndPassword(email, password) .addOnFailureListener( new TaskFailureLogger(TAG, "Error signing in with email and password")) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override <START> public void onSuccess(AuthResult authResult) { <END> AuthCredential authCredential = AuthCredentialHelper.getAuthCredential(mIdpResponse); if (authCredential == null) { mActivityHelper.saveCredentialsOrFinish( mSaveSmartLock, authResult.getUser(), password, new IdpResponse(EmailAuthProvider.PROVIDER_ID, email)); } else { authResult.getUser() .linkWithCredential(authCredential) .addOnFailureListener(new TaskFailureLogger( TAG, "Error signing in with credential")) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult authResult) { mActivityHelper.saveCredentialsOrFinish( mSaveSmartLock, authResult.getUser(), mIdpResponse); } }); } } }) .addOnFailureListener(this, new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { mActivityHelper.dismissDialog(); String error = e.getLocalizedMessage(); mPasswordLayout.setError(error); } }); }</code><technical_language>I leave new implementation. I a reason for sign out thing</technical_language>

Target:
private void next(final String email, final String password) { if (TextUtils.isEmpty(password)) { mPasswordLayout.setError(getString(R.string.required_field)); return; } else { mPasswordLayout.setError(null); } mActivityHelper.showLoadingDialog(R.string.progress_dialog_signing_in); final FirebaseAuth firebaseAuth = mActivityHelper.getFirebaseAuth(); firebaseAuth.signInWithEmailAndPassword(email, password) .addOnFailureListener( new TaskFailureLogger(TAG, "Error signing in with email and password")) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult authResult) { AuthCredential authCredential = AuthCredentialHelper.getAuthCredential(mIdpResponse); if (authCredential == null) { mActivityHelper.saveCredentialsOrFinish( mSaveSmartLock, authResult.getUser(), password, new IdpResponse(EmailAuthProvider.PROVIDER_ID, email)); } else { authResult.getUser() .linkWithCredential(authCredential) .addOnFailureListener(new TaskFailureLogger( TAG, "Error signing in with credential")) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult authResult) { mActivityHelper.saveCredentialsOrFinish( mSaveSmartLock, authResult.getUser(), mIdpResponse); } }); } } }) .addOnFailureListener(this, new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { mActivityHelper.dismissDialog(); String error = e.getLocalizedMessage(); mPasswordLayout.setError(error); } }); }
Source:
<code>public IntArrayList computeEligibleRowIds(Page page) { IntArrayList ids = new IntArrayList(page.getPositionCount()); Page bucketColumnsPage = extractColumns(page, bucketColumns); for (int position = 0; position < page.getPositionCount(); position++) { <START> int bucket = HiveBucketing.getHiveBucket(tableBucketCount, typeInfoList, bucketColumnsPage, position); <END> if ((bucket - bucketToKeep) % partitionBucketCount != 0) { throw new PrestoException(HIVE_INVALID_BUCKET_FILES, format( "A row that is supposed to be in bucket %s is encountered. Only rows in bucket %s (modulo %s) is expected", bucket, bucketToKeep % partitionBucketCount, partitionBucketCount)); } if (bucket == bucketToKeep) { ids.add(position); } } return ids; }</code><technical_language>static import</technical_language>

Target:
public IntArrayList computeEligibleRowIds(Page page) { IntArrayList ids = new IntArrayList(page.getPositionCount()); Page bucketColumnsPage = extractColumns(page, bucketColumns); for (int position = 0; position < page.getPositionCount(); position++) { int bucket = getHiveBucket(tableBucketCount, typeInfoList, bucketColumnsPage, position); if ((bucket - bucketToKeep) % partitionBucketCount != 0) { throw new PrestoException(HIVE_INVALID_BUCKET_FILES, format( "A row that is supposed to be in bucket %s is encountered. Only rows in bucket %s (modulo %s) are expected", bucket, bucketToKeep % partitionBucketCount, partitionBucketCount)); } if (bucket == bucketToKeep) { ids.add(position); } } return ids; }
Source:
<code>public void writeToFile(String repoIdString, String issuesETag, String collabsETag, String labelsETag, String milestonesETag, String issueCheckTime, ObservableList<TurboUser> collaborators, ObservableList<TurboLabel> labels, ObservableList<TurboMilestone> milestones, ObservableList<TurboIssue> issues) { <START> logger.info("About to write to file for repo: " + repoIdString); <END> this.issues = issues.stream().collect(Collectors.toList()); this.collaborators = collaborators.stream().collect(Collectors.toList()); this.labels = labels.stream().collect(Collectors.toList()); this.milestones = milestones.stream().collect(Collectors.toList()); TurboRepoData currentRepoData = new TurboRepoData(issuesETag, collabsETag, labelsETag, milestonesETag, issueCheckTime, this.collaborators, this.labels, this.milestones, this.issues); Gson gson = new GsonBuilder().setPrettyPrinting().create(); String json = gson.toJson(currentRepoData); try { FileWriter writer = new FileWriter(getFileName(FILE_DATA_CACHE_TEMP, repoIdString)); writer.write(json); writer.close(); logger.info("Done writing to file for repo: " + repoIdString); File file = new File(getFileName(FILE_DATA_CACHE, repoIdString)); if (file.exists()) { if (file.delete()) { } else { logger.error("Failed to delete cache file"); } } File newFile = new File(getFileName(FILE_DATA_CACHE_TEMP, repoIdString)); if (newFile.renameTo(file)) { } else { logger.error("Failed to rename temp cache file"); } } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>logging 'last checked time' property somewhere</technical_language>

Target:
public void writeToFile(String repoIdString, String issuesETag, String collabsETag, String labelsETag, String milestonesETag, String issueCheckTime, ObservableList<TurboUser> collaborators, ObservableList<TurboLabel> labels, ObservableList<TurboMilestone> milestones, ObservableList<TurboIssue> issues) { logger.info("About to write to file for repo: " + repoIdString + " with last checked time: " + issueCheckTime); this.issues = issues.stream().collect(Collectors.toList()); this.collaborators = collaborators.stream().collect(Collectors.toList()); this.labels = labels.stream().collect(Collectors.toList()); this.milestones = milestones.stream().collect(Collectors.toList()); TurboRepoData currentRepoData = new TurboRepoData(issuesETag, collabsETag, labelsETag, milestonesETag, issueCheckTime, this.collaborators, this.labels, this.milestones, this.issues); Gson gson = new GsonBuilder().setPrettyPrinting().create(); String json = gson.toJson(currentRepoData); try { FileWriter writer = new FileWriter(getFileName(FILE_DATA_CACHE_TEMP, repoIdString)); writer.write(json); writer.close(); logger.info("Done writing to file for repo: " + repoIdString); File file = new File(getFileName(FILE_DATA_CACHE, repoIdString)); if (file.exists()) { if (file.delete()) { } else { logger.error("Failed to delete cache file"); } } File newFile = new File(getFileName(FILE_DATA_CACHE_TEMP, repoIdString)); if (newFile.renameTo(file)) { } else { logger.error("Failed to rename temp cache file"); } } catch (IOException e) { e.printStackTrace(); } }
Source:
<code>private void resetBlockBuilders() { for (int i = 0; i < replicateTypes.size(); i++) { Block newInputBlock = currentPage.getBlock(replicateChannels.get(i)); replicatedBlockBuilders.get(i).resetInputBlock(newInputBlock); } <START> <END> for (int i = 0; i < unnestTypes.size(); i++) { int inputChannel = unnestChannels.get(i); Block unnestChannelInputBlock = currentPage.getBlock(inputChannel); unnesters.get(i).resetInput(unnestChannelInputBlock); } }</code><technical_language>unnestChannelInputBlock -> newInputBlock</technical_language>

Target:
private void resetBlockBuilders() { for (int i = 0; i < replicateTypes.size(); i++) { Block newInputBlock = currentPage.getBlock(replicateChannels.get(i)); replicatedBlockBuilders.get(i).resetInputBlock(newInputBlock); } int positionCount = currentPage.getPositionCount(); maxLengths = ensureCapacity(maxLengths, positionCount, SMALL, INITIALIZE); for (int i = 0; i < unnestTypes.size(); i++) { int inputChannel = unnestChannels.get(i); Block unnestChannelInputBlock = currentPage.getBlock(inputChannel); Unnester unnester = unnesters.get(i); unnester.resetInput(unnestChannelInputBlock); int[] lengths = unnester.getLengths(); for (int j = 0; j < positionCount; j++) { maxLengths[j] = max(maxLengths[j], lengths[j]); } } }
Source:
<code><START> public Sieve(int maxPrime) { <END> throw new UnsupportedOperationException("Delete this statement and provide your own implementation."); }</code><technical_language>Please indent 4 spaces :)</technical_language>

Target:
Sieve(int maxPrime) { throw new UnsupportedOperationException("Delete this statement and provide your own implementation."); }
Source:
<code>public String getQueryId() throws SQLException { if (stmtHandle == null) { <START> return null; <END> } try { return client.GetQueryId(new TGetQueryIdReq(stmtHandle)).getQueryId(); } catch (TException e) { throw new SQLException(e); } }</code><technical_language>concurrent closure of statement</technical_language>

Target:
public String getQueryId() throws SQLException { if (stmtHandle == null) { return null; } try { return client.GetQueryId(new TGetQueryIdReq(stmtHandle)).getQueryId(); } catch (TException e) { throw new SQLException(e); } catch (Exception e) { return null; } }
Source:
<code>public String toString() { <START> return "SystemServiceItemStoppedEvent{" + <END> "item='" + item + '\'' + ", total=" + total + ", current=" + current + "} " + super.toString(); }</code><technical_language>next format SystemServiceItemStoppedEvent{item='1', ....} class org.eclipse.che.api.system.shared.event.service.SystemServiceItemStoppedEvent {evenType='someType',...} rewrite getters super class</technical_language>

Target:
public String toString() { return "SystemServiceItemStoppedEvent{" + "item='" + item + '\'' + ", total=" + total + ", current=" + current + ", eventType='" + getType() + '\'' + ", service='" + getServiceName() + "\'}"; }
Source:
<code>protected String getUrlForWebView() { <START> return ""; <END> }</code><technical_language>this link course</technical_language>

Target:
protected String getUrlForWebView() { if ( courseData != null && courseData.getCourse() != null ){ return courseData.getCourse().getCourse_url(); } return ""; }
Source:
<code>public void onSuccess() { if (failureCount.get() > 0) { <START> synchronized (this) { <END> failureCount.set(0); } } }</code><technical_language>simply set 0 avoid synchronized .get call</technical_language>

Target:
public void onSuccess() { failureCount.set(0); }
Source:
<code>public void onWalSegmentRemoved(long segmentIdx) { Map<Integer, Set<Integer>> rmvKeys = grpKeys.releaseWalKeys(segmentIdx); if (F.isEmpty(rmvKeys)) return; synchronized (metaStorageMux) { try { writeToMetaStore(0, false, true); for (Map.Entry<Integer, Set<Integer>> entry : rmvKeys.entrySet()) { <START> int grpId = entry.getKey(); <END> if (reencryptGroups.containsKey(grpId)) continue; Set<Integer> keyIds = entry.getValue(); boolean rmv = grpKeys.removeKeysById(grpId, keyIds); assert rmv : keyIds; writeToMetaStore(grpId, true, false); if (log.isInfoEnabled()) { log.info("Previous encryption keys have been removed [grpId=" + grpId + ", keyIds=" + keyIds + "]"); } } } catch (IgniteCheckedException e) { log.error("Unable to remove encryption keys from metastore.", e); } } }</code><technical_language>int -> Integer avoid boxing containsKey</technical_language>

Target:
public void onWalSegmentRemoved(long segmentIdx) { withMasterKeyChangeReadLock(() -> { synchronized (metaStorageMux) { Map<Integer, Set<Integer>> rmvKeys = grpKeys.releaseWalKeys(segmentIdx); if (F.isEmpty(rmvKeys)) return null; try { writeTrackedWalIdxsToMetaStore(); for (Map.Entry<Integer, Set<Integer>> entry : rmvKeys.entrySet()) { Integer grpId = entry.getKey(); if (reencryptGroups.containsKey(grpId)) continue; Set<Integer> keyIds = entry.getValue(); if (!grpKeys.removeKeysById(grpId, keyIds)) continue; writeGroupKeysToMetaStore(grpId, grpKeys.getAll(grpId)); if (log.isInfoEnabled()) { log.info("Previous encryption keys have been removed [grpId=" + grpId + ", keyIds=" + keyIds + "]"); } } } catch (IgniteCheckedException e) { log.error("Unable to remove encryption keys from metastore.", e); } } return null; }); }
Source:
<code>private Character argToChar(Object o) { <START> return o != null ? ((char) o) : null; <END> }</code><technical_language>(Apparently GitHub lost this one) Check instanceof Character throw IllegalArgumentException above</technical_language>

Target:
private Character argToChar(Object o) { if (o instanceof Character) return (char) o; throw new IllegalArgumentException("expected type but was " + o); }
Source:
<code>public boolean remove(String citationNumber, String phoneNumber, LocalDate dob){ if (doesAlertExist(citationNumber,phoneNumber)){ Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("citationNumber", citationNumber); parameterMap.put("phoneNumber", phoneNumber); parameterMap.put("dob", DatabaseUtilities.convertLocalDateToDatabaseDate(dob)); String sql = "DELETE FROM sms_alerts WHERE citation_number=:citationNumber AND phone_number=:phoneNumber AND date_of_birth=:dob"; try{ jdbcTemplate.execute(sql, parameterMap, new PreparedStatementCallback<Boolean>(){ @Override <START> public Boolean doInPreparedStatement(PreparedStatement ps) <END> throws SQLException, DataAccessException { return ps.execute(); } }); return true; }catch(Exception e){ LogSystem.LogDBException(e); return false; } }else{ return true; } }</code><technical_language>this prepared statement business? This a verbose compared in for deletes in jdbc</technical_language>

Target:
public boolean remove(String citationNumber, String phoneNumber, LocalDate dob){ if (doesAlertExist(citationNumber,phoneNumber)){ Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("citationNumber", citationNumber); parameterMap.put("phoneNumber", phoneNumber); parameterMap.put("dob", DatabaseUtilities.convertLocalDateToDatabaseDate(dob)); try{ int rowsAffected = jdbcTemplate.update(getSql("SMSAlert/delete-SMSAlert.sql"), parameterMap); if (rowsAffected==1){ return true; }else{ return false; } }catch(Exception e){ LogSystem.LogDBException(e); return false; } }else{ return true; } }
Source:
<code>public void shouldInstallWidget() throws Exception { String componentCode = "de_test_widget"; try { installAndCheckForCompletion(componentCode); assertThat(widgetService.getWidget(componentCode)).isNotNull(); } finally { try { if (widgetService.getWidget(componentCode) != null) { widgetService.removeWidget(componentCode); } <START> } catch (RestRourceNotFoundException ignored) { <END> } } }</code><technical_language>widgetService.getWidget(componentCode) return null if component is found, instead throw RestRourceNotFoundException. other hand, removeWidget(componentCode) method throw a ValidationGenericException if widget is found. I remove if catch ValidationGenericException instead</technical_language>

Target:
public void shouldInstallWidget() throws Exception { String componentCode = "de_test_widget"; try { installAndCheckForCompletion(componentCode); assertThat(widgetService.getWidget(componentCode)).isNotNull(); } finally { try { widgetService.removeWidget(componentCode); } catch (ValidationGenericException ignored) { } } }
Source:
<code>private void initExternalPluginsState(ILaunchConfiguration configuration) throws CoreException { Map<IPluginModelBase, String> map = BundleLauncherHelper.getTargetBundleMap(configuration, Collections.EMPTY_SET, IPDELauncherConstants.TARGET_BUNDLES); fPluginTreeViewer.setSubtreeChecked(fExternalPlugins, false); for (Entry<IPluginModelBase, String> entry : map.entrySet()) { IPluginModelBase model = entry.getKey(); if (fPluginTreeViewer.setChecked(model, true)) { setText(model, <START> entry.getValue().toString()); <END> } } fNumExternalChecked = map.size(); resetGroup(fExternalPlugins); fPluginTreeViewer.setChecked(fExternalPlugins, fNumExternalChecked > 0); fPluginTreeViewer.setGrayed(fExternalPlugins, fNumExternalChecked > 0 && fNumExternalChecked < getExternalModels().length); }</code><technical_language>removed</technical_language>

Target:
private void initExternalPluginsState(ILaunchConfiguration configuration) throws CoreException { Map<IPluginModelBase, String> map = BundleLauncherHelper.getTargetBundleMap(configuration, Collections.EMPTY_SET, IPDELauncherConstants.TARGET_BUNDLES); fPluginTreeViewer.setSubtreeChecked(fExternalPlugins, false); for (Entry<IPluginModelBase, String> entry : map.entrySet()) { IPluginModelBase model = entry.getKey(); if (fPluginTreeViewer.setChecked(model, true)) { setText(model, entry.getValue()); } } fNumExternalChecked = map.size(); resetGroup(fExternalPlugins); fPluginTreeViewer.setChecked(fExternalPlugins, fNumExternalChecked > 0); fPluginTreeViewer.setGrayed(fExternalPlugins, fNumExternalChecked > 0 && fNumExternalChecked < getExternalModels().length); }
Source:
<code>public GroupingSetAnalysis( List<Set<FieldId>> cubes, List<List<FieldId>> rollups, List<List<Set<FieldId>>> ordinarySets, List<Expression> complexExpressions) { this.cubes = cubes; this.rollups = rollups; this.ordinarySets = ordinarySets; <START> this.complexExpressions = complexExpressions; <END> }</code><technical_language>ImmutableList.copyOf of them</technical_language>

Target:
public GroupingSetAnalysis( List<Set<FieldId>> cubes, List<List<FieldId>> rollups, List<List<Set<FieldId>>> ordinarySets, List<Expression> complexExpressions) { this.cubes = ImmutableList.copyOf(cubes); this.rollups = ImmutableList.copyOf(rollups); this.ordinarySets = ImmutableList.copyOf(ordinarySets); this.complexExpressions = ImmutableList.copyOf(complexExpressions); }
Source:
<code>private boolean noBeanPresentForComponent(Object instance, String parentBeanName) { if (instance instanceof NamedComponent) { String beanName = ((NamedComponent) instance).getComponentName(); if (beanName != null) { if (this.beanFactory.containsBean(beanName)) { BeanDefinition existingBeanDefinition = this.beanFactory.getBeanDefinition(beanName); if (!ConfigurableBeanFactory.SCOPE_PROTOTYPE.equals(existingBeanDefinition.getScope()) <START> && instance != this.beanFactory.getBean(beanName)) { <END> AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition((Class<Object>) instance.getClass(), () -> instance) .getBeanDefinition(); beanDefinition.setResourceDescription("the '" + parentBeanName + "' bean definition"); throw new BeanDefinitionOverrideException(beanName, beanDefinition, existingBeanDefinition); } else { return false; } } else { return true; } } } return !this.beanFactory.getBeansOfType(instance.getClass(), false, false) .values() .contains(instance); }</code><technical_language>If fully intend != !instance.equals() need a NOSONAR</technical_language>

Target:
private boolean noBeanPresentForComponent(Object instance, String parentBeanName) { if (instance instanceof NamedComponent) { String beanName = ((NamedComponent) instance).getComponentName(); if (beanName != null) { if (this.beanFactory.containsBean(beanName)) { BeanDefinition existingBeanDefinition = this.beanFactory.getBeanDefinition(beanName); if (!ConfigurableBeanFactory.SCOPE_PROTOTYPE.equals(existingBeanDefinition.getScope()) && !instance.equals(this.beanFactory.getBean(beanName))) { AbstractBeanDefinition beanDefinition = BeanDefinitionBuilder.genericBeanDefinition((Class<Object>) instance.getClass(), () -> instance) .getBeanDefinition(); beanDefinition.setResourceDescription("the '" + parentBeanName + "' bean definition"); throw new BeanDefinitionOverrideException(beanName, beanDefinition, existingBeanDefinition); } else { return false; } } else { return true; } } } return !this.beanFactory.getBeansOfType(instance.getClass(), false, false) .values() .contains(instance); }
Source:
<code>public void testIsDeleteD() { when(data.getModType()).thenReturn(ModificationType.DELETED); assertTrue(relation.isHardDeleted()); when(data.getModType()).thenReturn(ModificationType.ARTIFACT_DELETED); <START> assertTrue(relation.isHardDeleted()); <END> when(data.getModType()).thenReturn(ModificationType.MODIFIED); assertFalse(relation.isHardDeleted()); }</code><technical_language>Is ARTIFACT_DELETED hard deleted? I thought modificationType file above, isDeleted true DELETED | ARTIFACT_DELETED, isHardDeleted DELETED only</technical_language>

Target:
public void testIsDeleteD() { when(data.getModType()).thenReturn(ModificationType.DELETED); assertTrue(relation.isHardDeleted()); when(data.getModType()).thenReturn(ModificationType.MODIFIED); assertFalse(relation.isHardDeleted()); }
Source:
<code>public void testBuilderFrom() throws IOException { final Order.OrderType type = Order.OrderType.ASK; final BigDecimal originalAmount = new BigDecimal("100.501"); final CurrencyPair currencyPair = CurrencyPair.BTC_USD; final BigDecimal limitPrice = new BigDecimal("250.34"); final BigDecimal averagePrice = new BigDecimal("255.00"); final BigDecimal cumulativeAmount = new BigDecimal("0.00"); final BigDecimal stopPrice = new BigDecimal("266.21"); final BigDecimal fee = new BigDecimal("22.2"); final Date timestamp = new Date(); final String id = "id"; final Order.OrderStatus status = Order.OrderStatus.FILLED; final StopOrder original = new StopOrder( type, originalAmount, currencyPair, id, timestamp, stopPrice, limitPrice, averagePrice, cumulativeAmount, fee, status); original.addOrderFlag(TestFlags.TEST1); original.addOrderFlag(TestFlags.TEST3); final StopOrder copy = StopOrder.Builder.from(original).build(); assertThat(copy).isEqualToComparingFieldByField(original); StopOrder jsonCopy = ObjectMapperHelper.viaJSON(copy); assertThat(jsonCopy).isEqualToIgnoringGivenFields(copy, "cumulativeAmount"); <START> assertTrue(jsonCopy.getCumulativeAmount().compareTo(copy.getCumulativeAmount()) == 0); <END> }</code><technical_language>this mixes units test please separate other tests this build order pass viaJSON</technical_language>

Target:
public void testBuilderFrom() throws IOException { final Order.OrderType type = Order.OrderType.ASK; final BigDecimal originalAmount = new BigDecimal("100.501"); final CurrencyPair currencyPair = CurrencyPair.BTC_USD; final BigDecimal limitPrice = new BigDecimal("250.34"); final BigDecimal averagePrice = new BigDecimal("255.00"); final BigDecimal cumulativeAmount = new BigDecimal("0.00"); final BigDecimal stopPrice = new BigDecimal("266.21"); final BigDecimal fee = new BigDecimal("22.2"); final Date timestamp = new Date(); final String id = "id"; final Order.OrderStatus status = Order.OrderStatus.FILLED; final StopOrder original = new StopOrder( type, originalAmount, currencyPair, id, timestamp, stopPrice, limitPrice, averagePrice, cumulativeAmount, fee, status); original.addOrderFlag(TestFlags.TEST1); original.addOrderFlag(TestFlags.TEST3); final StopOrder copy = StopOrder.Builder.from(original).build(); assertThat(copy).isEqualToComparingFieldByField(original); }
Source:
<code>public void testSwitchWhitespaceAround() throws Exception { final String[] expected = { "6:15: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "switch"), }; <START> verify(checkConfig, getPath("InputWhitespaceAroundSwitchWhitespaceAround.java"), expected); <END> }</code><technical_language>Strange name. InputWhitespaceAroundSwitch.java</technical_language>

Target:
public void testSwitchWhitespaceAround() throws Exception { final String[] expected = { "6:15: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "switch"), }; verify(checkConfig, getPath("InputWhitespaceAroundSwitch.java"), expected); }
Source:
<code>public void testKieServerStateConfigMap() throws InterruptedException { Resource<ConfigMap, DoneableConfigMap> configMapResource = client.configMaps().inNamespace(testNamespace) .withName(TEST_KIE_SERVER_ID); ConfigMap configMap = configMapResource.get(); assertEquals(TEST_KIE_SERVER_ID, configMap.getMetadata().getName()); Map<String, String> data = configMap.getData(); String srvStateInXML = data.get(KieServerStateCloudRepository.CFG_MAP_DATA_KEY); KieServerState kieServerState = (KieServerState) xs.fromXML(srvStateInXML); assertNotNull(kieServerState); assertEquals(TEST_KIE_SERVER_ID, kieServerState.getConfiguration().getConfigItem(KieServerConstants.KIE_SERVER_ID).getValue()); <START> assertTrue(client instanceof AutoCloseable); <END> }</code><technical_language>Is reason test this</technical_language>

Target:
public void testKieServerStateConfigMap() throws InterruptedException { Resource<ConfigMap, DoneableConfigMap> configMapResource = client.configMaps().inNamespace(testNamespace) .withName(TEST_KIE_SERVER_ID); ConfigMap configMap = configMapResource.get(); assertEquals(TEST_KIE_SERVER_ID, configMap.getMetadata().getName()); Map<String, String> data = configMap.getData(); String srvStateInXML = data.get(KieServerStateCloudRepository.CFG_MAP_DATA_KEY); KieServerState kieServerState = (KieServerState) xs.fromXML(srvStateInXML); assertNotNull(kieServerState); assertEquals(TEST_KIE_SERVER_ID, kieServerState.getConfiguration().getConfigItem(KieServerConstants.KIE_SERVER_ID).getValue()); }
Source:
<code>public void askUserAndSaveMigratedSession(Session session) { if (MigrationUIUtil.shouldMigratedElementBeSaved(session, getSessionNameToDisplayWhileSaving(session))) { PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { try { new ProgressMonitorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell()).run(false, false, new WorkspaceModifyOperation() { @Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { session.save(monitor); if (session.getSessionResource() instanceof XMLResource) { ((XMLResource) <START> session.getSessionResource()).getDefaultLoadOptions().remove(AbstractSiriusMigrationService.OPTION_RESOURCE_MIGRATION_LOADEDVERSION); <END> } } }); } catch (InvocationTargetException e) { SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e)); } catch (InterruptedException e) { SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e)); } }); } }</code><technical_language>I if is right solution org.eclipse.sirius.common.ui.tools.internal.util.MigrationUIUtil.hasBeenMigratedAndUserShouldBeWarned(Resource) return false migration effectively done</technical_language>

Target:
public void askUserAndSaveMigratedSession(Session session) { if (askUserToSaveAutomaticMigration(session, getSessionNameToDisplayWhileSaving(session))) { PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { try { new ProgressMonitorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell()).run(false, false, new WorkspaceModifyOperation() { @Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { session.save(monitor); } }); } catch (InvocationTargetException e) { SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e)); } catch (InterruptedException e) { SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e)); } }); } }
Source:
<code>public ProbabilisticBufferReviewer() { <START> mConf = ServerConfiguration.global(); <END> mHardLimitBytes = mConf.getBytes(PropertyKey.WORKER_REVIEWER_BUFFER_HARDLIMIT_BYTES); long stopSoftBytes = mConf.getBytes(PropertyKey.WORKER_REVIEWER_BUFFER_SOFTLIMIT_BYTES); if (stopSoftBytes <= mHardLimitBytes) { LOG.warn("{} should be greater than or equal to {}. Setting to {}.", PropertyKey.WORKER_REVIEWER_BUFFER_SOFTLIMIT_BYTES.toString(), PropertyKey.WORKER_REVIEWER_BUFFER_HARDLIMIT_BYTES.toString(), PropertyKey.WORKER_REVIEWER_BUFFER_SOFTLIMIT_BYTES.toString(), mHardLimitBytes); mSoftLimitBytes = mHardLimitBytes; } else { mSoftLimitBytes = stopSoftBytes; } }</code><technical_language>this a local variable</technical_language>

Target:
public ProbabilisticBufferReviewer() { InstancedConfiguration conf = ServerConfiguration.global(); mHardLimitBytes = conf.getBytes(PropertyKey.WORKER_REVIEWER_PROBABILISTIC_HARDLIMIT_BYTES); long stopSoftBytes = conf.getBytes(PropertyKey.WORKER_REVIEWER_PROBABILISTIC_SOFTLIMIT_BYTES); if (stopSoftBytes <= mHardLimitBytes) { LOG.warn("{} should be greater than or equal to {}. Setting to {}.", PropertyKey.WORKER_REVIEWER_PROBABILISTIC_SOFTLIMIT_BYTES.toString(), PropertyKey.WORKER_REVIEWER_PROBABILISTIC_HARDLIMIT_BYTES.toString(), PropertyKey.WORKER_REVIEWER_PROBABILISTIC_SOFTLIMIT_BYTES.toString(), mHardLimitBytes); mSoftLimitBytes = mHardLimitBytes; } else { mSoftLimitBytes = stopSoftBytes; } }
Source:
<code>public void test_remote_bidi_greeting_expect_IllegalArgumentException() { GreetingService service = createProxy(); Flux<GreetingResponse> responses = service.bidiGreetingIllegalArgumentException( Mono.just(new GreetingRequest("IllegalArgumentException"))); StepVerifier.create(responses) .expectErrorMessage("IllegalArgumentException") <START> .verify(Duration.ofSeconds(300)); <END> }</code><technical_language>is needed</technical_language>

Target:
public void test_remote_bidi_greeting_expect_IllegalArgumentException() { GreetingService service = createProxy(); Flux<GreetingResponse> responses = service.bidiGreetingIllegalArgumentException( Mono.just(new GreetingRequest("IllegalArgumentException"))); StepVerifier.create(responses) .expectErrorMessage("IllegalArgumentException") .verify(Duration.ofSeconds(3)); }
Source:
<code>public void onDestroy() { mDispatcher.unregister(this); <START> super.onStop(); <END> }</code><technical_language>super.onDestroy(); called</technical_language>

Target:
public void onDestroy() { mDispatcher.unregister(this); super.onDestroy(); }
Source:
<code>public void rewritesOnSubqueryWithoutProjection() { tester.assertThat(rule) .on(p -> p.lateral( ImmutableList.of(p.symbol("corr")), p.values(p.symbol("corr")), p.enforceSingleRow( p.filter( p.expression("corr = a"), p.tableScan( NATION, ImmutableList.of(p.symbol("a")), ImmutableMap.of(p.symbol("a"), new TpchColumnHandle("nationkey", BIGINT))))))) .matches( project( filter( <START> "CASE is_distinct WHEN true THEN true ELSE CAST(fail(28, 'Scalar sub-query has returned multiple rows') AS BOOLEAN) END", <END> markDistinct( "is_distinct", ImmutableList.of("unique", "corr"), join( JoinNode.Type.LEFT, ImmutableList.of(), Optional.of("corr = a"), assignUniqueId( "unique", values(ImmutableMap.of("corr", 0))), project( ImmutableMap.of("non_null", expression("true")), tableScan("nation", ImmutableMap.of("a", "nationkey")))))))); }</code><technical_language>Construct this dynamically a reference enum for error code instead of hardcoding 28</technical_language>

Target:
public void rewritesOnSubqueryWithoutProjection() { tester.assertThat(rule) .on(p -> p.lateral( ImmutableList.of(p.symbol("corr")), p.values(p.symbol("corr")), p.enforceSingleRow( p.filter( p.expression("corr = a"), p.tableScan( NATION, ImmutableList.of(p.symbol("a")), ImmutableMap.of(p.symbol("a"), new TpchColumnHandle("nationkey", BIGINT))))))) .matches( project( filter( ensureScalarSubquery(), markDistinct( "is_distinct", ImmutableList.of("unique", "corr"), join( JoinNode.Type.LEFT, ImmutableList.of(), Optional.of("corr = a"), assignUniqueId( "unique", values(ImmutableMap.of("corr", 0))), project( ImmutableMap.of("non_null", expression("true")), tableScan("nation", ImmutableMap.of("a", "nationkey")))))))); }