auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void updatePosts(boolean forced) { if (!isAdded()) { return; } if (!NetworkUtils.checkConnection(getActivity())) { mRecyclerView.setRefreshing(false); return; } if (mFirstLoad) { mRecyclerView.setRefreshing(false); mFirstLoad = false; } else { UpdateAction updateAction = forced ? UpdateAction.REQUEST_REFRESH : UpdateAction.REQUEST_NEWER; switch (getPostListType()) { case TAG_FOLLOWED: case TAG_PREVIEW: updatePostsWithTag(getCurrentTag(), updateAction); break; case BLOG_PREVIEW: updatePostsInCurrentBlogOrFeed(updateAction); break; case SEARCH_RESULTS: break; } mRecyclerView.setRefreshing(true); <START> AnalyticsTracker.track(Stat.READER_PULL_TO_REFRESH); <END> } if (getCurrentTag() != null && getCurrentTag().isBookmarked()) { ReaderPostTable.purgeUnbookmarkedPostsWithBookmarkTag(); refreshPosts(); } }</code><technical_language>wondering if this method (the else branch) is invoked user pulls-to-refresh -> check if forced if REQUEST_REFRESH REQUEST_NEWER in other cases. want consider putting [here](<LINK_0> if(forced)track. Wdyt</technical_language>

Target:
private void updatePosts(boolean forced) { if (!isAdded()) { return; } if (!NetworkUtils.checkConnection(getActivity())) { mRecyclerView.setRefreshing(false); return; } if (mFirstLoad) { mRecyclerView.setRefreshing(false); mFirstLoad = false; } else { UpdateAction updateAction = forced ? UpdateAction.REQUEST_REFRESH : UpdateAction.REQUEST_NEWER; switch (getPostListType()) { case TAG_FOLLOWED: case TAG_PREVIEW: updatePostsWithTag(getCurrentTag(), updateAction); break; case BLOG_PREVIEW: updatePostsInCurrentBlogOrFeed(updateAction); break; case SEARCH_RESULTS: break; } mRecyclerView.setRefreshing(true); } if (getCurrentTag() != null && getCurrentTag().isBookmarked()) { ReaderPostTable.purgeUnbookmarkedPostsWithBookmarkTag(); refreshPosts(); } }
Source:
<code>public void testPostRequestNestedJSON() { Map<String, Object> jsonData = new HashMap<>(); Map<String, Object> nestedJSONData1 = new HashMap<>(); Map<String, Object> nestedJSONData2= new HashMap<>(); jsonData.put("key1", "value1"); nestedJSONData1.put("key4", "value4"); nestedJSONData1.put("key5", "value5"); nestedJSONData2.put("key6", "value6"); jsonData.put("key2", nestedJSONData1); jsonData.put("key3", nestedJSONData2); try { headers.put("Content-Type", "application/json"); response = WS.request(WS.OP.POST, uri + "/post", headers, jsonData, ContentType.APPLICATION_JSON); } catch (Exception e) { Assert.fail(e.toString()); } <START> System.out.println(response.get("json")); <END> Assert.assertTrue(response != null); Assert.assertEquals("value1", ((JSONObject) response.get("json")).get("key1")); Assert.assertEquals("value4", ((Map) ((Map) response.get("json")).get("key2")).get("key4")); Assert.assertEquals("value5", ((JSONObject) ((JSONObject) response.get("json")).get("key2")).get("key5")); Assert.assertEquals("value6", ((Map) ((JSONObject) response.get("json")).get("key3")).get("key6")); }</code><technical_language>I this line is longer needed</technical_language>

Target:
public void testPostRequestNestedJSON() { Map<String, Object> jsonData = new HashMap<>(); Map<String, Object> nestedJSONData1 = new HashMap<>(); Map<String, Object> nestedJSONData2= new HashMap<>(); jsonData.put("key1", "value1"); nestedJSONData1.put("key4", "value4"); nestedJSONData1.put("key5", "value5"); nestedJSONData2.put("key6", "value6"); jsonData.put("key2", nestedJSONData1); jsonData.put("key3", nestedJSONData2); try { headers.put("Content-Type", "application/json"); response = WS.request(WS.OP.POST, uri + "/post", headers, jsonData, ContentType.APPLICATION_JSON); } catch (Exception e) { Assert.fail(e.toString()); } Assert.assertTrue(response != null); Assert.assertEquals("value1", ((JSONObject) response.get("json")).get("key1")); Assert.assertEquals("value4", ((Map) ((Map) response.get("json")).get("key2")).get("key4")); Assert.assertEquals("value5", ((JSONObject) ((JSONObject) response.get("json")).get("key2")).get("key5")); Assert.assertEquals("value6", ((Map) ((JSONObject) response.get("json")).get("key3")).get("key6")); }
Source:
<code>private static void setupLoggerStorage(boolean userStorageAvailable) { boolean loggingEnabled = true; <START> if (instance().currentApp != null) { <END> loggingEnabled = HiddenPreferences.isLoggingEnabled(); } if (userStorageAvailable) { if (loggingEnabled) { Logger.registerLogger(new AndroidLogger(app.getUserStorage(AndroidLogEntry.STORAGE_KEY, AndroidLogEntry.class))); } ForceCloseLogger.registerStorage(app.getUserStorage(ForceCloseLogEntry.STORAGE_KEY, ForceCloseLogEntry.class)); XPathErrorLogger.registerStorage(app.getUserStorage(XPathErrorEntry.STORAGE_KEY, XPathErrorEntry.class)); } else { if (loggingEnabled) { Logger.registerLogger(new AndroidLogger( app.getGlobalStorage(AndroidLogEntry.STORAGE_KEY, AndroidLogEntry.class))); } ForceCloseLogger.registerStorage( app.getGlobalStorage(ForceCloseLogEntry.STORAGE_KEY, ForceCloseLogEntry.class)); } }</code><technical_language>cleaner do this check isLoggingEnabled() method return true if current app</technical_language>

Target:
private static void setupLoggerStorage(boolean userStorageAvailable) { boolean loggingEnabled = HiddenPreferences.isLoggingEnabled(); if (userStorageAvailable) { if (loggingEnabled) { Logger.registerLogger(new AndroidLogger(app.getUserStorage(AndroidLogEntry.STORAGE_KEY, AndroidLogEntry.class))); } ForceCloseLogger.registerStorage(app.getUserStorage(ForceCloseLogEntry.STORAGE_KEY, ForceCloseLogEntry.class)); XPathErrorLogger.registerStorage(app.getUserStorage(XPathErrorEntry.STORAGE_KEY, XPathErrorEntry.class)); } else { if (loggingEnabled) { Logger.registerLogger(new AndroidLogger( app.getGlobalStorage(AndroidLogEntry.STORAGE_KEY, AndroidLogEntry.class))); } ForceCloseLogger.registerStorage( app.getGlobalStorage(ForceCloseLogEntry.STORAGE_KEY, ForceCloseLogEntry.class)); } }
Source:
<code>void shutdown() { long startTime = SystemTime.getInstance().milliseconds(); try { logger.info("shutdown started"); clusterParticipant.terminate(); if (scheduler != null) { scheduler.shutdown(); if (!scheduler.awaitTermination(5, TimeUnit.MINUTES)) { logger.error("Could not terminate all tasks after scheduler shutdown"); } } if (statsManager != null) { statsManager.shutdown(); } if (networkServer != null) { networkServer.shutdown(); } if (requestHandlerPool != null) { requestHandlerPool.shutdown(); } if (replicationManager != null) { replicationManager.shutdown(); } if (storageManager != null) { storageManager.shutdown(); } if (connectionPool != null) { connectionPool.shutdown(); } if (reporter != null) { reporter.stop(); } if (notificationSystem != null) { try { notificationSystem.close(); } catch (IOException e) { logger.error("Error while closing notification system.", e); } } <START> clusterMap.close(); <END> logger.info("shutdown completed"); } catch (Exception e) { logger.error("Error while shutting down server", e); } finally { shutdownLatch.countDown(); long processingTime = SystemTime.getInstance().milliseconds() - startTime; metrics.serverShutdownTimeInMs.update(processingTime); logger.info("Server shutdown time in Ms " + processingTime); } }</code><technical_language>this null if start() is called shutdown() is. Also, is cluster map created if getClusterMap() is called</technical_language>

Target:
public void shutdown() { long startTime = SystemTime.getInstance().milliseconds(); try { logger.info("shutdown started"); if (clusterParticipant != null) { clusterParticipant.close(); } if (scheduler != null) { scheduler.shutdown(); if (!scheduler.awaitTermination(5, TimeUnit.MINUTES)) { logger.error("Could not terminate all tasks after scheduler shutdown"); } } if (statsManager != null) { statsManager.shutdown(); } if (networkServer != null) { networkServer.shutdown(); } if (requestHandlerPool != null) { requestHandlerPool.shutdown(); } if (replicationManager != null) { replicationManager.shutdown(); } if (storageManager != null) { storageManager.shutdown(); } if (connectionPool != null) { connectionPool.shutdown(); } if (reporter != null) { reporter.stop(); } if (notificationSystem != null) { try { notificationSystem.close(); } catch (IOException e) { logger.error("Error while closing notification system.", e); } } if (clusterMap != null) { clusterMap.close(); } logger.info("shutdown completed"); } catch (Exception e) { logger.error("Error while shutting down server", e); } finally { shutdownLatch.countDown(); long processingTime = SystemTime.getInstance().milliseconds() - startTime; metrics.serverShutdownTimeInMs.update(processingTime); logger.info("Server shutdown time in Ms " + processingTime); } }
Source:
<code>public void send(String fromAddress, String toAddress, String subject, String message) throws EmailSendException { Mail mail = new Mail(fromAddress, toAddress, subject, message); LOGGER.info(String.format("Sending message [%s] from [%s] to [%s] with subject [%s].", mail.getMessage(), mail.getFromAddress(), mail.getToAddress(), mail.getSubject())); try { mailSender.send(getMimeMessagePreparator(mail)); log(new EmailRecord(mail.getFromAddress(), mail.getToAddress(), mail.getSubject(), mail.getMessage(), now(), DeliveryStatus.SENT)); } catch (MailException e) { log(new EmailRecord(mail.getFromAddress(), mail.getToAddress(), mail.getSubject(), mail.getMessage(), now(), DeliveryStatus.ERROR)); <START> throw new EmailSendException("{\"Error\":\"Unable to send an email to " + mail.getToAddress() + "\"}", e); <END> } }</code><technical_language>create JSON objects here</technical_language>

Target:
public void send(String fromAddress, String toAddress, String subject, String message) throws EmailSendException { Mail mail = new Mail(fromAddress, toAddress, subject, message); LOGGER.info(String.format("Sending message [%s] from [%s] to [%s] with subject [%s].", mail.getMessage(), mail.getFromAddress(), mail.getToAddress(), mail.getSubject())); try { mailSender.send(getMimeMessagePreparator(mail)); log(new EmailRecord(mail.getFromAddress(), mail.getToAddress(), mail.getSubject(), mail.getMessage(), now(), DeliveryStatus.SENT)); } catch (MailException e) { log(new EmailRecord(mail.getFromAddress(), mail.getToAddress(), mail.getSubject(), mail.getMessage(), now(), DeliveryStatus.ERROR)); throw new EmailSendException("Unable to send an email to " + mail.getToAddress(), e); } }
Source:
<code>public @Nullable String getUnit() { <START> return null; <END> }</code><technical_language>Timestamps unit</technical_language>

Target:
public @Nullable String getUnit() { return fUnit; }
Source:
<code>private void copy(String storeId, File src, File tgt, long capacityInBytes) throws Exception { try (StoreCopier copier = new StoreCopier(storeId, src, tgt, capacityInBytes, fetchSizeInBytes, storeConfig, new MetricRegistry(), storeKeyFactory, diskIOScheduler, Collections.EMPTY_LIST, time)) { copier.copy(new StoreFindTokenFactory(storeKeyFactory).getNewFindToken()); } File[] replicas = {src, tgt}; <START> if (!consistencyChecker.checkConsistency(replicas)) { <END> throw new IllegalStateException("Data in " + src + " and " + tgt + " is not equivalent"); } }</code><technical_language>if inconsistencies other errors, making left in a good state (that is extraneous files for debugging such, ensure is data loss availability issues - server started successfully?)</technical_language>

Target:
private void copy(String storeId, File src, File tgt, long capacityInBytes) throws Exception { try (StoreCopier copier = new StoreCopier(storeId, src, tgt, capacityInBytes, fetchSizeInBytes, storeConfig, new MetricRegistry(), storeKeyFactory, diskIOScheduler, transformers, time)) { copier.copy(new StoreFindTokenFactory(storeKeyFactory).getNewFindToken()); } File[] replicas = {src, tgt}; if (!consistencyChecker.checkConsistency(replicas)) { throw new IllegalStateException("Data in " + src + " and " + tgt + " is not equivalent"); } }
Source:
<code>public MicrometerMetricsFactory(MeterRegistry meterRegistry) { <START> this.meterRegistry = meterRegistry; <END> }</code><technical_language>Assert.notNull()</technical_language>

Target:
public MicrometerMetricsFactory(MeterRegistry meterRegistry) { Assert.notNull(meterRegistry, "'meterRegistry' cannot be null"); this.meterRegistry = meterRegistry; }
Source:
<code>public InflightMessage completeMessage(Position p) { synchronized (this.linkedMap) { InflightMessage m = this.linkedMap.get(p); assert(m != null); m.isComplete = true; InflightMessage completeUntil = null; if (p.equals(head.position)) { Iterator<InflightMessage> iterator = this.linkedMap.values().iterator(); while ( iterator.hasNext() ) { InflightMessage msg = iterator.next(); if ( !msg.isComplete ) { <START> head = msg; <END> break; } completeUntil = msg; iterator.remove(); } if (isFull && linkedMap.size() < capacity) { isFull = false; this.linkedMap.notify(); } } if (producerAckTimeoutMS > 0 && isFull && head.staleness() > producerAckTimeoutMS && completePercentage() >= completePercentageThreshold) { context.terminate(new IllegalStateException( "Did not receive acknowledgement for the head of the inflight message list for " + producerAckTimeoutMS + " ms")); } return completeUntil; } }</code><technical_language>If complete _all_ pending messages in a single go, head get reset in this loop. I guess fixed next addMessage, feels dicey good invariant for head (could null some random if list is empty)y. get head on-demand linkedMap.values().iterator().next() -- marginally more expensive, (I assume) constant time - vote worth simplicity of track it</technical_language>

Target:
public InflightMessage completeMessage(Position p) { synchronized (this.linkedMap) { InflightMessage m = this.linkedMap.get(p); assert(m != null); m.isComplete = true; InflightMessage completeUntil = null; Iterator<InflightMessage> iterator = iterator(); while ( iterator.hasNext() ) { InflightMessage msg = iterator.next(); if ( !msg.isComplete ) { break; } completeUntil = msg; iterator.remove(); } if (isFull && linkedMap.size() < capacity) { isFull = false; this.linkedMap.notify(); } if (producerAckTimeoutMS > 0 && isFull) { Iterator<InflightMessage> it = iterator(); if (it.hasNext() && it.next().timeSinceSendMS() > producerAckTimeoutMS && completePercentage() >= completePercentageThreshold) { context.terminate(new IllegalStateException( "Did not receive acknowledgement for the head of the inflight message list for " + producerAckTimeoutMS + " ms")); } } return completeUntil; } }
Source:
<code>protected CommonReporter() { for (final Entry<ProblemLevel, OutputStreamFile> entry : ThreadConfig.get( Reporter.REPORTER_OUTPUT_STREAM_BY_LEVEL).entrySet()) { streamByLevel.put(entry.getKey(), entry.getValue().getPrintStream()); } <START> final Thread reporterThread = new Thread(new RunReporter()); <END> reporterThread.start(); Jack.getSession().getHooks().addHook(new Runnable() { @Override public void run() { toProcess.add(REPORTING_DONE); try { reporterThread.join(); } catch (InterruptedException e) { logger.log(Level.FINE, "Reporter hook was interrupted in " + Thread.currentThread().getName()); Thread.currentThread().interrupt(); } } }); }</code><technical_language>way, name reporter thread</technical_language>

Target:
protected CommonReporter() { for (final Entry<ProblemLevel, OutputStreamFile> entry : ThreadConfig.get( Reporter.REPORTER_OUTPUT_STREAM_BY_LEVEL).entrySet()) { streamByLevel.put(entry.getKey(), entry.getValue().getPrintStream()); } final Thread reporterThread = new Thread(new RunReporter(), "Jack reporter"); reporterThread.start(); Jack.getSession().getHooks().addHook(new Runnable() { @Override public void run() { toProcess.add(REPORTING_DONE); try { reporterThread.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }); }
Source:
<code>public void push() { <START> if (Session.getCredentials() == null || Session.getCredentials().isDemoCredentials()) { <END> Log.d(TAG, "execute mocked push"); executeMockedPush(); } else if (isLogged()) { Log.d(TAG, "execute push"); executePush(); } }</code><technical_language>if credentials is null execute mocked push</technical_language>

Target:
public void push() { if (Session.getCredentials() != null && Session.getCredentials().isDemoCredentials()) { Log.d(TAG, "execute mocked push"); executeMockedPush(); } else if (isLogged()) { Log.d(TAG, "execute push"); executePush(); } }
Source:
<code>public boolean validate(IDocument document, int offset, DocumentEvent event) { if (!isOffsetValid(offset)) return fIsValidated= false; if (isSupportingRequiredProposals() && !(((MemberProposalInfo) getProposalInfo()).fProposal).isSuffixProposal()) { fIsValidated= CharOperation.camelCaseMatch(getPrefix(document, offset).toCharArray(), TextProcessor.deprocess(getDisplayString()).toCharArray()) || CharOperation.substringMatch(getPrefix(document, offset), TextProcessor.deprocess(getDisplayString())); <START> } else <END> fIsValidated= isValidPrefix(getPrefix(document, offset)); if (fIsValidated && event != null) { int delta= (event.fText == null ? 0 : event.fText.length()) - event.fLength; final int newLength= Math.max(getReplacementLength() + delta, 0); setReplacementLength(newLength); } return fIsValidated; }</code><technical_language>Change 'else' statement block i.e. add braces</technical_language>

Target:
public boolean validate(IDocument document, int offset, DocumentEvent event) { if (!isOffsetValid(offset)) return fIsValidated= false; fIsValidated= isValidPrefix(getPrefix(document, offset)); if (fIsValidated && event != null) { int delta= (event.fText == null ? 0 : event.fText.length()) - event.fLength; final int newLength= Math.max(getReplacementLength() + delta, 0); setReplacementLength(newLength); } return fIsValidated; }
Source:
<code>public MapOperation() { final ILogger logger = this.logger(); final int forcedEvictionRetryCount = getRetryCount(); evictions = new Eviction[]{ new RecordStoreForcedEviction(forcedEvictionRetryCount, logger, this), new PartitionRecordStoreForcedEviction(forcedEvictionRetryCount, logger, this), new AllEntriesEviction(logger, this), <START> new PartitionAllEntriesEviction(logger, this) <END> }; }</code><technical_language>create a new map-operation for call, moving evictions difference</technical_language>

Target:
public MapOperation() { }
Source:
<code>public UnicastMacAddressValidation() { setExpression("^[a-fA-F0-9][02468aAcCeE](:[a-fA-F0-9]{2}){5}$"); <START> setMessage(ConstantsManager.getInstance().getConstants().invalidMacAddressMsg()); <END> }</code><technical_language>I expect a more detailed message, "This field a valid unicast MAC address"</technical_language>

Target:
public UnicastMacAddressValidation() { setExpression("^[a-fA-F0-9][02468aAcCeE](:[a-fA-F0-9]{2}){5}$"); setMessage(ConstantsManager.getInstance().getConstants().invalidUnicastMacAddressMsg()); }
Source:
<code><START> private static <END> String getMessageOrNull(AuditLogType logType) { final String key = logType.name(); try { return resourceBundle.getString(key); } catch (Exception e) { log.error("Key '{}' is not translated in '{}'", key, getResourceBundleName()); return null; } }</code><technical_language>related</technical_language>

Target:
protected static String getMessageOrNull(AuditLogType logType) { final String key = logType.name(); try { return resourceBundle.getString(key); } catch (Exception e) { log.error("Key '{}' is not translated in '{}'", key, getResourceBundleName()); return null; } }
Source:
<code>private void closeCart() { $(sidePanelContainer).removeClass(res.style().rightPanel__open()); <START> $(cartIcon).attr("class", font.icons().iconCart()); <END> $(cartButton).removeClass(res.style().active()); $(cartIcon).text(""); shoppingCartOpen = false; }</code><technical_language>change addClass remove "class"</technical_language>

Target:
private void closeCart() { $(sidePanelContainer).removeClass(res.style().rightPanel__open()); $(cartIcon).text(""); $(cartIcon).addClass(font.icons().iconCart()); $(cartButton).removeClass(res.style().active()); shoppingCartOpen = false; }
Source:
<code>private static void doubleCheck(CheckArguments param) throws CommandFormatException, IOException { if (param.getCtx() == null) { log.warn("Skip double checking by management trusted commands - CommandContext connection not set!"); return; } if (param.isSearchTypeStatus() && UNKNOWN.equals(param.getExpectedState())) { throw new IllegalStateException("Could not verify deployment state " + UNKNOWN + "!"); } <START> log.info("Double checking " + param.getName() + " with management command trusted for " + param.getGoalStr()); <END> if (param.getCtx().isTerminated()) { throw new IllegalStateException("FAILED: Could not double checking " + param.getName() + " with management operations for " + param.getGoalStr() + "!" + "Because connection to cli is closed!"); } if (param.isSearchTypeStatus()) { doubleCheckStatus(param); } else if (param.isSearchTypeExist()) { doubleCheckExist(param); } else if (param.isSearchTypeMissing()) { doubleCheckMissing(param); } else { throw new IllegalStateException("Unknown operation selected! Could not verify check!"); } log.info("Double checking " + param.getName() + " with management operations for " + param.getGoalStr() + " - Success"); }</code><technical_language>trace</technical_language>

Target:
private static void doubleCheck(CheckArguments param) throws CommandFormatException, IOException { if (param.getCtx() == null) { log.warn("Skip double checking by management trusted commands - CommandContext connection not set!"); return; } if (param.isSearchTypeStatus() && UNKNOWN.equals(param.getExpectedState())) { throw new IllegalStateException("Could not verify deployment state " + UNKNOWN + "!"); } log.trace("Double checking " + param.getName() + " with management command trusted for " + param.getGoalStr()); if (param.getCtx().isTerminated()) { throw new IllegalStateException("FAILED: Could not double checking " + param.getName() + " with management operations for " + param.getGoalStr() + "!" + "Because connection to cli is closed!"); } if (param.isSearchTypeStatus()) { doubleCheckStatus(param); } else if (param.isSearchTypeExist()) { doubleCheckExist(param); } else if (param.isSearchTypeMissing()) { doubleCheckMissing(param); } else { throw new IllegalStateException("Unknown operation selected! Could not verify check!"); } log.trace("Double checking " + param.getName() + " with management operations for " + param.getGoalStr() + " - Success"); }
Source:
<code>private void <START> validateThenCreateAccount() <END> { clearErrors(); if (!USERNAME_PATTERN.matcher(getText(usernameInput)).matches()) { usernameInput.requestFocus(); usernameInput.setError(getString(R.string.create_account_username_error)); return; } else if (getText(passwordInput).length() < PASSWORD_MIN_LENGTH) { passwordInput.requestFocus(); passwordInput.setError(getString(R.string.create_account_password_error)); return; } else if (!passwordInput.isPasswordVisible() && !getText(passwordInput).equals(getText(passwordRepeatInput))) { passwordRepeatInput.requestFocus(); passwordRepeatInput.setError(getString(R.string.create_account_passwords_mismatch_error)); return; } else if (!TextUtils.isEmpty(getText(emailInput)) && !Patterns.EMAIL_ADDRESS.matcher(getText(emailInput)).matches()) { emailInput.requestFocus(); emailInput.setError(getString(R.string.create_account_email_error)); return; } if (captchaHandler.isActive() && captchaHandler.token() != null) { doCreateAccount(captchaHandler.token()); } else { getCreateAccountInfo(); } }</code><technical_language>Consider breaking this methods: method updates UI another method validation logic returns error type, if any, some rudimentary tests it. If want punt, fine too</technical_language>

Target:
private void validateThenCreateAccount() { clearErrors(); ValidateResult result = validateInput(getText(usernameInput), getText(passwordInput), getText(passwordRepeatInput), !passwordInput.isPasswordVisible(), getText(emailInput)); switch (result) { case INVALID_USERNAME: usernameInput.requestFocus(); usernameInput.setError(getString(R.string.create_account_username_error)); return; case INVALID_PASSWORD: passwordInput.requestFocus(); passwordInput.setError(getString(R.string.create_account_password_error)); return; case PASSWORD_MISMATCH: passwordRepeatInput.requestFocus(); passwordRepeatInput.setError(getString(R.string.create_account_passwords_mismatch_error)); return; case INVALID_EMAIL: emailInput.requestFocus(); emailInput.setError(getString(R.string.create_account_email_error)); return; case SUCCESS: default: break; } if (captchaHandler.isActive() && captchaHandler.token() != null) { doCreateAccount(captchaHandler.token()); } else { getCreateAccountInfo(); } }
Source:
<code>public static MoveEntityEvent.Teleport handleDisplaceEntityTeleportEvent(final Entity entityIn, final double posX, final double posY, final double posZ, final float yaw, final float pitch) { <START> World world = ((org.spongepowered.api.entity.Entity) entityIn).getWorld(); <END> final Transform fromTransform = ((org.spongepowered.api.entity.Entity) entityIn).getTransform(); final Transform toTransform = fromTransform.withPosition(new Vector3d(posX, posY, posZ)).withRotation(new Vector3d(pitch, yaw, 0)); return handleDisplaceEntityTeleportEvent(entityIn, fromTransform, toTransform, world, world); }</code><technical_language>suggestion final World world = ((org.spongepowered.api.entity.Entity) entityIn).getWorld();</technical_language>

Target:
public static MoveEntityEvent.Teleport handleDisplaceEntityTeleportEvent(final Entity entityIn, final double posX, final double posY, final double posZ, final float yaw, final float pitch) { final World world = ((org.spongepowered.api.entity.Entity) entityIn).getWorld(); final Transform fromTransform = ((org.spongepowered.api.entity.Entity) entityIn).getTransform(); final Transform toTransform = fromTransform.withPosition(new Vector3d(posX, posY, posZ)).withRotation(new Vector3d(pitch, yaw, 0)); return handleDisplaceEntityTeleportEvent(entityIn, fromTransform, toTransform, world, world); }
Source:
<code>@Override public boolean canHandleRequest(@NonNull Request data) { Uri uri = data.uri; <START> if (uri == null) return false; <END> return SCHEME_CONTENT.equals(uri.getScheme()); }</code><technical_language>Merge return</technical_language>

Target:
@Override public boolean canHandleRequest(@NonNull Request data) { Uri uri = data.uri; return uri != null && SCHEME_CONTENT.equals(uri.getScheme()); }
Source:
<code>public void setSecondaryColor(int color) { if (date != null) { date.setTextColor(color); } if (weatherLayout != null) { weatherLayout.setColor(color); } if (weatherLayout2 != null) { weatherLayout2.setColor(color); } if (divider != null) { divider.setBackgroundColor(color); } if (analog_clock != null) { analog_clock.setSecondaryColor(color); } if (layoutId == LAYOUT_ID_DIGITAL_FLIP) { CustomDigitalFlipClock layout = findViewById(R.id.time_layout); layout.setSecondaryColor(color); <START> } Utility.colorizeView(calendarView, color, PorterDuff.Mode.MULTIPLY); Utility.colorizeView(notificationLayout, color); <END> }</code><technical_language>Please remove this mechanism for changing color. changes of colours modify individual views, e.g. night mode switches day mode</technical_language>

Target:
public void setSecondaryColor(int color) { if (date != null) { date.setTextColor(color); } if (weatherLayout != null) { weatherLayout.setColor(color); } if (weatherLayout2 != null) { weatherLayout2.setColor(color); } if (divider != null) { divider.setBackgroundColor(color); } if (analog_clock != null) { analog_clock.setSecondaryColor(color); } if (layoutId == LAYOUT_ID_DIGITAL_FLIP) { CustomDigitalFlipClock layout = findViewById(R.id.time_layout); layout.setSecondaryColor(color); } if (mediaStyleLayout != null) { View boundView = mediaStyleLayout.getChildAt(0); NotificationMediacontrolBinding mediaControlLayoutBinding = DataBindingUtil.getBinding(boundView); if (mediaControlLayoutBinding != null) { mediaControlLayoutBinding.getModel().setColor(color); mediaControlLayoutBinding.invalidateAll(); } } Utility.colorizeView(calendarView, color, PorterDuff.Mode.MULTIPLY); Utility.colorizeView(notificationLayout, color); }
Source:
<code>public CheckBoxFieldDefinition getDefaultField() { <START> CheckBoxFieldDefinition result = new CheckBoxFieldDefinition(); <END> result.setStandaloneClassName(Boolean.class.getName()); return new CheckBoxFieldDefinition(); }</code><technical_language>check here, result returned, new new CheckBoxFieldDefinition(); is returned instead. Wondering if sense setStandaloneClassName constructor a "fixed" class</technical_language>

Target:
public CheckBoxFieldDefinition getDefaultField() { return new CheckBoxFieldDefinition(); }
Source:
<code>public <T> List<ScriptResult<T>> executeScript(Script<T> script, String targetType, Set<String> targets) { final TargetType tType = TargetType.valueOf(targetType); final HashSet<RMNode> selectedRMNodes = new HashSet<>(); switch (tType) { case NODESOURCE_NAME: for (String target : targets) { <START> NodeSource nodeSource = deployedNodeSources.get(target); <END> if (nodeSource != null) { for (RMNode candidateNode : this.allNodes.values()) { if (candidateNode.getNodeSource().equals(nodeSource)) { this.selectCandidateNode(selectedRMNodes, candidateNode); } } } } break; case NODE_URL: for (String target : targets) { RMNode candidateNode = this.allNodes.get(target); if (candidateNode != null) { this.selectCandidateNode(selectedRMNodes, candidateNode); } } break; case HOSTNAME: for (String target : targets) { for (RMNode node : this.allNodes.values()) { if (node.getHostName().equals(target)) { this.selectCandidateNode(selectedRMNodes, node); break; } } } break; default: throw new IllegalArgumentException("Unable to execute script, unknown target type: " + targetType); } return this.selectionManager.executeScript(script, selectedRMNodes, null); }</code><technical_language>add this</technical_language>

Target:
public <T> List<ScriptResult<T>> executeScript(Script<T> script, String targetType, Set<String> targets) { final TargetType tType = TargetType.valueOf(targetType); final HashSet<RMNode> selectedRMNodes = new HashSet<>(); switch (tType) { case NODESOURCE_NAME: for (String target : targets) { NodeSource nodeSource = this.deployedNodeSources.get(target); if (nodeSource != null) { for (RMNode candidateNode : this.allNodes.values()) { if (candidateNode.getNodeSource().equals(nodeSource)) { this.selectCandidateNode(selectedRMNodes, candidateNode); } } } } break; case NODE_URL: for (String target : targets) { RMNode candidateNode = this.allNodes.get(target); if (candidateNode != null) { this.selectCandidateNode(selectedRMNodes, candidateNode); } } break; case HOSTNAME: for (String target : targets) { for (RMNode node : this.allNodes.values()) { if (node.getHostName().equals(target)) { this.selectCandidateNode(selectedRMNodes, node); break; } } } break; default: throw new IllegalArgumentException("Unable to execute script, unknown target type: " + targetType); } return this.selectionManager.executeScript(script, selectedRMNodes, null); }
Source:
<code>private String getValueFromPart(Element part) { String value = part.getText(); String type = part.attributeValue("localType"); <START> if (type != null) { <END> value += " (" + type + ")"; } return value; }</code><technical_language>a Objects.nonNull(type) other places changes</technical_language>

Target:
private String getValueFromPart(Element part) { String value = part.getText(); String type = part.attributeValue("localType"); if (Objects.nonNull(type)) { value += " (" + type + ")"; } return value; }
Source:
<code>private Set<String> extractTags(Set<String> input) throws <START> BadRequestException { <END> if (input == null) { return Collections.emptySet(); } else { HashSet<String> result = new HashSet<>(); for (String hashtag : input) { if (hashtag.contains(",")) { throw new BadRequestException("Hashtags may not contain commas"); } if (!hashtag.trim().isEmpty()) { result.add(hashtag.trim()); } } return result; } }</code><technical_language>Is this right abstraction level throw RestApiExceptions? RestApiExceptions sense this is called in context of REST API, called other places ChangeInserter</technical_language>

Target:
private Set<String> extractTags(Set<String> input) throws IllegalArgumentException { if (input == null) { return Collections.emptySet(); } else { HashSet<String> result = new HashSet<>(); for (String hashtag : input) { if (hashtag.contains(",")) { throw new IllegalArgumentException("Hashtags may not contain commas"); } if (!hashtag.trim().isEmpty()) { result.add(hashtag.trim()); } } return result; } }
Source:
<code><START> public void setDependentModule(TmfStateSystemAnalysisModule dependentModule) { <END> fDependentAnalysis = dependentModule; }</code><technical_language>private? set another module is identified ID..</technical_language>

Target:
private void setDependentModule(TmfStateSystemAnalysisModule dependentModule) { fDependentModule = dependentModule; }
Source:
<code>private Value getPort( PortInfo portInfo, List< InterfaceDefinition > interfaces ) { Value response = Value.create(); response.getFirstChild( "name" ).setValue( portInfo.id() ); if( portInfo instanceof InputPortInfo ) { InputPortInfo port = (InputPortInfo) portInfo; if( port.location() != null ) { response.getFirstChild( "location" ).setValue( port.location().toString() ); } else { response.getFirstChild( "location" ).setValue( "local" ); } if( port.protocol() != null ) { <START> response.getFirstChild( "protocol" ).setValue( port.protocol() ); <END> } else { response.getFirstChild( "protocol" ).setValue( "" ); } } else if( portInfo instanceof OutputPortInfo ) { OutputPortInfo port = (OutputPortInfo) portInfo; if( port.location() != null ) { response.getFirstChild( "location" ).setValue( port.location().toString() ); } else { response.getFirstChild( "location" ).setValue( "local" ); } if( port.protocol() != null ) { response.getFirstChild( "protocol" ).setValue( port.protocol() ); } else { response.getFirstChild( "protocol" ).setValue( "" ); } } List< InterfaceDefinition > interfaceList = portInfo.getInterfaceList(); for( int intf = 0; intf < interfaceList.size(); intf++ ) { InterfaceDefinition interfaceDefinition = portInfo.getInterfaceList().get( intf ); response.getChildren( "interfaces" ).get( intf ).getFirstChild( "name" ) .setValue( interfaceDefinition.name() ); interfaces = addInterfaceToList( interfaces, interfaceDefinition ); } return response; }</code><technical_language>toString()</technical_language>

Target:
private Value getPort( PortInfo portInfo, List< InterfaceDefinition > interfaces ) { Value response = Value.create(); response.getFirstChild( "name" ).setValue( portInfo.id() ); if( portInfo instanceof InputPortInfo ) { InputPortInfo port = (InputPortInfo) portInfo; if( port.location() != null ) { response.getFirstChild( "location" ).setValue( port.location().toString() ); } else { response.getFirstChild( "location" ).setValue( "local" ); } if( port.protocolId() != null ) { response.getFirstChild( "protocol" ).setValue( port.protocolId() ); } else { response.getFirstChild( "protocol" ).setValue( "" ); } } else if( portInfo instanceof OutputPortInfo ) { OutputPortInfo port = (OutputPortInfo) portInfo; if( port.location() != null ) { response.getFirstChild( "location" ).setValue( port.location().toString() ); } else { response.getFirstChild( "location" ).setValue( "local" ); } if( port.protocolId() != null ) { response.getFirstChild( "protocol" ).setValue( port.protocolId() ); } else { response.getFirstChild( "protocol" ).setValue( "" ); } } List< InterfaceDefinition > interfaceList = portInfo.getInterfaceList(); for( int intf = 0; intf < interfaceList.size(); intf++ ) { InterfaceDefinition interfaceDefinition = portInfo.getInterfaceList().get( intf ); response.getChildren( "interfaces" ).get( intf ).getFirstChild( "name" ) .setValue( interfaceDefinition.name() ); interfaces = addInterfaceToList( interfaces, interfaceDefinition ); } return response; }
Source:
<code>private void setupStalenessChecker() { if (currentRequestManager == null){ setRetryComplete(); return; } Runnable runnable = new Runnable() { @Override public void run() { synchronized (Batch.this) { if (currentRequestManager == null || currentRequestManager.isEmpty()) { setRetryComplete(); } else if (currentRequestManager.isStale()) { setFailure( io.grpc.Status.UNKNOWN.withDescription("Stale requests.").asRuntimeException()); } else { setupStalenessChecker(); } } } }; if (currentRequestManager.lastRpcSentTimeNanos != null) { long delay = currentRequestManager.calculateTimeUntilStaleNanos(); <START> stalenessFuture = retryExecutorService.schedule(runnable, delay, TimeUnit.NANOSECONDS); <END> } }</code><technical_language>stalenessFuture contained in class Batch instead of BulkMutation? batch calling setRetryComplete cancel latest batch's future, batch created it</technical_language>

Target:
private void setupStalenessChecker() { if (operationsAreComplete()){ setRetryComplete(); return; } Runnable runnable = new Runnable() { @Override public void run() { synchronized (Batch.this) { if (operationsAreComplete() || currentRequestManager.isEmpty()) { setRetryComplete(); } else if (currentRequestManager.isStale()) { setFailure( io.grpc.Status.UNKNOWN.withDescription("Stale requests.").asRuntimeException()); } else { setupStalenessChecker(); } } } }; if (currentRequestManager.lastRpcSentTimeNanos != null) { long delay = currentRequestManager.calculateTimeUntilStaleNanos(); stalenessFuture = retryExecutorService.schedule(runnable, delay, TimeUnit.NANOSECONDS); } }
Source:
<code>Point getScreenDPI () { int dpi = 96; if (GTK.GTK3) { if (GTK.GTK_VERSION <START> > OS.VERSION(3, <END> 22, 0)) { long display = GDK.gdk_display_get_default(); long pMonitor = GDK.gdk_display_get_primary_monitor(display); if (pMonitor == 0) { pMonitor = GDK.gdk_display_get_monitor(display, 0); } int widthMM = GDK.gdk_monitor_get_width_mm(pMonitor); int scaleFactor = GDK.gdk_monitor_get_scale_factor(pMonitor); GdkRectangle monitorGeometry = new GdkRectangle (); GDK.gdk_monitor_get_geometry(pMonitor, monitorGeometry); dpi = Compatibility.round (254 * monitorGeometry.width * scaleFactor, widthMM * 10); } } else { int widthMM = GDK.gdk_screen_width_mm (); int width = GDK.gdk_screen_width (); dpi = Compatibility.round (254 * width, widthMM * 10); } return new Point (dpi, dpi); }</code><technical_language>commit message "gtk 3.22 onwards I new api 3.22". >= here</technical_language>

Target:
Point getScreenDPI () { int dpi = 96; if (GTK.GTK3) { if (GTK.GTK_VERSION >= OS.VERSION(3, 22, 0)) { long display = GDK.gdk_display_get_default(); long pMonitor = GDK.gdk_display_get_primary_monitor(display); if (pMonitor == 0) { pMonitor = GDK.gdk_display_get_monitor(display, 0); } int widthMM = GDK.gdk_monitor_get_width_mm(pMonitor); int scaleFactor = GDK.gdk_monitor_get_scale_factor(pMonitor); GdkRectangle monitorGeometry = new GdkRectangle (); GDK.gdk_monitor_get_geometry(pMonitor, monitorGeometry); dpi = Compatibility.round (254 * monitorGeometry.width * scaleFactor, widthMM * 10); } } else { int widthMM = GDK.gdk_screen_width_mm (); int width = GDK.gdk_screen_width (); dpi = Compatibility.round (254 * width, widthMM * 10); } return new Point (dpi, dpi); }
Source:
<code>public ScrollTransform<Integer> createScrollTransform( Integer limit, Supplier<AsyncFuture<SearchResponse>> scroller ){ final OptionalLimit optionalLimit = OptionalLimit.of(limit); <START> return new ScrollTransform<>(async, optionalLimit, scroller, Object::hashCode); <END> }</code><technical_language>[Object#hashCode()](<LINK_0> is guaranteed unique (!a.equals(b) && a.hashCode() == b.hashCode() true). is safer Function.identity() do equals comparisons actual SearchHits. unique individual mocks</technical_language>

Target:
public ScrollTransform<SearchHit> createScrollTransform( Integer limit, Supplier<AsyncFuture<SearchResponse>> scroller ){ final OptionalLimit optionalLimit = OptionalLimit.of(limit); return new ScrollTransform<>(async, optionalLimit, scroller, Function.identity()); }
Source:
<code>boolean accept(String name, Set<String> names) { <START> return !names.contains(HaxePresentableUtil.getterName(name)) || <END> !names.contains(HaxePresentableUtil.setterName(name)); }</code><technical_language>this fix. this add a getter setter if exists in place? (e.g. if a setter, accept, allow a new getter, should, /and/ allow a setter?)</technical_language>

Target:
boolean accept(String name, Set<String> names) { return !names.contains(HaxePresentableUtil.getterName(name)); }
Source:
<code>private void setLocationByZip(final String zip) { Runnable r = new Runnable() { @Override public void run() { Location l = LocationUtils.getLocationFromZip(getContext(), zip); if (l != null) { mLocationHelper.onLocationChanged(l); setMyLocation(l, true, true); } else { <START> Toast.makeText(getContext(), getString(R.string.main_ziplocation_error), <END> Toast.LENGTH_SHORT).show(); } } }; r.run(); }</code><technical_language>getContext() getApplicationContext(), Toast trigger this Activity is destroyed</technical_language>

Target:
private void setLocationByZip(final String zip) { final Handler h = new Handler(); h.post(new Runnable() { @Override public void run() { Location l = LocationUtils.getLocationFromZip( Application.get().getApplicationContext(), zip); if (l != null && mLocationHelper != null) { mLocationHelper.onLocationChanged(l); setMyLocation(l, true, true); } else { Toast.makeText(Application.get().getApplicationContext(), getString(R.string.main_ziplocation_error), Toast.LENGTH_SHORT).show(); } } }); }
Source:
<code>public boolean isVideoAdBiggerThanImageAd(double videoHeight, double imageHeight) { int percentResult = (int)Math.round(100-(100/(videoHeight/imageHeight))); if (percentResult == PERCENTAGE_DIFFERENCE_BETWEEN_VIDEO_AND_IMAGE_AD) { <START> return true; <END> } PageObjectLogging.log("isVideoAdBiggerThanImageAdOasis", "Expected percentage difference between video height and image height is not equal with " + PERCENTAGE_DIFFERENCE_BETWEEN_VIDEO_AND_IMAGE_AD + " percent", false, driver); return false; }</code><technical_language>result of comparison returned</technical_language>

Target:
public boolean isVideoAdBiggerThanImageAd(double videoHeight, double imageHeight) { int percentResult = (int)Math.round(100-(100/(videoHeight/imageHeight))); return percentResult == PERCENTAGE_DIFFERENCE_BETWEEN_VIDEO_AND_IMAGE_AD; }
Source:
<code>public LabelTypes getLabelTypes() { Set<LabelType> r = <START> Sets.newTreeSet(new <END> Comparator<LabelType>() { @Override public int compare(LabelType o1, LabelType o2) { return o1.getName().compareTo(o2.getName()); } }); String destBranch = getChange().getDest().get(); for (LabelType l : getProjectControl().getLabelTypes().getLabelTypes()) { List<String> refs = l.getBranches(); if (refs == null) { r.add(l); } else { for (String b : refs) { if (RefConfigSection.isValid(b) && match(destBranch, b)) { r.add(l); break; } } } } return new LabelTypes(Lists.newArrayList(r)); }</code><technical_language>do need sorted name? I considered a feature admins control order of labels changing order in project.config (though inheritance this more complicated). ISTR some other discussions this issue check do elsewhere? Also, if end this, IMHO Guava's Ordering more readable: Sets.newTreeSet(Ordering.natural().onResultOf(new Function<LabelType, String>() { @Override public String apply(LabelType in) { return in.getName(); } });</technical_language>

Target:
public LabelTypes getLabelTypes() { Set<LabelType> r = Sets.newTreeSet(Ordering.natural().onResultOf( new Function<LabelType, String>() { @Override public String apply(LabelType in) { return in.getName(); } })); String destBranch = getChange().getDest().get(); for (LabelType l : getProjectControl().getLabelTypes().getLabelTypes()) { List<String> refs = l.getRefPatterns(); if (refs == null) { r.add(l); } else { for (String b : refs) { if (RefConfigSection.isValid(b) && match(destBranch, b)) { r.add(l); break; } } } } return new LabelTypes(Lists.newArrayList(r)); }
Source:
<code>List<String> getFilteredKeys(BibEntry entry, StandardField operator) { Optional<String> citingS = entry.getField(operator); if (citingS.isEmpty()) { <START> LOGGER.info(entry.getField(StandardField.TITLE).orElse("no title") + ": " + operator.getName() + " is empty!"); <END> return new ArrayList<>(); } ArrayList<String> keys = new ArrayList<>(Arrays.asList(citingS.get().split(","))); filterNonExisting(keys); entry.setField(operator, String.join(",", keys)); LOGGER.info(entry.getField(StandardField.TITLE).orElse("no title") + ": " + operator.getName() + ": " + String.join(",", keys)); return keys; }</code><technical_language>please this debug instead of info (here elsewhere)</technical_language>

Target:
List<String> getFilteredKeys(BibEntry entry, StandardField operator) { Optional<String> citingS = entry.getField(operator); if (citingS.isEmpty()) { LOGGER.debug("{}: is empty!", entry.getField(StandardField.TITLE).orElse("no title"), operator.getName()); return new ArrayList<>(); } ArrayList<String> keys = new ArrayList<>(Arrays.asList(citingS.get().split(","))); filterNonExisting(keys); entry.setField(operator, String.join(",", keys)); LOGGER.debug("{}: {}: {}", entry.getField(StandardField.TITLE).orElse("no title"), operator.getName(), String.join(",", keys)); return keys; }
Source:
<code>public void testSwaggerDocs() throws Exception { <START> Response response = invokeGet(getContextRoot(3)+"docs/"); <END> if (response.getStatus()!=200) { response = invokeGet(getContextRoot(1)+"api-docs?url="+getContextRoot(1)+"swagger.json"); } assertResponse(response); assertThat(Jsoup.parse(responseStr).title()).isIn("Execution Server Documentation", "Swagger UI"); }</code><technical_language>please close response in end of test</technical_language>

Target:
public void testSwaggerDocs() throws Exception { Response response = invokeGet(getContextRoot(3)+"docs/"); if (response.getStatus()!=200) { response = invokeGet(getContextRoot(1)+"api-docs?url="+getContextRoot(1)+"swagger.json"); } assertResponse(response); responseStr = response.readEntity(String.class); response.close(); assertThat(Jsoup.parse(responseStr).title()).isIn("Execution Server Documentation", "Swagger UI"); }