Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-33799 #1096

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
6bed332
LPS-33959 - Allow error-code 1002 to pass element name
michaelhashimoto Mar 28, 2013
7e13fe2
LPS-32110 Clear up ftls, move logic in blogs_entry.ftl to blogs.ftl, …
tinatian Mar 14, 2013
9f9dc65
LPS-32110 Clear up ftls, move logic in mb_category.ftl to mb.ftl, no …
tinatian Mar 14, 2013
1ea073c
LPS-32110 Clear up ftls, move logic in wiki_page.ftl to wiki.ftl, no …
tinatian Mar 14, 2013
2fb34f8
LPS-32110 SF, no changes.
tinatian Mar 28, 2013
e33f25b
LPS-32110 Clear up ftls, move logic in dl.ftl to groups.ftl, no changes.
tinatian Mar 28, 2013
1540ece
LPS-32110 Clear up ftls, move logic in dl_folder.ftl to dl_folders.ft…
tinatian Mar 28, 2013
09a94ed
LPS-32110 SF
brianchandotcom Mar 28, 2013
289a9c3
LPS-34057 - Update invalid HTML markup in app-view-search-entry taglib
Mar 27, 2013
66b49cf
LPS-33971
grace-guan99 Mar 28, 2013
b1b8ff5
LPS-33959 - Add check for valid attribute values
michaelhashimoto Mar 28, 2013
55d0062
LPS-34047 - Paths
michaelhashimoto Mar 28, 2013
385ba8c
LPS-34047 - Actions
michaelhashimoto Mar 28, 2013
b5952e8
LPS-34047 - Macros
michaelhashimoto Mar 28, 2013
c66b137
LPS-34047 - Tests
michaelhashimoto Mar 28, 2013
918a745
LPS-33079 Fix accidental logical change
hhuijser Mar 28, 2013
8c9c68e
LPS-31849 Add SilentPrefsPropsUtil
mikakoivisto Mar 28, 2013
96f06dc
LPS-31849 SF
brianchandotcom Mar 28, 2013
159ce08
LPS-33959 - Fix invalid element Exceptions
michaelhashimoto Mar 28, 2013
47fd0a9
LPS-33448
daledotshan Mar 21, 2013
567f424
LPS-33448 Fixing translation for file upload fields and edition when …
Mar 28, 2013
5b51c2e
LPS-34074 Not all jsessionids are correctly matched.
mikakoivisto Mar 28, 2013
40e22a4
LPS-34074 SF
brianchandotcom Mar 28, 2013
9116644
LPS-33959 - More specific missing child element exception
michaelhashimoto Mar 28, 2013
35c7b1a
LPS-33959 - Distinguish a missing name from an invalid name
michaelhashimoto Mar 29, 2013
4680e82
LPS-33959 Fix wrong variable name
brianchandotcom Mar 29, 2013
26e964b
LPS-33959 - Add the rest of the FunctionExecuteElement Tests
michaelhashimoto Mar 29, 2013
d0b6b47
LPS-32941
JamesLefeu Mar 29, 2013
a96da70
SourceFormatter - improve logic for catching redundant parentheses
hhuijser Mar 29, 2013
f28969f
SourceFormatter - Sort
hhuijser Mar 29, 2013
3dd2e89
Source formatting - remove redundant parentheses
hhuijser Mar 29, 2013
efb12db
LPS-32110 Add macro.ftl.
tinatian Mar 29, 2013
7688f5b
LPS-32110 Add macro method, insertAssetEntry.
tinatian Mar 29, 2013
cec2880
LPS-32110 Add macro method, insertDDMStructureLink.
tinatian Mar 29, 2013
67b4817
LPS-32110 Add macro method, insertDLSync.
tinatian Mar 29, 2013
cc643b4
LPS-32110 Add macro method, insertDDMContent.
tinatian Mar 29, 2013
1993772
LPS-32110 Add macro method, insertPortletPreferences.
tinatian Mar 29, 2013
a99c176
LPS-32110 Add macro method, insertSocialActivity.
tinatian Mar 29, 2013
d563c21
LPS-32110 SF
brianchandotcom Mar 29, 2013
a6e6bcb
LPS-34086 - Paths
kiyoshilee Mar 27, 2013
1557fdb
LPS-34086 - Actions
kiyoshilee Mar 29, 2013
771f723
LPS-34086 - Macros
kiyoshilee Mar 29, 2013
c7e1597
LPS-34086 - Tests
kiyoshilee Mar 29, 2013
7be6596
LPS-34086 - Test Formatting
michaelhashimoto Mar 29, 2013
3fbec83
LPS-33959 - Add Else/If/Then page object unit tests
michaelhashimoto Mar 29, 2013
d86910c
LPS-33959 - Fix all name attributes
michaelhashimoto Mar 29, 2013
c09e101
LPS-34088 - Paths
kiyoshilee Mar 29, 2013
a234ebf
LPS-34088 - Paths
michaelhashimoto Mar 29, 2013
b985ff6
LPS-33959 - Add Function Condition page object unit tests
michaelhashimoto Mar 30, 2013
77f8f85
LPS-34059
catherine-lui Mar 28, 2013
863f127
LPS-34059
michaelhashimoto Mar 29, 2013
0a25dc4
Test Fixes - portal/selenium
michaelhashimoto Mar 29, 2013
2f6d52b
LPS-34059 SF
brianchandotcom Mar 31, 2013
60ee426
LPS-33799 - Add support for Velocity hints on creating templates
ipeychev Apr 1, 2013
6a3bdd2
LPS-33799 Add support for the palette
Apr 1, 2013
5635613
LPS-33799 - Source formatting
ipeychev Apr 1, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -378,7 +378,7 @@ public Image getImage(InputStream is, boolean cleanUpStream)

public boolean isNullOrDefaultSpacer(byte[] bytes) {
if ((bytes == null) || (bytes.length == 0) ||
(Arrays.equals(bytes, getDefaultSpacer().getTextObj()))) {
Arrays.equals(bytes, getDefaultSpacer().getTextObj())) {

return true;
}
Expand Down
Expand Up @@ -27,7 +27,7 @@ public TicketImpl() {
public boolean isExpired() {
Date expirationDate = getExpirationDate();

if ((expirationDate != null) && (expirationDate.before(new Date()))) {
if ((expirationDate != null) && expirationDate.before(new Date())) {
return true;
}
else {
Expand Down
Expand Up @@ -157,7 +157,7 @@ public String getType() {
public boolean implies(
ProtectionDomain protectionDomain, Permission permission) {

if ((!(permission instanceof PACLUtil.Permission)) &&
if (!(permission instanceof PACLUtil.Permission) &&
((protectionDomain.getClassLoader() == null) ||
!PACLPolicyManager.isActive() ||
!_paclPolicy.isCheckablePermission(permission))) {
Expand Down
Expand Up @@ -224,8 +224,8 @@ public void deleteUserGroupRoles(long[] userIds, long groupId, long roleId)
}
}
else if ((role.getType() == RoleConstants.TYPE_SITE) &&
(!SiteMembershipPolicyUtil.isRoleProtected(
getPermissionChecker(), userId, groupId, roleId))) {
!SiteMembershipPolicyUtil.isRoleProtected(
getPermissionChecker(), userId, groupId, roleId)) {

filteredUserGroupRoles.add(userGroupRole);
}
Expand Down
Expand Up @@ -2241,12 +2241,12 @@ protected long[] checkOrganizations(long userId, long[] organizationIds)
organizationIds, organization.getOrganizationId()) &&
(!OrganizationPermissionUtil.contains(
permissionChecker, organization.getOrganizationId(),
ActionKeys.ASSIGN_MEMBERS)) ||
OrganizationMembershipPolicyUtil.isMembershipProtected(
ActionKeys.ASSIGN_MEMBERS) ||
OrganizationMembershipPolicyUtil.isMembershipProtected(
permissionChecker, userId,
organization.getOrganizationId()) ||
OrganizationMembershipPolicyUtil.isMembershipRequired(
userId, organization.getOrganizationId())) {
OrganizationMembershipPolicyUtil.isMembershipRequired(
userId, organization.getOrganizationId()))) {

organizationIds = ArrayUtil.append(
organizationIds, organization.getOrganizationId());
Expand Down Expand Up @@ -2299,9 +2299,9 @@ protected long[] checkRoles(long userId, long[] roleIds)
if (!ArrayUtil.contains(roleIds, role.getRoleId()) &&
(!RolePermissionUtil.contains(
permissionChecker, role.getRoleId(),
ActionKeys.ASSIGN_MEMBERS)) ||
ActionKeys.ASSIGN_MEMBERS) ||
RoleMembershipPolicyUtil.isRoleRequired(
userId, role.getRoleId())) {
userId, role.getRoleId()))) {

roleIds = ArrayUtil.append(roleIds, role.getRoleId());
}
Expand Down
Expand Up @@ -887,6 +887,7 @@ else if (param1.equals("captureEntirePageScreenshot")) {
else if (param1.equals("check") || param1.equals("click") ||
param1.equals("doubleClick") ||
param1.equals("downloadTempFile") ||
param1.equals("makeVisible") ||
param1.equals("mouseDown") || param1.equals("mouseMove") ||
param1.equals("mouseOver") || param1.equals("mouseUp") ||
param1.equals("open") || param1.equals("selectFrame") ||
Expand Down
97 changes: 65 additions & 32 deletions portal-impl/src/com/liferay/portal/tools/SourceFormatter.java
Expand Up @@ -477,7 +477,12 @@ private static void _checkIfClause(
String s = ifClause.substring(
previousParenthesisPos + 1, i);

_checkMissingParentheses(s, fileName, lineCount);
if (_hasMissingParentheses(s)) {
_processErrorMessage(
fileName,
"missing parentheses: " + fileName + " " +
lineCount);
}
}

previousParenthesisPos = i;
Expand All @@ -502,9 +507,7 @@ private static void _checkIfClause(
String s = ifClause.substring(
posOpenParenthesis + 1, i);

if (Validator.isNotNull(s) &&
!s.contains(StringPool.SPACE)) {

if (_hasRedundantParentheses(s)) {
_processErrorMessage(
fileName,
"redundant parentheses: " + fileName + " " +
Expand Down Expand Up @@ -578,34 +581,6 @@ private static void _checkLanguageKeys(
}
}

private static void _checkMissingParentheses(
String s, String fileName, int lineCount) {

if (Validator.isNull(s)) {
return;
}

boolean containsAndOrOperator = (s.contains("&&") || s.contains("||"));

boolean containsCompareOperator =
(s.contains(" == ") || s.contains(" != ") || s.contains(" < ") ||
s.contains(" > ") || s.contains(" =< ") || s.contains(" => ") ||
s.contains(" <= ") || s.contains(" >= "));

boolean containsMathOperator =
(s.contains(" = ") || s.contains(" - ") || s.contains(" + ") ||
s.contains(" & ") || s.contains(" % ") || s.contains(" * ") ||
s.contains(" / "));

if (containsCompareOperator &&
(containsAndOrOperator ||
(containsMathOperator && !s.contains(StringPool.OPEN_BRACKET)))) {

_processErrorMessage(
fileName, "missing parentheses: " + fileName + " " + lineCount);
}
}

private static boolean _checkTaglibVulnerability(
String jspContent, String vulnerability) {

Expand Down Expand Up @@ -4252,6 +4227,64 @@ private static boolean _hasAnnotationOrJavadoc(String s) {
}
}

private static boolean _hasMissingParentheses(String s) {
if (Validator.isNull(s)) {
return false;
}

boolean containsAndOrOperator = (s.contains("&&") || s.contains("||"));

boolean containsCompareOperator =
(s.contains(" == ") || s.contains(" != ") || s.contains(" < ") ||
s.contains(" > ") || s.contains(" =< ") || s.contains(" => ") ||
s.contains(" <= ") || s.contains(" >= "));

boolean containsMathOperator =
(s.contains(" = ") || s.contains(" - ") || s.contains(" + ") ||
s.contains(" & ") || s.contains(" % ") || s.contains(" * ") ||
s.contains(" / "));

if (containsCompareOperator &&
(containsAndOrOperator ||
(containsMathOperator && !s.contains(StringPool.OPEN_BRACKET)))) {

return true;
}
else {
return false;
}
}

private static boolean _hasRedundantParentheses(String s) {
if (!s.contains("&&") && !s.contains("||")) {
for (int x = 0;;) {
x = s.indexOf(StringPool.CLOSE_PARENTHESIS);

if (x == -1) {
break;
}

int y = s.substring(0, x).lastIndexOf(
StringPool.OPEN_PARENTHESIS);

if (y == -1) {
break;
}

s = s.substring(0, y) + s.substring(x + 1);
}
}

if (Validator.isNotNull(s) &&
!s.contains(StringPool.SPACE)) {

return true;
}
else {
return false;
}
}

private static boolean _isGenerated(String content) {
if (content.contains("* @generated") || content.contains("$ANTLR")) {
return true;
Expand Down
Expand Up @@ -769,12 +769,12 @@ public DDMContent newDDMContent(DLFileEntry dlFileEntry) {
}

public DDMStorageLink newDDMStorageLink(
DDMContent ddmContent, long structureId) {
long ddmStorageLinkId, DDMContent ddmContent, long structureId) {

DDMStorageLink ddmStorageLink = new DDMStorageLinkImpl();

ddmStorageLink.setUuid(SequentialUUID.generate());
ddmStorageLink.setStorageLinkId(_counter.get());
ddmStorageLink.setStorageLinkId(ddmStorageLinkId);
ddmStorageLink.setClassNameId(
_classNamesMap.get(DDMContent.class.getName()));
ddmStorageLink.setClassPK(ddmContent.getContentId());
Expand Down Expand Up @@ -826,14 +826,15 @@ public DLFileEntry newDlFileEntry(DLFolder dlFoler, int index) {
}

public DLFileEntryMetadata newDLFileEntryMetadata(
DDMStorageLink ddmStorageLink, DLFileVersion dlFileVersion) {
long ddmStorageLinkId, long ddmStructureId,
DLFileVersion dlFileVersion) {

DLFileEntryMetadata dlFileEntryMetadata = new DLFileEntryMetadataImpl();

dlFileEntryMetadata.setUuid(SequentialUUID.generate());
dlFileEntryMetadata.setFileEntryMetadataId(_counter.get());
dlFileEntryMetadata.setDDMStorageId(ddmStorageLink.getPrimaryKey());
dlFileEntryMetadata.setDDMStructureId(ddmStorageLink.getStructureId());
dlFileEntryMetadata.setDDMStorageId(ddmStorageLinkId);
dlFileEntryMetadata.setDDMStructureId(ddmStructureId);
dlFileEntryMetadata.setFileEntryTypeId(
dlFileVersion.getFileEntryTypeId());
dlFileEntryMetadata.setFileEntryId(dlFileVersion.getFileEntryId());
Expand Down
Expand Up @@ -35,13 +35,9 @@
import com.liferay.portal.model.User;
import com.liferay.portal.tools.ArgumentsUtil;
import com.liferay.portal.util.InitUtil;
import com.liferay.portlet.blogs.model.BlogsEntry;
import com.liferay.portlet.documentlibrary.model.DLFileEntry;
import com.liferay.portlet.documentlibrary.model.DLFolder;
import com.liferay.portlet.dynamicdatalists.model.DDLRecord;
import com.liferay.portlet.messageboards.model.MBCategory;
import com.liferay.portlet.messageboards.model.MBMessage;
import com.liferay.portlet.wiki.model.WikiPage;

import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -198,14 +194,6 @@ public SampleSQLBuilder(Map<String, String> arguments) throws Exception {
sb.toString());
}

public void insertBlogsEntry(BlogsEntry blogsEntry) throws Exception {
Map<String, Object> context = getContext();

put(context, "blogsEntry", blogsEntry);

processTemplate(_tplBlogsEntry, context);
}

public void insertDDLRecord(
DDLRecord ddlRecord, int ddlRecordCount, long ddmStructureId)
throws Exception {
Expand All @@ -230,17 +218,6 @@ public void insertDLFileEntry(DLFileEntry dlFileEntry, long ddmStructureId)
processTemplate(_tplDLFileEntry, context);
}

public void insertDLFolder(DLFolder dlFolder, long ddmStructureId)
throws Exception {

Map<String, Object> context = getContext();

put(context, "ddmStructureId", ddmStructureId);
put(context, "dlFolder", dlFolder);

processTemplate(_tplDLFolder, context);
}

public void insertDLFolders(
long groupId, long parentDLFolderId, int dlFolderDepth,
long ddmStructureId)
Expand Down Expand Up @@ -273,14 +250,6 @@ public void insertLayout(Layout layout) throws Exception {
processTemplate(_tplLayout, context);
}

public void insertMBCategory(MBCategory mbCategory) throws Exception {
Map<String, Object> context = getContext();

put(context, "mbCategory", mbCategory);

processTemplate(_tplMBCategory, context);
}

public void insertMBDiscussion(
long groupId, long classNameId, long classPK, long mbThreadId,
long mbRootMessageId, int maxCommentCount)
Expand Down Expand Up @@ -329,14 +298,6 @@ public void insertUser(List<Long> groupIds, List<Role> roleIds, User user)
processTemplate(_tplUser, context);
}

public void insertWikiPage(WikiPage wikiPage) throws Exception {
Map<String, Object> context = getContext();

put(context, "wikiPage", wikiPage);

processTemplate(_tplWikiPage, context);
}

protected void compressInsertSQL(String insertSQL) throws IOException {
String tableName = insertSQL.substring(0, insertSQL.indexOf(' '));

Expand Down Expand Up @@ -660,21 +621,17 @@ protected void writeToInsertSQLFile(String tableName, String sql)
private String _outputDir;
private boolean _outputMerge;
private File _tempDir;
private String _tplBlogsEntry = _TPL_ROOT + "blogs_entry.ftl";
private String _tplDDLRecord = _TPL_ROOT + "ddl_record.ftl";
private String _tplDLFileEntry = _TPL_ROOT + "dl_file_entry.ftl";
private String _tplDLFolder = _TPL_ROOT + "dl_folder.ftl";
private String _tplDLFolders = _TPL_ROOT + "dl_folders.ftl";
private String _tplGroup = _TPL_ROOT + "group.ftl";
private String _tplLayout = _TPL_ROOT + "layout.ftl";
private String _tplMBCategory = _TPL_ROOT + "mb_category.ftl";
private String _tplMBDiscussion = _TPL_ROOT + "mb_discussion.ftl";
private String _tplMBMessage = _TPL_ROOT + "mb_message.ftl";;
private String _tplResourcePermission =
_TPL_ROOT + "resource_permission.ftl";
private String _tplSample = _TPL_ROOT + "sample.ftl";
private String _tplUser = _TPL_ROOT + "user.ftl";
private String _tplWikiPage = _TPL_ROOT + "wiki_page.ftl";
private Writer _writerBlogsCSV;
private Writer _writerCompanyCSV;
private Writer _writerDocumentLibraryCSV;
Expand Down
Expand Up @@ -2,7 +2,9 @@
<#list 1..maxBlogsEntryCount as blogsEntryCount>
<#assign blogsEntry = dataFactory.newBlogsEntry(groupId, blogsEntryCount)>

${sampleSQLBuilder.insertBlogsEntry(blogsEntry)}
insert into BlogsEntry values ('${blogsEntry.uuid}', ${blogsEntry.entryId}, ${blogsEntry.groupId}, ${blogsEntry.companyId}, ${blogsEntry.userId}, '${blogsEntry.userName}', '${dataFactory.getDateString(blogsEntry.createDate)}', '${dataFactory.getDateString(blogsEntry.modifiedDate)}', '${blogsEntry.title}', '${blogsEntry.urlTitle}', '${blogsEntry.description}', '${blogsEntry.content}', '${dataFactory.getDateString(blogsEntry.displayDate)}', ${blogsEntry.allowPingbacks?string}, ${blogsEntry.allowTrackbacks?string}, '${blogsEntry.trackbacks}', ${blogsEntry.smallImage?string}, ${blogsEntry.smallImageId}, '${blogsEntry.smallImageURL}', ${blogsEntry.status}, ${blogsEntry.statusByUserId}, '${blogsEntry.statusByUserName}', '${dataFactory.getDateString(blogsEntry.statusDate)}');

<@insertAssetEntry _entry = blogsEntry />

<#assign mbThreadId = counter.get()>
<#assign mbRootMessageId = counter.get()>
Expand Down

This file was deleted.

@@ -1,5 +1,3 @@
<#setting number_format = "0">

<#list dataFactory.classNames as className>
insert into ClassName_ values (${className.classNameId}, '${className.value}');
</#list>
@@ -1,5 +1,3 @@
<#setting number_format = "0">

<#assign company = dataFactory.company>

insert into Company values (${company.companyId}, ${company.accountId}, '${company.webId}', '${company.key}', '${company.mx}', '${company.homeURL}', ${company.logoId}, ${company.system?string}, ${company.maxUsers}, ${company.active?string});
Expand Down
@@ -1,5 +1,3 @@
<#setting number_format = "0">

<#assign counters = dataFactory.newCounters()>

<#list counters as counter>
Expand Down