auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private ITmfTimeZoomProvider getTimeZoomProvider() { return (zoomIn, selection) -> { TimeGraphControl control = getTimeGraphControl(); TimeGraphViewer viewer = getTimeGraphViewer(); if (control != null && viewer != null) { if (selection) { int xCoord = control.toControl(control.getDisplay().getCursorLocation()).x; if ((viewer.getNameSpace() <START> < xCoord) <END> && (xCoord < control.getSize().x)) { if (zoomIn) { control.zoomIn(); } else { control.zoomOut(); } } } else { control.zoom(zoomIn); } } }; }</code><technical_language>I <= ? If name space 0 want x=0 OK</technical_language>

Target:
private ITmfTimeZoomProvider getTimeZoomProvider() { return (zoomIn, useMousePosition) -> { TimeGraphControl control = getTimeGraphControl(); TimeGraphViewer viewer = getTimeGraphViewer(); if (control != null && viewer != null) { if (useMousePosition) { control.zoom(zoomIn); } else { int xCoord = control.toControl(control.getDisplay().getCursorLocation()).x; if ((viewer.getNameSpace() <= xCoord) && (xCoord < control.getSize().x)) { if (zoomIn) { control.zoomIn(); } else { control.zoomOut(); } } } } }; }
Source:
<code>private void handleIntent(Intent intent) { mIsPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); boolean bPageHasChanged = false; if (intent.hasExtra(EXTRA_VIEW_PAGES)) { boolean isPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); bPageHasChanged = isPage != mIsPage; } mIsPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); boolean bSiteHasChanged = false; if (intent.hasExtra(WordPress.SITE)) { SiteModel site = (SiteModel) intent.getSerializableExtra(WordPress.SITE); <START> bSiteHasChanged = site.getId() != mSite.getId(); <END> mSite = site; } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(getString(mIsPage ? R.string.pages : R.string.posts)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } mPostList = (PostsListFragment) getFragmentManager().findFragmentByTag(PostsListFragment.TAG); if (mPostList == null || bSiteHasChanged || bPageHasChanged) { PostsListFragment oldFragment = mPostList; mPostList = PostsListFragment.newInstance(mSite, mIsPage); if (oldFragment == null) { getFragmentManager().beginTransaction() .add(R.id.post_list_container, mPostList, PostsListFragment.TAG) .commit(); } else { getFragmentManager().beginTransaction() .replace(R.id.post_list_container, mPostList, PostsListFragment.TAG) .commit(); } } showErrorDialogIfNeeded(intent.getExtras()); }</code><technical_language>for mSite null here</technical_language>

Target:
private void handleIntent(Intent intent) { mIsPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); boolean pageHasChanged = false; if (intent.hasExtra(EXTRA_VIEW_PAGES)) { boolean isPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); pageHasChanged = isPage != mIsPage; } mIsPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); boolean siteHasChanged = false; if (intent.hasExtra(WordPress.SITE)) { SiteModel site = (SiteModel) intent.getSerializableExtra(WordPress.SITE); if (mSite != null && site != null) { siteHasChanged = site.getId() != mSite.getId(); } mSite = site; } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(getString(mIsPage ? R.string.pages : R.string.posts)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } mPostList = (PostsListFragment) getFragmentManager().findFragmentByTag(PostsListFragment.TAG); if (mPostList == null || siteHasChanged || pageHasChanged) { PostsListFragment oldFragment = mPostList; mPostList = PostsListFragment.newInstance(mSite, mIsPage); if (oldFragment == null) { getFragmentManager().beginTransaction() .add(R.id.post_list_container, mPostList, PostsListFragment.TAG) .commit(); } else { getFragmentManager().beginTransaction() .replace(R.id.post_list_container, mPostList, PostsListFragment.TAG) .commit(); } } showErrorDialogIfNeeded(intent.getExtras()); }
Source:
<code>public Cohort(String name, String description, Patient[] patients) { this(name, description, (Integer[]) null); if (patients != null) { for (Patient p : patients) { CohortMember cohortMember = new CohortMember(this, p, new Date()); <START> members.add(cohortMember); <END> } } }</code><technical_language>combine lines 1 with: members.add(new CohortMember(this, p, new Date()));</technical_language>

Target:
public Cohort(String name, String description, Patient[] patients) { this(name, description, (Integer[]) null); if (patients != null) { for (Patient p : patients) { addMembership(new CohortMembership(p)); } } }
Source:
<code>protected Set<Value.Immutable<?>> api$getVanillaValues() { Set<Value.Immutable<?>> vanillaValues = super.api$getVanillaValues(); vanillaValues.add(this.type().asImmutable()); vanillaValues.add(this.sitting().asImmutable()); vanillaValues.add(this.faceplanted().asImmutable()); vanillaValues.add(this.defending().asImmutable()); vanillaValues.add(this.sleeping().asImmutable()); vanillaValues.add(this.pouncing().asImmutable()); vanillaValues.add(this.crouching().asImmutable()); vanillaValues.add(this.interested().asImmutable()); <START> if (this.dataManager.get(FoxEntityAccessor.accessor$getTrustedUuidMain()).isPresent()) { <END> this.firstTrusted().map(Value::asImmutable).ifPresent(vanillaValues::add); } if (this.dataManager.get(FoxEntityAccessor.accessor$getTrustedUuidSecondary()).isPresent()) { this.secondTrusted().map(Value::asImmutable).ifPresent(vanillaValues::add); } return vanillaValues; }</code><technical_language>Remove this if</technical_language>

Target:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> values = super.api$getVanillaValues(); values.add(this.type().asImmutable()); values.add(this.sitting().asImmutable()); values.add(this.faceplanted().asImmutable()); values.add(this.defending().asImmutable()); values.add(this.sleeping().asImmutable()); values.add(this.pouncing().asImmutable()); values.add(this.crouching().asImmutable()); values.add(this.interested().asImmutable()); this.firstTrusted().map(Value::asImmutable).ifPresent(values::add); this.secondTrusted().map(Value::asImmutable).ifPresent(values::add); return values; }
Source:
<code>private void triggerForceRefreshProgressDialog() { Task<Boolean> task = new Task<Boolean>(){ @Override protected Boolean call() throws IOException { try { logger.info("Menu: View > Force Refresh"); ServiceManager.getInstance().stopModelUpdate(); ServiceManager.getInstance().getModel().forceReloadComponents(); ServiceManager.getInstance().restartModelUpdate(); } catch (Exception e1) { <START> e1.printStackTrace(); <END> } logger.info("Menu: View > Force Refresh completed"); return true; } }; DialogMessage.showProgressDialog(task, "Reloading issues for current repo. This may take awhile, please wait..."); Thread thread = new Thread(task); thread.setDaemon(true); thread.start(); }</code><technical_language>log stack trace</technical_language>

Target:
private void triggerForceRefreshProgressDialog() { Task<Boolean> task = new Task<Boolean>(){ @Override protected Boolean call() throws IOException { try { logger.info("Menu: View > Force Refresh"); ServiceManager.getInstance().stopModelUpdate(); ServiceManager.getInstance().getModel().forceReloadComponents(); ServiceManager.getInstance().restartModelUpdate(); } catch (SocketTimeoutException e) { handleSocketTimeoutException(e); return false; } catch (UnknownHostException e) { handleUnknownHostException(e); return false; } catch (Exception e) { logger.error(e.getMessage(), e); e.printStackTrace(); return false; } logger.info("Menu: View > Force Refresh completed"); return true; } private void handleSocketTimeoutException(Exception e) { Platform.runLater(() -> { logger.error(e.getMessage(), e); DialogMessage.showWarningDialog("Internet Connection is down", "Timeout while loading items from github. Please check your internet connection."); }); } private void handleUnknownHostException(Exception e) { Platform.runLater(() -> { logger.error(e.getMessage(), e); DialogMessage.showWarningDialog("No Internet Connection", "Please check your internet connection and try again"); }); } }; DialogMessage.showProgressDialog(task, "Reloading issues for current repo... This may take awhile, please wait."); Thread thread = new Thread(task); thread.setDaemon(true); thread.start(); }
Source:
<code>public void persist_shouldCreateARefund() { ChargeEntity chargeEntity = new ChargeEntity(); chargeEntity.setId(chargeTestRecord.getChargeId()); <START> RefundEntity refundEntity = new RefundEntity(chargeEntity, 100L, null); <END> refundEntity.setStatus(RefundStatus.REFUND_SUBMITTED); refundEntity.setReference("test-refund-entity"); refundDao.persist(refundEntity); assertNotNull(refundEntity.getId()); List<Map<String, Object>> refundByIdFound = databaseTestHelper.getRefund(refundEntity.getId()); assertThat(refundByIdFound.size(), is(1)); assertThat(refundByIdFound, hasItems(aRefundMatching(refundEntity.getExternalId(), is("test-refund-entity"), refundEntity.getChargeEntity().getId(), refundEntity.getAmount(), refundEntity.getStatus().getValue()))); assertThat(refundByIdFound.get(0), hasEntry("created_date", java.sql.Timestamp.from(refundEntity.getCreatedDate().toInstant()))); }</code><technical_language>This actual assert refund stores this</technical_language>

Target:
public void persist_shouldCreateARefund() { ChargeEntity chargeEntity = new ChargeEntity(); chargeEntity.setId(chargeTestRecord.getChargeId()); RefundEntity refundEntity = new RefundEntity(chargeEntity, 100L, userExternalId); refundEntity.setStatus(RefundStatus.REFUND_SUBMITTED); refundEntity.setReference("test-refund-entity"); refundDao.persist(refundEntity); assertNotNull(refundEntity.getId()); List<Map<String, Object>> refundByIdFound = databaseTestHelper.getRefund(refundEntity.getId()); assertThat(refundByIdFound.size(), is(1)); assertThat(refundByIdFound, hasItems(aRefundMatching(refundEntity.getExternalId(), is("test-refund-entity"), refundEntity.getChargeEntity().getId(), refundEntity.getAmount(), refundEntity.getStatus().getValue()))); assertThat(refundByIdFound.get(0), hasEntry("created_date", java.sql.Timestamp.from(refundEntity.getCreatedDate().toInstant()))); assertThat(refundByIdFound.get(0), hasEntry("user_external_id", userExternalId)); }
Source:
<code>String[] oldPaths = (oldValue != null ? oldValue.toString() : <START> new String()) <END> .split(Character.toString(File.pathSeparatorChar)); String[] newPaths = (newValue != null ? newValue.toString() : new String()) .split(Character.toString(File.pathSeparatorChar)); List<String> removedPaths = new ArrayList<>(Arrays.asList(oldPaths)); for (String path : newPaths) { removedPaths.remove(path); }</code><technical_language>please "", below, a named constant "EMPTY_VALUE" so</technical_language>

Target:
String[] oldPaths = (oldValue != null ? oldValue.toString() : EMPTY_STRING) .split(Character.toString(File.pathSeparatorChar)); String[] newPaths = (newValue != null ? newValue.toString() : EMPTY_STRING) .split(Character.toString(File.pathSeparatorChar)); List<String> removedPaths = new ArrayList<>(Arrays.asList(oldPaths)); for (String path : newPaths) { removedPaths.remove(path); }
Source:
<code>private List<Object> parseList(String str) { List<Object> rc = new ArrayList<Object>(); String temp = str.trim(); Pattern pattern = isPatternFoundList(str); if (pattern == null) <START> return null; <END> Matcher variableMatcher = pattern.matcher(temp); if (variableMatcher != null) { while (variableMatcher.find()) { rc.add(variableMatcher.group()); } } return rc; }</code><technical_language>Please return empty rc prevent NPEs. Users of method easily check list is empty instead of null. Returning null collection is expected is considered a bad style</technical_language>

Target:
private List<String> parseList(String str) { List<String> rc = new ArrayList<String>(); String temp = str.trim(); Pattern pattern = isPatternFoundList(str); if (pattern == null) { return rc; } Matcher variableMatcher = pattern.matcher(temp); if (variableMatcher != null) { while (variableMatcher.find()) { rc.add(variableMatcher.group()); } } return rc; }
Source:
<code>void testAttacking() { int index = 4; for (final var unit : units) { when(((UnitAttachment) unit.getType().getAttachment("")).getOffensiveAttackAa(any())) <START> .thenReturn(index / 2); <END> index--; } DiceRoll.sortAaHighToLow(units, gameData, false, unitPowerAndRollsMap); assertThat(units.get(0), is(unit1)); assertThat(units.get(1), is(unit2)); assertThat(units.get(2), is(unit3)); assertThat(units.get(3), is(unit4)); assertThat(units.get(4), is(unit5)); }</code><technical_language>'index / 2' represent? question answered extracting a variable</technical_language>

Target:
void testAttacking() { int index = 4; for (final var unit : units) { final var unitAttachment = setupUnitAttachment(unit); when(unitAttachment.getOffensiveAttackAa(any())).thenReturn(index / 2); index--; } DiceRoll.sortAaHighToLow(units, gameData, false, new HashMap<>()); assertThat(units.get(0), is(unit1)); assertThat(units.get(1), is(unit2)); assertThat(units.get(2), is(unit3)); assertThat(units.get(3), is(unit4)); assertThat(units.get(4), is(unit5)); }
Source:
<code>private String commit(final CommitParams params, URI dockerDaemonUri) throws IOException { try (DockerConnection connection = connectionFactory.openConnection(dockerDaemonUri) .method("POST") .path("/commit")) { <START> addQueryParamIfNotNull(connection, "container", params.getContainer()); <END> addQueryParamIfNotNull(connection, "repo", params.getRepository()); addQueryParamIfNotNull(connection, "tag", params.getTag()); addQueryParamIfNotNull(connection, "comment", (params.getComment() == null) ? null : URLEncoder.encode(params.getComment(), "UTF-8")); addQueryParamIfNotNull(connection, "author", (params.getAuthor() == null) ? null : URLEncoder.encode(params.getAuthor(), "UTF-8")); final DockerResponse response = connection.request(); if (CREATED.getStatusCode() != response.getStatus()) { throw getDockerException(response); } return parseResponseStreamAndClose(response.getInputStream(), ContainerCommitted.class).getId(); } catch (JsonParseException e) { throw new IOException(e.getLocalizedMessage(), e); } }</code><technical_language>Commit is mandatory parameter. null. need this check</technical_language>

Target:
private String commit(final CommitParams params, URI dockerDaemonUri) throws IOException { try (DockerConnection connection = connectionFactory.openConnection(dockerDaemonUri) .method("POST") .path("/commit") .query("container", params.getContainer())) { addQueryParamIfNotNull(connection, "repo", params.getRepository()); addQueryParamIfNotNull(connection, "tag", params.getTag()); addQueryParamIfNotNull(connection, "comment", (params.getComment() == null) ? null : URLEncoder.encode(params.getComment(), "UTF-8")); addQueryParamIfNotNull(connection, "author", (params.getAuthor() == null) ? null : URLEncoder.encode(params.getAuthor(), "UTF-8")); final DockerResponse response = connection.request(); if (CREATED.getStatusCode() != response.getStatus()) { throw getDockerException(response); } return parseResponseStreamAndClose(response.getInputStream(), ContainerCommitted.class).getId(); } catch (JsonParseException e) { throw new IOException(e.getLocalizedMessage(), e); } }
Source:
<code>public static <Y> Key<Object, Y> create(ViewMetamodel metamodel, Object source, Class<Y> targetEntityViewClass, String constructorName, ConvertOption... convertOptions) { if (source instanceof EntityViewProxy) { EntityViewProxy sourceProxy = (EntityViewProxy) source; return (Key<Object, Y>) create(metamodel, sourceProxy.$$_getEntityViewClass(), targetEntityViewClass, constructorName, convertOptions); } else { <START> return (Key<Object, Y>) create(metamodel, null, targetEntityViewClass, constructorName, convertOptions); <END> } }</code><technical_language>IMO validate entity class of target entity view is a super type of source object. suggestion ManagedViewType<?> targetViewType = metamodel.managedView(targetEntityViewClass); if (targetViewType == null) { throw new IllegalArgumentException("Unknown target view type: " + targetEntityViewClass.getName()); } if (!targetViewType.getEntityClass().isInstance(source)) { throw new IllegalArgumentException("The source object is instance of target views entity type " + targetViewType.getEntityClass().getName() + ": " + source.getClass().getName()); } MappingConstructorImpl<Y> constructor = null; if (targetConstructorName != null) { constructor = (MappingConstructorImpl<Y>) targetViewType.getConstructor(targetConstructorName); if (constructor == null) { throw new IllegalArgumentException("Unknown constructor '" + targetConstructorName + "' target view type: " + targetEntityViewClass.getName()); } } boolean ignoreMissingAttributes = false; boolean markNew = false; for (ConvertOption copyOption : convertOptions) { switch (copyOption) { case CREATE_NEW: markNew = true; break; case IGNORE_MISSING_ATTRIBUTES: ignoreMissingAttributes = true; break; default: break; } } return new ViewMapper.Key<>(sourceViewType, targetViewType, constructor, ignoreMissingAttributes, markNew);</technical_language>

Target:
public static <Y> Key<Object, Y> create(ViewMetamodel metamodel, Object source, Class<Y> targetEntityViewClass, String constructorName, ConvertOption... convertOptions) { if (source instanceof EntityViewProxy) { EntityViewProxy sourceProxy = (EntityViewProxy) source; return (Key<Object, Y>) createWithConvertOptions(metamodel, sourceProxy.$$_getEntityViewClass(), targetEntityViewClass, constructorName, false, convertOptions); } else { ManagedViewType<Y> targetViewType = metamodel.managedView(targetEntityViewClass); if (targetViewType == null) { throw new IllegalArgumentException("Unknown target view type: " + targetEntityViewClass.getName()); } else if (!targetViewType.getEntityClass().isInstance(source)) { throw new IllegalArgumentException("The source object is not an instance of the target views entity type " + targetViewType.getEntityClass().getName() + ": " + source.getClass().getName()); } return createWithConvertOptions(metamodel, null, targetEntityViewClass, constructorName, true, convertOptions); } }
Source:
<code>public void receiveRequest(final Request request, final EndpointReceiver receiver) { final KeyMID idByMID = KeyMID.fromInboundMessage(request); final Exchange exchange = new Exchange(request, Origin.REMOTE, executor); final Exchange previous = exchangeStore.findPrevious(idByMID, exchange); boolean duplicate = previous != null; if (duplicate) { EndpointContext sourceContext = request.getSourceContext(); Request previousRequest = previous.getRequest(); EndpointContext previousSourceContext = previousRequest.getSourceContext(); duplicate = endpointContextMatcher.isToBeSent(previousSourceContext, sourceContext); if (!duplicate) { exchangeStore.remove(idByMID, previous); if (exchangeStore.findPrevious(idByMID, exchange) != null) { LOGGER.warn("new request could not be registered!"); } } } if (duplicate) { LOGGER.trace("duplicate request: {}", request); request.setDuplicate(true); previous.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(previous, request); } catch (Exception ex) { LOGGER.debug("error receiving request again!", request, ex); <START> receiver.reject(request); <END> } } }); } else { exchange.setRemoveHandler(exchangeRemoveHandler); exchange.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(exchange, request); } catch (Exception ex) { LOGGER.debug("error receiving request {}", request, ex); receiver.reject(request); } } }); } }</code><technical_language>if sending RST is a good idea... :thinking: consider send Internal Server Error Response</technical_language>

Target:
public void receiveRequest(final Request request, final EndpointReceiver receiver) { final KeyMID idByMID = KeyMID.fromInboundMessage(request); final Exchange exchange = new Exchange(request, Origin.REMOTE, executor); final Exchange previous = exchangeStore.findPrevious(idByMID, exchange); boolean duplicate = previous != null; if (duplicate) { EndpointContext sourceContext = request.getSourceContext(); Request previousRequest = previous.getRequest(); EndpointContext previousSourceContext = previousRequest.getSourceContext(); duplicate = endpointContextMatcher.isToBeSent(previousSourceContext, sourceContext); if (!duplicate) { exchangeStore.remove(idByMID, previous); if (exchangeStore.findPrevious(idByMID, exchange) != null) { LOGGER.warn("new request could not be registered!"); } } } if (duplicate) { LOGGER.trace("duplicate request: {}", request); request.setDuplicate(true); previous.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(previous, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request again!", request, ex); receiver.reject(request); } } }); } else { exchange.setRemoveHandler(exchangeRemoveHandler); exchange.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(exchange, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request {}", request, ex); receiver.reject(request); } } }); } }
Source:
<code>public void convertFromEntityShouldCopyRequiredFields(){ SpamRule entity = randomSpamRule(); SpamRuleDto dto = SpamRuleDto.fromEntity(entity); <START> assertEquals(entity, dto); <END> }</code><technical_language>assertReflecitonEquals()</technical_language>

Target:
public void convertFromEntityShouldCopyRequiredFields(){ SpamRule expected = randomSpamRule(); SpamRuleDto dto = SpamRuleDto.fromEntity(expected); SpamRule actual = SpamRule.toEntity(dto); actual.setUuid(expected.getUuid()); assertReflectionEquals(expected, actual); }
Source:
<code>public void testGetParameter() { String key = "foo"; CRRequest req = createTestRequest(null); assertNull( "When no parameters and no request wrapper is set, a call to get with fallback=true should not throw an exception", req.get(key, Boolean.TRUE) ); req = createTestRequest(new HashMap<String, String>()); assertNull("Null should be returned if no parameter is set", req.get(key)); <START> assertNull("Null should be returned if no parameter is set and fallback=true", req.get(key, Boolean.FALSE)); <END> req.set(key, "bar"); assertEquals("If a parameter is set in the CRRequest, the value should be returned", "bar", req.get(key)); HashMap<String, String> servletParams = new HashMap<>(); servletParams.put(key, "servletBar"); req = createTestRequest(servletParams); assertNull( "Null should be returned when get is called with a single argument and the parameter is only set in the servlet request", req.get(key) ); assertNull( "Null should be returned when get is called with fallback=false and the parameter is only set in the servlet request", req.get(key) ); assertEquals( "If the parameter is only set in the servlet request and get is called with fallback=true, the value should be retrieved from the servlet request.", "servletBar", req.get(key, Boolean.TRUE) ); req.set(key, "bar"); assertNotEquals( "If the parameter is set in both requests and get is called with a single argument, the value should be different from the one stored in the servlet reques", "servletBar", req.get(key) ); assertNotEquals( "If the parameter is set in both requests and get is called with fallback=false, the value should be different from the one stored in the servlet request.", "servletBar", req.get(key, Boolean.FALSE) ); assertEquals( "If the parameter is set in both requests and calls to get with fallback=false and fallback=true shoudl return the same value.", req.get(key, Boolean.TRUE), req.get(key, Boolean.FALSE) ); }</code><technical_language>Inkonistenter assert-string</technical_language>

Target:
public void testGetParameter() { String key = "foo"; CRRequest req = createTestRequest(null); assertNull( "When no parameters and no request wrapper is set, a call to get with fallback=true should not throw an exception", req.get(key, Boolean.TRUE) ); }
Source:
<code>public final void write(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { final Channel channel = this.channel; int readableBytes = buffer.readableBytes(); Object fileObject = null; if (buffer instanceof FileDelegatedChannelBufferWrapper) { readableBytes += ((FileDelegatedChannelBufferWrapper)buffer).getDataSize(); <START> fileObject = getFileObject((FileDelegatedChannelBufferWrapper)buffer); <END> } if (logger.isDebugEnabled()) { final int remainingBytes = this.writeBufferHighWaterMark - readableBytes; if (remainingBytes < 0) { logger.debug("a write request is exceeding by " + (-remainingBytes) + " bytes the writeBufferHighWaterMark size [ " + this.writeBufferHighWaterMark + " ] : consider to set it at least of " + readableBytes + " bytes"); } } final ChannelPromise promise; if (flush || (futureListener != null)) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); assert readableBytes >= 0; final int writeBatchSize = this.batchLimit; final boolean batchingEnabled = this.batchingEnabled; if (batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, fileObject, readableBytes, promise); } else if (fileObject == null) { future = channel.writeAndFlush(bytes, promise); } else { channel.write(bytes); future = channel.writeAndFlush(fileObject, promise); } if (futureListener != null) { future.addListener(futureListener); } if (flush) { flushAndWait(channel, promise); } }</code><technical_language>NettyConnection::write is supposed open a RandomAccessFile (with SSL) a new FileChannel? happen for File times</technical_language>

Target:
public final void write(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { final int readableBytes = buffer.readableBytes(); if (logger.isDebugEnabled()) { final int remainingBytes = this.writeBufferHighWaterMark - readableBytes; if (remainingBytes < 0) { logger.debug("a write request is exceeding by " + (-remainingBytes) + " bytes the writeBufferHighWaterMark size [ " + this.writeBufferHighWaterMark + " ] : consider to set it at least of " + readableBytes + " bytes"); } } final Channel channel = this.channel; final ChannelPromise promise; if (flush || (futureListener != null)) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); assert readableBytes >= 0; final int writeBatchSize = this.batchLimit; final boolean batchingEnabled = this.batchingEnabled; if (batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise); } if (futureListener != null) { future.addListener(futureListener); } if (flush) { flushAndWait(channel, promise); } }
Source:
<code>public static ChangeUpdate newUpdate(Injector injector, GitRepositoryManager repoManager, Change c, final IdentifiedUser user) <START> throws Exception { <END> return injector.createChildInjector(new FactoryModule() { @Override public void configure() { factory(ChangeUpdate.Factory.class); bind(IdentifiedUser.class).toInstance(user); } }).getInstance(ChangeUpdate.Factory.class).create( stubChangeControl(repoManager, c, user), TimeUtil.nowTs(), Ordering.<String> natural()); }</code><technical_language>this is necessary</technical_language>

Target:
public static ChangeUpdate newUpdate(Injector injector, GitRepositoryManager repoManager, Change c, final IdentifiedUser user) throws OrmException { return injector.createChildInjector(new FactoryModule() { @Override public void configure() { factory(ChangeUpdate.Factory.class); bind(IdentifiedUser.class).toInstance(user); } }).getInstance(ChangeUpdate.Factory.class).create( stubChangeControl(repoManager, c, user), TimeUtil.nowTs(), Ordering.<String> natural()); }
Source:
<code>public void testFormShortCircuit() { FormParseInit fpi = new FormParseInit("/IfShortCircuitTest.xhtml"); IFunctionHandler functionFailer = new IFunctionHandler() { @Override public String getName() { return "fail_function"; } @Override public Object eval(Object[] args, EvaluationContext ec) { <START> throw new RuntimeException("You failed the test!"); <END> } @Override public Vector getPrototypes() { Vector<Class[]> p = new Vector<>(); p.addElement(new Class[0]); return p; } @Override public boolean rawArgs() { return false; } }; fpi.getFormDef().exprEvalContext.addFunctionHandler(functionFailer); FormEntryController fec = fpi.getFormEntryController(); do { QuestionDef q = fpi.getCurrentQuestion(); if (q == null) { continue; } fec.answerQuestion(new SelectOneData(new Selection("yes"))); } while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM); }</code><technical_language>helpful more specific test failed</technical_language>

Target:
public void testFormShortCircuit() { FormParseInit fpi = new FormParseInit("/IfShortCircuitTest.xhtml"); IFunctionHandler functionFailer = new IFunctionHandler() { @Override public String getName() { return "fail_function"; } @Override public Object eval(Object[] args, EvaluationContext ec) { throw new RuntimeException("False portion of if() statement called"); } @Override public Vector getPrototypes() { Vector<Class[]> p = new Vector<>(); p.addElement(new Class[0]); return p; } @Override public boolean rawArgs() { return false; } }; fpi.getFormDef().exprEvalContext.addFunctionHandler(functionFailer); FormEntryController fec = fpi.getFormEntryController(); do { QuestionDef q = fpi.getCurrentQuestion(); if (q == null) { continue; } fec.answerQuestion(new SelectOneData(new Selection("yes"))); } while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM); }
Source:
<code>private static String createAliasUsingDoi(String doi, Workflow workflow) { Map<String, Alias> aliases = workflow.getAliases(); String doiReformattedAlias = doi.replaceAll("/", "-"); aliases.put(doiReformattedAlias, new Alias()); <START> workflow.setAliases(aliases); <END> return doiReformattedAlias; }</code><technical_language>this line is redundant in Java. aliases is a pointer original map put new alias in collection, need workflow it. i.e. workflow.setAliases(aliases); is a no-op workflow.setAliases(workflow.getAliases()</technical_language>

Target:
private static String createAliasUsingDoi(String doi, Workflow workflow) { Map<String, Alias> aliases = workflow.getAliases(); String doiReformattedAlias = doi.replaceAll("/", "-"); aliases.put(doiReformattedAlias, new Alias()); return doiReformattedAlias; }
Source:
<code>default <R> R collect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner) { <START> R container = supplier.get(); <END> accumulator.accept(container, get()); return container; }</code><technical_language>local vars final if</technical_language>

Target:
default <R> R collect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner) { return StreamSupport.stream(spliterator(), false).collect(supplier, accumulator, combiner); }
Source:
<code>public void handleEvent(Event event) { EventContext ctx = event.getContext(); if (!(ctx instanceof DocumentEventContext)) { return; } DocumentEventContext docCtx = (DocumentEventContext) ctx; DocumentModel doc = docCtx.getSourceDocument(); if (doc.hasFacet(PICTURE_FACET) && !doc.isProxy()) { Property fileProp = doc.getProperty("file:content"); Property viewsProp = doc.getProperty(AbstractPictureAdapter.VIEWS_PROPERTY); Boolean forceGeneration = Boolean.TRUE.equals(doc.getContextData(CTX_FORCE_VIEWS_GENERATION)); if (forceGeneration || (!viewsProp.isDirty() || viewsProp.size() == 0) <START> && (ABOUT_TO_CREATE.equals(event.getName()) || fileProp.isDirty())) { <END> preFillPictureViews(docCtx.getCoreSession(), doc); } else { docCtx.setProperty(PictureViewsGenerationListener.DISABLE_PICTURE_VIEWS_GENERATION_LISTENER, true); } } }</code><technical_language>parenthesing mix of && || easy understand logic tested. like: boolean noPictureViews = !viewsProp.isDirty() || viewsProp.size() == 0; boolean fileChanged = ABOUT_TO_CREATE.equals(event.getName()) || fileProp.isDirty(); if (forceGeneration || (noPictureViews && fileChanged)) { (Change names fit)</technical_language>

Target:
public void handleEvent(Event event) { EventContext ctx = event.getContext(); if (!(ctx instanceof DocumentEventContext)) { return; } DocumentEventContext docCtx = (DocumentEventContext) ctx; DocumentModel doc = docCtx.getSourceDocument(); if (doc.hasFacet(PICTURE_FACET) && !doc.isProxy()) { Property fileProp = doc.getProperty("file:content"); Property viewsProp = doc.getProperty(AbstractPictureAdapter.VIEWS_PROPERTY); boolean forceGeneration = Boolean.TRUE.equals(doc.getContextData(CTX_FORCE_VIEWS_GENERATION)); boolean noPictureViews = !viewsProp.isDirty() || viewsProp.size() == 0; boolean fileChanged = ABOUT_TO_CREATE.equals(event.getName()) || fileProp.isDirty(); if (forceGeneration || (noPictureViews && fileChanged)) { preFillPictureViews(docCtx.getCoreSession(), doc); } else { docCtx.setProperty(PictureViewsGenerationListener.DISABLE_PICTURE_VIEWS_GENERATION_LISTENER, true); } } }
Source:
<code>public void saveInterpreterBindings(NotebookSocket conn, Message fromMessage) { try { List<String> settingIdList = gson.fromJson(String.valueOf( fromMessage.data.get("selectedSettingIds")), new TypeToken<ArrayList<String>>() { }.getType()); <START> notebook().bindInterpretersToNote((String) fromMessage.data.get("noteID"), settingIdList); <END> } catch (Exception e) { LOG.error("Error while saving interpreter bindings", e); } }</code><technical_language>saving broadcast, other users note this save update</technical_language>

Target:
public void saveInterpreterBindings(NotebookSocket conn, Message fromMessage) { String noteId = (String) fromMessage.data.get("noteID"); try { List<String> settingIdList = gson.fromJson(String.valueOf( fromMessage.data.get("selectedSettingIds")), new TypeToken<ArrayList<String>>() { }.getType()); notebook().bindInterpretersToNote(noteId, settingIdList); broadcastInterpreterBindings(noteId, InterpreterBindingUtils.getInterpreterBindings(notebook(), noteId)); } catch (Exception e) { LOG.error("Error while saving interpreter bindings", e); } }
Source:
<code>public BlobServiceAsyncClient buildAsyncClient() { BuilderHelper.validateCpk(customerProvidedKey, endpoint); BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest(); <START> HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( <END> storageSharedKeyCredential, tokenCredential, sasTokenCredential, endpoint, retryOptions, logOptions, httpClient, additionalPolicies, configuration, serviceVersion); return new BlobServiceAsyncClient(pipeline, endpoint, serviceVersion, accountName, customerProvidedKey); }</code><technical_language>add a check this call ensure is a credential set in builder? changes longer throw IllegalArgumentException credential set</technical_language>

Target:
public BlobServiceAsyncClient buildAsyncClient() { BuilderHelper.validateCpk(customerProvidedKey, endpoint); if (Objects.isNull(storageSharedKeyCredential) && Objects.isNull(tokenCredential) && Objects.isNull(sasTokenCredential)) { throw logger.logExceptionAsError(new IllegalArgumentException("Blob Service Client cannot be accessed " + "anonymously. Please provide a form of authentication")); } BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest(); HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( storageSharedKeyCredential, tokenCredential, sasTokenCredential, endpoint, retryOptions, logOptions, httpClient, additionalPolicies, configuration, serviceVersion); return new BlobServiceAsyncClient(pipeline, endpoint, serviceVersion, accountName, customerProvidedKey); }
Source:
<code>public IntervalLoadRule( @JsonProperty("interval") Interval interval, @JsonProperty("tieredReplicants") Map<String, Integer> tieredReplicants ) { <START> this.tieredReplicants = tieredReplicants == null ? Maps.<String, Integer>newHashMap() : tieredReplicants; <END> validateTieredReplicants(this.tieredReplicants); this.interval = interval; }</code><technical_language>Suggest ImmutableMap.<String, Integer>of()</technical_language>

Target:
public IntervalLoadRule( @JsonProperty("interval") Interval interval, @JsonProperty("tieredReplicants") Map<String, Integer> tieredReplicants ) { this.tieredReplicants = tieredReplicants == null ? ImmutableMap.of(DruidServer.DEFAULT_TIER, DruidServer.DEFAULT_NUM_REPLICANTS) : tieredReplicants; validateTieredReplicants(this.tieredReplicants); this.interval = interval; }
Source:
<code>private boolean isServicesBasedDeployment(List<String> services) { <START> return services != null && services.size() > 0; <END> }</code><technical_language>Pretty minor generally !isEmpty is clearer size > 0</technical_language>

Target:
private boolean isServicesBasedDeployment(List<String> services) { return services != null && !services.isEmpty(); }
Source:
<code>public void testCreateVolume() { assertNotNull(dataCenter); testVolume = volumeApi().createVolume( Volume.Request.creatingBuilder() .dataCenterId(dataCenter.id()) .name("jclouds-volume") .size(3) .licenceType(LicenceType.LINUX) <START> .type("HDD") <END> .build()); assertNotNull(testVolume); assertEquals(testVolume.properties().name(), "jclouds-volume"); assertVolumeAvailable(testVolume); }</code><technical_language>Configure some ssh key</technical_language>

Target:
public void testCreateVolume() { assertNotNull(dataCenter); List<Image> images = api.imageApi().getList(new DepthOptions().depth(5)); Image testImage = null; for (Image image : images) { if ( image.metadata().state() == State.AVAILABLE && image.properties().isPublic() && image.properties().imageType() == Image.Type.HDD && image.properties().location() == TestLocation && image.properties().licenceType() == LicenceType.LINUX && ( testImage == null || testImage.properties().size() > image.properties().size() ) ) { testImage = image; } } HashSet<String> sshKeys = new HashSet<String>(); sshKeys.add("hQGOEJeFL91EG3+l9TtRbWNjzhDVHeLuL3NWee6bekA="); testVolume = volumeApi().createVolume( Volume.Request.creatingBuilder() .dataCenterId(dataCenter.id()) .name("jclouds-volume") .size(4) .licenceType(LicenceType.LINUX) .type(VolumeType.HDD) .image(testImage.id()) .sshKeys(sshKeys) .build()); assertNotNull(testVolume); assertEquals(testVolume.properties().name(), "jclouds-volume"); assertVolumeAvailable(testVolume); }
Source:
<code>private void handleInvalidResponse(HttpResponse response, String url) throws IOException { <START> try (StringWriter sw = new StringWriter(); <END> PrintWriter out = new PrintWriter(sw) ) { out.print("Problem accessing server at "); out.println(url); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { LOG.info("Response code: " + response.getStatusLine().getStatusCode()); out.println("Few Possible Causes: "); out.println("1. Your Go Server is down or not accessible."); out.println("2. This agent might be incompatible with your Go Server. Please fix the version mismatch between Go Server and Go Agent."); throw new ClientProtocolException(sw.toString()); } else if (response.getFirstHeader(MD5_HEADER) == null || response.getFirstHeader(SSL_PORT_HEADER) == null) { out.print("Missing required headers '"); out.print(MD5_HEADER); out.print("' and '"); out.print(SSL_PORT_HEADER); out.println("' in response."); throw new ClientProtocolException(sw.toString()); } } }</code><technical_language>String writer need a try resource</technical_language>

Target:
private void handleInvalidResponse(HttpResponse response, String url) throws IOException { StringWriter sw = new StringWriter(); try (PrintWriter out = new PrintWriter(sw)) { out.print("Problem accessing server at "); out.println(url); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { LOG.info("Response code: " + response.getStatusLine().getStatusCode()); out.println("Few Possible Causes: "); out.println("1. Your Go Server is down or not accessible."); out.println("2. This agent might be incompatible with your Go Server. Please fix the version mismatch between Go Server and Go Agent."); throw new ClientProtocolException(sw.toString()); } else if (response.getFirstHeader(MD5_HEADER) == null || response.getFirstHeader(SSL_PORT_HEADER) == null) { out.print("Missing required headers '"); out.print(MD5_HEADER); out.print("' and '"); out.print(SSL_PORT_HEADER); out.println("' in response."); throw new ClientProtocolException(sw.toString()); } } }
Source:
<code>private void updateProjectAccessible( final boolean blockWorkbenchStartup ) { if ( blockWorkbenchStartup ) { workbench.addStartupBlocker( LibraryMonitor.class ); } libraryService.call( new RemoteCallback<Boolean>() { @Override public void callback( Boolean thereIsAProjectInTheWorkbench ) { <START> thereIsAtLeastOneProjectAccessible = thereIsAProjectInTheWorkbench; <END> if ( blockWorkbenchStartup ) { workbench.removeStartupBlocker( LibraryMonitor.class ); } } } ).thereIsAProjectInTheWorkbench(); }</code><technical_language>In case of exception, workbench startup (blocked startup blocker). log in error</technical_language>

Target:
private void updateProjectAccessible( final boolean blockWorkbenchStartup ) { if ( blockWorkbenchStartup ) { workbench.addStartupBlocker( LibraryMonitor.class ); } libraryService.call( new RemoteCallback<Boolean>() { @Override public void callback( Boolean thereIsAProjectInTheWorkbench ) { thereIsAtLeastOneProjectAccessible = thereIsAProjectInTheWorkbench; if ( blockWorkbenchStartup ) { workbench.removeStartupBlocker( LibraryMonitor.class ); } } }, ( o, throwable ) -> { setThereIsAtLeastOneProjectAccessible( true ); LOGGER.log( Level.SEVERE, "Error while checking for projects: ", throwable ); if ( blockWorkbenchStartup ) { workbench.removeStartupBlocker( LibraryMonitor.class ); } return false; } ).thereIsAProjectInTheWorkbench(); }
Source:
<code>protected void updateReferenceTimes(ScannedFileInfo fileInfo) { <START> Map<String, Long> referenceTimeMap; <END> if ((referenceTimeMap = referenceTimes.get(fileInfo.getDirectoryPath())) == null) { referenceTimeMap = Maps.newHashMap(); } referenceTimeMap.put(fileInfo.getFilePath(), fileInfo.modifiedTime); referenceTimes.put(fileInfo.getDirectoryPath(), referenceTimeMap); }</code><technical_language>Nitpicking: please call local variable referenceTimePerInputDir. remember changed</technical_language>

Target:
protected void updateReferenceTimes(ScannedFileInfo fileInfo) { Map<String, Long> referenceTimePerInputDir; if ((referenceTimePerInputDir = referenceTimes.get(fileInfo.getDirectoryPath())) == null) { referenceTimePerInputDir = Maps.newHashMap(); } referenceTimePerInputDir.put(fileInfo.getFilePath(), fileInfo.modifiedTime); referenceTimes.put(fileInfo.getDirectoryPath(), referenceTimePerInputDir); }
Source:
<code>public void clickViewStudentCheckBoxInSectionLevel(int instrNum, int sectionLevelIndex) { this.sectionLevelIndexPanelCheckBox(instrNum, sectionLevelIndex, <START> Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS).click(); <END> }</code><technical_language>I indent 8 spaces [t]his</technical_language>

Target:
public void clickViewStudentCheckBoxInSectionLevel(int instrNum, int sectionLevelIndex) { this.sectionLevelPanelCheckBox(instrNum, sectionLevelIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS).click(); }
Source:
<code>private static String getArrayNotEqualReason(Object actual, Object expected){ <START> if(actual == expected) <END> return null; if(null == expected) { return "expected a null array, but not null found"; } if(null == actual) { return "expected not null array, but null found"; } if (!actual.getClass().isArray()) { return "not an array"; } int expectedLength = Array.getLength(expected); if (expectedLength != Array.getLength(actual)) { return "array lengths are not the same"; } for (int i = 0; i < expectedLength; i++) { Object _actual = Array.get( actual, i ); Object _expected = Array.get( expected, i ); if(!areEqual( _actual, _expected )){ return "(values at index " + i + " are not the same)"; } } return null; }</code><technical_language>please for this if condition</technical_language>

Target:
private static String getArrayNotEqualReason(Object actual, Object expected) { if (actual == expected) { return null; } if (null == expected) { return "expected a null array, but not null found"; } if (null == actual) { return "expected not null array, but null found"; } if (!actual.getClass().isArray()) { return "not an array"; } int expectedLength = Array.getLength(expected); if (expectedLength != Array.getLength(actual)) { return "array lengths are not the same"; } for (int i = 0; i < expectedLength; i++) { Object _actual = Array.get(actual, i); Object _expected = Array.get(expected, i); if (!areEqual(_actual, _expected)) { return "(values at index " + i + " are not the same)"; } } return null; }
Source:
<code>public void testColumnRangeReadUnsupported() { Transaction t1 = startTransaction(); try { t1.getRowsColumnRange(TEST_TABLE, ImmutableList.of(PtBytes.toBytes("row1")), <START> new ColumnRangeSelection(PtBytes.EMPTY_BYTE_ARRAY, PtBytes.EMPTY_BYTE_ARRAY), 1); <END> } catch (UnsupportedOperationException e) { } }</code><technical_language>needs a fail() this line, throwing passes</technical_language>

Target:
public void testColumnRangeReadUnsupported() { Transaction t1 = startTransaction(); try { t1.getRowsColumnRange(TEST_TABLE, ImmutableList.of(PtBytes.toBytes("row1")), new ColumnRangeSelection(PtBytes.EMPTY_BYTE_ARRAY, PtBytes.EMPTY_BYTE_ARRAY), 1); fail(); } catch (UnsupportedOperationException e) { } }
Source:
<code>private void updatePublishDateTextView() { if (!isAdded()) { return; } PostModel postModel = getPost(); String labelToUse = "%s"; String dateCreated = postModel.getDateCreated(); if (!TextUtils.isEmpty(dateCreated)) { String formattedDate = DateUtils.formatDateTime(getActivity(), DateTimeUtils.timestampFromIso8601Millis(dateCreated), getDateTimeFlags()); PostStatus status = PostStatus.fromPost(postModel); if (status == PostStatus.SCHEDULED) { labelToUse = getString(R.string.scheduled_for, formattedDate); } else if (status == PostStatus.PUBLISHED || status == PostStatus.PRIVATE) { labelToUse = getString(R.string.published_on, formattedDate); } else if (postModel.isLocalDraft() && PostUtils.shouldPublishImmediately(postModel)) { mPublishDateTextView.setText(R.string.immediately); return; } else if (PostUtils.isPublishDateInTheFuture(postModel)) { labelToUse = getString(R.string.schedule_for, formattedDate); } else { labelToUse = getString(R.string.publish_on, formattedDate); } mPublishDateTextView.setText(labelToUse); <START> } else if (PostUtils.shouldPublishImmediatelyOptionBeAvailable(postModel)) { <END> mPublishDateTextView.setText(R.string.immediately); } }</code><technical_language>if dateCreated is empty immediately publish option is available, label for this</technical_language>

Target:
private void updatePublishDateTextView() { if (!isAdded()) { return; } PostModel postModel = getPost(); String labelToUse; String dateCreated = postModel.getDateCreated(); if (!TextUtils.isEmpty(dateCreated)) { String formattedDate = DateUtils.formatDateTime(getActivity(), DateTimeUtils.timestampFromIso8601Millis(dateCreated), getDateTimeFlags()); PostStatus status = PostStatus.fromPost(postModel); if (status == PostStatus.SCHEDULED) { labelToUse = getString(R.string.scheduled_for, formattedDate); } else if (status == PostStatus.PUBLISHED || status == PostStatus.PRIVATE) { labelToUse = getString(R.string.published_on, formattedDate); } else if (postModel.isLocalDraft() && PostUtils.shouldPublishImmediately(postModel)) { labelToUse = getString(R.string.immediately); } else if (PostUtils.isPublishDateInTheFuture(postModel)) { labelToUse = getString(R.string.schedule_for, formattedDate); } else { labelToUse = getString(R.string.publish_on, formattedDate); } } else if (PostUtils.shouldPublishImmediatelyOptionBeAvailable(postModel)) { labelToUse = getString(R.string.immediately); } else { labelToUse = ""; } mPublishDateTextView.setText(labelToUse); }