SonarQube 5.2 Rest API: Can not search for groups that contain undersores

78 views
Skip to first unread message

Michael Binder

unread,
Dec 18, 2015, 3:35:23 AM12/18/15
to SonarQube
Hi,

I am using the SonarQube 5.2 Rest API to create and query groups. My group names contain underscores e.g. "my_group".
A call to "/api/user_groups/search" finds this group. A call to "/api/user_groups/search?q=my_group" returns zero groups.

I traced the call in the sonarqube sources.
The GroupDao seems to escape undersores in the query. But the GroupMapper.xml does not declare an escape character in the query.

Possible solution:
Add "ESCAPE '/'" to the query. See also the correct implementation in GroupMembershipMapper.xml. Maybe this is an issue for other like queries.

suggestion for changes in GroupMapper.xml:
  <select id="selectByQuery" parameterType="map" resultType="Group">
    SELECT
   
<include refid="groupColumns"/>
    FROM groups g
    WHERE UPPER(g.name) LIKE #{query} ESCAPE '/'
    ORDER BY UPPER(g.name)
 
</select>

Please fix this bug.

Thank You!

Michael

Teryk Bellahsene

unread,
Dec 23, 2015, 4:55:18 AM12/23/15
to SonarQube, michaelix...@gmail.com
Hi,

Thanks a lot for the investigation! I confirm the bug.
Jira ticket created: https://jira.sonarsource.com/browse/SONAR-7163
It should be fixed in 5.3, out in January.

Sincerely,

Teryk

liudo...@gmail.com

unread,
Dec 24, 2015, 10:07:07 AM12/24/15
to SonarQube, michaelix...@gmail.com
Hi Teryk,

Here is the similar issue for api/users/search, if the logins parameter has unicode char or special char(eg. underscore, space), it will report error.

Thanks very much,
Dongshan


在 2015年12月23日星期三 UTC+8下午5:55:18,Teryk Bellahsene写道:

michaelix...@gmail.com

unread,
Jan 11, 2016, 7:45:19 AM1/11/16
to SonarQube, michaelix...@gmail.com
Hi,

tested with SonarQube 5.3. I can confirm this is fixed.

Thanks for the fast fix!
Reply all
Reply to author
Forward
0 new messages