Skip to content

WW-5622 Optimize Hibernate proxy detection when Hibernate is absent#1650

Open
lukaszlenart wants to merge 1 commit intorelease/struts-6-8-xfrom
fix/WW-5622-hibernate-proxy-detection-perf
Open

WW-5622 Optimize Hibernate proxy detection when Hibernate is absent#1650
lukaszlenart wants to merge 1 commit intorelease/struts-6-8-xfrom
fix/WW-5622-hibernate-proxy-detection-perf

Conversation

@lukaszlenart
Copy link
Copy Markdown
Member

@lukaszlenart lukaszlenart commented Apr 4, 2026

Summary

  • Detect Hibernate availability once at class-load time via Class.forName() in ProxyUtil
  • Short-circuit isHibernateProxy(), isHibernateProxyMember(), and getHibernateProxyTarget() immediately when Hibernate is absent
  • Retain existing catch (NoClassDefFoundError) blocks as safety net (intentionally narrower than LinkageError — broken Hibernate installs should fail visibly)

Problem

When Hibernate is not on the application classpath, every call to Hibernate proxy detection methods throws and catches NoClassDefFoundError. Since isProxy() and isProxyMember() are invoked on every OGNL evaluation, this produces hundreds of thousands of caught exceptions, causing severe performance degradation.

Backport of #1649 (Struts 7) to release/struts-6-8-x.

Fixes WW-5622

Test plan

  • SpringProxyUtilTest — 3 tests pass
  • Core util.** tests — 89 pass (4 failures in unrelated DefaultFileManagerTest)
  • Manual verification in app without Hibernate on classpath

🤖 Generated with Claude Code

…NoClassDefFoundError

Detect Hibernate availability once at class-load time via Class.forName()
and short-circuit all Hibernate-related methods immediately when absent.
This eliminates repeated NoClassDefFoundError exceptions that cause
significant performance degradation in applications without Hibernate
on the classpath.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lukaszlenart lukaszlenart force-pushed the fix/WW-5622-hibernate-proxy-detection-perf branch from 0aa13da to 98a3c1c Compare April 4, 2026 13:29
@lukaszlenart lukaszlenart force-pushed the fix/WW-5622-hibernate-proxy-detection-perf branch from 98a3c1c to 2eede24 Compare April 4, 2026 13:32
@lukaszlenart lukaszlenart marked this pull request as ready for review April 4, 2026 13:32
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 4, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
25 Security Hotspots
43.3% Coverage on New Code (required ≥ 80%)
3.3% Duplication on New Code (required ≤ 3%)
E Security Rating on New Code (required ≥ A)
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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