RFR: 8316996: Catalog API Enhancement: add a factory method [v5]

Naoto Sato naoto at openjdk.org
Fri Oct 27 22:37:32 UTC 2023


On Fri, 27 Oct 2023 22:21:41 GMT, Joe Wang <joehw at openjdk.org> wrote:

>> src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java line 283:
>> 
>>> 281:                     return type;
>>> 282:                 }
>>> 283:             }
>> 
>> Instead of looping through all the elements, `Enum.valueOf()` can be used (and it appropriately throws IAE if not found).
>
> Thanks. Added IAE. Enum.valueOf() is nice. However, in this case, the Enum type is mapped to the resolve property that was defined to be case sensitive. It would therefore require validating the case and then convert it to upper case before calling valueOf. While the current impl requires loop, it uses toString() that's mapped to the resolve property.

That is correct. Thanks for checking

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16045#discussion_r1375099347


More information about the core-libs-dev mailing list