From 58fd59e6b184888fc0fd6726afcbf49239b5cfd8 Mon Sep 17 00:00:00 2001 From: Gang Li Date: Thu, 21 Dec 2023 19:01:15 +0800 Subject: [PATCH] IDE warning fix --- .../indy/service/ui/client/AuthClientRequestFilter.java | 2 -- .../service/ui/jaxrs/content/ContentBrowseResource.java | 7 ------- .../ui/jaxrs/content/MavenContentAccessResource.java | 2 -- .../ui/jaxrs/repository/RepositoryAdminResource.java | 1 - .../indy/service/ui/jaxrs/stats/StatsResource.java | 8 +------- .../indy/service/ui/keycloak/SecurityController.java | 4 ---- .../indy/service/ui/models/repository/StoreKey.java | 2 -- .../org/commonjava/indy/service/ui/util/MimeTyper.java | 3 ++- 8 files changed, 3 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/commonjava/indy/service/ui/client/AuthClientRequestFilter.java b/src/main/java/org/commonjava/indy/service/ui/client/AuthClientRequestFilter.java index c1115e8..90910b1 100644 --- a/src/main/java/org/commonjava/indy/service/ui/client/AuthClientRequestFilter.java +++ b/src/main/java/org/commonjava/indy/service/ui/client/AuthClientRequestFilter.java @@ -15,8 +15,6 @@ */ package org.commonjava.indy.service.ui.client; -import io.quarkus.oidc.IdToken; -import io.quarkus.oidc.RefreshToken; import org.apache.commons.lang3.StringUtils; import org.eclipse.microprofile.jwt.JsonWebToken; import org.slf4j.Logger; diff --git a/src/main/java/org/commonjava/indy/service/ui/jaxrs/content/ContentBrowseResource.java b/src/main/java/org/commonjava/indy/service/ui/jaxrs/content/ContentBrowseResource.java index 023cc01..6caef13 100644 --- a/src/main/java/org/commonjava/indy/service/ui/jaxrs/content/ContentBrowseResource.java +++ b/src/main/java/org/commonjava/indy/service/ui/jaxrs/content/ContentBrowseResource.java @@ -16,8 +16,6 @@ package org.commonjava.indy.service.ui.jaxrs.content; import org.commonjava.indy.service.ui.client.content.ContentBrowseReGenClient; -import org.commonjava.indy.service.ui.client.content.ContentBrowseServiceClient; -import org.commonjava.indy.service.ui.models.content.ContentBrowseResult; import org.commonjava.indy.service.ui.models.repository.StoreType; import org.eclipse.microprofile.openapi.annotations.Operation; import org.eclipse.microprofile.openapi.annotations.media.Content; @@ -27,9 +25,6 @@ import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; import org.eclipse.microprofile.openapi.annotations.responses.APIResponses; import org.eclipse.microprofile.openapi.annotations.tags.Tag; -import org.eclipse.microprofile.rest.client.inject.RestClient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.inject.Inject; import javax.ws.rs.GET; @@ -48,8 +43,6 @@ @Path( "/api/browse/{packageType}/{type: (hosted|group|remote)}/{name}" ) public class ContentBrowseResource { - private final Logger logger = LoggerFactory.getLogger( this.getClass() ); - @Inject ContentBrowseReGenClient client; diff --git a/src/main/java/org/commonjava/indy/service/ui/jaxrs/content/MavenContentAccessResource.java b/src/main/java/org/commonjava/indy/service/ui/jaxrs/content/MavenContentAccessResource.java index 6211ff4..4460779 100644 --- a/src/main/java/org/commonjava/indy/service/ui/jaxrs/content/MavenContentAccessResource.java +++ b/src/main/java/org/commonjava/indy/service/ui/jaxrs/content/MavenContentAccessResource.java @@ -55,8 +55,6 @@ @Path( "/api/content/maven/{type: (hosted|group|remote)}/{name}" ) public class MavenContentAccessResource { - private final Logger logger = LoggerFactory.getLogger( this.getClass() ); - @Inject @RestClient MavenContentAccessServiceClient client; diff --git a/src/main/java/org/commonjava/indy/service/ui/jaxrs/repository/RepositoryAdminResource.java b/src/main/java/org/commonjava/indy/service/ui/jaxrs/repository/RepositoryAdminResource.java index 951fd53..4dd06ab 100644 --- a/src/main/java/org/commonjava/indy/service/ui/jaxrs/repository/RepositoryAdminResource.java +++ b/src/main/java/org/commonjava/indy/service/ui/jaxrs/repository/RepositoryAdminResource.java @@ -52,7 +52,6 @@ import java.nio.charset.Charset; import java.util.Map; import java.util.function.Function; -import java.util.function.Supplier; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.eclipse.microprofile.openapi.annotations.enums.ParameterIn.PATH; diff --git a/src/main/java/org/commonjava/indy/service/ui/jaxrs/stats/StatsResource.java b/src/main/java/org/commonjava/indy/service/ui/jaxrs/stats/StatsResource.java index c343828..7b54c49 100644 --- a/src/main/java/org/commonjava/indy/service/ui/jaxrs/stats/StatsResource.java +++ b/src/main/java/org/commonjava/indy/service/ui/jaxrs/stats/StatsResource.java @@ -15,16 +15,13 @@ */ package org.commonjava.indy.service.ui.jaxrs.stats; -import io.quarkus.launcher.QuarkusLauncher; import io.quarkus.runtime.LaunchMode; -import org.apache.commons.io.IOUtils; import org.commonjava.indy.service.ui.client.stats.StatsClient; import org.commonjava.indy.service.ui.exception.IndyUIException; import org.commonjava.indy.service.ui.jaxrs.ResponseHelper; import org.commonjava.indy.service.ui.models.stats.AddOnListing; import org.commonjava.indy.service.ui.models.stats.EndpointView; import org.commonjava.indy.service.ui.models.stats.IndyVersioning; -import org.commonjava.indy.service.ui.util.ResourceUtils; import org.eclipse.microprofile.openapi.annotations.Operation; import org.eclipse.microprofile.openapi.annotations.media.Content; import org.eclipse.microprofile.openapi.annotations.media.Schema; @@ -41,9 +38,6 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; import java.util.Map; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; @@ -54,7 +48,7 @@ @Path( "/api/stats" ) public class StatsResource { - private Logger logger = LoggerFactory.getLogger( this.getClass() ); + private final Logger logger = LoggerFactory.getLogger( this.getClass() ); @Inject @RestClient diff --git a/src/main/java/org/commonjava/indy/service/ui/keycloak/SecurityController.java b/src/main/java/org/commonjava/indy/service/ui/keycloak/SecurityController.java index fb7e6cc..cb7416b 100644 --- a/src/main/java/org/commonjava/indy/service/ui/keycloak/SecurityController.java +++ b/src/main/java/org/commonjava/indy/service/ui/keycloak/SecurityController.java @@ -16,19 +16,15 @@ package org.commonjava.indy.service.ui.keycloak; import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; import org.codehaus.plexus.interpolation.InterpolationException; import org.codehaus.plexus.interpolation.PropertiesBasedValueSource; import org.codehaus.plexus.interpolation.StringSearchInterpolator; import org.commonjava.indy.service.ui.exception.IndyUIException; -import org.commonjava.indy.service.ui.util.ResourceUtils; import org.commonjava.indy.service.ui.util.UrlUtils; import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; import java.io.File; import java.io.IOException; -import java.io.InputStream; import java.net.MalformedURLException; import java.nio.charset.Charset; import java.util.Properties; diff --git a/src/main/java/org/commonjava/indy/service/ui/models/repository/StoreKey.java b/src/main/java/org/commonjava/indy/service/ui/models/repository/StoreKey.java index 34839d9..3a9c458 100644 --- a/src/main/java/org/commonjava/indy/service/ui/models/repository/StoreKey.java +++ b/src/main/java/org/commonjava/indy/service/ui/models/repository/StoreKey.java @@ -222,8 +222,6 @@ public void writeExternal( final ObjectOutput out ) public void readExternal( final ObjectInput in ) throws IOException, ClassNotFoundException { - int keyVersion = in.readInt(); - this.packageType = (String) in.readObject(); Object rawType = in.readObject(); diff --git a/src/main/java/org/commonjava/indy/service/ui/util/MimeTyper.java b/src/main/java/org/commonjava/indy/service/ui/util/MimeTyper.java index 5db5498..a531c0b 100644 --- a/src/main/java/org/commonjava/indy/service/ui/util/MimeTyper.java +++ b/src/main/java/org/commonjava/indy/service/ui/util/MimeTyper.java @@ -22,6 +22,7 @@ import javax.enterprise.context.ApplicationScoped; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.Charset; @ApplicationScoped public class MimeTyper @@ -40,7 +41,7 @@ public MimeTyper() { try { - final String extraTypes = IOUtils.toString( stream ); + final String extraTypes = IOUtils.toString( stream, Charset.defaultCharset() ); typeMap.addMimeTypes( extraTypes ); } catch ( final IOException e )