You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-dev@jakarta.apache.org by jeff <jl...@houseofdistraction.com> on 2000/09/13 04:24:13 UTC

how to submit fixes?

I got the latest ORO out of anon CVS and fixed a bug in Perl5Matcher.java.  
How do I submit this for testing and/or incorporation?

The bug was that Perl5Matcher.contains was ignoring the BeginOffset property
of PatternMatcherInput with regards to matching the '^' anchor expression.

Here's a context diff:

Index: Perl5Matcher.java
===================================================================
RCS file: /home/cvspublic/jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Matcher.java,v
retrieving revision 1.3
diff -c -r1.3 Perl5Matcher.java
*** Perl5Matcher.java	2000/09/02 06:28:34	1.3
--- Perl5Matcher.java	2000/09/13 02:16:00
***************
*** 191,197 ****
  
    // Initialize globals needed before calling __tryExpression for first time
    private void __initInterpreterGlobals(Perl5Pattern expression, char[] input,
! 					int beginOffset, int endOffset) {
      __input                      = input;
      __endOffset                  = endOffset;
      __currentRep                 = new Perl5Repetition();
--- 191,197 ----
  
    // Initialize globals needed before calling __tryExpression for first time
    private void __initInterpreterGlobals(Perl5Pattern expression, char[] input,
! 					int beginLineOffset, int beginOffset, int endOffset) {
      __input                      = input;
      __endOffset                  = endOffset;
      __currentRep                 = new Perl5Repetition();
***************
*** 200,206 ****
      __program                    = expression._program;
      __stack.setSize(0);
  
!     if(beginOffset == 0)
        __previousChar = '\n';
      else {
        __previousChar = input[beginOffset - 1];
--- 200,206 ----
      __program                    = expression._program;
      __stack.setSize(0);
  
!     if(beginOffset == beginLineOffset)
        __previousChar = '\n';
      else {
        __previousChar = input[beginOffset - 1];
***************
*** 276,288 ****
    // __originalInput must be set before calling this method for
    // __lastMatchResult to be set correctly.
    private boolean __interpret(Perl5Pattern expression, char[] input,
! 			      int beginOffset, int endOffset)
    {
      boolean success;
      int minLength = 0, dontTry = 0, offset;
      char ch, mustString[];
  
!     __initInterpreterGlobals(expression, input, beginOffset, endOffset);
  
      success = false;
      mustString = expression._mustString;
--- 276,288 ----
    // __originalInput must be set before calling this method for
    // __lastMatchResult to be set correctly.
    private boolean __interpret(Perl5Pattern expression, char[] input,
! 			      int beginLineOffset, int beginOffset, int endOffset)
    {
      boolean success;
      int minLength = 0, dontTry = 0, offset;
      char ch, mustString[];
  
!     __initInterpreterGlobals(expression, input, beginLineOffset, beginOffset, endOffset);
  
      success = false;
      mustString = expression._mustString;
***************
*** 1244,1250 ****
      if(expression._isCaseInsensitive)
        input = _toLower(input);
  
!     __initInterpreterGlobals(expression, input, offset, input.length);
  
      __lastSuccess = __tryExpression(expression, offset);
      __lastMatchResult = null;
--- 1244,1250 ----
      if(expression._isCaseInsensitive)
        input = _toLower(input);
  
!     __initInterpreterGlobals(expression, input, 0, offset, input.length);
  
      __lastSuccess = __tryExpression(expression, offset);
      __lastMatchResult = null;
***************
*** 1322,1328 ****
      } else
        inp = __originalInput;
  
!     __initInterpreterGlobals(expression, inp, input._currentOffset,
  			    input._endOffset);
      __lastSuccess = __tryExpression(expression, input._currentOffset);
      __lastMatchResult = null;
--- 1322,1328 ----
      } else
        inp = __originalInput;
  
!     __initInterpreterGlobals(expression, inp, 0, input._currentOffset,
  			    input._endOffset);
      __lastSuccess = __tryExpression(expression, input._currentOffset);
      __lastMatchResult = null;
***************
*** 1384,1390 ****
  	return true;
      }
      */
!     __initInterpreterGlobals(expression, input, 0, input.length);
      __lastSuccess = (__tryExpression(expression, 0) &&
  		     __endMatchOffsets[0] == input.length);
      __lastMatchResult = null;
--- 1384,1390 ----
  	return true;
      }
      */
!     __initInterpreterGlobals(expression, input, 0, 0, input.length);
      __lastSuccess = (__tryExpression(expression, 0) &&
  		     __endMatchOffsets[0] == input.length);
      __lastMatchResult = null;
***************
*** 1513,1519 ****
      }
      */
  
!     __initInterpreterGlobals(expression, inp, input._beginOffset,
  			    input._endOffset);
  
      __lastMatchResult = null;
--- 1513,1519 ----
      }
      */
  
!     __initInterpreterGlobals(expression, inp, 0, input._beginOffset,
  			    input._endOffset);
  
      __lastMatchResult = null;
***************
*** 1609,1615 ****
      if(expression._isCaseInsensitive)
        input = _toLower(input);
  
!     return __interpret(expression, input, 0, input.length);
    }
  
  
--- 1609,1615 ----
      if(expression._isCaseInsensitive)
        input = _toLower(input);
  
!     return __interpret(expression, input, 0, 0, input.length);
    }
  
  
***************
*** 1713,1719 ****
      __lastMatchInputEndOffset = input.getMatchEndOffset();
  
      matchFound =
!       __interpret(expression, inp, input._currentOffset, input._endOffset);
  
      if(matchFound) {
        input.setCurrentOffset(__endMatchOffsets[0]);
--- 1713,1719 ----
      __lastMatchInputEndOffset = input.getMatchEndOffset();
  
      matchFound =
!       __interpret(expression, inp, input._beginOffset, input._currentOffset, input._endOffset);
  
      if(matchFound) {
        input.setCurrentOffset(__endMatchOffsets[0]);

Re: how to submit fixes?

Posted by Jon Stevens <jo...@latchkey.com>.
on 9/12/2000 7:24 PM, "jeff" <jl...@houseofdistraction.com> wrote:

> How do I submit this for testing and/or incorporation?

rtfm. :-)

<http://jakarta.apache.org/guidelines/index.html>

also, use diff -u in the future instead please.

since your patch seems a bit larger than most, i will let daniel comment on
it...

-jon

-- 
http://scarab.tigris.org/    | http://noodle.tigris.org/
http://java.apache.org/      | http://java.apache.org/turbine/
http://www.working-dogs.com/ | http://jakarta.apache.org/velocity/
http://www.collab.net/       | http://www.sourcexchange.com/



Re: fixes

Posted by Peter Kronenberg <pk...@predictivetechnologies.com>.
I am new to the world of CVS, so I'm not sure exactly what this 
means.  Where can I download the updated code?

thanks

At 9/15/2000  Friday  01:30 AM, you wrote:

>I don't know if oro-dev subscribers automatically get subscribed to
>oro-cvs, so I just wanted to report that I committed the fix that
>Jeff identified as well as some unrelated changes to Util.split.
>There were some minor problems with Jeff's patch, so the implementation of
>the fix is slightly different.  Thanks for identifying this bug Jeff.
>
>daniel



Re: how to submit fixes?

Posted by jeff <jl...@houseofdistraction.com>.
Peter Kronenberg wrote:
> How exactly does one go about applying your fix?  Do you know how long it
> takes for the fixed code to be available for downloading?

I don't know.  I thought one would just feed it into patch but patch
seems confused by '-c' diffs.  Attached is a '-u' diff which you can
copy into the regexp directory and execute the command
	patch -l <patchfile
(where "patchfile" is the filename of the diff) to fix
Perl5Matcher.java.  I am no expert at patch or diff YMMV.

Use the source from cvs to do this rather than the release tarball since
the latter has a broken build script.

-jeff

Re: how to submit fixes?

Posted by Peter Kronenberg <pk...@predictivetechnologies.com>.
Jeff,
   Thanks so much for finding and fixing this.  This is the exact thing I 
was trying to do.  I hadn't tried Daniel's suggestion yet, so I'm glad you 
saved me the frustration.

How exactly does one go about applying your fix?  Do you know how long it 
takes for the fixed code to be available for downloading?

At 9/12/2000  Tuesday  07:24 PM, you wrote:
>I got the latest ORO out of anon CVS and fixed a bug in Perl5Matcher.java.
>How do I submit this for testing and/or incorporation?
>
>The bug was that Perl5Matcher.contains was ignoring the BeginOffset property
>of PatternMatcherInput with regards to matching the '^' anchor expression.
>
>Here's a context diff:
>
>Index: Perl5Matcher.java
>===================================================================
>RCS file: 
>/home/cvspublic/jakarta-oro/src/java/org/apache/oro/text/regex/Perl5Matcher.java,v
>retrieving revision 1.3
>diff -c -r1.3 Perl5Matcher.java
>*** Perl5Matcher.java   2000/09/02 06:28:34     1.3
>--- Perl5Matcher.java   2000/09/13 02:16:00
>***************
>*** 191,197 ****
>
>     // Initialize globals needed before calling __tryExpression for first 
> time
>     private void __initInterpreterGlobals(Perl5Pattern expression, char[] 
> input,
>!                                       int beginOffset, int endOffset) {
>       __input                      = input;
>       __endOffset                  = endOffset;
>       __currentRep                 = new Perl5Repetition();
>--- 191,197 ----
>
>     // Initialize globals needed before calling __tryExpression for first 
> time
>     private void __initInterpreterGlobals(Perl5Pattern expression, char[] 
> input,
>!                                       int beginLineOffset, int 
>beginOffset, int endOffset) {
>       __input                      = input;
>       __endOffset                  = endOffset;
>       __currentRep                 = new Perl5Repetition();
>***************
>*** 200,206 ****
>       __program                    = expression._program;
>       __stack.setSize(0);
>
>!     if(beginOffset == 0)
>         __previousChar = '\n';
>       else {
>         __previousChar = input[beginOffset - 1];
>--- 200,206 ----
>       __program                    = expression._program;
>       __stack.setSize(0);
>
>!     if(beginOffset == beginLineOffset)
>         __previousChar = '\n';
>       else {
>         __previousChar = input[beginOffset - 1];
>***************
>*** 276,288 ****
>     // __originalInput must be set before calling this method for
>     // __lastMatchResult to be set correctly.
>     private boolean __interpret(Perl5Pattern expression, char[] input,
>!                             int beginOffset, int endOffset)
>     {
>       boolean success;
>       int minLength = 0, dontTry = 0, offset;
>       char ch, mustString[];
>
>!     __initInterpreterGlobals(expression, input, beginOffset, endOffset);
>
>       success = false;
>       mustString = expression._mustString;
>--- 276,288 ----
>     // __originalInput must be set before calling this method for
>     // __lastMatchResult to be set correctly.
>     private boolean __interpret(Perl5Pattern expression, char[] input,
>!                             int beginLineOffset, int beginOffset, int 
>endOffset)
>     {
>       boolean success;
>       int minLength = 0, dontTry = 0, offset;
>       char ch, mustString[];
>
>!     __initInterpreterGlobals(expression, input, beginLineOffset, 
>beginOffset, endOffset);
>
>       success = false;
>       mustString = expression._mustString;
>***************
>*** 1244,1250 ****
>       if(expression._isCaseInsensitive)
>         input = _toLower(input);
>
>!     __initInterpreterGlobals(expression, input, offset, input.length);
>
>       __lastSuccess = __tryExpression(expression, offset);
>       __lastMatchResult = null;
>--- 1244,1250 ----
>       if(expression._isCaseInsensitive)
>         input = _toLower(input);
>
>!     __initInterpreterGlobals(expression, input, 0, offset, input.length);
>
>       __lastSuccess = __tryExpression(expression, offset);
>       __lastMatchResult = null;
>***************
>*** 1322,1328 ****
>       } else
>         inp = __originalInput;
>
>!     __initInterpreterGlobals(expression, inp, input._currentOffset,
>                             input._endOffset);
>       __lastSuccess = __tryExpression(expression, input._currentOffset);
>       __lastMatchResult = null;
>--- 1322,1328 ----
>       } else
>         inp = __originalInput;
>
>!     __initInterpreterGlobals(expression, inp, 0, input._currentOffset,
>                             input._endOffset);
>       __lastSuccess = __tryExpression(expression, input._currentOffset);
>       __lastMatchResult = null;
>***************
>*** 1384,1390 ****
>         return true;
>       }
>       */
>!     __initInterpreterGlobals(expression, input, 0, input.length);
>       __lastSuccess = (__tryExpression(expression, 0) &&
>                      __endMatchOffsets[0] == input.length);
>       __lastMatchResult = null;
>--- 1384,1390 ----
>         return true;
>       }
>       */
>!     __initInterpreterGlobals(expression, input, 0, 0, input.length);
>       __lastSuccess = (__tryExpression(expression, 0) &&
>                      __endMatchOffsets[0] == input.length);
>       __lastMatchResult = null;
>***************
>*** 1513,1519 ****
>       }
>       */
>
>!     __initInterpreterGlobals(expression, inp, input._beginOffset,
>                             input._endOffset);
>
>       __lastMatchResult = null;
>--- 1513,1519 ----
>       }
>       */
>
>!     __initInterpreterGlobals(expression, inp, 0, input._beginOffset,
>                             input._endOffset);
>
>       __lastMatchResult = null;
>***************
>*** 1609,1615 ****
>       if(expression._isCaseInsensitive)
>         input = _toLower(input);
>
>!     return __interpret(expression, input, 0, input.length);
>     }
>
>
>--- 1609,1615 ----
>       if(expression._isCaseInsensitive)
>         input = _toLower(input);
>
>!     return __interpret(expression, input, 0, 0, input.length);
>     }
>
>
>***************
>*** 1713,1719 ****
>       __lastMatchInputEndOffset = input.getMatchEndOffset();
>
>       matchFound =
>!       __interpret(expression, inp, input._currentOffset, input._endOffset);
>
>       if(matchFound) {
>         input.setCurrentOffset(__endMatchOffsets[0]);
>--- 1713,1719 ----
>       __lastMatchInputEndOffset = input.getMatchEndOffset();
>
>       matchFound =
>!       __interpret(expression, inp, input._beginOffset, 
>input._currentOffset, input._endOffset);
>
>       if(matchFound) {
>         input.setCurrentOffset(__endMatchOffsets[0]);