You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jochen Wiedmann (Jira)" <ji...@apache.org> on 2019/11/26 17:24:00 UTC

[jira] [Commented] (IO-646) org.apache.commons.io.FileUtils.writeStringToFile causes crashes on Android 4.2

    [ https://issues.apache.org/jira/browse/IO-646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16982698#comment-16982698 ] 

Jochen Wiedmann commented on IO-646:
------------------------------------

The difference between 2.5, and 2.6 is obvious:

 

2.5 uses this:

 

     public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");

 

But 2.6 has:

 

    public static final Charset ISO_8859_1 = StandardCharsets.ISO_8859_1;

 

I haven't much ideas about Android, but this looks to me, like your JVM doesn't have the StandardCharsets class. According to  [https://developer.android.com/reference/java/nio/charset/StandardCharsets] (Introduced in API Level 19, but 4.2 is level 17.), that is exactly the problem.

 

Question: Do we want to support such outdated versions? In my opinion, we don't.

 

 

>  org.apache.commons.io.FileUtils.writeStringToFile causes crashes on Android 4.2
> --------------------------------------------------------------------------------
>
>                 Key: IO-646
>                 URL: https://issues.apache.org/jira/browse/IO-646
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Streams/Writers
>    Affects Versions: 2.6
>         Environment: Android 4.2 (API 17)
>            Reporter: Hong Zhang
>            Priority: Major
>             Fix For: 2.5
>
>
> Version 2.6 causes the following crash on Android 4.2 (probably on versions lower than 4.2 too)
> {{java.lang.NoClassDefFoundError: 
>   at org.apache.commons.io.Charsets.<clinit> (Charsets.java:120)
>   at org.apache.commons.io.FileUtils.writeStringToFile (FileUtils.java:2035)
>   at org.apache.commons.io.FileUtils.writeStringToFile (FileUtils.java:1999)}}
> {{}}
> {{}}Version 2.5 works flawlessly



--
This message was sent by Atlassian Jira
(v8.3.4#803005)