identityKeys / oneTimeKeys : remove useless try/catch blocks
This commit is contained in:
parent
b2b182161e
commit
2a7c191d84
1 changed files with 8 additions and 28 deletions
|
@ -241,23 +241,13 @@ public class OlmAccount extends CommonSerializeUtils implements Serializable {
|
||||||
*/
|
*/
|
||||||
public Map<String, String> identityKeys() {
|
public Map<String, String> identityKeys() {
|
||||||
JSONObject identityKeysJsonObj = null;
|
JSONObject identityKeysJsonObj = null;
|
||||||
byte identityKeysBuffer[];
|
byte[] identityKeysBuffer = identityKeysJni();
|
||||||
|
|
||||||
if( null != (identityKeysBuffer = identityKeysJni())) {
|
if (null != identityKeysBuffer) {
|
||||||
try {
|
try {
|
||||||
String identityKeysString;
|
identityKeysJsonObj = new JSONObject(new String(identityKeysBuffer, "UTF-8"));
|
||||||
|
|
||||||
try {
|
|
||||||
identityKeysString = new String(identityKeysBuffer, "UTF-8");
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(LOG_TAG, "## identityKeys(): Exception : cannot convert with utf-8 charset " + e.getMessage());
|
|
||||||
identityKeysString = new String(identityKeysBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
identityKeysJsonObj = new JSONObject(identityKeysString);
|
|
||||||
//Log.d(LOG_TAG, "## identityKeys(): Identity Json keys=" + identityKeysJsonObj.toString());
|
//Log.d(LOG_TAG, "## identityKeys(): Identity Json keys=" + identityKeysJsonObj.toString());
|
||||||
} catch (JSONException e) {
|
} catch (Exception e) {
|
||||||
identityKeysJsonObj = null;
|
|
||||||
Log.e(LOG_TAG, "## identityKeys(): Exception - Msg=" + e.getMessage());
|
Log.e(LOG_TAG, "## identityKeys(): Exception - Msg=" + e.getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -311,24 +301,14 @@ public class OlmAccount extends CommonSerializeUtils implements Serializable {
|
||||||
* @return one time keys in string dictionary if operation succeed, null otherwise
|
* @return one time keys in string dictionary if operation succeed, null otherwise
|
||||||
*/
|
*/
|
||||||
public Map<String, Map<String, String>> oneTimeKeys() {
|
public Map<String, Map<String, String>> oneTimeKeys() {
|
||||||
byte oneTimeKeysBuffer[];
|
|
||||||
JSONObject oneTimeKeysJsonObj = null;
|
JSONObject oneTimeKeysJsonObj = null;
|
||||||
|
byte[] oneTimeKeysBuffer = oneTimeKeysJni();
|
||||||
|
|
||||||
if( null != (oneTimeKeysBuffer = oneTimeKeysJni())) {
|
if( null != oneTimeKeysBuffer) {
|
||||||
try {
|
try {
|
||||||
String oneTimeKeysString;
|
oneTimeKeysJsonObj = new JSONObject(new String(new String(oneTimeKeysBuffer, "UTF-8")));
|
||||||
|
|
||||||
try {
|
|
||||||
oneTimeKeysString = new String(oneTimeKeysBuffer, "UTF-8");
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(LOG_TAG, "## oneTimeKeys(): Exception : cannot convert with utf-8 charset " + e.getMessage());
|
|
||||||
oneTimeKeysString = new String(oneTimeKeysBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
oneTimeKeysJsonObj = new JSONObject(new String(oneTimeKeysString));
|
|
||||||
//Log.d(LOG_TAG, "## oneTimeKeys(): OneTime Json keys=" + oneTimeKeysJsonObj.toString());
|
//Log.d(LOG_TAG, "## oneTimeKeys(): OneTime Json keys=" + oneTimeKeysJsonObj.toString());
|
||||||
} catch (JSONException e) {
|
} catch (Exception e) {
|
||||||
oneTimeKeysJsonObj = null;
|
|
||||||
Log.e(LOG_TAG, "## oneTimeKeys(): Exception - Msg=" + e.getMessage());
|
Log.e(LOG_TAG, "## oneTimeKeys(): Exception - Msg=" + e.getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue