auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private ObjCClass(long handle, Class<? extends ObjCObject> type, String name, boolean custom) { super(handle, false); this.type = type; this.name = name; this.custom = custom; if (custom) { <START> ObjCObject.ObjectOwnershipHelper.registerClass(this); <END> } }</code><technical_language>I this call end of ObjCClass.register() method. ObjCClass instance is created</technical_language>

Target:
private ObjCClass(long handle, Class<? extends ObjCObject> type, String name, boolean custom) { super(handle, false); this.type = type; this.name = name; this.custom = custom; }
Source:
<code>public boolean undo() { if (s3Client.doesObjectExist(bucket, previousVersionFilePath)) { try { s3Client.copyObject(bucket, previousVersionFilePath, bucket, remoteFilePath); } catch (SdkClientException e) { <START> LOG.log(Level.SEVERE, "Error undoing deploying", e); <END> return false; } } return true; }</code><technical_language>replace "Error deploying" more descriptive? undo why</technical_language>

Target:
public boolean undo() { if (s3Client.doesObjectExist(bucket, previousVersionFilePath)) { try { s3Client.copyObject(bucket, previousVersionFilePath, bucket, remoteFilePath); } catch (SdkClientException e) { LOG.log(Level.SEVERE, "Reverting to previous topology version failed", e); return false; } } return true; }
Source:
<code>public CassandraYesNoType() { <START> super( CharacterStringGridTypeDescriptor.INSTANCE, org.hibernate.type.YesNoType.INSTANCE.getJavaTypeDescriptor() ); <END> }</code><technical_language>check this works alternatively: super( new TranslatingGridTypeDescriptor( Character.class ), org.hibernate.type.YesNoType.INSTANCE.getJavaTypeDescriptor() ); save new grid descriptor type. type business is perfect btw., high agenda rework that. thanks for fighting :)</technical_language>

Target:
public CassandraYesNoType() { super( StringMappedGridTypeDescriptor.INSTANCE, org.hibernate.type.YesNoType.INSTANCE.getJavaTypeDescriptor() ); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); NotificationUtil.subscribeToTopics(environment, this); <START> NotificationUtil.logFirebaseToken(); <END> initWhatsNew(); addClickListenerOnProfileButton(); }</code><technical_language>Is this right place for this code? this in MainApplication class guarded Config#areFirebasePushNotificationsEnabled check</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initWhatsNew(); addClickListenerOnProfileButton(); }
Source:
<code>protected I prepareInteractor(String actionName) { if (_customInteractorListener != null) { I customResult = (I) _customInteractorListener.createInteractor(actionName); if (customResult != null) { <START> customResult.onScreenletAttached(this); <END> _interactors.put(actionName, customResult); return customResult; } } I result = createInteractor(actionName); if (result != null) { result.onScreenletAttached(this); _interactors.put(actionName, result); } return result; }</code><technical_language>Code repeated. Get interactor custom listener (if exists), else get template method. For both, attach, put return</technical_language>

Target:
protected I prepareInteractor(String actionName) { I result = _customInteractorListener == null ? createInteractor(actionName) : (I) _customInteractorListener.createInteractor(actionName); if (result != null) { result.onScreenletAttached(this); _interactors.put(actionName, result); } return result; }
Source:
<code>public void createFile(JDBCSequentialFile file) throws SQLException { try (Connection connection = connectionProvider.getConnection()) { <START> try (PreparedStatement createFile = connection.prepareStatement(this.createFile)) { <END> connection.setAutoCommit(false); Long oid = largeObjectManager.createLO(connection); createFile.setString(1, file.getFileName()); createFile.setString(2, file.getExtension()); createFile.setLong(3, oid); createFile.executeUpdate(); try (ResultSet keys = createFile.getGeneratedKeys()) { keys.next(); file.setId(keys.getLong(1)); } connection.commit(); } catch (SQLException e) { connection.rollback(); throw e; } } }</code><technical_language>need pass Statement.RETURN_GENERATED_KEYS argument (check line 55 previous code)</technical_language>

Target:
public void createFile(JDBCSequentialFile file) throws SQLException { try (Connection connection = connectionProvider.getConnection()) { try (PreparedStatement createFile = connection.prepareStatement(this.createFile, this.createFileAutogeneratedKeys)) { connection.setAutoCommit(false); Long oid = largeObjectManager.createLO(connection); createFile.setString(1, file.getFileName()); createFile.setString(2, file.getExtension()); createFile.setLong(3, oid); createFile.executeUpdate(); try (ResultSet keys = createFile.getGeneratedKeys()) { keys.next(); file.setId(keys.getLong(1)); } connection.commit(); } catch (SQLException e) { connection.rollback(); throw e; } } }
Source:
<code>public void updateMessage() throws Exception { assertThat(modifier.createEdit(change, getCurrentPatchSet(changeId))) .isEqualTo(RefUpdate.Result.NEW); Optional<ChangeEdit> edit = editUtil.byChange(change); try { modifier.modifyMessage( edit.get(), edit.get().getEditCommit().getFullMessage()); <START> fail("InvalidChangeOperationException expected"); <END> } catch (UnchangedCommitMessage ex) { assertThat(ex.getMessage()).isEqualTo( "New commit message cannot be same as existing commit message"); } String msg = String.format("New commit message\n\nChange-Id: %s", change.getKey()); assertThat(modifier.modifyMessage(edit.get(), msg)).isEqualTo( RefUpdate.Result.FORCED); edit = editUtil.byChange(change); assertThat(edit.get().getEditCommit().getFullMessage()).isEqualTo(msg); editUtil.publish(edit.get()); assertThat(editUtil.byChange(change).isPresent()).isFalse(); ChangeInfo info = get(changeId, ListChangesOption.CURRENT_COMMIT, ListChangesOption.CURRENT_REVISION); assertThat(info.revisions.get(info.currentRevision).commit.message) .isEqualTo(msg); }</code><technical_language>UnchangedCommitMessage</technical_language>

Target:
public void updateMessage() throws Exception { assertThat(modifier.createEdit(change, getCurrentPatchSet(changeId))) .isEqualTo(RefUpdate.Result.NEW); Optional<ChangeEdit> edit = editUtil.byChange(change); try { modifier.modifyMessage( edit.get(), edit.get().getEditCommit().getFullMessage()); fail("UnchangedCommitMessage expected"); } catch (UnchangedCommitMessageException ex) { assertThat(ex.getMessage()).isEqualTo( "New commit message cannot be same as existing commit message"); } String msg = String.format("New commit message\n\nChange-Id: %s", change.getKey()); assertThat(modifier.modifyMessage(edit.get(), msg)).isEqualTo( RefUpdate.Result.FORCED); edit = editUtil.byChange(change); assertThat(edit.get().getEditCommit().getFullMessage()).isEqualTo(msg); editUtil.publish(edit.get()); assertThat(editUtil.byChange(change).isPresent()).isFalse(); ChangeInfo info = get(changeId, ListChangesOption.CURRENT_COMMIT, ListChangesOption.CURRENT_REVISION); assertThat(info.revisions.get(info.currentRevision).commit.message) .isEqualTo(msg); }
Source:
<code>private void testGuts(FileTailingMessageProducerSupport adapter, String field) throws Exception { final List<FileTailingEvent> events = new ArrayList<FileTailingEvent>(); adapter.setApplicationEventPublisher(new ApplicationEventPublisher() { @Override public void publishEvent(ApplicationEvent event) { FileTailingEvent tailEvent = (FileTailingEvent) event; logger.warn(event); events.add(tailEvent); } }); adapter.setFile(new File(testDir, "foo")); QueueChannel outputChannel = new QueueChannel(); adapter.setOutputChannel(outputChannel); adapter.afterPropertiesSet(); File file = new File(testDir, "foo"); File renamed = new File(testDir, "bar"); file.delete(); renamed.delete(); adapter.start(); waitForField(adapter, field); FileOutputStream foo = new FileOutputStream(file); for (int i = 0; i < 50; i++) { foo.write(("hello" + i + "\n").getBytes()); } foo.flush(); for (int i = 0; i < 50; i++) { Message<?> message = outputChannel.receive(5000); <START> assertNotNull(message); <END> assertEquals("hello" + i, message.getPayload()); } file.renameTo(renamed); foo.close(); foo = new FileOutputStream(file); if (adapter instanceof ApacheCommonsFileTailingMessageProducer) { Thread.sleep(1000); } for (int i = 50; i < 100; i++) { foo.write(("hello" + i + "\n").getBytes()); } foo.flush(); for (int i = 50; i < 100; i++) { Message<?> message = outputChannel.receive(3000); assertNotNull(message); assertEquals("hello" + i, message.getPayload()); } foo.close(); adapter.stop(); }</code><technical_language>add assertion message: assertNotNull("message null", message);</technical_language>

Target:
private void testGuts(FileTailingMessageProducerSupport adapter, String field) throws Exception { this.adapter = adapter; final List<FileTailingEvent> events = new ArrayList<FileTailingEvent>(); adapter.setApplicationEventPublisher(new ApplicationEventPublisher() { @Override public void publishEvent(ApplicationEvent event) { FileTailingEvent tailEvent = (FileTailingEvent) event; logger.warn(event); events.add(tailEvent); } }); adapter.setFile(new File(testDir, "foo")); QueueChannel outputChannel = new QueueChannel(); adapter.setOutputChannel(outputChannel); adapter.setTailAttemptsDelay(500); adapter.afterPropertiesSet(); File file = new File(testDir, "foo"); File renamed = new File(testDir, "bar"); file.delete(); renamed.delete(); adapter.start(); waitForField(adapter, field); FileOutputStream foo = new FileOutputStream(file); for (int i = 0; i < 50; i++) { foo.write(("hello" + i + "\n").getBytes()); } foo.flush(); for (int i = 0; i < 50; i++) { Message<?> message = outputChannel.receive(5000); assertNotNull("expected a non-null message", message); assertEquals("hello" + i, message.getPayload()); } file.renameTo(renamed); foo.close(); foo = new FileOutputStream(file); if (adapter instanceof ApacheCommonsFileTailingMessageProducer) { Thread.sleep(1000); } for (int i = 50; i < 100; i++) { foo.write(("hello" + i + "\n").getBytes()); } foo.flush(); for (int i = 50; i < 100; i++) { Message<?> message = outputChannel.receive(3000); assertNotNull("expected a non-null message", message); assertEquals("hello" + i, message.getPayload()); } foo.close(); }
Source:
<code><START> public String getDirectoryUrl() { <END> return azureFileStorageClient.url(); }</code><technical_language>This return a URL</technical_language>

Target:
public URL getDirectoryUrl() { try { return new URL(azureFileStorageClient.url()); } catch (MalformedURLException e) { throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureFileStorageClient.url()), e); } }
Source:
<code>protected Collection<? extends FieldAccessorFactory> createAccessorFactories() { return Arrays.<FieldAccessorFactory>asList( new IdFieldAccessorFactory(template), new TransientFieldAccessorFactory(), new LabelFieldAccessorFactory(template), new TraversalFieldAccessorFactory(template), new QueryFieldAccessorFactory(template), new PropertyFieldAccessorFactory(template), new ConvertingNodePropertyFieldAccessorFactory(template), new GenericNodePropertyFieldAccessorFactory(template), new RelatedToSingleFieldAccessorFactory(template), new RelatedToCollectionFieldAccessorFactory(template), new ReadOnlyRelatedToCollectionFieldAccessorFactory(template), new RelatedToViaCollectionFieldAccessorFactory(template), new RelatedToViaSingleFieldAccessorFactory(template), new DynamicPropertiesFieldAccessorFactory(template) <START> <END> ); }</code><technical_language>I in list, or</technical_language>

Target:
protected Collection<? extends FieldAccessorFactory> createAccessorFactories() { return Arrays.<FieldAccessorFactory>asList( new IdFieldAccessorFactory(template), new TransientFieldAccessorFactory(), new LabelFieldAccessorFactory(template), new TraversalFieldAccessorFactory(template), new QueryFieldAccessorFactory(template), new PropertyFieldAccessorFactory(template), new ConvertingNodePropertyFieldAccessorFactory(template), new RelatedToSingleFieldAccessorFactory(template), new RelatedToCollectionFieldAccessorFactory(template), new ReadOnlyRelatedToCollectionFieldAccessorFactory(template), new RelatedToViaCollectionFieldAccessorFactory(template), new RelatedToViaSingleFieldAccessorFactory(template), new DynamicPropertiesFieldAccessorFactory(template), new GenericNodePropertyFieldAccessorFactory(template) ); }
Source:
<code><START> public static DimensionHandler getHandlerFromCapabilities( <END> String dimensionName, ColumnCapabilities capabilities, MultiValueHandling multiValueHandling ) { if (capabilities == null) { return new StringDimensionHandler(dimensionName, multiValueHandling); } if (dimensionName.equals(Column.TIME_COLUMN_NAME)) { return new StringDimensionHandler(Column.TIME_COLUMN_NAME, MultiValueHandling.ARRAY); } multiValueHandling = multiValueHandling == null ? MultiValueHandling.ofDefault() : multiValueHandling; if (capabilities.getType() == ValueType.STRING) { if (!capabilities.isDictionaryEncoded() || !capabilities.hasBitmapIndexes()) { throw new IAE("String column must have dictionary encoding and bitmap index."); } return new StringDimensionHandler(dimensionName, multiValueHandling); } return new StringDimensionHandler(dimensionName, multiValueHandling); }</code><technical_language>This a lot of work basically return new StringDimensionHandler(dimensionName, multiValueHandling), I assume meant fleshed out a bit later</technical_language>

Target:
public static DimensionHandler getHandlerFromCapabilities( String dimensionName, ColumnCapabilities capabilities, MultiValueHandling multiValueHandling ) { if (capabilities == null) { return new StringDimensionHandler(dimensionName, multiValueHandling); } multiValueHandling = multiValueHandling == null ? MultiValueHandling.ofDefault() : multiValueHandling; if (capabilities.getType() == ValueType.STRING) { if (!capabilities.isDictionaryEncoded() || !capabilities.hasBitmapIndexes()) { throw new IAE("String column must have dictionary encoding and bitmap index."); } return new StringDimensionHandler(dimensionName, multiValueHandling); } return new StringDimensionHandler(dimensionName, multiValueHandling); }
Source:
<code>private Map<String, String> getVersionStrings() { <START> final Script command = new Script(_versionstringpath, _timeout.getMillis(), s_logger); <END> final KeyValueInterpreter kvi = new KeyValueInterpreter(); final String result = command.execute(kvi); if (result == null) { return kvi.getKeyValues(); } else { return new HashMap<String, String>(1); } }</code><technical_language>Please consider adding overridden version of Script(String, int, Logger) constructor accepts Duration encapsulate this type conversion</technical_language>

Target:
private Map<String, String> getVersionStrings() { final Script command = new Script(_versionstringpath, _timeout, s_logger); final KeyValueInterpreter kvi = new KeyValueInterpreter(); final String result = command.execute(kvi); if (result == null) { return kvi.getKeyValues(); } else { return new HashMap<String, String>(1); } }
Source:
<code><START> public CommandTaskNew() { <END> super(); }</code><technical_language>constructors exist for codec / jackson protected private. handle warning</technical_language>

Target:
private CommandTaskNew() { super(); }
Source:
<code>public static void dumpDiagnosticsForAll(@Nonnull PrintWriter w) { for (Ref ref : ACTIVE_CHANNELS.values().toArray(new Ref[0])) { Channel ch = ref.channel(); if (ch != null) { try { <START> ch.dumpDiagnostics(w); <END> } catch (Throwable ex) { if (ex instanceof Error) { throw (Error)ex; } logger.log(Level.WARNING, String.format("Cannot dump diagnostics for the channel %s", ch.getName()), ex); } } } }</code><technical_language>If performance concerned, I recommend adding if (w.checkError()) { return; } sense continuing if PrintWriter suppressed IOE</technical_language>

Target:
public static void dumpDiagnosticsForAll(@Nonnull PrintWriter w) { final Ref[] channels = ACTIVE_CHANNELS.values().toArray(new Ref[0]); int processedCount = 0; for (Ref ref : channels) { if (w.checkError()) { logger.log(Level.WARNING, String.format("Cannot dump diagnostics for all channels, because output stream encountered an error. " + "Processed %d of %d channels, first unprocessed channel reference is %s.", processedCount, channels.length, ref )); break; } final Channel ch = ref.channel(); if (ch != null) { try { ch.dumpDiagnostics(w); } catch (Throwable ex) { if (ex instanceof Error) { throw (Error)ex; } w.printf("Cannot dump diagnostics for the channel %s. %s. See Error stacktrace in system logs", ch.getName(), ex.getMessage()); logger.log(Level.WARNING, String.format("Cannot dump diagnostics for the channel %s", ch.getName()), ex); } } processedCount++; } }
Source:
<code>public Note get(String noteId, String revId, AuthenticationInfo subject) { Note revisionNote = null; try { <START> if (isDefaultRepoGit()) { <END> revisionNote = ((NotebookRepoWithVersionControl) getRepo(0)).get(noteId, revId, subject); } } catch (IOException e) { LOG.error("Failed to get revision of note {}", revId, noteId, e); } return revisionNote; }</code><technical_language>Git is implementation of version control, getRepo(0) instanceof NotebookRepoWithVersionControl</technical_language>

Target:
public Note get(String noteId, String revId, AuthenticationInfo subject) { Note revisionNote = null; try { if (isRevisionSupportedInDefaultRepo()) { revisionNote = ((NotebookRepoWithVersionControl) getRepo(0)).get(noteId, revId, subject); } } catch (IOException e) { LOG.error("Failed to get revision of note {}", revId, noteId, e); } return revisionNote; }
Source:
<code>public String getDialectFromPath(String uriPath) { if (uriPath == null) return UNKNOWN_DIALECT_VALUE; if (uriPath.startsWith("/w/api.php")) return UNKNOWN_DIALECT_VALUE; if (uriPath.equals("/") || uriPath.equals("/wiki") || uriPath.equals("/w") || uriPath.startsWith("/wiki/") || uriPath.startsWith("/w/")) return DEFAULT_DIALECT_VALUE; int startIdx = uriPath.indexOf("/"); <START> startIdx = (startIdx >= 0)?(startIdx + 1):startIdx; <END> int middleIdx = uriPath.indexOf("-", startIdx); int endIdx = uriPath.indexOf("/", startIdx); endIdx = (endIdx > 0)?endIdx:(uriPath.length()); if ((startIdx >= 0) && (startIdx < endIdx)) { if ((middleIdx > 0) && (middleIdx < endIdx)) return uriPath.substring(startIdx, endIdx); else return DEFAULT_DIALECT_VALUE; } return UNKNOWN_DIALECT_VALUE; }</code><technical_language>spaces expressions please: (startIdx >= 0) ? (startIdx + 1) : startIdx; below</technical_language>

Target:
public String getDialectFromPath(String uriPath) { String normPath = normalizeUriPath(uriPath); if (normPath.startsWith("/w/api.php")) return UNKNOWN_DIALECT_VALUE; if (normPath.equals("/") || normPath.equals("/wiki") || normPath.equals("/w") || normPath.startsWith("/wiki/") || normPath.startsWith("/w/")) return DEFAULT_DIALECT_VALUE; int startIdx = normPath.indexOf("/"); startIdx = (startIdx >= 0) ? (startIdx + 1) : startIdx; int middleIdx = normPath.indexOf("-", startIdx); int endIdx = normPath.indexOf("/", startIdx); endIdx = (endIdx > 0) ? endIdx : (normPath.length()); if ((startIdx >= 0) && (startIdx < endIdx)) { if ((middleIdx > 0) && (middleIdx < endIdx)) return normPath.substring(startIdx, endIdx); else return DEFAULT_DIALECT_VALUE; } return UNKNOWN_DIALECT_VALUE; }
Source:
<code>public boolean verifyAllResultsPanelBodyVisibility(boolean visible){ int numOfQns = browser.driver.findElements(By.cssSelector(".panel-heading+.panel-collapse")).size(); assertTrue(numOfQns > 0); <START> ThreadHelper.waitFor(numOfQns * 50); <END> for(WebElement e : browser.driver.findElements(By.cssSelector(".panel-heading+.panel-collapse"))){ if(e.isDisplayed() != visible){ return false; } } return true; }</code><technical_language>i need add a slightly longer wait. exact timing failures slower computers. +1 it</technical_language>

Target:
public boolean verifyAllResultsPanelBodyVisibility(boolean visible){ int numOfQns = browser.driver.findElements(By.cssSelector(".panel-heading+.panel-collapse")).size(); assertTrue(numOfQns > 0); ThreadHelper.waitFor((numOfQns * 50) + 1000); for(WebElement e : browser.driver.findElements(By.cssSelector(".panel-heading+.panel-collapse"))){ if(e.isDisplayed() != visible){ return false; } } return true; }
Source:
<code><START> public void startProxy() throws Exception { <END> mProxyProcess = ProxyProcess.Factory.create(); Runnable runProxy = () -> { try { mProxyProcess.start(); } catch (InterruptedException e) { } catch (Exception e) { LOG.error("Start proxy error", e); throw new RuntimeException(e + " \n Start Proxy Error \n" + e.getMessage(), e); } }; mProxyThread = new Thread(runProxy); mProxyThread.setName("ProxyThread-" + System.identityHashCode(mProxyThread)); mProxyThread.start(); TestUtils.waitForReady(mProxyProcess); }</code><technical_language>reason need change this</technical_language>

Target:
private void startProxy() throws Exception { mProxyProcess = ProxyProcess.Factory.create(); Runnable runProxy = () -> { try { mProxyProcess.start(); } catch (InterruptedException e) { } catch (Exception e) { LOG.error("Start proxy error", e); throw new RuntimeException(e + " \n Start Proxy Error \n" + e.getMessage(), e); } }; mProxyThread = new Thread(runProxy); mProxyThread.setName("ProxyThread-" + System.identityHashCode(mProxyThread)); mProxyThread.start(); TestUtils.waitForReady(mProxyProcess); }
Source:
<code>protected void clickOk() { WebElement okButton = getDriver().findElement(By.id("ok")); <START> if (okButton != null) { <END> okButton.click(); } else { throw new IllegalArgumentException("Ok button is not available to click"); } }</code><technical_language>WebDriver#findElement throw NoSuchElementException if element exist, null here. AbstractElement#findElementIfExists get element null, more sense remove null check allow NoSuchElementException thrown in clickCancel</technical_language>

Target:
protected void clickOk() { WebElement okButton = getDriver().findElement(By.id("ok")); okButton.click(); }
Source:
<code>public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { <START> if (mode == DirectoryListMode.ALL || mode == DirectoryListMode.DIRS_ONLY) { <END> paths.add(dir); } return FileVisitResult.CONTINUE; }</code><technical_language>This kind of logic is indicative of awkward separation of list modes. I prefer a Set<DirectoryListMode> provide a simple factories construct sets a la filesOnly(), dirsOnly(), all(). This way, this condition modes.contains(DirectoryListMode.DIRS)</technical_language>

Target:
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (mode.contains(ListDirectoryMode.DIRS)) { paths.add(dir); } return FileVisitResult.CONTINUE; }
Source:
<code>public Action<?, ?> finsihedAction() { return new AbstractChangePrimaryGatewayAction<>(StackEvent.class) { @Inject private OperationService operationService; @Override protected void doExecute(ChangePrimaryGatewayContext context, StackEvent payload, Map<Object, Object> variables) { Stack stack = context.getStack(); SuccessDetails successDetails = new SuccessDetails(stack.getEnvironmentCrn()); <START> if (isFinalChain(variables)) { <END> stackStatusCheckerJob.syncAStack(stack); } else { stackUpdater.updateStackStatus(stack.getId(), getChangePrimaryGatewayCompleteStatus(variables), "Finished changing the primary gateway"); } if (isFinalChain(variables)) { successDetails.getAdditionalDetails().put("DownscaleHosts", getDownscaleHosts(variables)); successDetails.getAdditionalDetails().put("UpscaleHosts", getUpscaleHosts(variables)); operationService.completeOperation(stack.getAccountId(), getOperationId(variables), List.of(successDetails), Collections.emptyList()); } sendEvent(context, CHANGE_PRIMARY_GATEWAY_FINISHED_EVENT.selector(), new StackEvent(stack.getId())); } }; }</code><technical_language>this if combined if starting line 162</technical_language>

Target:
public Action<?, ?> finsihedAction() { return new AbstractChangePrimaryGatewayAction<>(StackEvent.class) { @Inject private OperationService operationService; @Override protected void doExecute(ChangePrimaryGatewayContext context, StackEvent payload, Map<Object, Object> variables) { Stack stack = context.getStack(); SuccessDetails successDetails = new SuccessDetails(stack.getEnvironmentCrn()); if (isFinalChain(variables)) { stackStatusCheckerJob.syncAStack(stack); successDetails.getAdditionalDetails().put("DownscaleHosts", getDownscaleHosts(variables)); successDetails.getAdditionalDetails().put("UpscaleHosts", getUpscaleHosts(variables)); operationService.completeOperation(stack.getAccountId(), getOperationId(variables), List.of(successDetails), Collections.emptyList()); } else { stackUpdater.updateStackStatus(stack.getId(), DetailedStackStatus.REPAIR_IN_PROGRESS, "Finished changing the primary gateway"); } sendEvent(context, CHANGE_PRIMARY_GATEWAY_FINISHED_EVENT.selector(), new StackEvent(stack.getId())); } }; }
Source:
<code>public void activate(Object operatorID) { Long count = datastore.entityCount(OperatorEntity.class, Filter.where("_id").is(operatorID)); if (count == 0) { <START> throw new OperatorException("Operator is undefined!"); <END> } datastore.update(OperatorEntity.class, Filter.where("_id").is(operatorID), UpdateStatement.update("state").toBe(OperatorState.ACTIVE.name())); }</code><technical_language>thrown a NotFoundException (if is declared, create it). This exception catch in interceptor response 404 found</technical_language>

Target:
public void activate(Object operatorID) { Long count = datastore.entityCount(OperatorEntity.class, Filter.where("_id").is(operatorID)); if (count == 0) { throw new NotFoundException("Operator is undefined!"); } datastore.update(OperatorEntity.class, Filter.where("_id").is(operatorID), UpdateStatement.update("state").toBe(OperatorState.ACTIVE.name())); }
Source:
<code>public Set<OperatingSystem> listImages() { Set<OperatingSystem> result = Sets.newHashSet(); Set<SoftwareDescription> unfiltered = api.getSoftwareDescriptionApi().getAllObjects(); Set<OperatingSystem> osAvailable = createObjectOptionsSupplier.get().getVirtualGuestOperatingSystems(); for (OperatingSystem os : osAvailable) { final String operatingSystemReferenceCode = os.getOperatingSystemReferenceCode(); result.addAll( FluentIterable.from(unfiltered) .filter(new Predicate<SoftwareDescription>() { @Override public boolean apply(SoftwareDescription input) { <START> return input.getOperatingSystem() == 1 && input.getReferenceCode().equals <END> (operatingSystemReferenceCode); } }) .transform(new Function<SoftwareDescription, OperatingSystem>() { @Override public OperatingSystem apply(SoftwareDescription input) { return OperatingSystem.builder() .id(input.getName()) .softwareLicense(SoftwareLicense.builder().softwareDescription(input).build()) .build(); } }) .toSet() ); } return result; }</code><technical_language>Replace 1 a constant describes is</technical_language>

Target:
public Set<OperatingSystem> listImages() { Set<OperatingSystem> result = Sets.newHashSet(); Set<SoftwareDescription> unfiltered = api.getSoftwareDescriptionApi().getAllObjects(); Set<OperatingSystem> operatingSystemsAvailable = createObjectOptionsSupplier.get() .getVirtualGuestOperatingSystems(); for (OperatingSystem os : operatingSystemsAvailable) { final String osReferenceCode = os.getOperatingSystemReferenceCode(); final String osId = os.getId(); result.addAll(FluentIterable.from(unfiltered) .filter(new Predicate<SoftwareDescription>() { @Override public boolean apply(SoftwareDescription input) { return isOperatingSystem(input) && input.getReferenceCode().equals(osReferenceCode); } }) .transform(new SoftwareDescriptionToOperatingSystem(osId, osReferenceCode)) .toSet() ); } Set<VirtualGuestBlockDeviceTemplateGroup> privateImages = api.getAccountApi().getBlockDeviceTemplateGroups(); Map<String, SoftwareDescription> privateImagesSoftwareDescriptions = extractSoftwareDescriptions(privateImages); for (Map.Entry<String, SoftwareDescription> entry : privateImagesSoftwareDescriptions.entrySet()) { OperatingSystem os = getOperatingSystem(entry); if (os != null) { result.add(os); } } if (includePublicImages) { Set<VirtualGuestBlockDeviceTemplateGroup> publicImages = api.getVirtualGuestBlockDeviceTemplateGroupApi().getPublicImages(); Map<String, SoftwareDescription> publicImagesSoftwareDescriptions = extractSoftwareDescriptions(publicImages); for (Map.Entry<String, SoftwareDescription> entry : publicImagesSoftwareDescriptions.entrySet()) { OperatingSystem os = getOperatingSystem(entry); if (os != null) { result.add(os); } } } return result; }
Source:
<code>public Map<ContainerKeyPrefix, Integer> getKeyPrefixesForContainer( long containerId) throws IOException { <START> return getKeyPrefixesForContainer(containerId, ""); <END> }</code><technical_language>StringUtils.EMPTY</technical_language>

Target:
public Map<ContainerKeyPrefix, Integer> getKeyPrefixesForContainer( long containerId) throws IOException { return getKeyPrefixesForContainer(containerId, StringUtils.EMPTY); }
Source:
<code>public Organization buildObject(Result source, Oaf resolvedOafObject) throws UnsupportedEncodingException { Preconditions.checkNotNull(resolvedOafObject); <START> Preconditions.checkNotNull(source); <END> OafEntity oafEntity = resolvedOafObject.getEntity(); if (!isDataCorrect(source, oafEntity)) { return null; } eu.dnetlib.data.proto.OrganizationProtos.Organization srcOrganization = oafEntity.getOrganization(); Organization.Builder orgBuilder = Organization.newBuilder(); orgBuilder.setId(oafEntity.getId()); Metadata srcOrgMetadata = srcOrganization.getMetadata(); orgBuilder.setName(srcOrgMetadata.getLegalname().getValue()); orgBuilder.setShortName(srcOrgMetadata.getLegalshortname().getValue()); orgBuilder.setCountryName(srcOrgMetadata.getCountry().getClassname()); orgBuilder.setCountryCode(srcOrgMetadata.getCountry().getClassid()); orgBuilder.setWebsiteUrl(srcOrgMetadata.getWebsiteurl().getValue()); return orgBuilder.build(); }</code><technical_language>care source in this context. If resolvedOafObject is null fine</technical_language>

Target:
public Organization buildObject(Result source, Oaf resolvedOafObject) throws UnsupportedEncodingException { Preconditions.checkNotNull(resolvedOafObject); OafEntity oafEntity = resolvedOafObject.getEntity(); if (!isDataCorrect(oafEntity)) { return null; } eu.dnetlib.data.proto.OrganizationProtos.Organization srcOrganization = oafEntity.getOrganization(); Organization.Builder orgBuilder = Organization.newBuilder(); orgBuilder.setId(oafEntity.getId()); Metadata srcOrgMetadata = srcOrganization.getMetadata(); orgBuilder.setName(srcOrgMetadata.getLegalname().getValue()); orgBuilder.setShortName(srcOrgMetadata.getLegalshortname().getValue()); orgBuilder.setCountryName(srcOrgMetadata.getCountry().getClassname()); orgBuilder.setCountryCode(srcOrgMetadata.getCountry().getClassid()); orgBuilder.setWebsiteUrl(srcOrgMetadata.getWebsiteurl().getValue()); return orgBuilder.build(); }
Source:
<code>TestRow(String someString, Integer someInteger, Double someDouble, String someDate, Boolean someBoolean) { <START> this.stringField = someString; <END> this.integerField = someInteger; this.doubleField = (someDouble == null) ? null : WrappedBigDecimal.fromDouble(someDouble); this.dateField = WebUtils.parseDate(someDate); this.booleanField = someBoolean; }</code><technical_language>If some, removing this.s</technical_language>

Target:
TestRow(String someString, Integer someInteger, Double someDouble, String someDate, Boolean someBoolean) { stringField = someString; integerField = someInteger; doubleField = (someDouble == null) ? null : WrappedBigDecimal.fromDouble(someDouble); dateField = WebUtils.parseDate(someDate); booleanField = someBoolean; }
Source:
<code>protected boolean canDoAction() { boolean returnValue = true; <START> if (isAttachDetachAllowedForVmStatus(getVm().getstatus())) { <END> setVdsId(getVm().getrun_on_vds().getValue()); if (isHotPlugNicAllowedForVmStatus(getVm().getstatus())) { returnValue = canPerformHotPlug(); } } else { addCanDoActionMessage(VdcBllMessages.HOT_PLUG_NIC_VM_STATUS_ILLEGAL); returnValue = false; } if (returnValue) { vmDevice = getVmDeviceDao().get(new VmDeviceId(getParameters().getNicId(), getParameters().getVmId())); if (vmDevice == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.VM_INTERFACE_NOT_EXIST); } } return returnValue; }</code><technical_language>please rename match action: activate/deactivate</technical_language>

Target:
protected boolean canDoAction() { boolean returnValue = true; if (isActivateDeactivateAllowedForVmStatus(getVm().getstatus())) { setVdsId(getVm().getrun_on_vds().getValue()); if (VmHandler.isHotPlugNicAllowedForVmStatus(getVm().getstatus())) { returnValue = canPerformHotPlug(); } } else { addCanDoActionMessage(VdcBllMessages.HOT_PLUG_NIC_VM_STATUS_ILLEGAL); returnValue = false; } if (returnValue) { vmDevice = getVmDeviceDao().get(new VmDeviceId(getParameters().getNicId(), getParameters().getVmId())); if (vmDevice == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.VM_INTERFACE_NOT_EXIST); } } return returnValue; }
Source:
<code>private boolean isAcceptedConfigurationAdminEntry(ImportMigrationConfigurationAdminEntry entry) { if (ACCEPTED_ENTRY_PIDS.contains(entry.getPid())) { return true; } <START> if (entry.getFactoryPid() != null) { <END> if (ACCEPTED_ENTRY_FACTORY_PIDS.contains(entry.getFactoryPid()) || StringUtils.containsIgnoreCase(entry.getFactoryPid(), "source") || StringUtils.containsIgnoreCase(entry.getFactoryPid(), "service")) { return true; } } return false; }</code><technical_language>need this null check. If factoryPid is null, next condition return false ACCEPTED_ENTRY_FACTORY_PIDS null of items</technical_language>

Target:
private boolean isAcceptedConfigurationAdminEntry(ImportMigrationConfigurationAdminEntry entry) { return (ACCEPTED_ENTRY_PIDS.contains(entry.getPid()) || ACCEPTED_ENTRY_FACTORY_PIDS.contains(entry.getFactoryPid()) || isASource(entry.getFactoryPid())); }
Source:
<code>private void registerStoreStatistics(ServerStoreImpl store, String storeName) throws InvalidStoreException { STAT_STORE_METHOD_REFERENCES.entrySet().stream().forEach((entry)-> <START> registerStatistic(store, storeName, entry.getKey(), STATISTICS_STORE_TAG, PROPERTY_STORE_KEY, new Callable<Number>() { <END> @Override public Number call() throws Exception { return entry.getValue().apply(store); } }) ); }</code><technical_language>better: need explicitly create Callable. invoking entry.getValue().apply(store) allow a Callable</technical_language>

Target:
private void registerStoreStatistics(ServerStoreImpl store, String storeName) throws InvalidStoreException { STAT_STORE_METHOD_REFERENCES.entrySet().stream().forEach((entry)-> registerStatistic(store, storeName, entry.getKey(), STATISTICS_STORE_TAG, PROPERTY_STORE_KEY, () -> entry.getValue().apply(store) )); }
Source:
<code>public ExecutorComparator(Map<String,Integer> comparatorList) { if (null == comparatorList|| comparatorList.size() == 0){ logger.error("failed to initialize executor comparator as the passed comparator list is invalid or empty."); <START> throw new IllegalArgumentException("filterList"); <END> } for (Entry<String,Integer> entry : comparatorList.entrySet()){ if (comparatorCreatorRepository.containsKey(entry.getKey())){ this.registerFactorComparator(comparatorCreatorRepository. get(entry.getKey()). create(entry.getValue())); } else { logger.error(String.format("failed to initialize executor comparator as the comparator implementation for requested factor '%s' doesn't exist.", entry.getKey())); throw new IllegalArgumentException("comparatorList"); } } }</code><technical_language>I move message IllegalArgumentException exception. log statement is optional</technical_language>

Target:
public ExecutorComparator(Map<String,Integer> comparatorList) { if (null == comparatorList|| comparatorList.size() == 0){ throw new IllegalArgumentException("failed to initialize executor comparator" + "as the passed comparator list is invalid or empty."); } for (Entry<String,Integer> entry : comparatorList.entrySet()){ if (comparatorCreatorRepository.containsKey(entry.getKey())){ this.registerFactorComparator(comparatorCreatorRepository. get(entry.getKey()). create(entry.getValue())); } else { throw new IllegalArgumentException(String.format("failed to initialize executor comparator " + "as the comparator implementation for requested factor '%s' doesn't exist.", entry.getKey())); } } }
Source:
<code><START> public PrimitiveStringifier valueStringifier(PrimitiveType primitiveType) { <END> throw new UnsupportedOperationException("Stringifier is not supported for the logical type: " + this); }</code><technical_language>PrimitiveType.stringifier() is for API user. This package protected</technical_language>

Target:
PrimitiveStringifier valueStringifier(PrimitiveType primitiveType) { throw new UnsupportedOperationException("Stringifier is not supported for the logical type: " + this); }
Source:
<code>public void invalidIntReturnIs500() throws NoSuchMethodException { Set<ConstraintViolation<ConstraintViolationsTest>> violations = execValidator.validateReturnValue( new ConstraintViolationsTest(), ConstraintViolationsTest.class.getMethod("theIntTest", Integer.class), 4 ); assertThat(violations).hasSize(1); Set<ConstraintViolation<?>> copy = ConstraintViolations.copyOf(violations); <START> assertThat(ConstraintViolations.determineStatus(copy)).isEqualTo(500); <END> }</code><technical_language>change signature of ConstraintViolations.determineStatus java public static int determineStatus(Set<ConstraintViolation<?>> violations) java public static <T> int determineStatus(Set<ConstraintViolation<T>> violations) so, avoid making a copy</technical_language>

Target:
public void invalidIntReturnIs500() { Set<ConstraintViolation<ConstraintViolationsTest>> violations = execValidator.validateReturnValue( this, getAccessibleMethod(getClass(), "theIntTest", Integer.class), 4 ); assertThat(violations).hasSize(1); assertThat(ConstraintViolations.determineStatus(violations)).isEqualTo(500); }
Source:
<code>public String lineProtocol(final TimeUnit precision) { final StringBuilder sb = CACHED_STRINGBUILDERS.get(); sb.setLength(0); escapeKey(sb, measurement); concatenatedTags(sb); concatenatedFields(sb); <START> if (precision != null) { <END> formatedTime(sb, precision); } else { formatedTime(sb); } return sb.toString(); }</code><technical_language>This check is necessary. formatedTime is it</technical_language>

Target:
public String lineProtocol(final TimeUnit precision) { StringBuilder sb = CACHED_STRINGBUILDERS.get(); sb.setLength(0); escapeKey(sb, measurement); concatenatedTags(sb); concatenatedFields(sb); formatedTime(sb, precision); return sb.toString(); }
Source:
<code>synchronized boolean tryAcquirePersistentLock() { Preconditions.checkState(!isShutDown, "This PersistentLockManager is shut down, and cannot be used to acquire locks."); try { lockId = persistentLockService.acquireBackupLock("Sweep"); referenceCount++; log.info("Successfully acquired persistent lock for sweep: {}", SafeArg.of("lockId", lockId)); return true; } catch (CheckAndSetException e) { List<byte[]> actualValues = e.getActualValues(); if (!actualValues.isEmpty()) { LockEntry actualEntry = LockEntry.fromStoredValue(actualValues.get(0)); log.info("CAS failed on lock acquire. We thought the lockId was {}, and the database has {}", SafeArg.of("lockId", lockId), SafeArg.of("actualEntry", actualEntry)); if (lockId != null && actualEntry.instanceId().equals(lockId.value())) { referenceCount++; <START> log.info("Attempted to acquire the a new lock when we already held a lock." <END> + " The acquire failed, but our lock is still valid, so we still hold the lock."); return true; } else { referenceCount = 0; lockId = null; } } lockFailureMeter.mark(); log.warn("Failed to acquire persistent lock for sweep. Waiting and retrying."); return false; } catch (NotInitializedException e) { log.info("The LockStore is not initialized yet. Waiting and retrying."); return false; } }</code><technical_language>nit: acquire a new lock</technical_language>

Target:
synchronized boolean tryAcquirePersistentLock() { Preconditions.checkState(!isShutDown, "This PersistentLockManager is shut down, and cannot be used to acquire locks."); try { lockId = persistentLockService.acquireBackupLock("Sweep"); referenceCount++; log.info("Successfully acquired persistent lock for sweep: {}", SafeArg.of("lockId", lockId)); return true; } catch (CheckAndSetException e) { List<byte[]> actualValues = e.getActualValues(); if (!actualValues.isEmpty()) { LockEntry actualEntry = LockEntry.fromStoredValue(actualValues.get(0)); log.info("CAS failed on lock acquire. We thought the lockId was {}, and the database has {}", SafeArg.of("lockId", lockId), SafeArg.of("actualEntry", actualEntry)); if (lockId != null && actualEntry.instanceId().equals(lockId.value())) { referenceCount++; log.info("Attempted to acquire a new lock when we already held a lock." + " The acquire failed, but our lock is still valid, so we still hold the lock."); return true; } else { referenceCount = 0; lockId = null; } } lockFailureMeter.mark(); log.warn("Failed to acquire persistent lock for sweep. Waiting and retrying."); return false; } catch (NotInitializedException e) { log.info("The LockStore is not initialized yet. Waiting and retrying."); return false; } }
Source:
<code>public boolean canBeInstantiated() { <START> return (this.modifiers & (ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation | ExtraCompilerModifiers.AccRecord)) == 0; <END> }</code><technical_language>This incorrect - Record instantiated</technical_language>

Target:
public boolean canBeInstantiated() { return (this.modifiers & (ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) == 0; }
Source:
<code>public Iterable<Hardware> listHardwareProfiles() { Set<Hardware> hardware = Sets.newLinkedHashSet(); hardware.add(new HardwareBuilder().ids("micro").hypervisor("lxc").name("micro").ram(512).build()); hardware.add(new HardwareBuilder().ids("small").hypervisor("lxc").name("small").ram(1024).build()); hardware.add(new HardwareBuilder().ids("medium").hypervisor("lxc").name("medium").ram(2048).build()); hardware.add(new HardwareBuilder().ids("large").hypervisor("lxc").name("large").ram(3072).build()); <START> return hardware; <END> }</code><technical_language>list of hardware profiles include cpu. I improve here: - Provide more cpu/ram combinations (otherwise is enough flexible), providers CloudSigma do (those hardcoded hardware profiles). - Create a Supplier<Hardware>, qualified @Default avoid collisions jclouds hardware supplier, people bind hardware profiles if need ones</technical_language>

Target:
public Iterable<Hardware> listHardwareProfiles() { Set<Hardware> hardware = Sets.newLinkedHashSet(); hardware.add(new HardwareBuilder().ids("micro").hypervisor("lxc").name("micro").processor(new Processor(1, 1)).ram(512).build()); hardware.add(new HardwareBuilder().ids("small").hypervisor("lxc").name("small").processor(new Processor(1, 1)).ram(1024).build()); hardware.add(new HardwareBuilder().ids("medium").hypervisor("lxc").name("medium").processor(new Processor(1, 1)).ram(2048).build()); hardware.add(new HardwareBuilder().ids("large").hypervisor("lxc").name("large").processor(new Processor(1, 1)).ram(3072).build()); return hardware; }
Source:
<code>public void run() { <START> CompletableFuture.runAsync(super::run, executorService); <END> }</code><technical_language>CompletableFuture.runAsync instead of executorService.execute(super::run)</technical_language>

Target:
public void run() { executorService.submit(internalLeaderElector::run); }
Source:
<code>public void beginProcessing(String charset) { final Builder builder = DetectorOptions.newBuilder() .reporter(this) .format(format) .message(message) .minimum(minimum) .maximum(maximum) .ignoreCase(ignoreCase); if (matchAcrossLines) { <START> builder.compileFlags(Pattern.DOTALL); <END> } else { builder.compileFlags(Pattern.MULTILINE); } final DetectorOptions options = builder.build(); detector = new MultilineDetector(options); }</code><technical_language>please extract this if-else method getRegexCompileFlags</technical_language>

Target:
public void beginProcessing(String charset) { final DetectorOptions options = DetectorOptions.newBuilder() .reporter(this) .compileFlags(getRegexCompileFlags()) .format(format) .message(message) .minimum(minimum) .maximum(maximum) .ignoreCase(ignoreCase) .build(); detector = new MultilineDetector(options); }
Source:
<code>public void start() throws Exception { if (serializedExecutor == null) { LOG.debug("{} Starting leadership controller...", logPrefix()); <START> serializedExecutor = Executors.newSingleThreadScheduledExecutor(); <END> leaderNotifier = new TimedLeaderNotifier(this.eventHandler); leaderNotifier.start(); serializedExecutor.execute(this::refreshStatus); } }</code><technical_language>CamelContext.getExecutorServiceManager().newSingleThreadScheduledExecutor(...)</technical_language>

Target:
public void start() throws Exception { if (serializedExecutor == null) { LOG.debug("{} Starting leadership controller...", logPrefix()); serializedExecutor = camelContext.getExecutorServiceManager().newSingleThreadScheduledExecutor(this, "CamelKubernetesLeadershipController"); leaderNotifier = new TimedLeaderNotifier(this.camelContext, this.eventHandler); leaderNotifier.start(); serializedExecutor.execute(this::refreshStatus); } }
Source:
<code>public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 3) { throw new IAE("function '%s' needs 3 arguments", name()); } final String arg = args.get(0).eval(bindings).asString(); final int index = args.get(1).eval(bindings).asInt(); final ExprEval lengthExprEval = args.get(2).eval(bindings); final int end = lengthExprEval.asInt() >= 0 ? index + lengthExprEval.asInt() : -1; <START> if (arg == null) { <END> return ExprEval.of(null); } if (index < arg.length()) { if (end > 0) { return ExprEval.of(arg.substring(index, Math.min(end, arg.length()))); } else { return ExprEval.of(arg.substring(index)); } } else { return ExprEval.of(null); } }</code><technical_language>move this block</technical_language>

Target:
public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 3) { throw new IAE("Function[%s] needs 3 arguments", name()); } final String arg = args.get(0).eval(bindings).asString(); if (arg == null) { return ExprEval.of(null); } final int index = args.get(1).eval(bindings).asInt(); final int length = args.get(2).eval(bindings).asInt(); if (index < arg.length()) { if (length >= 0) { return ExprEval.of(arg.substring(index, Math.min(index + length, arg.length()))); } else { return ExprEval.of(arg.substring(index)); } } else { return ExprEval.of(null); } }
Source:
<code>public void onResume() { super.onResume(); <START> if (mBlog != null && !mBlogTitleTextView.getText().equals(mBlog.getBlogName())) { <END> mBlogTitleTextView.setText(mBlog.getBlogName()); } if (ServiceUtils.isServiceRunning(getActivity(), StatsService.class)) { getActivity().stopService(new Intent(getActivity(), StatsService.class)); } long delayMs = getResources().getInteger(R.integer.fab_animation_delay); new Handler().postDelayed(new Runnable() { @Override public void run() { if (isAdded() && mBlog != null && (mFabView.getVisibility() != View.VISIBLE || mFabView.getTranslationY() != 0)) { AniUtils.showFab(mFabView, true); } } }, delayMs); }</code><technical_language>This is blog title is set in [refreshBlogDetails](<LINK_0></technical_language>

Target:
public void onResume() { super.onResume(); final Blog blog = WordPress.getBlog(mBlogLocalId); refreshBlogDetails(blog); if (ServiceUtils.isServiceRunning(getActivity(), StatsService.class)) { getActivity().stopService(new Intent(getActivity(), StatsService.class)); } long delayMs = getResources().getInteger(R.integer.fab_animation_delay); new Handler().postDelayed(new Runnable() { @Override public void run() { if (isAdded() && blog != null && (mFabView.getVisibility() != View.VISIBLE || mFabView.getTranslationY() != 0)) { AniUtils.showFab(mFabView, true); } } }, delayMs); }