JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html

Doubts about object deletion management

JavaCard Applet Development Related Questions and Answers.
warex
Posts: 13
Joined: Mon Dec 14, 2015 10:46 pm
Points :214
Contact:

Doubts about object deletion management

Post by warex » Fri Dec 18, 2015 10:58 pm

Here is part of code about object deletion management under java card 3 platform classic edition. My doubts is when I call JCSystem.requestObjectDeletion(); is the buffer1 deleted or the buffer?

Code: Select all

void updateBuffer(byte requiredSize)
     {
     try
       {
          if(buffer != null && buffer.length == requiredSize)
             {
             ..// A buffer of required size
              return;
             }

          JCSystem.beginTransaction();
          byte[] buffer1 = buffer;
          buffer = new byte[requiredSize];

          if (buffer1 != null)
             JCSystem.requestObjectDeletion();

          JCSystem.commitTransaction();
      }

    catch(Exception e)
      {
          JCSystem.abortTransaction();
      }
   }

Tarantino
Posts: 101
Joined: Wed Aug 19, 2015 1:56 am
Points :478
Contact:

Re: Doubts about object deletion management

Post by Tarantino » Wed Dec 30, 2015 10:39 pm

Just try to modify your code as follows. It would be more clearer.

Code: Select all


...

      if(buffer != null && buffer.length == requiredSize)
             {
                ..// A buffer of required size
                return;
             }

       JCSystem.beginTransaction();
        buffer = new byte[requiredSize];
        JCSystem.requestObjectDeletion();
        JCSystem.commitTransaction();
...
The greatest glory in living lies not in never falling, but in rising every time we fall.--Nelson Mandela

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: Google [Bot] and 85 guests

JavaCard OS : Disclaimer