Skip to content

Commit 45e1a3a

Browse files
dsanzbrianchandotcom
authored andcommitted
LPS-200583 Simplify: enforce number of files for the current request is not higher than combo.max.files value. This still allows caching more files than combo.max.files globally, because we cache many responses. We guarantee however that no element in cache contains more than combo.max.files
1 parent 60facf5 commit 45e1a3a

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

portal-impl/src/com/liferay/portal/servlet/ComboServlet.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -307,23 +307,9 @@ protected void doService(
307307
if (cacheEnabled && (modulePathsString != null) &&
308308
!PropsValues.COMBO_CHECK_TIMESTAMP) {
309309

310-
if (modulePaths.length <= PropsValues.COMBO_MAX_FILES) {
311-
int totalFilesCount = 0;
310+
if (PropsValues.COMBO_MAX_FILES > 0 &&
311+
modulePaths.length > PropsValues.COMBO_MAX_FILES) {
312312

313-
List<String> keys = _bytesArrayPortalCache.getKeys();
314-
315-
for (String key : keys) {
316-
byte[][] curBytesArray = _bytesArrayPortalCache.get(
317-
key);
318-
319-
totalFilesCount += curBytesArray.length;
320-
321-
if (totalFilesCount > PropsValues.COMBO_MAX_FILES) {
322-
return;
323-
}
324-
}
325-
}
326-
else {
327313
httpServletResponse.setHeader(
328314
HttpHeaders.CACHE_CONTROL,
329315
HttpHeaders.CACHE_CONTROL_NO_CACHE_VALUE);
@@ -333,7 +319,7 @@ protected void doService(
333319

334320
if (_log.isWarnEnabled()) {
335321
_log.warn(
336-
"ComboServlet request exceeded maximum file count")
322+
"ComboServlet request exceeded maximum file count");
337323
}
338324

339325
return;

0 commit comments

Comments
 (0)