Skip to content

fix(common): handle classes without a superclass - #22

Open
Hanabi9248 wants to merge 1 commit into
IvorySQL:IVYC_REL_5_STABLEfrom
Hanabi9248:codex/common-class-predicate
Open

Hanabi9248 wants to merge 1 commit into
IvorySQL:IVYC_REL_5_STABLEfrom
Hanabi9248:codex/common-class-predicate

Conversation

@Hanabi9248

Copy link
Copy Markdown

CommonUtil.isNumber(Class) dereferences getSuperclass() before reaching its existing primitive-type branch. Primitive classes, Object.class and interfaces have no superclass, so these ordinary inputs throw NullPointerException.

Call equals on Number.class instead. A missing superclass becomes a non-match and evaluation continues through the existing wrapper/primitive clauses. The classification clauses and null-Class policy are unchanged. This is a public utility fix; no deployed service incident is claimed.

Validated the complete actual CommonUtil and unchanged DateHelper support on Windows, JDK 25.0.4.101 with --release 8, using real commons-lang 2.4, slf4j-api 1.7.30 and Lombok 1.18.42. Baseline: eight NullPointerExceptions and two passing controls. Candidate: all ten pass, covering six numeric primitive classes, Object.class, CharSequence.class, Integer.class and String.class.

The project's commons-lang 2.6 and Lombok 1.18.20, a Java 8 runtime, Linux and the full Maven/backend suite were not tested. The standalone Java regression is manual; hosted CI coverage is not claimed. This branch contains only the class-predicate change, independently of #15's UTC conversion fix.

Compare from Number.class before the existing wrapper and primitive
clauses. Genuine primitive, Object and interface Class values then
evaluate instead of throwing NullPointerException.

Cover ten JDK class inputs through the complete CommonUtil class.
Keep the existing classification clauses and null-Class policy.

Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant