Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Olm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
Olm
Commits
bacdc3c5
Commit
bacdc3c5
authored
8 years ago
by
ylecollen
Browse files
Options
Downloads
Patches
Plain Diff
Add an encoding type while converting byte[] to string
parent
1c067b1c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java
+22
-4
22 additions, 4 deletions
...bSdk/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java
with
22 additions
and
4 deletions
java/android/OlmLibSdk/olm-sdk/src/main/java/org/matrix/olm/OlmAccount.java
+
22
−
4
View file @
bacdc3c5
...
...
@@ -244,7 +244,16 @@ public class OlmAccount extends CommonSerializeUtils implements Serializable {
if
(
null
!=
(
identityKeysBuffer
=
identityKeysJni
()))
{
try
{
identityKeysJsonObj
=
new
JSONObject
(
new
String
(
identityKeysBuffer
));
String
identityKeysString
;
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());
}
catch
(
JSONException
e
)
{
identityKeysJsonObj
=
null
;
...
...
@@ -301,12 +310,21 @@ public class OlmAccount extends CommonSerializeUtils implements Serializable {
* @return one time keys in string dictionary if operation succeed, null otherwise
*/
public
Map
<
String
,
Map
<
String
,
String
>>
oneTimeKeys
()
{
byte
identity
KeysBuffer
[];
byte
oneTime
KeysBuffer
[];
JSONObject
oneTimeKeysJsonObj
=
null
;
if
(
null
!=
(
identity
KeysBuffer
=
oneTimeKeysJni
()))
{
if
(
null
!=
(
oneTime
KeysBuffer
=
oneTimeKeysJni
()))
{
try
{
oneTimeKeysJsonObj
=
new
JSONObject
(
new
String
(
identityKeysBuffer
));
String
oneTimeKeysString
;
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());
}
catch
(
JSONException
e
)
{
oneTimeKeysJsonObj
=
null
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment