Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    regExpValidator hanging for text item widget

    Dear Isomorphic Support:

    I'm attempting to implement a simple domain validator for a domain text item field. Everything seems to work fine
    when the domain string is small (10 characters). However, when entering longer domain names, the regExpValidator seems
    to be hanging and I get script not responding errors on IE. The details are below:


    Product: SmartGWT 3.0p nightly build Nov 15, 2012
    Browser: IE 9

    Sample code:


    Code:
            DynamicForm domainForm = new DynamicForm();
            domain = new TextItem();
            domain.setTitle(langConstants.domain());
            domain.setLength(255);
            domain.setWidth(200);        
            RegExpValidator regExpValidator = new RegExpValidator();
            regExpValidator.setExpression("(?=^.{1,254}$)(^(?:(?!\\d+\\.)[a-zA-Z0-9_\\-]{1,63}\\.?)+(?:[a-zA-Z]{1,})$)");
            regExpValidator.setErrorMessage(langConstants.domainError());
            regExpValidator.setValidateOnChange(true);
            regExpValidator.setStopOnError(true);
            domain.setValidators(regExpValidator);
            domain.setRequired(true);
    I also from the DyanmicForm as part of a window widget.

    Reproduction: I started entering the characters below (slowly one at a time) and when I got up to the last character, the
    SmartGWT client framework started to slow down and became unresponsive. I am also doing the reproduction in Eclipse debugging
    (shouldn't matter though since I have done validation like this in raw GWT in previous projects and have not had an issue).

    domain string entered:

    01234567890123456789012345

    Best Regards, T.

    #2
    Presumably you've seen this in GWT development mode only. Development mode can be as much as 100x or more slower than compiled mode. Let us know if you see any similar issue in compiled mode.

    Comment


      #3
      This happens on compiled code also.

      Comment


        #4
        What we see with your example when using IE profiling is a single call to IE's native regexp.test function that takes hundreds of seconds or more to execute.

        So, it looks like the issue is with the IE's regexp engine, which is beyond our control. Perhaps the regexp can be simplified and still do it's job?

        Comment


          #5
          Does the SmartGWT code compile regexp differently than raw GWT? The regexp has no issues in one of our previous raw GWT project that we have in production.

          The pattern we use in the raw GWT code:

          RegExp regExp = RegExp.compile(regExpString);

          MatchResult matcher = regExp.exec(source);
          if (matcher == null) {
          error = errorMessage;
          } else {
          error = "";
          }

          and it is lightning quick with no issues.

          If it is indeed not fixable with a SmartGWT project, I will look for a different regular expression.

          T.

          Comment


            #6
            No, both systems are simply calling a native JavaScript API provided by the browser. There is no compilation of the regexp itself.

            If it's performing acceptably in another scenario, either the data is different or the regexp is different in that other scenario.

            Comment

            Working...
            X