[ 
https://issues.apache.org/jira/browse/WW-5622?focusedWorklogId=1013352&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1013352
 ]

ASF GitHub Bot logged work on WW-5622:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Apr/26 13:22
            Start Date: 04/Apr/26 13:22
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #1650:
URL: https://github.com/apache/struts/pull/1650

   ## 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](https://issues.apache.org/jira/browse/WW-5622)
   
   ## Test plan
   
   - [x] `SpringProxyUtilTest` — 3 tests pass
   - [x] Core `util.**` tests — 89 pass (4 failures in unrelated 
`DefaultFileManagerTest`)
   - [ ] Manual verification in app without Hibernate on classpath
   
   🤖 Generated with [Claude Code](https://claude.ai/code)




Issue Time Tracking
-------------------

    Worklog Id:     (was: 1013352)
    Time Spent: 0.5h  (was: 20m)

> 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: 0.5h
>  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)

Reply via email to