[
https://issues.apache.org/jira/browse/WW-5622?focusedWorklogId=1013348&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1013348
]
ASF GitHub Bot logged work on WW-5622:
--------------------------------------
Author: ASF GitHub Bot
Created on: 04/Apr/26 09:48
Start Date: 04/Apr/26 09:48
Worklog Time Spent: 10m
Work Description: lukaszlenart opened a new pull request, #1649:
URL: https://github.com/apache/struts/pull/1649
## Summary
- Detect Hibernate availability once at class-load time via
`Class.forName()` in both `StrutsProxyService` and deprecated `ProxyUtil`
- Short-circuit `isHibernateProxy()`, `isHibernateProxyMember()`, and
`getHibernateProxyTarget()` immediately when Hibernate is absent
- Retain existing `try/catch LinkageError` blocks as safety net for partial
classpath scenarios
## Problem
When Hibernate is not on the application classpath, every call to Hibernate
proxy detection methods throws and catches `LinkageError`. While
`computeIfAbsent` caching in 7.x limits this to one exception per unique
class/member, applications with many distinct classes flowing through OGNL
still experience thousands of caught exceptions, causing measurable performance
degradation. The issue is most severe in Struts 6.x where caching is less
effective.
Fixes [WW-5622](https://issues.apache.org/jira/browse/WW-5622)
## Test plan
- [x] `StrutsProxyServiceTest` — 36 tests pass
- [x] `StrutsProxyServiceSpringIntegrationTest` — 16 tests pass
- [x] `SecurityMemberAccessTest` — 98 tests pass
- [x] `SpringProxyUtilTest` — 6 tests pass
- [ ] Backport to `support/6.x` branch
🤖 Generated with [Claude Code](https://claude.ai/code)
Issue Time Tracking
-------------------
Worklog Id: (was: 1013348)
Remaining Estimate: 0h
Time Spent: 10m
> Optimize Hibernate proxy detection to avoid repeated exception overhead when
> Hibernate is absent
> ------------------------------------------------------------------------------------------------
>
> Key: WW-5622
> URL: https://issues.apache.org/jira/browse/WW-5622
> Project: Struts 2
> Issue Type: Improvement
> Components: Core
> Reporter: Lukasz Lenart
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 6.9.0, 7.2.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When Hibernate is not on the application classpath, Hibernate proxy detection
> methods throw and internally catch exceptions (NoClassDefFoundError in 6.x,
> LinkageError in 7.x) on every invocation. Applications with many distinct
> classes flowing through OGNL experience hundreds of thousands of caught
> exceptions, causing measurable performance degradation.
> h3. Impact
> The impact is most severe in Struts 6.x where
> {{com.opensymphony.xwork2.util.ProxyUtil}} lacks effective caching -
> {{isHibernateProxy()}} throws on nearly every call. Struts 7.x mitigates this
> partially via {{computeIfAbsent}} caching in {{StrutsProxyService}}, but
> still throws once per unique class/member.
> h3. Fix
> Detect Hibernate availability once at class-load time via {{Class.forName()}}
> and short-circuit all Hibernate-related methods immediately when absent. The
> existing {{try/catch}} blocks are retained as a safety net for partial
> classpath scenarios.
> h3. Affected Classes
> - 6.x: {{com.opensymphony.xwork2.util.ProxyUtil}}
> - 7.x: {{org.apache.struts2.util.StrutsProxyService}} and deprecated
> {{org.apache.struts2.util.ProxyUtil}}
> h3. Affected Methods
> - {{isHibernateProxy()}}
> - {{isHibernateProxyMember()}}
> - {{getHibernateProxyTarget()}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)