Skip to content

ArrayIndexOutOfBoundsException caused by TransferStatusUpdater.unregisterListener$lambda$15 #2663

Open
@yaroslav-v

Description

@yaroslav-v

Before opening, please confirm:

Language and Async Model

Java

Amplify Categories

Storage

Gradle script dependencies

// Put output below this line
implementation "com.amplifyframework:core:2.14.7"
implementation "com.amplifyframework:aws-storage-s3:2.14.7"
implementation "com.amplifyframework:aws-auth-cognito:2.14.7"

Environment information

# Put output below this line
------------------------------------------------------------
Gradle 8.1.1
------------------------------------------------------------

Build time:   2023-04-21 12:31:26 UTC
Revision:     1cf537a851c635c364a4214885f8b9798051175b

Kotlin:       1.8.10
Groovy:       3.0.15
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          1.8.0_201 (Oracle Corporation 25.201-b09)
OS:           Mac OS X 10.16 x86_64

Please include any relevant guides or documentation you're referencing

No response

Describe the bug

Hi there!

We have a few (3 at the moment) reports on Firebase with this crash. The issue appears on Android 13 only, affected devices include Samsung and Xiaomi.

The issue is quite rare and, unfortunately, there are no steps to reproduce it.

I believe you may have more clues why this might happen.

Reproduction steps (if applicable)

No response

Code Snippet

// Initialization in Application class

Amplify.Logging.disable();

Amplify.addPlugin(new AWSCognitoAuthPlugin());
Amplify.addPlugin(new AWSS3StoragePlugin());

AmplifyConfiguration amplifyConfig = AmplifyConfiguration.builder(context)
		.devMenuEnabled(false)
		.build();
Amplify.configure(amplifyConfig, context);


// Uploading, somewhere in the app

DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US);
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));

Map<String, String> metadata = new ArrayMap<>(4);
metadata.put("date", dateFormat.format(date));
metadata.put("session_uuid", uid);
metadata.put("token", authToken);
metadata.put("service", serviceName);

StorageUploadFileOptions options =
		StorageUploadFileOptions.builder()
				.accessLevel(StorageAccessLevel.PUBLIC)
				.contentType(mimeType)
				.metadata(metadata)
				.build();

final File file = new File(path);
if (file.canRead()) {
	Amplify.Storage.uploadFile(
			file.getName(),
			file,
			options,
			result -> {
				// write success logs
			},
			failure -> {
				// write failure logs
			}
	);
}

Log output

// Put your logs below this line
Fatal Exception: java.lang.ArrayIndexOutOfBoundsException
length=1; index=1
	java.util.ArrayList.remove (ArrayList.java:631)
	com.amplifyframework.storage.s3.transfer.TransferStatusUpdater.unregisterListener$lambda$15 (TransferStatusUpdater.kt:214)
	android.os.Handler.handleCallback (Handler.java:942)
	android.os.Handler.dispatchMessage (Handler.java:99)
	android.os.Looper.loopOnce (Looper.java:211)
	android.os.Looper.loop (Looper.java:300)
	android.app.ActivityThread.main (ActivityThread.java:8410)
	java.lang.reflect.Method.invoke (Method.java)
	com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:559)
	com.android.internal.os.ZygoteInit.main (ZygoteInit.java:954)

amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclosing soonThis issue will be closed in 7 days unless further comments are made.storageRelated to the Storage category/plugins

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions