This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I was a bit surprised that this gave no overflow exception, and that java happily expands pattern to accept a too-large number, and that I have to, say, resort to comparing the length() of output to the length() of pattern, and create a custom exception if output "overflows".
Resorting to this seems a bit inelegant. After all, this is a concrete subclass of NumberFormat which is all about formatting numbers for display and reports and such, where field lengths matter quite a lot.
Is there anything in NumberFormat or its cousins that traps for overflowing numbers?