From 6993eb97e4b3aa4e6c10a2c83fccb261ca064418 Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Wed, 27 May 2026 19:00:58 -0400 Subject: [PATCH] Remove fast-uuid as a dependency --- pom.xml | 5 ----- pushy/pom.xml | 4 ---- .../com/eatthepath/pushy/apns/ApnsClientHandler.java | 5 ++--- .../pushy/apns/SimplePushNotificationResponse.java | 6 ++---- .../pushy/apns/server/MockApnsServerHandler.java | 11 +++++------ .../server/ParsingMockApnsServerListenerAdapter.java | 3 +-- .../server/ValidatingPushNotificationHandler.java | 4 ++-- .../pushy/apns/util/SimpleApnsPushNotification.java | 3 +-- .../server/ValidatingPushNotificationHandlerTest.java | 4 ++-- 9 files changed, 15 insertions(+), 30 deletions(-) diff --git a/pom.xml b/pom.xml index 239225f76..e9a4469c5 100644 --- a/pom.xml +++ b/pom.xml @@ -89,11 +89,6 @@ netty-tcnative-boringssl-static 2.0.77.Final - - com.eatthepath - fast-uuid - 0.2.0 - org.slf4j slf4j-bom diff --git a/pushy/pom.xml b/pushy/pom.xml index 9e265145c..bd3891c5f 100644 --- a/pushy/pom.xml +++ b/pushy/pom.xml @@ -47,10 +47,6 @@ io.netty netty-resolver-dns - - com.eatthepath - fast-uuid - org.slf4j slf4j-api diff --git a/pushy/src/main/java/com/eatthepath/pushy/apns/ApnsClientHandler.java b/pushy/src/main/java/com/eatthepath/pushy/apns/ApnsClientHandler.java index 790221521..a1e2a90db 100644 --- a/pushy/src/main/java/com/eatthepath/pushy/apns/ApnsClientHandler.java +++ b/pushy/src/main/java/com/eatthepath/pushy/apns/ApnsClientHandler.java @@ -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; @@ -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; @@ -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; diff --git a/pushy/src/main/java/com/eatthepath/pushy/apns/SimplePushNotificationResponse.java b/pushy/src/main/java/com/eatthepath/pushy/apns/SimplePushNotificationResponse.java index bd4245b5c..e166eba2b 100644 --- a/pushy/src/main/java/com/eatthepath/pushy/apns/SimplePushNotificationResponse.java +++ b/pushy/src/main/java/com/eatthepath/pushy/apns/SimplePushNotificationResponse.java @@ -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; @@ -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 + '}'; diff --git a/pushy/src/main/java/com/eatthepath/pushy/apns/server/MockApnsServerHandler.java b/pushy/src/main/java/com/eatthepath/pushy/apns/server/MockApnsServerHandler.java index d55404455..73bb67f20 100644 --- a/pushy/src/main/java/com/eatthepath/pushy/apns/server/MockApnsServerHandler.java +++ b/pushy/src/main/java/com/eatthepath/pushy/apns/server/MockApnsServerHandler.java @@ -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; @@ -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(); @@ -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); @@ -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; { diff --git a/pushy/src/main/java/com/eatthepath/pushy/apns/server/ParsingMockApnsServerListenerAdapter.java b/pushy/src/main/java/com/eatthepath/pushy/apns/server/ParsingMockApnsServerListenerAdapter.java index b54476502..2d342652d 100644 --- a/pushy/src/main/java/com/eatthepath/pushy/apns/server/ParsingMockApnsServerListenerAdapter.java +++ b/pushy/src/main/java/com/eatthepath/pushy/apns/server/ParsingMockApnsServerListenerAdapter.java @@ -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; @@ -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; diff --git a/pushy/src/main/java/com/eatthepath/pushy/apns/server/ValidatingPushNotificationHandler.java b/pushy/src/main/java/com/eatthepath/pushy/apns/server/ValidatingPushNotificationHandler.java index f44049740..50cbf4a7f 100644 --- a/pushy/src/main/java/com/eatthepath/pushy/apns/server/ValidatingPushNotificationHandler.java +++ b/pushy/src/main/java/com/eatthepath/pushy/apns/server/ValidatingPushNotificationHandler.java @@ -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; @@ -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; @@ -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); diff --git a/pushy/src/main/java/com/eatthepath/pushy/apns/util/SimpleApnsPushNotification.java b/pushy/src/main/java/com/eatthepath/pushy/apns/util/SimpleApnsPushNotification.java index 8b21130f6..831c89015 100644 --- a/pushy/src/main/java/com/eatthepath/pushy/apns/util/SimpleApnsPushNotification.java +++ b/pushy/src/main/java/com/eatthepath/pushy/apns/util/SimpleApnsPushNotification.java @@ -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; @@ -325,7 +324,7 @@ public String toString() { ", pushType=" + pushType + ", topic='" + topic + '\'' + ", collapseId='" + collapseId + '\'' + - ", apnsId=" + (apnsId != null ? FastUUID.toString(apnsId) : null) + + ", apnsId=" + apnsId + '}'; } } diff --git a/pushy/src/test/java/com/eatthepath/pushy/apns/server/ValidatingPushNotificationHandlerTest.java b/pushy/src/test/java/com/eatthepath/pushy/apns/server/ValidatingPushNotificationHandlerTest.java index 86eae571d..c3536dda3 100644 --- a/pushy/src/test/java/com/eatthepath/pushy/apns/server/ValidatingPushNotificationHandlerTest.java +++ b/pushy/src/test/java/com/eatthepath/pushy/apns/server/ValidatingPushNotificationHandlerTest.java @@ -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; @@ -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 {