You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2016/06/07 13:56:34 UTC

svn commit: r1747238 - /commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java

Author: sebb
Date: Tue Jun  7 13:56:34 2016
New Revision: 1747238

URL: http://svn.apache.org/viewvc?rev=1747238&view=rev
Log:
Now using Java 7 so can avoid the deprecated constant

Modified:
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java?rev=1747238&r1=1747237&r2=1747238&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java Tue Jun  7 13:56:34 2016
@@ -33,6 +33,7 @@ import java.net.URLConnection;
 import java.nio.ByteBuffer;
 import java.nio.channels.FileChannel;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
@@ -843,7 +844,7 @@ public class FileUtils {
      * @return The decoded URL or {@code null} if the input was
      * {@code null}.
      */
-    @SuppressWarnings("deprecation") // unavoidable until Java 7
+//    @SuppressWarnings("deprecation") // unavoidable until Java 7
     static String decodeUrl(final String url) {
         String decoded = url;
         if (url != null && url.indexOf('%') >= 0) {
@@ -865,7 +866,7 @@ public class FileUtils {
                     } finally {
                         if (bytes.position() > 0) {
                             bytes.flip();
-                            buffer.append(Charsets.UTF_8.decode(bytes).toString());
+                            buffer.append(StandardCharsets.UTF_8.decode(bytes).toString());
                             bytes.clear();
                         }
                     }



Re: svn commit: r1747238 - /commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java

Posted by sebb <se...@gmail.com>.
On 7 June 2016 at 15:52, Benedikt Ritter <br...@apache.org> wrote:
> <se...@apache.org> schrieb am Di., 7. Juni 2016 um 15:56 Uhr:
>
>> Author: sebb
>> Date: Tue Jun  7 13:56:34 2016
>> New Revision: 1747238
>>
>> URL: http://svn.apache.org/viewvc?rev=1747238&view=rev
>> Log:
>> Now using Java 7 so can avoid the deprecated constant
>>
>> Modified:
>>
>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
>>
>> Modified:
>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
>> URL:
>> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java?rev=1747238&r1=1747237&r2=1747238&view=diff
>>
>> ==============================================================================
>> ---
>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
>> (original)
>> +++
>> commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
>> Tue Jun  7 13:56:34 2016
>> @@ -33,6 +33,7 @@ import java.net.URLConnection;
>>  import java.nio.ByteBuffer;
>>  import java.nio.channels.FileChannel;
>>  import java.nio.charset.Charset;
>> +import java.nio.charset.StandardCharsets;
>>  import java.util.ArrayList;
>>  import java.util.Collection;
>>  import java.util.Date;
>> @@ -843,7 +844,7 @@ public class FileUtils {
>>       * @return The decoded URL or {@code null} if the input was
>>       * {@code null}.
>>       */
>> -    @SuppressWarnings("deprecation") // unavoidable until Java 7
>> +//    @SuppressWarnings("deprecation") // unavoidable until Java 7
>>
>
> Please don't comment out code that has no use anymore. Just remove that
> stuff.
>

Good catch.

I meant to remove the line once I had determined what the fix was.

>>      static String decodeUrl(final String url) {
>>          String decoded = url;
>>          if (url != null && url.indexOf('%') >= 0) {
>> @@ -865,7 +866,7 @@ public class FileUtils {
>>                      } finally {
>>                          if (bytes.position() > 0) {
>>                              bytes.flip();
>> -
>> buffer.append(Charsets.UTF_8.decode(bytes).toString());
>> +
>> buffer.append(StandardCharsets.UTF_8.decode(bytes).toString());
>>                              bytes.clear();
>>                          }
>>                      }
>>
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1747238 - /commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java

Posted by Benedikt Ritter <br...@apache.org>.
<se...@apache.org> schrieb am Di., 7. Juni 2016 um 15:56 Uhr:

> Author: sebb
> Date: Tue Jun  7 13:56:34 2016
> New Revision: 1747238
>
> URL: http://svn.apache.org/viewvc?rev=1747238&view=rev
> Log:
> Now using Java 7 so can avoid the deprecated constant
>
> Modified:
>
> commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
>
> Modified:
> commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java?rev=1747238&r1=1747237&r2=1747238&view=diff
>
> ==============================================================================
> ---
> commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
> (original)
> +++
> commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
> Tue Jun  7 13:56:34 2016
> @@ -33,6 +33,7 @@ import java.net.URLConnection;
>  import java.nio.ByteBuffer;
>  import java.nio.channels.FileChannel;
>  import java.nio.charset.Charset;
> +import java.nio.charset.StandardCharsets;
>  import java.util.ArrayList;
>  import java.util.Collection;
>  import java.util.Date;
> @@ -843,7 +844,7 @@ public class FileUtils {
>       * @return The decoded URL or {@code null} if the input was
>       * {@code null}.
>       */
> -    @SuppressWarnings("deprecation") // unavoidable until Java 7
> +//    @SuppressWarnings("deprecation") // unavoidable until Java 7
>

Please don't comment out code that has no use anymore. Just remove that
stuff.


>      static String decodeUrl(final String url) {
>          String decoded = url;
>          if (url != null && url.indexOf('%') >= 0) {
> @@ -865,7 +866,7 @@ public class FileUtils {
>                      } finally {
>                          if (bytes.position() > 0) {
>                              bytes.flip();
> -
> buffer.append(Charsets.UTF_8.decode(bytes).toString());
> +
> buffer.append(StandardCharsets.UTF_8.decode(bytes).toString());
>                              bytes.clear();
>                          }
>                      }
>
>
>