Can Pattern objects be stored in a Hashtable?

"Steve Cohen" <[email protected]> Fri, 10 May 2002 15:20:11 -0500
Newsgroups gmane.comp.jakarta.oro.user
Message-ID <[email protected]>
apparently not.  Granted, I am using a somewhat old version:

jakarta-oro-2.0.1.jar

Here is the problem, though.

I have a program that is attempting to iterate through a bunch of strings containing compilable patterns.  My program compiles each one and attempts to store it in a HashSet.  I find that the first pattern compiles and is stored, the second pattern compiles, but the HashSet.add() method that stores the pattern throws a stack overflow error.

java.lang.StackOverflowError
        at java.util.HashMap.access$000(HashMap.java:90)
        at java.util.HashMap$1.iterator(HashMap.java:487)
        at java.util.HashSet.iterator(HashSet.java:123)
        at java.util.AbstractSet.hashCode(AbstractSet.java:92)
        at java.util.AbstractSet.hashCode(AbstractSet.java:96)
        at java.util.AbstractSet.hashCode(AbstractSet.java:96)
        at java.util.AbstractSet.hashCode(AbstractSet.java:96)
        at java.util.AbstractSet.hashCode(AbstractSet.java:96)
etc.

Is this a bug that has been fixed in a later version?  Or is it a known problem?

I have looked (for the first time, I will admit) at the PatternCache, but it doesn't, I think, fit my needs.  Once my patterns are stored, all I want to do is walk through the whole bunch of them (we're not talking about vast numbers here, maybe 10) and try each one out looking for a match.

-----------------------------------------------------------------
Steve Cohen
Sr. Software Engineer
Ignite Sports, Inc.
[email protected]