This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git


The following commit(s) were added to refs/heads/master by this push:
     new 2f57d79e4b Clean up code, suppress warnings
2f57d79e4b is described below

commit 2f57d79e4bfd49b5884a8aa44dbcafcb2d7576f7
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon Aug 14 12:04:08 2023 +0200

    Clean up code, suppress warnings
---
 .../felix/webconsole/WebConsoleConstants.java       | 16 +++-------------
 .../org/apache/felix/webconsole/WebConsoleUtil.java | 21 ++++++++++-----------
 2 files changed, 13 insertions(+), 24 deletions(-)

diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java 
b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java
index b2ad2b97ca..4831d9ff91 100644
--- 
a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java
+++ 
b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java
@@ -18,10 +18,6 @@
  */
 package org.apache.felix.webconsole;
 
-import java.util.Dictionary;
-
-import org.apache.felix.webconsole.internal.servlet.OsgiManager;
-
 /**
  * WebConsoleConstants provides some common constants that are used by plugin
  * developers.
@@ -207,16 +203,10 @@ public interface WebConsoleConstants
      * <p>
      * The type of this request attribute is <code>Map&lt;String, 
Object&gt;</code>.
      * <p>
-     * This map contains the web console configuration params managed by 
{@link OsgiManager}.
+     * This map contains the web console configuration params managed by the 
web console.
      * It can be used to access to the configuration values while processing 
requests.
-     * e.g.: The VMStat plugin uses it in order to retrive the 
"felix.webconsole.reload.timeout" ({@link OsgiManager#FRAMEWORK_RELOAD_TIMEOUT})
-     * and "felix.webconsole.shutdown.timeout" ({@link 
OsgiManager#FRAMEWORK_SHUTDOWN_TIMEOUT}).
-     * 
-     * @see OsgiManager
-     * @see OsgiManager#configuration
-     * @see OsgiManager#updateConfiguration( java.util.Dictionary )
      * 
-     * @since 4.8.13
+     * @since 3.5.0
      */
-    public static final String ATTR_CONFIGURATION = 
"felix.webconsole.configuration"; //$NON-NLS-1$
+    public static final String ATTR_CONFIGURATION = 
"felix.webconsole.configuration";
 }
diff --git 
a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java 
b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
index ca8fbec9a6..71a5b7c3b6 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
@@ -21,8 +21,10 @@ package org.apache.felix.webconsole;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Array;
 import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -73,6 +75,7 @@ public final class WebConsoleUtil
      *
      * @return The {@link VariableResolver} for the given request.
      */
+    @SuppressWarnings("unchecked")
     public static VariableResolver getVariableResolver( final ServletRequest 
request )
     {
         final Object resolverObj = request.getAttribute( 
WebConsoleConstants.ATTR_CONSOLE_VARIABLE_RESOLVER );
@@ -82,9 +85,8 @@ public final class WebConsoleUtil
         }
 
         final DefaultVariableResolver resolver = new DefaultVariableResolver();
-        // FIXME: don't we need a constant for the values below?
-        resolver.put( "appRoot", request.getAttribute( 
WebConsoleConstants.ATTR_APP_ROOT ) ); //$NON-NLS-1$
-        resolver.put( "pluginRoot", request.getAttribute( 
WebConsoleConstants.ATTR_PLUGIN_ROOT ) ); //$NON-NLS-1$
+        resolver.put( "appRoot", request.getAttribute( 
WebConsoleConstants.ATTR_APP_ROOT ) );
+        resolver.put( "pluginRoot", request.getAttribute( 
WebConsoleConstants.ATTR_PLUGIN_ROOT ) );
         setVariableResolver( request, resolver );
         return resolver;
     }
@@ -130,6 +132,7 @@ public final class WebConsoleUtil
         }
 
         // check, whether we already have the parameters
+        @SuppressWarnings("unchecked")
         Map<String, FileItem[]> params = ( Map<String, FileItem[]> ) 
request.getAttribute( AbstractWebConsolePlugin.ATTR_FILEUPLOAD );
         if ( params == null )
         {
@@ -338,6 +341,7 @@ public final class WebConsoleUtil
      * @param value the value to decode
      * @return the decoded string
      */
+    @SuppressWarnings("deprecation")
     public static String urlDecode( final String value )
     {
         // shortcut for empty or missing values
@@ -346,14 +350,9 @@ public final class WebConsoleUtil
             return value;
         }
 
-        try
-        {
-            return URLDecoder.decode( value, "UTF-8" ); //$NON-NLS-1$
-        }
-        catch ( Throwable t )
-        {
-            // expected NoSuchMethodError: if platform does not support it
-            // expected UnsupportedEncoding (not really: UTF-8 is required)
+        try {
+            return URLDecoder.decode( value, "UTF-8" );
+        } catch (UnsupportedEncodingException e) {
             return URLDecoder.decode( value );
         }
     }

Reply via email to