Skip to content

Commit f2d3c04

Browse files
Add error field to file result and set on decrypt error (#294)
* Add error field to file result and set on decrypt error * PubNub SDK v6.4.3 release. --------- Co-authored-by: PubNub Release Bot <120067856+pubnub-release-bot@users.noreply.github.com>
1 parent 32d76c6 commit f2d3c04

11 files changed

Lines changed: 43 additions & 13 deletions

File tree

.pubnub.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: java
2-
version: 6.4.2
2+
version: 6.4.3
33
schema: 1
44
scm: github.com/pubnub/java
55
files:
6-
- build/libs/pubnub-gson-6.4.2-all.jar
6+
- build/libs/pubnub-gson-6.4.3-all.jar
77
sdks:
88
-
99
type: library
@@ -23,8 +23,8 @@ sdks:
2323
-
2424
distribution-type: library
2525
distribution-repository: maven
26-
package-name: pubnub-gson-6.4.2
27-
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-gson/6.4.2/pubnub-gson-6.4.2.jar
26+
package-name: pubnub-gson-6.4.3
27+
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-gson/6.4.3/pubnub-gson-6.4.3.jar
2828
supported-platforms:
2929
supported-operating-systems:
3030
Android:
@@ -115,6 +115,11 @@ sdks:
115115
is-required: Required
116116

117117
changelog:
118+
- date: 2023-11-28
119+
version: v6.4.3
120+
changes:
121+
- type: feature
122+
text: "Add `error` field to `PNFileEventResult` and set it in case of decryption failure."
118123
- date: 2023-11-23
119124
version: v6.4.2
120125
changes:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v6.4.3
2+
November 28 2023
3+
4+
#### Added
5+
- Add `error` field to `PNFileEventResult` and set it in case of decryption failure.
6+
17
## v6.4.2
28
November 23 2023
39

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ You will need the publish and subscribe keys to authenticate your app. Get your
2222
<dependency>
2323
<groupId>com.pubnub</groupId>
2424
<artifactId>pubnub-gson</artifactId>
25-
<version>6.4.2</version>
25+
<version>6.4.3</version>
2626
</dependency>
2727
```
2828

2929
* for Gradle, add the following dependency in your `gradle.build`:
3030
```groovy
31-
implementation 'com.pubnub:pubnub-gson:6.4.2'
31+
implementation 'com.pubnub:pubnub-gson:6.4.3'
3232
```
3333

3434
2. Configure your keys:

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010
}
1111
group = 'com.pubnub'
1212

13-
version = '6.4.2'
13+
version = '6.4.3'
1414

1515
description = """"""
1616

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SONATYPE_HOST=DEFAULT
33
SONATYPE_AUTOMATIC_RELEASE=true
44
GROUP=com.pubnub
55
POM_ARTIFACT_ID=pubnub-gson
6-
VERSION_NAME=6.4.2
6+
VERSION_NAME=6.4.3
77
POM_PACKAGING=jar
88

99
POM_NAME=PubNub Java SDK

src/main/java/com/pubnub/api/PubNub.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public class PubNub {
105105
private static final int TIMESTAMP_DIVIDER = 1000;
106106
private static final int MAX_SEQUENCE = 65535;
107107

108-
private static final String SDK_VERSION = "6.4.2";
108+
private static final String SDK_VERSION = "6.4.3";
109109
private final ListenerManager listenerManager;
110110
private final StateManager stateManager;
111111

src/main/java/com/pubnub/api/builder/PubNubErrorBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ public final class PubNubErrorBuilder {
756756

757757
public static final PubNubError PNERROBJ_PNERR_CRYPTO_IS_CONFIGURED_BUT_MESSAGE_IS_NOT_ENCRYPTED = PubNubError.builder()
758758
.errorCode(PNERR_CRYPTO_IS_CONFIGURED_BUT_MESSAGE_IS_NOT_ENCRYPTED)
759-
.message("Crypto is configured but message is not encrypted.")
759+
.message("Message decryption failed using the current crypto configuration.")
760760
.build();
761761

762762
private PubNubErrorBuilder() {

src/main/java/com/pubnub/api/models/consumer/pubsub/files/PNFileEventResult.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.pubnub.api.models.consumer.pubsub.files;
22

33
import com.google.gson.JsonElement;
4+
import com.pubnub.api.PubNubError;
45
import com.pubnub.api.models.consumer.files.PNDownloadableFile;
56
import com.pubnub.api.models.consumer.pubsub.PNEvent;
67
import lombok.Builder;
@@ -19,4 +20,5 @@ public class PNFileEventResult implements PNEvent {
1920
@NonNull
2021
private final PNDownloadableFile file;
2122
private final JsonElement jsonMessage;
23+
private final PubNubError error;
2224
}

src/main/java/com/pubnub/api/workers/SubscribeMessageProcessor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ PNEvent processIncomingPayload(SubscribeMessage message) throws PubNubException
7777

7878
if (message.getChannel().endsWith("-pnpres")) {
7979
PresenceEnvelope presencePayload = mapper.convertValue(message.getPayload(), PresenceEnvelope.class);
80-
8180
String strippedPresenceChannel = null;
8281
String strippedPresenceSubscription = null;
8382

@@ -107,7 +106,6 @@ PNEvent processIncomingPayload(SubscribeMessage message) throws PubNubException
107106
.timeout(getDelta(message.getPayload().getAsJsonObject().get("timeout")))
108107
.hereNowRefresh(isHereNowRefresh != null && isHereNowRefresh.getAsBoolean())
109108
.build();
110-
111109
return pnPresenceEventResult;
112110
} else {
113111
JsonElement extractedMessage;
@@ -202,6 +200,7 @@ PNEvent processIncomingPayload(SubscribeMessage message) throws PubNubException
202200
.publisher(message.getIssuingClientId())
203201
.timetoken(publishMetaData.getPublishTimetoken())
204202
.jsonMessage(jsonMessage)
203+
.error(error)
205204
.build();
206205
}
207206
}

src/test/java/com/pubnub/api/PubNubTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void getVersionAndTimeStamp() {
100100
pubnub = new PubNub(pnConfiguration);
101101
String version = pubnub.getVersion();
102102
int timeStamp = pubnub.getTimestamp();
103-
Assert.assertEquals("6.4.2", version);
103+
Assert.assertEquals("6.4.3", version);
104104
Assert.assertTrue(timeStamp > 0);
105105
}
106106

0 commit comments

Comments
 (0)