[jira] [Commented] (BATIK-906) Should never use Error to report runtime errors

"simon steiner (JIRA)" <[email protected]>
Newsgroups gmane.text.xml.batik.devel
Message-ID <[email protected]>
    [ https://issues.apache.org/jira/browse/BATIK-906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16171782#comment-16171782 ] 

simon steiner commented on BATIK-906:
-------------------------------------

http://svn.apache.org/viewvc?view=revision&revision=1808888

> Should never use Error to report runtime errors
> -----------------------------------------------
>
>                 Key: BATIK-906
>                 URL: https://issues.apache.org/jira/browse/BATIK-906
>             Project: Batik
>          Issue Type: Bug
>          Components: GVT
>    Affects Versions: 1.7
>         Environment: Operating System: Windows XP
> Platform: PC
>            Reporter: Sebb
>            Assignee: Batik Developer's Mailing list
>
> TIFFImageEncoder uses Error to report unexpected conditions, e.g.
>         switch(dataType) {
>         case DataBuffer.TYPE_BYTE:
>             if(sampleSize[0] != 1 && sampleSize[0] == 4 &&
>                sampleSize[0] != 8) {
>                 throw new Error("TIFFImageEncoder2");
>             }
>             break;
> Using Error makes it hard to safely catch the exception, as there are some Errors that should not be caught (e.g. ThreadDeath)
> The code should use a more specific Error, e.g. RuntimeException or IllegalArgumentException or InvalidParameterException.
> There are over 70 classes where Error is thrown - please can these be changed to something more appropriate?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.