auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private FreeStyleJob status_thresholds_step7(final FreeStyleJob job, final TaskScannerAction action) { job.configure(); job.addShellStep("NEW=\"CLOSED\"\n" + "for t in \"todo\" \"TODO\" \"XXX\" \"fixme\" \"FIXME\" \"Deprecated\"\n" + "do\n" + " OLD=$t\n" + " for f in `ls`\n" + " do\n" + " if [ -f $f -a -r $f ]; then\n" + <START> " if [ $f = ${f%.java*}.java ]; then\n" + <END> " sed \"s/$OLD/$NEW/\" \"$f\" > \"${f}.new\"\n" + " mv \"${f}.new\" \"$f\"\n" + " else\n" + " echo \"Info: $f is not a *.java file. Skipped.\"\n" + " fi" + " else\n" + " echo \"Error: Cannot read $f\"\n" + " fi\n" + " done\n" + "done"); job.save(); Build lastBuild = buildSuccessfulJob(job); lastBuild.open(); assertThatOpenTaskCountLinkIs(action, 1, 17); assertThatNewOpenTaskCountLinkIs(action, 1); assertThatClosedTaskCountLinkIs(action, 3); action.open(); assertThat(action.getNumberOfWarnings(), is(1)); assertThat(action.getNumberOfNewWarnings(), is(1)); assertThat(action.getNumberOfFixedWarnings(), is(3)); assertThat(action.getNumberOfWarningsWithHighPriority(), is(0)); assertThat(action.getNumberOfWarningsWithNormalPriority(), is(0)); assertThat(action.getNumberOfWarningsWithLowPriority(), is(1)); assertThat(action.getPluginResult(lastBuild), is("Plug-in Result: SUCCESS - no threshold has been exceeded (Reference build: #1)")); return job; }</code><technical_language>simpler ls *.java avoid this if altogether</technical_language>

Target:
private FreeStyleJob status_thresholds_step7(final FreeStyleJob job, final TaskScannerAction action) { job.configure(); job.addShellStep("NEW=\"CLOSED\"\n" + "for t in \"todo\" \"TODO\" \"XXX\" \"fixme\" \"FIXME\" \"Deprecated\"\n" + "do\n" + " OLD=$t\n" + " for f in `ls *.java`\n" + " do\n" + " if [ -f $f -a -r $f ]; then\n" + " sed \"s/$OLD/$NEW/\" \"$f\" > \"${f}.new\"\n" + " mv \"${f}.new\" \"$f\"\n" + " else\n" + " echo \"Error: Cannot read $f\"\n" + " fi\n" + " done\n" + "done"); job.save(); Build lastBuild = buildSuccessfulJob(job); lastBuild.open(); assertThatOpenTaskCountLinkIs(action, 1, 17); assertThatNewOpenTaskCountLinkIs(action, 1); assertThatClosedTaskCountLinkIs(action, 3); action.open(); assertThat(action.getNumberOfWarnings(), is(1)); assertThat(action.getNumberOfNewWarnings(), is(1)); assertThat(action.getNumberOfFixedWarnings(), is(3)); assertThat(action.getNumberOfWarningsWithHighPriority(), is(0)); assertThat(action.getNumberOfWarningsWithNormalPriority(), is(0)); assertThat(action.getNumberOfWarningsWithLowPriority(), is(1)); assertThat(action.getPluginResult(lastBuild), is("Plug-in Result: SUCCESS - no threshold has been exceeded (Reference build: #1)")); return job; }
Source:
<code><START> public synchronized void count(String type) { <END> Integer count = this.counts.get(type); if (count == null) count = 0; count++; this.counts.put(type, count); if (COUNT_PROGRESS.contains(type) && count % PROGRESS_INTERVAL == 0) { String message = this.resources.getString(type); message = MessageFormat.format(message, count); logger.info(message); } }</code><technical_language>Synchronisation avoided in this method computeIfAbsent AtomicInteger, if is worth changing this point I performance impact full synchronisation is having</technical_language>

Target:
public void count(String type) { AtomicInteger count = this.counts.computeIfAbsent(type, k -> new AtomicInteger(0)); int c = count.incrementAndGet(); if (COUNT_PROGRESS.contains(type) && c % PROGRESS_INTERVAL == 0) { String message = this.resources.getString(type); message = MessageFormat.format(message, c); logger.info(message); } }
Source:
<code>private void updateRequiresAndRefines(Comparison comparison) { Iterator<Diff> multiplicityChanges = Iterators.filter(comparison.getDifferences().iterator(), IS_MULTIPLICITY_CHANGE); while (multiplicityChanges.hasNext()) { MultiplicityElementChange refChange = (MultiplicityElementChange)multiplicityChanges.next(); for (Diff refines : refChange.getRefinedBy()) { ArrayList<Diff> refinedChangesToUpdate = new ArrayList<Diff>(); for (Diff refined : refines.getRefines()) { if (refined != refChange) { refinedChangesToUpdate.add(refined); } } for (Diff refined : refinedChangesToUpdate) { refined.getRefinedBy().remove(refines); refined.getRefinedBy().add(refChange); <START> if (refined.getRequires().contains(refChange)) { <END> refined.getRequires().remove(refChange); } } } } }</code><technical_language>I this test is relevant method remove(object) do if object is present in list</technical_language>

Target:
private void updateRequiresAndRefines(Comparison comparison) { Iterator<Diff> multiplicityChanges = Iterators.filter(comparison.getDifferences().iterator(), IS_MULTIPLICITY_CHANGE); while (multiplicityChanges.hasNext()) { MultiplicityElementChange refChange = (MultiplicityElementChange)multiplicityChanges.next(); for (Diff refines : refChange.getRefinedBy()) { ArrayList<Diff> refinedChangesToUpdate = new ArrayList<Diff>(); for (Diff refined : refines.getRefines()) { if (refined != refChange) { refinedChangesToUpdate.add(refined); } } for (Diff refined : refinedChangesToUpdate) { refined.getRefinedBy().remove(refines); refined.getRefinedBy().add(refChange); refined.getRequires().remove(refChange); } } } }
Source:
<code>public NullSafeFieldAccessExpr setName(final SimpleName name) { assertNotNull(name); if (name == this.name) { return (NullSafeFieldAccessExpr) this; } notifyPropertyChange(ObservableProperty.NAME, this.name, name); <START> if (this.name != null) <END> this.name.setParentNode(null); this.name = name; setAsParentNodeOf(name); return this; }</code><technical_language>Please add curly bracers here. please check other places, I more other places. IDEA formatting highlights for that</technical_language>

Target:
public NullSafeFieldAccessExpr setName(final SimpleName name) { assertNotNull(name); if (name == this.name) { return (NullSafeFieldAccessExpr) this; } notifyPropertyChange(ObservableProperty.NAME, this.name, name); if (this.name != null) { this.name.setParentNode(null); } this.name = name; setAsParentNodeOf(name); return this; }
Source:
<code>public ManagedChannel shutdownNow() { Counter counter = getActiveChannelCounter(); for (ChannelAndMetrics channelWrapper : channels.get()) { ManagedChannel channel = channelWrapper.channel; if (!channel.isTerminated()) { channel.shutdownNow(); <START> counter.dec(); <END> } } return this; }</code><technical_language>getActiveChannelCounter().dec()</technical_language>

Target:
public ManagedChannel shutdownNow() { for (InstrumentedChannel channel : channels.get()) { if (!channel.isTerminated()) { channel.shutdownNow(); } } return this; }
Source:
<code>protected Message<?> doPollForMessage(String groupIdKey) { <START> List<Message<?>> messages = jdbcTemplate.query(getQuery(Query.POLL_FROM_GROUP), new Object[] { groupIdKey, region, groupIdKey }, mapper); <END> Assert.isTrue(messages.size() == 0 || messages.size() == 1); if (messages.size() > 0){ return messages.get(0); } return null; }</code><technical_language>NamedParameterJdbcTemplate done in JdbcChannelMessageStore#doPollForMessage</technical_language>

Target:
protected Message<?> doPollForMessage(String groupIdKey) { List<Message<?>> messages = jdbcTemplate.query(getQuery(Query.POLL_FROM_GROUP), new Object[] { groupIdKey, region, groupIdKey, region }, mapper); Assert.isTrue(messages.size() == 0 || messages.size() == 1); if (messages.size() > 0){ return messages.get(0); } return null; }
Source:
<code>private void unblockControls() { <START> mControlBlocked = ControlBlock.NONE; <END> mCardFrame.setEnabled(true); mFlipCardLayout.setEnabled(true); switch (mCurrentEase) { case EASE_1: mEase1Layout.setClickable(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; case EASE_2: mEase1Layout.setEnabled(true); mEase2Layout.setClickable(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; case EASE_3: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setClickable(true); mEase4Layout.setEnabled(true); break; case EASE_4: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setClickable(true); break; default: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; } if (mPrefWhiteboard && mWhiteboard != null) { mWhiteboard.setEnabled(true); } if (typeAnswer()) { mAnswerField.setEnabled(true); } mTouchLayer.setVisibility(View.VISIBLE); mInAnswer = false; invalidateOptionsMenu(); }</code><technical_language>nit: UNBLOCKED read</technical_language>

Target:
private void unblockControls() { mControlBlocked = ControlBlock.UNBLOCKED; mCardFrame.setEnabled(true); mFlipCardLayout.setEnabled(true); switch (mCurrentEase) { case EASE_1: mEase1Layout.setClickable(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; case EASE_2: mEase1Layout.setEnabled(true); mEase2Layout.setClickable(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; case EASE_3: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setClickable(true); mEase4Layout.setEnabled(true); break; case EASE_4: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setClickable(true); break; default: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; } if (mPrefWhiteboard && mWhiteboard != null) { mWhiteboard.setEnabled(true); } if (typeAnswer()) { mAnswerField.setEnabled(true); } mTouchLayer.setVisibility(View.VISIBLE); mInAnswer = false; invalidateOptionsMenu(); }
Source:
<code>private void reloadContent() { final List<EditedStyleItem> rawAttributes = ThemeEditorUtils.resolveAllAttributes(mySelectedStyle); myAttributes.clear(); myLabels = AttributesSorter.generateLabels(rawAttributes, myAttributes); <START> fireTableDataChanged(); <END> }</code><technical_language>fireTableStructureChanged() instead, spans in table, spans (will need listen TableModelEvent.HEADER_ROW event re-calc rows</technical_language>

Target:
private void reloadContent() { final List<EditedStyleItem> rawAttributes = ThemeEditorUtils.resolveAllAttributes(mySelectedStyle); myAttributes.clear(); myLabels = AttributesSorter.generateLabels(rawAttributes, myAttributes); fireTableStructureChanged(); }
Source:
<code>private void dealWithResponse(CollectCoordinationResponse<T> response, long responseOffset) { String responseVersion = response.getVersion(); long responseLastCheckpointedOffset = response.getLastCheckpointedOffset(); List<T> results; try { results = response.getResults(serializer); } catch (IOException e) { LOG.warn("An exception occurs when deserializing query results. Some results might be lost.", e); results = Collections.emptyList(); } if (responseLastCheckpointedOffset > lastCheckpointedOffset) { userTail += responseLastCheckpointedOffset - lastCheckpointedOffset; lastCheckpointedOffset = responseLastCheckpointedOffset; } <START> <END> if (!version.equals(responseVersion)) { for (long i = 0; i < offset - responseLastCheckpointedOffset; i++) { buffer.removeLast(); } version = responseVersion; offset = responseLastCheckpointedOffset; } if (!results.isEmpty()) { int addStart = (int) (offset - responseOffset); List<T> addedResults = results.subList(addStart, results.size()); buffer.addAll(addedResults); offset += addedResults.size(); } sanityCheck(); }</code><technical_language>I eat this exception, throw this out show is wrong</technical_language>

Target:
private void dealWithResponse(CollectCoordinationResponse<T> response, long responseOffset) throws IOException { String responseVersion = response.getVersion(); long responseLastCheckpointedOffset = response.getLastCheckpointedOffset(); List<T> results = response.getResults(serializer); if (!version.equals(responseVersion)) { for (long i = 0; i < offset - responseLastCheckpointedOffset; i++) { buffer.removeLast(); } version = responseVersion; offset = responseLastCheckpointedOffset; } if (responseLastCheckpointedOffset > userVisibleTail) { userVisibleTail = responseLastCheckpointedOffset; } if (!results.isEmpty()) { int addStart = (int) (offset - responseOffset); List<T> addedResults = results.subList(addStart, results.size()); buffer.addAll(addedResults); offset += addedResults.size(); } sanityCheck(); }
Source:
<code>public void testSubscriptionTrackingSettingSerialization() throws Exception { SubscriptionTrackingSetting setting = new SubscriptionTrackingSetting(); setting.setEnable(false); <START> String jsonTwo = mapper.writeValueAsString(setting); <END> System.out.println(jsonTwo); Assert.assertEquals(jsonTwo, "{\"enable\":false}"); }</code><technical_language>jsonOne. This is assuming numeral part of variable name is expected number of fields in serialized version. If case, elaborate naming convention</technical_language>

Target:
public void testSubscriptionTrackingSettingSerialization() throws Exception { SubscriptionTrackingSetting setting = new SubscriptionTrackingSetting(); setting.setEnable(false); String json = mapper.writeValueAsString(setting); System.out.println(json); Assert.assertEquals(json, "{\"enable\":false}"); }
Source:
<code>public ValueType typeCheck(TypeContext ctx) { List<DeclType> dts = new LinkedList<DeclType>(); TypeContext thisCtx = ctx.extend(selfName, getExprType()); ValueType type = getExprType(); if (hasDelegate) { ValueType delegateObjectType = ctx.lookup(delegateDeclaration.getFieldName()); for (Declaration d : decls_ExceptDelegate()) { DeclType dt = d.typeCheck(ctx, thisCtx); dts.add(dt); } StructuralType delegateStructuralType = delegateObjectType.getStructuralType(thisCtx); for (DeclType declType : delegateStructuralType.getDeclTypes()) { if (!dts.stream().anyMatch(newDefDeclType-> newDefDeclType.isSubtypeOf(declType, thisCtx))) { dts.add(declType); } } } else { for (Declaration d : decls) { DeclType dt = d.typeCheck(ctx, thisCtx); dts.add(dt); <START> } <END> } StructuralType requiredT = type.getStructuralType(ctx); StructuralType actualT = new StructuralType(selfName, dts); if (!actualT.isSubtypeOf(requiredT, ctx)) { throw new RuntimeException("typechecking error: not a subtype"); } return type; }</code><technical_language>This code is present in "if" "else" blocks, for "decls" vs. "decls_ExceptDelegate". pull out of "if" avoid code duplication, "decls_ExceptDelegate" in cases</technical_language>

Target:
public ValueType typeCheck(TypeContext ctx) { List<DeclType> dts = new LinkedList<DeclType>(); TypeContext thisCtx = ctx.extend(selfName, getExprType()); for (Declaration d : decls_ExceptDelegate()) { DeclType dt = d.typeCheck(ctx, thisCtx); dts.add(dt); } ValueType type = getExprType(); if (hasDelegate) { ValueType delegateObjectType = ctx.lookup(delegateDeclaration.getFieldName()); StructuralType delegateStructuralType = delegateObjectType.getStructuralType(thisCtx); for (DeclType declType : delegateStructuralType.getDeclTypes()) { if (!dts.stream().anyMatch(newDefDeclType-> newDefDeclType.isSubtypeOf(declType, thisCtx))) { dts.add(declType); } } } StructuralType requiredT = type.getStructuralType(ctx); StructuralType actualT = new StructuralType(selfName, dts); if (!actualT.isSubtypeOf(requiredT, ctx)) { throw new RuntimeException("typechecking error: not a subtype"); } return type; }
Source:
<code>public void updateSensorData(SensorJob sensorJob, String priority) { if (sensorJobExecutor == null) { sensorJobExecutor = new SensorJobExecutor(connMan); this.sensorJobExecutor.startExecutor(); } if (sensorJob != null && priority != null) { switch (priority) { case Config.REFRESH_PRIORITY_HIGH: sensorJobExecutor.addHighPriorityJob(sensorJob); break; case Config.REFRESH_PRIORITY_MEDIUM: sensorJobExecutor.addMediumPriorityJob(sensorJob); break; case Config.REFRESH_PRIORITY_LOW: sensorJobExecutor.addLowPriorityJob(sensorJob); break; default: try { long prio = Long.parseLong(priority); sensorJobExecutor.addPriorityJob(sensorJob, prio); } catch (NumberFormatException e) { <START> System.err.println("Sensor data update priority do not exist! Please check the input!"); <END> return; } } logger.debug("Add new sensorJob with priority: to sensorJobExecuter", sensorJob.toString(), priority); } }</code><technical_language>Please of a logger</technical_language>

Target:
public void updateSensorData(SensorJob sensorJob, String priority) { if (sensorJobExecutor == null) { sensorJobExecutor = new SensorJobExecutor(connMan); this.sensorJobExecutor.startExecutor(); } if (sensorJob != null && priority != null) { switch (priority) { case Config.REFRESH_PRIORITY_HIGH: sensorJobExecutor.addHighPriorityJob(sensorJob); break; case Config.REFRESH_PRIORITY_MEDIUM: sensorJobExecutor.addMediumPriorityJob(sensorJob); break; case Config.REFRESH_PRIORITY_LOW: sensorJobExecutor.addLowPriorityJob(sensorJob); break; default: try { long prio = Long.parseLong(priority); sensorJobExecutor.addPriorityJob(sensorJob, prio); } catch (NumberFormatException e) { logger.debug("Sensor data update priority do not exist! Please check the input!"); return; } } logger.debug("Add new sensorJob with priority: to sensorJobExecuter", sensorJob.toString(), priority); } }
Source:
<code>public Response getApplication(@PathParam("seaCloudsId") String seaCloudsId) throws IOException { if (seaCloudsId == null) { LOG.error("Missing input parameters"); return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } else { SeaCloudsApplicationData seaCloudsApplicationData = dataStore.getSeaCloudsApplicationDataById(seaCloudsId); if (seaCloudsApplicationData == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } for (JsonNode application : deployer.getApplicationsTree()) { if(application.get("id").getTextValue().equals(seaCloudsApplicationData.getDeployerApplicationId())){ <START> return Response.ok(application.toString()).build(); <END> } } return Response.status(Response.Status.BAD_REQUEST).build(); } }</code><technical_language>toString</technical_language>

Target:
public Response getApplication(@PathParam("seaCloudsId") String seaCloudsId) throws IOException { if (seaCloudsId == null) { LOG.error("Missing input parameters"); return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } else { SeaCloudsApplicationData seaCloudsApplicationData = dataStore.getSeaCloudsApplicationDataById(seaCloudsId); if (seaCloudsApplicationData == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } for (JsonNode application : deployer.getApplicationsTree()) { if(application.get("id").getTextValue().equals(seaCloudsApplicationData.getDeployerApplicationId())){ return Response.ok(application).build(); } } return Response.status(Response.Status.BAD_REQUEST).build(); } }
Source:
<code>public void checkAccountExists(final String email) { if (!TextUtils.isEmpty(email)) { mActivityHelper.getFirebaseAuth() .fetchProvidersForEmail(email) .addOnFailureListener( new TaskFailureLogger(TAG, "Error fetching providers for email")) .addOnCompleteListener( new OnCompleteListener<ProviderQueryResult>() { @Override public void onComplete(@NonNull Task<ProviderQueryResult> task) { <START> if (task.isSuccessful()) { <END> List<String> providers = task.getResult().getProviders(); if (providers != null && !providers.isEmpty()) { String provider = providers.get(0); if (provider.equalsIgnoreCase(EmailAuthProvider.PROVIDER_ID)) { Intent signInIntent = SignInActivity.createIntent( RegisterEmailActivity.this, mActivityHelper.getFlowParams(), email); mActivityHelper.startActivityForResult(signInIntent, RC_SIGN_IN); } else { Intent intent = WelcomeBackIdpPrompt.createIntent( RegisterEmailActivity.this, mActivityHelper.getFlowParams(), provider, null, email); mActivityHelper.startActivityForResult(intent, RC_WELCOME_BACK_IDP); } } } mActivityHelper.dismissDialog(); } }); } }</code><technical_language>nit: separate success failure listeners checking task.isSuccessful()</technical_language>

Target:
public void checkAccountExists(final String email) { if (!TextUtils.isEmpty(email)) { mActivityHelper.getFirebaseAuth() .fetchProvidersForEmail(email) .addOnFailureListener( new TaskFailureLogger(TAG, "Error fetching providers for email")) .addOnCompleteListener(this, new OnCompleteListener<ProviderQueryResult>() { @Override public void onComplete(@NonNull Task<ProviderQueryResult> task) { mActivityHelper.dismissDialog(); } }) .addOnSuccessListener(new OnSuccessListener<ProviderQueryResult>() { @Override public void onSuccess(ProviderQueryResult result) { List<String> providers = result.getProviders(); if (providers != null && !providers.isEmpty()) { String provider = providers.get(0); if (provider.equalsIgnoreCase(EmailAuthProvider.PROVIDER_ID)) { Intent signInIntent = SignInActivity.createIntent( RegisterEmailActivity.this, mActivityHelper.getFlowParams(), email); mActivityHelper.startActivityForResult(signInIntent, RC_SIGN_IN); } else { Intent intent = WelcomeBackIdpPrompt.createIntent( RegisterEmailActivity.this, mActivityHelper.getFlowParams(), provider, null, email); mActivityHelper.startActivityForResult(intent, RC_WELCOME_BACK_IDP); } } } }); } }
Source:
<code>public void testConnectionServiceFocusGainedWithSameConnectionService() throws Exception { if (!mShouldTestTelecom) { return; } placeAndVerifyCall(); <START> verifyConnectionForOutgoingCall().setActive(); assertTrue(connectionService.waitForEvent( MockConnectionService.EVENT_CONNECTION_SERVICE_FOCUS_GAINED)); Thread.sleep(500); END> placeAndVerifyCall(); verifyConnectionForOutgoingCall(); assertFalse(connectionService.waitForEvent( MockConnectionService.EVENT_CONNECTION_SERVICE_FOCUS_GAINED)); assertFalse(connectionService.waitForEvent( MockConnectionService.EVENT_CONNECTION_SERVICE_FOCUS_LOST)); }</code><technical_language>Please Thread.sleep(). bane of CTS bugs. Instead, try this replace highlighted code: Connection outgoing = verifyConnectionForOutgoingCall(); outgoing.setActive(); assertTrue(connectionService.waitForEvent(mockConnectionService.EVENT_CONNECTION_SERVICE_FOCUS_GAINED)); assertConnectionState(outgoing, Connection.STATE_ACTIVE);</technical_language>

Target:
public void testConnectionServiceFocusGainedWithSameConnectionService() { if (!mShouldTestTelecom) { return; } placeAndVerifyCall(); Connection outgoing = verifyConnectionForOutgoingCall(); outgoing.setActive(); assertTrue(connectionService.waitForEvent( MockConnectionService.EVENT_CONNECTION_SERVICE_FOCUS_GAINED)); assertCallState(mInCallCallbacks.getService().getLastCall(), Call.STATE_ACTIVE); placeAndVerifyCall(); verifyConnectionForOutgoingCall(); assertFalse(connectionService.waitForEvent( MockConnectionService.EVENT_CONNECTION_SERVICE_FOCUS_GAINED)); assertFalse(connectionService.waitForEvent( MockConnectionService.EVENT_CONNECTION_SERVICE_FOCUS_LOST)); }
Source:
<code>public Intent getIntent(GraphData data) throws InvalidStateException { render(data); <START> setPanAndZoom(Boolean.valueOf(mData.getConfiguration("zoom", "false")).equals(Boolean.TRUE)); <END> String title = mRenderer.getChartTitle(); if (Graph.TYPE_BUBBLE.equals(mData.getType())) { return ChartFactory.getBubbleChartIntent(mContext, mDataset, mRenderer, title); } if (Graph.TYPE_TIME.equals(mData.getType())) { return ChartFactory.getTimeChartIntent(mContext, mDataset, mRenderer, title, getTimeFormat()); } if (Graph.TYPE_BAR.equals(mData.getType())) { return ChartFactory.getBarChartIntent(mContext, mDataset, mRenderer, BarChart.Type.DEFAULT, title); } return ChartFactory.getLineChartIntent(mContext, mDataset, mRenderer, title); }</code><technical_language>able remove .equals(Boolean.TRUE) part, right</technical_language>

Target:
public Intent getIntent(GraphData data) throws InvalidStateException { render(data); setPanAndZoom(Boolean.valueOf(mData.getConfiguration("zoom", "false"))); String title = mRenderer.getChartTitle(); if (Graph.TYPE_BUBBLE.equals(mData.getType())) { return ChartFactory.getBubbleChartIntent(mContext, mDataset, mRenderer, title); } if (Graph.TYPE_TIME.equals(mData.getType())) { return ChartFactory.getTimeChartIntent(mContext, mDataset, mRenderer, title, getTimeFormat()); } if (Graph.TYPE_BAR.equals(mData.getType())) { return ChartFactory.getBarChartIntent(mContext, mDataset, mRenderer, BarChart.Type.DEFAULT, title); } return ChartFactory.getLineChartIntent(mContext, mDataset, mRenderer, title); }
Source:
<code>public IOStructGen(CommonTree tree, CTFTrace trace) { <START> this.fTrace = trace; <END> this.fTree = tree; }</code><technical_language>Remove this</technical_language>

Target:
public IOStructGen(CommonTree tree, CTFTrace trace) { fTrace = trace; fTree = tree; }
Source:
<code>protected void deliverInternal(VoltMessage message) { assert(lockingVows()); logRxMessage(message); boolean canDeliver = m_scheduler.sequenceForReplay(message); if (message instanceof DumpMessage) { hostLog.warn("Received DumpMessage at " + CoreUtils.hsIdToString(m_hsId)); try { m_scheduler.dump(); } catch (Throwable ignore) { hostLog.warn("Failed to dump the content of the scheduler", ignore); } } if (message instanceof Iv2RepairLogRequestMessage) { handleLogRequest(message); return; } <START> if (message instanceof Iv2RepairLogResponseMessage) { <END> m_algo.deliver(message); return; } if (message instanceof RejoinMessage) { m_joinProducer.deliver((RejoinMessage) message); return; } m_repairLog.deliver(message); if (canDeliver) { m_scheduler.deliver(message); } }</code><technical_language>Please put elses in explicit. messages inheritance a future bug hit branches</technical_language>

Target:
protected void deliverInternal(VoltMessage message) { assert(lockingVows()); logRxMessage(message); boolean canDeliver = m_scheduler.sequenceForReplay(message); if (message instanceof DumpMessage) { hostLog.warn("Received DumpMessage at " + CoreUtils.hsIdToString(m_hsId)); try { m_scheduler.dump(); } catch (Throwable ignore) { hostLog.warn("Failed to dump the content of the scheduler", ignore); } } if (message instanceof Iv2RepairLogRequestMessage) { handleLogRequest(message); return; } else if (message instanceof Iv2RepairLogResponseMessage) { m_algo.deliver(message); return; } else if (message instanceof RejoinMessage) { m_joinProducer.deliver((RejoinMessage) message); return; } else if (message instanceof RepairLogTruncationMessage) { m_repairLog.deliver(message); return; } m_repairLog.deliver(message); if (canDeliver) { m_scheduler.deliver(message); } }
Source:
<code>public Boolean evaluate(EObject source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException { if (source.eResource() != null) { <START> ECrossReferenceAdapter adapter = CrossReferenceAdapter.getCrossReferenceAdapter(source.eResource().getResourceSet()); <END> for (Setting setting : adapter.getNonNavigableInverseReferences(source)) { EObject notationElement = setting.getEObject(); if (notationElement instanceof Table) { Table table = (Table) notationElement; EObject parent = table.getOwner() == null ? table.getContext() : table.getOwner(); if (parent == source) { return true; } } } } return false; }</code><technical_language>EMFHelper.getUsages(EObject) here, too</technical_language>

Target:
public Boolean evaluate(EObject source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException { Collection<Setting> settings = EMFHelper.getUsages(source); if (settings != null) { for (Setting setting : settings) { EObject usingElement = setting.getEObject(); if (usingElement instanceof Table) { Table table = (Table) usingElement; EObject parent = table.getOwner() == null ? table.getContext() : table.getOwner(); if (parent == source) { return true; } } } } return false; }
Source:
<code>public void start() { <START> Frontend.getInstance().runAction(ActionType.TransferDiskImage, <END> createInitParams(this.diskImage), result -> { if (result.getReturnValue().getSucceeded()) { Guid transferId = result.getReturnValue().getActionReturnValue(); Frontend.getInstance().runQuery(QueryType.GetImageTransferById, new IdQueryParameters(transferId), new AsyncQuery<QueryReturnValue>(returnValue -> { ImageTransfer imageTransfer = returnValue.getReturnValue(); initiateDownload(imageTransfer); })); } }, this); }</code><technical_language>need for this call, done in DownloadImageManager</technical_language>

Target:
public void start() { Frontend.getInstance().runAction(ActionType.TransferDiskImage, null, result -> { if (result.getReturnValue().getSucceeded()) { Frontend.getInstance().runQuery(QueryType.GetImageTransferById, new IdQueryParameters(this.diskImageId), new AsyncQuery<QueryReturnValue>(returnValue -> { ImageTransfer imageTransfer = returnValue.getReturnValue(); initiateDownload(imageTransfer); })); } }, this); }
Source:
<code>private static String getSpecifiedName( StructuralNode sn, boolean incParams, boolean dataDrivenNodesAsRegex) { String name = sn.getName(); if (sn.isDataDriven() && dataDrivenNodesAsRegex) { return DATA_DRIVEN_NODE_REGEX; } int bracketIndex = name.lastIndexOf("("); if (bracketIndex >= 0) { name = name.substring(0, bracketIndex); } <START> int questIndex = name.indexOf("?"); <END> if (questIndex >= 0) { if (incParams) { String params = name.substring(questIndex); name = name.substring(0, questIndex) + regexEscape(params); } else { name = name.substring(0, questIndex); } } if (name.endsWith("/")) { name = name.substring(0, name.length() - 1); } try { if (sn.getURI().getPath() == null || sn.getURI().getPath().length() == 1) { return name; } } catch (URIException e) { } int slashIndex = name.lastIndexOf('/'); if (slashIndex >= 0) { name = name.substring(slashIndex + 1); } if (sn.isLeaf()) { int colonIndex = name.indexOf(":"); if (colonIndex > 0) { name = name.substring(colonIndex + 1); } } return name; }</code><technical_language>queryIndex</technical_language>

Target:
private static String getSpecifiedName( StructuralNode sn, boolean incParams, boolean dataDrivenNodesAsRegex) { String name = sn.getName(); if (sn.isDataDriven() && dataDrivenNodesAsRegex) { return DATA_DRIVEN_NODE_REGEX; } int bracketIndex = name.lastIndexOf("("); if (bracketIndex >= 0) { name = name.substring(0, bracketIndex); } int queryIndex = name.indexOf("?"); if (queryIndex >= 0) { if (incParams) { String params = name.substring(queryIndex); name = name.substring(0, queryIndex) + regexEscape(params); } else { name = name.substring(0, queryIndex); } } if (name.endsWith("/")) { name = name.substring(0, name.length() - 1); } try { if (sn.getURI().getPath() == null || sn.getURI().getPath().length() == 1) { return name; } } catch (URIException e) { } int slashIndex = name.lastIndexOf('/'); if (slashIndex >= 0) { name = name.substring(slashIndex + 1); } if (sn.isLeaf()) { int colonIndex = name.indexOf(":"); if (colonIndex > 0) { name = name.substring(colonIndex + 1); } } return name; }
Source:
<code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sample); ButterKnife.inject(this); Dart.inject(this); stringText.setText(stringExtra); intText.setText(String.valueOf(intExtra)); parcelableText.setText(String.valueOf(parcelableExtra)); optionalText.setText(String.valueOf(optionalExtra)); <START> parcelNameText.setText(String.valueOf(parcelExtra.getName())); <END> parcelAgeText.setText(String.valueOf(parcelExtra.getAge())); }</code><technical_language>TextView for parcelExtra other samples? parcelText.setText(String.valueOf(parcelExtra));</technical_language>

Target:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sample); ButterKnife.inject(this); Dart.inject(this); stringText.setText(stringExtra); intText.setText(String.valueOf(intExtra)); parcelableText.setText(String.valueOf(parcelableExtra)); optionalText.setText(String.valueOf(optionalExtra)); parcelText.setText(String.valueOf(parcelExtra.getName())); }
Source:
<code>public void start() { if (mSignificantMotionSensor == null) { if (mLegacyMotionSensor != null) { mLegacyMotionSensor.start(); } return; } mStopSignificantMotionSensor = false; if (Build.VERSION.SDK_INT >= 18) { final TriggerEventListener tr = new TriggerEventListener() { @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) @Override public void onTrigger(TriggerEvent event) { if (mStopSignificantMotionSensor) { return; } AppGlobals.guiLogInfo("Major motion detected."); <START> LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(mAppContext); <END> if (broadcastManager == null) { return; } broadcastManager.sendBroadcastSync(new Intent(ACTION_USER_MOTION_DETECTED)); mSensorManager.requestTriggerSensor(this, mSignificantMotionSensor); } }; mSensorManager.requestTriggerSensor(tr, mSignificantMotionSensor); } }</code><technical_language>I want mAppContext null checked</technical_language>

Target:
public void start() { if (mSignificantMotionSensor == null) { if (mLegacyMotionSensor != null) { mLegacyMotionSensor.start(); } return; } mStopSignificantMotionSensor = false; if (Build.VERSION.SDK_INT >= 18) { final TriggerEventListener tr = new TriggerEventListener() { @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) @Override public void onTrigger(TriggerEvent event) { if (mStopSignificantMotionSensor) { return; } AppGlobals.guiLogInfo("Major motion detected."); LocalBroadcastManager.getInstance(mContext).sendBroadcastSync(new Intent(ACTION_USER_MOTION_DETECTED)); mSensorManager.requestTriggerSensor(this, mSignificantMotionSensor); } }; mSensorManager.requestTriggerSensor(tr, mSignificantMotionSensor); } }
Source:
<code>public ResponseEntity<?> handleFormPost(HttpServletRequest request, String layer, String body) throws RestException, GeoWebCacheException { final TileLayer tl; { String layerName = layer; if (layer != null) { try { tl = seeder.findTileLayer(layerName); } catch (GeoWebCacheException e) { throw new RestException(e.getMessage(), HttpStatus.BAD_REQUEST); } } else { tl = null; } } try { body = URLDecoder.decode(body, "UTF-8"); } catch (IOException e) { body = null; } if (body == null || body == "") { throw new RestException("Unable to parse form result.", HttpStatus.BAD_REQUEST); } Map<String, String> params = splitToMap(body); if (params.containsKey("list")) { if (tl == null) { throw new RestException("No layer specified", HttpStatus.BAD_REQUEST); } boolean listAllTasks = "all".equals(params.get("list")); return handleDoGet(tl, listAllTasks); } else if (params.containsKey("kill_thread")) { return handleKillThreadPost(params, tl); } else if (params.containsKey("kill_all")) { return handleKillAllThreadsPost(params, tl); } else if (params.get("minX") != null) { if (tl == null) { throw new RestException("No layer specified", HttpStatus.BAD_REQUEST); } return handleDoSeedPost(params, tl); <START> } else { <END> throw new RestException( "Unknown or malformed request. Please try again, somtimes the form " + "is not properly received. This frequently happens on the first POST " + "after a restart. The POST was to " + request.getRequestURI(), HttpStatus.BAD_REQUEST); } }</code><technical_language>Technically, else is unnecessary. clearer remove exception top level</technical_language>

Target:
public ResponseEntity<?> handleFormPost(HttpServletRequest request, String layer, String body) throws RestException, GeoWebCacheException { final TileLayer tl; { String layerName = layer; if (layer != null) { try { tl = seeder.findTileLayer(layerName); } catch (GeoWebCacheException e) { throw new RestException(e.getMessage(), HttpStatus.BAD_REQUEST); } } else { tl = null; } } try { body = URLDecoder.decode(body, "UTF-8"); } catch (IOException e) { body = null; } if (body == null || body == "") { throw new RestException("Unable to parse form result.", HttpStatus.BAD_REQUEST); } Map<String, String> params = splitToMap(body); if (params.containsKey("list")) { if (tl == null) { throw new RestException("No layer specified", HttpStatus.BAD_REQUEST); } boolean listAllTasks = "all".equals(params.get("list")); return handleDoGet(tl, listAllTasks); } else if (params.containsKey("kill_thread")) { return handleKillThreadPost(params, tl); } else if (params.containsKey("kill_all")) { return handleKillAllThreadsPost(params, tl); } else if (params.get("minX") != null) { if (tl == null) { throw new RestException("No layer specified", HttpStatus.BAD_REQUEST); } return handleDoSeedPost(params, tl); } return new ResponseEntity<Object>(HttpStatus.BAD_REQUEST); }
Source:
<code>public InputStream fetchMediaFile(String mediaFileURL) throws FormSourceException { InputStream mediaFile = mapException(() -> openRosaXMLFetcher.getFile(mediaFileURL, null)); <START> if (mediaFile != null) { <END> return mediaFile; } else { throw new FormSourceException(FETCH_ERROR); } }</code><technical_language>check this in mapException throw new FormSourceException(FETCH_ERROR) there? in place</technical_language>

Target:
public InputStream fetchMediaFile(String mediaFileURL) throws FormSourceException { return mapException(() -> openRosaXMLFetcher.getFile(mediaFileURL, null)); }
Source:
<code>private void loadValidUrl() { if (mWebView != null) { if (PreferencesState.getCredentialsFromPreferences().isDemoCredentials()) { showHideWebView(false); mErrorDemoText.setText( <START> translate(R.string.demo_page_text)); <END> ; } else { showHideWebView(true); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); clearCookies(getActivity()); mWebView.loadUrl(url); mWebView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); loadedFirstTime = true; } }); } } }</code><technical_language>translateText</technical_language>

Target:
private void loadValidUrl() { if (mWebView != null) { if (PreferencesState.getCredentialsFromPreferences().isDemoCredentials()) { showHideWebView(false); mErrorDemoText.setTextTranslation(R.string.demo_page_text); ; } else { showHideWebView(true); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); clearCookies(getActivity()); mWebView.loadUrl(url); mWebView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); loadedFirstTime = true; } }); } } }
Source:
<code>private static void perform(Context c, Measurement m) throws IOException { FileInputStream is = new FileInputStream(Measurement.getEntryFile(c, m.id, m.test_name)); <START> String input = new GsonBuilder().disableHtmlEscaping().create().toJson(new JsonParser().parse(new InputStreamReader(is))); <END> is.close(); MKCollectorResubmitSettings settings = new MKCollectorResubmitSettings(); settings.setTimeout(14); settings.setCABundlePath(c.getCacheDir() + "/" + Application.CA_BUNDLE); settings.setSerializedMeasurement(input); MKCollectorResubmitResults results = settings.perform(); if (results.isGood()) { String output = results.getUpdatedSerializedMeasurement(); FileOutputStream os = new FileOutputStream(Measurement.getEntryFile(c, m.id, m.test_name)); os.write(output.getBytes()); os.close(); m.report_id = results.getUpdatedReportID(); m.is_uploaded = true; m.is_upload_failed = false; m.save(); } else { Log.w(MKCollectorResubmitSettings.class.getSimpleName(), results.getLogs()); } }</code><technical_language>do parse serialise file context</technical_language>

Target:
private static void perform(Context c, Measurement m) throws IOException { File file = Measurement.getEntryFile(c, m.id, m.test_name); String input = FileUtils.readFileToString(file, StandardCharsets.UTF_8); MKCollectorResubmitSettings settings = new MKCollectorResubmitSettings(); settings.setTimeout(14); settings.setCABundlePath(c.getCacheDir() + "/" + Application.CA_BUNDLE); settings.setSerializedMeasurement(input); MKCollectorResubmitResults results = settings.perform(); if (results.isGood()) { String output = results.getUpdatedSerializedMeasurement(); FileUtils.writeStringToFile(file, output, StandardCharsets.UTF_8); m.report_id = results.getUpdatedReportID(); m.is_uploaded = true; m.is_upload_failed = false; m.save(); } else { Log.w(MKCollectorResubmitSettings.class.getSimpleName(), results.getLogs()); } }
Source:
<code>private static void writeSeparatorLine(StringBuilder buf, int[] colLengths) { for (int colIdx = 0; colIdx < colLengths.length; colIdx++) { buf.append('+'); for (int i = 0; i < colLengths[colIdx] + 2; i++) { buf.append('-'); } } <START> buf.append("+\n"); <END> }</code><technical_language>System.lineSeparator() for benefit of non-Unix-like consoles</technical_language>

Target:
private static void writeSeparatorLine(StringBuilder buf, int[] colLengths) { for (int colIdx = 0; colIdx < colLengths.length; colIdx++) { buf.append('+'); for (int i = 0; i < colLengths[colIdx] + 2; i++) { buf.append('-'); } } buf.append('+').append(LINE_SEPARATOR); }
Source:
<code>public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain ) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest) req; String requestId = Optional.ofNullable( request.getHeader( ActionUtil.X_REQUEST_ID ) ).orElse( <START> WorkItemLifecycleEvent.generateWorkItemId() ); <END> try { if ( logger.isDebugEnabled() ) { logger.debug( "received request with request id of: " + requestId ); } MDC.put( ActionUtil.REQUEST_ID, requestId ); chain.doFilter( req, resp ); } finally { if ( logger.isDebugEnabled() ) { logger.debug( "Exiting request with request id of: " + requestId ); } ( (HttpServletResponse) resp ).setHeader( ActionUtil.X_REQUEST_ID, requestId ); MDC.remove( ActionUtil.X_REQUEST_ID ); } }</code><technical_language>WorkItemLifecycleEvent belong here. This class agnostic WorkItems</technical_language>

Target:
public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain ) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest) req; String requestId = Optional.ofNullable( request.getHeader( RequestIdUtil.X_REQUEST_ID ) ).orElse( UUID.randomUUID().toString() ); try { if ( logger.isDebugEnabled() ) { logger.debug( "received request with request id of: " + requestId ); } MDC.put( RequestIdUtil.REQUEST_ID, RequestIdUtil.getFormattedRequestUid( requestId ) ); chain.doFilter( req, resp ); } finally { if ( logger.isDebugEnabled() ) { logger.debug( "Exiting request with request id of: " + requestId ); } ( (HttpServletResponse) resp ).setHeader( RequestIdUtil.X_REQUEST_ID, requestId ); MDC.remove( RequestIdUtil.X_REQUEST_ID ); } }
Source:
<code>public void populateDAG(DAG dag, Configuration conf) { HDFSFileSplitter fileSplitter = dag.addOperator("FileSplitter", new HDFSFileSplitter()); BlockReader blockReader = dag.addOperator("BlockReader", new BlockReader()); dag.addStream("BlockMetadata", fileSplitter.blocksMetadataOutput, blockReader.blocksMetadataInput); filesMetadataOutput.set(fileSplitter.filesMetadataOutput); blocksMetadataOutput.set(blockReader.blocksMetadataOutput); messages.set(blockReader.messages); fileSplitter.setSequencialFileRead(sequencialFileRead); if (blockSize != 0) { fileSplitter.setBlockSize(blockSize); } HDFSScanner fileScanner = (HDFSScanner)fileSplitter.getScanner(); fileScanner.setFiles(files); if (scanIntervalMillis != 0) { fileScanner.setScanIntervalMillis(scanIntervalMillis); } fileScanner.setRecursive(recursive); if (filePatternRegularExp != null) { fileSplitter.getScanner().setFilePatternRegularExp(filePatternRegularExp); } blockReader.setUri(files); if (readersCount != 0) { dag.setAttribute(blockReader, Context.OperatorContext.PARTITIONER, new StatelessPartitioner<BlockReader>(readersCount)); } MetricsAggregator blockReaderMetrics = new MetricsAggregator(); blockReaderMetrics.addAggregators("bytesReadPerSec", new SingleMetricAggregator[] {new LongSumAggregator()}); dag.setAttribute(blockReader, Context.OperatorContext.METRICS_AGGREGATOR, blockReaderMetrics); <START> dag.setAttribute(blockReader, Context.OperatorContext.COUNTERS_AGGREGATOR, new BasicCounters.LongAggregator<MutableLong>()); <END> }</code><technical_language>METRICS_AGGREGATOR here? COUNTERS_AGGREGATOR is marked deprecated</technical_language>

Target:
public void populateDAG(DAG dag, Configuration conf) { HDFSFileSplitter fileSplitter = dag.addOperator("FileSplitter", new HDFSFileSplitter()); BlockReader blockReader = dag.addOperator("BlockReader", new BlockReader()); dag.addStream("BlockMetadata", fileSplitter.blocksMetadataOutput, blockReader.blocksMetadataInput); filesMetadataOutput.set(fileSplitter.filesMetadataOutput); blocksMetadataOutput.set(blockReader.blocksMetadataOutput); messages.set(blockReader.messages); fileSplitter.setSequencialFileRead(sequencialFileRead); if (blockSize != 0) { fileSplitter.setBlockSize(blockSize); } HDFSScanner fileScanner = (HDFSScanner)fileSplitter.getScanner(); fileScanner.setFiles(files); if (scanIntervalMillis != 0) { fileScanner.setScanIntervalMillis(scanIntervalMillis); } fileScanner.setRecursive(recursive); if (filePatternRegularExp != null) { fileSplitter.getScanner().setFilePatternRegularExp(filePatternRegularExp); } blockReader.setUri(files); if (readersCount != 0) { dag.setAttribute(blockReader, Context.OperatorContext.PARTITIONER, new StatelessPartitioner<BlockReader>(readersCount)); } }
Source:
<code>private void addUnresolvedVMArgs (List<String> lines) { int startIndex = lines.indexOf(VMARG_ADD_OPENS); if (startIndex != -1) { for (int i = startIndex; i < lines.size(); i++) { <START> if (lines.get(i).contains("ALL-UNNAMED") && !lines.get(i-1).contains("--add-opens")) { <END> lines.add(i, VMARG_ADD_OPENS); } } } }</code><technical_language>Please, VMARG_ADD_OPENS constant create constant for "ALL-UNNAMED"</technical_language>

Target:
private void addUnresolvedVMArgs(List<String> lines) { int startIndex = lines.indexOf(VMARG_ADD_OPENS); if (startIndex != -1) { for (int i = startIndex; i < lines.size(); i++) { if (lines.get(i).contains(VMARG_ALL_UNNAMED) && !lines.get(i-1).startsWith(VMARG_ADD_OPENS)) { lines.add(i, VMARG_ADD_OPENS); } } } }
Source:
<code>public LoginAttemptResultReporter checkIsLockedOut(long userId) { UnsuccessfulLoginLockoutDTO lockoutInfo = unsuccessfulLoginLockoutDAO.getUnsuccessfulLoginLockoutInfoIfExist(userId) <START> .orElseGet(() -> new UnsuccessfulLoginLockoutDTO(userId)); <END> final long databaseTime = unsuccessfulLoginLockoutDAO.getDatabaseTimestampMillis(); if (databaseTime < lockoutInfo.getLockoutExpiration()){ throw new UnsuccessfulLoginLockoutException( databaseTime, lockoutInfo.getLockoutExpiration(), lockoutInfo.getUnsuccessfulLoginCount()); } return new ExponentialBackoffLoginAttemptReporter(lockoutInfo, unsuccessfulLoginLockoutDAO); }</code><technical_language>Optional foo = unsuccessfulLoginLockoutDAO.getUnsuccessfulLoginLockoutInfoIfExist(userId); if (foo.isPresent()) { lockoutinfo = foo.get(); } else { lockoutinfo = new UnsuccessfulLoginLockoutDTO(userId); }</technical_language>

Target:
public LoginAttemptResultReporter checkIsLockedOut(long userId) { Optional<UnsuccessfulLoginLockoutDTO> dtoOptional = unsuccessfulLoginLockoutDAO.getUnsuccessfulLoginLockoutInfoIfExist(userId); UnsuccessfulLoginLockoutDTO lockoutInfo; if (dtoOptional.isPresent()) { lockoutInfo = dtoOptional.get(); } else { lockoutInfo = new UnsuccessfulLoginLockoutDTO(userId); } final long databaseTime = unsuccessfulLoginLockoutDAO.getDatabaseTimestampMillis(); if (databaseTime < lockoutInfo.getLockoutExpiration()){ throw new UnsuccessfulLoginLockoutException( databaseTime, lockoutInfo.getLockoutExpiration(), lockoutInfo.getUnsuccessfulLoginCount()); } return new ExponentialBackoffLoginAttemptReporter(lockoutInfo, unsuccessfulLoginLockoutDAO); }