Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-906

Should never use Error to report runtime errors

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: None
    • Component/s: GVT
    • Labels:
      None
    • Environment:
      Operating System: Windows XP
      Platform: PC

      Description

      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?

        Attachments

          Activity

            People

            • Assignee:
              ssteiner Simon Steiner
              Reporter:
              sebb Sebb
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: