auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void createOptionsGroup(Composite parent) { Composite optionsGroup = new Composite(parent, SWT.NONE); optionsGroup.setLayout(new GridLayout()); optionsGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); Label descriptionLabel = new Label(optionsGroup, SWT.NONE); descriptionLabel.setText(Messages.CopyTraceDialog_Description); Button copyLinkButton = new Button(optionsGroup, SWT.RADIO); copyLinkButton.setText(Messages.CopyTraceDialog_CopyLinkButton); copyLinkButton.setSelection(true); fCopyAsLink = true; Button copyResourceButton = new Button(optionsGroup, SWT.RADIO); copyResourceButton.setText(Messages.CopyTraceDialog_CopyTraceButton); <START> copyLinkButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fCopyAsLink = true; } }); copyResourceButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fCopyAsLink = false; } }); <END> }</code><technical_language>parent group do this, instead of button require listener</technical_language>

Target:
private void createOptionsGroup(Composite parent) { Composite optionsGroup = new Composite(parent, SWT.NONE); optionsGroup.setLayout(new GridLayout()); optionsGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); Label descriptionLabel = new Label(optionsGroup, SWT.NONE); descriptionLabel.setText(Messages.CopyTraceDialog_Description); fCopyLinkButton = new Button(optionsGroup, SWT.RADIO); fCopyLinkButton.setText(Messages.CopyTraceDialog_CopyLinkButton); fCopyLinkButton.setSelection(true); Button copyResourceButton = new Button(optionsGroup, SWT.RADIO); copyResourceButton.setText(Messages.CopyTraceDialog_CopyTraceButton); }
Source:
<code>private void processScreensaverStateChanged(String method, Map<String, Object> json) { System.out.println(method); if ("GUI.OnScreensaverDeactivated".equals(method)) { updateScreenSaverStatus(false); <START> }else if ("GUI.OnScreensaverActivated".equals(method)) { <END> updateScreenSaverStatus(true); } }</code><technical_language>please extract key constant</technical_language>

Target:
private void processScreensaverStateChanged(String method, Map<String, Object> json) { if ("GUI.OnScreensaverDeactivated".equals(method)) { updateScreenSaverStatus(false); }else if ("GUI.OnScreensaverActivated".equals(method)) { updateScreenSaverStatus(true); } }
Source:
<code>public void handleTaskCompletion(ResultAndError<AppInstallStatus> appInstallStatusResultAndError) { AppInstallStatus result = appInstallStatusResultAndError.data; <START> if (result == AppInstallStatus.UpToDate) { <END> onAsyncExecutionSuccess(); } else if (result == AppInstallStatus.UpdateStaged) { installPendingUpdate(); } else { updateStatus(StringUtils.getStringRobust(mActivity, R.string.recovery_measure_known_error, appInstallStatusResultAndError.errorMessage)); onAsyncExecutionFailure(appInstallStatusResultAndError.data.name()); } }</code><technical_language>sounds totally right me. log out is especially important, unify call path do thing</technical_language>

Target:
public void handleTaskCompletion(ResultAndError<AppInstallStatus> appInstallStatusResultAndError) { AppInstallStatus result = appInstallStatusResultAndError.data; if (result == AppInstallStatus.UpToDate) { UpdateActivity.OnSuccessfulUpdate(true, false); onAsyncExecutionSuccess(); } else if (result == AppInstallStatus.UpdateStaged) { installPendingUpdate(); } else { updateStatus(StringUtils.getStringRobust(mActivity, R.string.recovery_measure_known_error, appInstallStatusResultAndError.errorMessage)); onAsyncExecutionFailure(appInstallStatusResultAndError.data.name()); } }
Source:
<code>public void addScanFilter(ScanFilter scanFilter) { <START> if (scanFilter != null) { <END> this.scanFilters.add(scanFilter); } }</code><technical_language>Objects.requireNonNull instead</technical_language>

Target:
public void addScanFilter(ScanFilter scanFilter) { this.scanFilters.add(Objects.requireNonNull(scanFilter)); }
Source:
<code>public CompositeJob(String thingUID, List<Job> jobs) { super(thingUID); checkArgument(jobs != null, "Jobs must not be null"); checkArgument(!jobs.isEmpty(), "Jobs must not be empty"); <START> this.thingUID = thingUID; <END> this.jobs = jobs; boolean notMatched = jobs.stream().anyMatch(j -> !j.getThingUID().equals(thingUID)); checkArgument(!notMatched, "The jobs must associate the same thing UID"); }</code><technical_language>Drop line</technical_language>

Target:
public CompositeJob(String thingUID, List<Job> jobs) { super(thingUID); checkArgument(jobs != null, "Jobs must not be null"); checkArgument(!jobs.isEmpty(), "Jobs must not be empty"); this.jobs = jobs; boolean notMatched = jobs.stream().anyMatch(j -> !j.getThingUID().equals(thingUID)); checkArgument(!notMatched, "The jobs must associate the same thing UID"); }
Source:
<code>protected void executeVmCommand() { Guid createdSnapshotId = getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE); getParameters().setSnapshotType(determineSnapshotType()); getParameters().setInitialVmStatus(getVm().getStatus()); getSnapshotDao().updateId(createdSnapshotId, newActiveSnapshotId); setActionReturnValue(createdSnapshotId); MemoryImageBuilder memoryImageBuilder = createMemoryImageBuilder(); addSnapshotToDB(createdSnapshotId, memoryImageBuilder); createSnapshotsForDisks(); memoryImageBuilder.build(); <START> getParameters().setTaskGroupSuccess(false); <END> if (getTaskIdList().isEmpty()) { incrementVmGeneration(); } if (!prepareForMemorySnapshot) { freeLock(); } setSucceeded(true); }</code><technical_language>Ravi, if initialize this false creation of tasks fix perfect</technical_language>

Target:
protected void executeVmCommand() { Guid createdSnapshotId = getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE); getParameters().setSnapshotType(determineSnapshotType()); getParameters().setInitialVmStatus(getVm().getStatus()); getSnapshotDao().updateId(createdSnapshotId, newActiveSnapshotId); setActionReturnValue(createdSnapshotId); MemoryImageBuilder memoryImageBuilder = createMemoryImageBuilder(); addSnapshotToDB(createdSnapshotId, memoryImageBuilder); createSnapshotsForDisks(); memoryImageBuilder.build(); if (getTaskIdList().isEmpty()) { getParameters().setTaskGroupSuccess(true); incrementVmGeneration(); } if (!prepareForMemorySnapshot) { freeLock(); } setSucceeded(true); }
Source:
<code>public void logReport(String userId, String email, String siteId, String type, String title, String content) { Connection conn = null; try { conn = sqlService.borrowConnection(); <START> sqlService.dbInsert(conn, insertReportSql, new String[] {userId, email, siteId, type, title, content}, "id"); <END> } catch (Exception e) { logger.error("Failed to insert feedback report.", e); } finally { if (conn != null) { sqlService.returnConnection(conn); } } }</code><technical_language>If care returned (and here) sqlService.dbWrite(String, Object[])</technical_language>

Target:
public void logReport(String userId, String email, String siteId, String type, String title, String content) { Connection conn = null; try { conn = sqlService.borrowConnection(); sqlService.dbWrite(conn, insertReportSql, new String[] {userId, email, siteId, type, title, content}); } catch (Exception e) { logger.error("Failed to insert feedback report.", e); } finally { if (conn != null) { sqlService.returnConnection(conn); } } }
Source:
<code>public DataNode(Datacenter datacenter, JSONObject jsonObject, ClusterMapConfig clusterMapConfig) throws JSONException { if (logger.isTraceEnabled()) { logger.trace("DataNode " + jsonObject.toString()); } this.datacenter = datacenter; this.hostname = getFullyQualifiedDomainName(jsonObject.getString("hostname")); this.port = jsonObject.getInt("port"); try { ResourceStatePolicyFactory resourceStatePolicyFactory = Utils .getObj(clusterMapConfig.clusterMapResourceStatePolicyFactory, this, HardwareState.valueOf(jsonObject.getString("hardwareState")), clusterMapConfig); this.dataNodeStatePolicy = resourceStatePolicyFactory.getResourceStatePolicy(); <START> } catch (Exception e) { <END> logger.error("Error during start {}", e); throw new InstantiationError("Error during start " + e); } JSONArray diskJSONArray = jsonObject.getJSONArray("disks"); this.disks = new ArrayList<Disk>(diskJSONArray.length()); for (int i = 0; i < diskJSONArray.length(); ++i) { this.disks.add(new Disk(this, diskJSONArray.getJSONObject(i), clusterMapConfig)); } this.rawCapacityInBytes = calculateRawCapacityInBytes(); validate(); }</code><technical_language>is this caught here? This throw top class need log it. loose context here</technical_language>

Target:
public DataNode(Datacenter datacenter, JSONObject jsonObject, ClusterMapConfig clusterMapConfig) throws JSONException { if (logger.isTraceEnabled()) { logger.trace("DataNode " + jsonObject.toString()); } this.datacenter = datacenter; this.hostname = getFullyQualifiedDomainName(jsonObject.getString("hostname")); this.port = jsonObject.getInt("port"); try { ResourceStatePolicyFactory resourceStatePolicyFactory = Utils .getObj(clusterMapConfig.clusterMapResourceStatePolicyFactory, this, HardwareState.valueOf(jsonObject.getString("hardwareState")), clusterMapConfig); this.dataNodeStatePolicy = resourceStatePolicyFactory.getResourceStatePolicy(); } catch (Exception e) { logger.error("Error creating resource state policy when instantiating a datanode " + e); throw new IllegalStateException( "Error creating resource state policy when instantiating a datanode: " + hostname + " " + port, e); } JSONArray diskJSONArray = jsonObject.getJSONArray("disks"); this.disks = new ArrayList<Disk>(diskJSONArray.length()); for (int i = 0; i < diskJSONArray.length(); ++i) { this.disks.add(new Disk(this, diskJSONArray.getJSONObject(i), clusterMapConfig)); } this.rawCapacityInBytes = calculateRawCapacityInBytes(); validate(); }
Source:
<code>public static void getLatency(Long latency) { Long innerLatency; if (latency != (long) minimum) { innerLatency = latency; } else { innerLatency = getDelayFromXml(); } try { TimeUnit.MILLISECONDS.sleep(innerLatency); <START> }catch (Exception e){ <END> log.error("faild to to run getLatency error is:{}", e); } }</code><technical_language>Please catch specific exception(InterruptedException) generic</technical_language>

Target:
public static void getLatency(Long latency) { Long innerLatency; if (latency != (long) minimum) { innerLatency = latency; } else { innerLatency = getDelayFromXml(); } try { TimeUnit.MILLISECONDS.sleep(innerLatency); }catch (InterruptedException e){ log.error("failed to to run getLatency error is:{}", e); } }
Source:
<code>private boolean doesSourceMatch(Datastream newDatastream, Datastream existingDatastream) { <START> if ((!newDatastream.hasSource() && !existingDatastream.hasSource()) <END> || (newDatastream.hasSource() && existingDatastream.hasSource() && newDatastream.getSource().equals(existingDatastream.getSource()))) { return true; } return false; }</code><technical_language>nit: return statement 'if', feel more readable this way</technical_language>

Target:
private boolean doesSourceMatch(Datastream newDatastream, Datastream existingDatastream) { return ((!newDatastream.hasSource() && !existingDatastream.hasSource()) || (newDatastream.hasSource() && existingDatastream.hasSource() && newDatastream.getSource().equals(existingDatastream.getSource()))); }
Source:
<code><START> public LocalVariable[] getLocals() { <END> return locals; }</code><technical_language>reasoning for returning a LocalVariable[] instead of a Map<String, Object> here</technical_language>

Target:
public Map<String, Object> getLocals() { if (locals == null || locals.length == 0) { return Collections.emptyMap(); } Map<String, Object> localsMap = new HashMap<>(); for (Frame.LocalVariable localVariable : locals) { if (localVariable != null) { localsMap.put(localVariable.getName(), localVariable.getValue()); } } return localsMap; }
Source:
<code>public WhoisResources performUpdates(final UpdateContext updateContext, final Origin origin, final Collection<Update> updates, final Keyword keyword, final HttpServletRequest request) { loggerContext.log("msg-in.txt", new UpdateLogCallback(updates)); <START> final UpdateResponse updateResponse = updateRequestHandler.handle(new UpdateRequest(origin, keyword, updates), updateContext); <END> return performUpdates(request, updateContext, updates); }</code><technical_language>Add a TODO response, if side-effects</technical_language>

Target:
public WhoisResources performUpdates(final UpdateContext updateContext, final Origin origin, final Collection<Update> updates, final Keyword keyword, final HttpServletRequest request) { loggerContext.log("msg-in.txt", new UpdateLogCallback(updates)); updateRequestHandler.handle(new UpdateRequest(origin, keyword, updates), updateContext); return performUpdates(request, updateContext, updates); }
Source:
<code>protected static void addResourceToRegionServerConfiguration(final HBaseTestingUtility testUtil) { for (RegionServerThread rsThread : testUtil.getMiniHBaseCluster().getRegionServerThreads()) { <START> rsThread.getRegionServer().getConfiguration().addResource( <END> testUtil.getDataTestDir("hbase-site.xml")); } }</code><technical_language>good</technical_language>

Target:
protected static void addResourceToRegionServerConfiguration(final HBaseTestingUtility testUtil) { for (RegionServerThread rsThread : testUtil.getMiniHBaseCluster().getRegionServerThreads()) { rsThread.getRegionServer().getConfiguration().addResource( testUtil.getDataTestDir(SERVER_CONFIG)); } }
Source:
<code>public void checkSpringBootHealthCheckBoosterProjectCommands() { consoles.executeCommandFromProjectExplorer( SPRING_BOOT_HEALTH_CHECK_BOOSTER, BUILD_GOAL, BUILD_COMMAND, BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( SPRING_BOOT_HEALTH_CHECK_BOOSTER, BUILD_GOAL, CLEAN_BUILD_COMMAND, BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( SPRING_BOOT_HEALTH_CHECK_BOOSTER, RUN_GOAL, RUN_COMMAND, "Started BoosterApplication in"); consoles.checkWebElementVisibilityAtPreviewPage( <START> By.xpath(" END> consoles.closeProcessTabWithAskDialog(RUN_COMMAND); consoles.executeCommandFromProcessesArea( "dev-machine", DEBUG_GOAL, DEBUG_COMMAND, LISTENING_AT_ADDRESS); consoles.closeProcessTabWithAskDialog(DEBUG_COMMAND); }</code><technical_language>Defining "//h2[text()='Health Check Booster']" string a constant code clear, IMHO, allow avoid duplication</technical_language>

Target:
public void checkSpringBootHealthCheckBoosterProjectCommands() { By textOnPreviewPage = By.xpath(" consoles.executeCommandFromProjectExplorer( SPRING_BOOT_HEALTH_CHECK_PROJECT, BUILD_GOAL, BUILD_COMMAND, BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( SPRING_BOOT_HEALTH_CHECK_PROJECT, BUILD_GOAL, CLEAN_BUILD_COMMAND, BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( SPRING_BOOT_HEALTH_CHECK_PROJECT, RUN_GOAL, RUN_COMMAND, "Started BoosterApplication in"); consoles.checkWebElementVisibilityAtPreviewPage(textOnPreviewPage); consoles.closeProcessTabWithAskDialog(RUN_COMMAND); consoles.executeCommandFromProcessesArea( "dev-machine", DEBUG_GOAL, DEBUG_COMMAND, LISTENING_AT_ADDRESS); consoles.closeProcessTabWithAskDialog(DEBUG_COMMAND); }
Source:
<code>static RetryAction ofScheduledRetry(final long maxAttempts, final Function<RetryContext, Duration> durationFunction) { validateMaxAttempts(maxAttempts); return new RetryActionImpl() { @Override public RetryStrategy apply(final RetryContext retryOperationContext) { if (retryOperationContext.getAttempt() > maxAttempts) { return RetryStrategy.resume(retryOperationContext.getLatestError()); } else { final Duration duration = durationFunction.apply(retryOperationContext); final Object parameterObject = retryOperationContext.getLatestParameter(); return RetryStrategy.retryScheduled(parameterObject, duration); } } @Override protected String getDescription() { <START> return "schedule retry retry up to " + maxAttempts + " times"; <END> } }; }</code><technical_language>retry</technical_language>

Target:
static RetryAction ofScheduledRetry(final long maxAttempts, final Function<RetryContext, Duration> durationFunction) { validateMaxAttempts(maxAttempts); return new RetryActionImpl() { @Override public RetryStrategy apply(final RetryContext retryOperationContext) { if (retryOperationContext.getAttempt() > maxAttempts) { return RetryStrategy.resume(retryOperationContext.getLatestError()); } else { final Duration duration = durationFunction.apply(retryOperationContext); final Object parameterObject = retryOperationContext.getLatestParameter(); return RetryStrategy.retryScheduled(parameterObject, duration); } } @Override protected String getDescription() { return "schedule retry up to " + maxAttempts + " times"; } }; }
Source:
<code>public void createMatches(Comparison comparison, Iterator<? extends EObject> leftEObjects, Iterator<? extends EObject> rightEObjects, Iterator<? extends EObject> originEObjects, Monitor monitor) { final List<EObject> leftEObjectsNoID = Lists.newArrayList(); final List<EObject> rightEObjectsNoID = Lists.newArrayList(); final List<EObject> originEObjectsNoID = Lists.newArrayList(); <START> diagnostic = (BasicDiagnostic)Diagnostic.OK_INSTANCE; <END> final Set<Match> matches = matchPerId(leftEObjects, rightEObjects, originEObjects, leftEObjectsNoID, rightEObjectsNoID, originEObjectsNoID); addDiagnostic(comparison); Iterables.addAll(comparison.getMatches(), matches); if (delegate.isPresent()) { doDelegation(comparison, leftEObjectsNoID, rightEObjectsNoID, originEObjectsNoID, monitor); } else { for (EObject eObject : leftEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setLeft(eObject); matches.add(match); } for (EObject eObject : rightEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setRight(eObject); matches.add(match); } for (EObject eObject : originEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setOrigin(eObject); matches.add(match); } } }</code><technical_language>Please instantiate a new instance of BasicDiagnostic below. modifying static instance. new BasicDiagnostic (OK, "org.eclipse.emf.common", 0, org.eclipse.emf.common.CommonPlugin.INSTANCE.getString("_UI_OK_diagnostic_0"), null);</technical_language>

Target:
public void createMatches(Comparison comparison, Iterator<? extends EObject> leftEObjects, Iterator<? extends EObject> rightEObjects, Iterator<? extends EObject> originEObjects, Monitor monitor) { final List<EObject> leftEObjectsNoID = Lists.newArrayList(); final List<EObject> rightEObjectsNoID = Lists.newArrayList(); final List<EObject> originEObjectsNoID = Lists.newArrayList(); diagnostic = new BasicDiagnostic(Diagnostic.OK, "org.eclipse.emf.common", 0, org.eclipse.emf.common.CommonPlugin.INSTANCE.getString("_UI_OK_diagnostic_0"), null); final Set<Match> matches = matchPerId(leftEObjects, rightEObjects, originEObjects, leftEObjectsNoID, rightEObjectsNoID, originEObjectsNoID); addDiagnostic(comparison); Iterables.addAll(comparison.getMatches(), matches); if (delegate.isPresent()) { doDelegation(comparison, leftEObjectsNoID, rightEObjectsNoID, originEObjectsNoID, monitor); } else { for (EObject eObject : leftEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setLeft(eObject); matches.add(match); } for (EObject eObject : rightEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setRight(eObject); matches.add(match); } for (EObject eObject : originEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setOrigin(eObject); matches.add(match); } } }
Source:
<code>private void setCancellingText(TextView titleTextView, TextView messageTextView, Button cancelButton) { titleTextView.setText(cancellingPrefixText + " '" + title + "'"); <START> messageTextView.setText(cancellingPrefixText + "..."); <END> cancelButton.setEnabled(false); }</code><technical_language>This kind of verbage is full of some dangerous assumptions nature of language involved. If in a right-to-left language this confusing put together. options help: 1) localization keys do construction, IE: Localization.get("cancelling.title", new String[] {titleText}) cancelling.title=Cancelling: ${0} similar. Alternatively, message view for cancel message (although put "..." in message for reason)</technical_language>

Target:
private void setCancellingText(TextView titleTextView, TextView messageTextView, Button cancelButton) { titleTextView.setText(Localization.get("activity.task.cancelling.title", new String[]{title})); messageTextView.setText(Localization.get("activity.task.cancelling.message")); cancelButton.setEnabled(false); }
Source:
<code>protected Analyzer getWrappedAnalyzer(String fieldName) { <START> int idx = fieldName.lastIndexOf("_"); <END> if (idx == -1) { return defaultAnalyzer; } String lang = langTag != null ? langTag : fieldName.substring(idx+1); Analyzer analyzer = Util.getLocalizedAnalyzer(lang); analyzer = analyzer != null ? analyzer : defaultAnalyzer; log.trace("getWrappedAnalyzer langTag: {}, fieldName: {}, analyzer: {}", langTag, fieldName, analyzer); return analyzer; }</code><technical_language>Weird formatting in this file, blocker</technical_language>

Target:
protected Analyzer getWrappedAnalyzer(String fieldName) { int idx = fieldName.lastIndexOf("_"); if (idx == -1) { return defaultAnalyzer; } String lang = ObjectUtils.defaultIfNull(langTag, fieldName.substring(idx+1)); Analyzer analyzer = Util.getLocalizedAnalyzer(lang); analyzer = ObjectUtils.defaultIfNull(analyzer, defaultAnalyzer); log.trace("getWrappedAnalyzer langTag: {}, fieldName: {}, analyzer: {}", langTag, fieldName, analyzer); return analyzer; }
Source:
<code>private ValueHolder<V> internalGet(K key, final boolean updateAccess) { return map.compute(key, new BiFunction<K, OffHeapValueHolder<V>, OffHeapValueHolder<V>>() { @Override public OffHeapValueHolder<V> apply(K mappedKey, OffHeapValueHolder<V> mappedValue) { long now = timeSource.getTimeMillis(); <START> if (mappedValue == null || mappedValue.isExpired(now, OffHeapValueHolder.TIME_UNIT)) { <END> if (mappedValue != null) { eventListener.onExpiration(wrap(mappedKey, mappedValue)); } return null; } if (updateAccess) { setAccessTimeAndExpiry(mappedKey, mappedValue, now); } return mappedValue; } }, false); }</code><technical_language>OffHeapValueHolder.TIME_UNIT fishy converting it. simply pass TimeUnit.MILLISECONDS? This remark applies calls this equivalent in OnHeapStore</technical_language>

Target:
private ValueHolder<V> internalGet(K key, final boolean updateAccess) { return map.compute(key, new BiFunction<K, OffHeapValueHolder<V>, OffHeapValueHolder<V>>() { @Override public OffHeapValueHolder<V> apply(K mappedKey, OffHeapValueHolder<V> mappedValue) { long now = timeSource.getTimeMillis(); if (mappedValue == null || mappedValue.isExpired(now, TimeUnit.MILLISECONDS)) { if (mappedValue != null) { eventListener.onExpiration(wrap(mappedKey, mappedValue)); } return null; } if (updateAccess) { setAccessTimeAndExpiry(mappedKey, mappedValue, now); } return mappedValue; } }, false); }
Source:
<code>private void updateAuditLogEventProcessed(EventAuditLogSubscriber eventSubscriber) throws SQLException { Connection connection = null; PreparedStatement ps = null; try { connection = ds.getConnection(); <START> ps = connection.prepareStatement("UPDATE audit_log SET processed = 'true' WHERE audit_log_id = ?"); <END> ps.setLong(1, eventSubscriber.getaudit_log_id()); int updated = ps.executeUpdate(); if (updated != 1) { log.error("Failed to mark audit_log entry as processed for audit_log_id: " + eventSubscriber.getaudit_log_id()); } } finally { DbUtils.closeQuietly(ps, connection); } }</code><technical_language>again</technical_language>

Target:
private void updateAuditLogEventProcessed(EventAuditLogSubscriber eventSubscriber) throws SQLException { Connection connection = null; PreparedStatement ps = null; try { connection = ds.getConnection(); ps = connection.prepareStatement("update audit_log set processed = 'true' where audit_log_id = ?"); ps.setLong(1, eventSubscriber.getaudit_log_id()); int updated = ps.executeUpdate(); if (updated != 1) { log.error("Failed to mark audit_log entry as processed for audit_log_id: " + eventSubscriber.getaudit_log_id()); } } finally { DbUtils.closeQuietly(ps, connection); } }
Source:
<code>public void allowCall(String callId) { <START> Long token = Binder.clearCallingIdentity(); <END> if (mCall == null || (!mCall.getId().equals(callId))) { Log.w(this, "allowCall, unknown call id: %s", callId); } mResultFuture.complete(mPriorStageResult); Binder.restoreCallingIdentity(token); unbindCallScreeningService(); }</code><technical_language>I valuable Log.startSession("CSCR.aC"); Log.endSession() stuff in previous version of allowCall. startSession stuff is helpful a unique identifier log messages a session; upper-case of class method name a session identifier. E.g. CSA.aC CallScreeningAdapter#acceptCall</technical_language>

Target:
public void allowCall(String callId) { Log.startSession("CSCR.aC"); Long token = Binder.clearCallingIdentity(); try { if (mCall == null || (!mCall.getId().equals(callId))) { Log.w(this, "allowCall, unknown call id: %s", callId); } mResultFuture.complete(mPriorStageResult); } finally { Binder.restoreCallingIdentity(token); unbindCallScreeningService(); Log.endSession(); } }
Source:
<code>public void verifyOperation() { val policy = new OidcCustomScopeAttributeReleasePolicy("groups", CollectionUtils.wrap("groups")); assertEquals(OidcConstants.CUSTOM_SCOPE_TYPE, policy.getScopeType()); assertNotNull(policy.getAllowedAttributes()); val principal = CoreAuthenticationTestUtils.getPrincipal(CollectionUtils.wrap("groups", List.of("admin", "user"))); val attrs = policy.getAttributes(principal, CoreAuthenticationTestUtils.getService(), CoreAuthenticationTestUtils.getRegisteredService()); <START> assertTrue(policy.getAllowedAttributes().stream().allMatch(attrs::containsKey)); <END> }</code><technical_language>Then, do this again: java val attrs = policy.getAttributes(principal, CoreAuthenticationTestUtils.getService(), CoreAuthenticationTestUtils.getRegisteredService()); ...and attrs right attributes entries. principal is passed reconstructed based attributes call: java val principal2 = CoreAuthenticationTestUtils.getPrincipal(attrs); val releaseAttrs = policy.getAttributes(principal2, CoreAuthenticationTestUtils.getService(), CoreAuthenticationTestUtils.getRegisteredService());</technical_language>

Target:
public void verifyOperation() { val policy = new OidcCustomScopeAttributeReleasePolicy("groups", CollectionUtils.wrap("groups")); assertEquals(OidcConstants.CUSTOM_SCOPE_TYPE, policy.getScopeType()); assertNotNull(policy.getAllowedAttributes()); val principal = CoreAuthenticationTestUtils.getPrincipal(CollectionUtils.wrap("groups", List.of("admin", "user"))); val attrs = policy.getAttributes(principal, CoreAuthenticationTestUtils.getService(), CoreAuthenticationTestUtils.getRegisteredService()); assertTrue(policy.getAllowedAttributes().stream().allMatch(attrs::containsKey)); val principal2 = CoreAuthenticationTestUtils.getPrincipal(attrs); val releaseAttrs = policy.getAttributes(principal2, CoreAuthenticationTestUtils.getService(), CoreAuthenticationTestUtils.getRegisteredService()); assertTrue(policy.getAllowedAttributes().stream().allMatch(releaseAttrs::containsKey)); assertEquals(releaseAttrs.get("groups"), List.of("admin", "user")); }
Source:
<code>protected int calculateTemplatesToKeep(final int templatesRead, final double overallProportion) { final ConstantMemoryDownsamplingIterator iter = (ConstantMemoryDownsamplingIterator) getUnderlyingIterator(); final double priorProportion = iter.getAcceptedFraction(); final double p = Math.max(0, Math.min(1, overallProportion / priorProportion)); final int retval = super.calculateTemplatesToKeep(templatesRead, p); for (long i = 0; i < iter.getDiscardedCount(); ++i) { <START> recordDiscardedRecord(null); <END> } return retval; }</code><technical_language>sense provide a recordDiscarded(int) instead of this silly loop. (and above)</technical_language>

Target:
protected int calculateTemplatesToKeep(final int templatesRead, final double overallProportion) { final ConstantMemoryDownsamplingIterator iter = (ConstantMemoryDownsamplingIterator) getUnderlyingIterator(); final double priorProportion = iter.getAcceptedFraction(); final double p = Math.max(0, Math.min(1, overallProportion / priorProportion)); final int retval = super.calculateTemplatesToKeep(templatesRead, p); recordDiscardRecords(iter.getDiscardedCount()); return retval; }
Source:
<code>public SwrveBaseCampaign(SwrveBase<?, ?> controller, JSONObject campaignData) throws JSONException { this(); setId(campaignData.getInt("id")); setIsInbox(campaignData.optBoolean("inbox", false)); setSubject(campaignData.optString("subject", null)); setTalkController(controller); SwrveLogger.i(LOG_TAG, "Loading campaign " + getId()); <START> this.state = new SwrveCampaignState(); <END> this.maxImpressions = DEFAULT_MAX_IMPRESSIONS; this.minDelayBetweenMessage = DEFAULT_MIN_DELAY_BETWEEN_MSGS; this.showMessagesAfterLaunch = SwrveHelper.addTimeInterval(this.talkController.getInitialisedTime(), DEFAULT_DELAY_FIRST_MESSAGE, Calendar.SECOND); assignCampaignTriggers(this, campaignData); assignCampaignRules(this, campaignData); assignCampaignDates(this, campaignData); }</code><technical_language>Rename swrveCampaignState</technical_language>

Target:
public SwrveBaseCampaign(SwrveBase<?, ?> controller, JSONObject campaignData) throws JSONException { this(); setId(campaignData.getInt("id")); setIsInbox(campaignData.optBoolean("inbox", false)); setSubject(campaignData.optString("subject", null)); setTalkController(controller); SwrveLogger.i(LOG_TAG, "Loading campaign " + getId()); this.saveableState = new SwrveCampaignState(); this.maxImpressions = DEFAULT_MAX_IMPRESSIONS; this.minDelayBetweenMessage = DEFAULT_MIN_DELAY_BETWEEN_MSGS; this.showMessagesAfterLaunch = SwrveHelper.addTimeInterval(this.talkController.getInitialisedTime(), DEFAULT_DELAY_FIRST_MESSAGE, Calendar.SECOND); assignCampaignTriggers(this, campaignData); assignCampaignRules(this, campaignData); assignCampaignDates(this, campaignData); }
Source:
<code>public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException { IProject project = type.getJavaProject().getProject(); BatchProject batchProject = (BatchProject) BatchProjectFactory.getBatchProjectWithProgress(project); if (batchProject == null) { return status; } IBatchArtifact artifact = batchProject.getArtifact(type); if (artifact != null) { IAnnotationDeclaration declaration = artifact.getNamedDeclaration(); if (declaration == null || declaration.getMemberValue(null) != null) { return status; } newName = BeanUtil.getDefaultBeanName(getArguments().getNewName()); } else { <START> newName = type.getFullyQualifiedName().replace(type.getElementName(), getArguments().getNewName()); <END> } searchInProject(batchProject, artifact, pm); BatchProject[] projects = batchProject.getAllDependentProjects(true); for (BatchProject p : projects) { searchInProject(p, artifact, pm); } return status; }</code><technical_language>if renaming "org.domain.test.test" -> "org.domain.test.BatchTest". newName == "org.domain.BatchTest.BatchTest" is correct. "org.domain.test.BatchTest"</technical_language>

Target:
public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException { IProject project = type.getJavaProject().getProject(); BatchProject batchProject = (BatchProject) BatchProjectFactory.getBatchProjectWithProgress(project); if (batchProject == null) { return status; } IBatchArtifact artifact = batchProject.getArtifact(type); IBatchProperty property = null; if (artifact != null) { if(field != null){ for (IBatchProperty prop : artifact.getProperties()) { if (prop.getField().equals(field)) { IAnnotationDeclaration declaration = prop.getBatchPropertyDeclaration(); if (declaration == null || declaration.getMemberValue(null) != null) { return status; } newName = getArguments().getNewName(); property = prop; } } }else{ IAnnotationDeclaration declaration = artifact.getNamedDeclaration(); if (declaration == null || declaration.getMemberValue(null) != null) { return status; } newName = BeanUtil.getDefaultBeanName(getArguments().getNewName()); } } else { String fullyQualifiedName = type.getFullyQualifiedName(); StringBuilder b = new StringBuilder(fullyQualifiedName); b.replace(fullyQualifiedName.lastIndexOf(type.getElementName()), fullyQualifiedName.lastIndexOf(type.getElementName()) + 1, getArguments().getNewName() ); newName = b.toString(); } searchInProject(batchProject, artifact, property, pm); BatchProject[] projects = batchProject.getAllDependentProjects(true); for (BatchProject p : projects) { searchInProject(p, artifact, property, pm); } return status; }
Source:
<code>public <T extends JestResult> T execute(Action<T> clientRequest) throws IOException { Map<String,Object> params = new HashMap<>(); params.put("strict-timeout", Boolean.TRUE); TimeoutTracker timeoutTracker = new TimeoutTracker(params, m_retries, m_timeout); for (timeoutTracker.reset(); timeoutTracker.shouldRetry(); timeoutTracker.nextAttempt()) { timeoutTracker.startAttempt(); try { return m_delegate.execute(clientRequest); <START> } catch (Throwable e) { <END> LOG.warn("Exception while trying to execute REST operation", e); } } return null; }</code><technical_language>Shoudn't try catching Exceptions instead? Otherwise, end catching OutOfMemoryErrors, etc..</technical_language>

Target:
public <T extends JestResult> T execute(Action<T> clientRequest) throws IOException { Map<String,Object> params = new HashMap<>(); params.put("strict-timeout", Boolean.TRUE); TimeoutTracker timeoutTracker = new TimeoutTracker(params, m_retries, m_timeout); for (timeoutTracker.reset(); timeoutTracker.shouldRetry(); timeoutTracker.nextAttempt()) { timeoutTracker.startAttempt(); try { return m_delegate.execute(clientRequest); } catch (Exception e) { LOG.warn("Exception while trying to execute REST operation (attempt {})", timeoutTracker.getAttempt() + 1, e); } } return null; }
Source:
<code>public boolean cancelOrder(CancelOrderParams orderParams) throws IOException { if (orderParams instanceof CancelOrderByPairAndIdParams) { try { final CancelOrderByPairAndIdParams params = (CancelOrderByPairAndIdParams) orderParams; return cancelBithumbOrder(params.getOrderId(), params.getCurrencyPair()); } catch (BithumbException e) { throw BithumbErrorAdapter.adapt(e); } <START> } else if (orderParams instanceof CancelOrderByIdParams && orderParams instanceof CancelOrderByCurrencyPair) { <END> String orderId = ((CancelOrderByIdParams)orderParams).getOrderId(); CurrencyPair pair = ((CancelOrderByCurrencyPair)orderParams).getCurrencyPair(); return cancelBithumbOrder(orderId, pair); } else { throw new NotYetImplementedForExchangeException( "Only CancelOrderByPairAndIdParams || (CancelOrderByIdParams && CancelOrderByCurrencyPair) supported"); } }</code><technical_language>CancelOrderByIdParams is meant cancel order passing id CancelOrderByCurrencyPair i meant cancel orders for a currency pair I this is needed, CancelOrderByPairAndIdParams besides this code do proper error handling</technical_language>

Target:
public boolean cancelOrder(CancelOrderParams orderParams) throws IOException { try { if (!(orderParams instanceof CancelOrderByIdParams && orderParams instanceof CancelOrderByCurrencyPair)) { throw new NotYetImplementedForExchangeException( "Only CancelOrderByPairAndIdParams || (CancelOrderByIdParams && CancelOrderByCurrencyPair) supported"); } String orderId = ((CancelOrderByIdParams) orderParams).getOrderId(); CurrencyPair pair = ((CancelOrderByCurrencyPair) orderParams).getCurrencyPair(); return cancelBithumbOrder(orderId, pair); } catch (BithumbException e) { throw BithumbErrorAdapter.adapt(e); } }
Source:
<code>public List<WorkspaceEntity> listWorkspaceEntitiesByUser(UserEntity userEntity, boolean includeUnpublished) { List<WorkspaceEntity> result = new ArrayList<>(); List<WorkspaceUserEntity> workspaceUserEntities = workspaceUserEntityController.listWorkspaceUserEntitiesByUserEntity(userEntity); for (WorkspaceUserEntity workspaceUserEntity : workspaceUserEntities) { WorkspaceEntity workspaceEntity = workspaceUserEntity.getWorkspaceEntity(); <START> if (Boolean.TRUE.equals(workspaceEntity.getArchived())) { <END> continue; } if (includeUnpublished || workspaceEntity.getPublished()) { if (!result.contains(workspaceEntity)) { result.add(workspaceEntity); } } } return result; }</code><technical_language>Changing existing methods done care. Filtering archived workspaces unknown effects else. Couple of approaches: * Add another method listUnarchivedWorkspaceEntitiesByUser basically original filters archived * Add a parameter this method (boolean includeArchived), if false, filters archived Also, more efficient if archived workspaces filtered in DAO listWorkspaceUserEntitiesByUserEntity replaced handles filtering while querying database</technical_language>

Target:
public List<WorkspaceEntity> listWorkspaceEntitiesByUser(UserEntity userEntity, boolean includeUnpublished) { List<WorkspaceEntity> result = new ArrayList<>(); List<WorkspaceUserEntity> workspaceUserEntities = workspaceUserEntityController.listWorkspaceUserEntitiesByUserEntity(userEntity); for (WorkspaceUserEntity workspaceUserEntity : workspaceUserEntities) { if (includeUnpublished || workspaceUserEntity.getWorkspaceEntity().getPublished()) { if (!result.contains(workspaceUserEntity.getWorkspaceEntity())) { result.add(workspaceUserEntity.getWorkspaceEntity()); } } } return result; }
Source:
<code>void testUserFormExistingUserValidEmptyPassword() { UserForm userForm = new UserForm(); userForm.setUsername(VALID_USERNAME); userForm.setPassword(StringUtils.EMPTY); Set<ConstraintViolation<UserForm>> violations = validator.validate(userForm, UserForm.ExistingUser.class); <START> assertThat(violations.isEmpty()).as("Violations are not empty!").isTrue(); <END> }</code><technical_language>assertThat(violations.isEmpty()).as("Violations empty!").isTrue(); => assertThat(violations).isEmpty();</technical_language>

Target:
void testUserFormExistingUserValidEmptyPassword() { UserForm userForm = new UserForm(); userForm.setUsername(VALID_USERNAME); userForm.setPassword(StringUtils.EMPTY); Set<ConstraintViolation<UserForm>> violations = validator.validate(userForm, UserForm.ExistingUser.class); assertThat(violations).as("Violations are not empty!").isEmpty(); }
Source:
<code>private <R, C extends ServiceCreationConfiguration<?, R>> CacheManagerBuilder<T> ensureThenUpdate(Supplier<C> supplier, UnaryOperator<R> update) { C emptyConfig = supplier.get(); @SuppressWarnings("unchecked") Class<? extends C> configType = (Class<? extends C>) emptyConfig.getClass(); if (configBuilder.getService(configType) == null) { return new CacheManagerBuilder<>(this, configBuilder.withService(emptyConfig).updateServices(configType, update)); <START> } else { <END> return new CacheManagerBuilder<>(this, configBuilder.updateServices(configType, update)); } }</code><technical_language>(or a variant thereof) a more clear intent? java FluentConfigurationBuilder<?> fluentBuilder = configBuilder; if (fluentBuilder.getService(configType) == null) { fluentBuilder = fluentBuilder.withService(emptyConfig); } return new CacheManagerBuilder<>(this, fluentBuilder.updateServices(configType, update)); a pity determine type of configuration creating a potentially unused instance</technical_language>

Target:
private <R, C extends ServiceCreationConfiguration<?, R>> CacheManagerBuilder<T> ensureThenUpdate(Supplier<C> supplier, UnaryOperator<R> update) { C emptyConfig = supplier.get(); @SuppressWarnings("unchecked") Class<? extends C> configType = (Class<? extends C>) emptyConfig.getClass(); FluentConfigurationBuilder<?> fluentBuilder = configBuilder; if (configBuilder.getService(configType) == null) { fluentBuilder = fluentBuilder.withService(emptyConfig); } return new CacheManagerBuilder<>(this, fluentBuilder.updateServices(configType, update)); }
Source:
<code>public void testGroupIncludesWildcardRule(@MavenRepository(repositoryId = REPOSITORY_RELEASES_TGIWR_1) Repository releases1, @MavenRepository(repositoryId = REPOSITORY_RELEASES_TGIWR_2) Repository releases2, @Group(repositories = { REPOSITORY_RELEASES_TGIWR_1, REPOSITORY_RELEASES_TGIWR_2 }) @MavenRepository(repositoryId = REPOSITORY_RELEASES_TGIWR_GROUP) Repository releasesGroup, @MavenTestArtifact(repositoryId = REPOSITORY_RELEASES_TGIWR_1, id = "com.artifacts.in.releases.three:foo", versions = "1.2.3") Path a1, @MavenTestArtifact(repositoryId = REPOSITORY_RELEASES_TGIWR_1, id = "com.artifacts.in.releases.under2:group", versions = "1.2.3") Path a2, @MavenTestArtifact(repositoryId = REPOSITORY_RELEASES_TGIWR_2, id = "com.artifacts.in.releases.two:foo", versions = "1.2.4") Path a3, @MavenTestArtifact(repositoryId = REPOSITORY_RELEASES_TGIWR_2, id = "com.artifacts.in.releases.under2:group", versions = "1.2.4") Path a4) throws Exception { <START> logger.info("# Testing group includes with wildcard..."); <END> RepositoryProvider repositoryProvider = repositoryProviderRegistry.getProvider(releasesGroup.getType()); RepositoryPath resolvedPath = repositoryPathResolver.resolve(releasesGroup, (RepositoryPath) a3.normalize()); Path repositoryPath = repositoryProvider.fetchPath(resolvedPath); try (InputStream is = repositoryProvider.getInputStream(repositoryPath)) { assertNotNull(is); } }</code><technical_language>I in test cases logger.debug, fine-tune this, if reduce noise. For example, moment, build failing Travis (where run MacOS builds) log files exceeding limit</technical_language>

Target:
public void testGroupIncludesWildcardRule(@MavenRepository(repositoryId = REPOSITORY_RELEASES_TGIWR_1) Repository releases1, @MavenRepository(repositoryId = REPOSITORY_RELEASES_TGIWR_2) Repository releases2, @Group(repositories = { REPOSITORY_RELEASES_TGIWR_1, REPOSITORY_RELEASES_TGIWR_2 }) @MavenRepository(repositoryId = REPOSITORY_RELEASES_TGIWR_GROUP) Repository releasesGroup, @MavenTestArtifact(repositoryId = REPOSITORY_RELEASES_TGIWR_1, id = "com.artifacts.in.releases.three:foo", versions = "1.2.3") Path a1, @MavenTestArtifact(repositoryId = REPOSITORY_RELEASES_TGIWR_1, id = "com.artifacts.in.releases.under2:group", versions = "1.2.3") Path a2, @MavenTestArtifact(repositoryId = REPOSITORY_RELEASES_TGIWR_2, id = "com.artifacts.in.releases.two:foo", versions = "1.2.4") Path a3, @MavenTestArtifact(repositoryId = REPOSITORY_RELEASES_TGIWR_2, id = "com.artifacts.in.releases.under2:group", versions = "1.2.4") Path a4) throws Exception { logger.debug("# Testing group includes with wildcard..."); RepositoryProvider repositoryProvider = repositoryProviderRegistry.getProvider(releasesGroup.getType()); RepositoryPath resolvedPath = repositoryPathResolver.resolve(releasesGroup, (RepositoryPath) a3.normalize()); Path repositoryPath = repositoryProvider.fetchPath(resolvedPath); try (InputStream is = repositoryProvider.getInputStream(repositoryPath)) { assertNotNull(is); } }
Source:
<code>private boolean testngXmlExistsInJar(File jarFile, List<String> classes) throws IOException { boolean foundTestngXml = false; try (JarFile jf = new JarFile(jarFile)) { Enumeration<JarEntry> entries = jf.entries(); while (entries.hasMoreElements()) { JarEntry je = entries.nextElement(); if (matchesXmlPathInJar(je)) { Collection<XmlSuite> parsedSuites = Parser.parse(jf.getInputStream(je), processor); for (XmlSuite suite : parsedSuites) { XmlSuite suiteToAdd = suite; if (testNames != null) { suiteToAdd = XmlSuiteUtils.cloneIfContainsTestsWithNamesMatchingAny(suite, testNames); } suites.add(suiteToAdd); } <START> foundTestngXml = true; <END> break; } else if (isJavaClass(je)) { classes.add(constructClassName(je)); } } } return foundTestngXml; }</code><technical_language>return</technical_language>

Target:
private boolean testngXmlExistsInJar(File jarFile, List<String> classes) throws IOException { boolean foundTestngXml = false; try (JarFile jf = new JarFile(jarFile)) { Enumeration<JarEntry> entries = jf.entries(); while (entries.hasMoreElements()) { JarEntry je = entries.nextElement(); if (matchesXmlPathInJar(je)) { Collection<XmlSuite> parsedSuites = Parser.parse(jf.getInputStream(je), processor); for (XmlSuite suite : parsedSuites) { XmlSuite suiteToAdd = suite; if (testNames != null) { suiteToAdd = XmlSuiteUtils.cloneIfContainsTestsWithNamesMatchingAny(suite, testNames); } suites.add(suiteToAdd); } return true; } else if (isJavaClass(je)) { classes.add(constructClassName(je)); } } } return foundTestngXml; }
Source:
<code>public void init(Configuration conf, RMProxy<T> proxy, Class<T> protocol) { this.protocol = protocol; try { YarnConfiguration yarnConf = new YarnConfiguration(conf); InetSocketAddress rmAddress = proxy.getRMAddress(yarnConf, protocol); <START> LOG.info("Connecting to ResourceManager at " + rmAddress); <END> this.proxy = proxy.getProxy(yarnConf, protocol, rmAddress); } catch (IOException ioe) { LOG.error("Unable to create proxy to the ResourceManager ", ioe); } }</code><technical_language>log4j format {}</technical_language>

Target:
public void init(Configuration conf, RMProxy<T> proxy, Class<T> protocol) { this.protocol = protocol; try { YarnConfiguration yarnConf = new YarnConfiguration(conf); InetSocketAddress rmAddress = proxy.getRMAddress(yarnConf, protocol); LOG.info("Connecting to ResourceManager at {}", rmAddress); this.proxy = proxy.getProxy(yarnConf, protocol, rmAddress); } catch (IOException ioe) { LOG.error("Unable to create proxy to the ResourceManager ", ioe); } }
Source:
<code>public void entityReference(String entity) { assertOpenBlock(); String literal = entityToLiteral.get(entity); if (literal == null) { <START> literal = EntityReferences.instance().equivalentString(entity); <END> } try { currentBlock.write(literal); } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>this handle case equivalent string is null, eg. literal = EntityReferences.instance().equivalentString(entity); if (literal == null) { literal = "&" + entity + ";"; //$NON-NLS-1$//$NON-NLS-2$ }</technical_language>

Target:
public void entityReference(String entity) { assertOpenBlock(); String literal = EntityReferences.instance().equivalentString(entity); if (literal == null) { literal = "&" + entity + ";"; } try { currentBlock.write(literal); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>private void handleIndexChangedEvent(GitEvent event) { Status status = newDto(Status.class); if (event instanceof GitCommitEvent) { status = ((GitCommitEvent) event).getStatus(); } else if (event instanceof GitResetEvent) { status = ((GitResetEvent) event).getStatus(); } else if (event instanceof GitRepositoryInitializedEvent) { status = ((GitRepositoryInitializedEvent) event).getStatus(); } for (String endpointId : endpointIds) { transmitter .newRequest() .endpointId(endpointId) <START> .methodName("event/git-index") <END> .paramsAsDto(status) .sendAndSkipResult(); } }</code><technical_language>event/git/indexStatusChanged event/git/indexChanged similar previously event/git/subscribe homogeneous method names here</technical_language>

Target:
private void handleIndexChangedEvent(GitEvent event) { Status status = newDto(Status.class); if (event instanceof GitCommitEvent) { status = ((GitCommitEvent) event).getStatus(); } else if (event instanceof GitResetEvent) { status = ((GitResetEvent) event).getStatus(); } else if (event instanceof GitRepositoryInitializedEvent) { status = ((GitRepositoryInitializedEvent) event).getStatus(); } for (String endpointId : endpointIds) { transmitter .newRequest() .endpointId(endpointId) .methodName("event/git/indexChanged") .paramsAsDto(status) .sendAndSkipResult(); } }
Source:
<code>public boolean sendEmail(final Report report, final String team) { SendGrid sendGrid = new SendGrid(apikey); SendGrid.Email email = createEmail(report, team); try { return sendGrid.send(email).getStatus(); <START> } catch (SendGridException e) { <END> throw new RuntimeException(e); } }</code><technical_language>Missing test for case. catching exception re-throwing a specific exception</technical_language>

Target:
public boolean sendEmail(final Report report, final String team) throws SendGridException { SendGrid sendGrid = new SendGrid(apikey); SendGrid.Email email = createEmail(report, team); return sendGrid.send(email).getStatus(); }