Author: thomas.heute(a)jboss.com
Date: 2008-06-25 11:34:41 -0400 (Wed, 25 Jun 2008)
New Revision: 11144
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp
branches/JBoss_Portal_Branch_2_7/search/src/main/org/jboss/portal/search/impl/jcr/JCRQueryConverter.java
Log:
JBPORTAL-2053: CMS Search fails when a Lucene syntax is entered but not understood by the
converter
Propagate the error in a clean manner to the user interface
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-06-25
14:48:07 UTC (rev 11143)
+++
branches/JBoss_Portal_Branch_2_7/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-06-25
15:34:41 UTC (rev 11144)
@@ -55,6 +55,7 @@
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.search.FederatedQuery;
+import org.jboss.portal.search.QueryConversionException;
import org.jboss.portal.search.impl.jcr.JCRQuery;
import org.jboss.portal.search.impl.jcr.JCRQueryConverter;
import org.jboss.portal.security.PortalPermission;
@@ -350,6 +351,11 @@
e.printStackTrace();
files = new ArrayList();
}
+ catch (QueryConversionException e)
+ {
+ files = new ArrayList();
+ rReq.setAttribute("conversionError", Boolean.TRUE);
+ }
rReq.setAttribute("files", files);
rReq.setAttribute("textQuery", textQuery);
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-06-25
14:48:07 UTC (rev 11143)
+++
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-06-25
15:34:41 UTC (rev 11144)
@@ -121,4 +121,6 @@
CMS_HELP=The CMS Portlet displays content from the file store inside a portlet window,
or, in the case of binary content, outside of the portlet window altogether
CMS_TO_MODIFY=To modify how this portlet behaves, please
CMS_CLICK_HERE=click here
-CMS_SELECT_ACTION=Select Action
\ No newline at end of file
+CMS_SELECT_ACTION=Select Action
+
+CMS_QUERYERROR=The query you entered is not valid
\ No newline at end of file
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp 2008-06-25
14:48:07 UTC (rev 11143)
+++
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp 2008-06-25
15:34:41 UTC (rev 11144)
@@ -43,8 +43,16 @@
</form>
</div>
+<%
+Boolean error = (Boolean)request.getAttribute("conversionError");
+if (error != null && error)
+{
+%>
+<div class="portlet-msg-error">${n:i18n("CMS_QUERYERROR")}:
<%= request.getAttribute("textQuery") %></div>
<%
+}
+
List files = (List)request.getAttribute("files");
String createDate = "";
String modifiedDate = "";
Modified:
branches/JBoss_Portal_Branch_2_7/search/src/main/org/jboss/portal/search/impl/jcr/JCRQueryConverter.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/search/src/main/org/jboss/portal/search/impl/jcr/JCRQueryConverter.java 2008-06-25
14:48:07 UTC (rev 11143)
+++
branches/JBoss_Portal_Branch_2_7/search/src/main/org/jboss/portal/search/impl/jcr/JCRQueryConverter.java 2008-06-25
15:34:41 UTC (rev 11144)
@@ -35,7 +35,7 @@
public class JCRQueryConverter extends AbstractQueryConverter
{
- public Query convert(FederatedQuery query)
+ public Query convert(FederatedQuery query) throws QueryConversionException
{
if (query == null)
{
@@ -43,18 +43,12 @@
}
StringBuffer result = new StringBuffer();
result.append("//*[");
- try
- {
- if (super.convert(query) != null)
- {
- result.append(((JCRQuery)super.convert(query)).getJcrQuery());
- }
- }
- catch (QueryConversionException e)
+ if (super.convert(query) != null)
{
- e.printStackTrace();
+ result.append(((JCRQuery)super.convert(query)).getJcrQuery());
}
+
result.append("]");
return new JCRQuery(result.toString());
}
Show replies by date