Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttendanceCollectionActivity.VerifyThumb java.lang.IllegalArgumentException - bad base-64 #477

Open
sundarraj11 opened this issue Mar 23, 2024 · 2 comments

Comments

@sundarraj11
Copy link

Mostly working But in Some rare cases I'm facing the issue

Android 9

Samsung

Fatal Exception: java.lang.IllegalArgumentException: bad base-64
at android.util.Base64.decode(Base64.java:161)
at android.util.Base64.decode(Base64.java:136)
at android.util.Base64.decode(Base64.java:118)
at com.example.bosco.ivdpshg.AttendanceCollectionActivity.VerifyThumb(AttendanceCollectionActivity.java:667)
at com.example.bosco.ivdpshg.AttendanceCollectionActivity.OnCapture4(AttendanceCollectionActivity.java:640)
at com.example.bosco.ivdpshg.AttendanceCollectionActivity$AttendanceCollectionAdapter.lambda$dialogMethod$7$AttendanceCollectionActivity$AttendanceCollectionAdapter(AttendanceCollectionActivity.java:1409)
at com.example.bosco.ivdpshg.-$$Lambda$AttendanceCollectionActivity$AttendanceCollectionAdapter$cSGygi6AAQrdSP1nMAcAm1smr1k.onClick(:2)
at android.view.View.performClick(View.java:7357)

I share the code below

public void VerifyThumb(int memberId, int nomineeId, int animatorId, boolean isAbsent, boolean isNomineeAbsent, boolean canSkipMeeting) {
    MemberDetailsAndFingerPrintModel memberDetailsAndFingerPrintModel = new MemberDetailsAndFingerPrintModel();

    strImageOne = "";
    strImageTwo = "";
    strImageThree = "";
    if (isAbsent || canSkipMeeting) {
        if (isNomineeAbsent) {
            getAnimatorId = animatorId;
            isNomeenieAbs = isNomineeAbsent;
            memberDetailsAndFingerPrintModel = ivdpDatabaseHelper.getAttendanceMemberThumb(animatorId, groupId);
        } else
            memberDetailsAndFingerPrintModel = ivdpDatabaseHelper.getAttendanceMemberThumb(nomineeId, groupId);
    } else {
        memberDetailsAndFingerPrintModel = ivdpDatabaseHelper.getAttendanceMemberThumb(memberId, groupId);
    }

    strImageOne = memberDetailsAndFingerPrintModel.getThump1();
    strImageTwo = memberDetailsAndFingerPrintModel.getThump2();
    strImageThree = memberDetailsAndFingerPrintModel.getThump3();
    if (strImageOne != null && strImageTwo != null && strImageThree != null) {
        imgOneDB = Base64.decode(strImageOne, Base64.NO_WRAP);
        imgTwoDB = Base64.decode(strImageTwo, Base64.NO_WRAP);
        imgThreeDB = Base64.decode(strImageThree, Base64.NO_WRAP);
    }

    if (imgOneDB != null && imgTwoDB != null && imgThreeDB != null && byTemplate4 != null) {
        NBioBSPJNI.FIR_HANDLE hLoadFIR1, hLoadFIR2, hLoadFIR3, hLoadFIR4;
        {
            hLoadFIR1 = bsp.new FIR_HANDLE();
            exportEngine.ImportFIR(imgOneDB, imgOneDB.length, NBioBSPJNI.EXPORT_MINCONV_TYPE.OLD_FDA, hLoadFIR1);
            if (bsp.IsErrorOccured()) {
                return;
            }
        }
        {
            hLoadFIR2 = bsp.new FIR_HANDLE();
            exportEngine.ImportFIR(imgTwoDB, imgTwoDB.length, NBioBSPJNI.EXPORT_MINCONV_TYPE.OLD_FDA, hLoadFIR2);
            if (bsp.IsErrorOccured()) {
                return;
            }
        }
        {
            hLoadFIR3 = bsp.new FIR_HANDLE();
            exportEngine.ImportFIR(imgThreeDB, imgThreeDB.length, NBioBSPJNI.EXPORT_MINCONV_TYPE.OLD_FDA, hLoadFIR3);
            if (bsp.IsErrorOccured()) {
                return;
            }
        }
        {
            hLoadFIR4 = bsp.new FIR_HANDLE();
            exportEngine.ImportFIR(byTemplate4, byTemplate4.length, NBioBSPJNI.EXPORT_MINCONV_TYPE.OLD_FDA, hLoadFIR4);
            if (bsp.IsErrorOccured()) {
                return;
            }
        }

        // Verify Match
        NBioBSPJNI.INPUT_FIR inputFIR1, inputFIR2, inputFIR3, inputFIR4;
        Boolean bResult = new Boolean(false);
        Boolean bResult1 = new Boolean(false);
        Boolean bResult2 = new Boolean(false);

        inputFIR1 = bsp.new INPUT_FIR();
        inputFIR2 = bsp.new INPUT_FIR();
        inputFIR3 = bsp.new INPUT_FIR();
        inputFIR4 = bsp.new INPUT_FIR();

        inputFIR1.SetFIRHandle(hLoadFIR1);
        inputFIR2.SetFIRHandle(hLoadFIR2);
        inputFIR3.SetFIRHandle(hLoadFIR3);
        inputFIR4.SetFIRHandle(hLoadFIR4);

        bsp.VerifyMatch(inputFIR1, inputFIR4, bResult, null);
        if (bResult) {
            setSuccessText(memberId);
        } else {
            bsp.VerifyMatch(inputFIR2, inputFIR4, bResult1, null);
            if (bResult1) {
                setSuccessText(memberId);
            } else {
                bsp.VerifyMatch(inputFIR3, inputFIR4, bResult2, null);
                if (bResult2) {
                    setSuccessText(memberId);
                } else {
                    statusLayout.setVisibility(View.VISIBLE);
                    imgStatus.setImageResource(R.drawable.ic_failure);
                    txtStatus.setVisibility(View.VISIBLE);
                    txtStatus.setText("Verification failed. Try again");
                    txtStatus.setTextColor(Color.parseColor("#da2d2d"));
                    thumb.setVisibility(View.VISIBLE);
                    btnClickHere.setVisibility(View.GONE);
                }
            }
        }
        hLoadFIR1.dispose();
        hLoadFIR2.dispose();
        hLoadFIR3.dispose();
    }
}
@Bashayer-reda
Copy link

Hello, @sundarraj11 Thank you so much for reaching out, I'm pleased to offer my assistance. Could you please provide me with additional information to better understand your requirements?
and also Instabug integration code, steps to reproduce the issue

@sundarraj11
Copy link
Author

I used Firebase Crashlytics. I happen to see that error from Firebase. Above given code is only used to verify the Fingerprint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants