[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Regexp] But report
From: |
Armbrust, Daniel C. |
Subject: |
[Regexp] But report |
Date: |
Wed, 31 Jul 2002 13:18:47 -0500 |
I think I have a bug identified in the regular expressions for java package,
latest version 1.1.4 (and going back to earlier versions)
I'm not what the proper way is to go about reporting it.
The method regularExpression.getMatchEnumeration returns an infinite
enumeration if you give it a FileInputStream as the object, and the file input
stream does not have a match at the end of the stream.
It works fine for other types of input objects.
Here is an example. Before you run this, create a file "c:\foo.txt" and put
something into the file, but do not put a line return at the end of the file.
import java.util.*;
import java.io.*;
public class infiniteLoopTest
{
public static void main(String[] args) throws Exception
{
gnu.regexp.RE regularExpression = new gnu.regexp.RE("[^\r\n]+");
//This causes an infinite loop if the file opened does not have the
match pattern at the end of the file.
FileInputStream temp = new FileInputStream(new File("c:\\foo.txt"));
gnu.regexp.REMatchEnumeration enumeration =
regularExpression.getMatchEnumeration(temp);
int i = 0;
while (enumeration.hasMoreElements())
{
System.out.println(enumeration.nextElement());
i++;
if (i > 5)
break;
}
}
}
*****************************
Daniel C. Armbrust
Medical Informatics Research
Information Services
Mayo Clinic Rochester
Harwick 8-36
(507) 538-1549
address@hidden
*****************************
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Regexp] But report,
Armbrust, Daniel C. <=