auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Long deserializeRestoreInformation(List<String> children, Map<String, Set<SnapshotInfo>> snapshotFragments) throws Exception { try { int recover = m_action.ordinal(); Long clStartTxnId = null; for (String node : children) { if (node.equals("snapshot_id")) continue; byte[] data = null; data = m_zk.getData(VoltZK.restore + "/" + node, false, null); String jsonData = new String(data, "UTF8"); JSONObject json = new JSONObject(jsonData); long maxTxnId = json.optLong("max", Long.MIN_VALUE); if (maxTxnId != Long.MIN_VALUE) { if (clStartTxnId == null || maxTxnId > clStartTxnId) { clStartTxnId = maxTxnId; } } int remoteRecover = json.getInt("action"); if (remoteRecover != recover) { String msg = "Database actions are not consistent. Remote node action is not 'recover'. " + "Please enter the same database action on the command-line."; <START> VoltDB.crashLocalVoltDB(msg, true, null); <END> } JSONArray snapInfos = json.getJSONArray("snapInfos"); int snapInfoCnt = snapInfos.length(); for (int i=0; i < snapInfoCnt; i++) { JSONObject jsonInfo = snapInfos.getJSONObject(i); SnapshotInfo info = new SnapshotInfo(jsonInfo); Set<SnapshotInfo> fragments = snapshotFragments.get(info.nonce); if (fragments == null) { fragments = new HashSet<SnapshotInfo>(); snapshotFragments.put(info.nonce, fragments); } fragments.add(info); } } return clStartTxnId; } catch (JSONException je) { VoltDB.crashLocalVoltDB("Error exchanging snapshot information", true, je); } throw new RuntimeException("impossible"); }</code><technical_language>stack trace of error message is pretty clear happened</technical_language>

Target:
private Long deserializeRestoreInformation(List<String> children, Map<String, Set<SnapshotInfo>> snapshotFragments) throws Exception { try { int recover = m_action.ordinal(); Long clStartTxnId = null; for (String node : children) { if (node.equals("snapshot_id")) continue; byte[] data = null; data = m_zk.getData(VoltZK.restore + "/" + node, false, null); String jsonData = new String(data, "UTF8"); JSONObject json = new JSONObject(jsonData); long maxTxnId = json.optLong("max", Long.MIN_VALUE); if (maxTxnId != Long.MIN_VALUE) { if (clStartTxnId == null || maxTxnId > clStartTxnId) { clStartTxnId = maxTxnId; } } int remoteRecover = json.getInt("action"); if (remoteRecover != recover) { String msg = "Database actions are not consistent. Remote node action is not 'recover'. " + "Please enter the same database action on the command-line."; VoltDB.crashLocalVoltDB(msg, false, null); } JSONArray snapInfos = json.getJSONArray("snapInfos"); int snapInfoCnt = snapInfos.length(); for (int i=0; i < snapInfoCnt; i++) { JSONObject jsonInfo = snapInfos.getJSONObject(i); SnapshotInfo info = new SnapshotInfo(jsonInfo); Set<SnapshotInfo> fragments = snapshotFragments.get(info.nonce); if (fragments == null) { fragments = new HashSet<SnapshotInfo>(); snapshotFragments.put(info.nonce, fragments); } fragments.add(info); } } return clStartTxnId; } catch (JSONException je) { VoltDB.crashLocalVoltDB("Error exchanging snapshot information", true, je); } throw new RuntimeException("impossible"); }
Source:
<code>public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { String message; if (chooseUseText == null) { String effectText = executingEffects.getText(source.getModes().getMode()); message = "Pay " + cost.getText() + " to prevent (" + effectText.substring(0, effectText.length() - 1) + ")?"; } else { message = chooseUseText; } message = CardUtil.replaceSourceName(message, sourceObject.getName()); boolean result = true; boolean doEffect = true; for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null && player != controller && cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { if (!game.isSimulation()) { game.informPlayers(player.getLogName() + " pays the cost to prevent the effect"); } doEffect = false; <START> break; <END> } } } if (doEffect) { for (Effect effect : executingEffects) { effect.setTargetPointer(this.targetPointer); if (effect instanceof OneShotEffect) { result &= effect.apply(game, source); } else { game.addEffect((ContinuousEffect) effect, source); } } } return result; } return false; }</code><technical_language>break needed here, people get option pay if paid. I know, weird</technical_language>

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller != null && sourceObject != null) { String message; if (chooseUseText == null) { String effectText = executingEffects.getText(source.getModes().getMode()); message = "Pay " + cost.getText() + " to prevent (" + effectText.substring(0, effectText.length() - 1) + ")?"; } else { message = chooseUseText; } message = CardUtil.replaceSourceName(message, sourceObject.getName()); boolean result = true; boolean doEffect = true; for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null && player != controller && cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) { if (!game.isSimulation()) { game.informPlayers(player.getLogName() + " pays the cost to prevent the effect"); } doEffect = false; } } } if (doEffect) { for (Effect effect : executingEffects) { effect.setTargetPointer(this.targetPointer); if (effect instanceof OneShotEffect) { result &= effect.apply(game, source); } else { game.addEffect((ContinuousEffect) effect, source); } } } return result; } return false; }
Source:
<code>private void showWarningNotification(String code, String message) { <START> if(message == null) <END> message = ""; getApplication().getMainWindow().showNotification(getLocalizedMessage(code) + message, Window.Notification.TYPE_WARNING_MESSAGE); }</code><technical_language>nvl() do</technical_language>

Target:
private void showWarningNotification(String code, String message) { getApplication().getMainWindow().showNotification(getLocalizedMessage(code) + nvl(message), Window.Notification.TYPE_WARNING_MESSAGE); }
Source:
<code>protected void testExecute_asInstructorWithCourseId_shouldReturnAllSessionsForCourse() { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); loginAsInstructor(instructor1OfCourse1.googleId); String[] submissionParam = { Const.ParamsNames.COURSE_ID, instructor1OfCourse1.getCourseId(), }; GetFeedbackSessionsAction a = getAction(submissionParam); FeedbackSessionsData fsData = (FeedbackSessionsData) getJsonResult(a).getOutput(); <START> assertEquals(6, fsData.getFeedbackSessions().size()); <END> }</code><technical_language>verify 6 feedback sessions course. Ideally, verify feedback sessions match</technical_language>

Target:
protected void testExecute_asInstructorWithCourseId_shouldReturnAllSessionsForCourse() { InstructorAttributes instructor2OfCourse1 = typicalBundle.instructors.get("instructor2OfCourse1"); loginAsInstructor(instructor2OfCourse1.googleId); String[] submissionParam = { Const.ParamsNames.COURSE_ID, instructor2OfCourse1.getCourseId(), Const.ParamsNames.ENTITY_TYPE, Const.EntityType.INSTRUCTOR, }; GetFeedbackSessionsAction action = getAction(submissionParam); FeedbackSessionsData fsData = (FeedbackSessionsData) getJsonResult(action).getOutput(); assertEquals(5, fsData.getFeedbackSessions().size()); assertAllInstructorSessionsMatch(fsData, sessionsInCourse1); }
Source:
<code>public void endVisit(UnaryExpression x, BlockScope b) { int operator = ((x.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT); if (operator == OperatorIds.PLUS && !(x.expression instanceof Literal)) { foundUnaryPos = true; Constant outer = x.constant; Constant inner = x.expression.constant; boolean <START> hasEcjUnaryPosBug = <END> !outer.equals(inner); assert hasEcjUnaryPosBug; } }</code><technical_language>I guess rename foundUnaryPos hasEcjUnaryPosBug write like: hasEcjUnaryPosBug |= !outer.equals(inner); check is accurate</technical_language>

Target:
public void endVisit(UnaryExpression x, BlockScope b) { int operator = ((x.bits & ASTNode.OperatorMASK) >> ASTNode.OperatorSHIFT); if (operator == OperatorIds.PLUS && !(x.expression instanceof Literal)) { hasEcjUnaryPosBug = true; Constant outer = x.constant; Constant inner = x.expression.constant; boolean hasEcjUnaryPosBug = !outer.equals(inner); assert hasEcjUnaryPosBug; } }
Source:
<code>public static void setBaseExtensionFields(DomainResource fhirResource, BaseOpenmrsMetadata openmrsMetadata) { fhirResource.addExtension(createDateCreatedExtension(openmrsMetadata.getDateCreated())); fhirResource.addExtension(createCreatorExtension(openmrsMetadata.getCreator())); <START> if (openmrsMetadata.getDateChanged() != null) { <END> fhirResource.addExtension(createDateChangedExtension(openmrsMetadata.getDateChanged())); fhirResource.addExtension(createChangedByExtension(openmrsMetadata.getChangedBy())); } if (openmrsMetadata.getRetired()) { fhirResource.addExtension(createRetiredExtension(openmrsMetadata.getRetired())); fhirResource.addExtension(createDateRetiredExtension(openmrsMetadata.getDateRetired())); fhirResource.addExtension(createRetiredByExtension(openmrsMetadata.getRetiredBy())); fhirResource.addExtension(createRetireReasonExtension(openmrsMetadata.getRetireReason())); } }</code><technical_language>check changedBy well</technical_language>

Target:
public static void setBaseExtensionFields(DomainResource fhirResource, BaseOpenmrsMetadata openmrsMetadata) { fhirResource.addExtension(ExtensionsUtil.createDateCreatedExtension(openmrsMetadata.getDateCreated())); fhirResource.addExtension(ExtensionsUtil.createCreatorExtension(openmrsMetadata.getCreator())); if (openmrsMetadata.getDateChanged() != null) { fhirResource.addExtension(ExtensionsUtil.createDateChangedExtension(openmrsMetadata.getDateChanged())); fhirResource.addExtension(ExtensionsUtil.createChangedByExtension(openmrsMetadata.getChangedBy())); } if (openmrsMetadata.getRetired()) { fhirResource.addExtension(ExtensionsUtil.createRetiredExtension(openmrsMetadata.getRetired())); fhirResource.addExtension(ExtensionsUtil.createDateRetiredExtension(openmrsMetadata.getDateRetired())); fhirResource.addExtension(ExtensionsUtil.createRetiredByExtension(openmrsMetadata.getRetiredBy())); fhirResource.addExtension(ExtensionsUtil.createRetireReasonExtension(openmrsMetadata.getRetireReason())); } }
Source:
<code>public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { return next.process() <START> .flatMap(response -> { <END> HttpResponse responseAfterScrub = scrubETagHeader(response); return Mono.justOrEmpty(responseAfterScrub); }); }</code><technical_language>This .flatMap(response -> Mono.justOrEmpty(scrubETagHeader(response)). Also, do need justOrEmpty this able null</technical_language>

Target:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { return next.process() .flatMap(response -> Mono.just(scrubETagHeader(response))); }
Source:
<code>protected void configure() { <START> bind(DateAdapter.class).to(Iso8601DateAdapter.class); <END> super.configure(); }</code><technical_language>This binding is redundant if AutoscaleParserModule adds it. Remove here</technical_language>

Target:
protected void configure() { super.configure(); }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } VDSGroup cluster = getVdsGroup(); if (cluster == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (!cluster.supportsGlusterService()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_DOES_NOT_SUPPORT_GLUSTER); return false; } <START> GlusterVolumeEntity volume = getDbFacade().getGlusterVolumeDao().getById(snapshot.getVolumeId()); <END> if (volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (!isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } return true; }</code><technical_language>check snapshot.getVolumeId is null</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } VDSGroup cluster = getVdsGroup(); if (cluster == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (!cluster.supportsGlusterService()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_DOES_NOT_SUPPORT_GLUSTER); return false; } if (volume != null && volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (!isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } return true; }
Source:
<code>public NewSubAppCommand(FBNetwork fbNetwork, List<?> selection, int x, int y) { super(fbNetwork, LibraryElementFactory.eINSTANCE.createSubApp(), x, y); getSubApp().setSubAppNetwork(LibraryElementFactory.eINSTANCE.createFBNetwork()); <START> PositioningUtilities.removeXYOffsetForFBNetwork(selection); <END> addElements = new AddElementsToSubAppCommand(getSubApp(), selection); checkMapping(selection); }</code><technical_language>this break undo</technical_language>

Target:
public NewSubAppCommand(FBNetwork fbNetwork, List<?> selection, int x, int y) { super(fbNetwork, LibraryElementFactory.eINSTANCE.createSubApp(), x, y); getSubApp().setSubAppNetwork(LibraryElementFactory.eINSTANCE.createFBNetwork()); addElements = new AddElementsToSubAppCommand(getSubApp(), selection); checkMapping(selection); }
Source:
<code>public ConnectionFactory connectionFactory() { <START> return ConnectionFactories.get(connectionString); <END> }</code><technical_language>configure application a connection pool creating connection factory? recommend connection pooling a practice in docs. [spring-data docs](<LINK_1> call out [r2dbc-pool](<LINK_0> a popular option</technical_language>

Target:
public ConnectionFactory connectionFactory() { ConnectionFactory connectionFactory = ConnectionFactories.get(connectionString); ConnectionPoolConfiguration configuration = ConnectionPoolConfiguration .builder(connectionFactory) .maxIdleTime(Duration.ofMillis(1000)) .maxSize(20) .build(); return new ConnectionPool(configuration); }
Source:
<code><START> public void dbNameIsRequired() throws Exception { <END> parameters.remove(JobParametersNames.DB_NAME); validator.validate(new JobParameters(parameters)); }</code><technical_language>Normalize of required/missing end of method name validator tests classes</technical_language>

Target:
public void dbNameIsRequired() throws Exception { requiredParameters.remove(JobParametersNames.DB_NAME); validator.validate(new JobParameters(requiredParameters)); }
Source:
<code><START> public void scrollToBottom(WebDriver driver) { <END> ((JavascriptExecutor) driver) .executeScript("window.scrollTo(0, document.body.scrollHeight)"); }</code><technical_language>public PostsListPage return this for chaining purpose</technical_language>

Target:
public PostsListPage scrollToBottom(WebDriver driver) { ((JavascriptExecutor) driver) .executeScript("window.scrollTo(0, document.body.scrollHeight)"); return this; }
Source:
<code>private List<ACL> removeDuplicates(List<ACL> acl) { ArrayList<ACL> retval = new ArrayList<ACL>(); <START> if(acl != null) { <END> Iterator<ACL> it = acl.iterator(); while (it.hasNext()) { ACL a = it.next(); if (retval.contains(a) == false) { retval.add(a); } } } return retval; }</code><technical_language>nit: space if (</technical_language>

Target:
private List<ACL> removeDuplicates(List<ACL> acl) { LinkedList<ACL> retval = new LinkedList<ACL>(); if (acl != null) { for (ACL a : acl) { if (!retval.contains(a)) { retval.add(a); } } } return retval; }
Source:
<code>public int execute(DriverContext driverContext) { if (driverContext.getCtx().getExplainAnalyze() == AnalyzeState.RUNNING) { return 0; } try { Hive db = Hive.get(conf); DDLDesc ddlDesc = work.getDDLDesc(); if (DESC_TO_OPARATION.containsKey(ddlDesc.getClass())) { DDLOperation<?> ddlOperation = DESC_TO_OPARATION.get(ddlDesc.getClass()).newInstance(); ddlOperation.init(db, conf, driverContext, ddlDesc); return ddlOperation.execute(); } else { throw new IllegalArgumentException("Unknown DDL request: " + ddlDesc.getClass()); } } catch (Throwable e) { failed(e); return 1; } <START> } <END></code><technical_language>ddl errors translated error code 1; if want that... * declare some exception haul errorcode; unpack/log * contracts this class - catching throwable includes kind of crap (like OOM) - want do that</technical_language>

Target:
public int execute(DriverContext driverContext) { if (driverContext.getCtx().getExplainAnalyze() == AnalyzeState.RUNNING) { return 0; } try { DDLDesc ddlDesc = work.getDDLDesc(); if (DESC_TO_OPARATION.containsKey(ddlDesc.getClass())) { DDLOperationContext context = new DDLOperationContext(conf, driverContext); Class<? extends DDLOperation> ddlOpertaionClass = DESC_TO_OPARATION.get(ddlDesc.getClass()); Constructor<? extends DDLOperation> constructor = ddlOpertaionClass.getConstructor(DDLOperationContext.class, ddlDesc.getClass()); DDLOperation ddlOperation = constructor.newInstance(context, ddlDesc); return ddlOperation.execute(); } else { throw new IllegalArgumentException("Unknown DDL request: " + ddlDesc.getClass()); } } catch (Throwable e) { failed(e); return 1; } }
Source:
<code>public Object[] getUserAndServerUrl(RealmConfiguration config) { if (config instanceof SyncConfiguration) { SyncConfiguration syncConfig = (SyncConfiguration) config; SyncUser user = syncConfig.getUser(); if (!user.isValid()) { <START> throw new IllegalStateException("SyncUser is no longer valid, probably logged out."); <END> } else { String rosServerUrl = syncConfig.getServerUrl().toString(); String rosUserIdentity = user.getIdentity(); String syncRealmAuthUrl = user.getAuthenticationUrl().toString(); String rosRefreshToken = user.toJson(); return new Object[]{rosUserIdentity, rosServerUrl, syncRealmAuthUrl, rosRefreshToken, syncConfig.syncClientValidateSsl(), syncConfig.getServerCertificateFilePath()}; } } else { return new Object[6]; } }</code><technical_language>I this is problematic, I this getInstance(syncConfig) throw if user is longer considered valid. Right do this check creating SyncConfiguration do it. opening Realm instance is late, open people work offline IMO</technical_language>

Target:
public Object[] getUserAndServerUrl(RealmConfiguration config) { if (config instanceof SyncConfiguration) { SyncConfiguration syncConfig = (SyncConfiguration) config; SyncUser user = syncConfig.getUser(); if (!user.isValid()) { if (user.getAccessToken() == null) { throw new IllegalStateException("The SyncUser is already logged out and can not use the provided configuration to open a Realm."); } else { RealmLog.warn("Can not use the provided configuration to open a Realm, the SyncUser is no longer valid."); } } String rosServerUrl = syncConfig.getServerUrl().toString(); String rosUserIdentity = user.getIdentity(); String syncRealmAuthUrl = user.getAuthenticationUrl().toString(); String rosSerializedUser = user.toJson(); return new Object[]{rosUserIdentity, rosServerUrl, syncRealmAuthUrl, rosSerializedUser, syncConfig.syncClientValidateSsl(), syncConfig.getServerCertificateFilePath()}; } else { return new Object[6]; } }
Source:
<code>private void lockAxis() { double min = 0; double max = 0; try { min = Double.parseDouble(fMinText.getText()); max = Double.parseDouble(fMaxText.getText()); fChartViewer.setFixedYRange(new AxisRange(min, max)); <START> super.okPressed(); <END> } catch (Exception e) { TraceUtils.displayErrorMsg(Messages.TmfChartView_Error, Messages.TmfChartView_InvalidRange); } }</code><technical_language>job of this method call this, done line 133</technical_language>

Target:
private void lockAxis() { double min = 0; double max = 0; try { min = Double.parseDouble(fMinText.getText()); max = Double.parseDouble(fMaxText.getText()); fChartViewer.setFixedYRange(new AxisRange(min, max)); } catch (NumberFormatException e) { } }
Source:
<code>public PayloadValidatingInterceptor payloadValidatingInterceptor() { final PayloadValidatingInterceptor payloadValidatingInterceptor = new PayloadValidatingInterceptor(); final Resource[] resources = new Resource[] { new ClassPathResource("schemas/common.xsd"), <START> new ClassPathResource("schemas/sm-installation.xsd"), <END> new ClassPathResource("schemas/sm-management.xsd"), new ClassPathResource("schemas/sm-bundle.xsd"), new ClassPathResource("schemas/sm-monitoring.xsd"), new ClassPathResource("schemas/sm-adhoc.xsd"), new ClassPathResource("schemas/sm-configuration.xsd") }; payloadValidatingInterceptor.setSchemas(resources); return payloadValidatingInterceptor; }</code><technical_language>Move String values more a constant</technical_language>

Target:
public PayloadValidatingInterceptor payloadValidatingInterceptor() { final PayloadValidatingInterceptor payloadValidatingInterceptor = new PayloadValidatingInterceptor(); final Resource[] resources = new Resource[] { new ClassPathResource(COMMON_XSD_PATH), new ClassPathResource(SMART_METERING_INSTALLATION_XSD_PATH), new ClassPathResource(SMART_METERING_MANAGEMENT_XSD_PATH), new ClassPathResource(SMART_METERING_BUNDLE_XSD_PATH), new ClassPathResource(SMART_METERING_MONITORING_XSD_PATH), new ClassPathResource(SMART_METERING_ADHOC_XSD_PATH), new ClassPathResource(SMART_METERING_CONFIGURATION_XSD_PATH) }; payloadValidatingInterceptor.setSchemas(resources); return payloadValidatingInterceptor; }
Source:
<code>public void execute(IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, 2); progress.setTaskName(NLS.bind(CoreText.TagOperation_performingTagging, tag.getTag())); ObjectId tagId = <START> !annotated ? tag.getObjectId() : updateTagObject(); <END> progress.worked(1); updateRepo(tagId); progress.worked(1); }</code><technical_language>please invert conditional operator get rid of negation</technical_language>

Target:
public void execute(IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, 2); progress.setTaskName(NLS.bind(CoreText.TagOperation_performingTagging, tag.getTag())); ObjectId tagId = annotated ? updateTagObject() : tag.getObjectId(); progress.worked(1); updateRepo(tagId); progress.worked(1); }
Source:
<code>static void trackVisitedUrl(String url) { synchronized (Gh4Application.class) { if (sHasCrashlytics) { <START> FabricApplication.trackVisitedUrl(url, sNextUrlTrackingPosition); <END> if (++sNextUrlTrackingPosition >= MAX_TRACKED_URLS) { sNextUrlTrackingPosition = 0; } } } }</code><technical_language>above: Move logic helper class do CrashReportingHelper.trackVisitedUrl(url); synchronized block</technical_language>

Target:
static void trackVisitedUrl(String url) { synchronized (Gh4Application.class) { CrashReportingHelper.trackVisitedUrl(get(), url); } }
Source:
<code>public Condition getCondition() { return condition; <START> } <END></code><technical_language>constructor exposed user. User ChannelConfiguration class</technical_language>

Target:
public TriggerCondition getCondition() { return condition; }
Source:
<code>public void publishMetrics(List<MetricDatumWithKey<CloudWatchMetricKey>> dataToPublish) { for (int startIndex = 0; startIndex < dataToPublish.size(); startIndex += BATCH_SIZE) { int endIndex = Math.min(dataToPublish.size(), startIndex + BATCH_SIZE); PutMetricDataRequest.Builder request = PutMetricDataRequest.builder(); request = request.namespace(namespace); List<MetricDatum> metricData = new ArrayList<>(); for (int i = startIndex; i < endIndex; i++) { metricData.add(dataToPublish.get(i).datum); } request = request.metricData(metricData); try { <START> cloudWatchClient.putMetricData(request.build()).get(PUT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); <END> } catch (Exception e) { log.warn("Could not publish datums to CloudWatch", endIndex - startIndex, e instanceof ExecutionException ? e.getCause() : e); } } }</code><technical_language>need add timeout. catch for specific exceptions instead of generic ones. java final AWSExceptionManager exceptionManager = new AWSExceptionManager(); exceptionManager.add(CloudWatchException.class, t -> t); try { try { cloudWatchClient.putMetricData(request.build()).get(); } catch (ExecutionException e) { throw exceptionManager.apply(e.getCause); } catch (InterruptedException e) { log.info("Interrupted, shutdown invoked"); } } catch(CloudWatchException e) { log.warn("Exception thrown while publishing CW", e); } catch (Exception e) { log.error("Unknown issue while publishing CW", e); }</technical_language>

Target:
public void publishMetrics(List<MetricDatumWithKey<CloudWatchMetricKey>> dataToPublish) { for (int startIndex = 0; startIndex < dataToPublish.size(); startIndex += BATCH_SIZE) { int endIndex = Math.min(dataToPublish.size(), startIndex + BATCH_SIZE); PutMetricDataRequest.Builder request = PutMetricDataRequest.builder(); request = request.namespace(namespace); List<MetricDatum> metricData = new ArrayList<>(); for (int i = startIndex; i < endIndex; i++) { metricData.add(dataToPublish.get(i).datum); } request = request.metricData(metricData); try { PutMetricDataRequest.Builder finalRequest = request; blockingExecute(cloudWatchAsyncClient.putMetricData(finalRequest.build()), PUT_TIMEOUT_MILLIS, CW_EXCEPTION_MANAGER); } catch(CloudWatchException | TimeoutException e) { log.warn("Could not publish datums to CloudWatch", endIndex - startIndex, e); } catch (Exception e) { log.error("Unknown exception while publishing datums to CloudWatch", endIndex - startIndex, e); } } }
Source:
<code>static <T> Iterator<T> reverseIterator(Iterable<T> iterable) { if (iterable instanceof java.util.List) { final java.util.List<T> list = (java.util.List<T>) iterable; return new Iterator<T>() { java.util.ListIterator<T> delegate = list.listIterator(list.size()); @Override public boolean hasNext() { return delegate.hasPrevious(); } @Override public T next() { return delegate.previous(); } }; } else if (iterable instanceof Seq) { return ((Seq<T>) iterable).reverseIterator(); } else { <START> return Iterator.ofAll(iterable).foldLeft(List.<T>empty(), List::prepend).iterator(); <END> } }</code><technical_language>Good idea a stack instead of a Vector (which require a size hint). I suggest pushAll instead of foldLeft: java List.<T> empty().pushAll(iterable).iterator();</technical_language>

Target:
static <T> Iterator<T> reverseIterator(Iterable<T> iterable) { if (iterable instanceof java.util.List) { final java.util.List<T> list = (java.util.List<T>) iterable; return new Iterator<T>() { java.util.ListIterator<T> delegate = list.listIterator(list.size()); @Override public boolean hasNext() { return delegate.hasPrevious(); } @Override public T next() { return delegate.previous(); } }; } else if (iterable instanceof Seq) { return ((Seq<T>) iterable).reverseIterator(); } else { return List.<T>empty().pushAll(iterable).iterator(); } }
Source:
<code>public HelixVcrCluster(CloudConfig cloudConfig, ClusterMapConfig clusterMapConfig, ClusterMap clusterMap) { <START> if (Utils.isNullOrEmpty(CloudConfig.VCR_CLUSTER_ZK_CONNECT_STRING)) { <END> throw new IllegalArgumentException("Missing value for " + CloudConfig.VCR_CLUSTER_ZK_CONNECT_STRING); } else if (Utils.isNullOrEmpty(CloudConfig.VCR_CLUSTER_NAME)) { throw new IllegalArgumentException("Missing value for " + CloudConfig.VCR_CLUSTER_NAME); } this.cloudConfig = cloudConfig; currentDataNode = new CloudDataNode(cloudConfig, clusterMapConfig); List<? extends PartitionId> allPartitions = clusterMap.getAllPartitionIds(null); logger.info("All partitions from clusterMap: {}.", allPartitions); partitionIdMap = allPartitions.stream().collect(Collectors.toMap(PartitionId::toPathString, Function.identity())); vcrClusterName = cloudConfig.vcrClusterName; vcrInstanceName = ClusterMapUtils.getInstanceName(clusterMapConfig.clusterMapHostName, clusterMapConfig.clusterMapPort); metrics = new HelixVcrClusterMetrics(clusterMap.getMetricRegistry(), assignedPartitionIds); }</code><technical_language>new version sense me. VCR_CLUSTER_ZK_CONNECT_STRING is a constant string empty. I checking cloudConfig.vcrClusterZkConnectString</technical_language>

Target:
public HelixVcrCluster(CloudConfig cloudConfig, ClusterMapConfig clusterMapConfig, ClusterMap clusterMap) { if (Utils.isNullOrEmpty(cloudConfig.vcrClusterZkConnectString)) { throw new IllegalArgumentException("Missing value for " + CloudConfig.VCR_CLUSTER_ZK_CONNECT_STRING); } else if (Utils.isNullOrEmpty(cloudConfig.vcrClusterName)) { throw new IllegalArgumentException("Missing value for " + CloudConfig.VCR_CLUSTER_NAME); } this.cloudConfig = cloudConfig; currentDataNode = new CloudDataNode(cloudConfig, clusterMapConfig); List<? extends PartitionId> allPartitions = clusterMap.getAllPartitionIds(null); logger.info("All partitions from clusterMap: {}.", allPartitions); partitionIdMap = allPartitions.stream().collect(Collectors.toMap(PartitionId::toPathString, Function.identity())); vcrClusterName = cloudConfig.vcrClusterName; vcrInstanceName = ClusterMapUtils.getInstanceName(clusterMapConfig.clusterMapHostName, clusterMapConfig.clusterMapPort); metrics = new HelixVcrClusterMetrics(clusterMap.getMetricRegistry(), assignedPartitionIds); }
Source:
<code>List<Document> parse() { final List<Document> documents = new LinkedList<>(); for (final Pair<LongWritable, Text> keyValue : dataSet) { final String text = keyValue.getSecond().toString().trim(); if (text.startsWith("#") || text.length() == 0) { continue; } final String[] split = text.split("\\s+"); <START> final List<Integer> wordList = new LinkedList<>(); <END> for (final String word : split) { wordList.add(Integer.parseInt(word)); } final int[] words = new int[wordList.size()]; for (int i = 0; i < words.length; i++) { words[i] = wordList.get(i); } documents.add(new Document(words, numTopics)); } LOG.log(Level.INFO, "Parsed {0} lines", documents.size()); return documents; }</code><technical_language>This LinkedList redundant. parse words put in words array</technical_language>

Target:
List<Document> parse() { final List<Document> documents = new LinkedList<>(); for (final Pair<LongWritable, Text> keyValue : dataSet) { final String text = keyValue.getSecond().toString().trim(); if (text.startsWith("#") || text.length() == 0) { continue; } final String[] split = text.split("\\s+"); final int[] words = new int[split.length]; for (int i = 0; i < split.length; i++) { words[i] = Integer.parseInt(split[i]); } documents.add(new Document(words, numTopics)); } LOG.log(Level.INFO, "Parsed {0} lines", documents.size()); return documents; }
Source:
<code>private static OutputWrapper connectPostgres(String param) throws IOException { try { Class.forName("org.postgresql.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:postgresql:" + param); return new OutputWrapper(conn); } catch (Exception e) { <START> throw new IOException(e.toString()); <END> } }</code><technical_language>throw new IOException(e)</technical_language>

Target:
private static OutputWrapper connectPostgres(String param) throws IOException { try { Class.forName("org.postgresql.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:postgresql:" + param); return new OutputWrapper(conn); } catch (Exception e) { throw new IOException(e); } }
Source:
<code>public double evaluate(JavaSparkContext sparkContext, PMML model, Path modelParentPath, JavaRDD<String> testData) { KMeansPMMLUtils.validatePMMLVsSchema(model, inputSchema); JavaRDD<Vector> testingData = parsedToVectorRDD(testData.map(MLFunctions.PARSE_FN)); List<ClusterInfo> clusterInfoList = KMeansPMMLUtils.read(model); double cost; switch (evaluationStrategy) { case "DAVIES-BOULDIN" : cost = Evaluation.daviesBouldinIndex(clusterInfoList, testingData); break; case "DUNN" : cost = Evaluation.dunnIndex(clusterInfoList, testingData); break; <START> default : <END> cost = pmmlToKMeansModel(model).computeCost(testingData.rdd()); break; } double eval = 1.0 / cost; log.info("Cost / eval {}", cost, eval); return eval; }</code><technical_language>name this case, "SSE" something, default in config file</technical_language>

Target:
public double evaluate(JavaSparkContext sparkContext, PMML model, Path modelParentPath, JavaRDD<String> testData) { KMeansPMMLUtils.validatePMMLVsSchema(model, inputSchema); JavaRDD<Vector> testingData = parsedToVectorRDD(testData.map(MLFunctions.PARSE_FN)); List<ClusterInfo> clusterInfoList = KMeansPMMLUtils.read(model); KMeansEvaluation kMeansEvaluation = new KMeansEvaluation(clusterInfoList); double cost; double eval = 0.0; log.info("Evaluation Strategy is {}", evaluationStrategy.name()); switch (evaluationStrategy) { case DAVIES_BOULDIN : eval = kMeansEvaluation.daviesBouldinIndex(testingData); log.info("Eval {}", eval); break; case DUNN : eval = kMeansEvaluation.dunnIndex(testingData); log.info("Eval {}", eval); break; case SILHOUETTE: log.info("Eval {}", eval); break; case SSE : cost = pmmlToKMeansModel(model).computeCost(testingData.rdd()); eval = 1.0 / cost; log.info("Cost / eval {}", cost, eval); break; } return eval; }
Source:
<code>private long doForceInsertExistingDocumentWithHistory(BasicDocumentRevision newRevision, List<String> revisions, Map<String, Object> attachments) { <START> logger.entering(this.getClass().getName(), <END> "doForceInsertExistingDocumentWithHistory", new Object[]{newRevision, revisions, attachments}); Preconditions.checkNotNull(newRevision, "New document revision must not be null."); Preconditions.checkArgument(this.containsDocument(newRevision.getId()), "DocumentRevisionTree must exist."); Preconditions.checkNotNull(revisions, "Revision history should not be null."); Preconditions.checkArgument(revisions.size() > 0, "Revision history should have at least one revision." ); long docNumericID = this.getDocNumericId(newRevision.getId()); DocumentRevisionTree localRevs = getAllRevisionsOfDocument(docNumericID); assert localRevs != null; long sequence; BasicDocumentRevision parent = localRevs.lookup(newRevision.getId(), revisions.get(0)); if(parent == null) { sequence = insertDocumentHistoryToNewTree(newRevision, revisions, docNumericID, localRevs); } else { sequence = insertDocumentHistoryIntoExistingTree(newRevision, revisions, docNumericID, localRevs, attachments); } return sequence; }</code><technical_language>of this.getClass().getName</technical_language>

Target:
private long doForceInsertExistingDocumentWithHistory(BasicDocumentRevision newRevision, List<String> revisions, Map<String, Object> attachments) { logger.entering("BasicDatastore", "doForceInsertExistingDocumentWithHistory", new Object[]{newRevision, revisions, attachments}); Preconditions.checkNotNull(newRevision, "New document revision must not be null."); Preconditions.checkArgument(this.containsDocument(newRevision.getId()), "DocumentRevisionTree must exist."); Preconditions.checkNotNull(revisions, "Revision history should not be null."); Preconditions.checkArgument(revisions.size() > 0, "Revision history should have at least one revision." ); long docNumericID = this.getDocNumericId(newRevision.getId()); DocumentRevisionTree localRevs = getAllRevisionsOfDocument(docNumericID); assert localRevs != null; long sequence; BasicDocumentRevision parent = localRevs.lookup(newRevision.getId(), revisions.get(0)); if(parent == null) { sequence = insertDocumentHistoryToNewTree(newRevision, revisions, docNumericID, localRevs); } else { sequence = insertDocumentHistoryIntoExistingTree(newRevision, revisions, docNumericID, localRevs, attachments); } return sequence; }
Source:
<code>@Override public Object adapt(Call<R> call) { Observable<Response<R>> responseObservable = isAsync ? new CallEnqueueObservable<>(call) : new CallExecuteObservable<>(call); Observable<?> observable; if (isResult) { observable = new ResultObservable<>(responseObservable); } else if (isBody) { <START> observable = new BodyObservable<>(responseObservable, !isCompletable); <END> } else { observable = responseObservable; } if (scheduler != null) { observable = observable.subscribeOn(scheduler); } if (isFlowable) { return observable.toFlowable(BackpressureStrategy.LATEST); } if (isSingle) { return observable.singleOrError(); } if (isMaybe) { return observable.singleElement(); } if (isCompletable) { return observable.ignoreElements(); } return RxJavaPlugins.onAssembly(observable); }</code><technical_language>I feel a complete throw error</technical_language>

Target:
@Override public Object adapt(Call<R> call) { Observable<Response<R>> responseObservable = isAsync ? new CallEnqueueObservable<>(call) : new CallExecuteObservable<>(call); Observable<?> observable; if (isResult) { observable = new ResultObservable<>(responseObservable); } else if (isBody) { observable = new BodyObservable<>(responseObservable, isSingle); } else { observable = responseObservable; } if (scheduler != null) { observable = observable.subscribeOn(scheduler); } if (isFlowable) { return observable.toFlowable(BackpressureStrategy.LATEST); } if (isSingle) { return observable.singleOrError(); } if (isMaybe) { return observable.singleElement(); } if (isCompletable) { return observable.ignoreElements(); } return RxJavaPlugins.onAssembly(observable); }
Source:
<code>void submitDeleteBlobOperation(String blobIdString, FutureResult<Void> futureResult, Callback<Void> callback) { try { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdString, clusterMap); DeleteOperation deleteOperation = <START> new DeleteOperation(routerConfig, responseHandler, blobId, futureResult, callback, time, routerMetrics); <END> deleteOperations.add(deleteOperation); } catch (RouterException e) { routerMetrics.operationDequeuingRate.mark(); routerMetrics.countError(e, NonBlockingRouter.RouterOperationType.DeleteBlob); operationCompleteCallback.completeOperation(futureResult, callback, null, e); } }</code><technical_language>add routerMetrics parameter, right routerConfig? sense config metrics together, is consistent pattern elsewhere</technical_language>

Target:
void submitDeleteBlobOperation(String blobIdString, FutureResult<Void> futureResult, Callback<Void> callback) { try { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdString, clusterMap); DeleteOperation deleteOperation = new DeleteOperation(routerConfig, routerMetrics, responseHandler, blobId, futureResult, callback, time); deleteOperations.add(deleteOperation); } catch (RouterException e) { routerMetrics.operationDequeuingRate.mark(); routerMetrics.deleteBlobErrorCount.inc(); routerMetrics.countError(e); operationCompleteCallback.completeOperation(futureResult, callback, null, e); } }
Source:
<code>private void updateCourseLevelPrivileges(Map<String, Boolean> privilegesMap, InstructorAttributes toUpdate) { <START> for (HashMap.Entry<String, Boolean> entry : privilegesMap.entrySet()) { <END> toUpdate.privileges.updatePrivilege(entry.getKey(), entry.getValue()); } }</code><technical_language>Prefer interface instead of concrete type. suggestion for (Map.Entry<String, Boolean> entry : privilegesMap.entrySet()) { in other places</technical_language>

Target:
private void updateCourseLevelPrivileges(Map<String, Boolean> privilegesMap, InstructorAttributes toUpdate) { for (Map.Entry<String, Boolean> entry : privilegesMap.entrySet()) { toUpdate.privileges.updatePrivilege(entry.getKey(), entry.getValue()); } }
Source:
<code><START> public String getAttribute() { <END> if (fAttribute.equals(NOT_SET)) { setAttribute(); } return fAttribute; }</code><technical_language>This method synchronized, otherwise, chances eventually a race condition for setting fAttribute</technical_language>

Target:
public synchronized String getAttribute() { if (fAttribute.equals(NOT_SET)) { setAttribute(); } return fAttribute; }
Source:
<code>public OrganizationalUnit newOrganizationalUnit(final SpaceInfo spaceInfo) { OrganizationalUnitImpl organizationalUnit = new OrganizationalUnitImpl(spaceInfo.getName(), spaceInfo.getDefaultGroupId(), spaceInfo.isDeleted()); final List<RepositoryInfo> repositories = spaceInfo.getRepositories(); if (repositories != null) { for (RepositoryInfo alias : repositories) { Space space = spacesAPI.getSpace(organizationalUnit.getName()); final Repository repo = repositoryService.getRepositoryFromSpace(space, alias.getName()); if (repo != null) { organizationalUnit.getRepositories().add(repo); } } } final List<String> securityGroups = spaceInfo.getSecurityGroups(); if (securityGroups != null) { organizationalUnit.getGroups().addAll(securityGroups); } <START> <END> final Collection<Contributor> contributors = spaceInfo.getContributors(); if (contributors != null) { organizationalUnit.getContributors().addAll(contributors); } return organizationalUnit; }</code><technical_language>logic moved getContributors</technical_language>

Target:
public OrganizationalUnit newOrganizationalUnit(final SpaceInfo spaceInfo) { OrganizationalUnitImpl organizationalUnit = new OrganizationalUnitImpl(spaceInfo.getName(), spaceInfo.getDefaultGroupId()); final List<RepositoryInfo> repositories = spaceInfo.getRepositories(); if (repositories != null) { for (RepositoryInfo alias : repositories) { Space space = spacesAPI.getSpace(organizationalUnit.getName()); final Repository repo = repositoryService.getRepositoryFromSpace(space, alias.getName()); if (repo != null) { organizationalUnit.getRepositories().add(repo); } } } final List<String> securityGroups = spaceInfo.getSecurityGroups(); if (securityGroups != null) { organizationalUnit.getGroups().addAll(securityGroups); } final Collection<Contributor> contributors = spaceInfo.getContributors(); if (contributors != null) { organizationalUnit.getContributors().addAll(contributors); } return organizationalUnit; }
Source:
<code>public void shutdown() <START> { <END> if (clientFactory != null) { for (TSocket eachTransfer: clientFactory.clientSocketMap.values()) { eachTransfer.close(); } } }</code><technical_language>code style issue. please this style public void shutdown() { }</technical_language>

Target:
public void shutdown() { if (clientFactory != null) { clientFactory.close(); } }
Source:
<code>public synchronized Set<String> getDataTypes(final String evalId) { if (!evalPartitions.containsKey(evalId)) { LOG.log(Level.WARNING, "The evaluator {0} does not exist.", evalId); return new HashSet<>(); } <START> return new HashSet<>(evalPartitions.get(evalId).keySet()); <END> }</code><technical_language>This work expected if evalPartitions.get(evalId) contains empty TreeSet a key (data type). check TreeSet is empty a evaluator contains data type</technical_language>

Target:
public synchronized Set<String> getDataTypes(final String evalId) { if (!evalPartitions.containsKey(evalId)) { LOG.log(Level.WARNING, "The evaluator {0} does not exist.", evalId); return new HashSet<>(); } final Set<String> dataTypeSet = new HashSet<>(evalPartitions.get(evalId).size()); for (final Map.Entry<String, TreeSet<LongRange>> entry : evalPartitions.get(evalId).entrySet()) { if (!entry.getValue().isEmpty()) { dataTypeSet.add(entry.getKey()); } } return dataTypeSet; }
Source:
<code>public void prepareFiles() { try { <START> TMP_JBOSS_CLI_FILE = File.createTempFile("tmp-jboss-cli", ".xml"); <END> } catch (IOException e) { fail(e.getLocalizedMessage()); } }</code><technical_language>file deleted exit</technical_language>

Target:
public void prepareFiles() { try { tempJbossConfigFile = File.createTempFile("tmp-jboss-cli", ".xml"); } catch (IOException e) { fail(e.getLocalizedMessage()); } }
Source:
<code>public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; } final String tag = FUtil.rainbowify(ChatColor.stripColor(FUtil.colorize(StringUtils.join(args, " ")))); for (String word : Command_tag.FORBIDDEN_WORDS) { <START> if (tag.contains(word)) <END> { msg("That tag contains a forbidden word."); return true; } } plugin.pl.getPlayer(playerSender).setTag(tag); msg("Set tag to " + tag); return true; }</code><technical_language>Add character limit check - #2105</technical_language>

Target:
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; } final String tag = ChatColor.stripColor(FUtil.colorize(StringUtils.join(args, " "))); if(tag.length() > 20) { msg("That tag is too long (Max is 20 characters)."); return true; } for (String word : Command_tag.FORBIDDEN_WORDS) { if (tag.contains(word)) { msg("That tag contains a forbidden word."); return true; } } plugin.pl.getPlayer(playerSender).setTag(FUtil.rainbowify(tag)); msg("Set tag to " + tag); return true; }
Source:
<code>public int hashCode() { <START> return HashUtil.combineHashCodes(multipleInstanceCollectionInput.hashCode(), <END> multipleInstanceCollectionOutput.hashCode(), multipleInstanceDataInput.hashCode(), multipleInstanceDataOutput.hashCode(), multipleInstanceCompletionCondition.hashCode(), onEntryAction.hashCode(), onExitAction.hashCode(), miTrigger.hashCode(), isAsync.hashCode()); }</code><technical_language>Objects.hashCode(multipleInstanceCollectionInput.hashCode()) for internal fields</technical_language>

Target:
public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(multipleInstanceCollectionInput), Objects.hashCode(multipleInstanceCollectionOutput), Objects.hashCode(multipleInstanceDataInput), Objects.hashCode(multipleInstanceDataOutput), Objects.hashCode(multipleInstanceCompletionCondition), Objects.hashCode(onEntryAction), Objects.hashCode(onExitAction), Objects.hashCode(miTrigger), Objects.hashCode(isAsync)); }
Source:
<code>public String getSpecParams() { <START> this.specParams = VmDeviceCommonUtils.appendDeviceIdToSpecParams(this.getId().getDeviceId(), this.specParams); <END> return this.specParams; }</code><technical_language>"this." is redundant</technical_language>

Target:
public String getSpecParams() { specParams = VmDeviceCommonUtils.appendDeviceIdToSpecParams(this.getId().getDeviceId(), specParams); return this.specParams; }