Re: RFR: 8270490: Charset.forName() taking fallback default value [v4]

2021-10-26 Thread Daniel Fuchs
On Sat, 23 Oct 2021 22:13:35 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v4]

2021-10-26 Thread Daniel Fuchs
On Tue, 26 Oct 2021 12:59:11 GMT, Naoto Sato wrote: >> src/java.base/share/classes/java/io/Console.java line 590: >> >>> 588: if (cs == null) { >>> 589: cs = Charset.forName(StaticProperty.nativeEncoding(), >>> 590: Charset.defaultCharset()); >> >> I

Re: RFR: 8270490: Charset.forName() taking fallback default value [v4]

2021-10-26 Thread Naoto Sato
On Tue, 26 Oct 2021 10:42:49 GMT, Daniel Fuchs wrote: >> Naoto Sato has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Reflecting review comments > > src/java.base/share/classes/java/io/Console.java line 590: > >> 588: if (cs ==

Re: RFR: 8270490: Charset.forName() taking fallback default value [v4]

2021-10-26 Thread Daniel Fuchs
On Sat, 23 Oct 2021 22:13:35 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v4]

2021-10-25 Thread Sergey Bylokhov
On Sat, 23 Oct 2021 22:13:35 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v4]

2021-10-25 Thread Joe Wang
On Sat, 23 Oct 2021 22:13:35 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v4]

2021-10-25 Thread Roger Riggs
On Sat, 23 Oct 2021 22:13:35 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v3]

2021-10-23 Thread Naoto Sato
On Sat, 23 Oct 2021 19:29:30 GMT, Sergey Bylokhov wrote: > Just an idea, should we check that the second parameter is null or not? Any > pros and cons of that? For example should this code be allowed: > > ``` > var cs = Charset.forName(charsetName, null); > if (cs == null) { >

Re: RFR: 8270490: Charset.forName() taking fallback default value [v4]

2021-10-23 Thread Naoto Sato
> During the review of JEP 400, a proposal to provide an overloaded method to > `Charset.forName()` was suggested > [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This > PR is to implement the proposal. A CSR is also drafted as >

Re: RFR: 8270490: Charset.forName() taking fallback default value [v3]

2021-10-23 Thread Naoto Sato
On Sat, 23 Oct 2021 06:42:52 GMT, Alan Bateman wrote: > I think you'll need to adjust the description make it clear that "fallback" > is used when the input is not a legal charset name or the charset is not > available. Made the method description clearer. - PR:

Re: RFR: 8270490: Charset.forName() taking fallback default value [v3]

2021-10-23 Thread Sergey Bylokhov
On Fri, 22 Oct 2021 17:33:43 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v3]

2021-10-23 Thread Alan Bateman
On Fri, 22 Oct 2021 17:33:43 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v3]

2021-10-22 Thread Ichiroh Takiguchi
On Fri, 22 Oct 2021 17:33:43 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v3]

2021-10-22 Thread Sergey Bylokhov
On Fri, 22 Oct 2021 17:33:43 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v3]

2021-10-22 Thread Roger Riggs
On Fri, 22 Oct 2021 17:33:43 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-22 Thread Naoto Sato
On Fri, 22 Oct 2021 04:54:35 GMT, Glavo wrote: >> Naoto Sato has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Moved the null sentence into @param tag. > > Oh, I found that I checked the outdated source code. Now this problem does > not

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-22 Thread Naoto Sato
On Fri, 22 Oct 2021 02:07:44 GMT, Sergey Bylokhov wrote: >> I first thought of swallowing all exceptions in 2-arg forName(), but decided >> not to do that. Because `IllegalArgumentException` and >> `IllegalCharsetNameException` are for the validity of the passed >> `charsetName`, like

Re: RFR: 8270490: Charset.forName() taking fallback default value [v3]

2021-10-22 Thread Naoto Sato
> During the review of JEP 400, a proposal to provide an overloaded method to > `Charset.forName()` was suggested > [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This > PR is to implement the proposal. A CSR is also drafted as >

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Glavo
On Wed, 20 Oct 2021 19:02:30 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Glavo
On Wed, 20 Oct 2021 19:02:30 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Sergey Bylokhov
On Thu, 21 Oct 2021 16:03:29 GMT, Naoto Sato wrote: >> Apparently `IllegalCharsetNameException` or `IllegalArgumentException` could >> still be thrown - so removing the `try-catch` would be a change of behaviour >> in those cases. It all depends on whether there is a chance that these >>

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Ichiroh Takiguchi
On Thu, 21 Oct 2021 18:00:46 GMT, Naoto Sato wrote: >> I'm not reviewer. >> >> I'd like to write down following code without `try-catch`. >> >> var cs = Charset.forName(charsetName, null); >> if (cs == null) cs = StandardCharsets.UTF_8; >> >> or please find out more easy way. > >> I'd like to

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Naoto Sato
On Thu, 21 Oct 2021 16:06:31 GMT, Ichiroh Takiguchi wrote: > I'd like to write down following code without `try-catch`. You don't *have to* try-catch those exceptions if you are not interested, as they are subclasses of `RuntimeException`. > ``` > var cs = Charset.forName(charsetName, null);

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Ichiroh Takiguchi
On Wed, 20 Oct 2021 19:02:30 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Naoto Sato
On Thu, 21 Oct 2021 09:33:30 GMT, Daniel Fuchs wrote: >> Right, I think both try-catch usages will be removed. > > Apparently `IllegalCharsetNameException` or `IllegalArgumentException` could > still be thrown - so removing the `try-catch` would be a change of behaviour > in those cases. It

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Naoto Sato
On Thu, 21 Oct 2021 15:00:03 GMT, Roger Riggs wrote: >> src/java.base/share/classes/java/io/Console.java line 594: >> >>> 592: cs = Charset.forName(StaticProperty.nativeEncoding(), >>> Charset.defaultCharset()); >>> 593: } catch (Exception ignored) { >>> 594:

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Roger Riggs
On Thu, 21 Oct 2021 01:31:31 GMT, Sergey Bylokhov wrote: >> Naoto Sato has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Moved the null sentence into @param tag. > > src/java.base/share/classes/java/io/Console.java line 594: > >> 592:

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Daniel Fuchs
On Thu, 21 Oct 2021 06:50:41 GMT, Alan Bateman wrote: >> src/java.base/share/classes/java/io/Console.java line 587: >> >>> 585: try { >>> 586: cs = Charset.forName(csname, null); >>> 587: } catch (Exception ignored) { } >> >> The comment

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-21 Thread Alan Bateman
On Thu, 21 Oct 2021 01:30:05 GMT, Sergey Bylokhov wrote: >> Naoto Sato has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Moved the null sentence into @param tag. > > src/java.base/share/classes/java/io/Console.java line 587: > >> 585:

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-20 Thread Sergey Bylokhov
On Wed, 20 Oct 2021 19:02:30 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-20 Thread Roger Riggs
On Wed, 20 Oct 2021 19:02:30 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-20 Thread Joe Wang
On Wed, 20 Oct 2021 19:02:30 GMT, Naoto Sato wrote: >> During the review of JEP 400, a proposal to provide an overloaded method to >> `Charset.forName()` was suggested >> [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This >> PR is to implement the proposal. A CSR is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-20 Thread Naoto Sato
On Wed, 20 Oct 2021 18:58:34 GMT, Alan Bateman wrote: >> Thanks, Joe. Moved that explanation into the `fallback` param, which I >> initially intended. > > The java.nio.charset package has the usual "Unless otherwise noted, passing a > null argument ..." so if fallback is allowed to be null

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-20 Thread Naoto Sato
On Wed, 20 Oct 2021 18:37:05 GMT, Joe Wang wrote: >> Naoto Sato has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Moved the null sentence into @param tag. > > src/java.base/share/classes/java/nio/charset/Charset.java line 545: > >> 543:

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-20 Thread Alan Bateman
On Wed, 20 Oct 2021 18:56:22 GMT, Naoto Sato wrote: >> src/java.base/share/classes/java/nio/charset/Charset.java line 545: >> >>> 543: * @return A charset object for the named charset, or {@code >>> fallback} >>> 544: * in case the charset object for the named charset is

Re: RFR: 8270490: Charset.forName() taking fallback default value [v2]

2021-10-20 Thread Naoto Sato
> During the review of JEP 400, a proposal to provide an overloaded method to > `Charset.forName()` was suggested > [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This > PR is to implement the proposal. A CSR is also drafted as >

Re: RFR: 8270490: Charset.forName() taking fallback default value

2021-10-20 Thread Joe Wang
On Wed, 20 Oct 2021 17:23:36 GMT, Naoto Sato wrote: > During the review of JEP 400, a proposal to provide an overloaded method to > `Charset.forName()` was suggested > [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This > PR is to implement the proposal. A CSR is also

RFR: 8270490: Charset.forName() taking fallback default value

2021-10-20 Thread Naoto Sato
During the review of JEP 400, a proposal to provide an overloaded method to `Charset.forName()` was suggested [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This PR is to implement the proposal. A CSR is also drafted as https://bugs.openjdk.java.net/browse/JDK-8275348