MTP: Add try/finally handling to finalize overrides

Change-Id: I23c481d6214ed5f045f903845632c07c11bb42a3
Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
Mike Lockwood
2010-08-30 09:27:55 -04:00
parent 48114f72fd
commit dbead321da
4 changed files with 24 additions and 7 deletions

View File

@@ -41,8 +41,12 @@ public class MtpClient {
}
@Override
protected void finalize() {
native_finalize();
protected void finalize() throws Throwable {
try {
native_finalize();
} finally {
super.finalize();
}
}
public boolean start() {

View File

@@ -97,7 +97,11 @@ public final class MtpCursor extends AbstractWindowedCursor {
@Override
protected void finalize() {
native_finalize();
try {
native_finalize();
} finally {
super.finalize();
}
}
@Override

View File

@@ -86,8 +86,13 @@ public class MtpDatabase {
}
@Override
protected void finalize() {
native_finalize();
protected void finalize() throws Throwable {
try {
native_finalize();
mDevicePropDb.close();
} finally {
super.finalize();
}
}
private int beginSendObject(String path, int format, int parent,

View File

@@ -35,8 +35,12 @@ public class MtpServer {
}
@Override
protected void finalize() {
native_finalize();
protected void finalize() throws Throwable {
try {
native_finalize();
} finally {
super.finalize();
}
}
public void start() {