7 Replies Latest reply on Jul 3, 2008 10:45 AM by Oliver Goldman

    AIR EncryptedLocalStore runtime error

    ljonny18 Level 1
      Hi can anyone help me out with this runtime error in AIR:

      I am trying to read a string form the EncryptedLocalStore using the following code:

      var newStr:String = "";
      var elsRead:ByteArray = EncryptedLocalStore.getItem("myEncryptedStr");

      if(elsRead != null)
      newStr = elsRead.readUTFBytes(elsRead.length);

      it is the line:
      var elsRead:ByteArray = EncryptedLocalStore.getItem("myEncryptedStr");

      that is causing the problem, and giving me the following runtime error:

      Error: general internal error
      at flash.data::EncryptedLocalStore$/processErrorCode()
      at flash.data::EncryptedLocalStore$/getItem()

      Does anyone have any ideas about what I am doing wrong or why I am getting this runtime error when I run my Flex / Air application.

      Also, when I restart my app the data in the local store is remembered... however if I update my AIR app using the Update() functionality, the data in the local store seems to get lost - again, can anyone help me out here, why is the data getting lost on an update???

        • 1. Re: AIR EncryptedLocalStore runtime error
          Oliver Goldman Adobe Employee
          When you receive an error like this from ELS, it indicates that the ELS store has been corrupted in some way. Your application should call reset() to clear the bad state.

          Updating your application does not clear the ELS data. I'd need more details to try and determine what's going wrong.

          • 2. AIR EncryptedLocalStore runtime error
            ljonny18 Level 1
            Hi thanks for the reply.

            I reset my ELS calling the reset() method, and yes it did remove the error, but not for long - it came back.
            I guess I am writing something to the ELS from my application that it does not like?

            It is strange, as, when I run the application it remembers / keeps the data in the ELS fine, even when I create a new AIR install it still remembers / keeps the data, no problem.
            I have noticed that, when I changed the version number of the application and then create a new AIR application - it then forgets / looses this information.

            What is even more strange, is that within my AIR application I am including a lib ("swc" file) from another project, and this "swc" is also writing to the ELS, but never forgets / looses its written data even when the application version is changed.

            I may be wrong on this - but I assume the "swc" is writing to the same ELS as the application, as it is included in the application and exported within the application, so is essentially the same application so same ELS???

            Any further thoughts?

            Also, can I ask you, how secure is the EncryptedLocalStore? can the file it writes to be accessed easily and modified / deleted?

            Thanks again,
            • 3. Re: AIR EncryptedLocalStore runtime error
              Oliver Goldman Adobe Employee
              I don't think AIR is losing the ELS data. As you note, the SWC is accessing the same ELS and that's working, even when the version # changes.

              ELS files can be easily deleted; it's not designed to protect against that. However, they cannot be easily read or modified.

              • 4. Re: AIR EncryptedLocalStore runtime error
                ljonny18 Level 1
                Hi, thanks again for your fast reply.

                is there any way to detect if an AIR app has been loaded for the first time (I think I remember scanning a related article re this, but I cant seem to find it again). E.g. if the ELS file is deleted is there any other way to check if the app has been loaded for the first time (I currently just write a var to the ELS that is checked against on further load ups).

                Re my corruption problem / loosing data. I have tested this a bit more.
                I am with you on this, and I don't think the ELS is loosing the data as you mentioned is can read the data written to it form the included swc file.
                I just seems to crash on the data written from the app itself and I am going with the fact that this data is corrupted in some way.....
                I havetraced all the values that are causing the crash during a debug session and they look good / as expected. it is really just when the application version ID is change that these (and only these) values being read are getting corrupted (somehow), However as mentioned, the values that were written form the included SWC file can be read fin with no problems whatsoever....

                anybody got any suggestions?

                Thanks again,
                • 5. Re: AIR EncryptedLocalStore runtime error
                  Oliver Goldman Adobe Employee
                  Storing data somewhere is a good way to check for first launch, but I'd store that information elsewhere; not in ELS.

                  Are you using the stronglyBound parameter when calling setItem()? That binds the data to a specific version of your application, which would explain why it's not available after an update.

                  • 6. Re: AIR EncryptedLocalStore runtime error
                    ljonny18 Level 1
                    Where would you suggest to store the date to detect if it is a first launch....
                    maybe write a file deep in a systems file storage???

                    what do you mean by a strongly bound parameter??
                    When I call the setItem() I am calling it in a different class within the application, and tew values that I am writing to store are simple strings that are declared in the same class:
                    public var myString = new string(); etc......

                    Thanks again,
                    • 7. Re: AIR EncryptedLocalStore runtime error
                      Oliver Goldman Adobe Employee
                      It doesn't really matter where you write the file. File.applicationStorage is a handy location.

                      By "strongly bound", I was referring to the third parameter to the setItem() call.