Skip to content

Commit

Permalink
RecordStore: Minor improvements and adjustments
Browse files Browse the repository at this point in the history
Stub enumerateRecords with tags, remove a null pointer check when
creating a new enumeration (jars like to do this), and rewrite
RecordStore's own null pointer check (this one has to stay, as
creating a record store from a null name shouldn't be supported)
  • Loading branch information
AShiningRay committed Nov 24, 2024
1 parent f7036b5 commit aa8b90e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/javax/microedition/rms/RecordStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class RecordStore

private RecordStore(String recordStoreName, boolean createIfNecessary) throws RecordStoreException, RecordStoreNotFoundException
{
if(recordStoreName == null) { throw new NullPointerException("RecordEnumeration received a null argument"); }
if(recordStoreName == null) { throw new NullPointerException("RecordStore received a null argument"); }

Mobile.log(Mobile.LOG_DEBUG, RecordStore.class.getPackage().getName() + "." + RecordStore.class.getSimpleName() + ": " + "> RecordStore "+recordStoreName);

Expand Down Expand Up @@ -290,6 +290,12 @@ public RecordEnumeration enumerateRecords(RecordFilter filter, RecordComparator
return new enumeration(filter, comparator, keepUpdated);
}

public RecordEnumeration enumerateRecords(RecordFilter filter, RecordComparator comparator, boolean keepUpdated, int[] tags)
{
Mobile.log(Mobile.LOG_WARNING, RecordStore.class.getPackage().getName() + "." + RecordStore.class.getSimpleName() + ": " + "RecordStore.enumerateRecords with tags not implemented. Enumerating without tags...");
return new enumeration(filter, comparator, keepUpdated);
}

public long getLastModified() { return lastModified; }

public String getName() { return name; }
Expand Down Expand Up @@ -460,7 +466,7 @@ public void setRecord(int recordId, byte[] newData, int offset, int numBytes) th

if (recordId == records.size()-1)
{
Mobile.log(Mobile.LOG_INFO, RecordStore.class.getPackage().getName() + "." + RecordStore.class.getSimpleName() + ": " + "> "+recordId+" in "+name + "has no data yet, creating it now as a workaround.");
Mobile.log(Mobile.LOG_INFO, RecordStore.class.getPackage().getName() + "." + RecordStore.class.getSimpleName() + ": " + "> "+recordId+" in "+name + " has no data yet, creating it now as a workaround.");
addRecord(newData, offset, numBytes);
return;
}
Expand Down Expand Up @@ -513,7 +519,6 @@ private class enumeration implements RecordEnumeration

public enumeration(RecordFilter filter, RecordComparator comparator, boolean keepUpdated)
{
if(filter == null || comparator == null) { throw new NullPointerException("RecordEnumeration received a null argument"); }
keepupdated = keepUpdated;
index = 0;
count = 0;
Expand Down

0 comments on commit aa8b90e

Please sign in to comment.