jakarta-regexp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ales Novak <ano...@netbeans.com>
Subject CharacterIterator
Date Wed, 09 May 2001 07:31:44 GMT
Hello everybody

Now, a lot of people here in NetBeans (http://www.netbeans.org), as well 
as I, are working on porting of NetBeans on upcoming JDK 1.4.

One of the bugs is 
http://developer.java.sun.com/developer/bugParade/bugs/4454355.html
or (actual NB bug):
http://www.netbeans.org/bugs-cgi/show_bug.cgi?id=11852

The bug is in fact a regression in IO system of 1.4 on Windows and as 
far as I know it was fixed yesterday, so it should be integrated in 1.4 
beta63/64.

But, in my opinion, the bug shows some weakness in the CharacterIterator 
interface.

Particularly, ReaderCharacterIterator, which implements the interface, 
reads data from a stream, so the reader should be able to propagate an 
IOException when it occures. Now, it folds the exception into a 
StringIndexOutOfBounds exception. Indeed, it is not a very smart solution.

What can we do?
1) ignore it - 99.99% of time it works
2) all methods of CharacterIterator can throw IOException or Exception
3) allow registering of a custom exception handler (new method to the 
interface)
More ideas here...

ad 2) I think that this could be the cleanest solution - all methods can 
throw e.g. CharacterIteratorException exception with the "Throwable 
getCause()" method.

On the other hand, this change is not backward compatible - i.e. you 
would need to add try { } catch {} block into your sources (unless the 
exception is a RuntimeException).

ad 3) It is backward compatible for users but not for people who 
implements the interface.

Any comments?
Thanks
Ales


Mime
View raw message