Skip to content

Commit

Permalink
apply updated formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Sep 28, 2023
1 parent 46de2cc commit 84339ac
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 29 deletions.
7 changes: 5 additions & 2 deletions src/main/java/io/cryostat/net/AgentConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
22 changes: 16 additions & 6 deletions src/main/java/io/cryostat/net/AgentJFRService.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,14 @@ public IRecordingDescriptor start(
IConstrainedMap<String> 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 =
Expand Down Expand Up @@ -321,9 +326,14 @@ public IRecordingDescriptor start(
@Override
public IRecordingDescriptor start(
IConstrainedMap<String> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ public class SubprocessReportGenerator extends AbstractReportGeneratorService {

@Override
public synchronized CompletableFuture<Path> 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");
}
Expand Down
14 changes: 11 additions & 3 deletions src/main/java/io/cryostat/net/security/jwt/AssetJwtHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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);

Expand Down
23 changes: 18 additions & 5 deletions src/main/java/io/cryostat/net/security/jwt/DiscoveryJwtHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/cryostat/net/web/WebServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ public void stop() {
}

public URL getHostUrl()
throws MalformedURLException, SocketException, UnknownHostException,
throws MalformedURLException,
SocketException,
UnknownHostException,
URISyntaxException {
return getHostUri().toURL();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ protected void writeResponse(RoutingContext ctx, IntermediateResponse<T> 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);
Expand Down
8 changes: 6 additions & 2 deletions src/test/java/io/cryostat/net/web/WebServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ class InvalidJwt {

@BeforeEach
void setup()
throws MalformedURLException, SocketException, UnknownHostException,
throws MalformedURLException,
SocketException,
UnknownHostException,
URISyntaxException {
headers = MultiMap.caseInsensitiveMultiMap();
queryParams = MultiMap.caseInsensitiveMultiMap();
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 84339ac

Please sign in to comment.