I'm running a pretty weird problem on my application.
I store data i download from the internet on several RMS, once they are used and there no need for those, the RMS has to be erased, but I have this problem. The RMS will be deleting "sometimes" and not always as is supposed to be.
I'm developing this application specially for balckberrys, hence i'm using the blackberry API, the only j2me thing i'm using is the RMS as I have been working with this application for over a year and i'm already waaaay to used to the RMS.
Well, the problem is, sometimes, when trying to delete the RMS, they will be deleted withouth a problem, but other times, they won't be and a RecordStoreException is thrown were the error message is just the name of the RMS i want to delete.
This is the code of the deleting process
PHP Code:
public void wipeOut(String ruta, String itinerario)
{
salirSistema(); // This makes sure the RMS are closed
nombre = RecordStore.listRecordStores();
/**
* Nomenclatura de la tablas
* rutaDBRxIyTz
* sistemaDBRxIy
* EnviadosRxIy
* RevisadosRxIy
* R -> Ruta
* I -> Itinerario
* T -> Tabla
* x, y, z -> Son nĂºmeros enteros que pueden ser del 0 hasta el infinito
*/
for (int i = 0; i < nombre.length; i++)
{
try
{
Debug(nombrexxx91;ixxx93;);
if (contenido(nombrexxx91;ixxx93;, "rutaDBR" + ruta + "I" + itinerario + "T"))
RecordStore.deleteRecordStore(nombrexxx91;ixxx93;);
else if (nombrexxx91;ixxx93;.equals("EnviadosR" + ruta + "I" + itinerario))
RecordStore.deleteRecordStore(nombrexxx91;ixxx93;);
else if (nombrexxx91;ixxx93;.equals("RevisadosR" + ruta + "I" + itinerario))
RecordStore.deleteRecordStore(nombrexxx91;ixxx93;);
else if (nombrexxx91;ixxx93;.equals("sistemaDBR" + ruta + "I" + itinerario))
RecordStore.deleteRecordStore(nombrexxx91;ixxx93;);
}
catch(RecordStoreNotFoundException e)
{
Debug("No se encontro la tabla " + nombrexxx91;ixxx93;);
}
catch(RecordStoreException e)
{
Debug("Se suscito un error: " + e.getMessage());
}
catch(Exception e)
{
Debug("Se suscito un error: " + e.getMessage());
}
}
// message(mensaje, 2500, formaLogin);
}
I have 4 types of RMS.
1.- rutaDBRxIyTz, were i store all my data, but given that there can be a lot of data to be downloaded and a RecordStoreFullException might be thrown, I store it in several subsecuents RMS. Hence the Tz, where T stands for Table and z the secuencial number of the RMS so somtimes there can be a lof ot tables like this:
rutaDBRxIyT0
rutaDBRxIyT1
rutaDBRxIyT2
.
.
.
rutaDBRxIyTn
2.- sistemaDBRxIy, were is store information regarding the data is being worked liked how many registers were downloaded, how many haven already revised and how many sended back and stuff like that
3.- RevisadosRxIy, were i check which indexes on the rutaDB RMs have been already reviewed
4.- EnviadosRxIy, were i check which indexes on the rutaDB RMs have been sended back to the server DB
Becuase i want to make sure i'm not commiting a mistake when deleting the RMs, i store all the current created RMS on a String array (nombre) and go through it comparing the names to the ones i want to delete. In the case of the rutaDBRxIyTz RMS's, i don't know how many RMS's were created to store all the data, so for that I created a function named "contenido" that works as the String function subString() so I look in the index "i" of "nombre" for the subString "rutaDBRxIyT" and when its a match it means it one of the tables created. Once i found a match i delete that RMS. But sometimes the RecordStoreException is thrown and the error message is the name of the RMS.
When creating the RMS, i only set the name and the boolean value (openRecordStore(String recordStoreName, boolean createIfNecessary) ).
Any idea why this might be happening. Its driving me crazy as there's no logic for it