'RecordStore' opened but not safely closed
Reports Java ME javax.microedition.rms.RecordStore
resources that are not opened in front of a try
block and closed in the corresponding finally
block.
Such resources may be inadvertently leaked if an exception is thrown before the resource is closed.
This inspection is intended for Java ME and other highly resource constrained environments. Applying the results of this inspection without consideration might have negative effects on code clarity and design.
Example:
void foo1() throws RecordStoreException {
RecordStore rs = RecordStore.openRecordStore("bar", true); // warning
}
void foo2() throws RecordStoreException {
RecordStore rs = RecordStore.openRecordStore("bar", true); // no warning
try {
/* ... */
} finally {
rs.closeRecordStore();
}
}
Inspection options
Option | Type | Default |
---|---|---|
Allow resource to be opened inside a 'try' block | Checkbox | false |
Any method may close resource argument | Checkbox | true |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023