Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#36 java.util.regex

closed
Josson Smith
5
2009-01-17
2009-01-17
Sebastián Gurin
No

the attached small java program won't work. I figure out the error: it is in java.util.regex.Matcher, and it is fixable changin only one line.

Matcher(Pattern pat, CharSequence cs) {
...
this.string = cs;
this.leftBound = 0;
this.rightBound = string.length(); <---- here

it seems that CharSequences are normal strings in javascript. And since the line is translated to

this.rightBound = this.string.length()

instead of

this.rightBound = this.string.length

it will fail with error "this.string has no length() function"

I'm sending a patch that I thing won't affect performance or behavior.

Discussion

  •  
    Attachments
  • File Added: StringUtils.java

     
  • the failing test

     
    Attachments
  • File Added: StringUtils.java

     
  • the failing test

     
    Attachments
    • status: open --> closed
     
  • patch applied in trunk/sources/net.sf.j2s.java.core
    is this action right? I mean is this the correct source directory for applying this kind of patches?
    i'm kind of newbie with svn...

     
  • patch applied in trunk/sources/net.sf.j2s.java.core
    is this action right? I mean is this the correct source directory for applying this kind of patches?
    i'm kind of newbie with svn...

     
  • patch applied in trunk/sources/net.sf.j2s.java.core
    is this action right? I mean is this the correct source directory for applying this kind of patches?
    i'm kind of newbie with svn...