Skip to content

Commit

Permalink
Fixes #4294 - Cleanup various bits (#4295)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem authored Nov 27, 2024
1 parent 731ce16 commit 472cb37
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,13 @@ public void setup(ManagedPiranhaContainerConfiguration configuration) {
this.configuration = configuration;
}

@SuppressWarnings("exports")
@Override
public ProtocolDescription getDefaultProtocol() {
return new ProtocolDescription(configuration.getProtocol());
}

@SuppressWarnings("exports")
@Override
public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
LOGGER.log(INFO, "Deploying " + archive.getName());
Expand Down Expand Up @@ -300,6 +302,7 @@ private String convertGroupIdToPath(String groupId) {
* @return the URL.
* @throws IOException when an I/O error occurs.
*/
@SuppressWarnings("deprecation")
private URL createMavenCentralArtifactUrl(String groupId, String artifactId, String version, String type) throws IOException {
return new URL("https://repo1.maven.org/maven2/" + createArtifactPath(groupId, artifactId, version, type));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class ManagedPiranhaContainerExtension implements LoadableExtension {
public ManagedPiranhaContainerExtension() {
}

@SuppressWarnings("exports")
@Override
public void register(ExtensionBuilder extensionBuilder) {
extensionBuilder.service(DeployableContainer.class, ManagedPiranhaContainer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private static Cookie[] parseNetscape(String cookiesValue) {
return cookieList.toArray(new Cookie[0]);
}

@SuppressWarnings({"deprecation", "removal"})
@SuppressWarnings({"removal"})
private static Cookie[] parseRFC2109(String cookiesValue) {
List<Cookie> cookieList = new ArrayList<>();
String[] cookieCandidates = cookiesValue.split("[;,]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public void addAnnotatedClass(Class<? extends Annotation> annotationClass, Class
classes.add(clazz);
annotatedClasses.put(annotationClass, classes);
} else {
@SuppressWarnings({ "rawtypes", "unchecked" })
HashSet<Class<?>> classes = (HashSet) annotatedClasses.get(annotationClass);
classes.add(clazz);
}
Expand Down Expand Up @@ -108,6 +109,7 @@ public Set<Class<?>> getAnnotatedClass(Class<? extends Annotation> annotationCla
return annotatedClasses.getOrDefault(annotationClass, Collections.emptySet());
}

@SuppressWarnings("unchecked")
@Override
public Set<Class<?>> getAnnotatedClasses(Class<?>[] annotationClasses) {
HashSet<Class<?>> result = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ private void addProviders(ModuleDescriptor.Builder builder, Resource resource) {
InputStream inputStream = resource.getResourceAsStream(providerFile);
if (inputStream == null)
continue;
@SuppressWarnings("resource")
List<String> providerList = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))
.lines()
.filter(x -> !x.startsWith("#"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public void include(ServletRequest servletRequest, ServletResponse servletRespon
throws ServletException, IOException {

WebApplicationRequest request = unwrap(servletRequest);
WebApplicationResponse response = unwrap(servletResponse);

/* - JAVADOC, Servlet:SPEC:192
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class DefaultPushBuilder implements PushBuilder {
/**
* Stores the web application request.
*/
@SuppressWarnings("unused")
private final WebApplicationRequest request;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public DefaultWebApplicationBuilder() {
*
* @return the web application.
*/
@SuppressWarnings("unchecked")
public DefaultWebApplication build() {
DefaultWebApplication webApplication = new DefaultWebApplication();
for (Resource resource : resources) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void testClose() throws Exception {
@Test
void testGetInputStream() throws Exception {
DefaultWebApplicationRequest request = new DefaultWebApplicationRequest();
@SuppressWarnings("resource")
DefaultWebConnection connection = new DefaultWebConnection(request, null);
assertNotNull(connection.getInputStream());
}
Expand All @@ -67,6 +68,7 @@ void testGetInputStream() throws Exception {
@Test
void testGetOutputStream() throws Exception {
DefaultWebApplicationResponse response = new DefaultWebApplicationResponse();
@SuppressWarnings("resource")
DefaultWebConnection connection = new DefaultWebConnection(null, response);
assertNotNull(connection.getOutputStream());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,7 @@ void testSetSessionTimeoutWithMultipleTimeouts() {
*/
@Test
void testSetSessionTrackingModesWithEmptyHashSet() {
@SuppressWarnings({ "rawtypes", "unchecked" })
WebApplication webApplication = new DefaultWebApplicationBuilder()
.sessionTrackingModes(new HashSet())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public boolean isSecure() {
/**
* Stores the query string.
*/
@SuppressWarnings("unused")
private String queryString;

/**
Expand Down

0 comments on commit 472cb37

Please sign in to comment.