From 84339ac2ccbf19a6df9efbf5f2b1395c5b7c74b0 Mon Sep 17 00:00:00 2001 From: Andrew Azores Date: Thu, 21 Sep 2023 14:13:21 -0400 Subject: [PATCH] apply updated formatter --- .../java/io/cryostat/net/AgentConnection.java | 7 ++++-- .../java/io/cryostat/net/AgentJFRService.java | 22 +++++++++++++----- .../reports/SubprocessReportGenerator.java | 11 ++++++--- .../net/security/jwt/AssetJwtHelper.java | 14 ++++++++--- .../net/security/jwt/DiscoveryJwtHelper.java | 23 +++++++++++++++---- .../java/io/cryostat/net/web/WebServer.java | 4 +++- .../v2/AbstractAssetJwtConsumingHandler.java | 8 +++++-- .../AbstractDiscoveryJwtConsumingHandler.java | 8 +++++-- .../io/cryostat/net/web/WebServerTest.java | 8 +++++-- ...tractDiscoveryJwtConsumingHandlerTest.java | 13 ++++++++--- 10 files changed, 89 insertions(+), 29 deletions(-) diff --git a/src/main/java/io/cryostat/net/AgentConnection.java b/src/main/java/io/cryostat/net/AgentConnection.java index cce516b2d6..f1538f0d05 100644 --- a/src/main/java/io/cryostat/net/AgentConnection.java +++ b/src/main/java/io/cryostat/net/AgentConnection.java @@ -140,8 +140,11 @@ public boolean isConnected() { @Override public MBeanMetrics getMBeanMetrics() - throws ConnectionException, IOException, InstanceNotFoundException, - IntrospectionException, ReflectionException { + throws ConnectionException, + IOException, + InstanceNotFoundException, + IntrospectionException, + ReflectionException { try { return client.mbeanMetrics().toCompletionStage().toCompletableFuture().get(); } catch (ExecutionException | InterruptedException e) { diff --git a/src/main/java/io/cryostat/net/AgentJFRService.java b/src/main/java/io/cryostat/net/AgentJFRService.java index 1a25e58b9b..78a9e452dc 100644 --- a/src/main/java/io/cryostat/net/AgentJFRService.java +++ b/src/main/java/io/cryostat/net/AgentJFRService.java @@ -268,9 +268,14 @@ public IRecordingDescriptor start( IConstrainedMap recordingOptions, String templateName, TemplateType preferredTemplateType) - throws io.cryostat.core.FlightRecorderException, FlightRecorderException, - ConnectionException, IOException, ServiceNotAvailableException, - QuantityConversionException, EventOptionException, EventTypeException { + throws io.cryostat.core.FlightRecorderException, + FlightRecorderException, + ConnectionException, + IOException, + ServiceNotAvailableException, + QuantityConversionException, + EventOptionException, + EventTypeException { StartRecordingRequest req; String recordingName = recordingOptions.get("name").toString(); long duration = @@ -321,9 +326,14 @@ public IRecordingDescriptor start( @Override public IRecordingDescriptor start( IConstrainedMap recordingOptions, Template eventTemplate) - throws io.cryostat.core.FlightRecorderException, FlightRecorderException, - ConnectionException, IOException, FlightRecorderException, - ServiceNotAvailableException, QuantityConversionException, EventOptionException, + throws io.cryostat.core.FlightRecorderException, + FlightRecorderException, + ConnectionException, + IOException, + FlightRecorderException, + ServiceNotAvailableException, + QuantityConversionException, + EventOptionException, EventTypeException { return CryostatFlightRecorderService.super.start(recordingOptions, eventTemplate); } diff --git a/src/main/java/io/cryostat/net/reports/SubprocessReportGenerator.java b/src/main/java/io/cryostat/net/reports/SubprocessReportGenerator.java index 97f8630d8b..f1d3cb8a8f 100644 --- a/src/main/java/io/cryostat/net/reports/SubprocessReportGenerator.java +++ b/src/main/java/io/cryostat/net/reports/SubprocessReportGenerator.java @@ -73,9 +73,14 @@ public class SubprocessReportGenerator extends AbstractReportGeneratorService { @Override public synchronized CompletableFuture exec(Path recording, Path saveFile, String filter) - throws NoSuchMethodException, SecurityException, IllegalAccessException, - IllegalArgumentException, InvocationTargetException, IOException, - InterruptedException, ReportGenerationException { + throws NoSuchMethodException, + SecurityException, + IllegalAccessException, + IllegalArgumentException, + InvocationTargetException, + IOException, + InterruptedException, + ReportGenerationException { if (recording == null) { throw new IllegalArgumentException("Recording may not be null"); } diff --git a/src/main/java/io/cryostat/net/security/jwt/AssetJwtHelper.java b/src/main/java/io/cryostat/net/security/jwt/AssetJwtHelper.java index 61e04e8420..6afadb6af7 100644 --- a/src/main/java/io/cryostat/net/security/jwt/AssetJwtHelper.java +++ b/src/main/java/io/cryostat/net/security/jwt/AssetJwtHelper.java @@ -76,7 +76,10 @@ public class AssetJwtHelper { } public String createAssetDownloadJwt(String subject, String resource, String jmxauth) - throws JOSEException, SocketException, UnknownHostException, URISyntaxException, + throws JOSEException, + SocketException, + UnknownHostException, + URISyntaxException, MalformedURLException { String issuer = webServer.get().getHostUrl().toString(); Date now = Date.from(Instant.now()); @@ -107,8 +110,13 @@ public String createAssetDownloadJwt(String subject, String resource, String jmx } public JWT parseAssetDownloadJwt(String rawToken) - throws ParseException, JOSEException, BadJWTException, SocketException, - UnknownHostException, URISyntaxException, MalformedURLException { + throws ParseException, + JOSEException, + BadJWTException, + SocketException, + UnknownHostException, + URISyntaxException, + MalformedURLException { JWEObject jwe = JWEObject.parse(rawToken); jwe.decrypt(decrypter); diff --git a/src/main/java/io/cryostat/net/security/jwt/DiscoveryJwtHelper.java b/src/main/java/io/cryostat/net/security/jwt/DiscoveryJwtHelper.java index c9b9f59073..34057a47e3 100644 --- a/src/main/java/io/cryostat/net/security/jwt/DiscoveryJwtHelper.java +++ b/src/main/java/io/cryostat/net/security/jwt/DiscoveryJwtHelper.java @@ -82,7 +82,10 @@ public class DiscoveryJwtHelper { public String createDiscoveryPluginJwt( String authzHeader, String realm, InetAddress requestAddr, URI resource) - throws MalformedURLException, SocketException, UnknownHostException, URISyntaxException, + throws MalformedURLException, + SocketException, + UnknownHostException, + URISyntaxException, JOSEException { URL hostUrl = webServer.get().getHostUrl(); String issuer = hostUrl.toString(); @@ -115,8 +118,13 @@ public String createDiscoveryPluginJwt( public JWT parseDiscoveryPluginJwt( String rawToken, String realm, URI resource, InetAddress requestAddr) - throws ParseException, JOSEException, BadJWTException, SocketException, - UnknownHostException, URISyntaxException, MalformedURLException { + throws ParseException, + JOSEException, + BadJWTException, + SocketException, + UnknownHostException, + URISyntaxException, + MalformedURLException { return parseDiscoveryPluginJwt(rawToken, realm, resource, requestAddr, true); } @@ -126,8 +134,13 @@ public JWT parseDiscoveryPluginJwt( URI resource, InetAddress requestAddr, boolean checkTimeClaims) - throws ParseException, JOSEException, BadJWTException, SocketException, - UnknownHostException, URISyntaxException, MalformedURLException { + throws ParseException, + JOSEException, + BadJWTException, + SocketException, + UnknownHostException, + URISyntaxException, + MalformedURLException { JWEObject jwe = JWEObject.parse(rawToken); jwe.decrypt(decrypter); diff --git a/src/main/java/io/cryostat/net/web/WebServer.java b/src/main/java/io/cryostat/net/web/WebServer.java index 1346904500..04e9fb070f 100644 --- a/src/main/java/io/cryostat/net/web/WebServer.java +++ b/src/main/java/io/cryostat/net/web/WebServer.java @@ -238,7 +238,9 @@ public void stop() { } public URL getHostUrl() - throws MalformedURLException, SocketException, UnknownHostException, + throws MalformedURLException, + SocketException, + UnknownHostException, URISyntaxException { return getHostUri().toURL(); } diff --git a/src/main/java/io/cryostat/net/web/http/api/v2/AbstractAssetJwtConsumingHandler.java b/src/main/java/io/cryostat/net/web/http/api/v2/AbstractAssetJwtConsumingHandler.java index 5fc482d0ab..2a4a0ed12e 100644 --- a/src/main/java/io/cryostat/net/web/http/api/v2/AbstractAssetJwtConsumingHandler.java +++ b/src/main/java/io/cryostat/net/web/http/api/v2/AbstractAssetJwtConsumingHandler.java @@ -99,8 +99,12 @@ public final void handle(RoutingContext ctx) { } private JWT validateJwt(RoutingContext ctx) - throws ParseException, JOSEException, SocketException, UnknownHostException, - URISyntaxException, MalformedURLException { + throws ParseException, + JOSEException, + SocketException, + UnknownHostException, + URISyntaxException, + MalformedURLException { String token = ctx.queryParams().get("token"); JWT parsed; try { diff --git a/src/main/java/io/cryostat/net/web/http/api/v2/AbstractDiscoveryJwtConsumingHandler.java b/src/main/java/io/cryostat/net/web/http/api/v2/AbstractDiscoveryJwtConsumingHandler.java index 7c323cac61..367e9563e5 100644 --- a/src/main/java/io/cryostat/net/web/http/api/v2/AbstractDiscoveryJwtConsumingHandler.java +++ b/src/main/java/io/cryostat/net/web/http/api/v2/AbstractDiscoveryJwtConsumingHandler.java @@ -105,8 +105,12 @@ protected void writeResponse(RoutingContext ctx, IntermediateResponse interme } private JWT validateJwt(RoutingContext ctx) - throws ParseException, JOSEException, SocketException, UnknownHostException, - URISyntaxException, MalformedURLException { + throws ParseException, + JOSEException, + SocketException, + UnknownHostException, + URISyntaxException, + MalformedURLException { String token = ctx.queryParams().get("token"); if (StringUtils.isBlank(token)) { throw new ApiException(401); diff --git a/src/test/java/io/cryostat/net/web/WebServerTest.java b/src/test/java/io/cryostat/net/web/WebServerTest.java index b75b692e45..27ac58dfd9 100644 --- a/src/test/java/io/cryostat/net/web/WebServerTest.java +++ b/src/test/java/io/cryostat/net/web/WebServerTest.java @@ -128,7 +128,9 @@ void shouldUseConfiguredPort() throws Exception { @ValueSource( strings = {"foo", "bar.jfr", "some-recording.jfr", "another_recording", "alpha123"}) void shouldProvideSavedDownloadUrl(String recordingName) - throws UnknownHostException, MalformedURLException, SocketException, + throws UnknownHostException, + MalformedURLException, + SocketException, URISyntaxException { when(netConf.getWebServerHost()).thenReturn("example.com"); when(netConf.getExternalWebServerPort()).thenReturn(8181); @@ -201,7 +203,9 @@ void shouldProvideReportUrl(String recordingName) throws URISyntaxException, IOE @ValueSource( strings = {"foo", "bar.jfr", "some-recording.jfr", "another_recording", "alpha123"}) void shouldProvideSavedReportUrl(String recordingName) - throws UnknownHostException, MalformedURLException, SocketException, + throws UnknownHostException, + MalformedURLException, + SocketException, URISyntaxException { when(netConf.getWebServerHost()).thenReturn("example.com"); when(netConf.getExternalWebServerPort()).thenReturn(8181); diff --git a/src/test/java/io/cryostat/net/web/http/api/v2/AbstractDiscoveryJwtConsumingHandlerTest.java b/src/test/java/io/cryostat/net/web/http/api/v2/AbstractDiscoveryJwtConsumingHandlerTest.java index 027f7f6bcd..3c0ad88d55 100644 --- a/src/test/java/io/cryostat/net/web/http/api/v2/AbstractDiscoveryJwtConsumingHandlerTest.java +++ b/src/test/java/io/cryostat/net/web/http/api/v2/AbstractDiscoveryJwtConsumingHandlerTest.java @@ -102,7 +102,9 @@ class InvalidJwt { @BeforeEach void setup() - throws MalformedURLException, SocketException, UnknownHostException, + throws MalformedURLException, + SocketException, + UnknownHostException, URISyntaxException { headers = MultiMap.caseInsensitiveMultiMap(); queryParams = MultiMap.caseInsensitiveMultiMap(); @@ -213,8 +215,13 @@ class AuthManagerRejection { @BeforeEach void setup() - throws MalformedURLException, SocketException, UnknownHostException, - URISyntaxException, ParseException, JOSEException, BadJWTException { + throws MalformedURLException, + SocketException, + UnknownHostException, + URISyntaxException, + ParseException, + JOSEException, + BadJWTException { headers = MultiMap.caseInsensitiveMultiMap(); queryParams = MultiMap.caseInsensitiveMultiMap(); queryParams.set("token", "mytoken");