RFR: 8254717: isAssignableFrom checks in KeyFactorySpi.engineGetKeySpec appear to be backwards

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8254717: isAssignableFrom checks in KeyFactorySpi.engineGetKeySpec appear to be backwards

Ziyi Luo
All of the "isAssignableFrom" checks in "engineGetKeySpec" appear to be backwards in Java's KeyFactorySpi.engineGetKeySpec implementations. In most cases, the requested KeySpec is equal to the concrete implementation so the inversion does not matter. But there are few cases, as presented in the added jtreg test, will cause unexpected behavior (e.g., ClassCastException rather than an InvalidKeySpecException). The fix is trivial.

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

Commit messages:
 - 8254717: isAssignableFrom checks in KeyFactorySpi.engineGetKeySpec appear to be backwards

Changes: https://git.openjdk.java.net/jdk/pull/2681/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2681&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8254717
  Stats: 112 lines in 15 files changed: 71 ins; 0 del; 41 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2681.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2681/head:pull/2681

PR: https://git.openjdk.java.net/jdk/pull/2681
Reply | Threaded
Open this post in threaded view
|

Withdrawn: 8254717: isAssignableFrom checks in KeyFactorySpi.engineGetKeySpec appear to be backwards

Ziyi Luo
On Tue, 23 Feb 2021 01:38:36 GMT, Ziyi Luo <[hidden email]> wrote:

> All of the "isAssignableFrom" checks in "engineGetKeySpec" appear to be backwards in Java's KeyFactorySpi.engineGetKeySpec implementations. In most cases, the requested KeySpec is equal to the concrete implementation so the inversion does not matter. But there are few cases, as presented in the added jtreg test, will cause unexpected behavior (e.g., ClassCastException rather than an InvalidKeySpecException). The fix is trivial.

This pull request has been closed without being integrated.

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

PR: https://git.openjdk.java.net/jdk/pull/2681
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8254717: isAssignableFrom checks in KeyFactorySpi.engineGetKeySpec appear to be backwards

Ziyi Luo
In reply to this post by Ziyi Luo
On Tue, 23 Feb 2021 01:38:36 GMT, Ziyi Luo <[hidden email]> wrote:

> All of the "isAssignableFrom" checks in "engineGetKeySpec" appear to be backwards in Java's KeyFactorySpi.engineGetKeySpec implementations. In most cases, the requested KeySpec is equal to the concrete implementation so the inversion does not matter. But there are few cases, as presented in the added jtreg test, will cause unexpected behavior (e.g., ClassCastException rather than an InvalidKeySpecException). The fix is trivial.

Will change the branch and submit a new one

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

PR: https://git.openjdk.java.net/jdk/pull/2681