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 
or (actual NB bug):

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 

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

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 
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?

View raw message