Author: chris.laprun(a)jboss.com
Date: 2009-07-21 17:54:36 -0400 (Tue, 21 Jul 2009)
New Revision: 13572
Modified:
branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
Log:
- JBPORTAL-2415: properly handle the empty search string (it really should be done at the
search level though).
Modified:
branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
---
branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-07-21
21:52:12 UTC (rev 13571)
+++
branches/Enterprise_Portal_Platform_4_3/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-07-21
21:54:36 UTC (rev 13572)
@@ -82,6 +82,7 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
@@ -439,26 +440,27 @@
rRes.setContentType("text/html");
String textQuery = rReq.getParameter("search");
- FederatedQuery query = new FederatedQuery(textQuery);
+ List files = Collections.emptyList();
+ if (!ParameterValidation.isNullOrEmpty(textQuery))
+ {
+ FederatedQuery query = new FederatedQuery(textQuery);
- JCRQueryConverter converter = new JCRQueryConverter();
+ JCRQueryConverter converter = new JCRQueryConverter();
- List files;
- try
- {
- Command searchCommand =
CMSService.getCommandFactory().createSearchCommand((JCRQuery)converter.convert(query));
- files = (List)CMSService.execute(searchCommand);
+ try
+ {
+ Command searchCommand =
CMSService.getCommandFactory().createSearchCommand((JCRQuery)converter.convert(query));
+ files = (List)CMSService.execute(searchCommand);
+ }
+ catch (CMSException e)
+ {
+ e.printStackTrace();
+ }
+ catch (QueryConversionException e)
+ {
+ rReq.setAttribute("conversionError", Boolean.TRUE);
+ }
}
- catch (CMSException e)
- {
- e.printStackTrace();
- files = new ArrayList();
- }
- catch (QueryConversionException e)
- {
- files = new ArrayList();
- rReq.setAttribute("conversionError", Boolean.TRUE);
- }
rReq.setAttribute("files", files);
rReq.setAttribute("textQuery", textQuery);
@@ -1508,25 +1510,27 @@
// check title and description for XSS injection... If one found,
re-display page with old values
sTitle = ParameterValidation.sanitizeFromPattern(sTitle,
CHECK_FOR_XSS_PATTERN, INVALID_TITLE);
boolean invalidTitle = INVALID_TITLE.equals(sTitle);
-
+
sDescription = ParameterValidation.sanitizeFromPattern(sDescription,
CHECK_FOR_XSS_PATTERN, INVALID_DESCRIPTION);
boolean invalidDesc = INVALID_DESCRIPTION.equals(sDescription);
sLanguage = ParameterValidation.sanitizeFromPattern(sLanguage,
CHECK_FOR_XSS_PATTERN, INVALID_LANG);
boolean invalidLang = INVALID_LANG.equals(sLanguage);
- if(invalidLang)
+ if (invalidLang)
- if (invalidTitle || invalidDesc || invalidLang)
{
- aRes.setRenderParameter("op", CMSAdminConstants.OP_EDIT);
+ if (invalidTitle || invalidDesc || invalidLang)
+ {
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_EDIT);
- // output error message
- aRes.setRenderParameter(ERROR_MESSAGE,
CMSAdminConstants.CMS_INVALID_PARAMETER);
+ // output error message
+ aRes.setRenderParameter(ERROR_MESSAGE,
CMSAdminConstants.CMS_INVALID_PARAMETER);
- aRes.setRenderParameter("path",
aReq.getParameter("savetopath"));
- aRes.setRenderParameter("language",
aReq.getParameter("language"));
+ aRes.setRenderParameter("path",
aReq.getParameter("savetopath"));
+ aRes.setRenderParameter("language",
aReq.getParameter("language"));
- return;
+ return;
+ }
}
Locale locale = new Locale(sLanguage);
Show replies by date