7 Replies Latest reply: Apr 25, 2014 6:02 AM by Andrey.P-Oracle RSS

    rms inconsistencies in sdk ea2?

    Colin Cooper

      I ran into some issues implementing RMSPersistentStore.

       

      It seems as though oracle-jmesdk-8-0-ea2-win32-bin.exe installs into c:\Java_ME_platform_SDK_8.0_EA an RMS whose RecordStore.addRecord signature is:

       

      public int addRecord(byte[], int, int) throws javax.microedition.rms.InvalidRecordIDException, javax.microedition.rms.RecordStoreException, javax.microedition.rms.RecordStoreNotOpenException

       

      However EA2 actually contains:

      public int addRecord(byte[], int, int) throws javax.microedition.rms.RecordStoreNotOpenException, javax.microedition.rms.RecordStoreException, javax.microedition.rms.RecordStoreFullException;

       

      The javadoc in Java_ME_platform_SDK_8.0_EA is consistent with the latter

       

       

      In either case, the RMSPersistentStore.saveData implementation has to catch and wrap these exceptions, as the course-provided PersistentStore.java declares saveData to throw an IOException -- but the RecordStoreException classes don't extend IOException.

       

      I'd appreciate if anyone could confirm that the above is accurate; if not could you point me to which bit of my environment might be incorrect.

       

        Thanks

        Colin

        • 1. Re: rms inconsistencies in sdk ea2?
          Andrey.P-Oracle

          Hi Colin,

           

          I'm not sure what your mean that ME SDK 8.0 EA installs an RMS with invalid method signature. But RecordStore.addRecord() shall have RecordStoreFullException, not InvalidRecordIDException. And Oracle's Java ME runtime has always had the proper signature

           

          WRT the PersistentStore.java I'll let for Tom to answer

           

          Regards,

          Andrey

          • 2. Re: rms inconsistencies in sdk ea2?
            Colin Cooper

            Andrey,

             

            I'm intrigued by your claim that "Oracle's Java ME runtime has always had the proper signature"?

             

            oracle-jmesdk-8-0-ea2-win32-bin.exe installs

            • code - C:\Java_ME_platform_SDK_8.0_EA\lib\meep_8.0-rms.jar
              • extracting & decompiling RecordStore shows
              • addRecord(byte[], int, int) throws javax.microedition.rms.InvalidRecordIDException, javax.microedition.rms.RecordStoreException, javax.microedition.rms.RecordStoreNotOpenException;
            • javadoc - C:\Java_ME_platform_SDK_8.0_EA\docs\api\meep-8.0.zip
              • javadoc for RecordStore shows
              • addRecord(byte[] data, int offset, int numBytes) throws RecordStoreNotOpenException,RecordStoreException, RecordStoreFullException

             

             

            This, to me, is an inconsistency.  Are you claiming that the class in your jar has a different signature for addRecord?


                 Regards,

                 Colin

            • 3. Re: rms inconsistencies in sdk ea2?
              Trinity

              Hi Colin

               

              Almost everyone usually only use the general RecordStoreException which is the superclass exception of both InvalidRecordIDException and RecordStoreFullException and several other exceptions as well.

              • 4. Re: rms inconsistencies in sdk ea2?
                Andrey.P-Oracle

                Hi Colin,

                 

                Please pardon my long reply. A small explanation: the meep_8.0-rms.jar is actually not the code, but rather stubs which are only used when application is compiled into bytecode (These are supplied to javac under the hood when you hit the Build or Run in Netbeans). The "runtime" I've referred to is the actual implementation of Java ME technology and is not directly related to the .jars in the lib folder (although in theory these should match )

                 

                So yes, this is definitely an inconsistency, but, unless you really write "catch (InvalidRecordIDException)" into your application it does not effect you

                 

                Regards,

                Andrey

                • 5. Re: rms inconsistencies in sdk ea2?
                  Trinity

                  Thanks Andrey, also I think you can write out all the subclass exceptions of RecordStoreException, including the RecordStoreException itself without being affected....just in case you really want to catch specific exceptions.

                  • 6. Re: rms inconsistencies in sdk ea2?
                    Colin Cooper

                    Thanks - that explains a lot.

                     

                    It would be good if the stubs matched the implementation though -- I only discovered this when NetBeans generated a catch block for me which the compiler later rejected.

                    • 7. Re: rms inconsistencies in sdk ea2?
                      Andrey.P-Oracle

                      Absolutely agree. But please note that letters EA in "EA2" deciphers to "Early Access"

                      Of course the bug was fixed, you will not find it in "EA2 latest developer build" or GA release, when it's out

                       

                      Regards,

                      Andrey