Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 3431c3b

Browse files
committed
Added RuntimeIOException and InvalidSSLConfig on APNS Service.
1 parent c3b158b commit 3431c3b

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

src/main/java/com/devsu/push/sender/service/async/AsyncApplePushService.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import com.devsu.push.sender.callback.PushCallback;
44
import com.devsu.push.sender.service.sync.SyncApplePushService;
5+
import com.notnoop.exceptions.InvalidSSLConfig;
6+
import com.notnoop.exceptions.RuntimeIOException;
57

68
/**
79
* The async push service for iOS (APNS).
@@ -11,7 +13,8 @@ public class AsyncApplePushService extends AsyncPushServiceBase {
1113
/**
1214
* @see com.devsu.push.sender.service.sync.SyncApplePushService#ApplePushService(String, String, boolean)
1315
*/
14-
public AsyncApplePushService(String certificatePath, String certificatePassword, boolean useProductionServer){
16+
public AsyncApplePushService(String certificatePath, String certificatePassword, boolean useProductionServer)
17+
throws RuntimeIOException, InvalidSSLConfig {
1518
super(new SyncApplePushService(certificatePath, certificatePassword, useProductionServer), null);
1619
}
1720

@@ -21,22 +24,25 @@ public AsyncApplePushService(String certificatePath, String certificatePassword,
2124
* @param certificatePassword The password for the p12 certificate.
2225
* @param useProductionServer Indicates if the services uses a Production environment or a Sandbox environment.
2326
* @param pushCallback The push callback.
27+
* @throws RuntimeIOException
28+
* @throws InvalidSSLConfig
2429
*/
25-
public AsyncApplePushService(String certificatePath, String certificatePassword, boolean useProductionServer, PushCallback pushCallback) {
30+
public AsyncApplePushService(String certificatePath, String certificatePassword, boolean useProductionServer, PushCallback pushCallback)
31+
throws RuntimeIOException, InvalidSSLConfig {
2632
super(new SyncApplePushService(certificatePath, certificatePassword, useProductionServer), pushCallback);
2733
}
2834

2935
/**
3036
* @see com.devsu.push.sender.service.sync.SyncApplePushService#setupDevelopmentServer(java.lang.String, java.lang.String)
3137
*/
32-
public void setupDevelopmentServer(String certificatePath, String certificatePassword) {
38+
public void setupDevelopmentServer(String certificatePath, String certificatePassword) throws RuntimeIOException, InvalidSSLConfig {
3339
((SyncApplePushService)pushService).setupDevelopmentServer(certificatePath, certificatePassword);
3440
}
3541

3642
/**
3743
* @see com.devsu.push.sender.service.sync.SyncApplePushService#setupProductionServer(java.lang.String, java.lang.String)
3844
*/
39-
public void setupProductionServer(String certificatePath, String certificatePassword) {
45+
public void setupProductionServer(String certificatePath, String certificatePassword) throws RuntimeIOException, InvalidSSLConfig {
4046
((SyncApplePushService)pushService).setupProductionServer(certificatePath, certificatePassword);
4147
}
4248

src/main/java/com/devsu/push/sender/service/sync/SyncApplePushService.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import com.notnoop.apns.APNS;
1010
import com.notnoop.apns.ApnsService;
1111
import com.notnoop.apns.PayloadBuilder;
12+
import com.notnoop.exceptions.InvalidSSLConfig;
13+
import com.notnoop.exceptions.RuntimeIOException;
1214

1315

1416
public class SyncApplePushService extends SyncPushServiceBase {
@@ -28,8 +30,10 @@ public class SyncApplePushService extends SyncPushServiceBase {
2830
* @param certificatePath The path of the p12 certificate file.
2931
* @param certificatePassword The password for the p12 certificate.
3032
* @param useProductionServer Indicates if the services uses a Production environment or a Sandbox environment.
33+
* @throws RuntimeIOException
34+
* @throws InvalidSSLConfig
3135
*/
32-
public SyncApplePushService(String certificatePath, String certificatePassword, boolean useProductionServer) {
36+
public SyncApplePushService(String certificatePath, String certificatePassword, boolean useProductionServer) throws RuntimeIOException, InvalidSSLConfig {
3337
setDefaultValues();
3438
if (useProductionServer) {
3539
setupProductionServer(certificatePath, certificatePassword);
@@ -101,8 +105,10 @@ private PayloadBuilder generateBuilder(String title, String message, Map<String,
101105
* Sets up the APNS Sandbox environment.
102106
* @param certificatePath The path of the p12 certificate file.
103107
* @param certificatePassword The password for the p12 certificate.
108+
* @throws RuntimeIOException
109+
* @throws InvalidSSLConfig
104110
*/
105-
public void setupDevelopmentServer(String certificatePath, String certificatePassword) {
111+
public void setupDevelopmentServer(String certificatePath, String certificatePassword) throws RuntimeIOException, InvalidSSLConfig {
106112
apnsService = APNS.newService().withCert(certificatePath, certificatePassword).withSandboxDestination().build();
107113
apnsService.stop();
108114
}
@@ -111,8 +117,10 @@ public void setupDevelopmentServer(String certificatePath, String certificatePas
111117
* Sets up the APNS Production environment.
112118
* @param certificatePath The path of the p12 certificate file.
113119
* @param certificatePassword The password for the p12 certificate.
120+
* @throws RuntimeIOException
121+
* @throws InvalidSSLConfig
114122
*/
115-
public void setupProductionServer(String certificatePath, String certificatePassword) {
123+
public void setupProductionServer(String certificatePath, String certificatePassword) throws RuntimeIOException, InvalidSSLConfig {
116124
apnsService = APNS.newService().withCert(certificatePath, certificatePassword).withProductionDestination().build();
117125
apnsService.stop();
118126
}

0 commit comments

Comments
 (0)