Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>2.0.77.Final</version>
</dependency>
<dependency>
<groupId>com.eatthepath</groupId>
<artifactId>fast-uuid</artifactId>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-bom</artifactId>
Expand Down
4 changes: 0 additions & 4 deletions pushy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns</artifactId>
</dependency>
<dependency>
<groupId>com.eatthepath</groupId>
<artifactId>fast-uuid</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import com.eatthepath.json.JsonParser;
import com.eatthepath.pushy.apns.util.concurrent.PushNotificationFuture;
import com.eatthepath.uuid.FastUUID;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
Expand Down Expand Up @@ -236,7 +235,7 @@ protected Http2Headers getHeadersForPushNotification(final ApnsPushNotification
}

if (pushNotification.getApnsId() != null) {
headers.add(APNS_ID_HEADER, FastUUID.toString(pushNotification.getApnsId()));
headers.add(APNS_ID_HEADER, pushNotification.getApnsId().toString());
}

return headers;
Expand Down Expand Up @@ -338,7 +337,7 @@ private static UUID getUUIDFromHeaders(final Http2Headers headers, final AsciiSt
final CharSequence uuidSequence = headers.get(header);

try {
return uuidSequence != null ? FastUUID.parseUUID(uuidSequence) : null;
return uuidSequence != null ? UUID.fromString(uuidSequence.toString()) : null;
} catch (final IllegalArgumentException e) {
log.error("Failed to parse `{}` header: {}", header, uuidSequence, e);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

package com.eatthepath.pushy.apns;

import com.eatthepath.uuid.FastUUID;

import java.time.Instant;
import java.util.Optional;
import java.util.UUID;
Expand Down Expand Up @@ -92,8 +90,8 @@ public String toString() {
return "SimplePushNotificationResponse{" +
"pushNotification=" + pushNotification +
", success=" + success +
", apnsId=" + (apnsId != null ? FastUUID.toString(apnsId) : null) +
", apnsUniqueId=" + getApnsUniqueId().map(FastUUID::toString).orElse(null) +
", apnsId=" + apnsId +
", apnsUniqueId=" + getApnsUniqueId() +
", rejectionReason='" + rejectionReason + '\'' +
", tokenExpirationTimestamp=" + tokenExpirationTimestamp +
'}';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package com.eatthepath.pushy.apns.server;

import com.eatthepath.json.JsonSerializer;
import com.eatthepath.uuid.FastUUID;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFuture;
Expand Down Expand Up @@ -277,7 +276,7 @@ private void handleEndOfStream(final ChannelHandlerContext context, final Http2S
UUID apnsIdFromHeaders;

try {
apnsIdFromHeaders = apnsIdSequence != null ? FastUUID.parseUUID(apnsIdSequence) : UUID.randomUUID();
apnsIdFromHeaders = apnsIdSequence != null ? UUID.fromString(apnsIdSequence.toString()) : UUID.randomUUID();
} catch (final IllegalArgumentException e) {
log.error("Failed to parse `apns-id` header: {}", apnsIdSequence, e);
apnsIdFromHeaders = UUID.randomUUID();
Expand Down Expand Up @@ -318,10 +317,10 @@ public void write(final ChannelHandlerContext context, final Object message, fin

final Http2Headers headers = new DefaultHttp2Headers()
.status(HttpResponseStatus.OK.codeAsText())
.add(APNS_ID_HEADER, FastUUID.toString(acceptNotificationResponse.getApnsId()));
.add(APNS_ID_HEADER, acceptNotificationResponse.getApnsId().toString());

acceptNotificationResponse.getApnsUniqueId()
.ifPresent(apnsUniqueId -> headers.add(APNS_UNIQUE_ID_HEADER, FastUUID.toString(apnsUniqueId)));
.ifPresent(apnsUniqueId -> headers.add(APNS_UNIQUE_ID_HEADER, apnsUniqueId.toString()));

this.encoder().writeHeaders(context, acceptNotificationResponse.getStreamId(), headers, 0, true, writePromise);

Expand All @@ -332,10 +331,10 @@ public void write(final ChannelHandlerContext context, final Object message, fin
final Http2Headers headers = new DefaultHttp2Headers()
.status(rejectNotificationResponse.getErrorReason().getHttpResponseStatus().codeAsText())
.add(HttpHeaderNames.CONTENT_TYPE, "application/json")
.add(APNS_ID_HEADER, FastUUID.toString(rejectNotificationResponse.getApnsId()));
.add(APNS_ID_HEADER, rejectNotificationResponse.getApnsId().toString());

rejectNotificationResponse.getApnsUniqueId()
.ifPresent(apnsUniqueId -> headers.add(APNS_UNIQUE_ID_HEADER, FastUUID.toString(apnsUniqueId)));
.ifPresent(apnsUniqueId -> headers.add(APNS_UNIQUE_ID_HEADER, apnsUniqueId.toString()));

final byte[] payloadBytes;
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.eatthepath.pushy.apns.ApnsPushNotification;
import com.eatthepath.pushy.apns.DeliveryPriority;
import com.eatthepath.pushy.apns.PushType;
import com.eatthepath.uuid.FastUUID;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http2.Http2Headers;
import io.netty.util.AsciiString;
Expand Down Expand Up @@ -173,7 +172,7 @@ private static ApnsPushNotification parsePushNotification(final Http2Headers hea
UUID apnsIdFromHeaders;

try {
apnsIdFromHeaders = apnsIdSequence != null ? FastUUID.parseUUID(apnsIdSequence) : null;
apnsIdFromHeaders = apnsIdSequence != null ? UUID.fromString(apnsIdSequence.toString()) : null;
} catch (final IllegalArgumentException e) {
log.error("Failed to parse `apns-id` header: {}", apnsIdSequence, e);
apnsIdFromHeaders = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import com.eatthepath.pushy.apns.DeliveryPriority;
import com.eatthepath.pushy.apns.PushType;
import com.eatthepath.uuid.FastUUID;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http2.Http2Headers;
Expand All @@ -34,6 +33,7 @@
import java.time.Instant;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -66,7 +66,7 @@ public void handlePushNotification(final Http2Headers headers, final ByteBuf pay
final CharSequence apnsIdSequence = headers.get(APNS_ID_HEADER);

if (apnsIdSequence != null) {
FastUUID.parseUUID(apnsIdSequence);
UUID.fromString(apnsIdSequence.toString());
}
} catch (final IllegalArgumentException e) {
throw new RejectedNotificationException(RejectionReason.BAD_MESSAGE_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.eatthepath.pushy.apns.ApnsPushNotification;
import com.eatthepath.pushy.apns.DeliveryPriority;
import com.eatthepath.pushy.apns.PushType;
import com.eatthepath.uuid.FastUUID;

import java.time.Duration;
import java.time.Instant;
Expand Down Expand Up @@ -325,7 +324,7 @@ public String toString() {
", pushType=" + pushType +
", topic='" + topic + '\'' +
", collapseId='" + collapseId + '\'' +
", apnsId=" + (apnsId != null ? FastUUID.toString(apnsId) : null) +
", apnsId=" + apnsId +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package com.eatthepath.pushy.apns.server;

import com.eatthepath.pushy.apns.DeliveryPriority;
import com.eatthepath.uuid.FastUUID;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import io.netty.handler.codec.http.HttpMethod;
Expand All @@ -38,7 +37,8 @@
import java.time.Instant;
import java.util.*;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

public abstract class ValidatingPushNotificationHandlerTest {

Expand Down