You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2017/01/24 19:34:31 UTC

svn commit: r1780103 - in /felix/trunk/webconsole: changelog.txt pom.xml src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java

Author: cziegeler
Date: Tue Jan 24 19:34:31 2017
New Revision: 1780103

URL: http://svn.apache.org/viewvc?rev=1780103&view=rev
Log:
FELIX-5509 - Remove method keyVal from WebConsoleUtil

Modified:
    felix/trunk/webconsole/changelog.txt
    felix/trunk/webconsole/pom.xml
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java

Modified: felix/trunk/webconsole/changelog.txt
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/changelog.txt?rev=1780103&r1=1780102&r2=1780103&view=diff
==============================================================================
--- felix/trunk/webconsole/changelog.txt (original)
+++ felix/trunk/webconsole/changelog.txt Tue Jan 24 19:34:31 2017
@@ -3,6 +3,7 @@ Changes from 4.2.18 to 4.3.0
 ** Improvement
     * [FELIX-5503] - Add simple json writer
     * [FELIX-5504] - Switch from org.json to new simple json writer
+    * [FELIX-5509] - Remove method keyVal from WebConsoleUtil
 
 
 Changes from 4.2.16 to 4.2.18

Modified: felix/trunk/webconsole/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/pom.xml?rev=1780103&r1=1780102&r2=1780103&view=diff
==============================================================================
--- felix/trunk/webconsole/pom.xml (original)
+++ felix/trunk/webconsole/pom.xml Tue Jan 24 19:34:31 2017
@@ -39,8 +39,6 @@
     
     <properties>
         <felix.java.version>4</felix.java.version>
-        <org.json.version>20070829</org.json.version>
-        <org.json.version.osgi>0.0.0.${org.json.version}</org.json.version.osgi>
         <webconsole.exports>
             org.apache.felix.webconsole;version=3.2.0;provide:=true,
             org.apache.felix.webconsole.bundleinfo;version=1.0.0;provide:=true,
@@ -116,7 +114,6 @@
                             ${webconsole.exports}
                         </Export-Package>
                         <Import-Package>
-                            org.json.*;version=0,
                             javax.servlet.*;version="[2.4,4)",
                             org.apache.commons.io; version="[1.4,3)",
                             *
@@ -184,7 +181,7 @@
        <!--
            The "all-in-one-bundle" profile builds a bundle including certain
            3rd party libraries and classes, namely: Commons IO, Commons
-           FileUpload, JSON, and the OSGi ServiceTracker.
+           FileUpload, and the OSGi ServiceTracker.
            The "all-in-one-bundle" can be used in deployments where these
            dependencies need not be deployed separately.
        -->
@@ -219,7 +216,6 @@
                                             org.apache.commons.io,
                                             org.apache.commons.io.filefilter,
                                             org.apache.commons.io.output,
-                                            org.json;version=${org.json.version.osgi},
                                             org.apache.felix.inventory;version=1.0.0,
                                             ${webconsole.exports}
                                        </Export-Package>
@@ -368,13 +364,6 @@
         </dependency>
 
         <dependency>
-            <groupId>org.json</groupId>
-            <artifactId>json</artifactId>
-            <version>${org.json.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        
-        <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.shell</artifactId>
             <version>1.0.0</version>

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java?rev=1780103&r1=1780102&r2=1780103&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java Tue Jan 24 19:34:31 2017
@@ -38,8 +38,6 @@ import org.apache.commons.fileupload.Fil
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.commons.fileupload.servlet.ServletFileUpload;
 import org.apache.commons.fileupload.servlet.ServletRequestContext;
-import org.json.JSONException;
-import org.json.JSONWriter;
 
 
 /**
@@ -162,7 +160,7 @@ public final class WebConsoleUtil
                     if ( current == null )
                     {
                         current = new FileItem[]
-                            { fi };
+                                { fi };
                     }
                     else
                     {
@@ -210,8 +208,8 @@ public final class WebConsoleUtil
      *  URL is given and cannot be converted into a valid URL
      */
     public static final void sendRedirect(final HttpServletRequest request,
-                                final HttpServletResponse response,
-                                String redirectUrl) throws IOException {
+            final HttpServletResponse response,
+            String redirectUrl) throws IOException {
         // check for relative URL
         if ( !redirectUrl.startsWith("/") ) { //$NON-NLS-1$
             String base = request.getContextPath() + request.getServletPath() + request.getPathInfo();
@@ -267,25 +265,25 @@ public final class WebConsoleUtil
             {
                 switch (ch = text.charAt(i))
                 {
-                    case '<':
-                        sb.append("&lt;"); //$NON-NLS-1$
-                        break;
-                    case '>':
-                        sb.append("&gt;"); //$NON-NLS-1$
-                        break;
-                    case '&':
-                        sb.append("&amp;"); //$NON-NLS-1$
-                        break;
-                    case ' ':
-                        sb.append("&nbsp;"); //$NON-NLS-1$
-                        break;
-                    case '\r':
-                    case '\n':
-                        if (oldch != '\r' && oldch != '\n') // don't add twice <br>
-                            sb.append("<br/>\n"); //$NON-NLS-1$
-                        break;
-                    default:
-                        sb.append(ch);
+                case '<':
+                    sb.append("&lt;"); //$NON-NLS-1$
+                    break;
+                case '>':
+                    sb.append("&gt;"); //$NON-NLS-1$
+                    break;
+                case '&':
+                    sb.append("&amp;"); //$NON-NLS-1$
+                    break;
+                case ' ':
+                    sb.append("&nbsp;"); //$NON-NLS-1$
+                    break;
+                case '\r':
+                case '\n':
+                    if (oldch != '\r' && oldch != '\n') // don't add twice <br>
+                        sb.append("<br/>\n"); //$NON-NLS-1$
+                    break;
+                default:
+                    sb.append(ch);
                 }
                 oldch = ch;
             }
@@ -303,7 +301,7 @@ public final class WebConsoleUtil
      * @return the request parameter if set and is valid integer, or the default value
      */
     public static final int getParameterInt(HttpServletRequest request, String name,
-        int _default)
+            int _default)
     {
         int ret = _default;
         String param = request.getParameter(name);
@@ -321,32 +319,6 @@ public final class WebConsoleUtil
     }
 
     /**
-     * Writes a key-value pair in a JSON writer. Write is performed only if both key and
-     * value are not null.
-     *
-     * @param jw the writer, where to write the data
-     * @param key the key value, stored under 'key'
-     * @param value the value stored under 'value'
-     * @throws JSONException if the value cannot be serialized.
-     *
-     * @deprecated Plugins should use their own json code/library
-     */
-    public static final void keyVal(JSONWriter jw, String key, Object value)
-        throws JSONException
-    {
-        if (key != null && value != null)
-        {
-            jw.object();
-            jw.key("key"); //$NON-NLS-1$
-            jw.value(key);
-            jw.key("value"); //$NON-NLS-1$
-            jw.value(value);
-            jw.endObject();
-        }
-    }
-
-
-    /**
      * Decode the given value expected to be URL encoded.
      * <p>
      * This method first tries to use the Java 1.4 method