#36 java.util.regex

closed
5
2009-01-17
2009-01-17
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

  • Sebastián Gurin

    File Added: StringUtils.java

     
  • Sebastián Gurin

    File Added: StringUtils.java

     
  • Sebastián Gurin

    • status: open --> closed
     
  • Sebastián Gurin

    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...

     
  • Sebastián Gurin

    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...

     
  • Sebastián Gurin

    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...

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks