secure-preferences
secure-preferences copied to clipboard
SecurePreferences.getInt throw java.lang.ClassCastException:null
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.
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.