auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void init(IViewSite site) throws PartInitException { super.init(site); for (ModelExplorerTabDescriptor tabDescriptor : ModelExplorerTabRegistry.getRegisteredExtensions()) { IModelExplorerTabExtension tab = tabDescriptor.getTabExtension(); if (tab != null) { tab.init(site); } } for (Session session : SessionManager.INSTANCE.getSessions()) { PermissionAuthorityRegistry.getDefault().getPermissionAuthority(session.getTransactionalEditingDomain().getResourceSet()).addAuthorityListener(this); } permissionAuthoritySessionManagerListener = new PermissionAuthoritySessionManagerListener(this); <START> SessionManager.INSTANCE.addSessionsListener(permissionAuthoritySessionManagerListener); <END> }</code><technical_language>this code encapsulated in PermissionAuthoritySessionManagerListener constructor</technical_language>

Target:
public void init(IViewSite site) throws PartInitException { super.init(site); for (ModelExplorerTabDescriptor tabDescriptor : ModelExplorerTabRegistry.getRegisteredExtensions()) { IModelExplorerTabExtension tab = tabDescriptor.getTabExtension(); if (tab != null) { tab.init(site); } } lockDecorationUpdater.register(this); }
Source:
<code>public void setParallel(Supplier<Integer> width){ <START> output._json().addProperty(PortProperties.PARTITIONED, true); <END> output._json().addProperty(PortProperties.WIDTH, width.get()); }</code><technical_language>I partitioned</technical_language>

Target:
public TStream<T> setParallel(Supplier<Integer> width){ BOutputPort output = (BOutputPort)this.output; output.operator().addConfig(OpProperties.PARALLEL, true); output.operator().addConfig(OpProperties.WIDTH, width.get()); throw new UnsupportedOperationException("setParallel is not implemented."); }
Source:
<code>public static AddToReadingListDialog newInstance(@NonNull List<PageTitle> titles, InvokeSource source, @Nullable DialogInterface.OnDismissListener listener) { AddToReadingListDialog dialog = new AddToReadingListDialog(); Bundle args = new Bundle(); args.putParcelableArrayList("titles", new ArrayList<Parcelable>(titles)); <START> args.putSerializable("source", <END> source); dialog.setArguments(args); dialog.setOnDismissListener(listener); return dialog; }</code><technical_language>putSerializable() here, putInt(ordinal) in previous patch. this consistent</technical_language>

Target:
public static AddToReadingListDialog newInstance(@NonNull List<PageTitle> titles, InvokeSource source, @Nullable DialogInterface.OnDismissListener listener) { AddToReadingListDialog dialog = new AddToReadingListDialog(); Bundle args = new Bundle(); args.putParcelableArrayList("titles", new ArrayList<Parcelable>(titles)); args.putInt("source", source.ordinal()); dialog.setArguments(args); dialog.setOnDismissListener(listener); return dialog; }
Source:
<code>public void setup() { <START> if ( canSetUp ) { <END> eventBusHandlerRegistrations.add( eventBus.addHandler( ValidateEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( DeleteRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AfterColumnDeleted.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( UpdateColumnDataEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AppendRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( InsertRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AfterColumnInserted.TYPE, analyzerController ) ); } canSetUp = false; }</code><technical_language>Yeah this works it... nicer record HandlerRegistration add(...) method reattach handler if registration is null.. change works.</technical_language>

Target:
public void setup() { if ( eventBusHandlerRegistrations.isEmpty() ) { eventBusHandlerRegistrations.add( eventBus.addHandler( ValidateEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( DeleteRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AfterColumnDeleted.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( UpdateColumnDataEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AppendRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( InsertRowEvent.TYPE, analyzerController ) ); eventBusHandlerRegistrations.add( eventBus.addHandler( AfterColumnInserted.TYPE, analyzerController ) ); } }
Source:
<code>private static TransformerFactory getTransformerFactory(String transformerFactoryImplClass) { <START> if (transformerFactoryImplClass == null || transformerFactoryImplClass.length() <= 0) { <END> return TransformerFactory.newInstance(); } else { return TransformerFactory.newInstance(transformerFactoryImplClass, ClassLoader.getSystemClassLoader()); } }</code><technical_language>if (StringUtils.hasText(...) { replace this (and check for whitespace)</technical_language>

Target:
private static TransformerFactory getTransformerFactory(String transformerFactoryImplClass) { TransformerFactory transformerFactory = null; if (transformerFactoryImplClass == null || transformerFactoryImplClass.length() <= 0) { transformerFactory = TransformerFactory.newInstance(); } else if(ClassUtils.isPresent(transformerFactoryImplClass, ClassLoader.getSystemClassLoader())) { transformerFactory = TransformerFactory.newInstance(transformerFactoryImplClass, ClassLoader.getSystemClassLoader()); } else { if (logger.isWarnEnabled()) { logger.warn(String.format("Class [%s] was not found will default to [%s], please ensure [%s] is located on your class path", transformerFactoryImplClass, TransformerFactory.class, transformerFactoryImplClass)); } transformerFactory = TransformerFactory.newInstance(); } return transformerFactory; }
Source:
<code>public static File getArchiveForCoordinate(MavenCoordinate mavenCoordinate) { String sdkLocation = AndroidSdkUtils.tryToChooseAndroidSdk().getLocation(); String path = String.format(SUPPORT_REPOSITORY_BASE_PATH, sdkLocation, mavenCoordinate.getArtifactId()); String revisionPath = String.format(MAVEN_REVISION_PATH, mavenCoordinate.getFullRevision(), mavenCoordinate.getArtifactId(), mavenCoordinate.getFullRevision()); <START> return new File(path, revisionPath); <END> }</code><technical_language>need do a toSystemDependent call too, SUPPORT_REPOSITORY_BASE_PATH / File.separator</technical_language>

Target:
public static File getArchiveForCoordinate(MavenCoordinate mavenCoordinate) { String sdkLocation = AndroidSdkUtils.tryToChooseAndroidSdk().getLocation(); String path = String.format(SUPPORT_REPOSITORY_BASE_PATH, sdkLocation, mavenCoordinate.getArtifactId()); path = FileUtil.toSystemDependentName(path); String revisionPath = String.format(MAVEN_REVISION_PATH, mavenCoordinate.getFullRevision(), mavenCoordinate.getArtifactId(), mavenCoordinate.getFullRevision()); revisionPath = FileUtil.toSystemDependentName(revisionPath); return new File(path, revisionPath); }
Source:
<code>public static OSDeviceState getDeviceState() { <START> if (shouldLogUserPrivacyConsentErrorMessageForMethodName("getDeviceState()")) <END> return null; if (appContext == null) { logger.error("OneSignal.initWithContext has not been called. Could not get OSDeviceState"); return null; } OSSubscriptionState subscriptionStatus = getCurrentSubscriptionState(appContext); OSPermissionState permissionStatus = getCurrentPermissionState(appContext); OSEmailSubscriptionState emailSubscriptionStatus = getCurrentEmailSubscriptionState(appContext); return new OSDeviceState(subscriptionStatus, permissionStatus, emailSubscriptionStatus); }</code><technical_language>Consent needed this is a getter, network requests</technical_language>

Target:
public static OSDeviceState getDeviceState() { if (appContext == null) { logger.error("OneSignal.initWithContext has not been called. Could not get OSDeviceState"); return null; } OSSubscriptionState subscriptionStatus = getCurrentSubscriptionState(appContext); OSPermissionState permissionStatus = getCurrentPermissionState(appContext); OSEmailSubscriptionState emailSubscriptionStatus = getCurrentEmailSubscriptionState(appContext); return new OSDeviceState(subscriptionStatus, permissionStatus, emailSubscriptionStatus); }
Source:
<code>public void testPutAll_without_cache_writer() throws Exception { CacheConfigurationBuilder cacheConfigurationBuilder = CacheConfigurationBuilder.newCacheConfigurationBuilder(); CacheConfiguration<String, String> cacheConfiguration = cacheConfigurationBuilder.buildCacheConfig(String.class, String.class); <START> CacheManagerBuilder<CacheManager> managerBuilder = CacheManagerBuilder.newCacheManagerBuilder(); <END> CacheManager cacheManager = managerBuilder.withCache("myCache", cacheConfiguration).build(); Cache<String, String> myCache = cacheManager.getCache("myCache", String.class, String.class); HashMap<String, String> stringStringHashMap = new HashMap<String, String>(); for (int i = 0; i < 100; i++) { stringStringHashMap.put("key" + i, "value" + i); } myCache.putAll(stringStringHashMap.entrySet()); for (int i = 0; i < 100; i++) { assertThat(myCache.get("key" + i), is("value" + i)); } }</code><technical_language>lines beginning of this method (and others) this setup fixture (@Before). Then, for methods require a writer loader, reference CacheManagerBuilder field, append .using(...) needed</technical_language>

Target:
public void testPutAll_without_cache_writer() throws Exception { CacheConfigurationBuilder cacheConfigurationBuilder = CacheConfigurationBuilder.newCacheConfigurationBuilder(); CacheConfiguration<String, String> cacheConfiguration = cacheConfigurationBuilder.buildCacheConfig(String.class, String.class); CacheManagerBuilder<CacheManager> managerBuilder = CacheManagerBuilder.newCacheManagerBuilder(); CacheManager cacheManager = managerBuilder.withCache("myCache", cacheConfiguration).build(); Cache<String, String> myCache = cacheManager.getCache("myCache", String.class, String.class); HashMap<String, String> stringStringHashMap = new HashMap<String, String>(); for (int i = 0; i < 3; i++) { stringStringHashMap.put("key" + i, "value" + i); } myCache.putAll(stringStringHashMap.entrySet()); for (int i = 0; i < 3; i++) { assertThat(myCache.get("key" + i), is("value" + i)); } }
Source:
<code>public Mono<Response<BlockBlobItem>> uploadWithResponse(Flux<ByteBuffer> data, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions accessConditions) { <START> return determineUploadFullOrChunked(data, (stream) -> <END> uploadInChunks(stream, parallelTransferOptions, headers, metadata, tier, accessConditions), (stream, length) -> getBlockBlobAsyncClient().uploadWithResponse(stream, length, headers, metadata, tier,accessConditions)); }</code><technical_language>I prefer try/catch in public api instead of in a private method called here. some exceptions thrown calling private method</technical_language>

Target:
public Mono<Response<BlockBlobItem>> uploadWithResponse(Flux<ByteBuffer> data, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions accessConditions) { try { Objects.requireNonNull(data, "'data' must not be null"); BlobRequestConditions validatedAccessConditions = accessConditions == null ? new BlobRequestConditions() : accessConditions; final ParallelTransferOptions validatedParallelTransferOptions = parallelTransferOptions == null ? new ParallelTransferOptions(null, null, null) : new ParallelTransferOptions(parallelTransferOptions.getBlockSize(), parallelTransferOptions.getNumBuffers(), parallelTransferOptions.getProgressReceiver()); BlockBlobAsyncClient blockBlobAsyncClient = getBlockBlobAsyncClient(); Function<Flux<ByteBuffer>, Mono<Response<BlockBlobItem>>> uploadInChunksFunction = (stream) -> uploadInChunks(blockBlobAsyncClient, stream, validatedParallelTransferOptions, headers, metadata, tier, validatedAccessConditions); BiFunction<Flux<ByteBuffer>, Long, Mono<Response<BlockBlobItem>>> uploadFullBlobMethod = (stream, length) -> blockBlobAsyncClient.uploadWithResponse(ProgressReporter .addProgressReporting(stream, validatedParallelTransferOptions.getProgressReceiver()), length, headers, metadata, tier, null, validatedAccessConditions); return determineUploadFullOrChunked(data, uploadInChunksFunction, uploadFullBlobMethod); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
<code>private X509ExtendedTrustManager getLinkedTrustMananger(X509Certificate[] chain, SSLEngine sslEngine) { if (sslEngine != null) { <START> String peer = sslEngine.getPeerHost() + ":" + sslEngine.getPeerPort(); <END> X509ExtendedTrustManager trustManager = linkedTrustManager.getOrDefault(peer, EMPTY_QUEUE).peek(); if (trustManager != null) { logger.trace("Found trustManager by sslEngine peer/host: {}", peer); return trustManager; } else { logger.trace("Did NOT find trustManager by sslEngine peer/host: {}", peer); } } return getLinkedTrustMananger(chain); }</code><technical_language>if sslEngine.getPeerHost() returns NULL</technical_language>

Target:
private X509ExtendedTrustManager getLinkedTrustMananger(X509Certificate[] chain, SSLEngine sslEngine) { if (sslEngine != null) { X509ExtendedTrustManager trustManager = null; String peer = null; if (sslEngine.getPeerHost() != null) { peer = sslEngine.getPeerHost() + ":" + sslEngine.getPeerPort(); trustManager = linkedTrustManager.getOrDefault(peer, EMPTY_QUEUE).peek(); } if (trustManager != null) { logger.trace("Found trustManager by sslEngine peer/host: {}", peer); return trustManager; } else { logger.trace("Did NOT find trustManager by sslEngine peer/host: {}", peer); } } return getLinkedTrustMananger(chain); }
Source:
<code><START> private void assertStoredEntry(InternalCacheEntry entry, Object expectedValue, long expectedLifespan, String src, Object key) { <END> assert entry != null : src + " entry for key " + key + " should NOT be null"; assert entry.getValue().equals(expectedValue) : src + " should contain value " + expectedValue + " under key " + entry.getKey() + " but was " + entry.getValue() + ". Entry is " + entry; assert entry.getLifespan() == expectedLifespan : src + " expected lifespan for key " + key + " to be " + expectedLifespan + " but was " + entry.getLifespan() + ". Entry is " + entry; }</code><technical_language>assertNotNull() assertEquals() in lines instead of assert</technical_language>

Target:
private void assertStoredEntry(InternalCacheEntry entry, Object expectedValue, long expectedLifespan, String src, Object key) { assertNotNull(src + " entry for key " + key + " should NOT be null", entry); assertEquals(src + " should contain value " + expectedValue + " under key " + entry.getKey() + " but was " + entry.getValue() + ". Entry is " + entry, expectedValue, entry.getValue()); assertEquals(src + " expected lifespan for key " + key + " to be " + expectedLifespan + " but was " + entry.getLifespan() + ". Entry is " + entry, expectedLifespan, entry.getLifespan()); }
Source:
<code>private Set<SpecificHaxeClassReference> getCompatibleEnumTypes(HaxeClassModel model, HaxeGenericResolver resolver) { final Set<SpecificHaxeClassReference> list = new HashSet<>(); if (null == model) return list; boolean isEnumType = isContextAnEnumType(); boolean instanceIsExpected = canBeEnumInstance(); if (model instanceof HaxeEnumModel || (model.isEnum() && model.isAbstract())) { <START> if (instanceIsExpected) { list.add(SpecificHaxeClassReference.getEnumValue(context)); } <END> if(isEnumType) { SpecificHaxeClassReference ref = new SpecificHaxeClassReference( model.getReference(), resolver.getSpecifics(), null, null, context); list.add(SpecificHaxeClassReference.getEnum(context, ref)); } } else if (model.isAbstract() && "Enum".equals(model.getQualifiedInfo().getPresentableText())) { ResultHolder[] specifics = resolver.getSpecifics(); if (specifics.length == 1) { if (instanceIsExpected) { list.add(SpecificHaxeClassReference.getEnumValue(context)); } if(isEnumType) { list.add(specifics[0].getClassType()); } } } return list; }</code><technical_language>So, is "instanceIsExpected" now? I superseded changes "canAssignToFrom()"</technical_language>

Target:
private Set<SpecificHaxeClassReference> getCompatibleEnumTypes(HaxeClassModel model, HaxeGenericResolver resolver) { final Set<SpecificHaxeClassReference> list = new HashSet<>(); if (null == model) return list; boolean isEnumType = isContextAnEnumType(); if (model instanceof HaxeEnumModel || (model.isEnum() && model.isAbstract())) { if(isEnumType) { SpecificHaxeClassReference ref = new SpecificHaxeClassReference( model.getReference(), resolver.getSpecifics(), null, null, context); list.add(SpecificHaxeClassReference.getEnum(context, ref)); } } else if (model.isAbstract() && "Enum".equals(model.getQualifiedInfo().getPresentableText())) { ResultHolder[] specifics = resolver.getSpecifics(); if (specifics.length == 1) { if(isEnumType) { list.add(specifics[0].getClassType()); } } } return list; }
Source:
<code>private void checkSuperHasCorrectNumberOfArguments(SuperTreeImpl superTree) { if (isInConstructor(superTree) && !isInBaseClass(getEnclosingConstructor(superTree))) { ClassTree classTree = getEnclosingClass(superTree); ExpressionTree superClassTree = classTree.superClass(); if (superClassTree.is(Kind.IDENTIFIER_REFERENCE)) { <START> IdentifierTree superClassId = (IdentifierTree) superClassTree; <END> String superClassName = superClassId.identifierToken().text(); Scope constructorScope = getContext().getSymbolModel().getScope(getEnclosingConstructor(superTree)); Symbol superClassSymbol = constructorScope.lookupSymbol(superClassName); if (superClassSymbol != null) { compareNumberOfArguments(superTree, superClassSymbol); } } } }</code><technical_language>@ivandalbosco 3 lines replaced Symbol superClassSymbol = superClassId.symbol();</technical_language>

Target:
private void checkSuperHasCorrectNumberOfArguments(SuperTreeImpl superTree) { ClassTree classTree = getEnclosingClass(superTree); ExpressionTree superClassTree = classTree.superClass(); if (superClassTree.is(Kind.IDENTIFIER_REFERENCE)) { Symbol superClassSymbol = ((IdentifierTree) superClassTree).symbol(); if (superClassSymbol != null) { compareNumberOfArguments(superTree, superClassSymbol); } } }
Source:
<code>public static boolean openRenameWizard(String newName, IStructuredSelection structuredSelection) { Map<String, Object> commandParameters = new HashMap<>(); <START> commandParameters.put(LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY, newName); <END> return runCommand(LTK_RENAME_ID, structuredSelection, commandParameters); }</code><technical_language>worth Map<String, Object> commandParameters = Collections.singletonMap(LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY, newName); perform 1. fields, RAM 2. require a hash evaluate object, CPU</technical_language>

Target:
public static boolean openRenameWizard(String newName, IStructuredSelection structuredSelection) { Map<String, Object> commandParameters = Collections.singletonMap(LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY, newName); return runCommand(LTK_RENAME_ID, structuredSelection, commandParameters); }
Source:
<code>protected void init(TaggedValuePointable[] args) throws SystemException { returnSelf = true; indexSeqArgs = 0; indexSequence.add(0); returnSequence.add(0); if (args.length == 1) { <START> } else { <END> isfilter = true; if (args[1].getTag() != ValueTag.XS_INT_TAG) { throw new IllegalArgumentException("Expected int value tag, got: " + args[1].getTag()); } args[1].getValue(ip); if (ip.getInteger() != filterLookupID) { filterLookupID = ip.getInteger(); SequenceType sType = dCtx.getStaticContext().lookupSequenceType(ip.getInteger()); filter = NodeTestFilter.getNodeTestFilter(sType); } } if (args[0].getTag() == ValueTag.SEQUENCE_TAG) { args[0].getValue(seqNtp); seqArgsLength = seqNtp.getEntryCount(); } else if (args[0].getTag() == ValueTag.NODE_TREE_TAG) { args[0].getValue(ntp); seqArgsLength = -1; } else { throw new SystemException(ErrorCode.SYSE0001); } }</code><technical_language>if statement, change if condition remove else</technical_language>

Target:
protected void init(TaggedValuePointable[] args) throws SystemException { returnSelf = true; indexSeqArgs = 0; indexSequence.add(0); returnSequence.add(0); if (args.length > 1) { isfilter = true; if (args[1].getTag() != ValueTag.XS_INT_TAG) { throw new IllegalArgumentException("Expected int value tag, got: " + args[1].getTag()); } args[1].getValue(ip); if (ip.getInteger() != filterLookupID) { filterLookupID = ip.getInteger(); SequenceType sType = dCtx.getStaticContext().lookupSequenceType(ip.getInteger()); filter = NodeTestFilter.getNodeTestFilter(sType); } } if (args[0].getTag() == ValueTag.SEQUENCE_TAG) { args[0].getValue(seqNtp); seqArgsLength = seqNtp.getEntryCount(); } else if (args[0].getTag() == ValueTag.NODE_TREE_TAG) { args[0].getValue(ntp); seqArgsLength = -1; } else { throw new SystemException(ErrorCode.SYSE0001); } }
Source:
<code>public int compareTo(final ActivityCalendar other) { <START> return other.calendarName.compareTo(this.calendarName); <END> }</code><technical_language>Is reversed order calendarName intentional, comparison other around</technical_language>

Target:
public int compareTo(final ActivityCalendar other) { return this.calendarName.compareTo(other.calendarName); }
Source:
<code>private @CheckForNull String getThreaddump() { Process proc = process.getProcess(); try { int val = proc.exitValue(); return null; } catch (IllegalThreadStateException _) { } Class<?> clazz; Field pidField; try { clazz = Class.forName("java.lang.UNIXProcess"); pidField = clazz.getDeclaredField("pid"); pidField.setAccessible(true); } catch (Exception e) { return null; } if (clazz.isAssignableFrom(proc.getClass())) { int pid; try { pid = (int) pidField.get(proc); } catch (IllegalArgumentException | IllegalAccessException e) { throw new AssertionError(e); } try { File tmpFile = File.createTempFile("jstack-output", ".tmp"); tmpFile.deleteOnExit(); Process jstack = new ProcessBuilder("jstack", String.valueOf(pid)) .redirectErrorStream(true) .redirectOutput(ProcessBuilder.Redirect.to(tmpFile)) .start(); if (jstack.waitFor() == 0) { StringWriter writer = new StringWriter(); <START> IOUtils.copy(new FileInputStream(tmpFile), writer); <END> return writer.toString(); } } catch (IOException | InterruptedException e) { throw new AssertionError(e); } } return null; }</code><technical_language>more logical FileUtils.readFileToString(tmpFile, Charset.defaultCharset())</technical_language>

Target:
private @CheckForNull String getThreaddump() { Process proc = process.getProcess(); try { int val = proc.exitValue(); return null; } catch (IllegalThreadStateException _) { } Class<?> clazz; Field pidField; try { clazz = Class.forName("java.lang.UNIXProcess"); pidField = clazz.getDeclaredField("pid"); pidField.setAccessible(true); } catch (Exception e) { return null; } if (clazz.isAssignableFrom(proc.getClass())) { int pid; try { pid = (int) pidField.get(proc); } catch (IllegalArgumentException | IllegalAccessException e) { throw new AssertionError(e); } try { File tmpFile = File.createTempFile("jstack-output", ".tmp"); tmpFile.deleteOnExit(); Process jstack = new ProcessBuilder("jstack", String.valueOf(pid)) .redirectErrorStream(true) .redirectOutput(ProcessBuilder.Redirect.to(tmpFile)) .start(); if (jstack.waitFor() == 0) { return FileUtils.readFileToString(tmpFile, Charset.defaultCharset()); } } catch (IOException | InterruptedException e) { throw new AssertionError(e); } } return null; }
Source:
<code>public BoundFilter(final BoundDimFilter boundDimFilter) { super( boundDimFilter.getDimension(), new Predicate<String>() { private volatile Predicate<String> predicate; @Override public boolean apply(String input) { return function().apply(input); } private Predicate<String> function() { if (predicate == null) { final Comparator<String> comparator; if (boundDimFilter.isAlphaNumeric()) { comparator = new AlphaNumericTopNMetricSpec(null).getComparator(null, null); } else { comparator = new LexicographicTopNMetricSpec(null).getComparator(null, null); } final ExtractionFn extractionFn = boundDimFilter.getExtractionFn(); predicate = new Predicate<String>() { @Override public boolean apply(String input) { if (input == null) { return false; } <START> if (extractionFn != null) { <END> input = extractionFn.apply(input); } int lowerComparing = 1; int upperComparing = 1; if (boundDimFilter.getLower() != null) { lowerComparing = comparator.compare(input, boundDimFilter.getLower()); } if (boundDimFilter.getUpper() != null) { upperComparing = comparator.compare(boundDimFilter.getUpper(), input); } if (boundDimFilter.isLowerStrict() && boundDimFilter.isUpperStrict()) { return ((lowerComparing > 0)) && (upperComparing > 0); } else if (boundDimFilter.isLowerStrict()) { return (lowerComparing > 0) && (upperComparing >= 0); } else if (boundDimFilter.isUpperStrict()) { return (lowerComparing >= 0) && (upperComparing > 0); } return (lowerComparing >= 0) && (upperComparing >= 0); } }; } return predicate; } } ); }</code><technical_language>I more sense for DimensionPredicateFilter extractionFn apply it</technical_language>

Target:
public BoundFilter(final BoundDimFilter boundDimFilter) { this.boundDimFilter = boundDimFilter; this.comparator = boundDimFilter.isAlphaNumeric() ? StringComparators.ALPHANUMERIC : StringComparators.LEXICOGRAPHIC; this.extractionFn = boundDimFilter.getExtractionFn(); }
Source:
<code>private void deleteOldBlobs() { if (retentionDays <= 0) { return; } try { SmartQuery<SQLBlob> deleteQuery = oma.select(SQLBlob.class) .eq(SQLBlob.SPACE_NAME, spaceName) .where(OMA.FILTERS.lt(SQLBlob.LAST_MODIFIED, LocalDateTime.now().minusDays(retentionDays))) <START> .where(OMA.FILTERS.ltOrEmpty(MongoBlob.LAST_TOUCHED, <END> LocalDateTime.now() .minusDays(retentionDays))); if (isTouchTracking()) { deleteQuery.where(OMA.FILTERS.ltOrEmpty(SQLBlob.LAST_TOUCHED, LocalDateTime.now().minusDays(retentionDays))); } deleteQuery.limit(256).delete(); } catch (Exception e) { Exceptions.handle() .to(StorageUtils.LOG) .error(e) .withSystemErrorMessage("Layer 2/SQL: Failed to delete old blobs in %s: %s (%s)", spaceName) .handle(); } }</code><technical_language>MongoBlob SQLBlob</technical_language>

Target:
private void deleteOldBlobs() { if (retentionDays <= 0) { return; } try { SmartQuery<SQLBlob> deleteQuery = oma.select(SQLBlob.class) .eq(SQLBlob.SPACE_NAME, spaceName) .where(OMA.FILTERS.lt(SQLBlob.LAST_MODIFIED, LocalDateTime.now().minusDays(retentionDays))) .where(OMA.FILTERS.ltOrEmpty(SQLBlob.LAST_TOUCHED, LocalDateTime.now() .minusDays(retentionDays))); if (isTouchTracking()) { deleteQuery.where(OMA.FILTERS.ltOrEmpty(SQLBlob.LAST_TOUCHED, LocalDateTime.now().minusDays(retentionDays))); } deleteQuery.limit(256).delete(); } catch (Exception e) { Exceptions.handle() .to(StorageUtils.LOG) .error(e) .withSystemErrorMessage("Layer 2/SQL: Failed to delete old blobs in %s: %s (%s)", spaceName) .handle(); } }
Source:
<code>protected void writeBuckets(String fieldName, List<Bucket> buckets, Field field, JsonGenerator jg) throws IOException { Schema schema = field.getDeclaringType().getSchema(); DocumentPartImpl part = new DocumentPartImpl(schema); jg.writeArrayFieldStart(fieldName); for (Bucket bucket : buckets) { jg.writeStartObject(); jg.writeObjectField("key", bucket.getKey()); Property prop = PropertyFactory.createProperty(part, field, Property.NONE); if (prop.isList()) { ListType t = (ListType) prop.getType(); t.getField(); prop = PropertyFactory.createProperty(part, t.getField(), Property.NONE); } <START> log.debug("Writing for field resolved to {}", fieldName, field.getName(), prop.getName()); <END> prop.setValue(bucket.getKey()); writeEntityField("fetchedKey", prop, jg); jg.writeNumberField("docCount", bucket.getDocCount()); jg.writeEndObject(); if (bucket instanceof BucketRange) { BucketRange bucketRange = (BucketRange) bucket; jg.writeNumberField("from", bucketRange.getFrom()); jg.writeNumberField("to", bucketRange.getTo()); } if (bucket instanceof BucketRangeDate) { BucketRangeDate bucketRange = (BucketRangeDate) bucket; jg.writeStringField("fromAsDate", formatISODateTime(nowIfNull(bucketRange.getFromAsDate()))); jg.writeStringField("toAsDate", formatISODateTime(nowIfNull(bucketRange.getToAsDate()))); } } jg.writeEndArray(); }</code><technical_language>"Writing value: for field: resolved to: {}"</technical_language>

Target:
protected void writeBuckets(String fieldName, List<Bucket> buckets, Field field, JsonGenerator jg) throws IOException { Schema schema = field.getDeclaringType().getSchema(); DocumentPartImpl part = new DocumentPartImpl(schema); jg.writeArrayFieldStart(fieldName); for (Bucket bucket : buckets) { jg.writeStartObject(); jg.writeObjectField("key", bucket.getKey()); Property prop = PropertyFactory.createProperty(part, field, Property.NONE); if (prop.isList()) { ListType t = (ListType) prop.getType(); t.getField(); prop = PropertyFactory.createProperty(part, t.getField(), Property.NONE); } log.debug("Writing value: for field: resolved to: {}", fieldName, field.getName(), prop.getName()); prop.setValue(bucket.getKey()); writeEntityField("fetchedKey", prop, jg); jg.writeNumberField("docCount", bucket.getDocCount()); jg.writeEndObject(); if (bucket instanceof BucketRange) { BucketRange bucketRange = (BucketRange) bucket; jg.writeNumberField("from", bucketRange.getFrom()); jg.writeNumberField("to", bucketRange.getTo()); } if (bucket instanceof BucketRangeDate) { BucketRangeDate bucketRange = (BucketRangeDate) bucket; jg.writeStringField("fromAsDate", formatISODateTime(nowIfNull(bucketRange.getFromAsDate()))); jg.writeStringField("toAsDate", formatISODateTime(nowIfNull(bucketRange.getToAsDate()))); } } jg.writeEndArray(); }
Source:
<code>private void storeFileContent( File file, ByteBuffer sourceBuffer ) throws IOException { try ( StoreChannel storeChannel = fileSystem.create( file ) ) { <START> storeChannel.write( sourceBuffer ); <END> } }</code><technical_language>writeAll</technical_language>

Target:
private void storeFileContent( File file, ByteBuffer sourceBuffer ) throws IOException { try ( StoreChannel storeChannel = fileSystem.create( file ) ) { storeChannel.writeAll( sourceBuffer ); } }
Source:
<code>private byte[] updateOrDoFinal(byte[] input, int offset, int len, boolean isFinal) throws IllegalBlockSizeException, BadPaddingException { allocateBuffer(); <START> int tempLen = isFinal <END> ? len - len % transformation.getAlgorithmBlockSize() + transformation.getAlgorithmBlockSize() : len - len % transformation.getAlgorithmBlockSize(); byte[] temp = new byte[tempLen]; int cursor = consumeInput(input, offset, len, isFinal, temp); return generateOutput(temp, cursor, tempLen); }</code><technical_language>curious need buffer cipher patch separated byte array multiple small size byte buffer. IMO, converting byte array byte butter, giving byte butter native, converting byte butter result byte array return byte array. If input size number of blocks, native cipher handle buffer</technical_language>

Target:
private byte[] updateOrDoFinal(byte[] input, int offset, int len, boolean isFinal) throws IllegalBlockSizeException, BadPaddingException, ShortBufferException { if (input == null || offset < 0 || len < 0 || len > (input.length - offset)) { throw new IllegalArgumentException("Bad arguments"); } allocateBuffer(); final int blockSize = transformation.getAlgorithmBlockSize(); int bufferLen = isFinal ? len - len % blockSize + blockSize : len - len % blockSize; byte[] buffer = new byte[bufferLen]; int pos = updateInput(input, offset, len, isFinal, buffer); return getOutput(buffer, pos, bufferLen); }
Source:
<code>public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { mRecyclerView=new RecyclerView(getContext()); ingredients=new ArrayList<>(); Callback<JsonNode> callback=new Callback<JsonNode>() { @Override <START> public void onResponse(@NonNull Call<JsonNode> call, Response<JsonNode> response) { <END> final JsonNode node=response.body(); final JsonNode ingredientsJsonNode=node.findValue("ingredients"); for(int i=0;i<ingredientsJsonNode.size();i++) { Ingredient ingredient=new Ingredient(); ingredient.setId(ingredientsJsonNode.get(i).findValue("id").toString()); ingredient.setText(ingredientsJsonNode.get(i).findValue("text").toString()); ingredient.setRank(Long.valueOf(ingredientsJsonNode.get(i).findValue("rank").toString())); ingredients.add(ingredient); } adapter= new IngredientAnalysisRecyclerAdapter(getContext(),ingredients,getActivity()); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setAdapter(adapter); } @Override public void onFailure(@NonNull Call<JsonNode> call, Throwable t) { Toast.makeText(getActivity(), getActivity().getString(R.string.errorWeb), Toast.LENGTH_LONG).show(); } }; api.getIngredients(product.getCode(),callback); if(adapter!=null) { adapter.notifyDataSetChanged(); } return createView(inflater,container,R.layout.fragment_ingredients_analysis_product); }</code><technical_language>onResponse onFailure logic moved app/src/main/java/openfoodfacts/github/scrachx/openfood/network/OpenFoodAPIClient.java file. Refer this file do it</technical_language>

Target:
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { mRecyclerView=new RecyclerView(getContext()); api.getIngredients(product.getCode(),((value, ingredients) -> { if(value) { adapter= new IngredientAnalysisRecyclerAdapter(getContext(),ingredients,getActivity()); mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mRecyclerView.setAdapter(adapter); } else { Toast.makeText(getActivity(), getActivity().getString(R.string.errorWeb), Toast.LENGTH_LONG).show(); } })); return createView(inflater,container,R.layout.fragment_ingredients_analysis_product); }
Source:
<code>public static LifeForm parseLifeForm(String val) { switch(val) { <START> case "None": return NONE; <END> case "Microbes": return MICROBE; case "Plants": return PLANT; case "Fish": return FISH; case "Amphibians": return AMPH; case "Reptiles": return REPTILE; case "Birds": return BIRD; case "Mammals": return MAMMAL; case "Insects": return INSECT; default: return LifeForm.valueOf(val); } }</code><technical_language>Do need worry case here</technical_language>

Target:
public static LifeForm parseLifeForm(String val) { switch(val.toLowerCase()) { case "microbe": case "microbes": return MICROBE; case "plant": case "plants": return PLANT; case "fish": return FISH; case "amphibian": case "amphibians": return AMPHIBIAN; case "reptile": case "reptiles": return REPTILE; case "bird": case "birds": return BIRD; case "mammal": case "mammals": return MAMMAL; case "insect": case "insects": return INSECT; default: return NONE; } }
Source:
<code>public final ItemBinding<T> clearExtras() { if (extraBindings != null) { <START> extraBindings.clear(); <END> extraBindings = null; } return this; }</code><technical_language>clear list if immedatly setting null</technical_language>

Target:
public final ItemBinding<T> clearExtras() { if (extraBindings != null) { extraBindings.clear(); } return this; }
Source:
<code>public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { Logger.debug(LOG_TAG, "addAccount"); final Bundle res = new Bundle(); if (!FxAccountConstants.ACCOUNT_TYPE.equals(accountType)) { res.putInt(AccountManager.KEY_ERROR_CODE, -1); res.putString(AccountManager.KEY_ERROR_MESSAGE, "Not adding unknown account type."); return res; } Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName(AppConstants.ANDROID_PACKAGE_NAME, AppConstants.ANDROID_PACKAGE_NAME + ".App"); <START> intent.setData(Uri.parse("about:accounts")); <END> res.putParcelable(AccountManager.KEY_INTENT, intent); return res; }</code><technical_language>worth defining "create account"/"manage account" intents already, opening a URI</technical_language>

Target:
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { Logger.debug(LOG_TAG, "addAccount"); final Bundle res = new Bundle(); if (!FxAccountConstants.ACCOUNT_TYPE.equals(accountType)) { res.putInt(AccountManager.KEY_ERROR_CODE, -1); res.putString(AccountManager.KEY_ERROR_MESSAGE, "Not adding unknown account type."); return res; } Intent intent = new Intent(context, FxAccountSetupActivity.class); res.putParcelable(AccountManager.KEY_INTENT, intent); return res; }
Source:
<code>public void testColumnWithInvalidType() { assertNull(metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS)); metadata.createTable(SESSION, getOrdersTable(), false); ConnectorTableHandle tableHandle = metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS); assertInstanceOf(tableHandle, RaptorTableHandle.class); RaptorTableHandle raptorTableHandle = (RaptorTableHandle) tableHandle; List<RowType.Field> fields = new ArrayList<RowType.Field>(); fields.add(new RowType.Field(Optional.of("field_1"), BIGINT)); try { metadata.addColumn(SESSION, raptorTableHandle, new ColumnMetadata("new_col", RowType.from(fields))); } catch (PrestoException pe) { <START> assertEquals(pe.getErrorCode(), NOT_SUPPORTED.toErrorCode()); <END> } }</code><technical_language>Please add fail(); addColumn() call</technical_language>

Target:
public void testColumnWithInvalidType() { assertNull(metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS)); metadata.createTable(SESSION, getOrdersTable(), false); RaptorTableHandle raptorTableHandle = (RaptorTableHandle) metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS); List<RowType.Field> fields = (ImmutableList.of(new RowType.Field(Optional.of("field_1"), BIGINT))); try { metadata.addColumn( SESSION, raptorTableHandle, new ColumnMetadata("new_col", RowType.from(fields))); fail(); } catch (PrestoException e) { assertEquals(e.getErrorCode(), NOT_SUPPORTED.toErrorCode()); } }
Source:
<code>public List<Organization> getApprovedOrganizations() { <START> List<Organization> organizations = organizationDAO.findApprovedSortedByStar(); <END> organizations.forEach(organization -> Hibernate.initialize(organization.getAliases())); return organizations; }</code><technical_language>This broad</technical_language>

Target:
public List<Organization> getApprovedOrganizations() { return organizationDAO.findApprovedSortedByStar(); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Node node = (Node) o; <START> return com.google.common.base.Objects.equal(id, node.id) && <END> com.google.common.base.Objects.equal(ip, node.ip) && com.google.common.base.Objects.equal(addr, node.addr) && com.google.common.base.Objects.equal(name, node.name); }</code><technical_language>import com.google.common.base.Objects; for verbose</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Node node = (Node) o; return Objects.equal(id, node.id) && Objects.equal(ip, node.ip) && Objects.equal(addr, node.addr) && Objects.equal(name, node.name); }
Source:
<code>private void uploadParts(List<Part> parts, File file, String objectId, String uploadId, Progress progressBar) { transportBuilder.withProxy(storageService) .withProgressBar(progressBar) .withParts(parts) .withObjectId(objectId) .withTransportMode(Mode.UPLOAD) .withSessionId(uploadId); transportBuilder.build().send(file); <START> } <END></code><technical_language>java val transport = transportBuilder .withProxy(storageService) .withProgressBar(progressBar) .withParts(parts) .withObjectId(objectId) .withTransportMode(Mode.UPLOAD) .withSessionId(uploadId).build(); transport.send(file);</technical_language>

Target:
private void uploadParts(List<Part> parts, File file, String objectId, String uploadId, Progress progressBar) { val transport = transportBuilder .withProxy(storageService) .withProgressBar(progressBar) .withParts(parts) .withObjectId(objectId) .withTransportMode(Mode.UPLOAD) .withSessionId(uploadId).build(); transport.send(file); }
Source:
<code>public long getExpirationTimeStamp() { <START> return lastUpdate.getTime() + lifeTimeInSec * 1000; <END> }</code><technical_language>return getExpirationTimeStamp(0L)</technical_language>

Target:
public long getExpirationTimeStamp() { return getExpirationTimeStamp(0L); }
Source:
<code>public ValidationWhiteListDeleteRequestBuilder prepareDelete(String id) { <START> return prepareDelete(newHashSet(id)); <END> }</code><technical_language>Collections.singleton()</technical_language>

Target:
public ValidationWhiteListDeleteRequestBuilder prepareDelete(String id) { return prepareDelete(Collections.singleton(id)); }
Source:
<code>public void handle(LegacyPing ping) throws Exception { ServerPing legacy = new ServerPing( new ServerPing.Protocol( bungee.getGameVersion(), bungee.getProtocolVersion() ), <START> new ServerPing.Players( listener.getMaxPlayers(), bungee.getOnlineCount(), null ), listener.getMotd(), new Favicon( null ) ); <END> legacy = bungee.getPluginManager().callEvent( new ProxyPingEvent( this, legacy ) ).getResponse(); String kickMessage = ChatColor.DARK_BLUE + "\00" + 127 + "\00" + legacy.getVersion().getName() + "\00" + legacy.getDescription() + "\00" + legacy.getPlayers().getOnline() + "\00" + legacy.getPlayers().getMax(); ch.getHandle().writeAndFlush( kickMessage ); ch.close(); }</code><technical_language>I of a difference, construct a new instance, pass null do this.favicon = (favicon == null ? "" : favicon.getIcon()) in constructor instead? This eliminate a NPE ;)</technical_language>

Target:
public void handle(LegacyPing ping) throws Exception { ServerPing legacy = new ServerPing( new ServerPing.Protocol( bungee.getGameVersion(), bungee.getProtocolVersion() ), new ServerPing.Players( listener.getMaxPlayers(), bungee.getOnlineCount(), null ), listener.getMotd(), (Favicon) null ); legacy = bungee.getPluginManager().callEvent( new ProxyPingEvent( this, legacy ) ).getResponse(); String kickMessage = ChatColor.DARK_BLUE + "\00" + 127 + "\00" + legacy.getVersion().getName() + "\00" + legacy.getDescription() + "\00" + legacy.getPlayers().getOnline() + "\00" + legacy.getPlayers().getMax(); ch.getHandle().writeAndFlush( kickMessage ); ch.close(); }
Source:
<code>public void start() { LOG.info("Starting the container process manager"); <START> int containerRetryCount = clusterManagerConfig.getContainerRetryCount(); <END> if (containerRetryCount < ClusterManagerConfig.DEFAULT_CONTAINER_RETRY_COUNT) { LOG.warn("{} configured to: that is less than the default of: may cause premature failure of this job", ClusterManagerConfig.CLUSTER_MANAGER_CONTAINER_RETRY_COUNT, containerRetryCount, ClusterManagerConfig.DEFAULT_CONTAINER_RETRY_COUNT); } if (containerRetryCount > -1) { LOG.info("Max retries on restarting failed containers: {}", containerRetryCount); } else { LOG.info("Infinite retries on restarting failed containers"); } if (jvmMetrics != null) { jvmMetrics.start(); } if (metricsReporters != null) { metricsReporters.values().forEach(reporter -> reporter.start()); } if (diagnosticsManager.isDefined()) { diagnosticsManager.get().start(); } LOG.info("Starting the cluster resource manager"); clusterResourceManager.start(); state.processorCount.set(state.jobModelManager.jobModel().getContainers().size()); state.neededProcessors.set(state.jobModelManager.jobModel().getContainers().size()); Map<String, String> processorToHostMapping = state.jobModelManager.jobModel().getAllContainerLocality(); containerAllocator.requestResources(processorToHostMapping); LOG.info("Starting the container allocator thread"); allocatorThread.start(); LOG.info("Starting the container process manager"); }</code><technical_language>this entire config handling logic (224-237) moved a method in ClusterManagerConfig</technical_language>

Target:
public void start() { LOG.info("Starting the container process manager"); int containerRetryCount = clusterManagerConfig.getContainerRetryCount(); if (containerRetryCount > -1) { LOG.info("Max retries on restarting failed containers: {}", containerRetryCount); } else { LOG.info("Infinite retries on restarting failed containers"); } if (jvmMetrics != null) { jvmMetrics.start(); } if (metricsReporters != null) { metricsReporters.values().forEach(reporter -> reporter.start()); } if (diagnosticsManager.isDefined()) { diagnosticsManager.get().start(); } LOG.info("Starting the cluster resource manager"); clusterResourceManager.start(); state.processorCount.set(state.jobModelManager.jobModel().getContainers().size()); state.neededProcessors.set(state.jobModelManager.jobModel().getContainers().size()); Map<String, String> processorToHostMapping = state.jobModelManager.jobModel().getAllContainerLocality(); containerAllocator.requestResources(processorToHostMapping); LOG.info("Starting the container allocator thread"); allocatorThread.start(); LOG.info("Starting the container process manager"); }
Source:
<code>public String getDefaultExchange() { <START> return null != exInfo ? exInfo.getDefaultExchange() : null; <END> }</code><technical_language>a null check, attempt load exchange info file first</technical_language>

Target:
public String getDefaultExchange() { if (exInfo == null) { try { loadExchangeInfo(); } catch (ExchangeManagerException e) { LOG.error("There are some exception while loading internal exchange information ", e.getLocalizedMessage(), e); } } return null != exInfo ? exInfo.getDefaultExchange() : null; }
Source:
<code>public Key(String location, InetAddress ipAddress) { <START> this.location = location != null ? location : MonitoringLocationDao.DEFAULT_MONITORING_LOCATION_ID; <END> this.ipAddress = Objects.requireNonNull(ipAddress); }</code><technical_language>This replaced LocationUtils.getEffectiveLocationName(location)</technical_language>

Target:
public Key(String location, InetAddress ipAddress) { this.location = LocationUtils.getEffectiveLocationName(location); this.ipAddress = Objects.requireNonNull(ipAddress); }
Source:
<code>public void dismiss() { if (!mAnimated) { finish(); return; } if (mIsDismissing) { return; } final Animation slideOut = AnimationUtils.loadAnimation(getContext(), R.anim.snackbar_out); slideOut.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { mIsDismissing = true; if (mEventListener != null && mIsShowing) { <START> mEventListener.onDismiss(getHeight() + mOffset); <END> } } @Override public void onAnimationEnd(Animation animation) { post(new Runnable() { @Override public void run() { finish(); } }); } @Override public void onAnimationRepeat(Animation animation) { } }); startAnimation(slideOut); }</code><technical_language>repeat call here? I call a new event <code>onDismissStart()</code></technical_language>

Target:
public void dismiss() { if (mIsDismissing) { return; } mIsDismissing = true; if (mEventListener != null && mIsShowing) { mEventListener.onDismiss(Snackbar.this); } if (!mAnimated) { finish(); return; } final Animation slideOut = AnimationUtils.loadAnimation(getContext(), R.anim.snackbar_out); slideOut.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { post(new Runnable() { @Override public void run() { finish(); } }); } @Override public void onAnimationRepeat(Animation animation) { } }); startAnimation(slideOut); }