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

Improve error message when loading an invalid class version #15084

Merged
merged 1 commit into from
Jun 1, 2022

Conversation

thallium
Copy link
Contributor

provides version number of invalid class

fix #13347

@fengxue-IS please review

Signed-off-by: Gengchen Tuo gengchen.tuo@ibm.com

@thallium thallium force-pushed the master branch 2 times, most recently from 988d054 to 30ca1b5 Compare May 18, 2022 14:08
runtime/verutil/cfrerr.c Outdated Show resolved Hide resolved
runtime/verutil/cfrerr.c Outdated Show resolved Hide resolved
@thallium thallium force-pushed the master branch 2 times, most recently from d1514fa to 56ca1b2 Compare May 18, 2022 23:25
@pshipton
Copy link
Member

J9NLS_CFR_ERR_MAJOR_VERSION, J9NLS_CFR_ERR_MINOR_VERSION can't be removed completely, just the text can be removed. See the instructions at the top of the file # If you wish to remove a message, delete its text, but leave the key in place.

@thallium
Copy link
Contributor Author

J9NLS_CFR_ERR_MAJOR_VERSION, J9NLS_CFR_ERR_MINOR_VERSION can't be removed completely, just the text can be removed. See the instructions at the top of the file # If you wish to remove a message, delete its text, but leave the key in place.

should = be removed?

@pshipton
Copy link
Member

should = be removed?

The = should stay. You can also remove the values of the fields that follow, and set .explanation=NOTAG. Example

J9NLS_VM_DVT_NOT_SET=
# START NON-TRANSLATABLE
J9NLS_VM_DVT_NOT_SET.explanation=NOTAG
J9NLS_VM_DVT_NOT_SET.system_action=
J9NLS_VM_DVT_NOT_SET.user_response=
# END NON-TRANSLATABLE

runtime/verutil/cfrerr.c Outdated Show resolved Hide resolved
@thallium thallium force-pushed the master branch 2 times, most recently from a536c76 to 0d6991e Compare May 20, 2022 16:34
@thallium thallium requested a review from pshipton May 20, 2022 17:01
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
runtime/verutil/cfrerr.c Outdated Show resolved Hide resolved
runtime/verutil/cfrerr.c Outdated Show resolved Hide resolved
@thallium thallium force-pushed the master branch 2 times, most recently from a65b82a to a7c6194 Compare May 20, 2022 19:09
@thallium
Copy link
Contributor Author

Removed old preview version message and also squashed commits.

@pshipton
Copy link
Member

@fengxue-IS any more comments?

jenking test sanity,extended xlinux jdk8

Copy link
Contributor

@fengxue-IS fengxue-IS left a comment

Choose a reason for hiding this comment

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

code lgtm, no more questions

@fengxue-IS
Copy link
Contributor

jenking test sanity,extended xlinux jdk8

@pshipton can you please restart the testing, there is a typo

@pshipton
Copy link
Member

jenkins test sanity,extended xlinux jdk8

@pshipton
Copy link
Member

jenkins compile xlinux jdk18,jdk19

@thallium
Copy link
Contributor Author

jenkins compile xlinux jdk18,jdk19

@pshipton Looks like it should be "next" instead of jdk19?

@pshipton
Copy link
Member

jenkins compile xlinux jdk18,jdknext

@pshipton
Copy link
Member

Major version too big:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=Wait, offset=6
	at java.lang.ClassLoader.defineClassImpl(Native Method)

Preview version on older JVM:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=Switch, offset=6
	at java.lang.ClassLoader.defineClassImpl(Native Method)

Preview not enabled:

Error: LinkageError occurred while loading main class Switch
	java.lang.UnsupportedClassVersionError: JVMCFRE197E version 62.65535 of class Switch is a preview version but preview is not enabled, please enable it with --enable-preview; offset=6

Unsupported preview version

Error: LinkageError occurred while loading main class Switch
	java.lang.UnsupportedClassVersionError: JVMCFRE198E version 61.65535 of class Switch is an unsupported preview major version, runtime only allows 62.65535; offset=6

@thallium
Copy link
Contributor Author

Major version too big:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=Wait, offset=6
	at java.lang.ClassLoader.defineClassImpl(Native Method)

Preview version on older JVM:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=Switch, offset=6
	at java.lang.ClassLoader.defineClassImpl(Native Method)

Preview not enabled:

Error: LinkageError occurred while loading main class Switch
	java.lang.UnsupportedClassVersionError: JVMCFRE197E version 62.65535 of class Switch is a preview version but preview is not enabled, please enable it with --enable-preview; offset=6

Unsupported preview version

Error: LinkageError occurred while loading main class Switch
	java.lang.UnsupportedClassVersionError: JVMCFRE198E version 61.65535 of class Switch is an unsupported preview major version, runtime only allows 62.65535; offset=6

What's the first two errors? Do I need to do something about them?

@pshipton
Copy link
Member

They are just examples of your changes, for testing.

@pshipton pshipton requested a review from keithc-ca May 25, 2022 21:48
runtime/bcutil/cfreader.c Show resolved Hide resolved
runtime/oti/j9nonbuilder.h Outdated Show resolved Hide resolved
runtime/verutil/cfrerr.c Outdated Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
@thallium thallium force-pushed the master branch 3 times, most recently from 73c276c to ecea610 Compare May 27, 2022 17:12
@thallium thallium requested a review from keithc-ca May 27, 2022 17:14
runtime/bcutil/cfreader.c Outdated Show resolved Hide resolved
runtime/bcutil/cfreader.c Outdated Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Outdated Show resolved Hide resolved
@keithc-ca
Copy link
Contributor

@thallium Please resolve the conflict (your additions to cfrerr.nls should go at the end).

runtime/nls/cfre/cfrerr.nls Show resolved Hide resolved
runtime/nls/cfre/cfrerr.nls Show resolved Hide resolved
Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
@keithc-ca
Copy link
Contributor

jenkins test sanity,extended alinux64,win,win32 jdk8

@keithc-ca keithc-ca merged commit a091bb4 into eclipse-openj9:master Jun 1, 2022
@pshipton
Copy link
Member

pshipton commented Jun 1, 2022

@thallium pls cherry pick this change and create a PR against the https://github.com/eclipse-openj9/openj9/tree/v0.33.0-release branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve error message when loading an invalid class version
4 participants