@@ -246,9 +246,9 @@ public final class PageContextImpl extends PageContext {
246246 /**
247247 * Field <code>pathList</code>
248248 */
249- private final LinkedList <UDF > udfs = new LinkedList <UDF >();
250- private final LinkedList <PageSource > pathList = new LinkedList <PageSource >();
251- private final LinkedList <PageSource > includePathList = new LinkedList <PageSource >();
249+ private final ArrayList <UDF > udfs = new ArrayList <UDF >();
250+ private final ArrayList <PageSource > pathList = new ArrayList <PageSource >();
251+ private final ArrayList <PageSource > includePathList = new ArrayList <PageSource >();
252252 private final Set <PageSource > includeOnce = new HashSet <PageSource >();
253253
254254 /**
@@ -926,13 +926,13 @@ public PageSource getRelativePageSource(String realPath) {
926926 LogUtil .log (this , Log .LEVEL_INFO , PageContextImpl .class .getName (), "method getRelativePageSource is deprecated" );
927927 if (StringUtil .startsWith (realPath , '/' )) return PageSourceImpl .best (getPageSources (realPath ));
928928 if (pathList .size () == 0 ) return null ;
929- return ((PageSourceImpl ) pathList .getLast ( )).getRealPageSource (this , realPath );
929+ return ((PageSourceImpl ) pathList .get ( pathList . size () - 1 )).getRealPageSource (this , realPath );
930930 }
931931
932932 public PageSource getRelativePageSourceExisting (String realPath ) {
933933 if (StringUtil .startsWith (realPath , '/' )) return getPageSourceExisting (realPath );
934934 if (pathList .size () == 0 ) return null ;
935- PageSource ps = ((PageSourceImpl ) pathList .getLast ( )).getRealPageSource (this , realPath );
935+ PageSource ps = ((PageSourceImpl ) pathList .get ( pathList . size () - 1 )).getRealPageSource (this , realPath );
936936 if (PageSourceImpl .pageExist (ps )) return ps ;
937937 return null ;
938938 }
@@ -950,7 +950,7 @@ public PageSource getRelativePageSourceExisting(String realPath, boolean previou
950950 PageSource ps = null , tmp = null ;
951951 if (previous ) {
952952 boolean valid = false ;
953- ps = pathList .getLast ( );
953+ ps = pathList .get ( pathList . size () - 1 );
954954 for (int i = pathList .size () - 2 ; i >= 0 ; i --) {
955955 tmp = pathList .get (i );
956956 if (tmp != ps ) {
@@ -961,7 +961,7 @@ public PageSource getRelativePageSourceExisting(String realPath, boolean previou
961961 }
962962 if (!valid ) return null ;
963963 }
964- else ps = pathList .getLast ( );
964+ else ps = pathList .get ( pathList . size () - 1 );
965965
966966 ps = ((PageSourceImpl ) ps ).getRealPageSource (this , realPath );
967967 if (PageSourceImpl .pageExist (ps )) return ps ;
@@ -970,7 +970,7 @@ public PageSource getRelativePageSourceExisting(String realPath, boolean previou
970970
971971 public PageSource [] getRelativePageSources (String realPath ) {
972972 if (StringUtil .startsWith (realPath , '/' )) return getPageSources (realPath );
973- PageSource ps = pathList .peekLast ( );
973+ PageSource ps = pathList .isEmpty () ? null : pathList . get ( pathList . size () - 1 );
974974 if (ps == null ) return null ;
975975 return new PageSource [] { ((PageSourceImpl ) ps ).getRealPageSource (this , realPath ) };
976976 }
@@ -1207,12 +1207,12 @@ public int getCurrentLevel() {
12071207
12081208 @ Override
12091209 public PageSource getCurrentPageSource () {
1210- return pathList .peekLast ( );
1210+ return pathList .isEmpty () ? null : pathList . get ( pathList . size () - 1 );
12111211 }
12121212
12131213 @ Override
12141214 public PageSource getCurrentPageSource (PageSource defaultvalue ) {
1215- PageSource ps = pathList .peekLast ( );
1215+ PageSource ps = pathList .isEmpty () ? null : pathList . get ( pathList . size () - 1 );
12161216 return ps != null ? ps : defaultvalue ;
12171217 }
12181218
@@ -1221,7 +1221,7 @@ public PageSource getCurrentPageSource(PageSource defaultvalue) {
12211221 */
12221222 @ Override
12231223 public PageSource getCurrentTemplatePageSource () {
1224- return includePathList .peekLast ( );
1224+ return includePathList .isEmpty () ? null : includePathList . get ( includePathList . size () - 1 );
12251225 }
12261226
12271227 /**
@@ -3482,8 +3482,8 @@ public void addPageSource(PageSource ps, PageSource psInc) {
34823482
34833483 @ Override
34843484 public void removeLastPageSource (boolean alsoInclude ) {
3485- if (!pathList .isEmpty ()) pathList .removeLast ( );
3486- if (alsoInclude && !includePathList .isEmpty ()) includePathList .removeLast ( );
3485+ if (!pathList .isEmpty ()) pathList .remove ( pathList . size () - 1 );
3486+ if (alsoInclude && !includePathList .isEmpty ()) includePathList .remove ( includePathList . size () - 1 );
34873487 }
34883488
34893489 public UDF [] getUDFs () {
@@ -3495,7 +3495,7 @@ public void addUDF(UDF udf) {
34953495 }
34963496
34973497 public void removeUDF () {
3498- if (!udfs .isEmpty ()) udfs .removeLast ( );
3498+ if (!udfs .isEmpty ()) udfs .remove ( udfs . size () - 1 );
34993499 }
35003500
35013501 // ==================== Debugger Stack Frame Support ====================
0 commit comments