[magnolia-dev] [JIRA] (MGNLUI-3100) AdminCentral SearchJcrContainer: Using characters ( { [ ''' crashes the AdminCentral

2014-08-18 Thread JIRA (on behalf of Federico Grilli)














































Federico Grilli
 updated  MGNLUI-3100


AdminCentral  SearchJcrContainer: Using characters ( { [  crashes the AdminCentral
















Change By:


Federico Grilli
(18/Aug/14 12:43 PM)




Fix Version/s:


5.2.9





Fix Version/s:


5.3.3



























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira








Forlistdetails,see:http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively,useourforums:http://forum.magnolia-cms.com/
Tounsubscribe,E-mailto:dev-list-unsubscr...@magnolia-cms.com





[magnolia-dev] [JIRA] (MGNLUI-3100) AdminCentral SearchJcrContainer: Using characters ( { [ ''' crashes the AdminCentral

2014-08-13 Thread JIRA (on behalf of Christian Ringele)














































Christian Ringele
 created  MGNLUI-3100


AdminCentral  SearchJcrContainer: Using characters ( { [  crashes the AdminCentral















Issue Type:


Bug



Affects Versions:


5.3.2, 5.2.8



Assignee:


Unassigned


Components:


workbench



Created:


13/Aug/14 4:58 PM



Description:


This happens only on the fist search dropped after opening an app using the SearchJcrContainer (content apps in the workbench).

Reproduce crash:

	Open for example the contacts app
	enter one if these search terms:


(
{
[
'''
anythingAnd(inbetween





No crash when:

	Open app
	enter valid search term
	removing the term using the  at the right of the search field
	drop one of the characters that don't work in first search



Errors:
The initial Error:


Aug 13, 2014 4:35:10 PM com.vaadin.server.DefaultErrorHandler doDefault
SEVERE: 
java.lang.RuntimeException: Unable to get item id for index: 0 from container using Container.Indexed#getIdByIndex() even though container.size()  endIndex. Returned item id was null. Check your container implementation!
	at com.vaadin.data.ContainerHelpers.getItemIdsUsingGetIdByIndex(ContainerHelpers.java:90)
	at info.magnolia.ui.workbench.container.AbstractJcrContainer.getItemIds(AbstractJcrContainer.java:676)
	at com.vaadin.ui.Table.getItemIds(Table.java:2219)
	at com.vaadin.ui.Table.getVisibleCellsNoCache(Table.java:2169)
	at com.vaadin.ui.Table.refreshRenderedCells(Table.java:1694)
	at com.vaadin.ui.Table.getVisibleCells(Table.java:3960)


Happens when the calls "ContainerHelpers.getItemIdsUsingGetIdByIndex(startIndex, numberOfItems, this);" which calls on the used container the method getIdByIndex(int):


info.magnolia.ui.workbench.container.AbstractJcrContainer.getIdByIndex(int)



The system complaints about illegal characters used for the full text search:


2014-08-13 16:08:05,914 WARN  gnolia.ui.workbench.container.AbstractJcrContainer: Could not update size with statement: select * from [nt:base] as t where (([jcr:primaryType] = 'mgnl:contact' or [jcr:primaryType] = 'mgnl:folder') and (lower(localname()) LIKE '(%' or t.['('] IS NOT NULL or contains(t.*, '(')) ): javax.jcr.RepositoryException: Invalid full text search _expression_: (
2014-08-13 16:08:19,833 WARN  gnolia.ui.workbench.container.AbstractJcrContainer: Cannot get Page with statement: select * from [nt:base] as t where (([jcr:primaryType] = 'mgnl:contact' or [jcr:primaryType] = 'mgnl:folder') and (lower(localname()) LIKE '(%' or t.['('] IS NOT NULL or contains(t.*, '(')) ) order by score(t) desc: javax.jcr.RepositoryException: Invalid full text search _expression_: (




Looked into:
First I suspected this method:

info.magnolia.ui.workbench.search.SearchJcrContainer.escapeIllegalFullTextSearchChars(String)

 as it uses the variable 

private static final String illegalFullTextChars = "-+)\"\\";

 to determine the invalid characters.

Then I checked the method:
info.magnolia.ui.workbench.search.SearchJcrContainer.getQueryWhereClauseSearch()
Where the 

 final String escapedSearch = Text.escapeIllegalJcrChars(unescapedFullTextExpression);

 is already using the Text.escapeIllegalJcrChars to remove illegal characters.

But all this can't be the full source of the problem, because this does not explain why it only doesn't work as a first dropped search. If the excaping alone would be the problem, then it would never work.

What surprises is:
If changing in the method "info.magnolia.ui.workbench.search.SearchJcrContainer.getQueryWhereClauseSearch()"
just for testing the 

final String unescapedFullTextExpression = getFullTextExpression();

 by 

final String unescapedFullTextExpression = "\\(";

 it works perfectly.




Project:


Magnolia UI



Labels:


support




Priority:


Neutral