I have a class for my user called "User". All getters and setters are correct. I initialized "mUser" in the main activity to be used globally by the app (MainActivity.mUser).
The Log.i("..............UID Used", auth.getCurrentUser().getUid());
returns the correct Uid for the user.
What I am struggling with is nothing executes in the try/catch block. Nothing is logged in catalog and the app crashes. It does not go to onComplete, onFail, nor catches an exception. The app just goes to the next section of code which references the data pulled from this block and gives an error due to the values of mUser all being null.
It was working then all of a sudden stopped and I am unsure why. Can anyone shed some light on this?
private void getUserProfileInfo() {
MainActivity.mUser.clearUser();
FirebaseAuth auth = FirebaseAuth.getInstance();
Log.i("..............UID Used", auth.getCurrentUser().getUid());
FirebaseDatabase firebaseDatabase = FirebaseDatabase
.getInstance("https://godsvong-default-rtdb.firebaseio.com/");
DatabaseReference databaseReference = firebaseDatabase.getReference();
try {
databaseReference.child("User_Profiles").child(auth.getCurrentUser().getUid())
.get().addOnCompleteListener(new OnCompleteListener<DataSnapshot>() {
@Override
public void onComplete(@NonNull Task<DataSnapshot> task) {
MainActivity.mUser = task.getResult().getValue(User.class);
Log.i("Get Data", "SUCCESS!!!!!");
MainActivity.mUser.showUserDataInCatlog();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.i("Get Data", "FAILED!!!!!");
}
});
}
catch (Exception e){
Log.i(".............ERROR", e.toString());
}
String path = MainActivity.mUser.getmProfilePicUrl();
//MainActivity.mUser.showUserDataInCatlog();
//Log.i(".............PATH", MainActivity.mUser.getmProfilePicUrl());
//Log.i(".............PATH", path);
StorageReference gsReference = FirebaseStorage.getInstance()
.getReferenceFromUrl(path);
LOGCAT:
W/System: Ignoring header X-Firebase-Locale because its value was null.
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
W/System: Ignoring header X-Firebase-Locale because its value was null.
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/..............UID Used: 3jdmmGvAh4Q8KSvG6m9aSFLOXuG2
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.hsquaredtechnologies.godsvong, PID: 9974
java.lang.IllegalArgumentException: location must not be null or empty
at com.google.android.gms.common.internal.Preconditions.checkArgument(com.google.android.gms:play-services-basement@@17.1.0:35)
at com.google.firebase.storage.FirebaseStorage.getReferenceFromUrl(FirebaseStorage.java:282)
at com.hsquaredtechnologies.godsvong.ui.logout.LogoutFragment.getUserProfileInfo(LogoutFragment.java:268)
at com.hsquaredtechnologies.godsvong.ui.logout.LogoutFragment.lambda$onViewCreated$1$LogoutFragment(LogoutFragment.java:186)
at com.hsquaredtechnologies.godsvong.ui.logout.LogoutFragment$$ExternalSyntheticLambda2.onComplete(Unknown Source:8)
at com.google.android.gms.tasks.zzj.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8512)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1139)
I/Process: Sending signal. PID: 9974 SIG: 9