Skip to content

Commit

Permalink
LPS-58330 Refactor, no logical changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hhuijser authored and brianchandotcom committed Sep 2, 2015
1 parent bd29e99 commit b3d7ee3
Showing 1 changed file with 30 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,15 @@ protected void addImportCounts(String content) {
}
}

protected void addJSPIncludeFileNames(String fileName) {
protected Set<String> getJSPIncludeFileNames(
String fileName, Set<String> fileNames) {

Set<String> includeFileNames = new HashSet<>();

String content = _jspContents.get(fileName);

if (Validator.isNull(content)) {
return;
return includeFileNames;
}

for (int x = 0;;) {
Expand Down Expand Up @@ -133,20 +137,33 @@ protected void addJSPIncludeFileNames(String fileName) {
!includeFileName.endsWith("html/common/init.jsp") &&
!includeFileName.endsWith("html/portlet/init.jsp") &&
!includeFileName.endsWith("html/taglib/init.jsp") &&
!_includeFileNames.contains(includeFileName)) {
!fileNames.contains(includeFileName)) {

_includeFileNames.add(includeFileName);
includeFileNames.add(includeFileName);
}

x = y;
}

return includeFileNames;
}

protected void addJSPReferenceFileNames(String fileName) {
protected Set<String> getJSPReferenceFileNames(
String fileName, Set<String> fileNames) {

Set<String> referenceFileNames = new HashSet<>();

if (!fileName.endsWith("init.jsp") &&
!fileName.endsWith("init.jspf") &&
!fileName.contains("init-ext.jsp")) {

return referenceFileNames;
}

for (Map.Entry<String, String> entry : _jspContents.entrySet()) {
String referenceFileName = entry.getKey();

if (_includeFileNames.contains(referenceFileName)) {
if (fileNames.contains(referenceFileName)) {
continue;
}

Expand Down Expand Up @@ -182,12 +199,14 @@ protected void addJSPReferenceFileNames(String fileName) {
content.contains(
"<%@ include file=\"" + fileName.substring(x + 1))) {

_includeFileNames.add(referenceFileName);
referenceFileNames.add(referenceFileName);

break;
}
}
}

return referenceFileNames;
}

protected void addJSPUnusedImports(
Expand Down Expand Up @@ -1325,14 +1344,10 @@ protected boolean isJSPTermRequired(
}

if (!_checkedForIncludesFileNames.contains(fileName)) {
addJSPIncludeFileNames(fileName);

if (fileName.endsWith("init.jsp") ||
fileName.endsWith("init.jspf") ||
fileName.contains("init-ext.jsp")) {

addJSPReferenceFileNames(fileName);
}
_includeFileNames.addAll(
getJSPIncludeFileNames(fileName, _includeFileNames));
_includeFileNames.addAll(
getJSPReferenceFileNames(fileName, _includeFileNames));
}

_checkedForIncludesFileNames.add(fileName);
Expand Down

0 comments on commit b3d7ee3

Please sign in to comment.