dandelion / dandelion-datatables

Dandelion component for DataTables
http://dandelion.github.io/components/datatables/
Other
110 stars 49 forks source link

[CLOSED] Erroneous regex match in Utils.java #178

Closed tduchateau closed 10 years ago

tduchateau commented 10 years ago

Issue by gorder from Monday Jul 22, 2013 at 18:56 GMT


This one cost me a bit of time tracking down :)

Basically what happens is this. If I define a table that looks like the one I defined below, the optionListHtml property does not render. This is due to the fact that the regex on line 170 of Utils.java erroneously matches that String and performs a toLowerCase() on it causing datatables to not be able to match it as it is looking for optionListHtml not optionlisthtml.

// Handling null value
        if (value == null) return defaultValue;

        if (stringRegex.matcher(value.trim().toLowerCase()).find()) return value.trim().toLowerCase();  //This matches but it should not match just because I use Html in my property name

        // Default behaviour
        return processStandardExpression(arguments, value, defaultValue, clazz);
table class="table table-striped table-bordered" id="plans"
                        dt:table="true" dt:theme="bootstrap2" dt:dom="#{dashboard.dt.button.row}" dt:url="@{/dashboard}" dt:serverside="true" dt:processing="true">
                        <thead>
                            <tr>
                                <th dt:property="'id'">id</th>
                                <th dt:property="'overview.name'">Plan Name</th>
                                <th dt:property="'status'">Status</th>
                                <th dt:property="'assignedTo.fullName'">Reviewer</th>
                                <th dt:property="'checkedOutTo.fullName'">Checked Out By</th>
                                <th dt:property="'lastCheckInDate'">Last Check In</th>
                                <th dt:property="'lastModifiedBy.fullName'">Last Edited By</th>
                                <th dt:property="'optionListHtml'">Test</th>
                            </tr>
                        </thead>
                    </table>
tduchateau commented 10 years ago

Comment by tduchateau from Monday Jul 22, 2013 at 21:25 GMT

Wow! Thanks! Two comments:

The moral being: OSS rocks :metal:

tduchateau commented 10 years ago

Comment by Jdourd from Monday Jul 22, 2013 at 21:30 GMT

Ah les boulets, on a oublié les parenthèses :o

stringRegexBuilder.append("^").append('('); ... stringRegexBuilder.append(')').append("$");

En toute logique, ca corrige le soucis de la regex... !

2013/7/22 Thibault Duchateau notifications@github.com

Wow! Thanks! Two comments:

  • indded, it must have been quite a challenge to find this out!
  • I never thought I would experience this kind of issue :-)

The moral being: OSS rocks [image: :metal:]

— Reply to this email directly or view it on GitHubhttps://github.com/dandelion/issues/issues/152#issuecomment-21376975 .

tduchateau commented 10 years ago

Comment by tduchateau from Monday Jul 22, 2013 at 21:44 GMT

@Jdourd :-)

tduchateau commented 10 years ago

Comment by tduchateau from Monday Jul 22, 2013 at 22:02 GMT

https://dandelion.ci.cloudbees.com/job/dandelion-datatables-build/189/console :-(