maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From micha...@apache.org
Subject svn commit: r1777821 - in /maven/doxia/doxia/trunk/doxia-core/src: main/java/org/apache/maven/doxia/util/DoxiaUtils.java main/java/org/apache/maven/doxia/util/HtmlTools.java test/java/org/apache/maven/doxia/util/HtmlToolsTest.java
Date Sat, 07 Jan 2017 16:13:14 GMT
Author: michaelo
Date: Sat Jan  7 16:13:14 2017
New Revision: 1777821

URL: http://svn.apache.org/viewvc?rev=1777821&view=rev
Log:
[DOXIA-549] Deprecate and replace DoxiaUtils#byteToHex() with String#format()

Modified:
    maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/util/DoxiaUtils.java
    maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/util/HtmlTools.java
    maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/util/HtmlToolsTest.java

Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/util/DoxiaUtils.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/util/DoxiaUtils.java?rev=1777821&r1=1777820&r2=1777821&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/util/DoxiaUtils.java
(original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/util/DoxiaUtils.java
Sat Jan  7 16:13:14 2017
@@ -275,7 +275,9 @@ public class DoxiaUtils
      * @return the result of Integer.toHexString( b & 0xFF ).
      *
      * @since 1.1.1
+     * @deprecated Use {@code String.format( "%02X", bytes[j] )}
      */
+    @Deprecated
     public static String byteToHex( final byte b )
     {
         return Integer.toHexString( b & MINUS_ONE );

Modified: maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/util/HtmlTools.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/util/HtmlTools.java?rev=1777821&r1=1777820&r2=1777821&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/util/HtmlTools.java
(original)
+++ maven/doxia/doxia/trunk/doxia-core/src/main/java/org/apache/maven/doxia/util/HtmlTools.java
Sat Jan  7 16:13:14 2017
@@ -366,14 +366,8 @@ public class HtmlTools
 
                         for ( int j = 0; j < bytes.length; ++j )
                         {
-                            String hex = DoxiaUtils.byteToHex( bytes[j] );
-
                             encoded.append( '%' );
-                            if ( hex.length() == 1 )
-                            {
-                                encoded.append( '0' );
-                            }
-                            encoded.append( hex );
+                            encoded.append( String.format( "%02X", bytes[j] ) );
                         }
                     }
             }

Modified: maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/util/HtmlToolsTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/util/HtmlToolsTest.java?rev=1777821&r1=1777820&r2=1777821&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/util/HtmlToolsTest.java
(original)
+++ maven/doxia/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/util/HtmlToolsTest.java
Sat Jan  7 16:13:14 2017
@@ -124,7 +124,7 @@ public class HtmlToolsTest
                       "http://www.example.com/?This%20is%20a%20simple%20&%20short%20test."
);
 
         String url = "\uD808\uDF45";
-        assertEquals( HtmlTools.encodeURL( url ), URLEncoder.encode( url, "UTF-8" ).toLowerCase(
Locale.ENGLISH ) );
+        assertEquals( HtmlTools.encodeURL( url ), URLEncoder.encode( url, "UTF-8" ) );
     }
 
     /**



Mime
View raw message