ArrayIndexOutOfBoundsException - When selecting printed expiration date out of order
License and Copyright Notice
By submitting this issue or commenting on this issue, or contributing any content to this issue, you certify under the Developer Certificate of Origin that the content you post may be licensed under GPLv3 (for code) or CC-BY-SA 4.0 International (for non-code content).
Summary
ArrayIndexOutOfBoundsException
when selecting printed expiration date out of order.
Steps to reproduce
- Go to the 'CHECK EXPIRATION DATE' feature within the app.
- Scan or enter a barcode.
- Fill in the required information if in
SelectItemFragment
, or press confirm if inConfirmItemFragment
. - Select a random day first.
- The app should crash from a
ArrayIndexOutOfBoundsException
What is the current bug behavior?
The app crashes with a 'ArrayIndexOutOfBoundsException' when selecting a day before selecting the month.
What is the expected correct behavior?
The user should be able to select the date in any order they choose or be forced into selecting the date in a specific order by disabling the buttons until the preceding one has been selected.
Relevant logs and/or screenshots
E/AndroidRuntime: FATAL EXCEPTION: main
Process: edu.ncc.nest.nestapp, PID: 6472
java.lang.ArrayIndexOutOfBoundsException: length=12; index=-2
at edu.ncc.nest.nestapp.CheckExpirationDate.Fragments.SelectPrintedExpirationDateFragment.pickDay(SelectPrintedExpirationDateFragment.java:187)
at edu.ncc.nest.nestapp.CheckExpirationDate.Fragments.SelectPrintedExpirationDateFragment.lambda$CZ4e28OP6z10sWJmLpbo3FdWmeA(Unknown Source:0)
at edu.ncc.nest.nestapp.CheckExpirationDate.Fragments.-$$Lambda$SelectPrintedExpirationDateFragment$CZ4e28OP6z10sWJmLpbo3FdWmeA.onClick(Unknown Source:2)
at android.view.View.performClick(View.java:7448)
at android.view.View.performClickInternal(View.java:7425)
at android.view.View.access$3600(View.java:810)
at android.view.View$PerformClick.run(View.java:28305)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Possible fixes
The day button should either be disabled until a month has been selected, or the user should be able to choose from 31 days and have the app automatically change the selected day to the maximum day allowed for the selected month if their selection is above the maximum for the month.
Labels
NEST
Component:Check-Expiration-Date
Type::Bug
Status::Doing
Weight Explanation
I'm giving this a weight of 1 since it should be a straight forward and easy fix.