Remove the null-termination for Java string compatibility.

1. Also change the keyname delimiter in CertTool.java.
2. Return NOTFOUND if the result.len==0 in the listKeys().
3. Define the keystore states in the class Keystore.
This commit is contained in:
Chung-yih Wang
2009-07-02 19:11:11 +08:00
parent eec11827a6
commit fa927c046a
3 changed files with 13 additions and 5 deletions

View File

@@ -25,6 +25,12 @@ public abstract class Keystore {
private static final String TAG = "Keystore";
private static final String[] NOTFOUND = new String[0];
// Keystore States
public static final int BOOTUP = 0;
public static final int UNINITIALIZED = 1;
public static final int LOCKED = 2;
public static final int UNLOCKED = 3;
/**
*/
public static Keystore getInstance() {
@@ -195,9 +201,11 @@ public abstract class Keystore {
public String[] listKeys(String namespace) {
Reply result = mServiceCommand.execute(ServiceCommand.LIST_KEYS,
namespace);
return (result != null) ? ((result.returnCode != 0) ? NOTFOUND :
new String(result.data, 0, result.len).split("\\s+"))
: NOTFOUND;
if ((result == null) || (result.returnCode != 0) ||
(result.len == 0)) {
return NOTFOUND;
}
return new String(result.data, 0, result.len).split("\\s+");
}
@Override