JavaCard Applet Development Related Questions and Answers.
-
warex
- Posts: 13
- Joined: Mon Dec 14, 2015 10:46 pm
- Points :214
-
Contact:
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:
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
Users browsing this forum: Google [Bot] and 85 guests
JavaCard OS : Disclaimer
Board Disclaimer
The views and comments posted in these fora are personal and do not necessarily represent the those of the Management of JavaCard OS.
The Management of JavaCard OS does not, under any circumstances whatsoever, accept any responsibility for any advice, or recommentations, made by, or implied by, any member or guest vistor of JavaCard OS that results in any loss whatsoever in any manner to a member of JavaCard OS, or to any other person.
Furthermore, the Management of JavaCard OS is not, and cannot be, responsible for the content of any other Internet site(s) that have been linked to from JavaCard OS.