xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47171] New: Should never use Error to report runtime errors
Date Fri, 08 May 2009 22:57:11 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47171

           Summary: Should never use Error to report runtime errors
           Product: Batik
           Version: 1.7
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: GVT
        AssignedTo: batik-dev@xmlgraphics.apache.org
        ReportedBy: sebb@apache.org


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?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Mime
View raw message