harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Beyer <ndbe...@apache.org>
Subject Re: svn commit: r773966 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java
Date Wed, 13 May 2009 01:15:25 GMT
This commit seems contradictory to the specification. All JREs must
support UTF-8 as an encoding, so the UnsupportedEncodingException
should never happen.

I think the code should throw new AssertionError(e) in the catch block.

Thoughts?

-Nathan

On Tue, May 12, 2009 at 11:23 AM,  <odeakin@apache.org> wrote:
> Author: odeakin
> Date: Tue May 12 16:23:08 2009
> New Revision: 773966
>
> URL: http://svn.apache.org/viewvc?rev=773966&view=rev
> Log:
> When constructing the exception, make sure the error message is in an encoding where
it will be readable on non-ASCII platforms once printed.
>
> Modified:
>    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java
>
> Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java?rev=773966&r1=773965&r2=773966&view=diff
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java
(original)
> +++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSFileSystem.java
Tue May 12 16:23:08 2009
> @@ -20,6 +20,7 @@
>  import java.io.FileDescriptor;
>  import java.io.FileNotFoundException;
>  import java.io.IOException;
> +import java.io.UnsupportedEncodingException;
>
>  /**
>  * This is the portable implementation of the file system interface.
> @@ -235,7 +236,11 @@
>                }
>                long handler = openImpl(fileName, mode);
>                if (handler < 0) {
> -                       throw new FileNotFoundException(new String(fileName));
> +                    try {
> +                        throw new FileNotFoundException(new String(fileName,
"UTF-8"));
> +                    } catch (java.io.UnsupportedEncodingException e) {
> +                        throw new FileNotFoundException(new String(fileName));
> +                    }
>                }
>                return handler;
>        }
>
>
>

Mime
View raw message