Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8276665: ObjectInputStream.GetField.get(name, object) should throw ClassNotFoundException #6393

Closed
wants to merge 4 commits into from

Conversation

RogerRiggs
Copy link
Contributor

@RogerRiggs RogerRiggs commented Nov 15, 2021

The ObjectInputStream.GetField.get(String name, Object val) method is returning null instead of throwing an exception when the class of the object is not found. The caller is not able to correctly handle the case where the class is not found. The signature of GetField.get(name, val) should have a throws ClassNotFoundException and a ClassNotFoundException exception should be thrown.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8276665: ObjectInputStream.GetField.get(name, object) should throw ClassNotFoundException

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6393/head:pull/6393
$ git checkout pull/6393

Update a local copy of the PR:
$ git checkout pull/6393
$ git pull https://git.openjdk.java.net/jdk pull/6393/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6393

View PR using the GUI difftool:
$ git pr show -t 6393

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6393.diff

…eption

Updated to add throws CNFE to GetField.get and test for various cases.
@bridgekeeper
Copy link

bridgekeeper bot commented Nov 15, 2021

👋 Welcome back rriggs! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 15, 2021

@RogerRiggs The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Nov 15, 2021
…eption

Updated to add throws CNFE to GetField.get and test for various cases.
@RogerRiggs RogerRiggs changed the title 8276665: ObjectInputStream.GetField.get should throw ClassNotFoundException 8276665: ObjectInputStream.GetField.get(name, object) should throw ClassNotFoundException Nov 17, 2021
@RogerRiggs
Copy link
Contributor Author

/csr

@RogerRiggs RogerRiggs marked this pull request as ready for review November 17, 2021 15:45
@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Nov 17, 2021
@openjdk
Copy link

openjdk bot commented Nov 17, 2021

@RogerRiggs this pull request will not be integrated until the CSR request JDK-8276742 for issue JDK-8276665 has been approved.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 17, 2021
@mlbridge
Copy link

mlbridge bot commented Nov 17, 2021

Webrevs

Copy link
Member

@naotoj naotoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good.

src/java.base/share/classes/java/io/ObjectInputStream.java Outdated Show resolved Hide resolved
@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Nov 18, 2021
@openjdk
Copy link

openjdk bot commented Nov 18, 2021

⚠️ @RogerRiggs This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@RogerRiggs
Copy link
Contributor Author

Note the addition of a system property "jdk.serialGetFieldCnfeReturnsNull" to revert to the old behavior
if there is an application dependency on the old behavior.

@openjdk
Copy link

openjdk bot commented Nov 18, 2021

@RogerRiggs This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8276665: ObjectInputStream.GetField.get(name, object) should throw ClassNotFoundException

Reviewed-by: naoto, lancea, smarks

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 131 new commits pushed to the master branch:

  • 7b2d823: 8277503: compiler/onSpinWait/TestOnSpinWaitAArch64DefaultFlags.java failed with "OnSpinWaitInst with the expected value 'isb' not found."
  • 7cb56a2: 8265796: vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java fails when running with JEP 416
  • 24e586a: 8276764: Enable deterministic file content ordering for Jar and Jmod
  • ea85e01: 8271623: Omit enclosing instance fields from inner classes that don't use it
  • 0320672: 8277451: java.lang.reflect.Field::set on static field with invalid argument type should throw IAE
  • e8acac2: 8277350: runtime/jni/checked/TestPrimitiveArrayCriticalWithBadParam.java times out
  • 8a44e09: 8268725: jshell does not support the --enable-native-access option
  • 7b67a49: 8261847: performance of java.lang.Record::toString should be improved
  • 38802ad: 8254108: ciReplay: Support incremental inlining
  • 64bdc84: 8277649: [BACKOUT] JDK-8277507 Add jlink.debug system property while launching jpackage tests to help diagonize recent intermittent failures
  • ... and 121 more: https://git.openjdk.java.net/jdk/compare/7fc344dc96008f277dacf5518b28447f3a598cde...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 18, 2021
@RogerRiggs
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 24, 2021

Going to push as commit 0384739.
Since your change was applied there have been 138 commits pushed to the master branch:

  • cf7adae: 8275320: NMT should perform buffer overrun checks
  • 96e3607: 8275063: Implementation of Foreign Function & Memory API (Second incubator)
  • 17e68ca: 8277042: add test for 8276036 to compiler/codecache
  • 8a8bc29: 8277562: Remove dead method c1 If::swap_sux
  • d085c2b: 8273328: Compiler implementation for Pattern Matching for switch (Second Preview)
  • 6d73460: 8277399: ZGC: Move worker thread logging out of gc+phase=debug
  • 712b875: 8277397: ZGC: Add JFR event for temporary latency measurements
  • 7b2d823: 8277503: compiler/onSpinWait/TestOnSpinWaitAArch64DefaultFlags.java failed with "OnSpinWaitInst with the expected value 'isb' not found."
  • 7cb56a2: 8265796: vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java fails when running with JEP 416
  • 24e586a: 8276764: Enable deterministic file content ordering for Jar and Jmod
  • ... and 128 more: https://git.openjdk.java.net/jdk/compare/7fc344dc96008f277dacf5518b28447f3a598cde...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 24, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 24, 2021
@openjdk
Copy link

openjdk bot commented Nov 24, 2021

@RogerRiggs Pushed as commit 0384739.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@RogerRiggs RogerRiggs deleted the 8276665-readfields-cnfe branch June 10, 2022 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
4 participants