2020
2121import org .apache .logging .log4j .LogManager ;
2222import org .apache .logging .log4j .Logger ;
23- import org .apache .struts2 .result .ActionChainResult ;
2423import org .apache .struts2 .ActionInvocation ;
2524import org .apache .struts2 .StrutsConstants ;
2625import org .apache .struts2 .Unchainable ;
2726import org .apache .struts2 .inject .Inject ;
27+ import org .apache .struts2 .result .ActionChainResult ;
2828import org .apache .struts2 .result .Result ;
2929import org .apache .struts2 .util .CompoundRoot ;
3030import org .apache .struts2 .util .ProxyUtil ;
@@ -167,17 +167,18 @@ public String intercept(ActionInvocation invocation) throws Exception {
167167 }
168168
169169 private void copyStack (ActionInvocation invocation , CompoundRoot root ) {
170- List list = prepareList (root );
170+ List < Object > list = prepareList (root );
171171 Map <String , Object > ctxMap = invocation .getInvocationContext ().getContextMap ();
172172 for (Object object : list ) {
173- if (shouldCopy (object )) {
174- Object action = invocation . getAction () ;
175- Class <?> editable = null ;
176- if ( ProxyUtil . isProxy ( action )) {
177- editable = ProxyUtil . ultimateTargetClass ( action ) ;
178- }
179- reflectionProvider . copy ( object , action , ctxMap , prepareExcludes (), includes , editable );
173+ if (! shouldCopy (object )) {
174+ continue ;
175+ }
176+ Object action = invocation . getAction ();
177+ Class <?> editable = null ;
178+ if ( ProxyUtil . isProxy ( action )) {
179+ editable = ProxyUtil . ultimateTargetClass ( action );
180180 }
181+ reflectionProvider .copy (object , action , ctxMap , prepareExcludes (), includes , editable );
181182 }
182183 }
183184
@@ -204,9 +205,8 @@ private boolean shouldCopy(Object o) {
204205 return o != null && !(o instanceof Unchainable );
205206 }
206207
207- @ SuppressWarnings ("unchecked" )
208- private List prepareList (CompoundRoot root ) {
209- List list = new ArrayList (root );
208+ private List <Object > prepareList (CompoundRoot root ) {
209+ var list = new ArrayList <>(root );
210210 list .remove (0 );
211211 Collections .reverse (list );
212212 return list ;
0 commit comments