Comments (5)
Hi! What version of library do you use?
Also one question: what key you use for fetching Persistable
from preferences?
It looks like registered Persistable
object key differs with key witch has been passed into getPersistable
method.
from binaryprefs.
As you can see this code part tries to fetch registered Persistable
class type for instantiation and deserialization of stored binary data and in your case it just not found after getPersistable
invocation because your key from getPersistable
does not found inside PersistableRegistry
map structure.
from binaryprefs.
I can recommend disable all encryption for checking how works simple fetching. Because most of problems is incorrect custom key/value encryption. Also I recommend to use bundled encryption algorithms and different keys for each of.
from binaryprefs.
The original question based on 1.0.0-BETA-2.
Also i have tried 0.9.9.9, and caught another exception:
Caused by: com.ironz.binaryprefs.exception.FileOperationException: java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException: Can't read out of bounds array (71 bytes > 62 bytes). May be your read/write contract isn't mirror-implemented?
at com.ironz.binaryprefs.task.Completable.completeBlockingUnsafe(Completable.java:44)
at com.ironz.binaryprefs.BinaryPreferences.fetchCache(BinaryPreferences.java:60)
at com.ironz.binaryprefs.BinaryPreferences.<init>(BinaryPreferences.java:40)
at com.ironz.binaryprefs.BinaryPreferencesBuilder.build(BinaryPreferencesBuilder.java:205)
There is getting of my encription keys (this part has never been changed since first implementation):
private val INITIAL_VECTOR = "be or not to be that is the question".toByteArray()
private val SECRET_KEY = "be or not to be that is the question".toByteArray()
val initialVector = Arrays.copyOf(INITIAL_VECTOR, 16)
val secretKey = Arrays.copyOf(SECRET_KEY, 16)
BinaryPreferencesBuilder(context)
.keyEncryption(XorKeyEncryptionImpl(secretKey))
.valueEncryption(AesValueEncryptionImpl(secretKey, initialVector))
My experiment with disabled encription:
Caused by: com.ironz.binaryprefs.exception.FileOperationException: java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException: Can't read out of bounds array (expected size: LogoPass bytes > disk size: 71 bytes) for 62! keyMay be your read/write contract isn't mirror-implemented or old disk version is not backward compatible with new class version?
at com.ironz.binaryprefs.task.FutureBarrier.completeBlockingUnsafe(FutureBarrier.java:44)
at com.ironz.binaryprefs.BinaryPreferences.fetchCache(BinaryPreferences.java:52)
at com.ironz.binaryprefs.BinaryPreferences.<init>(BinaryPreferences.java:40)
at com.ironz.binaryprefs.BinaryPreferencesBuilder.createInstance(BinaryPreferencesBuilder.java:251)
at com.ironz.binaryprefs.BinaryPreferencesBuilder.build(BinaryPreferencesBuilder.java:226)
As i can see there is migration required, but i'm not sure how to do it correctly. What is "old preferences" and "new preferences" at the docs?
from binaryprefs.
"old" - disk version means your old saving protocol for first version of Persistable
.
"new" - means actual protocol which tries restore old saved data based on your first protocol version.
If you wanna to use migration for your Persistable
you should follow mutual steps as in java.io.Externalizable
interface. Read manuals about it.
from binaryprefs.
Related Issues (20)
- Problem with getting data from Set<String> HOT 5
- Incorrect state of contains method of BinaryPrefs after creation HOT 4
- editor.clear() not clears prefs HOT 4
- Add lazy evaluation for default values HOT 4
- Impossible to use without Android HOT 1
- FileChannel#write is now removed from 28 dp1 api
- External storage sometimes is empty line
- Preferences should be instantiated in the main thread. HOT 8
- Encryption key update HOT 4
- Support for Lists, Sets and Arrays HOT 4
- RuntimeException: Unable to start receiver com.ironz.binaryprefs.dump.DumpReceiver HOT 3
- Can't create preferences directory in /mnt/expand/ HOT 1
- So the inter process part is asynchronized? HOT 1
- Change UnsupportedClassVersionError error to an meaningful
- In-memory cache of byte array is vulnerable for external modifications HOT 3
- 🐞Bug with encryption HOT 3
- Create a ktx module
- Could you release the new version with current changes please? HOT 5
- Clear all prefs at once
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binaryprefs.