Bug 14488 - toString() on Perl5Util throws null pointer exception
Summary: toString() on Perl5Util throws null pointer exception
Status: CLOSED FIXED
Alias: None
Product: ORO
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.0.6
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Jakarta Notifications Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-12 20:31 UTC by Ed Gow
Modified: 2005-03-20 17:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Gow 2002-11-12 20:31:43 UTC
The practice of having toString()in the ORO classes return the results of the 
last match or else throw null pointer exception is very detrimental to using 
the class in interpreted environments such as beanshell and probably jython. 
These environments call toString() as a matter of course after assigning a 
constructed object to a variable. It would be very helpful if the toString() 
method would return Object.toString() rather than throw a null pointer 
exception in the event that it is called before any match on the object.
Comment 1 Daniel F. Savarese 2002-11-14 00:38:40 UTC
The problem report is unclear.  It refers to "the practice ... in ORO classes",
but only Perl5Util throws a NullPointerException if toString() is called
when there is no match.  Perl5Util has to honor the MatchResult interface.
Returning Object.toString() violate the MatchResult contract.  However, it is
undesirable to throw an exception when MatchResult requires group() to return
null when there is no matched group and toString() returns group(0).  Therefore,
Perl5Util.toString() has been changed to return null if there is no match,
which is the original intended behavior.
Comment 2 Daniel F. Savarese 2003-03-06 03:45:33 UTC
Closing report as it's been fixed for a number of months.