secure-preferences icon indicating copy to clipboard operation
secure-preferences copied to clipboard

SecurePreferences.getInt throw java.lang.ClassCastException:null

Open pzl237 opened this issue 7 years ago • 1 comments

My app uses the version 0.1.4. Recently, I met a problem: call SecurePreferences. getInt() method, throw "Java. Lang. ClassCastException: null". I find in source code, and find the decrypt (final String ciphertext) method may return null, so the Integer. ParseInt (null) method would throw this exception. I think SecurePreferences. getInt (String key, int defaultValue) method should take the initiative to throw an exception, life for SecurePreferences. getInt (String key, int defaultValue) method throws a NumberFormatException, so that the caller can try catch this a NumberFormatException exception.

pzl237 avatar Apr 26 '17 07:04 pzl237

i got this error too, it is very rare tho. idk what happened but seems it failed to decipher the encrypted string causing Integer.parseInt fail to parse.

alkaaf avatar Mar 26 '18 01:03 alkaaf