Skip to content

Commit

Permalink
Issue #16 - removing profiles didn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
kwart committed Jun 20, 2013
1 parent 50ab020 commit c41ab49
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/main/java/org/jboss/totp/TOTPMIDlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,6 @@ public void pauseApp() {
* @see javax.microedition.midlet.MIDlet#destroyApp(boolean)
*/
public void destroyApp(boolean unconditional) {
try {
save();
} catch (Exception e) {
debugErr("Saving config in destroyApp failed: " + e.getMessage());
error(e);
}
refreshTokenTask.cancel();
timer.cancel();
notifyDestroyed();
Expand Down Expand Up @@ -543,28 +537,28 @@ private int addProfileToRecordStore(final byte[] configBytes) {
* Removes record with given ID from a {@link RecordStore} with given name.
*
* @param storeName
* @param recordIdx
* @param recordId
*/
private void removeRecordFromStore(final String storeName, final int recordIdx) {
private void removeRecordFromStore(final String storeName, final int recordId) {
RecordStore tmpRS = null;
if (DEBUG)
debug("removeRecordFromStore - " + storeName + " - " + recordId);
try {
tmpRS = RecordStore.openRecordStore(storeName, false);
if (tmpRS.getNumRecords() > recordIdx) {
tmpRS.deleteRecord(recordIdx + 1);
}
tmpRS.deleteRecord(recordId);
} catch (RecordStoreNotFoundException e) {
if (DEBUG)
debug("removeRecordFromStore - RecordStoreNotFoundException - " + storeName);
} catch (Exception e) {
debugErr("removeRecordFromStore - " + e.getClass().getName() + " - " + storeName + " - " + recordIdx + ": "
debugErr("removeRecordFromStore - " + e.getClass().getName() + " - " + storeName + " - " + recordId + ": "
+ e.getMessage());
} finally {
if (tmpRS != null) {
try {
tmpRS.closeRecordStore();
} catch (RecordStoreException e) {
debugErr("removeRecordFromStore (close) - " + e.getClass().getName() + " - " + storeName + " - "
+ recordIdx + ": " + e.getMessage());
+ recordId + ": " + e.getMessage());
}
}
}
Expand Down

0 comments on commit c41ab49

Please sign in to comment.