aboutsummaryrefslogtreecommitdiff
path: root/java/android/OlmLibSdk/olm-sdk/src/main
diff options
context:
space:
mode:
authorpedroGitt <pedro.contreiras@amdocs.com>2016-10-28 10:49:04 +0200
committerpedroGitt <pedro.contreiras@amdocs.com>2016-10-28 10:49:04 +0200
commit7a0d7cc36dfb2c1d7649af181160767a844e81f6 (patch)
treeabffb7d54e60aec4aac80954d9ef1c9b11cfeb5e /java/android/OlmLibSdk/olm-sdk/src/main
parent0d3c1a2a46589b004231b92f44d3bc8e327e0097 (diff)
Fix OlmException cast issue
- OlmException class extends now from IOException - update corresponding serializing unit tests - update
Diffstat (limited to 'java/android/OlmLibSdk/olm-sdk/src/main')
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java6
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmException.java21
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java6
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmOutboundGroupSession.java6
-rw-r--r--java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmSession.java6
5 files changed, 19 insertions, 26 deletions
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java b/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java
index 321e194..876e651 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java
@@ -69,9 +69,8 @@ public class OlmAccount implements Serializable {
* Kick off the serialization mechanism.
* @param aOutStream output stream for serializing
* @throws IOException exception
- * @throws OlmException exception
*/
- private void writeObject(ObjectOutputStream aOutStream) throws IOException, OlmException {
+ private void writeObject(ObjectOutputStream aOutStream) throws IOException {
aOutStream.defaultWriteObject();
// generate serialization key
@@ -94,9 +93,8 @@ public class OlmAccount implements Serializable {
* @param aInStream input stream
* @throws IOException exception
* @throws ClassNotFoundException exception
- * @throws OlmException exception
*/
- private void readObject(ObjectInputStream aInStream) throws IOException, ClassNotFoundException, OlmException {
+ private void readObject(ObjectInputStream aInStream) throws IOException, ClassNotFoundException {
aInStream.defaultReadObject();
StringBuffer errorMsg = new StringBuffer();
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmException.java b/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmException.java
index d548cf7..bac49f4 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmException.java
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmException.java
@@ -16,10 +16,12 @@
package org.matrix.olm;
+import java.io.IOException;
+
/**
* Exception class to identify specific Olm SDK exceptions.
*/
-public class OlmException extends Exception {
+public class OlmException extends IOException {
// exception codes
public static final int EXCEPTION_CODE_CREATE_OUTBOUND_GROUP_SESSION = 0;
public static final int EXCEPTION_CODE_CREATE_INBOUND_GROUP_SESSION = 1;
@@ -37,18 +39,17 @@ public class OlmException extends Exception {
public static final int EXCEPTION_CODE_INBOUND_GROUP_SESSION_DESERIALIZATION = 13;
// exception human readable messages
- public static final String EXCEPTION_MSG_NEW_OUTBOUND_GROUP_SESSION = "failed to create a new outbound group Session";
- public static final String EXCEPTION_MSG_NEW_INBOUND_GROUP_SESSION = "failed to create a new inbound group Session";
- public static final String EXCEPTION_MSG_INIT_OUTBOUND_GROUP_SESSION = "failed to initialize a new outbound group Session";
- public static final String EXCEPTION_MSG_INIT_INBOUND_GROUP_SESSION = "failed to initialize a new inbound group Session";
+ public static final String EXCEPTION_MSG_NEW_OUTBOUND_GROUP_SESSION = "createNewSession() failed";
+ public static final String EXCEPTION_MSG_NEW_INBOUND_GROUP_SESSION = "createNewSession() failed";
+ public static final String EXCEPTION_MSG_INIT_OUTBOUND_GROUP_SESSION = "initOutboundGroupSession() failed";
+ public static final String EXCEPTION_MSG_INIT_INBOUND_GROUP_SESSION = " initInboundGroupSessionWithSessionKey() failed";
public static final String EXCEPTION_MSG_INIT_NEW_ACCOUNT_DESERIALIZATION = "initNewAccount() failure";
- public static final String EXCEPTION_MSG_INIT_ACCOUNT_DESERIALIZATION = "initWithSerializedData() failure";
public static final String EXCEPTION_MSG_INVALID_PARAMS_DESERIALIZATION = "invalid de-serialized parameters";
- public static final String EXCEPTION_MSG_INIT_ACCOUNT_CREATION = "Account constructor failure";
- public static final String EXCEPTION_MSG_INIT_SESSION_CREATION = "Session constructor failure";
+ public static final String EXCEPTION_MSG_INIT_ACCOUNT_CREATION = "initNewAccount() failed";
+ public static final String EXCEPTION_MSG_INIT_SESSION_CREATION = "initNewSession() failed";
- /** exception code to be taken from: {@link #EXCEPTION_CODE_CREATE_OUTBOUND_GROUP_SESSION} {@link #EXCEPTION_CODE_CREATE_INBOUND_GROUP_SESSION}
- * {@link #EXCEPTION_CODE_INIT_OUTBOUND_GROUP_SESSION} {@link #EXCEPTION_CODE_INIT_INBOUND_GROUP_SESSION}**/
+ /** exception code to be taken from: {@link #EXCEPTION_CODE_CREATE_OUTBOUND_GROUP_SESSION}, {@link #EXCEPTION_CODE_CREATE_INBOUND_GROUP_SESSION},
+ * {@link #EXCEPTION_CODE_INIT_OUTBOUND_GROUP_SESSION}, {@link #EXCEPTION_CODE_INIT_INBOUND_GROUP_SESSION}..**/
private final int mCode;
/** Human readable message description **/
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java b/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java
index f7e1812..501d660 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java
@@ -137,9 +137,8 @@ public class OlmInboundGroupSession implements Serializable {
* Kick off the serialization mechanism.
* @param aOutStream output stream for serializing
* @throws IOException exception
- * @throws OlmException exception
*/
- private void writeObject(ObjectOutputStream aOutStream) throws IOException, OlmException {
+ private void writeObject(ObjectOutputStream aOutStream) throws IOException {
aOutStream.defaultWriteObject();
// generate serialization key
@@ -162,9 +161,8 @@ public class OlmInboundGroupSession implements Serializable {
* @param aInStream input stream
* @throws IOException exception
* @throws ClassNotFoundException exception
- * @throws OlmException exception
*/
- private void readObject(ObjectInputStream aInStream) throws IOException, ClassNotFoundException, OlmException {
+ private void readObject(ObjectInputStream aInStream) throws IOException, ClassNotFoundException {
aInStream.defaultReadObject();
StringBuffer errorMsg = new StringBuffer();
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmOutboundGroupSession.java b/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmOutboundGroupSession.java
index 8ba3bcb..37f89ea 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmOutboundGroupSession.java
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmOutboundGroupSession.java
@@ -63,9 +63,8 @@ public class OlmOutboundGroupSession implements Serializable {
* Kick off the serialization mechanism.
* @param aOutStream output stream for serializing
* @throws IOException exception
- * @throws OlmException exception
*/
- private void writeObject(ObjectOutputStream aOutStream) throws IOException, OlmException {
+ private void writeObject(ObjectOutputStream aOutStream) throws IOException {
aOutStream.defaultWriteObject();
// generate serialization key
@@ -88,9 +87,8 @@ public class OlmOutboundGroupSession implements Serializable {
* @param aInStream input stream
* @throws IOException exception
* @throws ClassNotFoundException exception
- * @throws OlmException exception
*/
- private void readObject(ObjectInputStream aInStream) throws IOException, ClassNotFoundException, OlmException {
+ private void readObject(ObjectInputStream aInStream) throws IOException, ClassNotFoundException {
aInStream.defaultReadObject();
StringBuffer errorMsg = new StringBuffer();
diff --git a/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmSession.java b/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmSession.java
index 1237efd..9377838 100644
--- a/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmSession.java
+++ b/java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmSession.java
@@ -52,9 +52,8 @@ public class OlmSession implements Serializable {
* Kick off the serialization mechanism.
* @param aOutStream output stream for serializing
* @throws IOException exception
- * @throws OlmException exception
*/
- private void writeObject(ObjectOutputStream aOutStream) throws IOException, OlmException {
+ private void writeObject(ObjectOutputStream aOutStream) throws IOException {
aOutStream.defaultWriteObject();
// generate serialization key
@@ -77,9 +76,8 @@ public class OlmSession implements Serializable {
* @param aInStream input stream
* @throws IOException exception
* @throws ClassNotFoundException exception
- * @throws OlmException exception
*/
- private void readObject(ObjectInputStream aInStream) throws IOException, ClassNotFoundException, OlmException {
+ private void readObject(ObjectInputStream aInStream) throws IOException, ClassNotFoundException {
aInStream.defaultReadObject();
StringBuffer errorMsg = new StringBuffer();